index.d.ts 264 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637
  1. //
  2. // Translation from Objects in help to Typescript interface.
  3. // http://js.cytoscape.org/#notation/functions
  4. // TypeScript Version: 2.3
  5. /**
  6. * WARNING: This is a provisional specification of the Cytoscape.js
  7. * API in TypeScript, based on improvements made on the Typescript
  8. * specification for Cytoscape.js in DefinitelyTyped. This is a work
  9. * in progress and may not be complete, and it may have errors. Please
  10. * report any issues to the issue tracker:
  11. *
  12. * https://github.com/cytoscape/cytoscape.js/issues
  13. *
  14. * cy --> Cy.Core
  15. * the core
  16. *
  17. * eles --> Cy.Collection
  18. * a collection of one or more elements (nodes and edges)
  19. *
  20. * ele --> Cy.Singular
  21. * a collection of a single element (node or edge)
  22. *
  23. * node --> Cy.NodeSingular
  24. * a collection of a single node
  25. *
  26. * nodes -> Cy.NodeCollection
  27. * a collection of one or more nodes
  28. *
  29. * edge --> Cy.EdgeSingular
  30. * a collection of a single edge
  31. *
  32. * edges -> Cy.EdgeCollection
  33. * a collection of one or more edges
  34. *
  35. * The library makes a distinction between input and output parameters
  36. * due to the dynamic behaviour of the Cytoscape library.
  37. *
  38. * For a input parameter it will always expect:
  39. * - Cy.Collection
  40. * The input can be any element (node and edge) collection.
  41. * - Cy.NodeCollection
  42. * The input must be a node collection.
  43. * - Cy.EdgeCollection
  44. * The input must be a edge collection.
  45. * - Cy.Singular
  46. * The input must be a single element.
  47. * - Cy.NodeSingular
  48. * The input must be a single node.
  49. * - Cy.EdgeSingular
  50. * The input must be a single edge.
  51. *
  52. * For a output of a function it will always give:
  53. * - Cy.Elements
  54. * The output is a collection of node and edge elements OR single element.
  55. * - Cy.EdgeCollection
  56. * The output is a collection of edge elements OR single edge.
  57. * - Cy.NodeCollection
  58. * The output is a collection of node elements OR single node.
  59. *
  60. * A number of interfaces contain nothing as they serve to collect interfaces.
  61. */
  62. export = cytoscape;
  63. export as namespace cytoscape;
  64. /**
  65. * WARNING: This is a provisional specification of the Cytoscape.js
  66. * API in TypeScript, based on improvements made on the Typescript
  67. * specification for Cytoscape.js in DefinitelyTyped. This is a work
  68. * in progress and may not be complete, and it may have errors. Please
  69. * report any issues to the issue tracker:
  70. *
  71. * https://github.com/cytoscape/cytoscape.js/issues
  72. */
  73. declare function cytoscape(options?: cytoscape.CytoscapeOptions): cytoscape.Core;
  74. declare function cytoscape(type: string, name: string): unknown;
  75. declare function cytoscape(type: string, name: string, registrant: any): void;
  76. declare namespace cytoscape {
  77. /***
  78. * extensions can add functionality to the registry for Cytoscape ,
  79. * to three different types of functionality can be added
  80. **/
  81. type CytoscapeRegistry = (type: "core" | "collection" | "layout", name: string, extension: unknown) => void;
  82. interface Position {
  83. x: number;
  84. y: number;
  85. }
  86. interface BoundingBox {
  87. x1: number;
  88. y1: number;
  89. x2: number;
  90. y2: number;
  91. w: number;
  92. h: number;
  93. }
  94. type CssStyleDeclaration = any;
  95. interface ElementDefinition {
  96. group?: ElementGroup;
  97. data: NodeDataDefinition | EdgeDataDefinition;
  98. /**
  99. * Scratchpad data (usually temp or nonserialisable data)
  100. */
  101. scratch?: Scratchpad;
  102. /**
  103. * The model position of the node (optional on init, mandatory after)
  104. */
  105. position?: Position;
  106. /**
  107. * can alternatively specify position in rendered on-screen pixels
  108. */
  109. renderedPosition?: Position;
  110. /**
  111. * Whether the element is selected (default false)
  112. */
  113. selected?: boolean;
  114. /**
  115. * Whether the selection state is mutable (default true)
  116. */
  117. selectable?: boolean;
  118. /**
  119. * When locked a node's position is immutable (default false)
  120. */
  121. locked?: boolean;
  122. /**
  123. * Wether the node can be grabbed and moved by the user
  124. */
  125. grabbable?: boolean;
  126. /**
  127. * Whether the element has passthrough panning enabled.
  128. */
  129. pannable?: boolean;
  130. /**
  131. * a space separated list of class names that the element has
  132. */
  133. classes?: string[] | string;
  134. /**
  135. * CssStyleDeclaration;
  136. */
  137. style?: CssStyleDeclaration;
  138. /**
  139. * you should only use `style`/`css` for very special cases; use classes instead
  140. */
  141. css?: Css.Node | Css.Edge;
  142. /**
  143. * an element can be in a removed state, these elements will be not part of the rendered graph
  144. */
  145. removed?: boolean;
  146. }
  147. interface ElementDataDefinition {
  148. /**
  149. * elided id => autogenerated id
  150. */
  151. id?: string;
  152. position?: Position;
  153. }
  154. interface EdgeDefinition extends ElementDefinition {
  155. group?: "edges";
  156. data: EdgeDataDefinition;
  157. }
  158. interface EdgeDataDefinition extends ElementDataDefinition {
  159. /**
  160. * the source node id (edge comes from this node)
  161. */
  162. source: string;
  163. /**
  164. * the target node id (edge goes to this node)
  165. */
  166. target: string;
  167. [key: string]: any;
  168. }
  169. interface NodeDefinition extends ElementDefinition {
  170. group?: "nodes";
  171. data: NodeDataDefinition;
  172. }
  173. interface NodeDataDefinition extends ElementDataDefinition {
  174. parent?: string;
  175. [key: string]: any;
  176. }
  177. interface CytoscapeOptions {
  178. ///////////////////////////////////////
  179. // very commonly used options:
  180. /**
  181. * A HTML DOM element in which the graph should be rendered.
  182. * This is optional if Cytoscape.js is run headlessly or if you initialise using jQuery (in which case your jQuery object already has an associated DOM element).
  183. *
  184. * The default is undefined.
  185. */
  186. container?: HTMLElement | null;
  187. /**
  188. * An array of [[Elements]] specified as plain objects. For convenience, this option can alternatively be specified as a promise that resolves to the elements JSON.
  189. */
  190. elements?:
  191. | ElementsDefinition
  192. | ElementDefinition[]
  193. | Promise<ElementsDefinition>
  194. | Promise<ElementDefinition[]>
  195. ;
  196. /**
  197. * The StylesheetJson (StylesheetJsonBlock[]) used to style the graph. For convenience, this option can alternatively be specified as a promise that resolves to the stylesheet.
  198. */
  199. style?: StylesheetJson | Promise<StylesheetJson>;
  200. /**
  201. * A plain object that specifies layout options.
  202. * Which layout is initially run is specified by the name field.
  203. * Refer to a layout's documentation for the options it supports.
  204. * If you want to specify your node positions yourself in your elements JSON,
  205. * you can use the preset layout — by default it does not set any positions,
  206. * leaving your nodes in their current positions
  207. * (e.g. specified in options.elements at initialisation time)
  208. */
  209. layout?: LayoutOptions;
  210. /**
  211. * A plain object that contains graph-level data (i.e. data that does not belong to any particular node or edge).
  212. */
  213. data?: Record<string, any>;
  214. ///////////////////////////////////////
  215. // initial viewport state:
  216. /**
  217. * The initial zoom level of the graph.
  218. * Make sure to disable viewport manipulation options, such as fit, in your layout so that it is not overridden when the layout is applied.
  219. * You can set options.minZoom and options.maxZoom to set restrictions on the zoom level.
  220. *
  221. * The default value is 1.
  222. */
  223. zoom?: number;
  224. /**
  225. * The initial panning position of the graph. Make sure to disable viewport manipulation options, such as fit,
  226. * in your layout so that it is not overridden when the layout is applied.
  227. */
  228. pan?: Position;
  229. ///////////////////////////////////////
  230. // interaction options?:
  231. /**
  232. * A minimum bound on the zoom level of the graph. The viewport can not be scaled smaller than this zoom level.
  233. *
  234. * The default value is 1e-50.
  235. */
  236. minZoom?: number;
  237. /**
  238. * A maximum bound on the zoom level of the graph. The viewport can not be scaled larger than this zoom level.
  239. *
  240. * The default value is 1e50.
  241. */
  242. maxZoom?: number;
  243. /**
  244. * Whether zooming the graph is enabled, both by user events and programmatically.
  245. *
  246. * The default value is true.
  247. */
  248. zoomingEnabled?: boolean;
  249. /**
  250. * Whether user events (e.g. mouse wheel, pinch-to-zoom) are allowed to zoom the graph. Programmatic changes to zoom are unaffected by this option.
  251. *
  252. * The default value is true.
  253. */
  254. userZoomingEnabled?: boolean;
  255. /**
  256. * Whether panning the graph is enabled, both by user events and programmatically.
  257. *
  258. * The default value is true.
  259. */
  260. panningEnabled?: boolean;
  261. /**
  262. * Whether user events (e.g. dragging the graph background) are allowed to pan the graph. Programmatic changes to pan are unaffected by this option.
  263. *
  264. * The default value is true.
  265. */
  266. userPanningEnabled?: boolean;
  267. /**
  268. * Whether box selection (i.e. drag a box overlay around, and release it to select) is enabled. If enabled, the user must taphold to pan the graph.
  269. *
  270. * The default value is false.
  271. */
  272. boxSelectionEnabled?: boolean;
  273. /**
  274. * A string indicating the selection behaviour from user input.
  275. * By default, this is set automatically for you based on the type of input device detected.
  276. * On touch devices, 'additive' is default — a new selection made by the user adds to the set of currenly selected elements.
  277. * On mouse-input devices, 'single' is default — a new selection made by the user becomes the entire set of currently selected elements (i.e. the previous elements are unselected).
  278. *
  279. * The default value is (isTouchDevice ? 'additive' : 'single').
  280. */
  281. selectionType?: SelectionType;
  282. /**
  283. * A nonnegative integer that indicates the maximum allowable distance that a user may move during a tap gesture,
  284. * on touch devices and desktop devices respectively.
  285. *
  286. * This makes tapping easier for users.
  287. * These values have sane defaults, so it is not advised to change these options unless you have very good reason for doing so.
  288. * Larger values will almost certainly have undesirable consequences.
  289. *
  290. * The default value is is 8.
  291. */
  292. touchTapThreshold?: number;
  293. /**
  294. * A nonnegative integer that indicates the maximum allowable distance that a user may move during a tap gesture,
  295. * on touch devices and desktop devices respectively.
  296. *
  297. * This makes tapping easier for users.
  298. * These values have sane defaults,
  299. * so it is not advised to change these options unless you have very good reason for doing so.
  300. * Larger values will almost certainly have undesirable consequences.
  301. *
  302. * The default value is 4.
  303. */
  304. desktopTapThreshold?: number;
  305. /**
  306. * Whether nodes should be locked (not draggable at all) by default (if true, overrides individual node state).
  307. *
  308. * The default value is false.
  309. */
  310. autolock?: boolean;
  311. /**
  312. * Whether nodes should be ungrabified (not grabbable by user) by default (if true, overrides individual node state).
  313. *
  314. * The default value is false.
  315. */
  316. autoungrabify?: boolean;
  317. /**
  318. * Whether nodes should be unselectified (immutable selection state) by default (if true, overrides individual element state).
  319. *
  320. * The default value is false.
  321. */
  322. autounselectify?: boolean;
  323. ///////////////////////////////////////
  324. // rendering options:
  325. /**
  326. * A convenience option that initialises the Core to run headlessly.
  327. * You do not need to set this in environments that are implicitly headless (e.g. Node.js).
  328. * However, it is handy to set headless: true if you want a headless Core in a browser.
  329. *
  330. * The default value is false.
  331. */
  332. headless?: boolean;
  333. /**
  334. * A boolean that indicates whether styling should be used.
  335. * For headless (i.e. outside the browser) environments,
  336. * display is not necessary and so neither is styling necessary — thereby speeding up your code.
  337. * You can manually enable styling in headless environments if you require it for a special case.
  338. * Note that it does not make sense to disable style if you plan on rendering the graph.
  339. *
  340. * The default value is true.
  341. */
  342. styleEnabled?: boolean;
  343. /**
  344. * When set to true, the renderer does not render edges while the viewport is being manipulated.
  345. * This makes panning, zooming, dragging, et cetera more responsive for large graphs.
  346. *
  347. * The default value is false.
  348. */
  349. hideEdgesOnViewport?: boolean;
  350. /**
  351. * when set to true, the renderer does not render labels while the viewport is being manipulated.
  352. * This makes panning, zooming, dragging, et cetera more responsive for large graphs.
  353. *
  354. * The default value is false.
  355. */
  356. hideLabelsOnViewport?: boolean;
  357. /**
  358. * When set to true, the renderer uses a texture (if supported) during panning and zooming instead of drawing the elements,
  359. * making large graphs more responsive.
  360. *
  361. * The default value is false.
  362. */
  363. textureOnViewport?: boolean;
  364. /**
  365. * When set to true, the renderer will use a motion blur effect to make the transition between frames seem smoother.
  366. * This can significantly increase the perceived performance for a large graphs.
  367. *
  368. * The default value is false.
  369. */
  370. motionBlur?: boolean;
  371. /**
  372. * When motionBlur: true, this value controls the opacity of motion blur frames.
  373. * Higher values make the motion blur effect more pronounced.
  374. *
  375. * The default value is 0.2.
  376. */
  377. motionBlurOpacity?: number;
  378. /**
  379. * Changes the scroll wheel sensitivity when zooming. This is a multiplicative modifier.
  380. * So, a value between 0 and 1 reduces the sensitivity (zooms slower), and a value greater than 1 increases the sensitivity (zooms faster).
  381. *
  382. * The default value is 1.
  383. */
  384. wheelSensitivity?: number;
  385. /**
  386. * Overrides the screen pixel ratio with a manually set value (1.0 or 0.666 recommended, if set).
  387. * This can be used to increase performance on high density displays by reducing the effective area that needs to be rendered.
  388. * If you want to use the hardware's actual pixel ratio at the expense of performance, you can set pixelRatio: 'auto'.
  389. *
  390. * The default value is 1.
  391. */
  392. pixelRatio?: number | "auto";
  393. /**
  394. * Enables the experimental WebGL mode.
  395. * WARNING: This is currently experimental, and may have API changes in future.
  396. */
  397. webgl?: boolean;
  398. /**
  399. * Prints debug info to the browser console.
  400. * (optional)
  401. * WARNING: This is currently experimental, and may have API changes in future.
  402. */
  403. webglDebug?: boolean;
  404. /**
  405. * The size of the WebGL texture.
  406. * (provisional, may change in future releases)
  407. * WARNING: This is currently experimental, and may have API changes in future.
  408. */
  409. webglTexSize?: number;
  410. /**
  411. * The number of rows in the WebGL texture.
  412. * (provisional, may change in future releases)
  413. * WARNING: This is currently experimental, and may have API changes in future.
  414. */
  415. webglTexRows?: number;
  416. /**
  417. * The batch size for WebGL.
  418. * (provisional, may change in future releases)
  419. * WARNING: This is currently experimental, and may have API changes in future.
  420. */
  421. webglBatchSize?: number;
  422. /**
  423. * The number of textures per batch in WebGL.
  424. * (provisional, may change in future releases)
  425. * WARNING: This is currently experimental, and may have API changes in future.
  426. */
  427. webglTexPerBatch?: number;
  428. }
  429. /**
  430. * cy --> Cy.Core
  431. * The core object is your interface to a graph.
  432. *
  433. * It is your entry point to Cytoscape.js:
  434. * All of the library’s features are accessed through this object.
  435. * http://js.cytoscape.org/#core
  436. */
  437. interface Core
  438. extends
  439. CoreGraphManipulation,
  440. CoreData,
  441. CoreGraphManipulationExt,
  442. CoreEvents,
  443. CoreViewportManipulation,
  444. CoreAnimation,
  445. CoreLayout,
  446. CoreStyle,
  447. CoreExport
  448. {}
  449. /**
  450. * These are the principle functions used to interact with the graph model.
  451. *
  452. * http://js.cytoscape.org/#core/graph-manipulation
  453. */
  454. interface CoreGraphManipulation {
  455. /**
  456. * Add elements to the graph and return them.
  457. */
  458. add(
  459. eles: ElementDefinition | ElementDefinition[] | ElementsDefinition | CollectionArgument,
  460. ): CollectionReturnValue;
  461. /**
  462. * Remove elements in collection or match the selector from the graph and return them.
  463. */
  464. remove(eles: CollectionArgument | Selector): CollectionReturnValue;
  465. /**
  466. * Get a collection from elements in the graph matching the specified selector or from an array of elements.
  467. * If no parameter is specified, an empty collection will be returned
  468. * options The options for the collection
  469. * removed A truthy value that sets whether the elements are in the removed state (true) or added to the graph (false, default).
  470. */
  471. collection(
  472. eleObjs?: ElementDefinition[] | CollectionArgument | Selector,
  473. options?: {
  474. removed?: true;
  475. }
  476. ): CollectionReturnValue;
  477. /**
  478. * check whether the specified id is in the collection
  479. */
  480. hasElementWithId(id: string): boolean;
  481. /**
  482. * Get an element from its ID in a very performant way.
  483. * http://js.cytoscape.org/#cy.getElementById
  484. */
  485. getElementById(id: string): CollectionReturnValue;
  486. /**
  487. * Get an element from its ID in a very performant way.
  488. * http://js.cytoscape.org/#cy.getElementById
  489. */
  490. $id(id: string): CollectionReturnValue;
  491. /**
  492. * Get elements in the graph matching the specified selector.
  493. * http://js.cytoscape.org/#cy.$
  494. */
  495. $(selector: Selector): CollectionReturnValue;
  496. /**
  497. * Get elements in the graph matching the specified selector.
  498. * http://js.cytoscape.org/#cy.$
  499. */
  500. elements(selector?: Selector): CollectionReturnValue;
  501. /**
  502. * Get nodes in the graph matching the specified selector.
  503. */
  504. nodes(selector?: Selector): NodeCollection;
  505. /**
  506. * Get edges in the graph matching the specified selector.
  507. */
  508. edges(selector?: Selector): EdgeCollection;
  509. /**
  510. * Get elements in the graph matching the specified selector or filter function.
  511. */
  512. filter(
  513. selector: Selector | ((ele: Singular, i: number, eles: CollectionArgument) => boolean),
  514. ): CollectionReturnValue;
  515. /**
  516. * Allow for manipulation of elements without triggering multiple style calculations or multiple redraws.
  517. * http://js.cytoscape.org/#cy.batch
  518. * A callback within which you can make batch updates to elements.
  519. */
  520. batch(callback: () => void): void;
  521. /**
  522. * Allow for manipulation of elements without triggering multiple style calculations or multiple redraws.
  523. * http://js.cytoscape.org/#cy.batch
  524. *
  525. * Starts batching manually (useful for asynchronous cases).
  526. */
  527. startBatch(): void;
  528. /**
  529. * Allow for manipulation of elements without triggering multiple style calculations or multiple redraws.
  530. * http://js.cytoscape.org/#cy.batch
  531. *
  532. * Ends batching manually (useful for asynchronous cases).
  533. */
  534. endBatch(): void;
  535. /**
  536. * Attaches the instance to the specified container for visualisation.
  537. * http://js.cytoscape.org/#cy.mount
  538. *
  539. * If the core instance is headless prior to calling cy.mount(), then
  540. * the instance will no longer be headless and the visualisation will
  541. * be shown in the specified container. If the core instance is
  542. * non-headless prior to calling cy.mount(), then the visualisation
  543. * is swapped from the prior container to the specified container.
  544. */
  545. mount(element: Element): void;
  546. /**
  547. * Remove the instance from its current container.
  548. * http://js.cytoscape.org/#cy.unmount
  549. *
  550. * This function sets the instance to be headless after unmounting from
  551. * the current container.
  552. */
  553. unmount(): void;
  554. /**
  555. * A convenience function to explicitly destroy the Core.
  556. * http://js.cytoscape.org/#cy.destroy
  557. */
  558. destroy(): void;
  559. /**
  560. * Get whether the instance of Cytoscape.js has been destroyed or not.
  561. * https://js.cytoscape.org/#cy.destroyed
  562. */
  563. destroyed(): boolean;
  564. }
  565. /**
  566. * https://js.cytoscape.org/#core/data
  567. */
  568. interface CoreData {
  569. /**
  570. * Read and write developer-defined data associated with the graph.
  571. * http://js.cytoscape.org/#cy.data
  572. */
  573. /**
  574. * Get the entire data object or a particular data field.
  575. * @alias attr
  576. *
  577. * @param name The name of the field to get.
  578. */
  579. data(name?: string): any;
  580. /**
  581. * Set a particular data field.
  582. * @alias attr
  583. *
  584. * @param name The name of the field to set.
  585. * @param value The value to set for the field (must be JSON-serializable).
  586. */
  587. data(name: string, value: any): this;
  588. /**
  589. * Update multiple data fields at once via an object.
  590. * @alias attr
  591. *
  592. * @param obj The object containing name-value pairs to update data fields (must be JSON-serializable).
  593. */
  594. data(obj: Record<string, any>): this;
  595. /**
  596. * Get the entire data object or a particular data field.
  597. *
  598. * @param name The name of the field to get. Get the entire data object
  599. */
  600. attr(name?: string): any;
  601. /**
  602. * Set a particular data field.
  603. *
  604. * @param name The name of the field to set.
  605. * @param value The value to set for the field (must be JSON-serializable).
  606. */
  607. attr(name: string, value: any): this;
  608. /**
  609. * Update multiple data fields at once via an object.
  610. *
  611. * @param obj The object containing name-value pairs to update data fields.
  612. */
  613. attr(obj: Record<string, any>): this;
  614. /**
  615. * Remove developer-defined data associated with the elements.
  616. * https://js.cytoscape.org/#cy.removeData
  617. * @alias removeAttr
  618. *
  619. * @param names A space-separated list of fields to delete.
  620. */
  621. removeData(names?: string): this;
  622. /**
  623. * Remove developer-defined data associated with the elements.
  624. * https://js.cytoscape.org/#cy.removeData
  625. *
  626. * @param names A space-separated list of fields to delete.
  627. */
  628. removeAttr(names?: string): this;
  629. }
  630. /**
  631. * http://js.cytoscape.org/#core/graph-manipulation
  632. * http://js.cytoscape.org/#extensions
  633. * These functions are intended for use in extensions.
  634. */
  635. interface CoreGraphManipulationExt {
  636. /**
  637. * Set the scratchpad at a particular namespace,
  638. * where temporary or non-JSON data can be stored.
  639. * App-level scratchpad data should use namespaces prefixed with underscore, like '_foo'.
  640. *
  641. * If no parameter provided, the entire scratchpad will be returned.
  642. * If only namespace provided, the scratchpad with the namespace will be returned.
  643. *
  644. * @param namespace A namespace string.
  645. * @param value The value to set at the specified namespace.
  646. */
  647. scratch(namespace?: string): Scratchpad;
  648. scratch(namespace: string, value: any): this;
  649. /**
  650. * Remove scratchpad data. You should remove scratchpad data only at your own namespaces.
  651. * http://js.cytoscape.org/#cy.removeScratch
  652. *
  653. * @param namespace A namespace string.
  654. */
  655. removeScratch(namespace: string): this;
  656. }
  657. /**
  658. * The principle events from the graph model.
  659. * http://js.cytoscape.org/#core/events
  660. */
  661. interface CoreEvents {
  662. /**
  663. * Bind to events that occur in the graph.
  664. *
  665. * @param events A space separated list of event names.
  666. * @param handler The handler function that is called when one of the specified events occurs.
  667. * @param selector A selector to specify elements for which the handler is triggered.
  668. * @param data A plain object which is passed to the handler in the event object argument.
  669. * @param eventsMap A map of event names to handler functions.
  670. */
  671. on(events: EventNames, handler: EventHandler): this;
  672. on(events: EventNames, selector: Selector, handler: EventHandler): this;
  673. on(events: EventNames, selector: Selector, data: any, handler: EventHandler): this;
  674. on(eventsMap: { [value: string]: EventHandler }, selector?: Selector, data?: any): this;
  675. bind(events: EventNames, handler: EventHandler): this;
  676. bind(events: EventNames, selector: Selector, handler: EventHandler): this;
  677. bind(events: EventNames, selector: Selector, data: any, handler: EventHandler): this;
  678. bind(eventsMap: { [value: string]: EventHandler }, selector?: Selector, data?: any): this;
  679. listen(events: EventNames, handler: EventHandler): this;
  680. listen(events: EventNames, selector: Selector, handler: EventHandler): this;
  681. listen(events: EventNames, selector: Selector, data: any, handler: EventHandler): this;
  682. listen(eventsMap: { [value: string]: EventHandler }, selector?: Selector, data?: any): this;
  683. addListener(events: EventNames, handler: EventHandler): this;
  684. addListener(events: EventNames, selector: Selector, handler: EventHandler): this;
  685. addListener(events: EventNames, selector: Selector, data: any, handler: EventHandler): this;
  686. addListener(eventsMap: { [value: string]: EventHandler }, selector?: Selector, data?: any): this;
  687. /**
  688. * Get a promise that is resolved with the first
  689. * of any of the specified events triggered on the graph.
  690. * @param events A space separated list of event names.
  691. * @param selector [optional] A selector to specify elements for which the handler is triggered.
  692. */
  693. promiseOn(events: EventNames, selector?: Selector): Promise<EventHandler>;
  694. pon(events: EventNames, selector?: Selector): Promise<EventHandler>;
  695. /**
  696. * Bind to events that occur in the graph, and trigger the handler only once.
  697. *
  698. * @param events A space separated list of event names.
  699. * @param handler The handler function that is called when one of the specified events occurs.
  700. */
  701. one(events: EventNames, handler: EventHandler): this;
  702. /**
  703. * Bind to events that occur in the graph, and trigger the handler only once.
  704. *
  705. * @param events A space separated list of event names.
  706. * @param handler The handler function that is called when one of the specified events occurs.
  707. * @param selector A selector to specify elements for which the handler is triggered.
  708. */
  709. one(events: EventNames, selector: Selector, handler: EventHandler): this;
  710. /**
  711. * Bind to events that occur in the graph, and trigger the handler only once.
  712. *
  713. * @param events A space separated list of event names.
  714. * @param handler The handler function that is called when one of the specified events occurs.
  715. * @param selector A selector to specify elements for which the handler is triggered.
  716. * @param data A plain object which is passed to the handler in the event object argument.
  717. */
  718. one(events: EventNames, selector: Selector, data: any, handler: EventHandler): this;
  719. /**
  720. * Bind to events that occur in the graph, and trigger the handler only once.
  721. *
  722. * @param eventsMap A map of event names to handler functions.
  723. * @param selector A selector to specify elements for which the handler is triggered.
  724. * @param data A plain object which is passed to the handler in the event object argument.
  725. */
  726. one(eventsMap: { [value: string]: EventHandler }, selector?: Selector, data?: any): this;
  727. /**
  728. * Remove event handlers.
  729. * http://js.cytoscape.org/#cy.off
  730. *
  731. * @param events A space separated list of event names.
  732. * @param selector [optional] The same selector used to bind to the events.
  733. * @param handler [optional] A reference to the handler function to remove.
  734. * @param eventsMap A map of event names to handler functions to remove.
  735. */
  736. off(events: EventNames, handler?: EventHandler): this;
  737. off(events: EventNames, selector: Selector, handler?: EventHandler): this;
  738. off(eventsMap: { [value: string]: EventHandler }, selector?: Selector): this;
  739. unbind(events: EventNames, handler?: EventHandler): this;
  740. unbind(events: EventNames, selector: Selector, handler?: EventHandler): this;
  741. unbind(eventsMap: { [value: string]: EventHandler }, selector?: Selector): this;
  742. unlisten(events: EventNames, handler?: EventHandler): this;
  743. unlisten(events: EventNames, selector: Selector, handler?: EventHandler): this;
  744. unlisten(eventsMap: { [value: string]: EventHandler }, selector?: Selector): this;
  745. removeListener(events: EventNames, handler?: EventHandler): this;
  746. removeListener(events: EventNames, selector: Selector | undefined, handler?: EventHandler): this;
  747. removeListener(eventsMap: { [value: string]: EventHandler }, selector?: Selector): this;
  748. /**
  749. * Remove all event handlers.
  750. * https://js.cytoscape.org/#cy.removeAllListeners
  751. */
  752. removeAllListeners(): this;
  753. /**
  754. * Trigger one or more events.
  755. *
  756. * @param events A space separated list of event names to trigger.
  757. * @param extraParams [optional] An array of additional parameters to pass to the handler.
  758. */
  759. trigger(events: EventNames, extraParams?: any[]): this;
  760. emit(events: EventNames, extraParams?: any[]): this;
  761. /**
  762. * Run a callback as soon as the graph becomes ready. If the graph is already ready, then the callback is called immediately.
  763. * @param fn The callback run as soon as the graph is ready, inside which this refers to the core (cy).
  764. */
  765. ready(fn: EventHandler): this;
  766. }
  767. interface ZoomOptionsModel {
  768. /** The position about which to zoom. */
  769. position: Position;
  770. }
  771. interface ZoomOptionsRendered {
  772. /** The rendered position about which to zoom. */
  773. renderedPosition: Position;
  774. }
  775. interface ZoomOptionsLevel {
  776. /** The zoom level to set. */
  777. level: number;
  778. }
  779. type ZoomOptions = number | (ZoomOptionsLevel & (ZoomOptionsModel | ZoomOptionsRendered));
  780. /**
  781. * http://js.cytoscape.org/#core/viewport-manipulation
  782. */
  783. interface CoreViewportManipulation {
  784. /**
  785. * Get the HTML DOM element in which the graph is visualised.
  786. * A null value is returned if the Core is headless.
  787. */
  788. container(): HTMLElement | null;
  789. /**
  790. * Pan the graph to the centre of a collection.
  791. *
  792. * @param eles The collection to centre upon.
  793. */
  794. center(eles?: CollectionArgument): this;
  795. /**
  796. * Pan the graph to the centre of a collection.
  797. *
  798. * @param eles The collection to centre upon.
  799. */
  800. centre(eles?: CollectionArgument): this;
  801. /**
  802. * Pan and zooms the graph to fit to a collection.
  803. * http://js.cytoscape.org/#cy.fit
  804. *
  805. * @param eles [optional] The collection to fit to.
  806. * @param padding [optional] An amount of padding (in pixels) to have around the graph
  807. */
  808. fit(eles?: CollectionArgument | Selector, padding?: number): this;
  809. /**
  810. * Reset the graph to the default zoom level and panning position.
  811. * http://js.cytoscape.org/#cy.reset
  812. */
  813. reset(): this;
  814. /**
  815. * Get the panning position of the graph.
  816. * http://js.cytoscape.org/#cy.pan
  817. */
  818. pan(): Position;
  819. /**
  820. * Set the panning position of the graph.
  821. * http://js.cytoscape.org/#cy.pan
  822. *
  823. * @param renderedPosition The rendered position to pan the graph to.
  824. */
  825. pan(renderedPosition?: Position): this;
  826. /**
  827. * Relatively pan the graph by a specified rendered position vector.
  828. * http://js.cytoscape.org/#cy.panBy
  829. *
  830. * @param renderedPosition The rendered position vector to pan the graph by.
  831. */
  832. panBy(renderedPosition: Position): this;
  833. /**
  834. * Get whether panning is enabled.
  835. * If cy.boxSelectionEnabled() === true, then the user
  836. * must taphold to initiate panning.
  837. * http://js.cytoscape.org/#cy.panningEnabled
  838. */
  839. panningEnabled(): boolean;
  840. /**
  841. * Set whether panning is enabled. If cy.boxSelectionEnabled() === true, then the user must taphold to initiate panning.
  842. * http://js.cytoscape.org/#cy.panningEnabled
  843. *
  844. * @param bool A truthy value enables panning; a falsey value disables it.
  845. */
  846. panningEnabled(bool?: boolean): this;
  847. /**
  848. * Get whether panning by user events (e.g. dragging the graph background) is enabled. If cy.boxSelectionEnabled() === true, then the user must taphold to initiate panning.
  849. * http://js.cytoscape.org/#cy.userPanningEnabled
  850. */
  851. userPanningEnabled(): boolean;
  852. /**
  853. * Set whether panning by user events (e.g. dragging the graph background) is enabled. If cy.boxSelectionEnabled() === true, then the user must taphold to initiate panning.
  854. * http://js.cytoscape.org/#cy.userPanningEnabled
  855. *
  856. * @param bool A truthy value enables user panning; a falsey value disables it.
  857. */
  858. userPanningEnabled(bool?: boolean): this;
  859. /**
  860. * Get the zoom level.
  861. * http://js.cytoscape.org/#cy.zoom
  862. */
  863. zoom(): number;
  864. /**
  865. * Set the zoom level.
  866. * http://js.cytoscape.org/#cy.zoom
  867. *
  868. * @param level The zoom level to set.
  869. * @param options The options for zooming.
  870. */
  871. zoom(level?: number | ZoomOptions): this;
  872. /**
  873. * Set or get whether zooming is enabled. Get if no parameter provided.
  874. * http://js.cytoscape.org/#cy.zoomingEnabled
  875. *
  876. * @param bool A truthy value enables zooming; a falsey value disables it.
  877. */
  878. zoomingEnabled(bool?: boolean): this;
  879. /**
  880. * Get whether zooming by user events (e.g. mouse wheel, pinch-to-zoom)
  881. * is enabled.
  882. * http://js.cytoscape.org/#cy.userZoomingEnabled
  883. */
  884. userZoomingEnabled(): boolean;
  885. /**
  886. * Get or set whether zooming by user events get if no parameter provided
  887. * (e.g. mouse wheel, pinch-to-zoom) is enabled.
  888. * http://js.cytoscape.org/#cy.userZoomingEnabled
  889. *
  890. * @param bool A truthy value enables user zooming; a falsey value disables it.
  891. */
  892. userZoomingEnabled(bool?: boolean): this;
  893. /**
  894. * Get the minimum zoom level.
  895. * http://js.cytoscape.org/#cy.minZoom
  896. */
  897. minZoom(): number;
  898. /**
  899. * Set the minimum zoom level.
  900. * http://js.cytoscape.org/#cy.minZoom
  901. *
  902. * @param zoom The new minimum zoom level to use.
  903. */
  904. minZoom(zoom: number): this;
  905. /**
  906. * Get the maximum zoom level.
  907. * http://js.cytoscape.org/#cy.maxZoom
  908. */
  909. maxZoom(): number;
  910. /**
  911. * Set the maximum zoom level.
  912. * http://js.cytoscape.org/#cy.maxZoom
  913. *
  914. * @param zoom The new maximum zoom level to use.
  915. */
  916. maxZoom(zoom: number): this;
  917. /**
  918. * Set the viewport state (pan & zoom) in one call.
  919. * http://js.cytoscape.org/#cy.viewport
  920. *
  921. * @param options The viewport options.
  922. * @param options.zoom The zoom level to set.
  923. * @param options.pan The pan to set (a rendered position).
  924. */
  925. viewport(options: { zoom: number; pan: Position }): this;
  926. /**
  927. * gets the viewport state (pan & zoom) in one call.
  928. * http://js.cytoscape.org/#cy.viewport
  929. *
  930. */
  931. getFitViewport(): {
  932. zoom: number;
  933. pan: Position;
  934. };
  935. /**
  936. * Get whether box selection is enabled.
  937. * If enabled, the user must hold left-click to initiate panning.
  938. * http://js.cytoscape.org/#cy.boxSelectionEnabled
  939. */
  940. boxSelectionEnabled(): boolean;
  941. /**
  942. * Set whether box selection is enabled.
  943. * If enabled, the user must hold left-click to initiate panning.
  944. * http://js.cytoscape.org/#cy.boxSelectionEnabled
  945. *
  946. * @param bool A truthy value enables box selection; a falsey value disables it.
  947. */
  948. boxSelectionEnabled(bool?: boolean): this;
  949. /**
  950. * Get the selection type.
  951. * http://js.cytoscape.org/#cy.selectionType
  952. */
  953. selectionType(): SelectionType;
  954. /**
  955. * Set the selection type.
  956. * http://js.cytoscape.org/#cy.selectionType
  957. *
  958. * @param type The selection type string; one of 'single' (default) or 'additive'.
  959. */
  960. selectionType(type: SelectionType): this;
  961. /**
  962. * Get the on-screen width of the viewport in pixels.
  963. * http://js.cytoscape.org/#cy.width
  964. */
  965. width(): number;
  966. /**
  967. * Get the on-screen height of the viewport in pixels.
  968. * http://js.cytoscape.org/#cy.height
  969. */
  970. height(): number;
  971. /**
  972. * Get the extent of the viewport, a bounding box in model
  973. * coordinates that lets you know what model
  974. * positions are visible in the viewport.
  975. * http://js.cytoscape.org/#cy.extent
  976. */
  977. extent(): BoundingBox;
  978. /**
  979. * Get the rendered extent of the viewport, a bounding box in rendered
  980. * coordinates that lets you know what rendered
  981. * positions are visible in the viewport.
  982. * http://js.cytoscape.org/#cy.renderedExtent
  983. */
  984. renderedExtent(): BoundingBox;
  985. /**
  986. * Get whether nodes are automatically locked
  987. * (i.e. if true, nodes are locked despite their individual state).
  988. * http://js.cytoscape.org/#cy.autolock
  989. */
  990. autolock(): boolean;
  991. /**
  992. * Set whether nodes are automatically locked
  993. * (i.e. if true, nodes are locked despite their individual state).
  994. * http://js.cytoscape.org/#cy.autolock
  995. *
  996. * @param bool A truthy value enables autolocking; a falsey value disables it.
  997. */
  998. autolock(bool?: boolean): this;
  999. /**
  1000. * Get whether nodes are automatically ungrabified
  1001. * (i.e. if true, nodes are ungrabbale despite their individual state).
  1002. * http://js.cytoscape.org/#cy.autoungrabify
  1003. */
  1004. autoungrabify(): boolean;
  1005. /**
  1006. * Set whether nodes are automatically ungrabified
  1007. * (i.e. if true, nodes are ungrabbale despite their individual state).
  1008. * http://js.cytoscape.org/#cy.autoungrabify
  1009. *
  1010. * @param bool A truthy value enables autolocking; a falsey value disables it.
  1011. */
  1012. autoungrabify(bool?: boolean): this;
  1013. /**
  1014. * Get whether nodes are automatically unselectified
  1015. * (i.e. if true, nodes are unselectable despite their individual state).
  1016. * http://js.cytoscape.org/#cy.autounselectify
  1017. */
  1018. autounselectify(): boolean;
  1019. /**
  1020. * Set whether nodes are automatically unselectified
  1021. * (i.e. if true, nodes are unselectable despite their individual state).
  1022. * http://js.cytoscape.org/#cy.autounselectify
  1023. *
  1024. * @param bool A truthy value enables autolocking; a falsey value disables it.
  1025. */
  1026. autounselectify(bool?: boolean): this;
  1027. /**
  1028. * Force the renderer to redraw (i.e. draw a new frame).
  1029. *
  1030. * This function forces the renderer to draw a new frame.
  1031. * It is useful for very specific edgecases, such as in certain UI plugins,
  1032. * but it should not be needed for most developers.
  1033. * http://js.cytoscape.org/#cy.forceRender
  1034. */
  1035. forceRender(): this;
  1036. /**
  1037. * Force the renderer to recalculate the viewport bounds.
  1038. *
  1039. * If your code resizes the graph's dimensions or position
  1040. * (i.e. by changing the style of the HTML DOM element that holds the graph),
  1041. * you will want to call cy.resize() to have the graph resize and redraw itself.
  1042. *
  1043. * Cytoscape.js can not automatically monitor the bounding box of the viewport,
  1044. * as querying the DOM for those dimensions can be expensive.
  1045. * Although cy.resize() is automatically called for you on the window's resize event,
  1046. * there is no resize or style event for arbitrary DOM elements.
  1047. * http://js.cytoscape.org/#cy.resize
  1048. */
  1049. resize(): this;
  1050. invalidateDimensions(): this;
  1051. }
  1052. /**
  1053. * http://js.cytoscape.org/#core/animation
  1054. */
  1055. interface AnimationFitOptions {
  1056. eles: CollectionArgument | Selector; // to which the viewport will be fitted.
  1057. padding: number; // Padding to use with the fitting.
  1058. }
  1059. interface CenterOptions {
  1060. eles: CollectionArgument | Selector; // to which the viewport will be selected.
  1061. }
  1062. interface AnimationOptions {
  1063. /** A zoom level to which the graph will be animated. */
  1064. zoom?: ZoomOptions;
  1065. /** A panning position to which the graph will be animated. */
  1066. pan?: Position;
  1067. /** A relative panning position to which the graph will be animated. */
  1068. panBy?: Position;
  1069. /** An object containing fitting options from which the graph will be animated. */
  1070. fit?: AnimationFitOptions;
  1071. /** An object containing centring options from which the graph will be animated. */
  1072. center?: CenterOptions;
  1073. /** easing - A transition-timing-function easing style string that shapes the animation progress curve. */
  1074. easing?: Css.TransitionTimingFunction;
  1075. /** duration - The duration of the animation in milliseconds. */
  1076. duration?: number;
  1077. }
  1078. interface AnimateOptions extends AnimationOptions {
  1079. /** queue - A boolean indicating whether to queue the animation. */
  1080. queue?: boolean;
  1081. /** complete - A function to call when the animation is done. */
  1082. complete?(): void;
  1083. /** step - A function to call each time the animation steps. */
  1084. step?(): void;
  1085. }
  1086. interface CoreAnimation {
  1087. /**
  1088. * Get whether the viewport is currently being animated.
  1089. * http://js.cytoscape.org/#cy.animated
  1090. */
  1091. animated(): boolean;
  1092. /**
  1093. * Animate the viewport.
  1094. * http://js.cytoscape.org/#cy.animate
  1095. *
  1096. * @param anis An object containing the details of the animation.
  1097. *
  1098. * @param options An object containing animation options.
  1099. */
  1100. animate(anis: AnimateOptions, options?: AnimateOptions): Core;
  1101. /**
  1102. * Get an animation of the viewport.
  1103. * http://js.cytoscape.org/#cy.animation
  1104. */
  1105. animation(options: AnimationOptions): AnimationManipulation;
  1106. /**
  1107. * Add a delay between animations for the viewport.
  1108. *
  1109. * @param duration How long the delay should be in milliseconds.
  1110. * @param complete A function to call when the delay is complete.
  1111. */
  1112. delay(duration: number, complete?: () => void): Core;
  1113. /**
  1114. * Get a delay animation of the viewport.
  1115. * http://js.cytoscape.org/#cy.delayAnimation
  1116. */
  1117. delayAnimation(duration: number): AnimationManipulation;
  1118. /**
  1119. * Stop all viewport animations that are currently running.
  1120. * http://js.cytoscape.org/#cy.stop
  1121. *
  1122. * @param clearQueue A boolean, indicating whether the queue of animations should be emptied.
  1123. * @param jumpToEnd A boolean, indicating whether the currently-running animations should jump to their ends rather than just stopping midway.
  1124. */
  1125. stop(clearQueue?: boolean, jumpToEnd?: boolean): Core;
  1126. /**
  1127. * Remove all queued animations for the viewport.
  1128. * http://js.cytoscape.org/#cy.clearQueue
  1129. */
  1130. clearQueue(): Core;
  1131. }
  1132. /**
  1133. * http://js.cytoscape.org/#core/layout
  1134. */
  1135. interface CoreLayout {
  1136. /**
  1137. * Run a layout, which algorithmically positions the nodes in the graph.
  1138. * For layouts included with Cytoscape.js, you can find their
  1139. * options documented in the Layouts section.
  1140. * For external layouts, please refer to their accompanying documentation.
  1141. *
  1142. * An analogue to run a layout on a subset of the graph exists as eles.layout().
  1143. * http://js.cytoscape.org/#cy.layout
  1144. */
  1145. layout(layout: LayoutOptions): Layouts;
  1146. /**
  1147. * Get a new layout, which can be used to algorithmically
  1148. * position the nodes in the graph.
  1149. *
  1150. * You must specify options.name with the name of the layout you wish to use.
  1151. *
  1152. * This function creates and returns a layout object.
  1153. * You may want to keep a reference to the layout for more advanced usecases,
  1154. * such as running multiple layouts simultaneously.
  1155. * Note that you must call layout.run() in order for it to affect the graph.
  1156. * An analogue to make a layout on a subset of the graph exists as eles.makeLayout().
  1157. */
  1158. makeLayout(options: LayoutOptions): Layouts;
  1159. createLayout(options: LayoutOptions): Layouts;
  1160. }
  1161. /**
  1162. * Get the entry point to modify the visual style of the graph after initialisation.
  1163. * http://js.cytoscape.org/#core/style
  1164. */
  1165. interface ElementStylesheetStyle extends StylesheetStyle {
  1166. json(): any;
  1167. }
  1168. interface ElementStylesheetCSS extends StylesheetCSS {
  1169. json(): any;
  1170. }
  1171. interface CoreStyle {
  1172. /**
  1173. * Assign a new stylesheet to replace the existing one (if provided)
  1174. * and return the style.
  1175. */
  1176. style(sheet?: StylesheetJsonBlock | StylesheetJsonBlock[] | string): Style;
  1177. }
  1178. interface Style {
  1179. /**
  1180. * Add a rule to the stylesheet.
  1181. */
  1182. append(style: string | StylesheetJsonBlock | StylesheetJsonBlock[]): this;
  1183. /**
  1184. * Remove all styles, including default styles.
  1185. */
  1186. clear(): this;
  1187. /**
  1188. * Set the style from JSON data.
  1189. * @example
  1190. * style.fromJson([
  1191. * {
  1192. * selector: 'node',
  1193. * style: {
  1194. * 'background-color': 'red'
  1195. * }
  1196. * }
  1197. * ]);
  1198. */
  1199. fromJson(json: any): this;
  1200. /**
  1201. * Set the style from a string.
  1202. * @example
  1203. * style.fromString('node { background-color: blue; }');
  1204. */
  1205. fromString(style: string): this;
  1206. /**
  1207. * Resets to the default stylesheet.
  1208. */
  1209. resetToDefault(): this;
  1210. /**
  1211. * Sets the selector context for defining styles.
  1212. * @example
  1213. * style.selector('foo').style('color', 'black');
  1214. */
  1215. selector(s: string): this;
  1216. /**
  1217. * Sets a style for the current selected selector.
  1218. * @example
  1219. * style.selector('foo').style('color', 'black');
  1220. */
  1221. style(key: string, value: string | number): this;
  1222. /**
  1223. * Sets a style for the current selected selector.
  1224. * @example
  1225. * style.selector('foo').style({color: 'black'});
  1226. */
  1227. style(css: Css.Node | Css.Edge): this;
  1228. /**
  1229. * Makes the changes active.
  1230. */
  1231. update(): void;
  1232. }
  1233. /**
  1234. * http://js.cytoscape.org/#cy.style
  1235. */
  1236. type StylesheetJsonBlock = StylesheetStyle | StylesheetCSS;
  1237. type StylesheetJson = StylesheetJsonBlock[];
  1238. interface StylesheetStyle {
  1239. selector: string;
  1240. style: Css.Node | Css.Edge | Css.Core;
  1241. }
  1242. /**
  1243. * http://js.cytoscape.org/#cy.style
  1244. */
  1245. interface StylesheetCSS {
  1246. selector: string;
  1247. css: Css.Node | Css.Edge | Css.Core;
  1248. }
  1249. /**
  1250. * http://js.cytoscape.org/#core/export
  1251. */
  1252. interface ExportOptions {
  1253. /**
  1254. * The background colour of the image (transparent by default).
  1255. */
  1256. bg?: string;
  1257. /**
  1258. * Whether to export the current viewport view (false, default) or the entire graph (true).
  1259. */
  1260. full?: boolean;
  1261. /**
  1262. * This value specifies a positive number that scales the size of the resultant image.
  1263. */
  1264. scale?: number;
  1265. /**
  1266. * Specifies the scale automatically in combination with maxHeight such that the resultant image is no wider than maxWidth.
  1267. */
  1268. maxWidth?: number;
  1269. /**
  1270. * Specifies the scale automatically in combination with maxWidth such that the resultant image is no taller than maxHeight.
  1271. */
  1272. maxHeight?: number;
  1273. }
  1274. interface ExportStringOptions extends ExportOptions {
  1275. /**
  1276. * output Whether the output should be 'base64uri' (default), 'base64', or 'blob'.
  1277. */
  1278. output?: "base64uri" | "base64";
  1279. }
  1280. interface ExportBlobOptions extends ExportOptions {
  1281. /**
  1282. * output Whether the output should be 'base64uri' (default), 'base64', or 'blob'.
  1283. */
  1284. output?: "blob";
  1285. }
  1286. interface ExportBlobPromiseOptions extends ExportOptions {
  1287. /**
  1288. * output Whether the output should be 'base64uri' (default), 'base64', 'blob', or 'blob-promise'.
  1289. */
  1290. output?: "blob-promise";
  1291. }
  1292. interface ExportJpgOptions extends ExportOptions {
  1293. /**
  1294. * quality Specifies the quality of the image from 0
  1295. * (low quality, low filesize) to 1 (high quality, high filesize).
  1296. * If not set, the browser's default quality value is used.
  1297. */
  1298. quality?: number;
  1299. }
  1300. interface ExportJpgStringOptions extends ExportJpgOptions, ExportStringOptions {}
  1301. interface ExportJpgBlobOptions extends ExportJpgOptions, ExportBlobOptions {}
  1302. interface ExportJpgBlobPromiseOptions extends ExportJpgOptions, ExportBlobPromiseOptions {}
  1303. interface CoreExport {
  1304. /**
  1305. * Export the current graph view as a PNG image in Base64 representation.
  1306. */
  1307. png(options?: ExportStringOptions): string;
  1308. png(options?: ExportBlobOptions): Blob;
  1309. png(options?: ExportBlobPromiseOptions): Promise<Blob>;
  1310. /**
  1311. * Export the current graph view as a JPG image in Base64 representation.
  1312. */
  1313. jpg(options?: ExportJpgStringOptions): string;
  1314. jpg(options?: ExportJpgBlobOptions): Blob;
  1315. jpg(options?: ExportJpgBlobPromiseOptions): Promise<Blob>;
  1316. /**
  1317. * Export the current graph view as a JPG image in Base64 representation.
  1318. */
  1319. jpeg(options?: ExportJpgStringOptions): string;
  1320. jpeg(options?: ExportJpgBlobOptions): Blob;
  1321. jpeg(options?: ExportJpgBlobPromiseOptions): Promise<Blob>;
  1322. /**
  1323. * Export the graph as JSON, the same format used at initialisation.
  1324. */
  1325. json(): {
  1326. elements: {
  1327. nodes?: ElementDefinition[];
  1328. edges?: ElementDefinition[];
  1329. };
  1330. } & Record<string, any>;
  1331. json(
  1332. json: {
  1333. elements:
  1334. | {
  1335. nodes?: ElementDefinition[];
  1336. edges?: ElementDefinition[];
  1337. }
  1338. | ElementDefinition[];
  1339. } & Record<string, any>
  1340. ): this;
  1341. }
  1342. /**
  1343. * eles --> Cy.Collection
  1344. * a collection of one or more elements (nodes and edges)
  1345. *
  1346. * The input can be any element (node and edge) collection.
  1347. * http://js.cytoscape.org/#collection
  1348. */
  1349. interface Collection<TOut = SingularElementReturnValue, TIn = SingularElementArgument>
  1350. extends
  1351. CollectionGraphManipulation,
  1352. CollectionEvents,
  1353. CollectionData,
  1354. CollectionPosition,
  1355. CollectionTraversing,
  1356. CollectionLayout,
  1357. CollectionSelection,
  1358. CollectionStyle,
  1359. CollectionAnimation,
  1360. CollectionComparision,
  1361. CollectionIteration<TIn, TOut>,
  1362. CollectionBuildingFiltering<TIn, TOut>,
  1363. CollectionAlgorithms
  1364. {}
  1365. /**
  1366. * ele --> Cy.Singular
  1367. * a collection of a single element (node or edge)
  1368. * NB: every singular collection is a general collection too (but not vice versa)!
  1369. */
  1370. interface Singular<TOut = SingularElementReturnValue, TIn = SingularElementArgument>
  1371. extends
  1372. Collection<TOut, TIn>,
  1373. SingularGraphManipulation,
  1374. SingularData,
  1375. SingularPosition,
  1376. SingularSelection,
  1377. SingularStyle,
  1378. SingularAnimation
  1379. {}
  1380. interface ElementsDefinition {
  1381. nodes: NodeDefinition[];
  1382. edges: EdgeDefinition[];
  1383. }
  1384. type EventHandler = (event: EventObject, ...extraParams: any) => void;
  1385. /**
  1386. * The output is a collection of node and edge elements OR single element.
  1387. */
  1388. type CollectionArgument = Collection | EdgeCollection | NodeCollection | SingularElementArgument;
  1389. type CollectionReturnValue = Collection & EdgeCollection & NodeCollection & SingularElementReturnValue;
  1390. /**
  1391. * edges -> Cy.EdgeCollection
  1392. * a collection of one or more edges
  1393. *
  1394. * The output is a collection of edge elements OR single edge.
  1395. */
  1396. interface EdgeCollection extends Collection<EdgeSingular, EdgeSingular>, EdgeCollectionTraversing {}
  1397. /**
  1398. * nodes -> Cy.NodeCollection
  1399. * a collection of one or more nodes
  1400. *
  1401. * The output is a collection of node elements OR single node.
  1402. */
  1403. interface NodeCollection
  1404. extends
  1405. Collection<NodeSingular, NodeSingular>,
  1406. NodeCollectionMetadata,
  1407. NodeCollectionPosition,
  1408. NodeCollectionTraversing,
  1409. NodeCollectionCompound,
  1410. NodeCollectionLayout
  1411. {}
  1412. type SingularElementArgument = EdgeSingular | NodeSingular;
  1413. type SingularElementReturnValue = EdgeSingular & NodeSingular;
  1414. /**
  1415. * edge --> Cy.EdgeSingular
  1416. * a collection of a single edge
  1417. */
  1418. interface EdgeSingular
  1419. extends
  1420. Singular<EdgeSingular, EdgeSingular>,
  1421. EdgeCollection,
  1422. EdgeSingularData,
  1423. EdgeSingularPoints,
  1424. EdgeSingularTraversing
  1425. {}
  1426. /**
  1427. * node --> Cy.NodeSingular
  1428. * a collection of a single node
  1429. */
  1430. interface NodeSingular
  1431. extends
  1432. Singular<NodeSingular, NodeSingular>,
  1433. NodeCollection,
  1434. NodeSingularMetadata,
  1435. NodeSingularPosition,
  1436. NodeSingularCompound,
  1437. NodeSingularLayout
  1438. {}
  1439. /**
  1440. * http://js.cytoscape.org/#collection/graph-manipulation
  1441. */
  1442. interface CollectionGraphManipulation {
  1443. /**
  1444. * Remove the elements from the graph.
  1445. * http://js.cytoscape.org/#eles.remove
  1446. */
  1447. remove(): CollectionReturnValue;
  1448. /**
  1449. * Put removed elements back into the graph.
  1450. * http://js.cytoscape.org/#eles.restore
  1451. */
  1452. restore(): CollectionReturnValue;
  1453. /**
  1454. * Get a new collection containing clones (i.e. copies) of the elements in the calling collection.
  1455. * http://js.cytoscape.org/#eles.clone
  1456. */
  1457. clone(): CollectionReturnValue;
  1458. /**
  1459. * Get a new collection containing clones (i.e. copies) of the elements in the calling collection.
  1460. * http://js.cytoscape.org/#eles.clone
  1461. */
  1462. copy(): CollectionReturnValue;
  1463. /**
  1464. * Effectively move edges to different nodes. The modified (actually new) elements are returned.
  1465. * http://js.cytoscape.org/#eles.move
  1466. */
  1467. move(location: { source?: string; target?: string }): EdgeCollection;
  1468. /**
  1469. * Effectively move nodes to different parent node. The modified (actually new) elements are returned.
  1470. * http://js.cytoscape.org/#eles.move
  1471. */
  1472. move(location: { parent: string | null }): NodeCollection;
  1473. }
  1474. /**
  1475. * http://js.cytoscape.org/#collection/graph-manipulation
  1476. */
  1477. interface SingularGraphManipulation {
  1478. /**
  1479. * Get the core instance that owns the element.
  1480. */
  1481. cy(): Core;
  1482. /**
  1483. * Get whether the element has been removed from the graph.
  1484. * http://js.cytoscape.org/#ele.removed
  1485. */
  1486. removed(): boolean;
  1487. /**
  1488. * Get whether the element is inside the graph (i.e. not removed).
  1489. * http://js.cytoscape.org/#ele.inside
  1490. */
  1491. inside(): boolean;
  1492. }
  1493. /**
  1494. * http://js.cytoscape.org/#collection/events
  1495. */
  1496. interface CollectionEvents {
  1497. /**
  1498. * http://js.cytoscape.org/#eles.on
  1499. * @param events A space separated list of event names.
  1500. * @param selector [optional] A delegate selector to specify child elements for which the handler runs.
  1501. * @param data extra data given to the handler.
  1502. * @param handler The handler function called when one of the specified events occurs. Takes the event object as a parameter.
  1503. */
  1504. on(events: EventNames, selector: string, data: any, handler: EventHandler): this;
  1505. on(events: EventNames, selector: string, handler: EventHandler): this;
  1506. on(events: EventNames, handler: EventHandler): this;
  1507. bind(events: EventNames, selector: string, data: any, handler: EventHandler): this;
  1508. bind(events: EventNames, selector: string, handler: EventHandler): this;
  1509. bind(events: EventNames, handler: EventHandler): this;
  1510. listen(events: EventNames, selector: string, data: any, handler: EventHandler): this;
  1511. listen(events: EventNames, selector: string, handler: EventHandler): this;
  1512. listen(events: EventNames, handler: EventHandler): this;
  1513. addListener(events: EventNames, selector: string, data: any, handler: EventHandler): this;
  1514. addListener(events: EventNames, selector: string, handler: EventHandler): this;
  1515. addListener(events: EventNames, handler: EventHandler): this;
  1516. /**
  1517. * http://js.cytoscape.org/#eles.promiseOn
  1518. * @alias pon
  1519. */
  1520. promiseOn(events: EventNames, selector?: string): Promise<EventHandler>;
  1521. pon(events: EventNames, selector?: string): Promise<EventHandler>;
  1522. /**
  1523. * @param events A space separated list of event names.
  1524. * @param selector [optional] A delegate selector to specify child elements for which the handler is triggered.
  1525. * @param data [optional] A plain object which is passed to the handler in the event object argument.
  1526. * @param function(event) The handler function that is called when one of the specified events occurs.
  1527. * @param event The event object.
  1528. * http://js.cytoscape.org/#eles.one
  1529. */
  1530. one(events: EventNames, selector: string, data: any, handler: EventHandler): this;
  1531. one(events: EventNames, selector: string, handler: EventHandler): this;
  1532. one(events: EventNames, handler: EventHandler): this;
  1533. /**
  1534. * http://js.cytoscape.org/#eles.once
  1535. */
  1536. once(events: EventNames, selector: string, data: any, handler: EventHandler): this;
  1537. once(events: EventNames, selector: string, handler: EventHandler): this;
  1538. once(events: EventNames, handler: EventHandler): this;
  1539. /**
  1540. * http://js.cytoscape.org/#eles.off
  1541. * @alias unbind, unlisten, removeListener
  1542. */
  1543. off(events: EventNames, selector?: string, handler?: EventHandler): this;
  1544. unbind(events: EventNames, selector?: string, handler?: EventHandler): this;
  1545. unlisten(events: EventNames, selector?: string, handler?: EventHandler): this;
  1546. removeListener(events: EventNames, selector?: string, handler?: EventHandler): this;
  1547. /**
  1548. * https://js.cytoscape.org/#eles.removeAllListeners
  1549. */
  1550. removeAllListeners(): this;
  1551. /**
  1552. * http://js.cytoscape.org/#eles.trigger
  1553. * @alias emit
  1554. */
  1555. trigger(events: EventNames, extra?: unknown[]): this;
  1556. emit(events: EventNames, extra?: unknown[]): this;
  1557. }
  1558. /**
  1559. * http://js.cytoscape.org/#collection/data
  1560. *
  1561. * The following fields are immutable:
  1562. * id: The id field is used to uniquely identify an element in the graph.
  1563. * source & target : These fields define an edge's relationship to nodes, and this relationship can not be changed after creation.
  1564. * parent: The parent field defines the parent (compound) node.
  1565. */
  1566. interface CollectionData {
  1567. /**
  1568. * Read and write developer-defined data associated with the elements
  1569. * http://js.cytoscape.org/#eles.data
  1570. */
  1571. /**
  1572. * Get a particular data field for the element.
  1573. * @param name The name of the field to get.
  1574. */
  1575. data(name?: string): any;
  1576. /**
  1577. * Set a particular data field for the element.
  1578. * @param name The name of the field to set.
  1579. * @param value The value to set for the field (must be JSON-serializable).
  1580. */
  1581. data(name: string, value: any): this;
  1582. /**
  1583. * Update multiple data fields at once via an object.
  1584. * @param obj The object containing name- value pairs to update data fields (must be JSON-serializable).
  1585. */
  1586. data(obj: any): this;
  1587. /**
  1588. * Get a particular data field for the element.
  1589. * @param name The name of the field to get.
  1590. */
  1591. attr(name?: string): any;
  1592. /**
  1593. * Set a particular data field for the element.
  1594. * @param name The name of the field to set.
  1595. * @param value The value to set for the field (must be JSON-serializable).
  1596. */
  1597. attr(name: string, value: any): this;
  1598. /**
  1599. * Update multiple data fields at once via an object.
  1600. * @param obj The object containing name- value pairs to update data fields.
  1601. */
  1602. attr(obj: any): this;
  1603. /**
  1604. * Remove developer-defined data associated with the elements.
  1605. * http://js.cytoscape.org/#eles.removeData
  1606. * @param names A space-separated list of fields to delete.
  1607. */
  1608. removeData(...names: string[]): CollectionReturnValue;
  1609. removeAttr(...names: string[]): CollectionReturnValue;
  1610. /**
  1611. * Get an array of the plain JavaScript object
  1612. * representation of all elements in the collection.
  1613. */
  1614. jsons(): Record<string, any>[];
  1615. }
  1616. /**
  1617. * http://js.cytoscape.org/#collection/data
  1618. */
  1619. interface SingularData {
  1620. /**
  1621. * Get or set the scratchpad at a particular namespace,
  1622. * where temporary or non-JSON data can be stored.
  1623. * Get scratchpad if one or no parameter provided.
  1624. * App-level scratchpad data should use namespaces
  1625. * prefixed with underscore, like '_foo'.
  1626. * http://js.cytoscape.org/#ele.scratch
  1627. * @param namespace A namespace string.
  1628. * @param value The value to set at the specified namespace.
  1629. */
  1630. scratch(namespace?: string): Scratchpad;
  1631. scratch(namespace: string, value: any): this;
  1632. /**
  1633. * Remove scratchpad data.
  1634. * You should remove scratchpad data only at your own namespaces.
  1635. * http://js.cytoscape.org/#ele.removeScratch
  1636. * @param namespace A namespace string.
  1637. */
  1638. removeScratch(namespace: string): this;
  1639. /**
  1640. * A shortcut to get the ID of an element.
  1641. * http://js.cytoscape.org/#ele.id
  1642. */
  1643. id(): string;
  1644. /**
  1645. * Get the or set with element's plain JavaScript object representation
  1646. * http://js.cytoscape.org/#ele.json
  1647. */
  1648. json(obj?: Record<string, any>): Record<string, any>;
  1649. /**
  1650. * Get the group string that defines the type of the element.
  1651. *
  1652. * The group strings are 'nodes' for nodes and 'edges' for edges.
  1653. * In general, you should be using ele.isEdge()
  1654. * and ele.isNode() instead of ele.group().
  1655. * http://js.cytoscape.org/#ele.group
  1656. */
  1657. group(): ElementGroup;
  1658. /**
  1659. * Get whether the element is a node.
  1660. * http://js.cytoscape.org/#ele.isNode
  1661. */
  1662. isNode(): this is NodeSingular;
  1663. /**
  1664. * Get whether the element is an edge.
  1665. * http://js.cytoscape.org/#ele.isEdge
  1666. */
  1667. isEdge(): this is EdgeSingular;
  1668. /**
  1669. * Get the connected component for the calling element.
  1670. * The component considers all elements in the graph.
  1671. * http://js.cytoscape.org/#ele.component
  1672. */
  1673. component(): CollectionReturnValue;
  1674. }
  1675. /**
  1676. * http://js.cytoscape.org/#collection/data
  1677. */
  1678. interface EdgeSingularData {
  1679. /**
  1680. * Get whether the edge is a loop (i.e. source same as target).
  1681. * http://js.cytoscape.org/#edge.isLoop
  1682. */
  1683. isLoop(): boolean;
  1684. /**
  1685. * Get whether the edge is simple (i.e. source different than target).
  1686. * http://js.cytoscape.org/#edge.isSimple
  1687. */
  1688. isSimple(): boolean;
  1689. }
  1690. /**
  1691. * http://js.cytoscape.org/#collection/metadata
  1692. */
  1693. interface NodeSingularMetadata {
  1694. /**
  1695. * Get the degree of a node.
  1696. * @param includeLoops A boolean, indicating whether loops are to be included in degree calculations.
  1697. */
  1698. degree(includeLoops?: boolean): number;
  1699. /**
  1700. * Get the indegree of a node.
  1701. * @param includeLoops A boolean, indicating whether loops are to be included in degree calculations.
  1702. */
  1703. indegree(includeLoops?: boolean): number;
  1704. /**
  1705. * Get the outdegree of a node.
  1706. * @param includeLoops A boolean, indicating whether loops are to be included in degree calculations.
  1707. */
  1708. outdegree(includeLoops?: boolean): number;
  1709. }
  1710. /**
  1711. * http://js.cytoscape.org/#collection/metadata
  1712. */
  1713. interface NodeCollectionMetadata {
  1714. /**
  1715. * Get the total degree of a collection of nodes.
  1716. * @param includeLoops A boolean, indicating whether loops are to be included in degree calculations.
  1717. */
  1718. totalDegree(includeLoops?: boolean): number;
  1719. /**
  1720. * Get the minimum degree of the nodes in the collection.
  1721. * @param includeLoops A boolean, indicating whether loops are to be included in degree calculations.
  1722. */
  1723. minDegree(includeLoops?: boolean): number;
  1724. /**
  1725. * Get the maximum degree of the nodes in the collection.
  1726. * @param includeLoops A boolean, indicating whether loops are to be included in degree calculations.
  1727. */
  1728. maxDegree(includeLoops?: boolean): number;
  1729. /**
  1730. * Get the minimum indegree of the nodes in the collection.
  1731. * @param includeLoops A boolean, indicating whether loops are to be included in degree calculations.
  1732. */
  1733. minIndegree(includeLoops?: boolean): number;
  1734. /**
  1735. * Get the maximum indegree of the nodes in the collection.
  1736. * @param includeLoops A boolean, indicating whether loops are to be included in degree calculations.
  1737. */
  1738. maxIndegree(includeLoops?: boolean): number;
  1739. /**
  1740. * Get the minimum outdegree of the nodes in the collection.
  1741. * @param includeLoops A boolean, indicating whether loops are to be included in degree calculations.
  1742. */
  1743. minOutdegree(includeLoops?: boolean): number;
  1744. /**
  1745. * Get the maximum outdegree of the nodes in the collection.
  1746. * @param includeLoops A boolean, indicating whether loops are to be included in degree calculations.
  1747. */
  1748. maxOutdegree(includeLoops?: boolean): number;
  1749. }
  1750. /**
  1751. * http://js.cytoscape.org/#collection/position--dimensions
  1752. */
  1753. interface NodeSingularPosition {
  1754. /**
  1755. * Get the (model) position of a node.
  1756. */
  1757. position(): Position;
  1758. /**
  1759. * Get the value of a specified position dimension.
  1760. * @param dimension The position dimension to set.
  1761. * @param value The value to set to the dimension.
  1762. */
  1763. position(dimension: PositionDimension): number;
  1764. /**
  1765. * Set the value of a specified position dimension.
  1766. * @param dimension The position dimension to set.
  1767. * @param value The value to set to the dimension.
  1768. */
  1769. position(dimension: PositionDimension, value: number): this;
  1770. /**
  1771. * Set the position using name-value pairs in the specified object.
  1772. * @param pos An object specifying name-value pairs representing dimensions to set.
  1773. */
  1774. position(pos: Position): this;
  1775. /**
  1776. * Get the (model) position of a node.
  1777. */
  1778. modelPosition(): Position;
  1779. /**
  1780. * Get the value of a specified position dimension.
  1781. * @param dimension The position dimension to set.
  1782. * @param value The value to set to the dimension.
  1783. */
  1784. modelPosition(dimension: PositionDimension): number;
  1785. /**
  1786. * Set the value of a specified position dimension.
  1787. * @param dimension The position dimension to set.
  1788. * @param value The value to set to the dimension.
  1789. */
  1790. modelPosition(dimension: PositionDimension, value: number): this;
  1791. /**
  1792. * Set the position using name-value pairs in the specified object.
  1793. * @param pos An object specifying name-value pairs representing dimensions to set.
  1794. */
  1795. modelPosition(pos: Position): this;
  1796. /**
  1797. * Get the (model) position of a node.
  1798. */
  1799. point(): Position;
  1800. /**
  1801. * Get the value of a specified position dimension.
  1802. * @param dimension The position dimension to set.
  1803. * @param value The value to set to the dimension.
  1804. */
  1805. point(dimension: PositionDimension): number;
  1806. /**
  1807. * Set the value of a specified position dimension.
  1808. * @param dimension The position dimension to set.
  1809. * @param value The value to set to the dimension.
  1810. */
  1811. point(dimension: PositionDimension, value: number): this;
  1812. /**
  1813. * Set the position using name-value pairs in the specified object.
  1814. * @param pos An object specifying name-value pairs representing dimensions to set.
  1815. */
  1816. point(pos: Position): this;
  1817. /**
  1818. * Get or set the rendered (on-screen) position of a node.
  1819. * http://js.cytoscape.org/#node.renderedPosition
  1820. */
  1821. /**
  1822. * Get the value of a specified rendered position dimension.
  1823. * @param dimension The position dimension to get.
  1824. * @param value The value to set to the dimension.
  1825. * @param pos An object specifying name-value pairs representing dimensions to set.
  1826. */
  1827. renderedPosition(dimension?: PositionDimension): Position;
  1828. renderedPosition(dimension: PositionDimension, value: Position): this;
  1829. renderedPosition(pos: { [name: string]: number }): this;
  1830. /**
  1831. * Set the value of a specified rendered position dimension.
  1832. * @param dimension The position dimension to set.
  1833. * @param value The value to set to the dimension.
  1834. * @param pos An object specifying name-value pairs representing dimensions to set.
  1835. */
  1836. renderedPoint(dimension?: PositionDimension): Position;
  1837. renderedPoint(dimension: PositionDimension, value: Position): this;
  1838. renderedPoint(pos: { [name: string]: number }): this;
  1839. /**
  1840. * http://js.cytoscape.org/#node.relativePosition
  1841. */
  1842. /**
  1843. * Get the value of a specified relative position dimension.
  1844. * @param dimension The position dimension to get.
  1845. * @param value The value to set to the dimension.
  1846. * @param pos An object specifying name-value pairs representing dimensions to set.
  1847. */
  1848. relativePosition(dimension?: PositionDimension): Position;
  1849. relativePosition(dimension: PositionDimension, value: Position): this;
  1850. relativePosition(pos: { [name: string]: number }): this;
  1851. /**
  1852. * Get the value of a specified relative position dimension.
  1853. * @param dimension The position dimension to get.
  1854. * @param value The value to set to the dimension.
  1855. * @param pos An object specifying name-value pairs representing dimensions to set.
  1856. */
  1857. relativePoint(dimension?: PositionDimension): Position;
  1858. relativePoint(dimension: PositionDimension, value: Position): this;
  1859. relativePoint(pos: { [name: string]: number }): this;
  1860. /**
  1861. * Get whether a node is currently grabbed, meaning the user has hold of the node.
  1862. * http://js.cytoscape.org/#node.grabbed
  1863. */
  1864. grabbed(): boolean;
  1865. /**
  1866. * Get whether the user can grab a node.
  1867. * http://js.cytoscape.org/#node.grabbable
  1868. */
  1869. grabbable(): boolean;
  1870. /**
  1871. * Get whether a node is locked, meaning that its position can not be changed.
  1872. * http://js.cytoscape.org/#node.locked
  1873. */
  1874. locked(): boolean;
  1875. }
  1876. /**
  1877. * @param ele The element being iterated over for which the function should return a position to set.
  1878. * @param ix The index of the element when iterating over the elements in the collection.
  1879. */
  1880. type ElementPositionFunction = (ele: NodeSingular, ix: number) => Position;
  1881. type ElementCollectionFunction = (ele: NodeSingular, ix: number, eles: CollectionArgument) => Position;
  1882. /**
  1883. * http://js.cytoscape.org/#collection/position--dimensions
  1884. */
  1885. interface NodeCollectionPosition {
  1886. /**
  1887. * Shift the positions of the nodes by a given model position vector.
  1888. * @param dimension The position dimension to shift.
  1889. * @param value The value to shift the dimension.
  1890. */
  1891. shift(dimension: PositionDimension, value?: number): this;
  1892. /**
  1893. * Shift the positions of the nodes by a given model position vector.
  1894. * @param pos An object specifying name-value pairs representing dimensions to shift.
  1895. */
  1896. shift(pos: Position): this;
  1897. /**
  1898. * Set the positions via a function.
  1899. * @param handler A callback function that returns the position to set for each element.
  1900. * @param pos An object specifying name-value pairs representing dimensions to set.
  1901. * http://js.cytoscape.org/#nodes.positions
  1902. */
  1903. positions(handler: ElementPositionFunction | Position): this;
  1904. modelPositions(handler: ElementPositionFunction | Position): this;
  1905. points(handler: ElementPositionFunction | Position): this;
  1906. /**
  1907. * Allow the user to grab the nodes.
  1908. * http://js.cytoscape.org/#nodes.grabify
  1909. */
  1910. grabify(): this;
  1911. /**
  1912. * Disallow the user to grab the nodes.
  1913. * http://js.cytoscape.org/#nodes.ungrabify
  1914. */
  1915. ungrabify(): this;
  1916. /**
  1917. * Lock the nodes such that their positions can not be changed.
  1918. * http://js.cytoscape.org/#nodes.lock
  1919. */
  1920. lock(): this;
  1921. /**
  1922. * Unlock the nodes such that their positions can be changed.
  1923. * http://js.cytoscape.org/#nodes.unlock
  1924. */
  1925. unlock(): this;
  1926. /**
  1927. * Gets whether the element allows passthrough panning.
  1928. * http://js.cytoscape.org/#ele.pannable
  1929. */
  1930. pannable(): boolean;
  1931. /**
  1932. * Enables passthrough panning on the elements.
  1933. * http://js.cytoscape.org/#eles.panify
  1934. */
  1935. panify(): this;
  1936. /**
  1937. * Disables passthrough panning on the elements.
  1938. * http://js.cytoscape.org/#eles.unpanify
  1939. */
  1940. unpanify(): this;
  1941. }
  1942. /**
  1943. * http://js.cytoscape.org/#collection/position--dimensions
  1944. */
  1945. interface SingularPosition {
  1946. /**
  1947. * Get the width of the element.
  1948. */
  1949. width(): number;
  1950. /**
  1951. * Get the outer width of the element (includes width, padding, & border).
  1952. */
  1953. outerWidth(): number;
  1954. /**
  1955. * Get the width of the element in rendered dimensions.
  1956. */
  1957. renderedWidth(): number;
  1958. /**
  1959. * Get the outer width of the element (includes width, padding, & border) in rendered dimensions.
  1960. */
  1961. renderedOuterWidth(): number;
  1962. /**
  1963. * Get the height of the element.
  1964. */
  1965. height(): number;
  1966. /**
  1967. * Get the outer height of the element (includes height, padding, & border).
  1968. */
  1969. outerHeight(): number;
  1970. /**
  1971. * Get the height of the element in rendered dimensions.
  1972. */
  1973. renderedHeight(): number;
  1974. /**
  1975. * Get the outer height of the element (includes height, padding, & border) in rendered dimensions.
  1976. */
  1977. renderedOuterHeight(): number;
  1978. /**
  1979. * Gets whether the element is active (e.g. on user tap, grab, etc).
  1980. * http://js.cytoscape.org/#ele.active
  1981. */
  1982. active(): boolean;
  1983. }
  1984. interface BoundingBoxOptions {
  1985. /** A boolean indicating whether to include nodes in the bounding box (default true). */
  1986. includeNodes?: boolean;
  1987. /** A boolean indicating whether to include edges in the bounding box (default true). */
  1988. includeEdges?: boolean;
  1989. /** A boolean indicating whether to include labels in the bounding box (default true). */
  1990. includeLabels?: boolean;
  1991. /** A boolean indicating whether to include main (node or edge) labels in the bounding box (default true). */
  1992. includeMainLabels?: boolean;
  1993. /** A boolean indicating whether to include (edge) source-labels in the bounding box (default true). */
  1994. includeSourceLabels?: boolean;
  1995. /** A boolean indicating whether to include (edge) target-labels in the bounding box (default true). */
  1996. includeTargetLabels?: boolean;
  1997. /** A boolean indicating whether to include overlays (such as the one which appears when a node is clicked) in the bounding box (default true). */
  1998. includeOverlays?: boolean;
  1999. /** A boolean indicating whether to include underlays in the bounding box (default: true). */
  2000. includeUnderlays?: boolean;
  2001. }
  2002. /**
  2003. * http://js.cytoscape.org/#collection/position--dimensions
  2004. */
  2005. interface CollectionPosition {
  2006. /**
  2007. * Get the bounding box of the elements in model coordinates.
  2008. * @param options An object containing options for the function.
  2009. * http://js.cytoscape.org/#eles.boundingBox
  2010. */
  2011. boundingBox(options?: BoundingBoxOptions): BoundingBox12 & BoundingBoxWH;
  2012. boundingbox(options?: BoundingBoxOptions): BoundingBox12 & BoundingBoxWH;
  2013. /**
  2014. * Get the bounding box of the elements in rendered coordinates.
  2015. * @param options An object containing options for the function.
  2016. */
  2017. renderedBoundingBox(options?: BoundingBoxOptions): BoundingBox12 & BoundingBoxWH;
  2018. renderedBoundingbox(options?: BoundingBoxOptions): BoundingBox12 & BoundingBoxWH;
  2019. }
  2020. /**
  2021. * http://js.cytoscape.org/#collection/layout
  2022. */
  2023. interface CollectionLayout {
  2024. /**
  2025. * Get a new layout, which can be used to algorithmically position the nodes in the collection.
  2026. * This function is useful for running a layout on a subset of the elements in the graph, perhaps in parallel to other layouts.
  2027. *
  2028. * You must specify options.name with the name of the layout you wish to use.
  2029. *
  2030. * Note: that you must call layout.run() in order for it to affect the graph.
  2031. *
  2032. * @param options The layout options.
  2033. */
  2034. layout(options: LayoutOptions): Layouts;
  2035. makeLayout(options: LayoutOptions): Layouts;
  2036. createLayout(options: LayoutOptions): Layouts;
  2037. }
  2038. /**
  2039. * http://js.cytoscape.org/#collection/layout
  2040. */
  2041. interface LayoutPositionOptions {
  2042. // whether to animate changes to the layout
  2043. animate?: boolean;
  2044. // duration of animation in ms, if enabled
  2045. animationDuration?: number;
  2046. // easing of animation, if enabled
  2047. animationEasing?: Css.TransitionTimingFunction;
  2048. // collection of elements involved in the layout; set by cy.layout() or eles.layout(s)
  2049. eles: CollectionArgument;
  2050. // whether to fit the viewport to the graph
  2051. fit?: boolean;
  2052. // padding to leave between graph and viewport
  2053. padding?: number;
  2054. // pan the graph to the provided position, given as { x, y }
  2055. pan?: Position;
  2056. // callback for the layoutready event
  2057. ready?: undefined;
  2058. // callback for the layoutstop event
  2059. stop?: undefined;
  2060. // a positive value which adjusts spacing between nodes (>1 means greater than usual spacing)
  2061. spacingFactor?: number;
  2062. // zoom level as a positive number to set after animation
  2063. zoom?: number;
  2064. }
  2065. interface NodeCollectionLayout {
  2066. /**
  2067. * Position the nodes for a discrete/synchronous layout.
  2068. * http://js.cytoscape.org/#nodes.layoutPositions
  2069. * @param layout The layout.
  2070. * @param options The layout options object.
  2071. */
  2072. layoutPositions(layout: string, options: LayoutPositionOptions, handler: ElementPositionFunction): void;
  2073. }
  2074. /**
  2075. * http://js.cytoscape.org/#collection/layout
  2076. */
  2077. interface LayoutDimensionOptions {
  2078. // Boolean which changes whether label dimensions are included when calculating node dimensions
  2079. nodeDimensionsIncludeLabels?: boolean;
  2080. }
  2081. /**
  2082. * https://js.cytoscape.org/#node.layoutDimensions
  2083. */
  2084. interface NodeSingularLayout {
  2085. /**
  2086. * Returns the node width and height.
  2087. * Meant for use in layout positioning to do overlap detection.
  2088. * @param options The layout options object.
  2089. */
  2090. layoutDimensions(options: LayoutDimensionOptions): { w: number; h: number };
  2091. }
  2092. /**
  2093. * http://js.cytoscape.org/#collection/selection
  2094. */
  2095. interface SingularSelection {
  2096. /**
  2097. * Get whether the element is selected.
  2098. * http://js.cytoscape.org/#ele.selected
  2099. */
  2100. selected(): boolean;
  2101. /**
  2102. * Get whether the element's selection state is mutable.
  2103. * http://js.cytoscape.org/#ele.selectable
  2104. */
  2105. selectable(): boolean;
  2106. }
  2107. /**
  2108. * https://js.cytoscape.org/#collection/selection
  2109. */
  2110. interface CollectionSelection {
  2111. /**
  2112. * Make the elements selected (NB other elements outside the collection are not affected).
  2113. * http://js.cytoscape.org/#eles.select
  2114. */
  2115. select(): this;
  2116. /**
  2117. * Make the elements not selected (NB other elements outside the collection are not affected).
  2118. * http://js.cytoscape.org/#eles.unselect
  2119. */
  2120. unselect(): this;
  2121. deselect(): this;
  2122. /**
  2123. * Make the selection states of the elements mutable.
  2124. * http://js.cytoscape.org/#eles.selectify
  2125. */
  2126. selectify(): this;
  2127. /**
  2128. * Make the selection states of the elements immutable.
  2129. * http://js.cytoscape.org/#eles.unselectify
  2130. */
  2131. unselectify(): this;
  2132. }
  2133. /**
  2134. * http://js.cytoscape.org/#collection/style
  2135. */
  2136. type ClassName = string;
  2137. /** A space-separated list of class names or an array */
  2138. type ClassNames = string | ClassName[];
  2139. interface CollectionStyle {
  2140. /**
  2141. * Add classes to elements.
  2142. * http://js.cytoscape.org/#eles.addClass
  2143. * @param classes A space-separated list of class names to add to the elements.
  2144. */
  2145. addClass(classes: ClassNames): this;
  2146. /**
  2147. * Remove classes from elements.
  2148. * @param classes A space-separated list of class names to remove from the elements.
  2149. * http://js.cytoscape.org/#eles.removeClass
  2150. */
  2151. removeClass(classes: ClassNames): this;
  2152. /**
  2153. * Toggle whether the elements have the specified classes.
  2154. * @param classes A space-separated list of class names to toggle on the elements.
  2155. * @param toggle [optional] Instead of automatically toggling, adds the classes on truthy values or removes them on falsey values.
  2156. * http://js.cytoscape.org/#eles.toggleClass
  2157. */
  2158. toggleClass(classes: ClassNames, toggle?: boolean): this;
  2159. /**
  2160. * Replace the current list of classes on the elements with the specified list.
  2161. * @param classes A space-separated list or array of class names that replaces the current class list.
  2162. * http://js.cytoscape.org/#eles.classes
  2163. * Note: can be used to clear all classes (empty string or array).
  2164. */
  2165. classes(classes: ClassNames): this;
  2166. classes(classes: ClassNames): this | string[];
  2167. classes(): string[];
  2168. /**
  2169. * Add classes to the elements, and then remove the classes after a specified duration.
  2170. * @param classes A space-separated list of class names to flash on the elements.
  2171. * @param duration [optional] The duration in milliseconds that the classes should be added on the elements. After the duration, the classes are removed.
  2172. * http://js.cytoscape.org/#eles.flashClass
  2173. */
  2174. flashClass(classes: ClassNames, duration?: number): this;
  2175. /**
  2176. * Set a particular style property value.
  2177. * @param name The name of the visual style property to set.
  2178. * @param value The value to which the property is set.
  2179. */
  2180. style(name: string, value: any): this;
  2181. /**
  2182. * Get a particular style property value.
  2183. * @param name The name of the visual style property to get.
  2184. */
  2185. style(name: string): any;
  2186. /**
  2187. * Set several particular style property values.
  2188. * @param obj An object of style property name-value pairs to set.
  2189. */
  2190. style(obj: object): this;
  2191. /**
  2192. * Get a name-value pair object containing visual style properties and their values for the element.
  2193. */
  2194. style(): { [index: string]: any };
  2195. /**
  2196. * Set a particular style property value.
  2197. * @param name The name of the visual style property to set.
  2198. * @param value The value to which the property is set.
  2199. */
  2200. css(name: string, value: any): this;
  2201. /**
  2202. * Get a particular style property value.
  2203. * @param name The name of the visual style property to get.
  2204. */
  2205. css(name: string): any;
  2206. /**
  2207. * Set several particular style property values.
  2208. * @param obj An object of style property name-value pairs to set.
  2209. */
  2210. css(obj: object): this;
  2211. /**
  2212. * Get a name-value pair object containing visual style properties and their values for the element.
  2213. */
  2214. css(): { [index: string]: any };
  2215. /**
  2216. * Remove all or specific style overrides.
  2217. * @param names A space-separated list of property names to remove overrides
  2218. */
  2219. removeStyle(names?: string): this;
  2220. }
  2221. /**
  2222. * http://js.cytoscape.org/#collection/style
  2223. */
  2224. interface SingularStyle {
  2225. /**
  2226. * Get whether an element has a particular class.
  2227. * @param className The name of the class to test for.
  2228. * http://js.cytoscape.org/#ele.hasClass
  2229. */
  2230. hasClass(className: ClassName): boolean;
  2231. /**
  2232. * Get a name-value pair object containing rendered visual
  2233. * style properties and their values for the element.
  2234. * @param name The name of the visual style property to get.
  2235. */
  2236. renderedStyle(): { [name: string]: any };
  2237. renderedStyle(name: string): any;
  2238. renderedCss(): { [name: string]: any };
  2239. renderedCss(name: string): any;
  2240. /**
  2241. * Get the numeric value of a style property in
  2242. * preferred units that can be used for calculations.
  2243. * @param name The name of the style property to get.
  2244. * http://js.cytoscape.org/#ele.numericStyle
  2245. */
  2246. numericStyle(name: string): any;
  2247. /**
  2248. * Get the units that ele.numericStyle() is expressed in, for a particular property.
  2249. * @param name The name of the style property to get.
  2250. * http://js.cytoscape.org/#ele.numericStyleUnits
  2251. */
  2252. numericStyleUnits(name: string): any;
  2253. /**
  2254. * Get whether the element is visible.
  2255. * http://js.cytoscape.org/#ele.visible
  2256. */
  2257. visible(): boolean;
  2258. /**
  2259. * Get whether the element is hidden.
  2260. * http://js.cytoscape.org/#ele.visible
  2261. */
  2262. hidden(): boolean;
  2263. /**
  2264. * Get the effective opacity of the element
  2265. * (i.e. on-screen opacity),
  2266. * which takes into consideration parent node opacity.
  2267. * http://js.cytoscape.org/#ele.effectiveOpacity
  2268. */
  2269. effectiveOpacity(): number;
  2270. /**
  2271. * Get whether the element's effective opacity is completely transparent,
  2272. * which takes into consideration parent node opacity.
  2273. * http://js.cytoscape.org/#ele.transparent
  2274. */
  2275. transparent(): number;
  2276. }
  2277. /**
  2278. * http://js.cytoscape.org/#collection/animation
  2279. */
  2280. interface ElementAnimateOptionsBase {
  2281. /** An object containing name-value pairs of style properties to animate. */
  2282. style?: { [name: string]: any };
  2283. /** The duration of the animation in milliseconds. */
  2284. duration?: number;
  2285. /** A boolean indicating whether to queue the animation. */
  2286. queue?: boolean;
  2287. /** A function to call when the animation is done. */
  2288. complete?(): void;
  2289. /** A function to call each time the animation steps. */
  2290. step?(): void;
  2291. /** A transition-timing-function easing style string that shapes the animation progress curve. */
  2292. easing?: Css.TransitionTimingFunction;
  2293. }
  2294. interface ElementAnimateOptionPos extends ElementAnimateOptionsBase {
  2295. /** A position to which the elements will be animated. */
  2296. position?: Position;
  2297. }
  2298. interface ElementAnimateOptionRen extends ElementAnimateOptionsBase {
  2299. /** A rendered position to which the elements will be animated. */
  2300. renderedPosition?: Position;
  2301. }
  2302. interface CollectionAnimation {
  2303. /**
  2304. * Animate the elements.
  2305. * @param options An object containing the details of the animation.
  2306. * http://js.cytoscape.org/#eles.animate
  2307. */
  2308. animate(options: ElementAnimateOptionPos | ElementAnimateOptionRen, params?: ElementAnimateOptionsBase): this;
  2309. /**
  2310. * Add a delay between animations for the elements.
  2311. * @param duration How long the delay should be in milliseconds.
  2312. * @param complete A function to call when the delay is complete.
  2313. * http://js.cytoscape.org/#eles.delay
  2314. */
  2315. delay(duration: number, complete?: () => void): this;
  2316. /**
  2317. * Stop all animations that are currently running.
  2318. * @param clearQueue A boolean, indicating whether the queue of animations should be emptied.
  2319. * @param jumpToEnd A boolean, indicating whether the currently-running animations should jump to their ends rather than just stopping midway.
  2320. * http://js.cytoscape.org/#eles.stop
  2321. */
  2322. stop(clearQueue?: boolean, jumpToEnd?: boolean): this;
  2323. /**
  2324. * Remove all queued animations for the elements.
  2325. * http://js.cytoscape.org/#eles.clearQueue
  2326. */
  2327. clearQueue(): this;
  2328. }
  2329. interface SingularAnimationOptionsBase {
  2330. /** A position to which the elements will be animated. */
  2331. position: Position;
  2332. /** A rendered position to which the elements will be animated. */
  2333. renderedPosition: Position;
  2334. /** An object containing name-value pairs of style properties to animate. */
  2335. style: any;
  2336. /** The duration of the animation in milliseconds. */
  2337. duration: number;
  2338. /** A transition-timing-function easing style string that shapes the animation progress curve. */
  2339. easing: Css.TransitionTimingFunction;
  2340. }
  2341. interface SingularAnimationOptionsPos extends SingularAnimationOptionsBase {
  2342. /** A position to which the elements will be animated. */
  2343. position: Position;
  2344. }
  2345. interface SingularAnimationOptionsRen extends SingularAnimationOptionsBase {
  2346. /** A rendered position to which the elements will be animated. */
  2347. renderedPosition: Position;
  2348. }
  2349. interface SingularAnimation {
  2350. /**
  2351. * Get whether the element is currently being animated.
  2352. */
  2353. animated(): boolean;
  2354. /**
  2355. * Get an animation for the element.
  2356. * @param options An object containing the details of the animation.
  2357. */
  2358. animation(options: SingularAnimationOptionsRen | SingularAnimationOptionsPos): AnimationManipulation;
  2359. /**
  2360. * Get a delay animation for the element.
  2361. * @param duration How long the delay should be in milliseconds.
  2362. * http://js.cytoscape.org/#ele.delayAnimation
  2363. */
  2364. delayAnimation(duration: number): AnimationManipulation;
  2365. }
  2366. /**
  2367. * http://js.cytoscape.org/#collection/comparison
  2368. */
  2369. interface CollectionComparision {
  2370. /**
  2371. * Determine whether this collection contains exactly the same elements as another collection.
  2372. * @param eles The other elements to compare to.
  2373. */
  2374. same(eles: CollectionArgument): boolean;
  2375. /**
  2376. * Determine whether this collection contains any of the same elements as another collection.
  2377. * @param eles The other elements to compare to.
  2378. */
  2379. anySame(eles: CollectionArgument): boolean;
  2380. /**
  2381. * Determine whether this collection contains all of the elements of another collection.
  2382. */
  2383. contains(eles: CollectionArgument): boolean;
  2384. has(eles: CollectionArgument): boolean;
  2385. /**
  2386. * Determine whether all elements in the specified collection are in the neighbourhood of the calling collection.
  2387. * @param eles The other elements to compare to.
  2388. */
  2389. allAreNeighbors(eles: CollectionArgument): boolean;
  2390. allAreNeighbours(eles: CollectionArgument): boolean;
  2391. /**
  2392. * Determine whether any element in this collection matches a selector.
  2393. *
  2394. * @param selector The selector to match against.
  2395. */
  2396. is(selector: Selector): boolean;
  2397. /**
  2398. * Determine whether all elements in the collection match a selector.
  2399. * @param selector The selector to match against.
  2400. */
  2401. allAre(selector: Selector): boolean;
  2402. /**
  2403. * Determine whether any element in this collection satisfies the specified test function.
  2404. *
  2405. * @param test The test function that returns truthy values for elements that satisfy the test and falsey values for elements that do not satisfy the test.
  2406. * ele - The current element.
  2407. * i - The index of the current element.
  2408. * eles - The collection of elements being tested.
  2409. * @param thisArg [optional] The value for this within the test function.
  2410. */
  2411. some(test: (ele: CollectionArgument, i: number, eles: CollectionArgument) => boolean, thisArg?: any): boolean;
  2412. /**
  2413. * Determine whether all elements in this collection satisfy the specified test function.
  2414. *
  2415. * @param test The test function that returns truthy values for elements that satisfy the test and falsey values for elements that do not satisfy the test.
  2416. * ele - The current element.
  2417. * i - The index of the current element.
  2418. * eles - The collection of elements being tested.
  2419. * @param thisArg [optional] The value for this within the test function.
  2420. */
  2421. every(test: (ele: CollectionArgument, i: number, eles: CollectionArgument) => boolean, thisArg?: any): boolean;
  2422. }
  2423. /**
  2424. * http://js.cytoscape.org/#collection/iteration
  2425. */
  2426. interface CollectionIteration<TOut, TIn> {
  2427. /**
  2428. * Get the number of elements in the collection.
  2429. */
  2430. size(): number;
  2431. /**
  2432. * Get the number of elements in the collection.
  2433. */
  2434. length: number;
  2435. /**
  2436. * Get whether the collection is empty, meaning it has no elements.
  2437. */
  2438. empty(): boolean;
  2439. /**
  2440. * Get whether the collection is nonempty, meaning it has elements.
  2441. */
  2442. nonempty(): boolean;
  2443. /**
  2444. * Iterate over the elements in the collection using an implementation like the native array function namesake.
  2445. *
  2446. * This function behaves like Array.prototype.forEach() with minor changes for convenience:
  2447. * You can exit the iteration early by returning false in the iterating function.
  2448. * The Array.prototype.forEach() implementation does not support this, but it is included anyway on account of its utility.
  2449. *
  2450. * @param each The function executed each iteration.
  2451. * ele - The current element.
  2452. * i - The index of the current element.
  2453. * eles - The collection of elements being iterated.
  2454. * @param thisArg [optional] The value for this within the iterating function.
  2455. */
  2456. // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
  2457. each(each: (ele: TIn, i: number, eles: this) => void | boolean, thisArg?: any): this;
  2458. // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
  2459. forEach(each: (ele: TIn, i: number, eles: this) => void | boolean, thisArg?: any): this;
  2460. /**
  2461. * Get an element at a particular index in the collection.
  2462. *
  2463. * You may use eles[i] in place of eles.eq(i) as a more performant alternative.
  2464. *
  2465. * @param index The index of the element to get.
  2466. */
  2467. eq(index: number): TOut;
  2468. /**
  2469. * Get an element at a particular index in the collection.
  2470. *
  2471. * @param index The index of the element to get.
  2472. */
  2473. [index: number]: TOut;
  2474. /**
  2475. * Get the first element in the collection.
  2476. */
  2477. first(): TOut;
  2478. /**
  2479. * Get the last element in the collection.
  2480. */
  2481. last(): TOut;
  2482. /**
  2483. * Get a subset of the elements in the collection based on specified indices.
  2484. *
  2485. * @param start [optional] An integer that specifies where to start the selection.
  2486. * The first element has an index of 0.
  2487. * Use negative numbers to select from the end of an array.
  2488. * @param end [optional] An integer that specifies where to end the selection.
  2489. * If omitted, all elements from the start position and to the end of the array will be selected.
  2490. * Use negative numbers to select from the end of an array.
  2491. */
  2492. slice(start?: number, end?: number): this;
  2493. /**
  2494. * Get the collection as an array, maintaining the order of the elements.
  2495. */
  2496. toArray(): TOut[];
  2497. [Symbol.iterator](): Iterator<TOut>;
  2498. }
  2499. /**
  2500. * http://js.cytoscape.org/#collection/building--filtering
  2501. */
  2502. /**
  2503. * Get a new collection, resulting from adding the collection with another one
  2504. *
  2505. * @param eles The elements or array of elements to add or elements in the graph matching the selector.
  2506. * http://js.cytoscape.org/#eles.union
  2507. */
  2508. type CollectionBuildingUnionFunc = (
  2509. eles: CollectionArgument | CollectionArgument[] | Selector,
  2510. ) => CollectionReturnValue;
  2511. /**
  2512. * Get a new collection, resulting from the collection without some specified elements.
  2513. * http://js.cytoscape.org/#eles.difference
  2514. * @param eles The elements that will not be in the resultant collection.
  2515. * Elements from the calling collection matching this selector will not be in the resultant collection.
  2516. */
  2517. type CollectionBuildingDifferenceFunc = (eles: CollectionArgument | Selector) => CollectionReturnValue;
  2518. /**
  2519. * Get the elements in both this collection and another specified collection.
  2520. * http://js.cytoscape.org/#eles.intersection
  2521. * @param eles The elements to intersect with.
  2522. * A selector representing the elements to intersect with.
  2523. * All elements in the graph matching the selector are used as the passed collection.
  2524. */
  2525. type CollectionBuildingIntersectionFunc = (eles: CollectionArgument | Selector) => CollectionReturnValue;
  2526. /**
  2527. * Get the elements that are in the calling collection or the passed collection but not in both.
  2528. * http://js.cytoscape.org/#eles.symmetricDifference
  2529. * @param eles The elements to apply the symmetric difference with.
  2530. * A selector representing the elements to apply the symmetric difference with.
  2531. * All elements in the graph matching the selector are used as the passed collection.
  2532. */
  2533. type CollectionSymmetricDifferenceFunc = (eles: CollectionArgument | Selector) => CollectionReturnValue;
  2534. /**
  2535. * http://js.cytoscape.org/#collection/building--filtering
  2536. */
  2537. interface CollectionBuildingFiltering<TIn, TOut> {
  2538. /**
  2539. * Get an element in the collection from its ID in a very performant way.
  2540. * @param id The ID of the element to get.
  2541. */
  2542. getElementById(id: string): TOut;
  2543. /**
  2544. * Get an element in the collection from its ID in a very performant way.
  2545. * @param id The ID of the element to get.
  2546. */
  2547. $id(id: string): TOut;
  2548. /**
  2549. * Get a new collection, resulting from adding the collection with another one
  2550. * http://js.cytoscape.org/#eles.union
  2551. */
  2552. union: CollectionBuildingUnionFunc;
  2553. u: CollectionBuildingUnionFunc;
  2554. add: CollectionBuildingUnionFunc;
  2555. "+": CollectionBuildingUnionFunc;
  2556. or: CollectionBuildingUnionFunc;
  2557. "|": CollectionBuildingUnionFunc;
  2558. /**
  2559. * Get a new collection, resulting from the collection without some specified elements.
  2560. * http://js.cytoscape.org/#eles.difference
  2561. */
  2562. difference: CollectionBuildingDifferenceFunc;
  2563. subtract: CollectionBuildingDifferenceFunc;
  2564. "\\": CollectionBuildingDifferenceFunc;
  2565. not: CollectionBuildingDifferenceFunc;
  2566. "!": CollectionBuildingDifferenceFunc;
  2567. relativeComplement: CollectionBuildingDifferenceFunc;
  2568. "-": CollectionBuildingDifferenceFunc;
  2569. /**
  2570. * Get all elements in the graph that are not in the calling collection.
  2571. * http://js.cytoscape.org/#eles.absoluteComplement
  2572. */
  2573. absoluteComplement(): CollectionReturnValue;
  2574. abscomp(): CollectionReturnValue;
  2575. complement(): CollectionReturnValue;
  2576. /**
  2577. * Get the elements in both this collection and another specified collection.
  2578. * http://js.cytoscape.org/#eles.intersection
  2579. */
  2580. intersection: CollectionBuildingIntersectionFunc;
  2581. intersect: CollectionBuildingIntersectionFunc;
  2582. and: CollectionBuildingIntersectionFunc;
  2583. n: CollectionBuildingIntersectionFunc;
  2584. "&": CollectionBuildingIntersectionFunc;
  2585. ".": CollectionBuildingIntersectionFunc;
  2586. /**
  2587. * Get the elements that are in the calling collection
  2588. * or the passed collection but not in both.
  2589. * http://js.cytoscape.org/#eles.symmetricDifference
  2590. */
  2591. symmetricDifference: CollectionSymmetricDifferenceFunc;
  2592. symdiff: CollectionSymmetricDifferenceFunc;
  2593. xor: CollectionSymmetricDifferenceFunc;
  2594. "^": CollectionSymmetricDifferenceFunc;
  2595. "(+)": CollectionSymmetricDifferenceFunc;
  2596. "(-)": CollectionSymmetricDifferenceFunc;
  2597. /**
  2598. * Perform a traditional left/right diff on the two collections.
  2599. *
  2600. * @param selector
  2601. * A selector representing the elements on the right side of the diff. All elements in the graph matching the selector are used as the passed collection.
  2602. * The elements on the right side of the diff.
  2603. * @return This function returns a plain object of the form { left, right, both } where
  2604. * left - is the set of elements only in the calling (i.e. left) collection,
  2605. * right - is the set of elements only in the passed (i.e. right) collection, and
  2606. * both - is the set of elements in both collections.
  2607. * http://js.cytoscape.org/#eles.diff
  2608. */
  2609. diff(selector: Selector | CollectionArgument): {
  2610. left: CollectionReturnValue;
  2611. right: CollectionReturnValue;
  2612. both: CollectionReturnValue;
  2613. };
  2614. /**
  2615. * Perform a in-place merge of the given elements into the calling collection.
  2616. * @param eles The elements to merge in-place or a selector representing the elements to merge.
  2617. * All elements in the graph matching the selector are used as the passed collection.
  2618. *
  2619. * This function modifies the calling collection instead of returning a new one.
  2620. * Use of this function should be considered for performance in some cases, but otherwise should be avoided. Consider using eles.union() instead.
  2621. * Use this function only on new collections that you create yourself, using cy.collection().
  2622. * This ensures that you do not unintentionally modify another collection.
  2623. *
  2624. * Examples
  2625. * With a collection:
  2626. * @example
  2627. * var col = cy.collection(); // new, empty collection
  2628. * var j = cy.$('#j');
  2629. * var e = cy.$('#e');
  2630. * col.merge( j ).merge( e );
  2631. *
  2632. * With a selector:
  2633. * @example
  2634. * var col = cy.collection(); // new, empty collection
  2635. * col.merge('#j').merge('#e');
  2636. */
  2637. merge(eles: CollectionArgument | Selector): this;
  2638. /**
  2639. * Perform an in-place operation on the calling collection to remove the given elements.
  2640. * @param eles The elements to remove in-place or a selector representing the elements to remove .
  2641. * All elements in the graph matching the selector are used as the passed collection.
  2642. *
  2643. * This function modifies the calling collection instead of returning a new one.
  2644. * Use of this function should be considered for performance in some cases, but otherwise should be avoided. Consider using eles.filter() or eles.remove() instead.
  2645. * Use this function only on new collections that you create yourself, using cy.collection().
  2646. * This ensures that you do not unintentionally modify another collection.
  2647. *
  2648. * Examples
  2649. * With a collection:
  2650. * @example
  2651. * var col = cy.collection(); // new, empty collection
  2652. * var e = cy.$('#e');
  2653. * col.merge( cy.nodes() );
  2654. * col.unmerge( e );
  2655. *
  2656. * With a selector:
  2657. * @example
  2658. * var col = cy.collection(); // new, empty collection
  2659. * col.merge( cy.nodes() );
  2660. * col.unmerge('#e');
  2661. */
  2662. unmerge(eles: CollectionArgument | Selector): this;
  2663. /**
  2664. * Get a new collection containing elements that are accepted by the specified filter.
  2665. *
  2666. * @param selector The selector to match against.
  2667. * @param filter selector The filter function that returns true for elements to include.
  2668. * i - The index of the current element being considered.
  2669. * ele - The element being considered.
  2670. * http://js.cytoscape.org/#eles.filter
  2671. */
  2672. filter(
  2673. selector: Selector | ((ele: TIn, i: number, eles: CollectionArgument) => boolean),
  2674. ): CollectionReturnValue;
  2675. /**
  2676. * Get the nodes that match the specified selector.
  2677. *
  2678. * @param selector The selector to match against.
  2679. * http://js.cytoscape.org/#eles.filter
  2680. */
  2681. nodes(selector?: Selector): NodeCollection;
  2682. /**
  2683. * Get the edges that match the specified selector.
  2684. *
  2685. * @param selector The selector to match against.
  2686. * http://js.cytoscape.org/#eles.filter
  2687. */
  2688. edges(selector?: Selector): EdgeCollection;
  2689. /**
  2690. * Get a new collection containing the elements sorted by the
  2691. * specified comparison function.
  2692. *
  2693. * @param sort The sorting comparison function that returns a negative number
  2694. * for ele1 before ele2, 0 for ele1 same as ele2,
  2695. * or a positive number for ele1 after ele2.
  2696. *
  2697. * http://js.cytoscape.org/#eles.sort
  2698. */
  2699. sort(sort: (ele1: TIn, ele2: TIn) => number): CollectionReturnValue;
  2700. /**
  2701. * Get an array containing values mapped from the collection.
  2702. *
  2703. * @param fn The function that returns the mapped value for each element.
  2704. * ele - The current element.
  2705. * i - The index of the current element.
  2706. * eles - The collection of elements being mapped.
  2707. * @param thisArg [optional] The value for this within the iterating function.
  2708. *
  2709. * http://js.cytoscape.org/#eles.map
  2710. */
  2711. map<T>(fn: (ele: TIn, i: number, eles: CollectionArgument) => T, thisArg?: any): T[];
  2712. /**
  2713. * Reduce a single value by applying a
  2714. * function against an accumulator and each value of the collection.
  2715. *
  2716. * @param fn The function that returns the accumulated value
  2717. * given the previous value and the current element.
  2718. * prevVal The value accumulated from previous elements.
  2719. * ele The current element.
  2720. * i The index of the current element.
  2721. * eles The collection of elements being reduced.
  2722. * @param initialValue The initial value for reducing
  2723. * It is used also for type inference of output, but the type can be
  2724. * also stated explicitly as generic
  2725. * http://js.cytoscape.org/#eles.reduce
  2726. */
  2727. reduce<T>(fn: (prevVal: T, ele: TIn, i: number, eles: CollectionArgument) => T, initialValue: T): T;
  2728. /**
  2729. * Find a minimum value in a collection.
  2730. *
  2731. * @param fn The function that returns the value to compare for each element.
  2732. * ele - The current element.
  2733. * i - The index of the current element.
  2734. * eles - The collection of elements being mapped.
  2735. * @param thisArg [optional] The value for this within the iterating function.
  2736. *
  2737. * http://js.cytoscape.org/#eles.min
  2738. */
  2739. min<T>(
  2740. fn: (ele: TIn, i: number, eles: CollectionArgument) => T,
  2741. thisArg?: any,
  2742. ): {
  2743. /**
  2744. * The minimum value found.
  2745. */
  2746. value: T;
  2747. /**
  2748. * The element that corresponds to the minimum value.
  2749. */
  2750. ele: SingularElementReturnValue;
  2751. };
  2752. /**
  2753. * Find a maximum value and the corresponding element.
  2754. *
  2755. * @param fn The function that returns the value to compare for each element.
  2756. * ele - The current element.
  2757. * i - The index of the current element.
  2758. * eles - The collection of elements being mapped.
  2759. * @param thisArg [optional] The value for this within the iterating function.
  2760. *
  2761. * http://js.cytoscape.org/#eles.max
  2762. */
  2763. max<T>(
  2764. fn: (ele: TIn, i: number, eles: CollectionArgument) => T,
  2765. thisArg?: any,
  2766. ): {
  2767. /**
  2768. * The minimum value found.
  2769. */
  2770. value: T;
  2771. /**
  2772. * The element that corresponds to the minimum value.
  2773. */
  2774. ele: SingularElementReturnValue;
  2775. };
  2776. }
  2777. /**
  2778. * http://js.cytoscape.org/#collection/traversing
  2779. */
  2780. type MinumumSpanningTree = any;
  2781. interface CollectionTraversing {
  2782. // http://js.cytoscape.org/#collection/traversing
  2783. /**
  2784. * Get the open neighbourhood of the elements.
  2785. *
  2786. * The neighbourhood returned by this function is a bit different than the traditional definition of a "neighbourhood":
  2787. * This returned neighbourhood includes the edges connecting the collection to the neighbourhood. This gives you more flexibility.
  2788. * An open neighbourhood is one that does not include the original set of elements. If unspecified, a neighbourhood is open by default.
  2789. *
  2790. * @param selector [optional] An optional selector that is used to filter the resultant collection.
  2791. */
  2792. neighborhood(selector?: Selector): CollectionReturnValue;
  2793. /**
  2794. * Get the open neighbourhood of the elements.
  2795. *
  2796. * The neighbourhood returned by this function is a bit different than the traditional definition of a "neighbourhood":
  2797. * This returned neighbourhood includes the edges connecting the collection to the neighbourhood. This gives you more flexibility.
  2798. * An open neighbourhood is one that does not include the original set of elements. If unspecified, a neighbourhood is open by default.
  2799. *
  2800. * @param selector [optional] An optional selector that is used to filter the resultant collection.
  2801. */
  2802. openNeighborhood(selector?: Selector): CollectionReturnValue;
  2803. /**
  2804. * Get the closed neighbourhood of the elements.
  2805. *
  2806. * The neighbourhood returned by this function is a bit different than the traditional definition of a "neighbourhood":
  2807. * This returned neighbourhood includes the edges connecting the collection to the neighbourhood. This gives you more flexibility.
  2808. * A closed neighbourhood is one that does include the original set of elements.
  2809. *
  2810. * @param selector [optional] An optional selector that is used to filter the resultant collection.
  2811. */
  2812. closedNeighborhood(selector?: Selector): CollectionReturnValue;
  2813. /**
  2814. * Get the connected components, considering only the elements in the calling collection.
  2815. * An array of collections is returned, with each collection representing a component.
  2816. */
  2817. components(): CollectionReturnValue[];
  2818. /**
  2819. * Get the connected components to which the passed elements belong.
  2820. * The components consider only the subgraph made by the elements in the calling collection.
  2821. * An array of collections is returned, with each collection representing a component.
  2822. * http://js.cytoscape.org/#eles.componentsOf
  2823. * @param root The components that contain these elements are returned.
  2824. */
  2825. componentsOf(root: Selector): CollectionReturnValue[];
  2826. }
  2827. /**
  2828. * http://js.cytoscape.org/#collection/edge-points
  2829. */
  2830. interface EdgeSingularPoints {
  2831. /**
  2832. * Get an array of control point model positions for a {@code curve-style: bezier) or {@code curve-style: unbundled-bezier} edge.
  2833. *
  2834. * While the control points may be specified relatively in the CSS,
  2835. * this function returns the absolute model positions of the control points.
  2836. * The points are specified in the order of source-to-target direction.
  2837. * This function works for bundled beziers, but it is not applicable to the middle, straight-line edge in the bundle.
  2838. */
  2839. controlPoints(): Position[];
  2840. /**
  2841. * Get the control points in rendered coordinates.
  2842. * http://js.cytoscape.org/#edge.renderedControlPoints
  2843. */
  2844. renderedControlPoints(): Position[];
  2845. /**
  2846. * Get an array of segment point model positions (i.e. bend points) for a {@code curve-style: segments} edge.
  2847. *
  2848. * While the segment points may be specified relatively in the stylesheet,
  2849. * this function returns the absolute model positions of the segment points.
  2850. * The points are specified in the order of source-to-target direction.
  2851. */
  2852. segmentPoints(): Position[];
  2853. /**
  2854. * Get the segment points in rendered coordinates.
  2855. * http://js.cytoscape.org/#edge.renderedSegmentPoints
  2856. */
  2857. renderedSegmentPoints(): Position[];
  2858. /**
  2859. * Get the model position of where the edge ends, towards the source node.
  2860. */
  2861. sourceEndpoint(): Position;
  2862. /**
  2863. * Get the source endpoint in rendered coordinates.
  2864. * http://js.cytoscape.org/#edge.renderedSourceEndpoint
  2865. */
  2866. renderedSourceEndpoint(): Position;
  2867. /**
  2868. * Get the model position of where the edge ends, towards the target node.
  2869. */
  2870. targetEndpoint(): Position;
  2871. /**
  2872. * Get the target endpoint in rendered coordinates.
  2873. * http://js.cytoscape.org/#edge.renderedTargetEndpoint
  2874. */
  2875. renderedTargetEndpoint(): Position;
  2876. /**
  2877. * Get the model position of the midpoint of the edge.
  2878. *
  2879. * The midpoint is, by default, where the edge’s label is centred. It is also the position towards which mid arrows point.
  2880. * For curve-style: unbundled-bezier edges, the midpoint is the middle extremum if the number of control points is odd.
  2881. * For an even number of control points, the midpoint is where the two middle-most control points meet.
  2882. * This is the middle inflection point for bilaterally symmetric or skew symmetric edges, for example.
  2883. * For curve-style: segments edges, the midpoint is the middle segment point if the number of segment points is odd.
  2884. * For an even number of segment points, the overall midpoint is the midpoint of the middle-most line segment (i.e. the mean of the middle two segment points).
  2885. */
  2886. midpoint(): Position;
  2887. /**
  2888. * Get the midpoint in rendered coordinates.
  2889. * http://js.cytoscape.org/#edge.renderedMidpoint
  2890. */
  2891. renderedMidpoint(): Position;
  2892. }
  2893. interface EdgeSingularTraversing {
  2894. /**
  2895. * Get source node of this edge.
  2896. * @param selector An optional selector that is used to filter the resultant collection.
  2897. * http://js.cytoscape.org/#edge.source
  2898. */
  2899. source(selector?: Selector): NodeSingular;
  2900. /**
  2901. * Get target node of this edge.
  2902. * @param selector An optional selector that is used to filter the resultant collection.
  2903. * http://js.cytoscape.org/#edge.target
  2904. */
  2905. target(selector?: Selector): NodeSingular;
  2906. }
  2907. interface EdgeCollectionTraversing {
  2908. // http://js.cytoscape.org/#collection/traversing
  2909. /**
  2910. * Get the nodes connected to the edges in the collection
  2911. *
  2912. * @param selector [optional] An optional selector that is used to filter the resultant collection.
  2913. */
  2914. connectedNodes(selector?: Selector): NodeCollection;
  2915. /**
  2916. * Get source nodes connected to the edges in the collection.
  2917. *
  2918. * @param selector [optional] An optional selector that is used to filter the resultant collection.
  2919. */
  2920. sources(selector?: Selector): NodeCollection;
  2921. /**
  2922. * Get target nodes connected to the edges in the collection.
  2923. *
  2924. * @param selector [optional] An optional selector that is used to filter the resultant collection.
  2925. */
  2926. targets(selector?: Selector): NodeCollection;
  2927. /**
  2928. * Get edges parallel to those in the collection.
  2929. *
  2930. * Two edges are said to be parallel if they connect the same two nodes.
  2931. * Any two parallel edges may connect nodes in the same direction, in which case the edges share the same source and target.
  2932. * They may alternatively connect nodes in the opposite direction, in which case the source and target are reversed in the second edge.
  2933. * That is:
  2934. * - edge1.source().id() === edge2.source().id()
  2935. * && edge1.target().id() === edge2.target().id()
  2936. * OR
  2937. * - edge1.source().id() === edge2.target().id()
  2938. * && edge1.target().id() === edge2.source().id()
  2939. *
  2940. * @param selector [optional] An optional selector that is used to filter the resultant collection.
  2941. */
  2942. parallelEdges(selector?: Selector): EdgeCollection;
  2943. /**
  2944. * Get edges codirected to those in the collection.
  2945. *
  2946. * Two edges are said to be codirected if they connect the same two nodes in the same direction: The edges have the same source and target.
  2947. * That is:
  2948. * - edge1.source().id() === edge2.source().id()
  2949. * && edge1.target().id() === edge2.target().id()
  2950. *
  2951. * @param selector [optional] An optional selector that is used to filter the resultant collection.
  2952. */
  2953. codirectedEdges(selector?: Selector): EdgeCollection;
  2954. }
  2955. interface NodeCollectionTraversing {
  2956. // http://js.cytoscape.org/#collection/traversing
  2957. /**
  2958. * Get the edges connecting the collection to another collection. Direction of the edges does not matter.
  2959. *
  2960. * @param eles The other collection.
  2961. * @param selector The other collection, specified as a selector which is matched against all elements in the graph.
  2962. */
  2963. edgesWith(eles: CollectionArgument | Selector): EdgeCollection;
  2964. /**
  2965. * Get the edges coming from the collection (i.e. the source) going to another collection (i.e. the target).
  2966. *
  2967. * @param eles The other collection.
  2968. * @param selector The other collection, specified as a selector which is matched against all elements in the graph.
  2969. */
  2970. edgesTo(eles: CollectionArgument | Selector): EdgeCollection;
  2971. /**
  2972. * Get the edges connected to the nodes in the collection.
  2973. *
  2974. * @param selector [optional] An optional selector that is used to filter the resultant collection.
  2975. */
  2976. connectedEdges(selector?: Selector): EdgeCollection;
  2977. /**
  2978. * From the set of calling nodes, get the nodes which are roots (i.e. no incoming edges, as in a directed acyclic graph).
  2979. *
  2980. * @param selector [optional] An optional selector that is used to filter the resultant collection.
  2981. */
  2982. roots(selector?: Selector): NodeCollection;
  2983. /**
  2984. * From the set of calling nodes, get the nodes which are leaves (i.e. no outgoing edges, as in a directed acyclic graph).
  2985. *
  2986. * @param selector [optional] An optional selector that is used to filter the resultant collection.
  2987. */
  2988. leaves(selector?: Selector): NodeCollection;
  2989. /**
  2990. * Get edges (and their targets) coming out of the nodes in the collection.
  2991. *
  2992. * @param selector [optional] An optional selector that is used to filter the resultant collection.
  2993. */
  2994. outgoers(selector?: Selector): CollectionReturnValue;
  2995. /**
  2996. * Recursively get edges (and their targets) coming out of the nodes in the collection (i.e. the outgoers, the outgoers' outgoers, ...).
  2997. *
  2998. * @param selector [optional] An optional selector that is used to filter the resultant collection.
  2999. */
  3000. successors(selector?: Selector): CollectionReturnValue;
  3001. /**
  3002. * Get edges (and their sources) coming into the nodes in the collection.
  3003. *
  3004. * @param selector [optional] An optional selector that is used to filter the resultant collection.
  3005. */
  3006. incomers(selector?: Selector): CollectionReturnValue;
  3007. /**
  3008. * Recursively get edges (and their sources) coming into the nodes in the collection (i.e. the incomers, the incomers' incomers, ...).
  3009. *
  3010. * @param selector [optional] An optional selector that is used to filter the resultant collection.
  3011. */
  3012. predecessors(selector?: Selector): CollectionReturnValue;
  3013. }
  3014. /**
  3015. * http://js.cytoscape.org/#collection/algorithms
  3016. */
  3017. type WeightFn = (edge: EdgeCollection) => number;
  3018. /**
  3019. * The handler returns true when it finds the desired node, and it returns false to cancel the search.
  3020. * v - The current node.
  3021. * e - The edge connecting the previous node to the current node.
  3022. * u - The previous node.
  3023. * i - The index indicating this node is the ith visited node.
  3024. * depth - How many edge hops away this node is from the root nodes.
  3025. */
  3026. type SearchVisitFunction = (
  3027. v: NodeSingular,
  3028. e: EdgeSingular,
  3029. u: NodeSingular,
  3030. i: number,
  3031. depth: number,
  3032. // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
  3033. ) => boolean | void;
  3034. interface SearchFirstOptionsBase {
  3035. /**
  3036. * A handler function that is called when a node is visited in the search.
  3037. */
  3038. visit?: SearchVisitFunction;
  3039. /**
  3040. * A boolean indicating whether the algorithm should only go along edges from source to target (default false).
  3041. */
  3042. directed?: boolean;
  3043. }
  3044. interface SearchFirstOptions1 extends SearchFirstOptionsBase {
  3045. /**
  3046. * The root nodes (selector or collection) to start the search from.
  3047. */
  3048. root: Selector | CollectionArgument;
  3049. }
  3050. interface SearchFirstOptions2 extends SearchFirstOptionsBase {
  3051. /**
  3052. * The root nodes (selector or collection) to start the search from.
  3053. */
  3054. roots: Selector | CollectionArgument;
  3055. }
  3056. type SearchFirstOptions = SearchFirstOptions1 | SearchFirstOptions2;
  3057. interface SearchFirstResult {
  3058. /**
  3059. * The path of the search.
  3060. * - The path returned includes edges such that if path[i] is a node, then path[i - 1] is the edge used to get to that node.
  3061. */
  3062. path: CollectionArgument;
  3063. /**
  3064. * The node found by the search
  3065. * - If no node was found, then found is empty.
  3066. * - If your handler function returns false, then the only the path up to that point is returned.
  3067. */
  3068. found: NodeCollection;
  3069. }
  3070. /**
  3071. * http://js.cytoscape.org/#eles.dijkstra
  3072. */
  3073. interface SearchDijkstraOptions {
  3074. /**
  3075. * The root node (selector or collection) where the algorithm starts.
  3076. */
  3077. root: Selector | CollectionArgument;
  3078. /**
  3079. * A function that returns the positive numeric weight for this edge.
  3080. *
  3081. * If no weight function is defined, a constant weight of 1 is used for each edge.
  3082. */
  3083. weight?: WeightFn;
  3084. /**
  3085. * A boolean indicating whether the algorithm should only go along edges from source to target (default false).
  3086. */
  3087. directed?: boolean;
  3088. }
  3089. /**
  3090. * http://js.cytoscape.org/#eles.dijkstra
  3091. */
  3092. interface SearchDijkstraResult {
  3093. /**
  3094. * Returns the distance from the source node to node.
  3095. */
  3096. distanceTo(node: NodeSingular): number;
  3097. /**
  3098. * Returns a collection containing the shortest path from the source node to node.
  3099. * The path starts with the source node and includes the edges between the nodes in the path such that if pathTo(node)[i] is an edge,
  3100. * then pathTo(node)[i-1] is the previous node in the path and pathTo(node)[i+1] is the next node in the path.
  3101. */
  3102. pathTo(node: NodeSingular): CollectionReturnValue;
  3103. }
  3104. /**
  3105. * http://js.cytoscape.org/#eles.aStar
  3106. */
  3107. interface SearchAStarOptions {
  3108. root: Selector | CollectionArgument;
  3109. goal: Selector | CollectionArgument;
  3110. weight?: WeightFn;
  3111. heuristic?(node: NodeCollection): number;
  3112. directed?: boolean;
  3113. }
  3114. /**
  3115. * http://js.cytoscape.org/#eles.aStar
  3116. */
  3117. interface SearchAStarResult {
  3118. found: boolean;
  3119. distance: number;
  3120. path: CollectionReturnValue;
  3121. }
  3122. /**
  3123. * http://js.cytoscape.org/#eles.floydWarshall
  3124. */
  3125. interface SearchFloydWarshallOptions {
  3126. weight: WeightFn;
  3127. directed?: boolean;
  3128. }
  3129. /**
  3130. * http://js.cytoscape.org/#eles.floydWarshall
  3131. */
  3132. interface SearchFloydWarshallResult {
  3133. /**
  3134. * Returns the distance from the source node to node.
  3135. */
  3136. distance(fromNode: NodeSingular | CollectionSelection, toNode: NodeSingular | Selector): number;
  3137. /**
  3138. * Returns a collection containing the shortest path from the source node to node.
  3139. * The path starts with the source node and includes the edges
  3140. * between the nodes in the path such that if pathTo(node)[i] is an edge,
  3141. * then pathTo(node)[i-1] is the previous node in the path and pathTo(node)[i+1]
  3142. * is the next node in the path.
  3143. */
  3144. path(fromNode: NodeSingular | CollectionSelection, toNode: NodeSingular | Selector): CollectionReturnValue;
  3145. }
  3146. /**
  3147. * http://js.cytoscape.org/#eles.bellmanFord
  3148. */
  3149. interface SearchBellmanFordOptions {
  3150. /**
  3151. * The root node (selector or collection) where the search starts.
  3152. */
  3153. root: any;
  3154. /**
  3155. * A function that returns the positive numeric weight for this edge.
  3156. */
  3157. weight?: WeightFn;
  3158. /**
  3159. * Indicating whether the algorithm should only go along
  3160. * edges from source to target (default false).
  3161. */
  3162. directed: boolean;
  3163. /**
  3164. * Indicating whether the algorithm should find and return
  3165. * negative weight cycles (default true).
  3166. */
  3167. findNegativeWeightCycles?: boolean;
  3168. }
  3169. /**
  3170. * http://js.cytoscape.org/#eles.bellmanFord
  3171. */
  3172. interface SearchBellmanFordResult {
  3173. /**
  3174. * function that computes the shortest path from root node to the argument node
  3175. * (either objects or selector string)
  3176. */
  3177. pathTo(node: NodeSingular | Selector): CollectionReturnValue;
  3178. /**
  3179. * function that computes the shortest distance from root node to argument node
  3180. * (either objects or selector string)
  3181. */
  3182. distanceTo(node: NodeSingular | Selector): number;
  3183. /* true/false. If true, pathTo and distanceTo will be undefined */
  3184. hasNegativeWeightCycle: boolean;
  3185. /**
  3186. * array of collections corresponding to the negative weight cycles found
  3187. * (only populated if the findNegativeWeightCycles option is set to true)
  3188. */
  3189. negativeWeightCycles: CollectionReturnValue[];
  3190. }
  3191. /**
  3192. * http://js.cytoscape.org/#eles.kruskal
  3193. * trivial so implemented in the function
  3194. */
  3195. /**
  3196. * http://js.cytoscape.org/#eles.pageRank
  3197. */
  3198. interface SearchPageRankOptions {
  3199. /** Numeric parameter for the algorithm. */
  3200. dampingFactor?: number;
  3201. /** Numeric parameter that represents the required precision. */
  3202. precision?: number;
  3203. /** Maximum number of iterations to perform. */
  3204. iterations?: number;
  3205. }
  3206. /**
  3207. * http://js.cytoscape.org/#eles.pageRank
  3208. */
  3209. interface SearchPageRankResult {
  3210. /** function that computes the rank of a given node (either object or selector string) */
  3211. rank(node: NodeCollection): number;
  3212. }
  3213. /**
  3214. * http://js.cytoscape.org/#eles.degreeCentrality
  3215. */
  3216. interface SearchDegreeCentralityOptions {
  3217. /**
  3218. * The root node (selector or collection) for which the
  3219. * centrality calculation is made.
  3220. */
  3221. root: NodeSingular | Selector;
  3222. /** A function that returns the weight for the edge. */
  3223. weight?(edge: EdgeSingular): number;
  3224. /**
  3225. * The alpha value for the centrality calculation, ranging on [0, 1].
  3226. * With value 0 (default), disregards edge weights and solely uses
  3227. * number of edges in the centrality calculation. With value 1,
  3228. * disregards number of edges and solely uses the edge weights
  3229. * in the centrality calculation.
  3230. */
  3231. alpha?: number;
  3232. /**
  3233. * Whether the directed indegree and outdegree centrality is calculated (true) or
  3234. * whether the undirected centrality is calculated (false, default).
  3235. */
  3236. directed?: boolean;
  3237. }
  3238. /**
  3239. * http://js.cytoscape.org/#eles.degreeCentrality
  3240. */
  3241. interface SearchDegreeCentralityResultUndirected {
  3242. /** the degree centrality of the root node */
  3243. degree: number;
  3244. }
  3245. interface SearchDegreeCentralityResultDirected {
  3246. /* the indegree centrality of the root node */
  3247. indegree: number;
  3248. /* the outdegree centrality of the root node */
  3249. outdegree: number;
  3250. }
  3251. /**
  3252. * http://js.cytoscape.org/#eles.degreeCentralityNormalized
  3253. */
  3254. interface SearchDegreeCentralityNormalizedOptions {
  3255. /** A function that returns the weight for the edge. */
  3256. weight(edge: EdgeSingular): number;
  3257. /**
  3258. * The alpha value for the centrality calculation, ranging on [0, 1].
  3259. * With value 0 (default), disregards edge weights and solely uses
  3260. * number of edges in the centrality calculation. With value 1,
  3261. * disregards number of edges and solely uses the edge weights
  3262. * in the centrality calculation.
  3263. */
  3264. alpha?: number;
  3265. /**
  3266. * A boolean indicating whether the directed indegree and outdegree centrality is calculated (true) or
  3267. * whether the undirected centrality is calculated (false, default).
  3268. */
  3269. directed?: boolean;
  3270. }
  3271. /**
  3272. * http://js.cytoscape.org/#eles.degreeCentralityNormalized
  3273. */
  3274. interface SearchDegreeCentralityNormalizedResultUndirected {
  3275. /** the normalised degree centrality of the specified node */
  3276. degree(node: NodeSingular): any;
  3277. }
  3278. interface SearchDegreeCentralityNormalizedResultDirected {
  3279. /** the normalised indegree centrality of the specified node */
  3280. indegree(node: NodeSingular): any;
  3281. /** the normalised outdegree centrality of the specified node */
  3282. outdegree(node: NodeSingular): any;
  3283. }
  3284. /**
  3285. * http://js.cytoscape.org/#eles.closenessCentrality
  3286. */
  3287. interface SearchClosenessCentralityOptions {
  3288. /**
  3289. * The root node (selector or collection) for which the
  3290. * centrality calculation is made.
  3291. */
  3292. root: NodeSingular | Selector;
  3293. /** A function that returns the weight for the edge. */
  3294. weight?(edge: EdgeSingular): number;
  3295. /**
  3296. * A boolean indicating whether the directed indegree and outdegree centrality is calculated (true) or
  3297. * whether the undirected centrality is calculated (false, default).
  3298. */
  3299. directed?: boolean;
  3300. /**
  3301. * A boolean indicating whether the algorithm calculates the
  3302. * harmonic mean (true, default) or the arithmetic mean (false) of distances.
  3303. * The harmonic mean is very useful for graphs that are not strongly connected.
  3304. */
  3305. harmonic?: boolean;
  3306. }
  3307. /**
  3308. * http://js.cytoscape.org/#eles.closenessCentrality
  3309. * trivial
  3310. */
  3311. /**
  3312. * http://js.cytoscape.org/#eles.closenessCentralityNormalized
  3313. */
  3314. interface SearchClosenessCentralityNormalizedOptions {
  3315. /** A function that returns the weight for the edge. */
  3316. weight?(edge: EdgeSingular): number;
  3317. directed?: boolean;
  3318. /**
  3319. * A boolean indicating whether the algorithm calculates the
  3320. * harmonic mean (true, default) or the arithmetic mean (false) of distances.
  3321. * The harmonic mean is very useful for graphs that are not strongly connected.
  3322. */
  3323. harmonic?: boolean;
  3324. }
  3325. /**
  3326. * http://js.cytoscape.org/#eles.closenessCentralityNormalized
  3327. */
  3328. interface SearchClosenessCentralityNormalizedResult {
  3329. /** the normalised closeness centrality of the specified node */
  3330. closeness(node: NodeSingular): any;
  3331. }
  3332. /**
  3333. * http://js.cytoscape.org/#eles.betweennessCentrality
  3334. */
  3335. interface SearchBetweennessOptions {
  3336. /** A function that returns the weight for the edge. */
  3337. weight?(edge: EdgeSingular): number;
  3338. /**
  3339. * A boolean indicating whether the directed indegree and outdegree centrality is calculated (true) or
  3340. * whether the undirected centrality is calculated (false, default).
  3341. */
  3342. directed?: boolean;
  3343. }
  3344. /**
  3345. * http://js.cytoscape.org/#eles.betweennessCentrality
  3346. */
  3347. interface SearchBetweennessResult {
  3348. /** returns the betweenness centrality of the specified node */
  3349. betweenness(node: NodeSingular): number;
  3350. /** returns the normalised betweenness centrality of the specified node */
  3351. betweennessNormalized(node: NodeSingular): number;
  3352. betweennessNormalised(node: NodeSingular): number;
  3353. }
  3354. /**
  3355. * http://js.cytoscape.org/#eles.closenessCentralityNormalized
  3356. */
  3357. interface SearchClosenessCentralityNormalizedOptions {
  3358. /** A function that returns the weight for the edge. */
  3359. weight?(edge: EdgeSingular): number;
  3360. directed?: boolean;
  3361. /**
  3362. * A boolean indicating whether the algorithm calculates the
  3363. * harmonic mean (true, default) or the arithmetic mean (false) of distances.
  3364. * The harmonic mean is very useful for graphs that are not strongly connected.
  3365. */
  3366. harmonic?: boolean;
  3367. }
  3368. /**
  3369. * http://js.cytoscape.org/#eles.closenessCentralityNormalized
  3370. * trivial
  3371. */
  3372. /**
  3373. * Options for hierarchical clustering.
  3374. */
  3375. interface HierarchicalClusteringOptions {
  3376. attributes?: ((node: NodeSingular) => number)[];
  3377. distance?: "euclidean" | "squaredEuclidean" | "manhattan" | "max" | ((length: number, getPAt: (i: number) => number, getQAt: (i: number) => number, nodeP?: NodeSingular, nodeQ?: NodeSingular) => number) | ((nodeP: NodeSingular, nodeQ: NodeSingular) => number);
  3378. linkage?: "mean" | "min" | "max";
  3379. mode?: "threshold" | "dendrogram";
  3380. threshold?: number;
  3381. dendrogramDepth?: number;
  3382. addDendrogram?: boolean;
  3383. }
  3384. /**
  3385. * Result of hierarchical clustering.
  3386. */
  3387. interface HierarchicalClusteringResult {
  3388. clusters: NodeCollection[];
  3389. dendrogram?: CollectionReturnValue;
  3390. }
  3391. /**
  3392. * Options for Markov clustering.
  3393. */
  3394. interface MarkovClusteringOptions {
  3395. attributes?: ((edge: EdgeSingular) => number)[];
  3396. expandFactor?: number;
  3397. inflateFactor?: number;
  3398. multFactor?: number;
  3399. maxIterations?: number;
  3400. }
  3401. /**
  3402. * Result of Markov clustering.
  3403. */
  3404. type MarkovClusteringResult = NodeCollection[];
  3405. /**
  3406. * Options for k-means clustering.
  3407. */
  3408. interface KMeansOptions {
  3409. attributes: ((node: NodeSingular) => number)[];
  3410. k: number;
  3411. distance?: "euclidean" | "squaredEuclidean" | "manhattan" | "max" | ((length: number, getPAt: (i: number) => number, getQAt: (i: number) => number, nodeP?: NodeSingular, nodeQ?: NodeSingular) => number);
  3412. maxIterations?: number;
  3413. sensitivityThreshold?: number;
  3414. }
  3415. /**
  3416. * Result of k-means clustering.
  3417. */
  3418. type KMeansResult = NodeCollection[];
  3419. /**
  3420. * Options for k-medoids clustering.
  3421. */
  3422. interface KMedoidsOptions {
  3423. attributes: ((node: NodeSingular) => number)[];
  3424. k: number;
  3425. distance?: "euclidean" | "squaredEuclidean" | "manhattan" | "max" | ((length: number, getPAt: (i: number) => number, getQAt: (i: number) => number, nodeP?: NodeSingular, nodeQ?: NodeSingular) => number) | ((nodeP: NodeSingular, nodeQ: NodeSingular) => number);
  3426. maxIterations?: number;
  3427. }
  3428. /**
  3429. * Result of k-medoids clustering.
  3430. */
  3431. type KMedoidsResult = NodeCollection[];
  3432. /**
  3433. * Options for fuzzy c-means clustering.
  3434. */
  3435. interface FuzzyCMeansOptions {
  3436. attributes: ((node: NodeSingular) => number)[];
  3437. k: number;
  3438. distance?: "euclidean" | "squaredEuclidean" | "manhattan" | "max" | ((length: number, getPAt: (i: number) => number, getQAt: (i: number) => number, nodeP?: NodeSingular, nodeQ?: NodeSingular) => number);
  3439. maxIterations?: number;
  3440. sensitivityThreshold?: number;
  3441. }
  3442. /**
  3443. * Result of fuzzy c-means clustering.
  3444. */
  3445. interface FuzzyCMeansResult {
  3446. clusters: NodeCollection[];
  3447. degreeOfMembership: number[][];
  3448. }
  3449. /**
  3450. * Options for affinity propagation clustering.
  3451. */
  3452. interface AffinityPropagationOptions {
  3453. attributes: ((node: NodeSingular) => number)[];
  3454. distance?: "euclidean" | "squaredEuclidean" | "manhattan" | "max" | ((length: number, getPAt: (i: number) => number, getQAt: (i: number) => number, nodeP?: NodeSingular, nodeQ?: NodeSingular) => number) | ((nodeP: NodeSingular, nodeQ: NodeSingular) => number);
  3455. preference?: "median" | "mean" | "min" | "max" | number;
  3456. damping?: number;
  3457. minIterations?: number;
  3458. maxIterations?: number;
  3459. }
  3460. /**
  3461. * Result of affinity propagation clustering.
  3462. */
  3463. type AffinityPropagationResult = NodeCollection[];
  3464. /**
  3465. * Options for Hierholzer's algorithm.
  3466. */
  3467. interface HierholzerOptions {
  3468. root?: Selector | NodeCollection;
  3469. directed?: boolean;
  3470. }
  3471. /**
  3472. * Result of Hierholzer's algorithm.
  3473. */
  3474. interface HierholzerResult {
  3475. found: boolean;
  3476. trail: CollectionReturnValue;
  3477. }
  3478. interface SearchAlgorithms {
  3479. /**
  3480. * Perform a breadth-first search within the elements in the collection.
  3481. * @param options
  3482. * http://js.cytoscape.org/#eles.breadthFirstSearch
  3483. * @alias bfs
  3484. */
  3485. breadthFirstSearch(options: SearchFirstOptions): SearchFirstResult;
  3486. bfs(options: SearchFirstOptions): SearchFirstResult;
  3487. /**
  3488. * Perform a depth-first search within the elements in the collection.
  3489. * http://js.cytoscape.org/#eles.depthFirstSearch
  3490. * @alias dfs
  3491. */
  3492. depthFirstSearch(options: SearchFirstOptions): SearchFirstResult;
  3493. dfs(options: SearchFirstOptions): SearchFirstResult;
  3494. /**
  3495. * Perform Dijkstra's algorithm on the elements in the collection.
  3496. * This finds the shortest paths to all other nodes in the collection from the root node.
  3497. * http://js.cytoscape.org/#eles.dijkstra
  3498. */
  3499. dijkstra(options: SearchDijkstraOptions): SearchDijkstraResult;
  3500. /**
  3501. * Perform the A* search algorithm on the elements in the collection.
  3502. * This finds the shortest path from the root node to the goal node.
  3503. * http://js.cytoscape.org/#eles.aStar
  3504. */
  3505. aStar(options: SearchAStarOptions): SearchAStarResult;
  3506. /**
  3507. * Perform the Floyd Warshall search algorithm on the elements in the collection.
  3508. * This finds the shortest path between all pairs of nodes.
  3509. * http://js.cytoscape.org/#eles.floydWarshall
  3510. */
  3511. floydWarshall(options: SearchFloydWarshallOptions): SearchFloydWarshallResult;
  3512. /**
  3513. * Perform the Bellman-Ford search algorithm on the elements in the collection.
  3514. * This finds the shortest path from the starting node to all other nodes in the collection.
  3515. * http://js.cytoscape.org/#eles.bellmanFord
  3516. */
  3517. bellmanFord(options: SearchBellmanFordOptions): SearchBellmanFordResult;
  3518. /**
  3519. * Perform the Hierholzer search algorithm on the elements in the collection.
  3520. * This finds Eulerian trails and circuits.
  3521. * http://js.cytoscape.org/#eles.hierholzer
  3522. */
  3523. hierholzer(options: HierholzerOptions): HierholzerResult;
  3524. }
  3525. interface SpanningAlgorithms {
  3526. /**
  3527. * Perform Kruskal's algorithm on the elements in the collection,
  3528. * returning the minimum spanning tree, assuming undirected edges.
  3529. * http://js.cytoscape.org/#eles.kruskal
  3530. */
  3531. kruskal(handler: (edge: EdgeCollection) => number): CollectionReturnValue;
  3532. }
  3533. interface CutAlgorithms {
  3534. /**
  3535. * Finds the minimum cut in a graph using the Karger-Stein algorithm.
  3536. * The optimal result is found with a high probability, but without guarantee.
  3537. * http://js.cytoscape.org/#eles.kargerStein
  3538. */
  3539. kargerStein(): {
  3540. cut: EdgeCollection;
  3541. components: CollectionReturnValue;
  3542. partitionFirst: NodeCollection;
  3543. partitionSecond: NodeCollection;
  3544. };
  3545. /**
  3546. * finds the biconnected components in an undirected graph,
  3547. * as well as their respective cut vertices, using an algorithm due to Hopcroft and Tarjan.
  3548. * http://js.cytoscape.org/#eles.hopcroftTarjanBiconnected
  3549. */
  3550. hopcroftTarjanBiconnected(): { cut: NodeCollection; components: CollectionReturnValue };
  3551. /**
  3552. * Finds the biconnected components in an undirected graph,
  3553. * as well as their respective cut vertices, using an algorithm due to Hopcroft and Tarjan.
  3554. * http://js.cytoscape.org/#eles.hopcroftTarjanBiconnected
  3555. */
  3556. hopcroftTarjanBiconnectedComponents(): { cut: NodeCollection; components: CollectionReturnValue };
  3557. /**
  3558. * Finds the biconnected components in an undirected graph,
  3559. * as well as their respective cut vertices, using an algorithm due to Hopcroft and Tarjan.
  3560. * http://js.cytoscape.org/#eles.hopcroftTarjanBiconnected
  3561. */
  3562. htb(): { cut: NodeCollection; components: CollectionReturnValue };
  3563. /**
  3564. * Finds the biconnected components in an undirected graph,
  3565. * as well as their respective cut vertices, using an algorithm due to Hopcroft and Tarjan.
  3566. * http://js.cytoscape.org/#eles.hopcroftTarjanBiconnected
  3567. */
  3568. htbc(): { cut: NodeCollection; components: CollectionReturnValue };
  3569. /**
  3570. * Finds the strongly connected components of a directed graph using Tarjan's algorithm.
  3571. * http://js.cytoscape.org/#eles.tarjanStronglyConnected
  3572. */
  3573. tarjanStronglyConnected(): { cut: EdgeCollection; components: CollectionReturnValue };
  3574. /**
  3575. * Finds the strongly connected components of a directed graph using Tarjan's algorithm.
  3576. * http://js.cytoscape.org/#eles.tarjanStronglyConnected
  3577. */
  3578. tarjanStronglyConnectedComponents(): { cut: EdgeCollection; components: CollectionReturnValue };
  3579. /**
  3580. * Finds the strongly connected components of a directed graph using Tarjan's algorithm.
  3581. * http://js.cytoscape.org/#eles.tarjanStronglyConnected
  3582. */
  3583. tsc(): { cut: EdgeCollection; components: CollectionReturnValue };
  3584. /**
  3585. * Finds the strongly connected components of a directed graph using Tarjan's algorithm.
  3586. * http://js.cytoscape.org/#eles.tarjanStronglyConnected
  3587. */
  3588. tscc(): { cut: EdgeCollection; components: CollectionReturnValue };
  3589. }
  3590. interface CentralityAlgorithms {
  3591. /**
  3592. * Considering only the elements in the calling collection,
  3593. * calculate the degree centrality of the specified root node.
  3594. * http://js.cytoscape.org/#eles.degreeCentrality
  3595. */
  3596. degreeCentrality(
  3597. options: SearchDegreeCentralityOptions,
  3598. ): SearchDegreeCentralityResultDirected | SearchDegreeCentralityResultUndirected;
  3599. /**
  3600. * Considering only the elements in the calling collection,
  3601. * calculate the normalised degree centrality of the nodes.
  3602. * http://js.cytoscape.org/#eles.degreeCentralityNormalized
  3603. */
  3604. degreeCentralityNormalized(
  3605. options: SearchDegreeCentralityNormalizedOptions,
  3606. ): SearchDegreeCentralityNormalizedResultDirected | SearchDegreeCentralityNormalizedResultUndirected;
  3607. /**
  3608. * Considering only the elements in the calling collection,
  3609. * calculate the closeness centrality of the specified root node.
  3610. * http://js.cytoscape.org/#eles.closenessCentrality
  3611. */
  3612. closenessCentrality(options: SearchClosenessCentralityOptions): number;
  3613. /**
  3614. * Considering only the elements in the calling collection,
  3615. * calculate the closeness centrality of the nodes.
  3616. * http://js.cytoscape.org/#eles.closenessCentralityNormalized
  3617. */
  3618. closenessCentralityNormalized(
  3619. options: SearchClosenessCentralityNormalizedOptions,
  3620. ): SearchClosenessCentralityNormalizedResult;
  3621. /**
  3622. * Considering only the elements in the calling collection,
  3623. * calculate the betweenness centrality of the nodes.
  3624. * http://js.cytoscape.org/#eles.betweennessCentrality
  3625. */
  3626. betweennessCentrality(options: SearchBetweennessOptions): SearchBetweennessResult;
  3627. /**
  3628. * Rank the nodes in the collection using the Page Rank algorithm.
  3629. * http://js.cytoscape.org/#eles.pageRank
  3630. */
  3631. pageRank(options: SearchPageRankOptions): SearchPageRankResult;
  3632. }
  3633. interface ClusteringAlgorithms {
  3634. /**
  3635. * Considering only the elements in the calling collection,
  3636. * run the Markov cluster algorithm of the nodes.
  3637. * http://js.cytoscape.org/#eles.markovClustering
  3638. */
  3639. markovClustering(options: MarkovClusteringOptions): MarkovClusteringResult;
  3640. /**
  3641. * Considering only the nodes in the calling collection,
  3642. * calculate the k-means clustering of the nodes.
  3643. * http://js.cytoscape.org/#nodes.kMeans
  3644. */
  3645. kMeans(options: KMeansOptions): KMeansResult;
  3646. /**
  3647. * Considering only the elements in the calling collection,
  3648. * calculate the agglomerative hierarchical clustering of the nodes.
  3649. * http://js.cytoscape.org/#nodes.hierarchicalClustering
  3650. */
  3651. hierarchicalClustering(options: HierarchicalClusteringOptions): HierarchicalClusteringResult;
  3652. /**
  3653. * Considering only the nodes in the calling collection,
  3654. * calculate the k-medoids clustering of the nodes.
  3655. * http://js.cytoscape.org/#nodes.kMedoids
  3656. */
  3657. kMedoids(options: KMedoidsOptions): KMedoidsResult;
  3658. /**
  3659. * Considering only the elements in the calling collection,
  3660. * calculate the fuzzy c-means clustering of the nodes.
  3661. * http://js.cytoscape.org/#nodes.fuzzyCMeans
  3662. */
  3663. fuzzyCMeans(options: FuzzyCMeansOptions): FuzzyCMeansResult;
  3664. /**
  3665. * Considering only the elements in the calling collection,
  3666. * calculate the affinity propagation clustering of the nodes.
  3667. * http://js.cytoscape.org/#nodes.affinityPropagation
  3668. */
  3669. affinityPropagation(options: AffinityPropagationOptions): AffinityPropagationResult;
  3670. }
  3671. interface CollectionAlgorithms extends SearchAlgorithms, SpanningAlgorithms, CutAlgorithms, CentralityAlgorithms, ClusteringAlgorithms {}
  3672. /**
  3673. * http://js.cytoscape.org/#collection/compound-nodes
  3674. */
  3675. interface NodeSingularCompound {
  3676. /**
  3677. * Get whether the node is a compound parent
  3678. * (i.e. a node containing one or more child nodes)
  3679. * http://js.cytoscape.org/#node.isParent
  3680. */
  3681. isParent(): boolean;
  3682. /**
  3683. * Get whether the node is childless (i.e. a node with no child nodes)
  3684. * http://js.cytoscape.org/#node.isChildless
  3685. */
  3686. isChildless(): boolean;
  3687. /**
  3688. * Get whether the node is a compound child (i.e. contained within a node)
  3689. * http://js.cytoscape.org/#node.isChild
  3690. */
  3691. isChild(): boolean;
  3692. /**
  3693. * Get whether the node is an orphan (i.e. a node with no parent)
  3694. * http://js.cytoscape.org/#node.isOrphan
  3695. */
  3696. isOrphan(): boolean;
  3697. }
  3698. /**
  3699. * http://js.cytoscape.org/#collection/compound-nodes
  3700. */
  3701. interface NodeCollectionCompound {
  3702. /**
  3703. * Get the compound parent node of each node in the collection.
  3704. * @param selector A selector used to filter the resultant collection.
  3705. * http://js.cytoscape.org/#nodes.parent
  3706. */
  3707. parent(selector?: Selector): NodeCollection;
  3708. /**
  3709. * Get all compound ancestor nodes
  3710. * (i.e. parents, parents' parents, etc.) of each node in the collection.
  3711. * @param selector A selector used to filter the resultant collection.
  3712. * http://js.cytoscape.org/#nodes.ancestors
  3713. */
  3714. ancestors(selector?: Selector): NodeCollection;
  3715. parents(selector?: Selector): NodeCollection;
  3716. /**
  3717. * Get all compound ancestors common to all the nodes in the collection,
  3718. * starting with the closest and getting progressively farther.
  3719. * @param selector A selector used to filter the resultant collection.
  3720. * http://js.cytoscape.org/#nodes.commonAncestors
  3721. */
  3722. commonAncestors(selector?: Selector): NodeCollection;
  3723. /**
  3724. * Get all orphan (i.e. has no compound parent) nodes in the calling collection.
  3725. * @param selector A selector used to filter the resultant collection.
  3726. * http://js.cytoscape.org/#nodes.orphans
  3727. */
  3728. orphans(selector?: Selector): NodeCollection;
  3729. /**
  3730. * Get all nonorphan (i.e. has a compound parent) nodes in the calling collection.
  3731. * @param selector A selector used to filter the resultant collection.
  3732. * http://js.cytoscape.org/#nodes.nonorphans
  3733. */
  3734. nonorphans(selector?: Selector): NodeCollection;
  3735. /**
  3736. * Get all compound child (i.e. direct descendant) nodes of each node in the collection.
  3737. * @param selector A selector used to filter the resultant collection.
  3738. * http://js.cytoscape.org/#nodes.children
  3739. */
  3740. children(selector?: Selector): NodeCollection;
  3741. /**
  3742. * Get all compound descendant (i.e. children, children's children, etc.)
  3743. * nodes of each node in the collection.
  3744. * @param selector A selector used to filter the resultant collection.
  3745. * http://js.cytoscape.org/#nodes.descendants
  3746. */
  3747. descendants(selector?: Selector): NodeCollection;
  3748. /**
  3749. * Get all sibling (i.e. same compound parent)
  3750. * nodes of each node in the collection.
  3751. * @param selector A selector used to filter the resultant collection.
  3752. * http://js.cytoscape.org/#nodes.siblings
  3753. */
  3754. siblings(selector?: Selector): NodeCollection;
  3755. }
  3756. /**
  3757. * A selector functions similar to a CSS selector on DOM elements,
  3758. * but selectors in Cytoscape.js instead work on
  3759. * collections of graph elements.
  3760. * Note that wherever a selector may be specified
  3761. * as the argument to a function,
  3762. * a eles.filter()-style filter function may be
  3763. * used in place of the selector.
  3764. *
  3765. * See http://js.cytoscape.org/#selectors for
  3766. * details about writing selectors.
  3767. * Selectors are an island grammar.
  3768. */
  3769. type Selector = string;
  3770. /**
  3771. * A space separated list of event names.
  3772. * http://js.cytoscape.org/#cy.promiseOn
  3773. */
  3774. type EventNames = string;
  3775. /**
  3776. * A string indicating the selection behaviour from user input.
  3777. * http://js.cytoscape.org/#core/initialisation
  3778. *
  3779. * 'additive' : a new selection made by the user adds to the set of currently selected elements.
  3780. * 'single' : a new selection made by the user becomes the entire set of currently
  3781. * selected elements (i.e. the previous elements are unselected)
  3782. */
  3783. type SelectionType = "additive" | "single";
  3784. /**
  3785. * http://js.cytoscape.org/#ele.group
  3786. * http://js.cytoscape.org/#notation/elements-json
  3787. *
  3788. * 'nodes'
  3789. * 'edges'
  3790. */
  3791. type ElementGroup = "nodes" | "edges";
  3792. /**
  3793. * 'x' : x coordinate
  3794. * 'y' : y coordinate
  3795. */
  3796. type PositionDimension = "x" | "y";
  3797. /**
  3798. * Usually temp or nonserialisable data can be stored.
  3799. * http://js.cytoscape.org/#notation/elements-json
  3800. * http://js.cytoscape.org/#cy.scratch
  3801. * http://js.cytoscape.org/#ele.scratch
  3802. */
  3803. type Scratchpad = any;
  3804. /**
  3805. * Style in Cytoscape.js follows CSS conventions as closely as possible.
  3806. * In most cases, a property has the same name and behaviour as its corresponding CSS namesake.
  3807. * However, the properties in CSS are not sufficient to specify the style of some parts of the graph.
  3808. * In that case, additional properties are introduced that are unique to Cytoscape.js.
  3809. *
  3810. * For simplicity and ease of use, specificity rules are completely ignored in stylesheets.
  3811. * For a given style property for a given element, the last matching selector wins.
  3812. *
  3813. * http://js.cytoscape.org/#style
  3814. */
  3815. namespace Css {
  3816. type Colour = string;
  3817. /**
  3818. * In addition to specifying the value of a property outright, the developer may also use a mapper to dynamically specify the property value.
  3819. * - data()
  3820. * - mapData()
  3821. * - function( ele ){ ... }
  3822. * https://js.cytoscape.org/#style/mappers
  3823. */
  3824. type MapperFunction<Element, Type> = (ele: Element) => Type;
  3825. type PropertyValue<SingularType extends NodeSingular | EdgeSingular | cytoscape.Core, Type> =
  3826. | Type
  3827. | MapperFunction<SingularType, Type>;
  3828. type PropertyValueNode<Type> = PropertyValue<NodeSingular, Type>;
  3829. type PropertyValueEdge<Type> = PropertyValue<EdgeSingular, Type>;
  3830. type PropertyValueCore<Type> = PropertyValue<cytoscape.Core, Type>;
  3831. /**
  3832. * The shape of the node’s body.
  3833. * Note that each shape fits within the specified width and height,
  3834. * and so you may have to adjust width and height
  3835. * if you desire an equilateral shape
  3836. * (i.e. width !== height for several equilateral shapes).
  3837. * 'polygon' is a custom polygon specified via shape-polygon-points.
  3838. */
  3839. type NodeShape =
  3840. | "rectangle"
  3841. | "roundrectangle"
  3842. | "ellipse"
  3843. | "triangle"
  3844. | "pentagon"
  3845. | "hexagon"
  3846. | "heptagon"
  3847. | "octagon"
  3848. | "star"
  3849. | "barrel"
  3850. | "diamond"
  3851. | "vee"
  3852. | "rhomboid"
  3853. | "polygon"
  3854. | "tag"
  3855. | "round-rectangle"
  3856. | "round-triangle"
  3857. | "round-diamond"
  3858. | "round-pentagon"
  3859. | "round-hexagon"
  3860. | "round-heptagon"
  3861. | "round-octagon"
  3862. | "round-tag"
  3863. | "cut-rectangle"
  3864. | "bottom-round-rectangle"
  3865. | "concave-hexagon";
  3866. /**
  3867. * A space-separated list of numbers ranging on [-1, 1],
  3868. * representing alternating x and y values (i.e. x1 y1 x2 y2, x3 y3 ...).
  3869. * This represents the points in the polygon for the node’s shape.
  3870. * The bounding box of the node is given by (-1, -1), (1, -1), (1, 1), (-1, 1).
  3871. */
  3872. type ShapePolygonPoints = string;
  3873. /**
  3874. * The line style; may be solid, dotted, dashed, or double
  3875. */
  3876. type LineStyle = "solid" | "dotted" | "dashed" | "double";
  3877. /**
  3878. * http://js.cytoscape.org/#style/node-body
  3879. */
  3880. interface Node
  3881. extends
  3882. Partial<Overlay>,
  3883. Partial<Underlay>,
  3884. Partial<Outline>,
  3885. PaddingNode,
  3886. Partial<CompoundParentSizing>,
  3887. Partial<Labels<NodeSingular>>,
  3888. BackgroundImage,
  3889. Partial<Ghost>,
  3890. Partial<Visibility<NodeSingular>>,
  3891. Partial<PieChartBackground>,
  3892. Partial<Events<NodeSingular>>,
  3893. Partial<TransitionAnimation>
  3894. {
  3895. /**
  3896. * The CSS content field
  3897. */
  3898. content?: PropertyValueNode<string>;
  3899. /**
  3900. * The width of the node’s body.
  3901. * This property can take on the special value label
  3902. * so the width is automatically based on the node’s label.
  3903. */
  3904. width?: PropertyValueNode<number | string>;
  3905. /**
  3906. * The height of the node’s body.
  3907. * This property can take on the special value label
  3908. * so the height is automatically based on the node’s label.
  3909. */
  3910. height?: PropertyValueNode<number | string>;
  3911. /**
  3912. * The shape of the node’s body.
  3913. */
  3914. shape?: PropertyValueNode<NodeShape>;
  3915. "shape-polygon-points"?: PropertyValueNode<ShapePolygonPoints>;
  3916. backgroundColor?: PropertyValueNode<Colour>;
  3917. /**
  3918. * The colour of the node’s body.
  3919. */
  3920. "background-color"?: PropertyValueNode<Colour>;
  3921. /**
  3922. * Blackens the node’s body for values from 0 to 1;
  3923. * whitens the node’s body for values from 0 to -1.
  3924. */
  3925. "background-blacken"?: PropertyValueNode<number>;
  3926. /**
  3927. * The opacity level of the node’s background colour.
  3928. */
  3929. "background-opacity"?: PropertyValueNode<number>;
  3930. /**
  3931. * The filling style of the node’s body; may be solid (default), linear-gradient, or radial-gradient.
  3932. */
  3933. "background-fill"?: PropertyValueNode<"solid" | "linear-gradient" | "radial-gradient">;
  3934. /**
  3935. * The size of the node’s border.
  3936. */
  3937. "background-gradient-direction"?: PropertyValueNode<string>;
  3938. /**
  3939. * The colors to use at each stop in the gradient for the node’s background; may be specified as a space-separated list or an array.
  3940. */
  3941. "background-gradient-stop-colors"?: PropertyValueNode<string[]>;
  3942. /**
  3943. * The positions of each stop in the gradient for the node’s background; may be specified as a space-separated list or an array.
  3944. */
  3945. "background-gradient-stop-positions"?: PropertyValueNode<(number | string)[]>;
  3946. "border-width"?: PropertyValueNode<number | string>;
  3947. /**
  3948. * The style of the node’s border.
  3949. */
  3950. "border-style"?: PropertyValueNode<LineStyle>;
  3951. /**
  3952. * The colour of the node’s border.
  3953. */
  3954. "border-color"?: PropertyValueNode<Colour>;
  3955. /**
  3956. * The opacity of the node’s border.
  3957. * A value between [0 1].
  3958. */
  3959. "border-opacity"?: PropertyValueNode<number>;
  3960. /**
  3961. * The position of the node’s border.
  3962. * One of: center, inside, outside.
  3963. */
  3964. /**
  3965. * The cap style of the node’s border; may be butt, round or square.
  3966. */
  3967. "border-cap"?: PropertyValueNode<"butt" | "round" | "square">;
  3968. /**
  3969. * The join style of the node’s border; may be miter, bevel or round.
  3970. */
  3971. "border-join"?: PropertyValueNode<"miter" | "bevel" | "round">;
  3972. /**
  3973. * The dashed line pattern which specifies alternating lengths of lines and gaps. (e.g. [6, 3]).
  3974. */
  3975. "border-dash-pattern"?: PropertyValueNode<number[]>;
  3976. /**
  3977. * The dashed line offset (e.g. 24). It is useful for creating edge animations.
  3978. */
  3979. "border-dash-offset"?: PropertyValueNode<number>;
  3980. /**
  3981. * The position of the node’s border; may be center, inside, outside.
  3982. */
  3983. "border-position"?: PropertyValueNode<"center" | "inside" | "outside">;
  3984. /**
  3985. * The corner radius for round shapes and the cut-rectangle, in px or em.
  3986. */
  3987. "corner-radius"?: PropertyValueNode<string>;
  3988. }
  3989. /**
  3990. * A padding defines an addition to a node’s dimension. For example,
  3991. * padding adds to a node’s outer (i.e. total) width and height.
  3992. * This can be used to add spacing between a compound node parent
  3993. * and its children.
  3994. */
  3995. interface PaddingNode {
  3996. /**
  3997. * The amount of padding around all sides of the node. Either percentage or pixel value can be specified.
  3998. * For example, both `50%` and `50px` are acceptable values. By default, percentage padding is calculated as a percentage of node width.
  3999. */
  4000. "padding"?: PropertyValueNode<string>;
  4001. /**
  4002. * Determines how padding is calculated if and only if the percentage unit is used. Accepts one of the keywords specified below.
  4003. * - `width`: calculate padding as a percentage of the node width.
  4004. * - `height`: calculate padding as a percentage of the node height.
  4005. * - `average`: calculate padding as a percentage of the average of the node width and height.
  4006. * - `min`: calculate padding as a percentage of the minimum of the node width and height.
  4007. * - `max`: calculate padding as a percentage of the maximum of the node width and height.
  4008. */
  4009. "padding-relative-to"?: PropertyValueNode<"width" | "height" | "average" | "min" | "max">;
  4010. "padding-left"?: PropertyValueNode<string>;
  4011. "padding-right"?: PropertyValueNode<string>;
  4012. "padding-top"?: PropertyValueNode<string>;
  4013. "padding-bottom"?: PropertyValueNode<string>;
  4014. }
  4015. interface CompoundParentSizing {
  4016. /**
  4017. * Whether to include labels of descendants in sizing a compound node; may be include or exclude.
  4018. */
  4019. "compound-sizing-wrt-labels"?: PropertyValueNode<"include" | "exclude">;
  4020. /**
  4021. * Specifies the minimum (inner) width of the node’s body for a compound parent node (e.g. 400px).
  4022. */
  4023. "min-width"?: PropertyValueNode<string>;
  4024. /**
  4025. * When a compound node is enlarged by its min-width, this value specifies the percent of the extra width put on the left side of the node (e.g. 50%).
  4026. */
  4027. "min-width-bias-left"?: PropertyValueNode<string>;
  4028. /**
  4029. * When a compound node is enlarged by its min-width, this value specifies the percent of the extra width put on the right side of the node (e.g. 50%).
  4030. */
  4031. "min-width-bias-right"?: PropertyValueNode<string>;
  4032. /**
  4033. * Specifies the minimum (inner) height of the node’s body for a compound parent node (e.g. 400px).
  4034. */
  4035. "min-height"?: PropertyValueNode<string>;
  4036. /**
  4037. * When a compound node is enlarged by its min-height, this value specifies the percent of the extra width put on the top side of the node (e.g. 50%).
  4038. */
  4039. "min-height-bias-top"?: PropertyValueNode<string>;
  4040. }
  4041. interface Outline {
  4042. /**
  4043. * The size of the node’s outline.
  4044. */
  4045. "outline-width"?: PropertyValueNode<number | string>;
  4046. /**
  4047. * The style of the node’s outline; may be solid, dotted, dashed, or double.
  4048. */
  4049. "outline-style"?: PropertyValueNode<LineStyle>;
  4050. /**
  4051. * The colour of the node’s outline.
  4052. */
  4053. "outline-color"?: PropertyValueNode<Colour>;
  4054. /**
  4055. * The opacity of the node’s outline.
  4056. */
  4057. "outline-opacity"?: PropertyValueNode<number>;
  4058. /**
  4059. * The offset of the node’s outline.
  4060. */
  4061. "outline-offset"?: PropertyValueNode<number | string>;
  4062. }
  4063. interface Dictionary {
  4064. [key: string]: any;
  4065. }
  4066. // export interface ElementCss extends CSSStyleDeclaration { }
  4067. /**
  4068. * A background image may be applied to a node’s body:
  4069. *
  4070. * http://js.cytoscape.org/#style/background-image
  4071. */
  4072. interface BackgroundImage {
  4073. /**
  4074. * The URL that points to the image that should be used as the node’s background.
  4075. * PNG, JPG, and SVG are supported formats.
  4076. * You may use a data URI to use embedded images,
  4077. * thereby saving a HTTP request.
  4078. */
  4079. "background-image"?: PropertyValueNode<string> | PropertyValueNode<string[]>;
  4080. /**
  4081. * All images are loaded with a crossorigin attribute which may be `anonymous` or
  4082. * `use-credentials`.
  4083. *
  4084. * The default is set to `anonymous`.
  4085. */
  4086. "background-image-crossorigin"?:
  4087. | PropertyValueNode<"anonymous" | "use-credentials">
  4088. | PropertyValueNode<Array<"anonymous" | "use-credentials">>;
  4089. /**
  4090. * The opacity of the background image. [0 1]
  4091. */
  4092. "background-image-opacity"?: PropertyValueNode<number> | PropertyValueNode<number[]>;
  4093. /**
  4094. * Determines whether background image is smoothed (`yes`, default) or not (`no`).
  4095. * This is only a hint, and the browser may or may not respect the
  4096. * value set for this property.
  4097. */
  4098. "background-image-smoothing"?: PropertyValueNode<"yes" | "no"> | PropertyValueNode<Array<"yes" | "no">>;
  4099. /**
  4100. * Determines whether background image is within (`inside`)
  4101. * or over top of the node (`over`).
  4102. *
  4103. * The default is set to `inside`.
  4104. */
  4105. "background-image-containment"?:
  4106. | PropertyValueNode<"inside" | "over">
  4107. | PropertyValueNode<Array<"inside" | "over">>;
  4108. /**
  4109. * Specifies the width of the image.
  4110. * A percent value (e.g. 50%) may be used to set
  4111. * the image width relative to the node width.
  4112. * If used in combination with background- fit,
  4113. * then this value overrides the width of the image
  4114. * in calculating the fitting — thereby overriding the aspect ratio.
  4115. * The auto value is used by default, which uses the width of the image.
  4116. */
  4117. "background-width"?:
  4118. | PropertyValueNode<number | string>
  4119. | PropertyValueNode<Array<number | string>>
  4120. ;
  4121. /**
  4122. * Specifies the height of the image.
  4123. * A percent value (e.g. 50%) may be used to set the image
  4124. * height relative to the node height.
  4125. * If used in combination with background- fit,
  4126. * then this value overrides the height of the image in calculating
  4127. * the fitting — thereby overriding the aspect ratio.
  4128. * The auto value is used by default, which uses the height of the image.
  4129. */
  4130. "background-height"?:
  4131. | PropertyValueNode<number | string>
  4132. | PropertyValueNode<Array<number | string>>
  4133. ;
  4134. /**
  4135. * How the background image is fit to the node;
  4136. * may be none for original size,
  4137. * contain to fit inside node,
  4138. * or cover to cover the node.
  4139. */
  4140. "background-fit"?:
  4141. | PropertyValueNode<"none" | "contain" | "cover">
  4142. | PropertyValueNode<Array<"none" | "contain" | "cover">>
  4143. ;
  4144. /**
  4145. * Whether to repeat the background image;
  4146. * may be no-repeat, repeat-x, repeat-y, or repeat.
  4147. */
  4148. "background-repeat"?:
  4149. | PropertyValueNode<"no-repeat" | "repeat-x" | "repeat-y" | "repeat">
  4150. | PropertyValueNode<Array<"no-repeat" | "repeat-x" | "repeat-y" | "repeat">>
  4151. ;
  4152. /**
  4153. * The x position of the background image,
  4154. * measured in percent(e.g. `'50%'`) or pixels (e.g. `'10px'`).
  4155. */
  4156. "background-position-x"?:
  4157. | PropertyValueNode<number | string>
  4158. | PropertyValueNode<Array<number | string>>
  4159. ;
  4160. /**
  4161. * The y position of the background image,
  4162. * measured in percent(e.g. `'50%'`) or pixels (e.g. `'10px'`).
  4163. */
  4164. "background-position-y"?:
  4165. | PropertyValueNode<number | string>
  4166. | PropertyValueNode<Array<number | string>>
  4167. ;
  4168. /**
  4169. * The x offset of the background image,
  4170. * measured in percent(e.g. `'50%'`) or pixels (e.g. `'10px'`).
  4171. */
  4172. "background-offset-x"?: PropertyValueNode<number | string> | PropertyValueNode<Array<number | string>>;
  4173. /**
  4174. * The y offset of the background image,
  4175. * measured in percent(e.g. `'50%'`) or pixels (e.g. `'10px'`).
  4176. */
  4177. "background-offset-y"?: PropertyValueNode<number | string> | PropertyValueNode<Array<number | string>>;
  4178. /**
  4179. * Changes whether the width is calculated relative to the width of the node or
  4180. * the width in addition to the padding; may be inner or include-padding.
  4181. *
  4182. * If not specified, include-padding is used by default.
  4183. */
  4184. "background-width-relative-to"?:
  4185. | PropertyValueNode<"inner" | "include-padding">
  4186. | PropertyValueNode<Array<"inner" | "include-padding">>;
  4187. /**
  4188. * Changes whether the height is calculated relative to the height of the node or
  4189. * the height in addition to the padding; may be `inner` or `include-padding`.
  4190. *
  4191. * If not specified, `include-padding` is used by default.
  4192. */
  4193. "background-height-relative-to"?:
  4194. | PropertyValueNode<"inner" | "include-padding">
  4195. | PropertyValueNode<Array<"inner" | "include-padding">>;
  4196. /**
  4197. * How background image clipping is handled;
  4198. * may be node for clipped to node shape or none for no clipping.
  4199. */
  4200. "background-clip"?:
  4201. | PropertyValueNode<"node" | "none">
  4202. | PropertyValueNode<Array<"node" | "none">>
  4203. ;
  4204. /**
  4205. * Specifies a padding size (e.g. 20) that expands the bounding box of the node in
  4206. * all directions. This allows for images to be drawn outside of the normal bounding
  4207. * box of the node when `background-clip` is none. This is useful for small decorations
  4208. * just outside of the node.
  4209. *
  4210. * `bounds-expansions` accepts 1 value (for all directions),
  4211. * 2 values, ([topAndBottom, leftAndRight]) or 4 values ([top, right, bottom, left]).
  4212. */
  4213. "bounds-expansion"?: PropertyValueNode<
  4214. | number
  4215. | string
  4216. | [number | string, number | string]
  4217. | [number | string, number | string, number | string, number | string]
  4218. >;
  4219. }
  4220. /**
  4221. * The ghost properties allow for creating a ghosting effect, a semitransparent duplicate of the element drawn at an offset.
  4222. * https://js.cytoscape.org/#style/ghost
  4223. */
  4224. interface Ghost {
  4225. /**
  4226. * Whether to use the ghost effect; may be yes or no.
  4227. */
  4228. ghost: PropertyValueNode<"yes" | "no">;
  4229. /**
  4230. * The horizontal offset used to position the ghost effect.
  4231. */
  4232. "ghost-offset-x": PropertyValueNode<number>;
  4233. /**
  4234. * The vertical offset used to position the ghost effect.
  4235. */
  4236. "ghost-offset-y": PropertyValueNode<number>;
  4237. /**
  4238. * The opacity of the ghost effect.
  4239. */
  4240. "ghost-opacity": PropertyValueNode<number>;
  4241. }
  4242. /**
  4243. * These properties allow you to create pie chart backgrounds on nodes.
  4244. * Note that 16 slices maximum are supported per node,
  4245. * so in the properties 1 <= i <= 16.
  4246. * Of course, you must specify a numerical value for each property in place of i.
  4247. * Each nonzero sized slice is placed in order of i,
  4248. * starting from the 12 o’clock position and working clockwise.
  4249. *
  4250. * You may find it useful to reserve a number to a particular
  4251. * colour for all nodes in your stylesheet.
  4252. * Then you can specify values for pie-i-background-size
  4253. * accordingly for each node via a mapper.
  4254. * This would allow you to create consistently coloured
  4255. * pie charts in each node of the graph based on element data.
  4256. *
  4257. * http://js.cytoscape.org/#style/pie-chart-background
  4258. */
  4259. interface PieChartBackground {
  4260. /**
  4261. *
  4262. * The diameter of the pie, measured as a percent of node size (e.g. 100%) or an absolute length (e.g. 25px).
  4263. */
  4264. "pie-size": PropertyValueNode<number|string>;
  4265. /**
  4266. *
  4267. * The diameter of the hole in the centre of the pie, measured
  4268. * as a percent of node size (e.g. 100%) or an absolute length
  4269. * (e.g. 25px). This effectively converts the pie chart into a
  4270. * ring chart (default disabled, 0).
  4271. */
  4272. "pie-hole": PropertyValueNode<number|string>;
  4273. /**
  4274. *
  4275. * The start angle of the pie, measured as an angle starting at
  4276. * the 12 o'clock position and going clockwise (e.g. `90deg`
  4277. * is 3 o'clock). The default is to start at 12 o'clock (`0deg`, `0rad`).
  4278. */
  4279. "pie-start-angle": PropertyValueNode<number|string>;
  4280. /**
  4281. * @deprecated
  4282. *
  4283. * The colour of the node’s ith pie chart slice.
  4284. */
  4285. "pie-i-background-color": PropertyValueNode<Colour>;
  4286. /**
  4287. * @deprecated
  4288. *
  4289. * The size of the node’s ith (1 <= i <= 16) pie chart slice, measured in percent (e.g. 25% or 25).
  4290. */
  4291. "pie-i-background-size": PropertyValueNode<number>;
  4292. /**
  4293. * @deprecated
  4294. *
  4295. * The opacity of the node’s ith (1 <= i <= 16) pie chart slice.
  4296. */
  4297. "pie-i-background-opacity": PropertyValueNode<number>;
  4298. /**
  4299. * The colour of the node’s 1st pie chart slice.
  4300. */
  4301. "pie-1-background-color": PropertyValueNode<Colour>;
  4302. /**
  4303. * The size of the node’s 1st pie chart slice, measured in percent (e.g. 25% or 25).
  4304. */
  4305. "pie-1-background-size": PropertyValueNode<number>;
  4306. /**
  4307. * The opacity of the node’s 1st pie chart slice.
  4308. */
  4309. "pie-1-background-opacity": PropertyValueNode<number>;
  4310. /**
  4311. * The colour of the node’s 2nd pie chart slice.
  4312. */
  4313. "pie-2-background-color": PropertyValueNode<Colour>;
  4314. /**
  4315. * The size of the node’s 2nd pie chart slice, measured in percent (e.g. 25% or 25).
  4316. */
  4317. "pie-2-background-size": PropertyValueNode<number>;
  4318. /**
  4319. * The opacity of the node’s 2nd pie chart slice.
  4320. */
  4321. "pie-2-background-opacity": PropertyValueNode<number>;
  4322. /**
  4323. * The colour of the node’s 3rd pie chart slice.
  4324. */
  4325. "pie-3-background-color": PropertyValueNode<Colour>;
  4326. /**
  4327. * The size of the node’s 3rd pie chart slice, measured in percent (e.g. 25% or 25).
  4328. */
  4329. "pie-3-background-size": PropertyValueNode<number>;
  4330. /**
  4331. * The opacity of the node’s 3rd pie chart slice.
  4332. */
  4333. "pie-3-background-opacity": PropertyValueNode<number>;
  4334. /**
  4335. * The colour of the node’s 4th pie chart slice.
  4336. */
  4337. "pie-4-background-color": PropertyValueNode<Colour>;
  4338. /**
  4339. * The size of the node’s 4th pie chart slice, measured in percent (e.g. 25% or 25).
  4340. */
  4341. "pie-4-background-size": PropertyValueNode<number>;
  4342. /**
  4343. * The opacity of the node’s 4th pie chart slice.
  4344. */
  4345. "pie-4-background-opacity": PropertyValueNode<number>;
  4346. /**
  4347. * The colour of the node’s 5th pie chart slice.
  4348. */
  4349. "pie-5-background-color": PropertyValueNode<Colour>;
  4350. /**
  4351. * The size of the node’s 5th pie chart slice, measured in percent (e.g. 25% or 25).
  4352. */
  4353. "pie-5-background-size": PropertyValueNode<number>;
  4354. /**
  4355. * The opacity of the node’s 5th pie chart slice.
  4356. */
  4357. "pie-5-background-opacity": PropertyValueNode<number>;
  4358. /**
  4359. * The colour of the node’s 6th pie chart slice.
  4360. */
  4361. "pie-6-background-color": PropertyValueNode<Colour>;
  4362. /**
  4363. * The size of the node’s 6th pie chart slice, measured in percent (e.g. 25% or 25).
  4364. */
  4365. "pie-6-background-size": PropertyValueNode<number>;
  4366. /**
  4367. * The opacity of the node’s 6th pie chart slice.
  4368. */
  4369. "pie-6-background-opacity": PropertyValueNode<number>;
  4370. /**
  4371. * The colour of the node’s 7th pie chart slice.
  4372. */
  4373. "pie-7-background-color": PropertyValueNode<Colour>;
  4374. /**
  4375. * The size of the node’s 7th pie chart slice, measured in percent (e.g. 25% or 25).
  4376. */
  4377. "pie-7-background-size": PropertyValueNode<number>;
  4378. /**
  4379. * The opacity of the node’s 7th pie chart slice.
  4380. */
  4381. "pie-7-background-opacity": PropertyValueNode<number>;
  4382. /**
  4383. * The colour of the node’s 8th pie chart slice.
  4384. */
  4385. "pie-8-background-color": PropertyValueNode<Colour>;
  4386. /**
  4387. * The size of the node’s 8th pie chart slice, measured in percent (e.g. 25% or 25).
  4388. */
  4389. "pie-8-background-size": PropertyValueNode<number>;
  4390. /**
  4391. * The opacity of the node’s 8th pie chart slice.
  4392. */
  4393. "pie-8-background-opacity": PropertyValueNode<number>;
  4394. /**
  4395. * The colour of the node’s 9th pie chart slice.
  4396. */
  4397. "pie-9-background-color": PropertyValueNode<Colour>;
  4398. /**
  4399. * The size of the node’s 9th pie chart slice, measured in percent (e.g. 25% or 25).
  4400. */
  4401. "pie-9-background-size": PropertyValueNode<number>;
  4402. /**
  4403. * The opacity of the node’s 9th pie chart slice.
  4404. */
  4405. "pie-9-background-opacity": PropertyValueNode<number>;
  4406. /**
  4407. * The colour of the node’s 10th pie chart slice.
  4408. */
  4409. "pie-10-background-color": PropertyValueNode<Colour>;
  4410. /**
  4411. * The size of the node’s 10th pie chart slice, measured in percent (e.g. 25% or 25).
  4412. */
  4413. "pie-10-background-size": PropertyValueNode<number>;
  4414. /**
  4415. * The opacity of the node’s 10th pie chart slice.
  4416. */
  4417. "pie-10-background-opacity": PropertyValueNode<number>;
  4418. /**
  4419. * The colour of the node’s 11th pie chart slice.
  4420. */
  4421. "pie-11-background-color": PropertyValueNode<Colour>;
  4422. /**
  4423. * The size of the node’s 11th pie chart slice, measured in percent (e.g. 25% or 25).
  4424. */
  4425. "pie-11-background-size": PropertyValueNode<number>;
  4426. /**
  4427. * The opacity of the node’s 11th pie chart slice.
  4428. */
  4429. "pie-11-background-opacity": PropertyValueNode<number>;
  4430. /**
  4431. * The colour of the node’s 12th pie chart slice.
  4432. */
  4433. "pie-12-background-color": PropertyValueNode<Colour>;
  4434. /**
  4435. * The size of the node’s 12th pie chart slice, measured in percent (e.g. 25% or 25).
  4436. */
  4437. "pie-12-background-size": PropertyValueNode<number>;
  4438. /**
  4439. * The opacity of the node’s 12th pie chart slice.
  4440. */
  4441. "pie-12-background-opacity": PropertyValueNode<number>;
  4442. /**
  4443. * The colour of the node’s 13th pie chart slice.
  4444. */
  4445. "pie-13-background-color": PropertyValueNode<Colour>;
  4446. /**
  4447. * The size of the node’s 13th pie chart slice, measured in percent (e.g. 25% or 25).
  4448. */
  4449. "pie-13-background-size": PropertyValueNode<number>;
  4450. /**
  4451. * The opacity of the node’s 13th pie chart slice.
  4452. */
  4453. "pie-13-background-opacity": PropertyValueNode<number>;
  4454. /**
  4455. * The colour of the node’s 14th pie chart slice.
  4456. */
  4457. "pie-14-background-color": PropertyValueNode<Colour>;
  4458. /**
  4459. * The size of the node’s 14th pie chart slice, measured in percent (e.g. 25% or 25).
  4460. */
  4461. "pie-14-background-size": PropertyValueNode<number>;
  4462. /**
  4463. * The opacity of the node’s 14th pie chart slice.
  4464. */
  4465. "pie-14-background-opacity": PropertyValueNode<number>;
  4466. /**
  4467. * The colour of the node’s 15th pie chart slice.
  4468. */
  4469. "pie-15-background-color": PropertyValueNode<Colour>;
  4470. /**
  4471. * The size of the node’s 15th pie chart slice, measured in percent (e.g. 25% or 25).
  4472. */
  4473. "pie-15-background-size": PropertyValueNode<number>;
  4474. /**
  4475. * The opacity of the node’s 15th pie chart slice.
  4476. */
  4477. "pie-15-background-opacity": PropertyValueNode<number>;
  4478. /**
  4479. * The colour of the node’s 16th pie chart slice.
  4480. */
  4481. "pie-16-background-color": PropertyValueNode<Colour>;
  4482. /**
  4483. * The size of the node’s 16th pie chart slice, measured in percent (e.g. 25% or 25).
  4484. */
  4485. "pie-16-background-size": PropertyValueNode<number>;
  4486. /**
  4487. * The opacity of the node’s 16th pie chart slice.
  4488. */
  4489. "pie-16-background-opacity": PropertyValueNode<number>;
  4490. }
  4491. /**
  4492. * These properties allow you to create stripe chart backgrounds on
  4493. * nodes ([demo](demos/stripe-style)). Note that 16 stripes maximum
  4494. * are supported per node, so in the properties `1 <= i <= 16`. Of
  4495. * course, you must specify a numerical value for each property in
  4496. * place of `i`. Each nonzero sized stripe is placed in order of `i`,
  4497. * starting from the left and going rightwards for vertical stripes
  4498. * (`stripe-direction: vertical`) or starting from the top and going
  4499. * downwards for horizontal stripes (`stripe-direction: horizontal`).
  4500. *
  4501. * You may find it useful to reserve a number to a particular colour
  4502. * for all nodes in your stylesheet. Then you can specify values for
  4503. * `stripe-i-background-size` accordingly for each node via a mapper.
  4504. * This would allow you to create consistently coloured pie charts
  4505. * in each node of the graph based on element data.
  4506. *
  4507. * http://js.cytoscape.org/#style/stripe-chart-background
  4508. */
  4509. interface StripeChartBackground {
  4510. /**
  4511. *
  4512. * The size of the stripes, measured as a percent of node size (e.g. 100%) or an absolute length (e.g. 25px).
  4513. */
  4514. "stripe-size": PropertyValueNode<number|string>;
  4515. /**
  4516. *
  4517. * The direction of the stripes, either `vertical` stripes or `horizontal` stripes. Vertical stripes are
  4518. * stacked from left to right, and horizontal stripes are stacked from top to bottom.
  4519. */
  4520. "stripe-direction": PropertyValueNode<"vertical" | "horizontal">;
  4521. /**
  4522. * The colour of the node’s 1st stripe chart stripe.
  4523. */
  4524. "stripe-1-background-color": PropertyValueNode<Colour>;
  4525. /**
  4526. * The size of the node’s 1st stripe chart stripe, measured in percent (e.g. 25% or 25).
  4527. */
  4528. "stripe-1-background-size": PropertyValueNode<number>;
  4529. /**
  4530. * The opacity of the node’s 1st stripe chart stripe.
  4531. */
  4532. "stripe-1-background-opacity": PropertyValueNode<number>;
  4533. /**
  4534. * The colour of the node’s 2nd stripe chart stripe.
  4535. */
  4536. "stripe-2-background-color": PropertyValueNode<Colour>;
  4537. /**
  4538. * The size of the node’s 2nd stripe chart stripe, measured in percent (e.g. 25% or 25).
  4539. */
  4540. "stripe-2-background-size": PropertyValueNode<number>;
  4541. /**
  4542. * The opacity of the node’s 2nd stripe chart stripe.
  4543. */
  4544. "stripe-2-background-opacity": PropertyValueNode<number>;
  4545. /**
  4546. * The colour of the node’s 3rd stripe chart stripe.
  4547. */
  4548. "stripe-3-background-color": PropertyValueNode<Colour>;
  4549. /**
  4550. * The size of the node’s 3rd stripe chart stripe, measured in percent (e.g. 25% or 25).
  4551. */
  4552. "stripe-3-background-size": PropertyValueNode<number>;
  4553. /**
  4554. * The opacity of the node’s 3rd stripe chart stripe.
  4555. */
  4556. "stripe-3-background-opacity": PropertyValueNode<number>;
  4557. /**
  4558. * The colour of the node’s 4th stripe chart stripe.
  4559. */
  4560. "stripe-4-background-color": PropertyValueNode<Colour>;
  4561. /**
  4562. * The size of the node’s 4th stripe chart stripe, measured in percent (e.g. 25% or 25).
  4563. */
  4564. "stripe-4-background-size": PropertyValueNode<number>;
  4565. /**
  4566. * The opacity of the node’s 4th stripe chart stripe.
  4567. */
  4568. "stripe-4-background-opacity": PropertyValueNode<number>;
  4569. /**
  4570. * The colour of the node’s 5th stripe chart stripe.
  4571. */
  4572. "stripe-5-background-color": PropertyValueNode<Colour>;
  4573. /**
  4574. * The size of the node’s 5th stripe chart stripe, measured in percent (e.g. 25% or 25).
  4575. */
  4576. "stripe-5-background-size": PropertyValueNode<number>;
  4577. /**
  4578. * The opacity of the node’s 5th stripe chart stripe.
  4579. */
  4580. "stripe-5-background-opacity": PropertyValueNode<number>;
  4581. /**
  4582. * The colour of the node’s 6th stripe chart stripe.
  4583. */
  4584. "stripe-6-background-color": PropertyValueNode<Colour>;
  4585. /**
  4586. * The size of the node’s 6th stripe chart stripe, measured in percent (e.g. 25% or 25).
  4587. */
  4588. "stripe-6-background-size": PropertyValueNode<number>;
  4589. /**
  4590. * The opacity of the node’s 6th stripe chart stripe.
  4591. */
  4592. "stripe-6-background-opacity": PropertyValueNode<number>;
  4593. /**
  4594. * The colour of the node’s 7th stripe chart stripe.
  4595. */
  4596. "stripe-7-background-color": PropertyValueNode<Colour>;
  4597. /**
  4598. * The size of the node’s 7th stripe chart stripe, measured in percent (e.g. 25% or 25).
  4599. */
  4600. "stripe-7-background-size": PropertyValueNode<number>;
  4601. /**
  4602. * The opacity of the node’s 7th stripe chart stripe.
  4603. */
  4604. "stripe-7-background-opacity": PropertyValueNode<number>;
  4605. /**
  4606. * The colour of the node’s 8th stripe chart stripe.
  4607. */
  4608. "stripe-8-background-color": PropertyValueNode<Colour>;
  4609. /**
  4610. * The size of the node’s 8th stripe chart stripe, measured in percent (e.g. 25% or 25).
  4611. */
  4612. "stripe-8-background-size": PropertyValueNode<number>;
  4613. /**
  4614. * The opacity of the node’s 8th stripe chart stripe.
  4615. */
  4616. "stripe-8-background-opacity": PropertyValueNode<number>;
  4617. /**
  4618. * The colour of the node’s 9th stripe chart stripe.
  4619. */
  4620. "stripe-9-background-color": PropertyValueNode<Colour>;
  4621. /**
  4622. * The size of the node’s 9th stripe chart stripe, measured in percent (e.g. 25% or 25).
  4623. */
  4624. "stripe-9-background-size": PropertyValueNode<number>;
  4625. /**
  4626. * The opacity of the node’s 9th stripe chart stripe.
  4627. */
  4628. "stripe-9-background-opacity": PropertyValueNode<number>;
  4629. /**
  4630. * The colour of the node’s 10th stripe chart stripe.
  4631. */
  4632. "stripe-10-background-color": PropertyValueNode<Colour>;
  4633. /**
  4634. * The size of the node’s 10th stripe chart stripe, measured in percent (e.g. 25% or 25).
  4635. */
  4636. "stripe-10-background-size": PropertyValueNode<number>;
  4637. /**
  4638. * The opacity of the node’s 10th stripe chart stripe.
  4639. */
  4640. "stripe-10-background-opacity": PropertyValueNode<number>;
  4641. /**
  4642. * The colour of the node’s 11th stripe chart stripe.
  4643. */
  4644. "stripe-11-background-color": PropertyValueNode<Colour>;
  4645. /**
  4646. * The size of the node’s 11th stripe chart stripe, measured in percent (e.g. 25% or 25).
  4647. */
  4648. "stripe-11-background-size": PropertyValueNode<number>;
  4649. /**
  4650. * The opacity of the node’s 11th stripe chart stripe.
  4651. */
  4652. "stripe-11-background-opacity": PropertyValueNode<number>;
  4653. /**
  4654. * The colour of the node’s 12th stripe chart stripe.
  4655. */
  4656. "stripe-12-background-color": PropertyValueNode<Colour>;
  4657. /**
  4658. * The size of the node’s 12th stripe chart stripe, measured in percent (e.g. 25% or 25).
  4659. */
  4660. "stripe-12-background-size": PropertyValueNode<number>;
  4661. /**
  4662. * The opacity of the node’s 12th stripe chart stripe.
  4663. */
  4664. "stripe-12-background-opacity": PropertyValueNode<number>;
  4665. /**
  4666. * The colour of the node’s 13th stripe chart stripe.
  4667. */
  4668. "stripe-13-background-color": PropertyValueNode<Colour>;
  4669. /**
  4670. * The size of the node’s 13th stripe chart stripe, measured in percent (e.g. 25% or 25).
  4671. */
  4672. "stripe-13-background-size": PropertyValueNode<number>;
  4673. /**
  4674. * The opacity of the node’s 13th stripe chart stripe.
  4675. */
  4676. "stripe-13-background-opacity": PropertyValueNode<number>;
  4677. /**
  4678. * The colour of the node’s 14th stripe chart stripe.
  4679. */
  4680. "stripe-14-background-color": PropertyValueNode<Colour>;
  4681. /**
  4682. * The size of the node’s 14th stripe chart stripe, measured in percent (e.g. 25% or 25).
  4683. */
  4684. "stripe-14-background-size": PropertyValueNode<number>;
  4685. /**
  4686. * The opacity of the node’s 14th stripe chart stripe.
  4687. */
  4688. "stripe-14-background-opacity": PropertyValueNode<number>;
  4689. /**
  4690. * The colour of the node’s 15th stripe chart stripe.
  4691. */
  4692. "stripe-15-background-color": PropertyValueNode<Colour>;
  4693. /**
  4694. * The size of the node’s 15th stripe chart stripe, measured in percent (e.g. 25% or 25).
  4695. */
  4696. "stripe-15-background-size": PropertyValueNode<number>;
  4697. /**
  4698. * The opacity of the node’s 15th stripe chart stripe.
  4699. */
  4700. "stripe-15-background-opacity": PropertyValueNode<number>;
  4701. /**
  4702. * The colour of the node’s 16th stripe chart stripe.
  4703. */
  4704. "stripe-16-background-color": PropertyValueNode<Colour>;
  4705. /**
  4706. * The size of the node’s 16th stripe chart stripe, measured in percent (e.g. 25% or 25).
  4707. */
  4708. "stripe-16-background-size": PropertyValueNode<number>;
  4709. /**
  4710. * The opacity of the node’s 16th stripe chart stripe.
  4711. */
  4712. "stripe-16-background-opacity": PropertyValueNode<number>;
  4713. }
  4714. interface Edge
  4715. extends
  4716. EdgeLine,
  4717. EdgeArrow,
  4718. Partial<Gradient>,
  4719. Partial<Overlay>,
  4720. Partial<Underlay>,
  4721. Partial<BezierEdges>,
  4722. Partial<LoopEdges>,
  4723. Partial<UnbundledBezierEdges>,
  4724. Partial<HaystackEdges>,
  4725. Partial<SegmentsEdges>,
  4726. Partial<TaxiEdges>,
  4727. Partial<Visibility<EdgeSingular>>,
  4728. Partial<Labels<EdgeSingular>>,
  4729. Partial<Events<EdgeSingular>>,
  4730. Partial<EdgeEndpoints<EdgeSingular>>,
  4731. Partial<TransitionAnimation>
  4732. {}
  4733. /**
  4734. * These properties affect the styling of an edge’s line:
  4735. *
  4736. * http://js.cytoscape.org/#style/edge-line
  4737. */
  4738. interface EdgeLine {
  4739. /**
  4740. * The width of an edge’s line.
  4741. */
  4742. width?: PropertyValueEdge<number | string>;
  4743. /**
  4744. * The curving method used to separate two or more edges between two nodes;
  4745. * may be
  4746. * - haystack (default, very fast, bundled straight edges for which loops and compounds are unsupported),
  4747. * - bezier(bundled curved edges),
  4748. * - unbundled - bezier(curved edges for use with manual control points), or
  4749. * - segments (a series of straight lines).
  4750. * Note that haystack edges work best with ellipse, rectangle, or similar nodes.
  4751. * Smaller node shapes, like triangle, will not be as aesthetically pleasing.
  4752. * Also note that edge arrows are unsupported for haystack edges.
  4753. */
  4754. "curve-style"?: PropertyValueEdge<
  4755. | "haystack"
  4756. | "straight"
  4757. | "bezier"
  4758. | "unbundled-bezier"
  4759. | "segments"
  4760. | "taxi"
  4761. | "round-taxi"
  4762. | "round-segments"
  4763. >;
  4764. /**
  4765. * The colour of the edge’s line.
  4766. */
  4767. "line-color"?: PropertyValueEdge<Colour>;
  4768. /**
  4769. * The style of the edge’s line.
  4770. */
  4771. "line-style"?: PropertyValueEdge<LineStyle>;
  4772. /**
  4773. * The cap of the edge's line.
  4774. */
  4775. "line-cap"?: PropertyValueEdge<"butt" | "round" | "square">;
  4776. /**
  4777. * The filling style of the edge's line.
  4778. */
  4779. "line-fill"?: PropertyValueEdge<"solid" | "linear-gradient" | "radial-gradient">;
  4780. /**
  4781. * The opacity of the edge’s line and arrow. Useful if you wish to have a separate opacity for the edge
  4782. * label versus the edge line. Note that the opacity value of the edge element affects the effective
  4783. * opacity of its line and label subcomponents.
  4784. *
  4785. * Value between `0` and `1` inclusive.
  4786. */
  4787. "line-opacity"?: PropertyValueEdge<number>;
  4788. /**
  4789. * The dashed line pattern which specifies alternating lengths of lines and gaps.
  4790. */
  4791. "line-dash-pattern"?: Array<PropertyValueEdge<number>>;
  4792. /**
  4793. * The dashed line offset.
  4794. */
  4795. "line-dash-offset"?: PropertyValueEdge<number>;
  4796. /**
  4797. * The width of the edge’s outline.
  4798. */
  4799. "line-outline-width"?: PropertyValueEdge<number | string>;
  4800. /**
  4801. * The colour of the edge’s outline.
  4802. */
  4803. "line-outline-color"?: PropertyValueEdge<Colour>;
  4804. /**
  4805. * The distance the edge ends from its target.
  4806. */
  4807. "target-distance-from-node"?: PropertyValueEdge<number | string>;
  4808. /**
  4809. * The distance the edge ends from its source.
  4810. */
  4811. "source-distance-from-node"?: PropertyValueEdge<number | string>;
  4812. }
  4813. /**
  4814. * These properties specify the gradient colouration of an edge's line:
  4815. *
  4816. * https://js.cytoscape.org/#style/gradient
  4817. */
  4818. interface Gradient {
  4819. /**
  4820. * The colors of the gradient stops.
  4821. */
  4822. "line-gradient-stop-colors"?: PropertyValueEdge<Colour[]>;
  4823. /**
  4824. * The positions of the gradient stops.
  4825. * If not specified (or invalid), the stops will divide equally.
  4826. */
  4827. "line-gradient-stop-positions"?: PropertyValueEdge<number[]>;
  4828. }
  4829. /**
  4830. * For automatic, bundled bezier edges (curve - style: bezier):
  4831. *
  4832. * http://js.cytoscape.org/#style/bezier-edges
  4833. */
  4834. interface BezierEdges {
  4835. /**
  4836. * From the line perpendicular from source to target,
  4837. * this value specifies the distance between successive bezier edges.
  4838. */
  4839. "control-point-step-size": PropertyValueEdge<number>;
  4840. /**
  4841. * A single value that overrides "control-point-step-size" with a manual value.
  4842. * Because it overrides the step size, bezier edges with the same value will overlap.
  4843. * Thus, it’s best to use this as a one- off value for particular edges if need be.
  4844. */
  4845. "control-point-distance": PropertyValueEdge<number>;
  4846. /**
  4847. * A single value that weights control points along the line from source to target.
  4848. * The value usually ranges on [0, 1], with
  4849. * 0 towards the source node and
  4850. * 1 towards the target node —
  4851. * but larger or smaller values can also be used.
  4852. */
  4853. "control-point-weight": PropertyValueEdge<number>;
  4854. /**
  4855. * With value intersection (default),
  4856. * the line from source to target for "control-point-weight" is
  4857. * from the outside of the source node’s shape to the outside of
  4858. * the target node’s shape.With value node- position,
  4859. * the line is from the source position to the target position.
  4860. * The "node-position" option makes calculating edge points easier
  4861. * — but it should be used carefully because you can create invalid
  4862. * points that intersection would have automatically corrected.
  4863. */
  4864. "edge-distances": PropertyValueEdge<"intersection" | "node-position">;
  4865. }
  4866. /**
  4867. * Loop edges
  4868. * For loops (i.e. same source and target)
  4869. *
  4870. * https://js.cytoscape.org/#style/loop-edges
  4871. */
  4872. interface LoopEdges {
  4873. /**
  4874. * Determines the angle that loops extend from the node in cases when the source and
  4875. * target node of an edge is the same. The angle is specified from the 12 o’clock
  4876. * position and it progresses clockwise for increasing positive values.
  4877. * The default is `-45deg` (extending to the upper left).
  4878. */
  4879. "loop-direction": PropertyValueEdge<string>;
  4880. /**
  4881. * Determines the angle between the leaving and returning edges in loops. Positive
  4882. * values result in clockwise looping and negative values result in counter-clockwise
  4883. * looping. Default is `-90deg`.
  4884. */
  4885. "loop-sweep": PropertyValueEdge<string>;
  4886. }
  4887. /**
  4888. * Unbundled bezier edges
  4889. * For bezier edges with manual control points (curve - style: unbundled - bezier):
  4890. *
  4891. * http://js.cytoscape.org/#style/unbundled-bezier-edges
  4892. */
  4893. interface UnbundledBezierEdges {
  4894. /**
  4895. * A series of values that specify for each control point the
  4896. * distance perpendicular to a line formed
  4897. * from source to target, e.g. -20 20 - 20.
  4898. */
  4899. "control-point-distances": PropertyValueEdge<number | number[] | string>;
  4900. /**
  4901. * A series of values that weights control points along
  4902. * a line from source to target, e.g. 0.25 0.5 0.75.
  4903. * A value usually ranges on [0, 1], with
  4904. * 0 towards the source node and
  4905. * 1 towards the target node
  4906. * — but larger or smaller values can also be used.
  4907. */
  4908. "control-point-weights": PropertyValueEdge<number | number[] | string>;
  4909. /**
  4910. * With value intersection (default),
  4911. * the line from source to target for "control-point-weights"
  4912. * is from the outside of the source node’s shape to the
  4913. * outside of the target node’s shape.
  4914. * With value
  4915. * "node-position", the line is from the source position to the target position.
  4916. * The "node-position" option makes calculating edge points easier
  4917. * — but it should be used carefully because you can create
  4918. * invalid points that intersection would have automatically corrected.
  4919. */
  4920. "edge-distances": PropertyValueEdge<"intersection" | "node-position">;
  4921. }
  4922. /**
  4923. * Haystack edges
  4924. * Loop edges and compound parent nodes are not supported by haystack edges.
  4925. * Haystack edges are a more performant replacement for plain, straight line edges.
  4926. *
  4927. * For fast, straight line edges (curve - style: haystack):
  4928. * http://js.cytoscape.org/#style/haystack-edges
  4929. */
  4930. interface HaystackEdges {
  4931. /**
  4932. * A value between 0 and 1 inclusive that indicates the relative radius used to position haystack edges on their connected nodes.
  4933. * The outside of the node is at 1, and the centre of the node is at 0.
  4934. */
  4935. "haystack-radius": PropertyValueEdge<number>;
  4936. }
  4937. /**
  4938. * Segments edges
  4939. * For edges made of several straight lines (curve - style: segments):
  4940. * http://js.cytoscape.org/#style/segments-edges
  4941. */
  4942. interface SegmentsEdges {
  4943. /**
  4944. * A series of values that specify for each segment point the distance perpendicular to a line formed from source to target, e.g. -20 20 - 20.
  4945. */
  4946. "segment-distances": PropertyValueEdge<number | number[] | string>;
  4947. /**
  4948. * A series of values that weights segment points along a line from source to target,
  4949. * e.g. 0.25 0.5 0.75.A value usually ranges on [0, 1],
  4950. * with 0 towards the source node and 1 towards the target node — but larger or smaller values can also be used.
  4951. */
  4952. "segment-weights": PropertyValueEdge<number | number[] | string>;
  4953. /**
  4954. * A series of values that provide the radii of the different points positioned by segment-distances and segment-weights, e.g. 15 0 5.
  4955. * If less radii are provided than points have been defined, the last provided radius will be used for all the missing radius.
  4956. * If a single radius is provided, it will therefore be applied to all the segment’s points.
  4957. */
  4958. "segment-radii"?: PropertyValueEdge<number[]>;
  4959. /**
  4960. * Defines where segment-radii are applied, which is particularly relevant when the corner angle is acute.
  4961. * Values can be:
  4962. * - `arc-radius`: Default strategy: The radius property is applied to the corner arc, which will be placed further away from the control point if the arc doesn’t fit in an acute angle.
  4963. * - `influence-radius`: The radius property is applied to the control point sphere of influence. The arcs for a given control point will all start and end at radius distance from the control-points.
  4964. */
  4965. "radius-type"?: PropertyValueEdge<"arc-radius" | "influence-radius">;
  4966. /**
  4967. * With value
  4968. * * "intersection" (default), the line from source to target
  4969. * * for "segment-weights" is from the outside of the source node’s shape to the outside of the target node’s shape.
  4970. * * With value "node-position", the line is from the source position to the target position.
  4971. * The "node-position" option makes calculating edge points easier
  4972. * — but it should be used carefully because you can create
  4973. * invalid points that intersection would have automatically corrected.
  4974. */
  4975. "edge-distances": PropertyValueEdge<"intersection" | "node-position">;
  4976. }
  4977. /**
  4978. * Taxi edges
  4979. * For hierarchical, bundled edges (curve-style: taxi)
  4980. *
  4981. * https://js.cytoscape.org/#style/taxi-edges
  4982. */
  4983. interface TaxiEdges {
  4984. /**
  4985. * The main direction of the edge, the direction starting out from the source node; may be one of:
  4986. * * `auto`: Automatically use `vertical` or `horizontal`, based on whether the vertical or horizontal distance is largest.
  4987. * * `vertical`: Automatically use `downward` or `upward`, based on the vertical direction from source to target.
  4988. * * `downward`: Bundle outgoers downwards.
  4989. * * `upward`: Bundle outgoers upwards.
  4990. * * `horizontal`: Automatically use `righward` or `leftward`, based on the horizontal direction from source to target.
  4991. * * `rightward`: Bundle outgoers righwards.
  4992. * * `leftward`: Bundle outgoers leftwards.
  4993. */
  4994. "taxi-direction": PropertyValueEdge<
  4995. "auto" | "vertical" | "downward" | "upward" | "horizontal" | "rightward" | "leftward"
  4996. >;
  4997. /**
  4998. * The distance along the primary axis where the first turn is applied.
  4999. * * This value may be an absolute distance (e.g. `'20px'`) or it may be a relative distance
  5000. * between the source and target (e.g. `'50%'`).
  5001. * * A negative value may be specified to indicate a distance in the oppostite, target to
  5002. * source direction (e.g. `'-20px'`).
  5003. * * Note that bundling may not work with an explicit direction (upward, downward, leftward, or rightward)
  5004. * in tandem with a turn distance specified in percent units.
  5005. */
  5006. "taxi-turn": PropertyValueEdge<number | number[] | string>;
  5007. /**
  5008. * The minimum distance along the primary axis that is maintained between the nodes and the turns.
  5009. * * This value only takes on absolute values (e.g. `'5px'`).
  5010. * * This property makes the taxi edge be re-routed when the turns would be otherwise too close to
  5011. * the source or target. As such, it also helps to avoid turns overlapping edge endpoint arrows.
  5012. */
  5013. "taxi-turn-min-distance": PropertyValueEdge<number | string>;
  5014. /**
  5015. * The radius of the rounded corners of the edge.
  5016. */
  5017. "taxi-radius"?: PropertyValueEdge<number>;
  5018. /**
  5019. * With value `intersection` (default), the `distances` (`taxi-turn` and `taxi-turn-min-distance`)
  5020. * are considered from the outside of the source’s bounds to the outside of the target’s bounds.
  5021. * With value `node-position`, the distances are considered from the source position to the target position.
  5022. * The `node-position` option makes calculating edge points easier — but it should be used carefully because
  5023. * you can create invalid points that `intersection` would have automatically corrected.
  5024. */
  5025. "edge-distances": PropertyValueEdge<"intersection" | "node-position">;
  5026. }
  5027. type ArrowShape =
  5028. | "tee"
  5029. | "vee"
  5030. | "triangle"
  5031. | "triangle-tee"
  5032. | "circle-triangle"
  5033. | "triangle-cross"
  5034. | "triangle-backcurve"
  5035. | "square"
  5036. | "circle"
  5037. | "diamond"
  5038. | "chevron"
  5039. | "none";
  5040. type ArrowFill = "filled" | "hollow";
  5041. /**
  5042. * Edge arrow
  5043. * * <pos>-arrow-color : The colour of the edge’s source arrow.
  5044. * * <pos>-arrow-shape : The shape of the edge’s source arrow.
  5045. * * <pos>-arrow-fill : The fill state of the edge’s source arrow.
  5046. *
  5047. * For each edge arrow property above, replace <pos> with one of
  5048. * * source : Pointing towards the source node, at the end of the edge.
  5049. * * mid-source : Pointing towards the source node, at the middle of the edge.
  5050. * * target : Pointing towards the target node, at the end of the edge.
  5051. * * mid-target: Pointing towards the target node, at the middle of the edge.
  5052. *
  5053. * Only mid arrows are supported on haystack edges.
  5054. * http://js.cytoscape.org/#style/edge-arrow
  5055. */
  5056. interface EdgeArrow {
  5057. /** The size of the arrow. */
  5058. "arrow-scale"?: PropertyValueEdge<number>;
  5059. /** The colour of the edge’s source arrow. */
  5060. "source-arrow-color"?: PropertyValueEdge<Colour>;
  5061. /** The colour of the edge’s "mid-source" arrow. */
  5062. "mid-source-arrow-color"?: PropertyValueEdge<Colour>;
  5063. /** The colour of the edge’s target arrow. */
  5064. "target-arrow-color"?: PropertyValueEdge<Colour>;
  5065. /** The colour of the edge’s "mid-target" arrow. */
  5066. "mid-target-arrow-color"?: PropertyValueEdge<Colour>;
  5067. /** The shape of the edge’s source arrow. */
  5068. "source-arrow-shape"?: PropertyValueEdge<ArrowShape>;
  5069. /** The shape of the edge’s mid-source arrow. */
  5070. "mid-source-arrow-shape"?: PropertyValueEdge<ArrowShape>;
  5071. /** The shape of the edge’s target arrow. */
  5072. "target-arrow-shape"?: PropertyValueEdge<ArrowShape>;
  5073. /** The shape of the edge’s mid-target arrow. */
  5074. "mid-target-arrow-shape"?: PropertyValueEdge<ArrowShape>;
  5075. /** The fill state of the edge’s source arrow. */
  5076. "source-arrow-fill"?: PropertyValueEdge<ArrowFill>;
  5077. /** The fill state of the edge’s mid-source arrow. */
  5078. "mid-source-arrow-fill"?: PropertyValueEdge<ArrowFill>;
  5079. /** The fill state of the edge’s target arrow. */
  5080. "target-arrow-fill"?: PropertyValueEdge<ArrowFill>;
  5081. /** The fill state of the edge’s mid-target arrow. */
  5082. "mid-target-arrow-fill"?: PropertyValueEdge<ArrowFill>;
  5083. }
  5084. /**
  5085. * https://js.cytoscape.org/#style/edge-endpoints
  5086. */
  5087. interface EdgeEndpoints<SingularType extends EdgeSingular> {
  5088. /** Specifies the endpoint of the source side of the edge */
  5089. "source-endpoint": PropertyValue<
  5090. SingularType,
  5091. | "inside-to-node"
  5092. | "outside-to-node"
  5093. | "outside-to-node-or-label"
  5094. | "outside-to-line"
  5095. | "outside-to-line-or-label"
  5096. | string
  5097. >;
  5098. /** Specifies the endpoint of the target side of the edge */
  5099. "target-endpoint": PropertyValue<
  5100. SingularType,
  5101. | "inside-to-node"
  5102. | "outside-to-node"
  5103. | "outside-to-node-or-label"
  5104. | "outside-to-line"
  5105. | "outside-to-line-or-label"
  5106. | string
  5107. >;
  5108. }
  5109. /**
  5110. * http://js.cytoscape.org/#style/visibility
  5111. */
  5112. interface Visibility<SingularType extends NodeSingular | EdgeSingular> {
  5113. /**
  5114. * Whether to display the element; may be element for displayed or none for not displayed.
  5115. * Note that a "display: none" bezier edge does not take up space in its bundle.
  5116. */
  5117. display: PropertyValue<SingularType, "none" | "element">;
  5118. /**
  5119. * Whether the element is visible; may be visible or hidden.
  5120. * Note that a "visibility : hidden" bezier edge still takes up space in its bundle.
  5121. */
  5122. visibility: PropertyValue<SingularType, "hidden" | "visible">;
  5123. /**
  5124. * The opacity of the element, ranging from 0 to 1.
  5125. * Note that the opacity of a compound node parent affects the effective opacity of its children.
  5126. */
  5127. opacity: PropertyValue<SingularType, number>;
  5128. /**
  5129. * An integer value that affects the relative draw order of elements.
  5130. * In general, an element with a higher "z-index" will be drawn on top of an element with a lower "z-index".
  5131. * Note that edges are under nodes despite "z-index", except when necessary for compound nodes.
  5132. */
  5133. "z-index": PropertyValue<SingularType, number>;
  5134. /**
  5135. * May be bottom, orphan, auto (default), or top. The first drawn is bottom, the second is orphan,
  5136. * which is the same depth as the root of the compound graph, followed by the default of auto
  5137. * which draws in depth order from root to leaves of the compound graph. The last drawn is top.
  5138. * It does not usually make sense to set this value for non-compound graphs.
  5139. */
  5140. "z-compound-depth": PropertyValue<SingularType, "auto" | "top" | "bottom" | "orphan">;
  5141. /**
  5142. * May be auto (default) or manual. The auto setting draws edges under nodes,
  5143. * whereas manual ignores this convention and draws solely based on the z-index value.
  5144. */
  5145. "z-index-compare": PropertyValue<SingularType, "auto" | "manual">;
  5146. }
  5147. /** https://developer.mozilla.org/en-US/docs/Web/CSS/font-style */
  5148. type FontStyle = "normal" | "italic" | "oblique";
  5149. /** https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight */
  5150. type FontWeight = number | "normal" | "bold" | "lighter" | "bolder";
  5151. /** http://js.cytoscape.org/#style/labels */
  5152. type TextTranformation = "none" | "uppercase" | "lowercase";
  5153. /**
  5154. * Labels
  5155. * Label text:
  5156. *
  5157. * http://js.cytoscape.org/#style/labels
  5158. */
  5159. interface Labels<SingularType extends NodeSingular | EdgeSingular> {
  5160. /**
  5161. * The text to display for an element’s label.
  5162. */
  5163. label: PropertyValue<SingularType, string>;
  5164. /**
  5165. * The text to display for an edge’s source label.
  5166. */
  5167. "source-label": PropertyValue<SingularType, string>;
  5168. /**
  5169. * The text to display for an edge’s target label.
  5170. */
  5171. "target-label": PropertyValue<SingularType, string>;
  5172. /**
  5173. * Basic font styling:
  5174. */
  5175. /**
  5176. * The colour of the element’s label.
  5177. */
  5178. color: PropertyValue<SingularType, Colour>;
  5179. /**
  5180. * The opacity of the label text, including its outline.
  5181. */
  5182. "text-opacity": PropertyValue<SingularType, number>;
  5183. /**
  5184. * A comma-separated list of font names to use on the label text.
  5185. */
  5186. "font-family": PropertyValue<SingularType, string>;
  5187. /**
  5188. * The size of the label text.
  5189. * https://developer.mozilla.org/en-US/docs/Web/CSS/font-family
  5190. */
  5191. "font-size": PropertyValue<SingularType, number | string>;
  5192. /**
  5193. * A CSS font style to be applied to the label text.
  5194. * https://developer.mozilla.org/en-US/docs/Web/CSS/font-style
  5195. */
  5196. "font-style": PropertyValue<SingularType, FontStyle>;
  5197. /**
  5198. * A CSS font weight to be applied to the label text.
  5199. */
  5200. "font-weight": PropertyValue<SingularType, FontWeight>;
  5201. /**
  5202. * A transformation to apply to the label text.
  5203. */
  5204. "text-transform": PropertyValue<SingularType, TextTranformation>;
  5205. /**
  5206. * Wrapping text:
  5207. */
  5208. /**
  5209. * A wrapping style to apply to the label text; may be
  5210. * * "none" for no wrapping (including manual newlines ) or
  5211. * * "wrap" for manual and/ or autowrapping.
  5212. * * "ellipsis" to truncate the string and append
  5213. */
  5214. "text-wrap": PropertyValue<SingularType, "none" | "wrap" | "ellipsis">;
  5215. /**
  5216. * The maximum width for wrapped text,
  5217. * applied when "text-wrap" is set to wrap.
  5218. * For only manual newlines (i.e.\n), set a very large
  5219. * value like 1000px such that only your newline characters would apply.
  5220. */
  5221. "text-max-width": PropertyValue<SingularType, string>;
  5222. /**
  5223. * The characters that may be used for possible wrapping locations when
  5224. * a line overflows `text-max-width`; may be `whitespace` (default) or `anywhere`.
  5225. * Note that anywhere is suited to CJK, where the characters are in a grid
  5226. * and no whitespace exists. Using anywhere with text in the Latin alphabet,
  5227. * for example, will split words at arbitrary locations.
  5228. */
  5229. "text-overflow-wrap": PropertyValue<SingularType, "whitespace" | "anywhere">;
  5230. /**
  5231. * The justification of multiline (wrapped) labels; may be
  5232. * `left`, `center`, `right`, or `auto` (default). The auto value makes it so that a
  5233. * node’s label is justified along the node — e.g. a label on the right side
  5234. * of a node is left justified.
  5235. */
  5236. "text-justification": PropertyValue<SingularType, "auto" | "left" | "center" | "right">;
  5237. /**
  5238. * The line height of multiline text, as a relative, unitless value. It specifies the
  5239. * vertical spacing between each line. With value `1` (default), the lines are stacked
  5240. * directly on top of one another with no additional whitespace between them.
  5241. * With value `2`, for example, there is whitespace between each line equal to the visible
  5242. * height of a line of text.
  5243. */
  5244. "line-height": PropertyValue<SingularType, number>;
  5245. /**
  5246. * Node label alignment:
  5247. */
  5248. /**
  5249. * The vertical alignment of a node’s label.
  5250. */
  5251. "text-halign": PropertyValue<SingularType, "left" | "center" | "right">;
  5252. /**
  5253. * The vertical alignment of a node’s label.
  5254. */
  5255. "text-valign": PropertyValue<SingularType, "top" | "center" | "bottom">;
  5256. /**
  5257. * Edge label alignment:
  5258. */
  5259. /**
  5260. * For the source label of an edge, how far from the source node the label should be placed.
  5261. */
  5262. "source-text-offset": PropertyValue<SingularType, number>;
  5263. /**
  5264. * For the target label of an edge, how far from the target node the label should be placed.
  5265. */
  5266. "target-text-offset": PropertyValue<SingularType, number>;
  5267. /**
  5268. * Margins:
  5269. */
  5270. /**
  5271. * A margin that shifts the label along the x- axis.
  5272. */
  5273. "text-margin-x": PropertyValue<SingularType, number>;
  5274. /**
  5275. * A margin that shifts the label along the y- axis.
  5276. */
  5277. "text-margin-y": PropertyValue<SingularType, number>;
  5278. /**
  5279. * (For the source label of an edge.)
  5280. */
  5281. "source-text-margin-x": PropertyValue<SingularType, number>;
  5282. /**
  5283. * (For the source label of an edge.)
  5284. */
  5285. "source-text-margin-y": PropertyValue<SingularType, number>;
  5286. /**
  5287. * (For the target label of an edge.)
  5288. */
  5289. "target-text-margin-x": PropertyValue<SingularType, number>;
  5290. /**
  5291. * (For the target label of an edge.)
  5292. */
  5293. "target-text-margin-y": PropertyValue<SingularType, number>;
  5294. /**
  5295. * Rotating text:
  5296. */
  5297. /**
  5298. * A rotation angle that is applied to the label.
  5299. * * Rotations are clockwise.
  5300. * * For edges, the special value `autorotate` can be used to align the label to the edge.
  5301. * * For nodes, the label is rotated along its anchor point on the node, so a label margin may help for some usecases.
  5302. * * The special value `none` can be used to denote 0deg.
  5303. * * Rotations works best with left-to-right text.
  5304. */
  5305. "text-rotation": PropertyValue<SingularType, number | "autorotate" | "none">;
  5306. /**
  5307. * (For the source label of an edge.)
  5308. */
  5309. "source-text-rotation": PropertyValue<SingularType, number | "autorotate" | "none">;
  5310. /**
  5311. * (For the target label of an edge.)
  5312. */
  5313. "target-text-rotation": PropertyValue<SingularType, number | "autorotate" | "none">;
  5314. /**
  5315. * Outline:
  5316. */
  5317. /**
  5318. * The colour of the outline around the element’s label text.
  5319. */
  5320. "text-outline-color": PropertyValue<SingularType, Colour>;
  5321. /**
  5322. * The opacity of the outline on label text.
  5323. */
  5324. "text-outline-opacity": PropertyValue<SingularType, number>;
  5325. /**
  5326. * The size of the outline on label text.
  5327. */
  5328. "text-outline-width": PropertyValue<SingularType, number | string>;
  5329. /**
  5330. * Background:
  5331. */
  5332. /**
  5333. * The padding provides visual spacing between the text and the edge of the background.
  5334. */
  5335. "text-background-padding": PropertyValue<SingularType, string>;
  5336. /**
  5337. * A colour to apply on the text background.
  5338. */
  5339. "text-background-color": PropertyValue<SingularType, Colour>;
  5340. /**
  5341. * The opacity of the label background; the background is disabled for 0 (default value).
  5342. */
  5343. "text-background-opacity": PropertyValue<SingularType, number>;
  5344. /**
  5345. * The shape to use for the label background.
  5346. */
  5347. "text-background-shape": PropertyValue<SingularType, "rectangle" | "roundrectangle" | "circle">;
  5348. /**
  5349. * Border:
  5350. */
  5351. /**
  5352. * The width of the border around the label; the border is disabled for 0 (default value).
  5353. */
  5354. "text-border-opacity": PropertyValue<SingularType, number>;
  5355. /**
  5356. * The width of the border around the label.
  5357. */
  5358. "text-border-width": PropertyValue<SingularType, number>;
  5359. /**
  5360. * The style of the border around the label.
  5361. */
  5362. "text-border-style": PropertyValue<SingularType, LineStyle>;
  5363. /**
  5364. * The colour of the border around the label.
  5365. */
  5366. "text-border-color": PropertyValue<SingularType, Colour>;
  5367. /**
  5368. * Interactivity:
  5369. */
  5370. /**
  5371. * If zooming makes the effective font size of the label smaller than this,
  5372. * then no label is shown.Note that because of performance optimisations,
  5373. * the label may be shown at font sizes slightly smaller than this value.
  5374. *
  5375. * This effect is more pronounced at larger screen pixel ratios.However,
  5376. * it is guaranteed that the label will be shown at sizes equal to or greater than the value specified.
  5377. */
  5378. "min-zoomed-font-size": PropertyValue<SingularType, number | string>;
  5379. /**
  5380. * Whether events should occur on an element if the label receives an event; may be `yes` or `no`.
  5381. * You may want a style applied to the text on active so you know the text is activatable.
  5382. */
  5383. "text-events": PropertyValue<SingularType, "yes" | "no">;
  5384. /**
  5385. * Defines how an element responds to box selection via a selection rectangle.
  5386. *
  5387. * - `contain` (default): The element is selected only if it is entirely within the selection box.
  5388. * - `overlap`: The element is selected if it intersects with any part of the selection box.
  5389. * - `none`: The element is excluded from box selection.
  5390. *
  5391. * This property can be applied to nodes, edges, or both. For example, use `overlap` for more lenient selection or `contain` for stricter control.
  5392. */
  5393. "box-selection": PropertyValue<SingularType, "contain" | "overlap" | "none">;
  5394. }
  5395. /**
  5396. * http://js.cytoscape.org/#style/events
  5397. */
  5398. interface Events<SingularType extends NodeSingular | EdgeSingular> {
  5399. /**
  5400. * Whether events should occur on an element (e.g.tap, mouseover, etc.).
  5401. * * For "no", the element receives no events and events simply pass through to the core/viewport.
  5402. */
  5403. events: PropertyValue<SingularType, "yes" | "no">;
  5404. /**
  5405. * Whether events should occur on an element if the label receives an event.
  5406. * You may want a style applied to the text on active so you know the text is activatable.
  5407. */
  5408. "text-events": PropertyValue<SingularType, "yes" | "no">;
  5409. }
  5410. /**
  5411. * These properties allow for the creation of overlays on top of nodes or edges,
  5412. * and are often used in the :active state.
  5413. * http://js.cytoscape.org/#style/overlay
  5414. */
  5415. interface Overlay {
  5416. /**
  5417. * The colour of the overlay.
  5418. */
  5419. "overlay-color": PropertyValueEdge<Colour>;
  5420. /**
  5421. * The area outside of the element within which the overlay is shown.
  5422. */
  5423. "overlay-padding": PropertyValueEdge<number | string>;
  5424. /**
  5425. * The opacity of the overlay.
  5426. */
  5427. "overlay-opacity": PropertyValueEdge<number>;
  5428. /**
  5429. * The shape of the node overlay; may be round-rectangle (default), ellipse. Doesn’t apply to edges.
  5430. */
  5431. "overlay-shape"?: PropertyValueEdge<"round-rectangle" | "ellipse">;
  5432. }
  5433. /**
  5434. * These properties allow for the creation of underlays behind nodes or edges,
  5435. * and are often used in a highlighted state.
  5436. */
  5437. interface Underlay {
  5438. /**
  5439. * The colour of the underlay.
  5440. */
  5441. "underlay-color"?: PropertyValueNode<Colour>;
  5442. /**
  5443. * The area outside of the element within which the underlay is shown.
  5444. */
  5445. "underlay-padding"?: PropertyValueNode<number | string>;
  5446. /**
  5447. * The opacity of the underlay.
  5448. */
  5449. "underlay-opacity"?: PropertyValueNode<number>;
  5450. /**
  5451. * The shape of the node underlay; may be round-rectangle (default), ellipse. Doesn’t apply to edges.
  5452. */
  5453. "underlay-shape"?: PropertyValueNode<"round-rectangle" | "ellipse">;
  5454. }
  5455. /**
  5456. * Transition animation
  5457. */
  5458. type TransitionTimingFunction =
  5459. | "linear"
  5460. | "spring"
  5461. | "cubic-bezier"
  5462. | "ease"
  5463. | "ease-in"
  5464. | "ease-out"
  5465. | "ease-in-out"
  5466. | "ease-in-sine"
  5467. | "ease-out-sine"
  5468. | "ease-in-out-sine"
  5469. | "ease-in-quad"
  5470. | "ease-out-quad"
  5471. | "ease-in-out-quad"
  5472. | "ease-in-cubic"
  5473. | "ease-out-cubic"
  5474. | "ease-in-out-cubic"
  5475. | "ease-in-quart"
  5476. | "ease-out-quart"
  5477. | "ease-in-out-quart"
  5478. | "ease-in-quint"
  5479. | "ease-out-quint"
  5480. | "ease-in-out-quint"
  5481. | "ease-in-expo"
  5482. | "ease-out-expo"
  5483. | "ease-in-out-expo"
  5484. | "ease-in-circ"
  5485. | "ease-out-circ"
  5486. | "ease-in-out-circ";
  5487. /**
  5488. * http://js.cytoscape.org/#style/transition-animation
  5489. */
  5490. interface TransitionAnimation {
  5491. /**
  5492. * A comma separated list of style properties to animate in this state.
  5493. */
  5494. "transition-property": string;
  5495. /**
  5496. * The length of the transition in seconds(e.g. 0.5s).
  5497. */
  5498. "transition-duration": number;
  5499. /**
  5500. * The length of the delay in seconds before the transition occurs (e.g. 250ms).
  5501. */
  5502. "transition-delay": number;
  5503. /**
  5504. * An easing function that controls the animation progress curve (a visualisation of easings serves as a reference).
  5505. */
  5506. "transition-timing-function": TransitionTimingFunction;
  5507. }
  5508. /**
  5509. * Core
  5510. * These properties affect UI global to the graph, and apply only to the core.
  5511. * You can use the special core selector string to set these properties.
  5512. * http://js.cytoscape.org/#style/core
  5513. */
  5514. interface Core {
  5515. /**
  5516. * Indicator:
  5517. */
  5518. /**
  5519. * The colour of the indicator shown when the background is grabbed by the user.
  5520. */
  5521. "active-bg-color": PropertyValueCore<Colour>;
  5522. /**
  5523. * The opacity of the active background indicator.
  5524. */
  5525. "active-bg-opacity": PropertyValueCore<number>;
  5526. /**
  5527. * The size of the active background indicator.
  5528. */
  5529. "active-bg-size": PropertyValueCore<number>;
  5530. /**
  5531. * Selection box:
  5532. */
  5533. /**
  5534. * The background colour of the selection box used for drag selection.
  5535. */
  5536. "selection-box-color": PropertyValueCore<Colour>;
  5537. /**
  5538. * The colour of the border on the selection box.
  5539. */
  5540. "selection-box-border-color": PropertyValueCore<Colour>;
  5541. /**
  5542. * The size of the border on the selection box.
  5543. */
  5544. "selection-box-border-width": PropertyValueCore<number>;
  5545. /**
  5546. * The opacity of the selection box.
  5547. */
  5548. "selection-box-opacity": PropertyValueCore<number>;
  5549. /**
  5550. * Texture during viewport gestures:
  5551. */
  5552. /**
  5553. * The colour of the area outside the viewport texture when initOptions.textureOnViewport === true.
  5554. */
  5555. "outside-texture-bg-color": PropertyValueCore<Colour>;
  5556. /**
  5557. * The opacity of the area outside the viewport texture.
  5558. */
  5559. "outside-texture-bg-opacity": PropertyValueCore<number>;
  5560. }
  5561. }
  5562. /**
  5563. * Events passed to handler callbacks are similar to
  5564. * jQuery event objects in that they wrap native event objects,
  5565. * mimicking their API.
  5566. *
  5567. * http://js.cytoscape.org/#events
  5568. */
  5569. interface EventObject extends InputEventObject, LayoutEventObject {}
  5570. interface EventObjectNode extends EventObject {
  5571. target: NodeSingular;
  5572. }
  5573. interface EventObjectEdge extends EventObject {
  5574. target: EdgeSingular;
  5575. }
  5576. interface EventObjectCore extends EventObject {
  5577. target: Core;
  5578. }
  5579. /**
  5580. * http://js.cytoscape.org/#events/event-object
  5581. */
  5582. interface AbstractEventObject {
  5583. /** a reference to the corresponding core Core */
  5584. cy: Core;
  5585. /** indicates the element or core that first caused the event */
  5586. target: any;
  5587. /** the event type string (e.g. "tap", "select") */
  5588. type: UserInputDeviceEventName | UserInputDeviceEventNameExt | CollectionEventName | GraphEventName;
  5589. /** the event namespace string (e.g. "foo" for "foo.tap") */
  5590. namespace: string;
  5591. /** Unix epoch time of event in milliseconds */
  5592. timeStamp: number;
  5593. preventDefault: () => void;
  5594. stopPropagation: () => void;
  5595. stopImmediatePropagation: () => void;
  5596. isDefaultPrevented: () => boolean;
  5597. isPropagationStopped: () => boolean;
  5598. isImmediatePropagationStopped: () => boolean;
  5599. }
  5600. interface InputEventObject extends AbstractEventObject {
  5601. /** position : indicates the model position of the event */
  5602. position: Position;
  5603. /** renderedPosition : indicates the rendered position of the event */
  5604. renderedPosition: Position;
  5605. /** originalEvent : the original user input device event object */
  5606. originalEvent: MouseEvent;
  5607. }
  5608. interface LayoutEventObject extends AbstractEventObject {
  5609. /**
  5610. * layout : indicates the corresponding layout that triggered the event
  5611. * (useful if running multiple layouts simultaneously)
  5612. */
  5613. layout: any;
  5614. }
  5615. /**
  5616. * These are normal browser events that you can bind to via Cytoscape.js.
  5617. * You can bind these events to the core and to collections.
  5618. * http://js.cytoscape.org/#events/user-input-device-events
  5619. */
  5620. type UserInputDeviceEventName =
  5621. // when the mouse button is pressed
  5622. | "mousedown"
  5623. // when the mouse button is released
  5624. | "mouseup"
  5625. // after mousedown then mouseup
  5626. | "click"
  5627. // when the cursor is put on top of the target
  5628. | "mouseover"
  5629. // when the cursor is moved off of the target
  5630. | "mouseout"
  5631. // when the cursor is moved somewhere on top of the target
  5632. | "mousemove"
  5633. // when one or more fingers starts to touch the screen
  5634. | "touchstart"
  5635. // when one or more fingers are moved on the screen
  5636. | "touchmove"
  5637. // when one or more fingers are removed from the screen
  5638. | "touchend";
  5639. /**
  5640. * There are also some higher level events that you can use
  5641. * so you don’t have to bind to different events for
  5642. * mouse-input devices and for touch devices.
  5643. * http://js.cytoscape.org/#events/user-input-device-events
  5644. */
  5645. type UserInputDeviceEventNameExt =
  5646. // normalised tap start event (either mousedown or touchstart)
  5647. | "tapstart"
  5648. | "vmousedown"
  5649. // normalised move event (either touchmove or mousemove)
  5650. | "tapdrag"
  5651. | "vmousemove"
  5652. // normalised over element event (either touchmove or mousemove/mouseover)
  5653. | "tapdragover"
  5654. // normalised off of element event (either touchmove or mousemove/mouseout)
  5655. | "tapdragout"
  5656. // normalised tap end event (either mouseup or touchend)
  5657. | "tapend"
  5658. | "vmouseup"
  5659. // normalised tap event (either click, or touchstart followed by touchend without touchmove)
  5660. | "tap"
  5661. | "vclick"
  5662. // normalised tap hold event
  5663. | "taphold"
  5664. // normalised right-click mousedown or two-finger tapstart
  5665. | "cxttapstart"
  5666. // normalised right-click mouseup or two-finger tapend
  5667. | "cxttapend"
  5668. // normalised right-click or two-finger tap
  5669. | "cxttap"
  5670. // normalised mousemove or two-finger drag after cxttapstart but before cxttapend
  5671. | "cxtdrag"
  5672. // when going over a node via cxtdrag
  5673. | "cxtdragover"
  5674. // when going off a node via cxtdrag
  5675. | "cxtdragout"
  5676. // when starting box selection
  5677. | "boxstart"
  5678. // when ending box selection
  5679. | "boxend"
  5680. // triggered on elements when selected by box selection
  5681. | "boxselect"
  5682. // triggered on elements when inside the box on boxend
  5683. | "box";
  5684. /**
  5685. * These events are custom to Cytoscape.js. You can bind to these events for collections.
  5686. * http://js.cytoscape.org/#events/collection-events
  5687. */
  5688. type CollectionEventName =
  5689. // when an element is added to the graph
  5690. | "add"
  5691. // when an element is removed from the graph
  5692. | "remove"
  5693. // when an element is moved w.r.t. topology. Nodes: when the compound parent is changed. Edges: when the source or target is changed
  5694. | "move"
  5695. // when an element is selected
  5696. | "select"
  5697. // when an element is unselected
  5698. | "unselect"
  5699. // when an element is selected by a tap gesture
  5700. | "tapselect"
  5701. // when an element is unselected by a tap elsewhere
  5702. | "tapunselect"
  5703. // triggered on elements when selected by box selection
  5704. | "boxselect"
  5705. // triggered on elements when inside the box on boxend
  5706. | "box"
  5707. // when an element is locked
  5708. | "lock"
  5709. // when an element is unlocked
  5710. | "unlock"
  5711. // when an element is grabbed directly (including only the one node directly under the cursor or the user’s finger)
  5712. | "grabon"
  5713. // when an element is grabbed (including all elements that would be dragged)
  5714. | "grab"
  5715. // when an element is grabbed and then moved
  5716. | "drag"
  5717. // when an element is freed (i.e. let go from being grabbed)
  5718. | "free"
  5719. // when an element is freed directly (including only the one node directly under the cursor or the user’s finger)
  5720. | "freeon"
  5721. // when an element is freed after being dragged (i.e. grab then drag then free)
  5722. | "dragfree"
  5723. // when an element is freed after being dragged directly (i.e. grabon, drag, freeon)
  5724. | "dragfreeon"
  5725. // when an element changes position
  5726. | "position"
  5727. // when an element’s data is changed
  5728. | "data"
  5729. // when an element’s scratchpad data is changed
  5730. | "scratch"
  5731. // when an element’s style is changed
  5732. | "style"
  5733. // when a node’s background image is loaded
  5734. | "background";
  5735. /**
  5736. * These events are custom to Cytoscape.js, and they occur on the core.
  5737. * http://js.cytoscape.org/#events/graph-events
  5738. */
  5739. type GraphEventName =
  5740. // when a layout starts running
  5741. | "layoutstart"
  5742. // when a layout has set initial positions for all the nodes (but perhaps not final positions)
  5743. | "layoutready"
  5744. // when a layout has finished running completely or otherwise stopped running
  5745. | "layoutstop"
  5746. // when a new Core of Cytoscape.js is ready to be interacted with
  5747. | "ready"
  5748. // when the Core of Cytoscape.js was explicitly destroyed by calling .destroy().
  5749. | "destroy"
  5750. // when the viewport is (re)rendered
  5751. | "render"
  5752. // when the viewport is panned
  5753. | "pan"
  5754. // when the viewport is panned via dragging
  5755. | "dragpan"
  5756. // when the viewport is zoomed
  5757. | "zoom"
  5758. // when the viewport is zoomed via pinch gesture. This event is only supported for browsers which support the gesturechange event or touch events.
  5759. // Other browsers will fire the scrollzoom event.
  5760. | "pinchzoom"
  5761. // when the viewport is zoomed via the scroll wheel
  5762. | "scrollzoom"
  5763. // when the viewport is changed (i.e. from a pan, a zoom, or from both when zooming about a point – e.g. pinch-to-zoom)
  5764. | "viewport"
  5765. // when the viewport is resized (usually by calling cy.resize(), a window resize, or toggling a class on the Cytoscape.js div)
  5766. | "resize";
  5767. /**
  5768. * Layouts
  5769. * http://js.cytoscape.org/#layouts
  5770. *
  5771. * The function of a layout is to set the positions on the nodes in the graph.
  5772. * Layouts are extensions of Cytoscape.js such that it is possible for
  5773. * anyone to write a layout without modifying the library itself.
  5774. * Several layouts are included with Cytoscape.js by default,
  5775. * and their options are described in the sections that follow
  5776. * with the default values specified.
  5777. * Note that you must set options.name to the name of the
  5778. * layout to specify which one you want to run.
  5779. * Each layout has its own algorithm for setting the position for each node.
  5780. * This algorithm influences the overall shape of the graph and the lengths of the edges.
  5781. * A layout’s algorithm can be customised by setting its options.
  5782. * Therefore, edge lengths can be controlled by setting the layout options appropriately.
  5783. * For force-directed (physics) layouts,
  5784. * there is generally an option to set a weight to each edge
  5785. * to affect the relative edge lengths.
  5786. * Edge length can also be affected by options like spacing
  5787. * factors, angles, and overlap avoidance.
  5788. * Setting edge length depends on the particular layout,
  5789. * and some layouts will allow for more precise edge lengths than others.
  5790. */
  5791. interface Layouts extends LayoutManipulation, LayoutEvents {}
  5792. type LayoutOptions =
  5793. | NullLayoutOptions
  5794. | RandomLayoutOptions
  5795. | PresetLayoutOptions
  5796. | GridLayoutOptions
  5797. | CircleLayoutOptions
  5798. | ConcentricLayoutOptions
  5799. | BreadthFirstLayoutOptions
  5800. | CoseLayoutOptions
  5801. | BaseLayoutOptions;
  5802. type LayoutHandler = (e: LayoutEventObject) => void;
  5803. interface BaseLayoutOptions {
  5804. name: string;
  5805. // on layoutready event
  5806. ready?: LayoutHandler;
  5807. // on layoutstop event
  5808. stop?: LayoutHandler;
  5809. /**
  5810. * transform a given node position. Useful for changing flow direction in discrete layouts
  5811. *
  5812. * @param node The node.
  5813. * @param position The node position.
  5814. */
  5815. transform?(node: NodeSingular, position: Position): Position;
  5816. }
  5817. /**
  5818. * http://js.cytoscape.org/#layouts/null
  5819. */
  5820. interface NullLayoutOptions {
  5821. name: "null";
  5822. }
  5823. interface BoundingBox12 {
  5824. x1: number;
  5825. y1: number;
  5826. x2: number;
  5827. y2: number;
  5828. }
  5829. interface BoundingBoxWH {
  5830. x1: number;
  5831. y1: number;
  5832. w: number;
  5833. h: number;
  5834. }
  5835. interface AnimatedLayoutOptions {
  5836. // whether to transition the node positions
  5837. animate?: boolean;
  5838. // duration of animation in ms if enabled
  5839. animationDuration?: number;
  5840. // easing of animation if enabled
  5841. animationEasing?: Css.TransitionTimingFunction;
  5842. /**
  5843. * a function that determines whether the node should be animated.
  5844. * All nodes animated by default on animate enabled.
  5845. * Non-animated nodes are positioned immediately when the layout starts
  5846. */
  5847. animateFilter?(node: NodeSingular, index: number): boolean;
  5848. }
  5849. /**
  5850. * http://js.cytoscape.org/#layouts/random
  5851. */
  5852. interface RandomLayoutOptions extends BaseLayoutOptions, AnimatedLayoutOptions {
  5853. name: "random";
  5854. // whether to fit to viewport
  5855. fit?: boolean;
  5856. // fit padding
  5857. padding?: number;
  5858. // constrain layout bounds
  5859. boundingBox?: undefined | BoundingBox12 | BoundingBoxWH;
  5860. }
  5861. /**
  5862. * http://js.cytoscape.org/#layouts/preset
  5863. */
  5864. interface NodePositionMap {
  5865. [nodeid: string]: Position;
  5866. }
  5867. type NodePositionFunction = (nodeid: string) => Position;
  5868. interface PresetLayoutOptions extends BaseLayoutOptions, AnimatedLayoutOptions {
  5869. name: "preset";
  5870. // map of (node id) => (position obj); or function(node){ return somPos; }
  5871. positions?: NodePositionMap | NodePositionFunction;
  5872. // the zoom level to set (prob want fit = false if set)
  5873. zoom?: number;
  5874. // the pan level to set (prob want fit = false if set)
  5875. pan?: Position;
  5876. // whether to fit to viewport
  5877. fit?: boolean;
  5878. // padding on fit
  5879. padding?: number;
  5880. }
  5881. // A function that determines the order of the nodes. The return value has the same
  5882. // semantics as for compare function passed to Array.sort.
  5883. type SortingFunction = (a: NodeSingular, b: NodeSingular) => number;
  5884. interface ShapedLayoutOptions extends BaseLayoutOptions, AnimatedLayoutOptions {
  5885. // whether to fit to viewport
  5886. fit?: boolean;
  5887. // padding used on fit
  5888. padding?: number;
  5889. // constrain layout bounds
  5890. boundingBox?: BoundingBox12 | BoundingBoxWH;
  5891. // prevents node overlap, may overflow boundingBox if not enough space
  5892. avoidOverlap?: boolean;
  5893. // Excludes the label when calculating node bounding boxes for the layout algorithm
  5894. nodeDimensionsIncludeLabels?: boolean;
  5895. // Applies a multiplicative factor (>0) to expand or compress the overall area that the nodes take up
  5896. spacingFactor?: number;
  5897. // a sorting function to order the nodes
  5898. sort?: SortingFunction;
  5899. }
  5900. /**
  5901. * http://js.cytoscape.org/#layouts/grid
  5902. */
  5903. interface GridLayoutOptions extends ShapedLayoutOptions {
  5904. name: "grid";
  5905. // extra spacing around nodes when avoidOverlap: true
  5906. avoidOverlapPadding?: number;
  5907. // uses all available space on false, uses minimal space on true
  5908. condense?: boolean;
  5909. // force num of rows in the grid
  5910. rows?: number;
  5911. // force num of columns in the grid
  5912. cols?: number;
  5913. // returns { row, col } for element
  5914. position?(node: NodeSingular): { row: number; col: number };
  5915. }
  5916. /**
  5917. * http://js.cytoscape.org/#layouts/circle
  5918. */
  5919. interface CircleLayoutOptions extends ShapedLayoutOptions {
  5920. name: "circle";
  5921. // the radius of the circle
  5922. radius?: number;
  5923. // where nodes start in radians, e.g. 3 / 2 * Math.PI,
  5924. startAngle?: number;
  5925. // how many radians should be between the first and last node (defaults to full circle)
  5926. sweep?: number;
  5927. // whether the layout should go clockwise (true) or counterclockwise/anticlockwise (false)
  5928. clockwise?: boolean;
  5929. }
  5930. /**
  5931. * http://js.cytoscape.org/#layouts/concentric
  5932. */
  5933. interface ConcentricLayoutOptions extends ShapedLayoutOptions {
  5934. name: "concentric";
  5935. // where nodes start in radians, e.g. 3 / 2 * Math.PI,
  5936. startAngle?: number;
  5937. // how many radians should be between the first and last node (defaults to full circle)
  5938. sweep?: number;
  5939. // whether the layout should go clockwise (true) or counterclockwise/anticlockwise (false)
  5940. clockwise?: boolean;
  5941. // whether levels have an equal radial distance betwen them, may cause bounding box overflow
  5942. equidistant?: boolean;
  5943. minNodeSpacing?: number; // min spacing between outside of nodes (used for radius adjustment)
  5944. // height of layout area (overrides container height)
  5945. height?: number;
  5946. // width of layout area (overrides container width)
  5947. width?: number;
  5948. // Applies a multiplicative factor (>0) to expand or compress the overall area that the nodes take up
  5949. spacingFactor?: number;
  5950. // returns numeric value for each node, placing higher nodes in levels towards the centre
  5951. concentric?(node: NodeSingular): number;
  5952. // the variation of concentric values in each level
  5953. levelWidth?(node: NodeCollection): number;
  5954. }
  5955. /**
  5956. * http://js.cytoscape.org/#layouts/breadthfirst
  5957. */
  5958. interface BreadthFirstLayoutOptions extends ShapedLayoutOptions {
  5959. name: "breadthfirst";
  5960. // whether the tree is directed downwards (or edges can point in any direction if false)
  5961. directed?: boolean;
  5962. // determines the direction in which the tree structure is drawn
  5963. direction?: 'downward' | 'upward' | 'rightward' | 'leftward';
  5964. // put depths in concentric circles if true, put depths top down if false
  5965. circle?: boolean;
  5966. // the roots of the trees
  5967. roots?: string[];
  5968. // Deprecated: how many times to try to position the nodes in a maximal way (i.e. no backtracking)
  5969. maximalAdjustments?: number;
  5970. // whether to shift nodes down their natural BFS depths in order to avoid upwards edges (DAGS only)
  5971. maximal?: boolean;
  5972. // whether to create an even grid into which the DAG is placed (circle:false only)
  5973. grid?: boolean;
  5974. // a sorting function to order nodes at equal depth. e.g. function(a, b){ return a.data('weight') - b.data('weight') }
  5975. depthSort?: (a: NodeSingular, b: NodeSingular) => number;
  5976. }
  5977. /**
  5978. * http://js.cytoscape.org/#layouts/cose
  5979. */
  5980. interface CoseLayoutOptions extends ShapedLayoutOptions {
  5981. name: "cose";
  5982. // Number of iterations between consecutive screen positions update
  5983. // (0 -> only updated on the end)
  5984. refresh?: number;
  5985. // Randomize the initial positions of the nodes (true) or use existing positions (false)
  5986. randomize?: boolean;
  5987. // Extra spacing between components in non-compound graphs
  5988. componentSpacing?: number;
  5989. // Node repulsion (non overlapping) multiplier
  5990. nodeRepulsion?: Css.PropertyValueNode<number>;
  5991. // Node repulsion (overlapping) multiplier
  5992. nodeOverlap?: number;
  5993. // Ideal edge (non nested) length
  5994. idealEdgeLength?: Css.PropertyValueEdge<number>;
  5995. // Divisor to compute edge forces
  5996. edgeElasticity?: Css.PropertyValueEdge<number>;
  5997. // Nesting factor (multiplier) to compute ideal edge length for nested edges
  5998. nestingFactor?: number;
  5999. // Gravity force (constant)
  6000. gravity?: number;
  6001. // Maximum number of iterations to perform
  6002. numIter?: number;
  6003. // Initial temperature (maximum node displacement)
  6004. initialTemp?: number;
  6005. // Cooling factor (how the temperature is reduced between consecutive iterations
  6006. coolingFactor?: number;
  6007. // Lower temperature threshold (below this point the layout will end)
  6008. minTemp?: number;
  6009. // Deprecated: Pass a reference to weaver to use threads for calculations
  6010. weaver?: boolean;
  6011. // The layout animates only after this many milliseconds for animate:true
  6012. // (prevents flashing on fast runs)
  6013. animationThreshold?: number;
  6014. }
  6015. /**
  6016. * http://js.cytoscape.org/#layouts/layout-manipulation
  6017. * Layouts have a set of functions available to them,
  6018. * which allow for more complex behaviour than the primary run-one-layout-at-a-time usecase.
  6019. * A new, developer accessible layout can be made via cy.makeLayout().
  6020. */
  6021. interface LayoutManipulation {
  6022. /**
  6023. * Start running the layout
  6024. * http://js.cytoscape.org/#layout.run
  6025. */
  6026. run(): this;
  6027. start(): this;
  6028. /**
  6029. * Stop running the (asynchronous/discrete) layout
  6030. * http://js.cytoscape.org/#layout.stop
  6031. */
  6032. stop(): this;
  6033. }
  6034. interface LayoutEvents {
  6035. /**
  6036. * http://js.cytoscape.org/#layouts/layout-events
  6037. */
  6038. /**
  6039. * @param events A space separated list of event names.
  6040. * @param data [optional] A plain object which is passed to the
  6041. * handler in the event object argument.
  6042. * @param handler The handler function that is called
  6043. * when one of the specified events occurs.
  6044. */
  6045. on(events: EventNames, handler: EventHandler): this;
  6046. on(events: EventNames, data: any, handler: EventHandler): this;
  6047. bind(events: EventNames, handler: EventHandler): this;
  6048. bind(events: EventNames, data: any, handler: EventHandler): this;
  6049. listen(events: EventNames, handler: EventHandler): this;
  6050. listen(events: EventNames, data: any, handler: EventHandler): this;
  6051. addListener(events: EventNames, handler: EventHandler): this;
  6052. addListener(events: EventNames, data: any, handler: EventHandler): this;
  6053. /**
  6054. * Get a promise that is resolved with the first of any of
  6055. * the specified events triggered on the layout.
  6056. * http://js.cytoscape.org/#layout.promiseOn
  6057. */
  6058. promiseOn(events: EventNames): Promise<EventObject>;
  6059. pon(events: EventNames): Promise<EventObject>;
  6060. /**
  6061. * Bind to events that are emitted by the layout, and trigger the handler only once.
  6062. * @param events A space separated list of event names.
  6063. * @param data [optional] A plain object which is passed to the handler in the event object argument.
  6064. * @param handler The handler function that is called when one of the specified events occurs.
  6065. */
  6066. one(events: EventNames, handler: EventHandler): this;
  6067. one(events: EventNames, data: any, handler: EventHandler): this;
  6068. /**
  6069. * Remove event handlers on the layout.
  6070. * http://js.cytoscape.org/#layout.off
  6071. *
  6072. * @param events A space separated list of event names.
  6073. * @param handler [optional] A reference to the handler function to remove.
  6074. */
  6075. off(events: EventNames, handler?: EventHandler): this;
  6076. unbind(events: EventNames, handler?: EventHandler): this;
  6077. unlisten(events: EventNames, handler?: EventHandler): this;
  6078. removeListener(events: EventNames, handler?: EventHandler): this;
  6079. /**
  6080. * Remove all event handlers on the layout.
  6081. * https://js.cytoscape.org/#layout.removeAllListeners
  6082. */
  6083. removeAllListeners(): this;
  6084. /**
  6085. * Trigger one or more events on the layout.
  6086. * http://js.cytoscape.org/#layout.trigger
  6087. * @param events A space separated list of event names to trigger.
  6088. * @param extraParams [optional] An array of additional parameters to pass to the handler.
  6089. */
  6090. trigger(events: EventNames, extraParams?: any[]): this;
  6091. }
  6092. /**
  6093. * An animation represents a visible change in state over
  6094. * a duration of time for a single element.
  6095. * Animations can be generated via cy.animation()
  6096. * (for animations on the viewport) and ele.animation()
  6097. * (for animations on graph elements).
  6098. * http://js.cytoscape.org/#animations
  6099. */
  6100. /**
  6101. * http://js.cytoscape.org/#animations/animation-manipulation
  6102. */
  6103. interface AnimationManipulation {
  6104. /**
  6105. * Requests that the animation be played, starting on the next frame.
  6106. * If the animation is complete, it restarts from the beginning.
  6107. * http://js.cytoscape.org/#ani.play
  6108. */
  6109. play(): this;
  6110. /**
  6111. * Requests that the animation be played, starting on the next frame.
  6112. * If the animation is complete, it restarts from the beginning.
  6113. * http://js.cytoscape.org/#ani.play
  6114. */
  6115. run(): this;
  6116. /**
  6117. * Get whether the animation is currently playing.
  6118. * http://js.cytoscape.org/#ani.playing
  6119. */
  6120. playing(): boolean;
  6121. /**
  6122. * Get whether the animation is currently playing.
  6123. * http://js.cytoscape.org/#ani.playing
  6124. */
  6125. running(): boolean;
  6126. /**
  6127. * Get or set how far along the animation has progressed.
  6128. * http://js.cytoscape.org/#ani.progress
  6129. */
  6130. /**
  6131. * Get the progress of the animation in percent.
  6132. */
  6133. progress(): number;
  6134. /**
  6135. * Set the progress of the animation in percent.
  6136. * @param progress The progress in percent (i.e. between 0 and 1 inclusive) to set to the animation.
  6137. */
  6138. progress(progress: number): AnimationManipulation;
  6139. /**
  6140. * Get the progress of the animation in milliseconds.
  6141. */
  6142. time(): number;
  6143. /**
  6144. * Set the progress of the animation in milliseconds.
  6145. * @param time The progress in milliseconds
  6146. * (i.e. between 0 and the duration inclusive) to set to the animation.
  6147. */
  6148. time(time: number): AnimationManipulation;
  6149. /**
  6150. * Rewind the animation to the beginning.
  6151. */
  6152. rewind(): AnimationManipulation;
  6153. /**
  6154. * Fastforward the animation to the end.
  6155. */
  6156. fastforward(): AnimationManipulation;
  6157. /**
  6158. * Pause the animation, maintaining the current progress.
  6159. * http://js.cytoscape.org/#ani.pause
  6160. */
  6161. pause(): AnimationManipulation;
  6162. /**
  6163. * Stop the animation, maintaining the current progress
  6164. * and removing the animation from any associated queues.
  6165. * http://js.cytoscape.org/#ani.stop
  6166. */
  6167. stop(): AnimationManipulation;
  6168. /**
  6169. * Get whether the animation has progressed to the end.
  6170. * http://js.cytoscape.org/#ani.completed
  6171. */
  6172. completed(): AnimationManipulation;
  6173. complete(): AnimationManipulation;
  6174. /**
  6175. * Apply the animation at its current progress.
  6176. * http://js.cytoscape.org/#ani.apply
  6177. */
  6178. apply(): AnimationManipulation;
  6179. /**
  6180. * Get whether the animation is currently applying.
  6181. * http://js.cytoscape.org/#ani.applying
  6182. */
  6183. applying(): AnimationManipulation;
  6184. /**
  6185. * Reverse the animation such that its starting
  6186. * conditions and ending conditions are reversed.
  6187. * http://js.cytoscape.org/#ani.reverse
  6188. */
  6189. reverse(): AnimationManipulation;
  6190. /**
  6191. * Get a promise that is fulfilled with the specified animation event.
  6192. * @param animationEvent A string for the event name; completed or complete for
  6193. * completing the animation or frame for the next frame of the animation.
  6194. * http://js.cytoscape.org/#ani.promise
  6195. */
  6196. promise(animationEvent?: "completed" | "complete" | "frame"): Promise<EventObject>;
  6197. }
  6198. /**
  6199. * Cytoscape extension type
  6200. * Definition of an extension would be in following form:
  6201. * @example
  6202. * declare module 'cytoscape-ext' {
  6203. * const ext: cytoscape.Ext;
  6204. * export = ext;
  6205. * }
  6206. */
  6207. type Ext = (cy: typeof cytoscape) => void;
  6208. /**
  6209. * Register imported extension into cytoscape
  6210. * @param module Entry point for the extension, got by module = require('cy-ext')
  6211. * or by import module from 'cy-ext'
  6212. * http://js.cytoscape.org/#extensions
  6213. */
  6214. function use(module: Ext): void;
  6215. /**
  6216. * Surpress Cytoscape internal warnings globally with a flag.
  6217. * @param condition If true, all Cytoscape warnings are surpressed.
  6218. * https://js.cytoscape.org/#core/initialisation
  6219. */
  6220. function warnings(condition: boolean): void;
  6221. }