12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241 |
- /**
- * @license Paged.js v0.4.2 | MIT | https://gitlab.coko.foundation/pagedjs/pagedjs
- */
- (function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
- typeof define === 'function' && define.amd ? define(factory) :
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.PagedPolyfill = factory());
- })(this, (function () { 'use strict';
- function getDefaultExportFromCjs (x) {
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
- }
- var eventEmitter = {exports: {}};
- var d$2 = {exports: {}};
- var isImplemented$6 = function () {
- var assign = Object.assign, obj;
- if (typeof assign !== "function") return false;
- obj = { foo: "raz" };
- assign(obj, { bar: "dwa" }, { trzy: "trzy" });
- return (obj.foo + obj.bar + obj.trzy) === "razdwatrzy";
- };
- var isImplemented$5;
- var hasRequiredIsImplemented$1;
- function requireIsImplemented$1 () {
- if (hasRequiredIsImplemented$1) return isImplemented$5;
- hasRequiredIsImplemented$1 = 1;
- isImplemented$5 = function () {
- try {
- Object.keys("primitive");
- return true;
- } catch (e) {
- return false;
- }
- };
- return isImplemented$5;
- }
- // eslint-disable-next-line no-empty-function
- var noop$4 = function () {};
- var _undefined = noop$4(); // Support ES3 engines
- var isValue$3 = function (val) {
- return (val !== _undefined) && (val !== null);
- };
- var shim$5;
- var hasRequiredShim$5;
- function requireShim$5 () {
- if (hasRequiredShim$5) return shim$5;
- hasRequiredShim$5 = 1;
- var isValue = isValue$3;
- var keys = Object.keys;
- shim$5 = function (object) {
- return keys(isValue(object) ? Object(object) : object);
- };
- return shim$5;
- }
- var keys;
- var hasRequiredKeys;
- function requireKeys () {
- if (hasRequiredKeys) return keys;
- hasRequiredKeys = 1;
- keys = requireIsImplemented$1()()
- ? Object.keys
- : requireShim$5();
- return keys;
- }
- var isValue$2 = isValue$3;
- var validValue = function (value) {
- if (!isValue$2(value)) throw new TypeError("Cannot use null or undefined");
- return value;
- };
- var shim$4;
- var hasRequiredShim$4;
- function requireShim$4 () {
- if (hasRequiredShim$4) return shim$4;
- hasRequiredShim$4 = 1;
- var keys = requireKeys()
- , value = validValue
- , max = Math.max;
- shim$4 = function (dest, src /*, …srcn*/) {
- var error, i, length = max(arguments.length, 2), assign;
- dest = Object(value(dest));
- assign = function (key) {
- try {
- dest[key] = src[key];
- } catch (e) {
- if (!error) error = e;
- }
- };
- for (i = 1; i < length; ++i) {
- src = arguments[i];
- keys(src).forEach(assign);
- }
- if (error !== undefined) throw error;
- return dest;
- };
- return shim$4;
- }
- var assign$2 = isImplemented$6()
- ? Object.assign
- : requireShim$4();
- var isValue$1 = isValue$3;
- var forEach$1 = Array.prototype.forEach, create$5 = Object.create;
- var process = function (src, obj) {
- var key;
- for (key in src) obj[key] = src[key];
- };
- // eslint-disable-next-line no-unused-vars
- var normalizeOptions = function (opts1 /*, …options*/) {
- var result = create$5(null);
- forEach$1.call(arguments, function (options) {
- if (!isValue$1(options)) return;
- process(Object(options), result);
- });
- return result;
- };
- var isCallable$1 = function (obj) {
- return typeof obj === "function";
- };
- var str = "razdwatrzy";
- var isImplemented$4 = function () {
- if (typeof str.contains !== "function") return false;
- return (str.contains("dwa") === true) && (str.contains("foo") === false);
- };
- var shim$3;
- var hasRequiredShim$3;
- function requireShim$3 () {
- if (hasRequiredShim$3) return shim$3;
- hasRequiredShim$3 = 1;
- var indexOf = String.prototype.indexOf;
- shim$3 = function (searchString/*, position*/) {
- return indexOf.call(this, searchString, arguments[1]) > -1;
- };
- return shim$3;
- }
- var contains$1 = isImplemented$4()
- ? String.prototype.contains
- : requireShim$3();
- var assign$1 = assign$2
- , normalizeOpts = normalizeOptions
- , isCallable = isCallable$1
- , contains = contains$1
- , d$1;
- d$1 = d$2.exports = function (dscr, value/*, options*/) {
- var c, e, w, options, desc;
- if ((arguments.length < 2) || (typeof dscr !== 'string')) {
- options = value;
- value = dscr;
- dscr = null;
- } else {
- options = arguments[2];
- }
- if (dscr == null) {
- c = w = true;
- e = false;
- } else {
- c = contains.call(dscr, 'c');
- e = contains.call(dscr, 'e');
- w = contains.call(dscr, 'w');
- }
- desc = { value: value, configurable: c, enumerable: e, writable: w };
- return !options ? desc : assign$1(normalizeOpts(options), desc);
- };
- d$1.gs = function (dscr, get, set/*, options*/) {
- var c, e, options, desc;
- if (typeof dscr !== 'string') {
- options = set;
- set = get;
- get = dscr;
- dscr = null;
- } else {
- options = arguments[3];
- }
- if (get == null) {
- get = undefined;
- } else if (!isCallable(get)) {
- options = get;
- get = set = undefined;
- } else if (set == null) {
- set = undefined;
- } else if (!isCallable(set)) {
- options = set;
- set = undefined;
- }
- if (dscr == null) {
- c = true;
- e = false;
- } else {
- c = contains.call(dscr, 'c');
- e = contains.call(dscr, 'e');
- }
- desc = { get: get, set: set, configurable: c, enumerable: e };
- return !options ? desc : assign$1(normalizeOpts(options), desc);
- };
- var dExports = d$2.exports;
- var validCallable = function (fn) {
- if (typeof fn !== "function") throw new TypeError(fn + " is not a function");
- return fn;
- };
- (function (module, exports) {
- var d = dExports
- , callable = validCallable
- , apply = Function.prototype.apply, call = Function.prototype.call
- , create = Object.create, defineProperty = Object.defineProperty
- , defineProperties = Object.defineProperties
- , hasOwnProperty = Object.prototype.hasOwnProperty
- , descriptor = { configurable: true, enumerable: false, writable: true }
- , on, once, off, emit, methods, descriptors, base;
- on = function (type, listener) {
- var data;
- callable(listener);
- if (!hasOwnProperty.call(this, '__ee__')) {
- data = descriptor.value = create(null);
- defineProperty(this, '__ee__', descriptor);
- descriptor.value = null;
- } else {
- data = this.__ee__;
- }
- if (!data[type]) data[type] = listener;
- else if (typeof data[type] === 'object') data[type].push(listener);
- else data[type] = [data[type], listener];
- return this;
- };
- once = function (type, listener) {
- var once, self;
- callable(listener);
- self = this;
- on.call(this, type, once = function () {
- off.call(self, type, once);
- apply.call(listener, this, arguments);
- });
- once.__eeOnceListener__ = listener;
- return this;
- };
- off = function (type, listener) {
- var data, listeners, candidate, i;
- callable(listener);
- if (!hasOwnProperty.call(this, '__ee__')) return this;
- data = this.__ee__;
- if (!data[type]) return this;
- listeners = data[type];
- if (typeof listeners === 'object') {
- for (i = 0; (candidate = listeners[i]); ++i) {
- if ((candidate === listener) ||
- (candidate.__eeOnceListener__ === listener)) {
- if (listeners.length === 2) data[type] = listeners[i ? 0 : 1];
- else listeners.splice(i, 1);
- }
- }
- } else {
- if ((listeners === listener) ||
- (listeners.__eeOnceListener__ === listener)) {
- delete data[type];
- }
- }
- return this;
- };
- emit = function (type) {
- var i, l, listener, listeners, args;
- if (!hasOwnProperty.call(this, '__ee__')) return;
- listeners = this.__ee__[type];
- if (!listeners) return;
- if (typeof listeners === 'object') {
- l = arguments.length;
- args = new Array(l - 1);
- for (i = 1; i < l; ++i) args[i - 1] = arguments[i];
- listeners = listeners.slice();
- for (i = 0; (listener = listeners[i]); ++i) {
- apply.call(listener, this, args);
- }
- } else {
- switch (arguments.length) {
- case 1:
- call.call(listeners, this);
- break;
- case 2:
- call.call(listeners, this, arguments[1]);
- break;
- case 3:
- call.call(listeners, this, arguments[1], arguments[2]);
- break;
- default:
- l = arguments.length;
- args = new Array(l - 1);
- for (i = 1; i < l; ++i) {
- args[i - 1] = arguments[i];
- }
- apply.call(listeners, this, args);
- }
- }
- };
- methods = {
- on: on,
- once: once,
- off: off,
- emit: emit
- };
- descriptors = {
- on: d(on),
- once: d(once),
- off: d(off),
- emit: d(emit)
- };
- base = defineProperties({}, descriptors);
- module.exports = exports = function (o) {
- return (o == null) ? create(base) : defineProperties(Object(o), descriptors);
- };
- exports.methods = methods;
- } (eventEmitter, eventEmitter.exports));
- var eventEmitterExports = eventEmitter.exports;
- var EventEmitter = /*@__PURE__*/getDefaultExportFromCjs(eventEmitterExports);
- /**
- * Hooks allow for injecting functions that must all complete in order before finishing
- * They will execute in parallel but all must finish before continuing
- * Functions may return a promise if they are asycn.
- * From epubjs/src/utils/hooks
- * @param {any} context scope of this
- * @example this.content = new Hook(this);
- */
- class Hook {
- constructor(context){
- this.context = context || this;
- this.hooks = [];
- }
- /**
- * Adds a function to be run before a hook completes
- * @example this.content.register(function(){...});
- * @return {undefined} void
- */
- register(){
- for(var i = 0; i < arguments.length; ++i) {
- if (typeof arguments[i] === "function") {
- this.hooks.push(arguments[i]);
- } else {
- // unpack array
- for(var j = 0; j < arguments[i].length; ++j) {
- this.hooks.push(arguments[i][j]);
- }
- }
- }
- }
- /**
- * Triggers a hook to run all functions
- * @example this.content.trigger(args).then(function(){...});
- * @return {Promise} results
- */
- trigger(){
- var args = arguments;
- var context = this.context;
- var promises = [];
- this.hooks.forEach(function(task) {
- var executing = task.apply(context, args);
- if(executing && typeof executing["then"] === "function") {
- // Task is a function that returns a promise
- promises.push(executing);
- } else {
- // Otherwise Task resolves immediately, add resolved promise with result
- promises.push(new Promise((resolve, reject) => {
- resolve(executing);
- }));
- }
- });
- return Promise.all(promises);
- }
- /**
- * Triggers a hook to run all functions synchronously
- * @example this.content.trigger(args).then(function(){...});
- * @return {Array} results
- */
- triggerSync(){
- var args = arguments;
- var context = this.context;
- var results = [];
- this.hooks.forEach(function(task) {
- var executing = task.apply(context, args);
- results.push(executing);
- });
- return results;
- }
- // Adds a function to be run before a hook completes
- list(){
- return this.hooks;
- }
- clear(){
- return this.hooks = [];
- }
- }
- function getBoundingClientRect(element) {
- if (!element) {
- return;
- }
- let rect;
- if (typeof element.getBoundingClientRect !== "undefined") {
- rect = element.getBoundingClientRect();
- } else {
- let range = document.createRange();
- range.selectNode(element);
- rect = range.getBoundingClientRect();
- }
- return rect;
- }
- function getClientRects(element) {
- if (!element) {
- return;
- }
- let rect;
- if (typeof element.getClientRects !== "undefined") {
- rect = element.getClientRects();
- } else {
- let range = document.createRange();
- range.selectNode(element);
- rect = range.getClientRects();
- }
- return rect;
- }
- /**
- * Generates a UUID
- * based on: http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript
- * @returns {string} uuid
- */
- function UUID() {
- var d = new Date().getTime();
- if (typeof performance !== "undefined" && typeof performance.now === "function") {
- d += performance.now(); //use high-precision timer if available
- }
- return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
- var r = (d + Math.random() * 16) % 16 | 0;
- d = Math.floor(d / 16);
- return (c === "x" ? r : (r & 0x3 | 0x8)).toString(16);
- });
- }
- function attr(element, attributes) {
- for (var i = 0; i < attributes.length; i++) {
- if (element.hasAttribute(attributes[i])) {
- return element.getAttribute(attributes[i]);
- }
- }
- }
- /* Based on by https://mths.be/cssescape v1.5.1 by @mathias | MIT license
- * Allows # and .
- */
- function querySelectorEscape(value) {
- if (arguments.length == 0) {
- throw new TypeError("`CSS.escape` requires an argument.");
- }
- var string = String(value);
- var length = string.length;
- var index = -1;
- var codeUnit;
- var result = "";
- var firstCodeUnit = string.charCodeAt(0);
- while (++index < length) {
- codeUnit = string.charCodeAt(index);
- // Note: there’s no need to special-case astral symbols, surrogate
- // pairs, or lone surrogates.
- // If the character is NULL (U+0000), then the REPLACEMENT CHARACTER
- // (U+FFFD).
- if (codeUnit == 0x0000) {
- result += "\uFFFD";
- continue;
- }
- if (
- // If the character is in the range [\1-\1F] (U+0001 to U+001F) or is
- // U+007F, […]
- (codeUnit >= 0x0001 && codeUnit <= 0x001F) || codeUnit == 0x007F ||
- // If the character is the first character and is in the range [0-9]
- // (U+0030 to U+0039), […]
- (index == 0 && codeUnit >= 0x0030 && codeUnit <= 0x0039) ||
- // If the character is the second character and is in the range [0-9]
- // (U+0030 to U+0039) and the first character is a `-` (U+002D), […]
- (
- index == 1 &&
- codeUnit >= 0x0030 && codeUnit <= 0x0039 &&
- firstCodeUnit == 0x002D
- )
- ) {
- // https://drafts.csswg.org/cssom/#escape-a-character-as-code-point
- result += "\\" + codeUnit.toString(16) + " ";
- continue;
- }
- if (
- // If the character is the first character and is a `-` (U+002D), and
- // there is no second character, […]
- index == 0 &&
- length == 1 &&
- codeUnit == 0x002D
- ) {
- result += "\\" + string.charAt(index);
- continue;
- }
- // support for period character in id
- if (codeUnit == 0x002E) {
- if (string.charAt(0) == "#") {
- result += "\\.";
- continue;
- }
- }
- // If the character is not handled by one of the above rules and is
- // greater than or equal to U+0080, is `-` (U+002D) or `_` (U+005F), or
- // is in one of the ranges [0-9] (U+0030 to U+0039), [A-Z] (U+0041 to
- // U+005A), or [a-z] (U+0061 to U+007A), […]
- if (
- codeUnit >= 0x0080 ||
- codeUnit == 0x002D ||
- codeUnit == 0x005F ||
- codeUnit == 35 || // Allow #
- codeUnit == 46 || // Allow .
- codeUnit >= 0x0030 && codeUnit <= 0x0039 ||
- codeUnit >= 0x0041 && codeUnit <= 0x005A ||
- codeUnit >= 0x0061 && codeUnit <= 0x007A
- ) {
- // the character itself
- result += string.charAt(index);
- continue;
- }
- // Otherwise, the escaped character.
- // https://drafts.csswg.org/cssom/#escape-a-character
- result += "\\" + string.charAt(index);
- }
- return result;
- }
- /**
- * Creates a new pending promise and provides methods to resolve or reject it.
- * From: https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/Promise.jsm/Deferred#backwards_forwards_compatible
- * @returns {object} defered
- */
- function defer() {
- this.resolve = null;
- this.reject = null;
- this.id = UUID();
- this.promise = new Promise((resolve, reject) => {
- this.resolve = resolve;
- this.reject = reject;
- });
- Object.freeze(this);
- }
- const requestIdleCallback = typeof window !== "undefined" && ("requestIdleCallback" in window ? window.requestIdleCallback : window.requestAnimationFrame);
- function CSSValueToString(obj) {
- return obj.value + (obj.unit || "");
- }
- function isElement(node) {
- return node && node.nodeType === 1;
- }
- function isText(node) {
- return node && node.nodeType === 3;
- }
- function* walk$2(start, limiter) {
- let node = start;
- while (node) {
- yield node;
- if (node.childNodes.length) {
- node = node.firstChild;
- } else if (node.nextSibling) {
- if (limiter && node === limiter) {
- node = undefined;
- break;
- }
- node = node.nextSibling;
- } else {
- while (node) {
- node = node.parentNode;
- if (limiter && node === limiter) {
- node = undefined;
- break;
- }
- if (node && node.nextSibling) {
- node = node.nextSibling;
- break;
- }
- }
- }
- }
- }
- function nodeAfter(node, limiter) {
- if (limiter && node === limiter) {
- return;
- }
- let significantNode = nextSignificantNode(node);
- if (significantNode) {
- return significantNode;
- }
- if (node.parentNode) {
- while ((node = node.parentNode)) {
- if (limiter && node === limiter) {
- return;
- }
- significantNode = nextSignificantNode(node);
- if (significantNode) {
- return significantNode;
- }
- }
- }
- }
- function nodeBefore(node, limiter) {
- if (limiter && node === limiter) {
- return;
- }
- let significantNode = previousSignificantNode(node);
- if (significantNode) {
- return significantNode;
- }
- if (node.parentNode) {
- while ((node = node.parentNode)) {
- if (limiter && node === limiter) {
- return;
- }
- significantNode = previousSignificantNode(node);
- if (significantNode) {
- return significantNode;
- }
- }
- }
- }
- function elementAfter(node, limiter) {
- let after = nodeAfter(node, limiter);
- while (after && after.nodeType !== 1) {
- after = nodeAfter(after, limiter);
- }
- return after;
- }
- function elementBefore(node, limiter) {
- let before = nodeBefore(node, limiter);
- while (before && before.nodeType !== 1) {
- before = nodeBefore(before, limiter);
- }
- return before;
- }
- function displayedElementAfter(node, limiter) {
- let after = elementAfter(node, limiter);
- while (after && after.dataset.undisplayed) {
- after = elementAfter(after, limiter);
- }
- return after;
- }
- function displayedElementBefore(node, limiter) {
- let before = elementBefore(node, limiter);
- while (before && before.dataset.undisplayed) {
- before = elementBefore(before, limiter);
- }
- return before;
- }
- function rebuildAncestors(node) {
- let parent, ancestor;
- let ancestors = [];
- let added = [];
- let fragment = document.createDocumentFragment();
- // Handle rowspan on table
- if (node.nodeName === "TR") {
- let previousRow = node.previousElementSibling;
- let previousRowDistance = 1;
- while (previousRow) {
- // previous row has more columns, might indicate a rowspan.
- if (previousRow.childElementCount > node.childElementCount) {
- const initialColumns = Array.from(node.children);
- while (node.firstChild) {
- node.firstChild.remove();
- }
- let k = 0;
- for (let j = 0; j < previousRow.children.length; j++) {
- let column = previousRow.children[j];
- if (column.rowSpan && column.rowSpan > previousRowDistance) {
- const duplicatedColumn = column.cloneNode(true);
- // Adjust rowspan value
- duplicatedColumn.rowSpan = column.rowSpan - previousRowDistance;
- // Add the column to the row
- node.appendChild(duplicatedColumn);
- } else {
- // Fill the gap with the initial columns (if exists)
- const initialColumn = initialColumns[k++];
- // The initial column can be undefined if the newly created table has less columns than the original table
- if (initialColumn) {
- node.appendChild(initialColumn);
- }
- }
- }
- }
- previousRow = previousRow.previousElementSibling;
- previousRowDistance++;
- }
- }
- // Gather all ancestors
- let element = node;
- while(element.parentNode && element.parentNode.nodeType === 1) {
- ancestors.unshift(element.parentNode);
- element = element.parentNode;
- }
- for (var i = 0; i < ancestors.length; i++) {
- ancestor = ancestors[i];
- parent = ancestor.cloneNode(false);
-
- parent.setAttribute("data-split-from", parent.getAttribute("data-ref"));
- // ancestor.setAttribute("data-split-to", parent.getAttribute("data-ref"));
- if (parent.hasAttribute("id")) {
- let dataID = parent.getAttribute("id");
- parent.setAttribute("data-id", dataID);
- parent.removeAttribute("id");
- }
- // This is handled by css :not, but also tidied up here
- if (parent.hasAttribute("data-break-before")) {
- parent.removeAttribute("data-break-before");
- }
- if (parent.hasAttribute("data-previous-break-after")) {
- parent.removeAttribute("data-previous-break-after");
- }
- if (added.length) {
- let container = added[added.length-1];
- container.appendChild(parent);
- } else {
- fragment.appendChild(parent);
- }
- added.push(parent);
- // rebuild table rows
- if (parent.nodeName === "TD" && ancestor.parentElement.contains(ancestor)) {
- let td = ancestor;
- let prev = parent;
- while ((td = td.previousElementSibling)) {
- let sib = td.cloneNode(false);
- parent.parentElement.insertBefore(sib, prev);
- prev = sib;
- }
-
- }
- }
- added = undefined;
- return fragment;
- }
- /*
- export function split(bound, cutElement, breakAfter) {
- let needsRemoval = [];
- let index = indexOf(cutElement);
- if (!breakAfter && index === 0) {
- return;
- }
- if (breakAfter && index === (cutElement.parentNode.children.length - 1)) {
- return;
- }
- // Create a fragment with rebuilt ancestors
- let fragment = rebuildAncestors(cutElement);
- // Clone cut
- if (!breakAfter) {
- let clone = cutElement.cloneNode(true);
- let ref = cutElement.parentNode.getAttribute('data-ref');
- let parent = fragment.querySelector("[data-ref='" + ref + "']");
- parent.appendChild(clone);
- needsRemoval.push(cutElement);
- }
- // Remove all after cut
- let next = nodeAfter(cutElement, bound);
- while (next) {
- let clone = next.cloneNode(true);
- let ref = next.parentNode.getAttribute('data-ref');
- let parent = fragment.querySelector("[data-ref='" + ref + "']");
- parent.appendChild(clone);
- needsRemoval.push(next);
- next = nodeAfter(next, bound);
- }
- // Remove originals
- needsRemoval.forEach((node) => {
- if (node) {
- node.remove();
- }
- });
- // Insert after bounds
- bound.parentNode.insertBefore(fragment, bound.nextSibling);
- return [bound, bound.nextSibling];
- }
- */
- function needsBreakBefore(node) {
- if( typeof node !== "undefined" &&
- typeof node.dataset !== "undefined" &&
- typeof node.dataset.breakBefore !== "undefined" &&
- (node.dataset.breakBefore === "always" ||
- node.dataset.breakBefore === "page" ||
- node.dataset.breakBefore === "left" ||
- node.dataset.breakBefore === "right" ||
- node.dataset.breakBefore === "recto" ||
- node.dataset.breakBefore === "verso")
- ) {
- return true;
- }
- return false;
- }
- function needsPreviousBreakAfter(node) {
- if( typeof node !== "undefined" &&
- typeof node.dataset !== "undefined" &&
- typeof node.dataset.previousBreakAfter !== "undefined" &&
- (node.dataset.previousBreakAfter === "always" ||
- node.dataset.previousBreakAfter === "page" ||
- node.dataset.previousBreakAfter === "left" ||
- node.dataset.previousBreakAfter === "right" ||
- node.dataset.previousBreakAfter === "recto" ||
- node.dataset.previousBreakAfter === "verso")
- ) {
- return true;
- }
- return false;
- }
- function needsPageBreak(node, previousSignificantNode) {
- if (typeof node === "undefined" || !previousSignificantNode || isIgnorable(node)) {
- return false;
- }
- if (node.dataset && node.dataset.undisplayed) {
- return false;
- }
- let previousSignificantNodePage = previousSignificantNode.dataset ? previousSignificantNode.dataset.page : undefined;
- if (typeof previousSignificantNodePage === "undefined") {
- const nodeWithNamedPage = getNodeWithNamedPage(previousSignificantNode);
- if (nodeWithNamedPage) {
- previousSignificantNodePage = nodeWithNamedPage.dataset.page;
- }
- }
- let currentNodePage = node.dataset ? node.dataset.page : undefined;
- if (typeof currentNodePage === "undefined") {
- const nodeWithNamedPage = getNodeWithNamedPage(node, previousSignificantNode);
- if (nodeWithNamedPage) {
- currentNodePage = nodeWithNamedPage.dataset.page;
- }
- }
- return currentNodePage !== previousSignificantNodePage;
- }
- function *words(node) {
- let currentText = node.nodeValue;
- let max = currentText.length;
- let currentOffset = 0;
- let currentLetter;
- let range;
- const significantWhitespaces = node.parentElement && node.parentElement.nodeName === "PRE";
- while (currentOffset < max) {
- currentLetter = currentText[currentOffset];
- if (/^[\S\u202F\u00A0]$/.test(currentLetter) || significantWhitespaces) {
- if (!range) {
- range = document.createRange();
- range.setStart(node, currentOffset);
- }
- } else {
- if (range) {
- range.setEnd(node, currentOffset);
- yield range;
- range = undefined;
- }
- }
- currentOffset += 1;
- }
- if (range) {
- range.setEnd(node, currentOffset);
- yield range;
- }
- }
- function *letters(wordRange) {
- let currentText = wordRange.startContainer;
- let max = currentText.length;
- let currentOffset = wordRange.startOffset;
- // let currentLetter;
- let range;
- while(currentOffset < max) {
- // currentLetter = currentText[currentOffset];
- range = document.createRange();
- range.setStart(currentText, currentOffset);
- range.setEnd(currentText, currentOffset+1);
- yield range;
- currentOffset += 1;
- }
- }
- function isContainer(node) {
- let container;
- if (typeof node.tagName === "undefined") {
- return true;
- }
- if (node.style && node.style.display === "none") {
- return false;
- }
- switch (node.tagName) {
- // Inline
- case "A":
- case "ABBR":
- case "ACRONYM":
- case "B":
- case "BDO":
- case "BIG":
- case "BR":
- case "BUTTON":
- case "CITE":
- case "CODE":
- case "DFN":
- case "EM":
- case "I":
- case "IMG":
- case "INPUT":
- case "KBD":
- case "LABEL":
- case "MAP":
- case "OBJECT":
- case "Q":
- case "SAMP":
- case "SCRIPT":
- case "SELECT":
- case "SMALL":
- case "SPAN":
- case "STRONG":
- case "SUB":
- case "SUP":
- case "TEXTAREA":
- case "TIME":
- case "TT":
- case "VAR":
- case "P":
- case "H1":
- case "H2":
- case "H3":
- case "H4":
- case "H5":
- case "H6":
- case "FIGCAPTION":
- case "BLOCKQUOTE":
- case "PRE":
- case "LI":
- case "TD":
- case "DT":
- case "DD":
- case "VIDEO":
- case "CANVAS":
- container = false;
- break;
- default:
- container = true;
- }
- return container;
- }
- function cloneNode(n, deep=false) {
- return n.cloneNode(deep);
- }
- function findElement(node, doc, forceQuery) {
- const ref = node.getAttribute("data-ref");
- return findRef(ref, doc, forceQuery);
- }
- function findRef(ref, doc, forceQuery) {
- if (!forceQuery && doc.indexOfRefs && doc.indexOfRefs[ref]) {
- return doc.indexOfRefs[ref];
- } else {
- return doc.querySelector(`[data-ref='${ref}']`);
- }
- }
- function validNode(node) {
- if (isText(node)) {
- return true;
- }
- if (isElement(node) && node.dataset.ref) {
- return true;
- }
- return false;
- }
- function prevValidNode(node) {
- while (!validNode(node)) {
- if (node.previousSibling) {
- node = node.previousSibling;
- } else {
- node = node.parentNode;
- }
- if (!node) {
- break;
- }
- }
- return node;
- }
- function indexOf$2(node) {
- let parent = node.parentNode;
- if (!parent) {
- return 0;
- }
- return Array.prototype.indexOf.call(parent.childNodes, node);
- }
- function child(node, index) {
- return node.childNodes[index];
- }
- function hasContent(node) {
- if (isElement(node)) {
- return true;
- } else if (isText(node) &&
- node.textContent.trim().length) {
- return true;
- }
- return false;
- }
- function indexOfTextNode(node, parent) {
- if (!isText(node)) {
- return -1;
- }
- let nodeTextContent = node.textContent;
- let child;
- let index = -1;
- for (var i = 0; i < parent.childNodes.length; i++) {
- child = parent.childNodes[i];
- if (child.nodeType === 3) {
- let text = parent.childNodes[i].textContent;
- if (text.includes(nodeTextContent)) {
- index = i;
- break;
- }
- }
- }
- return index;
- }
- /**
- * Throughout, whitespace is defined as one of the characters
- * "\t" TAB \u0009
- * "\n" LF \u000A
- * "\r" CR \u000D
- * " " SPC \u0020
- *
- * This does not use Javascript's "\s" because that includes non-breaking
- * spaces (and also some other characters).
- */
- /**
- * Determine if a node should be ignored by the iterator functions.
- * taken from https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model/Whitespace#Whitespace_helper_functions
- *
- * @param {Node} node An object implementing the DOM1 |Node| interface.
- * @return {boolean} true if the node is:
- * 1) A |Text| node that is all whitespace
- * 2) A |Comment| node
- * and otherwise false.
- */
- function isIgnorable(node) {
- return (node.nodeType === 8) || // A comment node
- ((node.nodeType === 3) && isAllWhitespace(node)); // a text node, all whitespace
- }
- /**
- * Determine whether a node's text content is entirely whitespace.
- *
- * @param {Node} node A node implementing the |CharacterData| interface (i.e., a |Text|, |Comment|, or |CDATASection| node
- * @return {boolean} true if all of the text content of |nod| is whitespace, otherwise false.
- */
- function isAllWhitespace(node) {
- return !(/[^\t\n\r ]/.test(node.textContent));
- }
- /**
- * Version of |previousSibling| that skips nodes that are entirely
- * whitespace or comments. (Normally |previousSibling| is a property
- * of all DOM nodes that gives the sibling node, the node that is
- * a child of the same parent, that occurs immediately before the
- * reference node.)
- *
- * @param {ChildNode} sib The reference node.
- * @return {Node|null} Either:
- * 1) The closest previous sibling to |sib| that is not ignorable according to |is_ignorable|, or
- * 2) null if no such node exists.
- */
- function previousSignificantNode(sib) {
- while ((sib = sib.previousSibling)) {
- if (!isIgnorable(sib)) return sib;
- }
- return null;
- }
- function getNodeWithNamedPage(node, limiter) {
- if (node && node.dataset && node.dataset.page) {
- return node;
- }
- if (node.parentNode) {
- while ((node = node.parentNode)) {
- if (limiter && node === limiter) {
- return;
- }
- if (node.dataset && node.dataset.page) {
- return node;
- }
- }
- }
- return null;
- }
- function breakInsideAvoidParentNode(node) {
- while ((node = node.parentNode)) {
- if (node && node.dataset && node.dataset.breakInside === "avoid") {
- return node;
- }
- }
- return null;
- }
- /**
- * Find a parent with a given node name.
- * @param {Node} node - initial Node
- * @param {string} nodeName - node name (eg. "TD", "TABLE", "STRONG"...)
- * @param {Node} limiter - go up to the parent until there's no more parent or the current node is equals to the limiter
- * @returns {Node|undefined} - Either:
- * 1) The closest parent for a the given node name, or
- * 2) undefined if no such node exists.
- */
- function parentOf(node, nodeName, limiter) {
- if (limiter && node === limiter) {
- return;
- }
- if (node.parentNode) {
- while ((node = node.parentNode)) {
- if (limiter && node === limiter) {
- return;
- }
- if (node.nodeName === nodeName) {
- return node;
- }
- }
- }
- }
- /**
- * Version of |nextSibling| that skips nodes that are entirely
- * whitespace or comments.
- *
- * @param {ChildNode} sib The reference node.
- * @return {Node|null} Either:
- * 1) The closest next sibling to |sib| that is not ignorable according to |is_ignorable|, or
- * 2) null if no such node exists.
- */
- function nextSignificantNode(sib) {
- while ((sib = sib.nextSibling)) {
- if (!isIgnorable(sib)) return sib;
- }
- return null;
- }
- function filterTree(content, func, what) {
- const treeWalker = document.createTreeWalker(
- content || this.dom,
- what || NodeFilter.SHOW_ALL,
- func ? { acceptNode: func } : null,
- false
- );
- let node;
- let current;
- node = treeWalker.nextNode();
- while(node) {
- current = node;
- node = treeWalker.nextNode();
- current.parentNode.removeChild(current);
- }
- }
- /**
- * BreakToken
- * @class
- */
- class BreakToken {
- constructor(node, offset) {
- this.node = node;
- this.offset = offset;
- }
- equals(otherBreakToken) {
- if (!otherBreakToken) {
- return false;
- }
- if (this["node"] && otherBreakToken["node"] &&
- this["node"] !== otherBreakToken["node"]) {
- return false;
- }
- if (this["offset"] && otherBreakToken["offset"] &&
- this["offset"] !== otherBreakToken["offset"]) {
- return false;
- }
- return true;
- }
- toJSON(hash) {
- let node;
- let index = 0;
- if (!this.node) {
- return {};
- }
- if (isElement(this.node) && this.node.dataset.ref) {
- node = this.node.dataset.ref;
- } else if (hash) {
- node = this.node.parentElement.dataset.ref;
- }
- if (this.node.parentElement) {
- const children = Array.from(this.node.parentElement.childNodes);
- index = children.indexOf(this.node);
- }
- return JSON.stringify({
- "node": node,
- "index" : index,
- "offset": this.offset
- });
- }
- }
- /**
- * Render result.
- * @class
- */
- class RenderResult {
- constructor(breakToken, error) {
- this.breakToken = breakToken;
- this.error = error;
- }
- }
- class OverflowContentError extends Error {
- constructor(message, items) {
- super(message);
- this.items = items;
- }
- }
- const MAX_CHARS_PER_BREAK = 1500;
- /**
- * Layout
- * @class
- */
- class Layout {
- constructor(element, hooks, options) {
- this.element = element;
- this.bounds = this.element.getBoundingClientRect();
- this.parentBounds = this.element.offsetParent.getBoundingClientRect();
- let gap = parseFloat(window.getComputedStyle(this.element).columnGap);
-
- if (gap) {
- let leftMargin = this.bounds.left - this.parentBounds.left;
- this.gap = gap - leftMargin;
- } else {
- this.gap = 0;
- }
- if (hooks) {
- this.hooks = hooks;
- } else {
- this.hooks = {};
- this.hooks.layout = new Hook();
- this.hooks.renderNode = new Hook();
- this.hooks.layoutNode = new Hook();
- this.hooks.beforeOverflow = new Hook();
- this.hooks.onOverflow = new Hook();
- this.hooks.afterOverflowRemoved = new Hook();
- this.hooks.onBreakToken = new Hook();
- }
- this.settings = options || {};
- this.maxChars = this.settings.maxChars || MAX_CHARS_PER_BREAK;
- this.forceRenderBreak = false;
- }
- async renderTo(wrapper, source, breakToken, bounds = this.bounds) {
- let start = this.getStart(source, breakToken);
- let walker = walk$2(start, source);
- let node;
- let prevNode;
- let done;
- let next;
- let hasRenderedContent = false;
- let newBreakToken;
- let length = 0;
- let prevBreakToken = breakToken || new BreakToken(start);
- while (!done && !newBreakToken) {
- next = walker.next();
- prevNode = node;
- node = next.value;
- done = next.done;
- if (!node) {
- this.hooks && this.hooks.layout.trigger(wrapper, this);
- let imgs = wrapper.querySelectorAll("img");
- if (imgs.length) {
- await this.waitForImages(imgs);
- }
- newBreakToken = this.findBreakToken(wrapper, source, bounds, prevBreakToken);
- if (newBreakToken && newBreakToken.equals(prevBreakToken)) {
- console.warn("Unable to layout item: ", prevNode);
- return new RenderResult(undefined, new OverflowContentError("Unable to layout item", [prevNode]));
- }
- this.rebuildTableFromBreakToken(newBreakToken, wrapper);
- return new RenderResult(newBreakToken);
- }
- this.hooks && this.hooks.layoutNode.trigger(node);
- // Check if the rendered element has a break set
- if (hasRenderedContent && this.shouldBreak(node, start)) {
- this.hooks && this.hooks.layout.trigger(wrapper, this);
- let imgs = wrapper.querySelectorAll("img");
- if (imgs.length) {
- await this.waitForImages(imgs);
- }
- newBreakToken = this.findBreakToken(wrapper, source, bounds, prevBreakToken);
- if (!newBreakToken) {
- newBreakToken = this.breakAt(node);
- } else {
- this.rebuildTableFromBreakToken(newBreakToken, wrapper);
- }
- if (newBreakToken && newBreakToken.equals(prevBreakToken)) {
- console.warn("Unable to layout item: ", node);
- let after = newBreakToken.node && nodeAfter(newBreakToken.node);
- if (after) {
- newBreakToken = new BreakToken(after);
- } else {
- return new RenderResult(undefined, new OverflowContentError("Unable to layout item", [node]));
- }
- }
- length = 0;
- break;
- }
- if (node.dataset && node.dataset.page) {
- let named = node.dataset.page;
- let page = this.element.closest(".pagedjs_page");
- page.classList.add("pagedjs_named_page");
- page.classList.add("pagedjs_" + named + "_page");
- if (!node.dataset.splitFrom) {
- page.classList.add("pagedjs_" + named + "_first_page");
- }
- }
- // Should the Node be a shallow or deep clone
- let shallow = isContainer(node);
- let rendered = this.append(node, wrapper, breakToken, shallow);
- length += rendered.textContent.length;
- // Check if layout has content yet
- if (!hasRenderedContent) {
- hasRenderedContent = hasContent(node);
- }
- // Skip to the next node if a deep clone was rendered
- if (!shallow) {
- walker = walk$2(nodeAfter(node, source), source);
- }
- if (this.forceRenderBreak) {
- this.hooks && this.hooks.layout.trigger(wrapper, this);
- newBreakToken = this.findBreakToken(wrapper, source, bounds, prevBreakToken);
- if (!newBreakToken) {
- newBreakToken = this.breakAt(node);
- } else {
- this.rebuildTableFromBreakToken(newBreakToken, wrapper);
- }
- length = 0;
- this.forceRenderBreak = false;
- break;
- }
- // Only check x characters
- if (length >= this.maxChars) {
- this.hooks && this.hooks.layout.trigger(wrapper, this);
- let imgs = wrapper.querySelectorAll("img");
- if (imgs.length) {
- await this.waitForImages(imgs);
- }
- newBreakToken = this.findBreakToken(wrapper, source, bounds, prevBreakToken);
- if (newBreakToken) {
- length = 0;
- this.rebuildTableFromBreakToken(newBreakToken, wrapper);
- }
- if (newBreakToken && newBreakToken.equals(prevBreakToken)) {
- console.warn("Unable to layout item: ", node);
- let after = newBreakToken.node && nodeAfter(newBreakToken.node);
- if (after) {
- newBreakToken = new BreakToken(after);
- } else {
- return new RenderResult(undefined, new OverflowContentError("Unable to layout item", [node]));
- }
- }
- }
- }
- return new RenderResult(newBreakToken);
- }
- breakAt(node, offset = 0) {
- let newBreakToken = new BreakToken(
- node,
- offset
- );
- let breakHooks = this.hooks.onBreakToken.triggerSync(newBreakToken, undefined, node, this);
- breakHooks.forEach((newToken) => {
- if (typeof newToken != "undefined") {
- newBreakToken = newToken;
- }
- });
- return newBreakToken;
- }
- shouldBreak(node, limiter) {
- let previousNode = nodeBefore(node, limiter);
- let parentNode = node.parentNode;
- let parentBreakBefore = needsBreakBefore(node) && parentNode && !previousNode && needsBreakBefore(parentNode);
- let doubleBreakBefore;
- if (parentBreakBefore) {
- doubleBreakBefore = node.dataset.breakBefore === parentNode.dataset.breakBefore;
- }
- return !doubleBreakBefore && needsBreakBefore(node) || needsPreviousBreakAfter(node) || needsPageBreak(node, previousNode);
- }
- forceBreak() {
- this.forceRenderBreak = true;
- }
- getStart(source, breakToken) {
- let start;
- let node = breakToken && breakToken.node;
- if (node) {
- start = node;
- } else {
- start = source.firstChild;
- }
- return start;
- }
- append(node, dest, breakToken, shallow = true, rebuild = true) {
- let clone = cloneNode(node, !shallow);
- if (node.parentNode && isElement(node.parentNode)) {
- let parent = findElement(node.parentNode, dest);
- // Rebuild chain
- if (parent) {
- parent.appendChild(clone);
- } else if (rebuild) {
- let fragment = rebuildAncestors(node);
- parent = findElement(node.parentNode, fragment);
- if (!parent) {
- dest.appendChild(clone);
- } else if (breakToken && isText(breakToken.node) && breakToken.offset > 0) {
- clone.textContent = clone.textContent.substring(breakToken.offset);
- parent.appendChild(clone);
- } else {
- parent.appendChild(clone);
- }
- dest.appendChild(fragment);
- } else {
- dest.appendChild(clone);
- }
- } else {
- dest.appendChild(clone);
- }
- if (clone.dataset && clone.dataset.ref) {
- if (!dest.indexOfRefs) {
- dest.indexOfRefs = {};
- }
- dest.indexOfRefs[clone.dataset.ref] = clone;
- }
- let nodeHooks = this.hooks.renderNode.triggerSync(clone, node, this);
- nodeHooks.forEach((newNode) => {
- if (typeof newNode != "undefined") {
- clone = newNode;
- }
- });
- return clone;
- }
- rebuildTableFromBreakToken(breakToken, dest) {
- if (!breakToken || !breakToken.node) {
- return;
- }
- let node = breakToken.node;
- let td = isElement(node) ? node.closest("td") : node.parentElement.closest("td");
- if (td) {
- let rendered = findElement(td, dest, true);
- if (!rendered) {
- return;
- }
- while ((td = td.nextElementSibling)) {
- this.append(td, dest, null, true);
- }
- }
- }
- async waitForImages(imgs) {
- let results = Array.from(imgs).map(async (img) => {
- return this.awaitImageLoaded(img);
- });
- await Promise.all(results);
- }
- async awaitImageLoaded(image) {
- return new Promise(resolve => {
- if (image.complete !== true) {
- image.onload = function () {
- let {width, height} = window.getComputedStyle(image);
- resolve(width, height);
- };
- image.onerror = function (e) {
- let {width, height} = window.getComputedStyle(image);
- resolve(width, height, e);
- };
- } else {
- let {width, height} = window.getComputedStyle(image);
- resolve(width, height);
- }
- });
- }
- avoidBreakInside(node, limiter) {
- let breakNode;
- if (node === limiter) {
- return;
- }
- while (node.parentNode) {
- node = node.parentNode;
- if (node === limiter) {
- break;
- }
- if (window.getComputedStyle(node)["break-inside"] === "avoid") {
- breakNode = node;
- break;
- }
- }
- return breakNode;
- }
- createBreakToken(overflow, rendered, source) {
- let container = overflow.startContainer;
- let offset = overflow.startOffset;
- let node, renderedNode, parent, index, temp;
- if (isElement(container)) {
- temp = child(container, offset);
- if (isElement(temp)) {
- renderedNode = findElement(temp, rendered);
- if (!renderedNode) {
- // Find closest element with data-ref
- let prevNode = prevValidNode(temp);
- if (!isElement(prevNode)) {
- prevNode = prevNode.parentElement;
- }
- renderedNode = findElement(prevNode, rendered);
- // Check if temp is the last rendered node at its level.
- if (!temp.nextSibling) {
- // We need to ensure that the previous sibling of temp is fully rendered.
- const renderedNodeFromSource = findElement(renderedNode, source);
- const walker = document.createTreeWalker(renderedNodeFromSource, NodeFilter.SHOW_ELEMENT);
- const lastChildOfRenderedNodeFromSource = walker.lastChild();
- const lastChildOfRenderedNodeMatchingFromRendered = findElement(lastChildOfRenderedNodeFromSource, rendered);
- // Check if we found that the last child in source
- if (!lastChildOfRenderedNodeMatchingFromRendered) {
- // Pending content to be rendered before virtual break token
- return;
- }
- // Otherwise we will return a break token as per below
- }
- // renderedNode is actually the last unbroken box that does not overflow.
- // Break Token is therefore the next sibling of renderedNode within source node.
- node = findElement(renderedNode, source).nextSibling;
- offset = 0;
- } else {
- node = findElement(renderedNode, source);
- offset = 0;
- }
- } else {
- renderedNode = findElement(container, rendered);
- if (!renderedNode) {
- renderedNode = findElement(prevValidNode(container), rendered);
- }
- parent = findElement(renderedNode, source);
- index = indexOfTextNode(temp, parent);
- // No seperatation for the first textNode of an element
- if(index === 0) {
- node = parent;
- offset = 0;
- } else {
- node = child(parent, index);
- offset = 0;
- }
- }
- } else {
- renderedNode = findElement(container.parentNode, rendered);
- if (!renderedNode) {
- renderedNode = findElement(prevValidNode(container.parentNode), rendered);
- }
- parent = findElement(renderedNode, source);
- index = indexOfTextNode(container, parent);
- if (index === -1) {
- return;
- }
- node = child(parent, index);
- offset += node.textContent.indexOf(container.textContent);
- }
- if (!node) {
- return;
- }
- return new BreakToken(
- node,
- offset
- );
- }
- findBreakToken(rendered, source, bounds = this.bounds, prevBreakToken, extract = true) {
- let overflow = this.findOverflow(rendered, bounds);
- let breakToken, breakLetter;
- let overflowHooks = this.hooks.onOverflow.triggerSync(overflow, rendered, bounds, this);
- overflowHooks.forEach((newOverflow) => {
- if (typeof newOverflow != "undefined") {
- overflow = newOverflow;
- }
- });
- if (overflow) {
- breakToken = this.createBreakToken(overflow, rendered, source);
- // breakToken is nullable
- let breakHooks = this.hooks.onBreakToken.triggerSync(breakToken, overflow, rendered, this);
- breakHooks.forEach((newToken) => {
- if (typeof newToken != "undefined") {
- breakToken = newToken;
- }
- });
- // Stop removal if we are in a loop
- if (breakToken && breakToken.equals(prevBreakToken)) {
- return breakToken;
- }
- if (breakToken && breakToken["node"] && breakToken["offset"] && breakToken["node"].textContent) {
- breakLetter = breakToken["node"].textContent.charAt(breakToken["offset"]);
- } else {
- breakLetter = undefined;
- }
- if (breakToken && breakToken.node && extract) {
- let removed = this.removeOverflow(overflow, breakLetter);
- this.hooks && this.hooks.afterOverflowRemoved.trigger(removed, rendered, this);
- }
- }
- return breakToken;
- }
- hasOverflow(element, bounds = this.bounds) {
- let constrainingElement = element && element.parentNode; // this gets the element, instead of the wrapper for the width workaround
- let {width, height} = element.getBoundingClientRect();
- let scrollWidth = constrainingElement ? constrainingElement.scrollWidth : 0;
- let scrollHeight = constrainingElement ? constrainingElement.scrollHeight : 0;
- return Math.max(Math.floor(width), scrollWidth) > Math.round(bounds.width) ||
- Math.max(Math.floor(height), scrollHeight) > Math.round(bounds.height);
- }
- findOverflow(rendered, bounds = this.bounds, gap = this.gap) {
- if (!this.hasOverflow(rendered, bounds)) return;
- let start = Math.floor(bounds.left);
- let end = Math.round(bounds.right + gap);
- let vStart = Math.round(bounds.top);
- let vEnd = Math.round(bounds.bottom);
- let range;
- let walker = walk$2(rendered.firstChild, rendered);
- // Find Start
- let next, done, node, offset, skip, breakAvoid, prev, br;
- while (!done) {
- next = walker.next();
- done = next.done;
- node = next.value;
- skip = false;
- breakAvoid = false;
- prev = undefined;
- br = undefined;
- if (node) {
- let pos = getBoundingClientRect(node);
- let left = Math.round(pos.left);
- let right = Math.floor(pos.right);
- let top = Math.round(pos.top);
- let bottom = Math.floor(pos.bottom);
- if (!range && (left >= end || top >= vEnd)) {
- // Check if it is a float
- let isFloat = false;
- // Check if the node is inside a break-inside: avoid table cell
- const insideTableCell = parentOf(node, "TD", rendered);
- if (insideTableCell && window.getComputedStyle(insideTableCell)["break-inside"] === "avoid") {
- // breaking inside a table cell produces unexpected result, as a workaround, we forcibly avoid break inside in a cell.
- // But we take the whole row, not just the cell that is causing the break.
- prev = insideTableCell.parentElement;
- } else if (isElement(node)) {
- let styles = window.getComputedStyle(node);
- isFloat = styles.getPropertyValue("float") !== "none";
- skip = styles.getPropertyValue("break-inside") === "avoid";
- breakAvoid = node.dataset.breakBefore === "avoid" || node.dataset.previousBreakAfter === "avoid";
- prev = breakAvoid && nodeBefore(node, rendered);
- br = node.tagName === "BR" || node.tagName === "WBR";
- }
- let tableRow;
- if (node.nodeName === "TR") {
- tableRow = node;
- } else {
- tableRow = parentOf(node, "TR", rendered);
- }
- if (tableRow) {
- // honor break-inside="avoid" in parent tbody/thead
- let container = tableRow.parentElement;
- if (["TBODY", "THEAD"].includes(container.nodeName)) {
- let styles = window.getComputedStyle(container);
- if (styles.getPropertyValue("break-inside") === "avoid") prev = container;
- }
- // Check if the node is inside a row with a rowspan
- const table = parentOf(tableRow, "TABLE", rendered);
- const rowspan = table.querySelector("[colspan]");
- if (table && rowspan) {
- let columnCount = 0;
- for (const cell of Array.from(table.rows[0].cells)) {
- columnCount += parseInt(cell.getAttribute("colspan") || "1");
- }
- if (tableRow.cells.length !== columnCount) {
- let previousRow = tableRow.previousElementSibling;
- let previousRowColumnCount;
- while (previousRow !== null) {
- previousRowColumnCount = 0;
- for (const cell of Array.from(previousRow.cells)) {
- previousRowColumnCount += parseInt(cell.getAttribute("colspan") || "1");
- }
- if (previousRowColumnCount === columnCount) {
- break;
- }
- previousRow = previousRow.previousElementSibling;
- }
- if (previousRowColumnCount === columnCount) {
- prev = previousRow;
- }
- }
- }
- }
- if (prev) {
- range = document.createRange();
- range.selectNode(prev);
- break;
- }
- if (!br && !isFloat && isElement(node)) {
- range = document.createRange();
- range.selectNode(node);
- break;
- }
- if (isText(node) && node.textContent.trim().length) {
- range = document.createRange();
- range.selectNode(node);
- break;
- }
- }
- if (!range && isText(node) &&
- node.textContent.trim().length &&
- !breakInsideAvoidParentNode(node.parentNode)) {
- let rects = getClientRects(node);
- let rect;
- left = 0;
- top = 0;
- for (var i = 0; i != rects.length; i++) {
- rect = rects[i];
- if (rect.width > 0 && (!left || rect.left > left)) {
- left = rect.left;
- }
- if (rect.height > 0 && (!top || rect.top > top)) {
- top = rect.top;
- }
- }
- if (left >= end || top >= vEnd) {
- range = document.createRange();
- offset = this.textBreak(node, start, end, vStart, vEnd);
- if (!offset) {
- range = undefined;
- } else {
- range.setStart(node, offset);
- }
- break;
- }
- }
- // Skip children
- if (skip || (right <= end && bottom <= vEnd)) {
- next = nodeAfter(node, rendered);
- if (next) {
- walker = walk$2(next, rendered);
- }
- }
- }
- }
- // Find End
- if (range) {
- range.setEndAfter(rendered.lastChild);
- return range;
- }
- }
- findEndToken(rendered, source) {
- if (rendered.childNodes.length === 0) {
- return;
- }
- let lastChild = rendered.lastChild;
- let lastNodeIndex;
- while (lastChild && lastChild.lastChild) {
- if (!validNode(lastChild)) {
- // Only get elements with refs
- lastChild = lastChild.previousSibling;
- } else if (!validNode(lastChild.lastChild)) {
- // Deal with invalid dom items
- lastChild = prevValidNode(lastChild.lastChild);
- break;
- } else {
- lastChild = lastChild.lastChild;
- }
- }
- if (isText(lastChild)) {
- if (lastChild.parentNode.dataset.ref) {
- lastNodeIndex = indexOf$2(lastChild);
- lastChild = lastChild.parentNode;
- } else {
- lastChild = lastChild.previousSibling;
- }
- }
- let original = findElement(lastChild, source);
- if (lastNodeIndex) {
- original = original.childNodes[lastNodeIndex];
- }
- let after = nodeAfter(original);
- return this.breakAt(after);
- }
- textBreak(node, start, end, vStart, vEnd) {
- let wordwalker = words(node);
- let left = 0;
- let right = 0;
- let top = 0;
- let bottom = 0;
- let word, next, done, pos;
- let offset;
- while (!done) {
- next = wordwalker.next();
- word = next.value;
- done = next.done;
- if (!word) {
- break;
- }
- pos = getBoundingClientRect(word);
- left = Math.floor(pos.left);
- right = Math.floor(pos.right);
- top = Math.floor(pos.top);
- bottom = Math.floor(pos.bottom);
- if (left >= end || top >= vEnd) {
- offset = word.startOffset;
- break;
- }
- if (right > end || bottom > vEnd) {
- let letterwalker = letters(word);
- let letter, nextLetter, doneLetter;
- while (!doneLetter) {
- nextLetter = letterwalker.next();
- letter = nextLetter.value;
- doneLetter = nextLetter.done;
- if (!letter) {
- break;
- }
- pos = getBoundingClientRect(letter);
- left = Math.floor(pos.left);
- top = Math.floor(pos.top);
- if (left >= end || top >= vEnd) {
- offset = letter.startOffset;
- done = true;
- break;
- }
- }
- }
- }
- return offset;
- }
- removeOverflow(overflow, breakLetter) {
- let {startContainer} = overflow;
- let extracted = overflow.extractContents();
- this.hyphenateAtBreak(startContainer, breakLetter);
- return extracted;
- }
- hyphenateAtBreak(startContainer, breakLetter) {
- if (isText(startContainer)) {
- let startText = startContainer.textContent;
- let prevLetter = startText[startText.length - 1];
- // Add a hyphen if previous character is a letter or soft hyphen
- if (
- (breakLetter && /^\w|\u00AD$/.test(prevLetter) && /^\w|\u00AD$/.test(breakLetter)) ||
- (!breakLetter && /^\w|\u00AD$/.test(prevLetter))
- ) {
- startContainer.parentNode.classList.add("pagedjs_hyphen");
- startContainer.textContent += this.settings.hyphenGlyph || "\u2011";
- }
- }
- }
- equalTokens(a, b) {
- if (!a || !b) {
- return false;
- }
- if (a["node"] && b["node"] && a["node"] !== b["node"]) {
- return false;
- }
- if (a["offset"] && b["offset"] && a["offset"] !== b["offset"]) {
- return false;
- }
- return true;
- }
- }
- EventEmitter(Layout.prototype);
- /**
- * Render a page
- * @class
- */
- class Page {
- constructor(pagesArea, pageTemplate, blank, hooks, options) {
- this.pagesArea = pagesArea;
- this.pageTemplate = pageTemplate;
- this.blank = blank;
- this.width = undefined;
- this.height = undefined;
- this.hooks = hooks;
- this.settings = options || {};
- // this.element = this.create(this.pageTemplate);
- }
- create(template, after) {
- //let documentFragment = document.createRange().createContextualFragment( TEMPLATE );
- //let page = documentFragment.children[0];
- let clone = document.importNode(this.pageTemplate.content, true);
- let page, index;
- if (after) {
- this.pagesArea.insertBefore(clone, after.nextElementSibling);
- index = Array.prototype.indexOf.call(this.pagesArea.children, after.nextElementSibling);
- page = this.pagesArea.children[index];
- } else {
- this.pagesArea.appendChild(clone);
- page = this.pagesArea.lastChild;
- }
- let pagebox = page.querySelector(".pagedjs_pagebox");
- let area = page.querySelector(".pagedjs_page_content");
- let footnotesArea = page.querySelector(".pagedjs_footnote_area");
- let size = area.getBoundingClientRect();
- area.style.columnWidth = Math.round(size.width) + "px";
- area.style.columnGap = "calc(var(--pagedjs-margin-right) + var(--pagedjs-margin-left) + var(--pagedjs-bleed-right) + var(--pagedjs-bleed-left) + var(--pagedjs-column-gap-offset))";
- // area.style.overflow = "scroll";
- this.width = Math.round(size.width);
- this.height = Math.round(size.height);
- this.element = page;
- this.pagebox = pagebox;
- this.area = area;
- this.footnotesArea = footnotesArea;
- return page;
- }
- createWrapper() {
- let wrapper = document.createElement("div");
- this.area.appendChild(wrapper);
- this.wrapper = wrapper;
- return wrapper;
- }
- index(pgnum) {
- this.position = pgnum;
- let page = this.element;
- // let pagebox = this.pagebox;
- let index = pgnum + 1;
- let id = `page-${index}`;
- this.id = id;
- // page.dataset.pageNumber = index;
- page.dataset.pageNumber = index;
- page.setAttribute("id", id);
- if (this.name) {
- page.classList.add("pagedjs_" + this.name + "_page");
- }
- if (this.blank) {
- page.classList.add("pagedjs_blank_page");
- }
- if (pgnum === 0) {
- page.classList.add("pagedjs_first_page");
- }
- if (pgnum % 2 !== 1) {
- page.classList.remove("pagedjs_left_page");
- page.classList.add("pagedjs_right_page");
- } else {
- page.classList.remove("pagedjs_right_page");
- page.classList.add("pagedjs_left_page");
- }
- }
- /*
- size(width, height) {
- if (width === this.width && height === this.height) {
- return;
- }
- this.width = width;
- this.height = height;
- this.element.style.width = Math.round(width) + "px";
- this.element.style.height = Math.round(height) + "px";
- this.element.style.columnWidth = Math.round(width) + "px";
- }
- */
- async layout(contents, breakToken, maxChars) {
- this.clear();
- this.startToken = breakToken;
- let settings = this.settings;
- if (!settings.maxChars && maxChars) {
- settings.maxChars = maxChars;
- }
- this.layoutMethod = new Layout(this.area, this.hooks, settings);
- let renderResult = await this.layoutMethod.renderTo(this.wrapper, contents, breakToken);
- let newBreakToken = renderResult.breakToken;
- this.addListeners(contents);
- this.endToken = newBreakToken;
- return newBreakToken;
- }
- async append(contents, breakToken) {
- if (!this.layoutMethod) {
- return this.layout(contents, breakToken);
- }
- let renderResult = await this.layoutMethod.renderTo(this.wrapper, contents, breakToken);
- let newBreakToken = renderResult.breakToken;
- this.endToken = newBreakToken;
- return newBreakToken;
- }
- getByParent(ref, entries) {
- let e;
- for (var i = 0; i < entries.length; i++) {
- e = entries[i];
- if (e.dataset.ref === ref) {
- return e;
- }
- }
- }
- onOverflow(func) {
- this._onOverflow = func;
- }
- onUnderflow(func) {
- this._onUnderflow = func;
- }
- clear() {
- this.removeListeners();
- this.wrapper && this.wrapper.remove();
- this.createWrapper();
- }
- addListeners(contents) {
- if (typeof ResizeObserver !== "undefined") {
- this.addResizeObserver(contents);
- } else {
- this._checkOverflowAfterResize = this.checkOverflowAfterResize.bind(this, contents);
- this.element.addEventListener("overflow", this._checkOverflowAfterResize, false);
- this.element.addEventListener("underflow", this._checkOverflowAfterResize, false);
- }
- // TODO: fall back to mutation observer?
- this._onScroll = function () {
- if (this.listening) {
- this.element.scrollLeft = 0;
- }
- }.bind(this);
- // Keep scroll left from changing
- this.element.addEventListener("scroll", this._onScroll);
- this.listening = true;
- return true;
- }
- removeListeners() {
- this.listening = false;
- if (typeof ResizeObserver !== "undefined" && this.ro) {
- this.ro.disconnect();
- } else if (this.element) {
- this.element.removeEventListener("overflow", this._checkOverflowAfterResize, false);
- this.element.removeEventListener("underflow", this._checkOverflowAfterResize, false);
- }
- this.element && this.element.removeEventListener("scroll", this._onScroll);
- }
- addResizeObserver(contents) {
- let wrapper = this.wrapper;
- let prevHeight = wrapper.getBoundingClientRect().height;
- this.ro = new ResizeObserver(entries => {
- if (!this.listening) {
- return;
- }
- requestAnimationFrame(() => {
- for (let entry of entries) {
- const cr = entry.contentRect;
- if (cr.height > prevHeight) {
- this.checkOverflowAfterResize(contents);
- prevHeight = wrapper.getBoundingClientRect().height;
- } else if (cr.height < prevHeight) { // TODO: calc line height && (prevHeight - cr.height) >= 22
- this.checkUnderflowAfterResize(contents);
- prevHeight = cr.height;
- }
- }
- });
- });
- this.ro.observe(wrapper);
- }
- checkOverflowAfterResize(contents) {
- if (!this.listening || !this.layoutMethod) {
- return;
- }
- let newBreakToken = this.layoutMethod.findBreakToken(this.wrapper, contents, this.startToken);
- if (newBreakToken) {
- this.endToken = newBreakToken;
- this._onOverflow && this._onOverflow(newBreakToken);
- }
- }
- checkUnderflowAfterResize(contents) {
- if (!this.listening || !this.layoutMethod) {
- return;
- }
- let endToken = this.layoutMethod.findEndToken(this.wrapper, contents);
- if (endToken) {
- this._onUnderflow && this._onUnderflow(endToken);
- }
- }
- destroy() {
- this.removeListeners();
- this.element.remove();
- this.element = undefined;
- this.wrapper = undefined;
- }
- }
- EventEmitter(Page.prototype);
- /**
- * Render a flow of text offscreen
- * @class
- */
- class ContentParser {
- constructor(content, cb) {
- if (content && content.nodeType) {
- // handle dom
- this.dom = this.add(content);
- } else if (typeof content === "string") {
- this.dom = this.parse(content);
- }
- return this.dom;
- }
- parse(markup, mime) {
- let range = document.createRange();
- let fragment = range.createContextualFragment(markup);
- this.addRefs(fragment);
- return fragment;
- }
- add(contents) {
- // let fragment = document.createDocumentFragment();
- //
- // let children = [...contents.childNodes];
- // for (let child of children) {
- // let clone = child.cloneNode(true);
- // fragment.appendChild(clone);
- // }
- this.addRefs(contents);
- return contents;
- }
- addRefs(content) {
- var treeWalker = document.createTreeWalker(
- content,
- NodeFilter.SHOW_ELEMENT,
- null,
- false
- );
- let node = treeWalker.nextNode();
- while(node) {
- if (!node.hasAttribute("data-ref")) {
- let uuid = UUID();
- node.setAttribute("data-ref", uuid);
- }
- if (node.id) {
- node.setAttribute("data-id", node.id);
- }
- // node.setAttribute("data-children", node.childNodes.length);
- // node.setAttribute("data-text", node.textContent.trim().length);
- node = treeWalker.nextNode();
- }
- }
- find(ref) {
- return this.refs[ref];
- }
- destroy() {
- this.refs = undefined;
- this.dom = undefined;
- }
- }
- /**
- * Queue for handling tasks one at a time
- * @class
- * @param {scope} context what this will resolve to in the tasks
- */
- class Queue {
- constructor(context){
- this._q = [];
- this.context = context;
- this.tick = requestAnimationFrame;
- this.running = false;
- this.paused = false;
- }
- /**
- * Add an item to the queue
- * @return {Promise} enqueued
- */
- enqueue() {
- var deferred, promise;
- var queued;
- var task = [].shift.call(arguments);
- var args = arguments;
- // Handle single args without context
- // if(args && !Array.isArray(args)) {
- // args = [args];
- // }
- if(!task) {
- throw new Error("No Task Provided");
- }
- if(typeof task === "function"){
- deferred = new defer();
- promise = deferred.promise;
- queued = {
- "task" : task,
- "args" : args,
- //"context" : context,
- "deferred" : deferred,
- "promise" : promise
- };
- } else {
- // Task is a promise
- queued = {
- "promise" : task
- };
- }
- this._q.push(queued);
- // Wait to start queue flush
- if (this.paused == false && !this.running) {
- this.run();
- }
- return queued.promise;
- }
- /**
- * Run one item
- * @return {Promise} dequeued
- */
- dequeue(){
- var inwait, task, result;
- if(this._q.length && !this.paused) {
- inwait = this._q.shift();
- task = inwait.task;
- if(task){
- // console.log(task)
- result = task.apply(this.context, inwait.args);
- if(result && typeof result["then"] === "function") {
- // Task is a function that returns a promise
- return result.then(function(){
- inwait.deferred.resolve.apply(this.context, arguments);
- }.bind(this), function() {
- inwait.deferred.reject.apply(this.context, arguments);
- }.bind(this));
- } else {
- // Task resolves immediately
- inwait.deferred.resolve.apply(this.context, result);
- return inwait.promise;
- }
- } else if(inwait.promise) {
- // Task is a promise
- return inwait.promise;
- }
- } else {
- inwait = new defer();
- inwait.deferred.resolve();
- return inwait.promise;
- }
- }
- // Run All Immediately
- dump(){
- while(this._q.length) {
- this.dequeue();
- }
- }
- /**
- * Run all tasks sequentially, at convince
- * @return {Promise} all run
- */
- run(){
- if(!this.running){
- this.running = true;
- this.defered = new defer();
- }
- this.tick.call(window, () => {
- if(this._q.length) {
- this.dequeue()
- .then(function(){
- this.run();
- }.bind(this));
- } else {
- this.defered.resolve();
- this.running = undefined;
- }
- });
- // Unpause
- if(this.paused == true) {
- this.paused = false;
- }
- return this.defered.promise;
- }
- /**
- * Flush all, as quickly as possible
- * @return {Promise} ran
- */
- flush(){
- if(this.running){
- return this.running;
- }
- if(this._q.length) {
- this.running = this.dequeue()
- .then(function(){
- this.running = undefined;
- return this.flush();
- }.bind(this));
- return this.running;
- }
- }
- /**
- * Clear all items in wait
- * @return {void}
- */
- clear(){
- this._q = [];
- }
- /**
- * Get the number of tasks in the queue
- * @return {number} tasks
- */
- length(){
- return this._q.length;
- }
- /**
- * Pause a running queue
- * @return {void}
- */
- pause(){
- this.paused = true;
- }
- /**
- * End the queue
- * @return {void}
- */
- stop(){
- this._q = [];
- this.running = false;
- this.paused = true;
- }
- }
- const TEMPLATE = `
- <div class="pagedjs_page">
- <div class="pagedjs_sheet">
- <div class="pagedjs_bleed pagedjs_bleed-top">
- <div class="pagedjs_marks-crop"></div>
- <div class="pagedjs_marks-middle">
- <div class="pagedjs_marks-cross"></div>
- </div>
- <div class="pagedjs_marks-crop"></div>
- </div>
- <div class="pagedjs_bleed pagedjs_bleed-bottom">
- <div class="pagedjs_marks-crop"></div>
- <div class="pagedjs_marks-middle">
- <div class="pagedjs_marks-cross"></div>
- </div> <div class="pagedjs_marks-crop"></div>
- </div>
- <div class="pagedjs_bleed pagedjs_bleed-left">
- <div class="pagedjs_marks-crop"></div>
- <div class="pagedjs_marks-middle">
- <div class="pagedjs_marks-cross"></div>
- </div> <div class="pagedjs_marks-crop"></div>
- </div>
- <div class="pagedjs_bleed pagedjs_bleed-right">
- <div class="pagedjs_marks-crop"></div>
- <div class="pagedjs_marks-middle">
- <div class="pagedjs_marks-cross"></div>
- </div>
- <div class="pagedjs_marks-crop"></div>
- </div>
- <div class="pagedjs_pagebox">
- <div class="pagedjs_margin-top-left-corner-holder">
- <div class="pagedjs_margin pagedjs_margin-top-left-corner"><div class="pagedjs_margin-content"></div></div>
- </div>
- <div class="pagedjs_margin-top">
- <div class="pagedjs_margin pagedjs_margin-top-left"><div class="pagedjs_margin-content"></div></div>
- <div class="pagedjs_margin pagedjs_margin-top-center"><div class="pagedjs_margin-content"></div></div>
- <div class="pagedjs_margin pagedjs_margin-top-right"><div class="pagedjs_margin-content"></div></div>
- </div>
- <div class="pagedjs_margin-top-right-corner-holder">
- <div class="pagedjs_margin pagedjs_margin-top-right-corner"><div class="pagedjs_margin-content"></div></div>
- </div>
- <div class="pagedjs_margin-right">
- <div class="pagedjs_margin pagedjs_margin-right-top"><div class="pagedjs_margin-content"></div></div>
- <div class="pagedjs_margin pagedjs_margin-right-middle"><div class="pagedjs_margin-content"></div></div>
- <div class="pagedjs_margin pagedjs_margin-right-bottom"><div class="pagedjs_margin-content"></div></div>
- </div>
- <div class="pagedjs_margin-left">
- <div class="pagedjs_margin pagedjs_margin-left-top"><div class="pagedjs_margin-content"></div></div>
- <div class="pagedjs_margin pagedjs_margin-left-middle"><div class="pagedjs_margin-content"></div></div>
- <div class="pagedjs_margin pagedjs_margin-left-bottom"><div class="pagedjs_margin-content"></div></div>
- </div>
- <div class="pagedjs_margin-bottom-left-corner-holder">
- <div class="pagedjs_margin pagedjs_margin-bottom-left-corner"><div class="pagedjs_margin-content"></div></div>
- </div>
- <div class="pagedjs_margin-bottom">
- <div class="pagedjs_margin pagedjs_margin-bottom-left"><div class="pagedjs_margin-content"></div></div>
- <div class="pagedjs_margin pagedjs_margin-bottom-center"><div class="pagedjs_margin-content"></div></div>
- <div class="pagedjs_margin pagedjs_margin-bottom-right"><div class="pagedjs_margin-content"></div></div>
- </div>
- <div class="pagedjs_margin-bottom-right-corner-holder">
- <div class="pagedjs_margin pagedjs_margin-bottom-right-corner"><div class="pagedjs_margin-content"></div></div>
- </div>
- <div class="pagedjs_area">
- <div class="pagedjs_page_content"></div>
- <div class="pagedjs_footnote_area">
- <div class="pagedjs_footnote_content pagedjs_footnote_empty">
- <div class="pagedjs_footnote_inner_content"></div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>`;
- /**
- * Chop up text into flows
- * @class
- */
- class Chunker {
- constructor(content, renderTo, options) {
- // this.preview = preview;
- this.settings = options || {};
- this.hooks = {};
- this.hooks.beforeParsed = new Hook(this);
- this.hooks.filter = new Hook(this);
- this.hooks.afterParsed = new Hook(this);
- this.hooks.beforePageLayout = new Hook(this);
- this.hooks.layout = new Hook(this);
- this.hooks.renderNode = new Hook(this);
- this.hooks.layoutNode = new Hook(this);
- this.hooks.onOverflow = new Hook(this);
- this.hooks.afterOverflowRemoved = new Hook(this);
- this.hooks.onBreakToken = new Hook();
- this.hooks.afterPageLayout = new Hook(this);
- this.hooks.finalizePage = new Hook(this);
- this.hooks.afterRendered = new Hook(this);
- this.pages = [];
- this.total = 0;
- this.q = new Queue(this);
- this.stopped = false;
- this.rendered = false;
- this.content = content;
- this.charsPerBreak = [];
- this.maxChars;
- if (content) {
- this.flow(content, renderTo);
- }
- }
- setup(renderTo) {
- this.pagesArea = document.createElement("div");
- this.pagesArea.classList.add("pagedjs_pages");
- if (renderTo) {
- renderTo.appendChild(this.pagesArea);
- } else {
- document.querySelector("body").appendChild(this.pagesArea);
- }
- this.pageTemplate = document.createElement("template");
- this.pageTemplate.innerHTML = TEMPLATE;
- }
- async flow(content, renderTo) {
- let parsed;
- await this.hooks.beforeParsed.trigger(content, this);
- parsed = new ContentParser(content);
- this.hooks.filter.triggerSync(parsed);
- this.source = parsed;
- this.breakToken = undefined;
- if (this.pagesArea && this.pageTemplate) {
- this.q.clear();
- this.removePages();
- } else {
- this.setup(renderTo);
- }
- this.emit("rendering", parsed);
- await this.hooks.afterParsed.trigger(parsed, this);
- await this.loadFonts();
- let rendered = await this.render(parsed, this.breakToken);
- while (rendered.canceled) {
- this.start();
- rendered = await this.render(parsed, this.breakToken);
- }
- this.rendered = true;
- this.pagesArea.style.setProperty("--pagedjs-page-count", this.total);
- await this.hooks.afterRendered.trigger(this.pages, this);
- this.emit("rendered", this.pages);
- return this;
- }
- // oversetPages() {
- // let overset = [];
- // for (let i = 0; i < this.pages.length; i++) {
- // let page = this.pages[i];
- // if (page.overset) {
- // overset.push(page);
- // // page.overset = false;
- // }
- // }
- // return overset;
- // }
- //
- // async handleOverset(parsed) {
- // let overset = this.oversetPages();
- // if (overset.length) {
- // console.log("overset", overset);
- // let index = this.pages.indexOf(overset[0]) + 1;
- // console.log("INDEX", index);
- //
- // // Remove pages
- // // this.removePages(index);
- //
- // // await this.render(parsed, overset[0].overset);
- //
- // // return this.handleOverset(parsed);
- // }
- // }
- async render(parsed, startAt) {
- let renderer = this.layout(parsed, startAt);
- let done = false;
- let result;
- while (!done) {
- result = await this.q.enqueue(() => { return this.renderAsync(renderer); });
- done = result.done;
- }
- return result;
- }
- start() {
- this.rendered = false;
- this.stopped = false;
- }
- stop() {
- this.stopped = true;
- // this.q.clear();
- }
- renderOnIdle(renderer) {
- return new Promise(resolve => {
- requestIdleCallback(async () => {
- if (this.stopped) {
- return resolve({ done: true, canceled: true });
- }
- let result = await renderer.next();
- if (this.stopped) {
- resolve({ done: true, canceled: true });
- } else {
- resolve(result);
- }
- });
- });
- }
- async renderAsync(renderer) {
- if (this.stopped) {
- return { done: true, canceled: true };
- }
- let result = await renderer.next();
- if (this.stopped) {
- return { done: true, canceled: true };
- } else {
- return result;
- }
- }
- async handleBreaks(node, force) {
- let currentPage = this.total + 1;
- let currentPosition = currentPage % 2 === 0 ? "left" : "right";
- // TODO: Recto and Verso should reverse for rtl languages
- let currentSide = currentPage % 2 === 0 ? "verso" : "recto";
- let previousBreakAfter;
- let breakBefore;
- let page;
- if (currentPage === 1) {
- return;
- }
- if (node &&
- typeof node.dataset !== "undefined" &&
- typeof node.dataset.previousBreakAfter !== "undefined") {
- previousBreakAfter = node.dataset.previousBreakAfter;
- }
- if (node &&
- typeof node.dataset !== "undefined" &&
- typeof node.dataset.breakBefore !== "undefined") {
- breakBefore = node.dataset.breakBefore;
- }
- if (force) {
- page = this.addPage(true);
- } else if( previousBreakAfter &&
- (previousBreakAfter === "left" || previousBreakAfter === "right") &&
- previousBreakAfter !== currentPosition) {
- page = this.addPage(true);
- } else if( previousBreakAfter &&
- (previousBreakAfter === "verso" || previousBreakAfter === "recto") &&
- previousBreakAfter !== currentSide) {
- page = this.addPage(true);
- } else if( breakBefore &&
- (breakBefore === "left" || breakBefore === "right") &&
- breakBefore !== currentPosition) {
- page = this.addPage(true);
- } else if( breakBefore &&
- (breakBefore === "verso" || breakBefore === "recto") &&
- breakBefore !== currentSide) {
- page = this.addPage(true);
- }
- if (page) {
- await this.hooks.beforePageLayout.trigger(page, undefined, undefined, this);
- this.emit("page", page);
- // await this.hooks.layout.trigger(page.element, page, undefined, this);
- await this.hooks.afterPageLayout.trigger(page.element, page, undefined, this);
- await this.hooks.finalizePage.trigger(page.element, page, undefined, this);
- this.emit("renderedPage", page);
- }
- }
- async *layout(content, startAt) {
- let breakToken = startAt || false;
- let tokens = [];
- while (breakToken !== undefined && (true)) {
- if (breakToken && breakToken.node) {
- await this.handleBreaks(breakToken.node);
- } else {
- await this.handleBreaks(content.firstChild);
- }
- let page = this.addPage();
- await this.hooks.beforePageLayout.trigger(page, content, breakToken, this);
- this.emit("page", page);
- // Layout content in the page, starting from the breakToken
- breakToken = await page.layout(content, breakToken, this.maxChars);
- if (breakToken) {
- let newToken = breakToken.toJSON(true);
- if (tokens.lastIndexOf(newToken) > -1) {
- // loop
- let err = new OverflowContentError("Layout repeated", [breakToken.node]);
- console.error("Layout repeated at: ", breakToken.node);
- return err;
- } else {
- tokens.push(newToken);
- }
- }
- await this.hooks.afterPageLayout.trigger(page.element, page, breakToken, this);
- await this.hooks.finalizePage.trigger(page.element, page, undefined, this);
- this.emit("renderedPage", page);
- this.recoredCharLength(page.wrapper.textContent.length);
- yield breakToken;
- // Stop if we get undefined, showing we have reached the end of the content
- }
- }
- recoredCharLength(length) {
- if (length === 0) {
- return;
- }
- this.charsPerBreak.push(length);
- // Keep the length of the last few breaks
- if (this.charsPerBreak.length > 4) {
- this.charsPerBreak.shift();
- }
- this.maxChars = this.charsPerBreak.reduce((a, b) => a + b, 0) / (this.charsPerBreak.length);
- }
- removePages(fromIndex=0) {
- if (fromIndex >= this.pages.length) {
- return;
- }
- // Remove pages
- for (let i = fromIndex; i < this.pages.length; i++) {
- this.pages[i].destroy();
- }
- if (fromIndex > 0) {
- this.pages.splice(fromIndex);
- } else {
- this.pages = [];
- }
- this.total = this.pages.length;
- }
- addPage(blank) {
- let lastPage = this.pages[this.pages.length - 1];
- // Create a new page from the template
- let page = new Page(this.pagesArea, this.pageTemplate, blank, this.hooks, this.settings);
- this.pages.push(page);
- // Create the pages
- page.create(undefined, lastPage && lastPage.element);
- page.index(this.total);
- if (!blank) {
- // Listen for page overflow
- page.onOverflow((overflowToken) => {
- console.warn("overflow on", page.id, overflowToken);
- // Only reflow while rendering
- if (this.rendered) {
- return;
- }
- let index = this.pages.indexOf(page) + 1;
- // Stop the rendering
- this.stop();
- // Set the breakToken to resume at
- this.breakToken = overflowToken;
- // Remove pages
- this.removePages(index);
- if (this.rendered === true) {
- this.rendered = false;
- this.q.enqueue(async () => {
- this.start();
- await this.render(this.source, this.breakToken);
- this.rendered = true;
- });
- }
- });
- page.onUnderflow((overflowToken) => {
- // console.log("underflow on", page.id, overflowToken);
- // page.append(this.source, overflowToken);
- });
- }
- this.total = this.pages.length;
- return page;
- }
- /*
- insertPage(index, blank) {
- let lastPage = this.pages[index];
- // Create a new page from the template
- let page = new Page(this.pagesArea, this.pageTemplate, blank, this.hooks);
- let total = this.pages.splice(index, 0, page);
- // Create the pages
- page.create(undefined, lastPage && lastPage.element);
- page.index(index + 1);
- for (let i = index + 2; i < this.pages.length; i++) {
- this.pages[i].index(i);
- }
- if (!blank) {
- // Listen for page overflow
- page.onOverflow((overflowToken) => {
- if (total < this.pages.length) {
- this.pages[total].layout(this.source, overflowToken);
- } else {
- let newPage = this.addPage();
- newPage.layout(this.source, overflowToken);
- }
- });
- page.onUnderflow(() => {
- // console.log("underflow on", page.id);
- });
- }
- this.total += 1;
- return page;
- }
- */
- async clonePage(originalPage) {
- let lastPage = this.pages[this.pages.length - 1];
- let page = new Page(this.pagesArea, this.pageTemplate, false, this.hooks);
- this.pages.push(page);
- // Create the pages
- page.create(undefined, lastPage && lastPage.element);
- page.index(this.total);
- await this.hooks.beforePageLayout.trigger(page, undefined, undefined, this);
- this.emit("page", page);
- for (const className of originalPage.element.classList) {
- if (className !== "pagedjs_left_page" && className !== "pagedjs_right_page") {
- page.element.classList.add(className);
- }
- }
- await this.hooks.afterPageLayout.trigger(page.element, page, undefined, this);
- await this.hooks.finalizePage.trigger(page.element, page, undefined, this);
- this.emit("renderedPage", page);
- }
- loadFonts() {
- let fontPromises = [];
- (document.fonts || []).forEach((fontFace) => {
- if (fontFace.status !== "loaded") {
- let fontLoaded = fontFace.load().then((r) => {
- return fontFace.family;
- }, (r) => {
- console.warn("Failed to preload font-family:", fontFace.family);
- return fontFace.family;
- });
- fontPromises.push(fontLoaded);
- }
- });
- return Promise.all(fontPromises).catch((err) => {
- console.warn(err);
- });
- }
- destroy() {
- this.pagesArea.remove();
- this.pageTemplate.remove();
- }
- }
- EventEmitter(Chunker.prototype);
- var syntax = {exports: {}};
- var create$4 = {};
- //
- // list
- // ┌──────┐
- // ┌──────────────┼─head │
- // │ │ tail─┼──────────────┐
- // │ └──────┘ │
- // ▼ ▼
- // item item item item
- // ┌──────┐ ┌──────┐ ┌──────┐ ┌──────┐
- // null ◀──┼─prev │◀───┼─prev │◀───┼─prev │◀───┼─prev │
- // │ next─┼───▶│ next─┼───▶│ next─┼───▶│ next─┼──▶ null
- // ├──────┤ ├──────┤ ├──────┤ ├──────┤
- // │ data │ │ data │ │ data │ │ data │
- // └──────┘ └──────┘ └──────┘ └──────┘
- //
- function createItem(data) {
- return {
- prev: null,
- next: null,
- data: data
- };
- }
- function allocateCursor(node, prev, next) {
- var cursor;
- if (cursors !== null) {
- cursor = cursors;
- cursors = cursors.cursor;
- cursor.prev = prev;
- cursor.next = next;
- cursor.cursor = node.cursor;
- } else {
- cursor = {
- prev: prev,
- next: next,
- cursor: node.cursor
- };
- }
- node.cursor = cursor;
- return cursor;
- }
- function releaseCursor(node) {
- var cursor = node.cursor;
- node.cursor = cursor.cursor;
- cursor.prev = null;
- cursor.next = null;
- cursor.cursor = cursors;
- cursors = cursor;
- }
- var cursors = null;
- var List$6 = function() {
- this.cursor = null;
- this.head = null;
- this.tail = null;
- };
- List$6.createItem = createItem;
- List$6.prototype.createItem = createItem;
- List$6.prototype.updateCursors = function(prevOld, prevNew, nextOld, nextNew) {
- var cursor = this.cursor;
- while (cursor !== null) {
- if (cursor.prev === prevOld) {
- cursor.prev = prevNew;
- }
- if (cursor.next === nextOld) {
- cursor.next = nextNew;
- }
- cursor = cursor.cursor;
- }
- };
- List$6.prototype.getSize = function() {
- var size = 0;
- var cursor = this.head;
- while (cursor) {
- size++;
- cursor = cursor.next;
- }
- return size;
- };
- List$6.prototype.fromArray = function(array) {
- var cursor = null;
- this.head = null;
- for (var i = 0; i < array.length; i++) {
- var item = createItem(array[i]);
- if (cursor !== null) {
- cursor.next = item;
- } else {
- this.head = item;
- }
- item.prev = cursor;
- cursor = item;
- }
- this.tail = cursor;
- return this;
- };
- List$6.prototype.toArray = function() {
- var cursor = this.head;
- var result = [];
- while (cursor) {
- result.push(cursor.data);
- cursor = cursor.next;
- }
- return result;
- };
- List$6.prototype.toJSON = List$6.prototype.toArray;
- List$6.prototype.isEmpty = function() {
- return this.head === null;
- };
- List$6.prototype.first = function() {
- return this.head && this.head.data;
- };
- List$6.prototype.last = function() {
- return this.tail && this.tail.data;
- };
- List$6.prototype.each = function(fn, context) {
- var item;
- if (context === undefined) {
- context = this;
- }
- // push cursor
- var cursor = allocateCursor(this, null, this.head);
- while (cursor.next !== null) {
- item = cursor.next;
- cursor.next = item.next;
- fn.call(context, item.data, item, this);
- }
- // pop cursor
- releaseCursor(this);
- };
- List$6.prototype.forEach = List$6.prototype.each;
- List$6.prototype.eachRight = function(fn, context) {
- var item;
- if (context === undefined) {
- context = this;
- }
- // push cursor
- var cursor = allocateCursor(this, this.tail, null);
- while (cursor.prev !== null) {
- item = cursor.prev;
- cursor.prev = item.prev;
- fn.call(context, item.data, item, this);
- }
- // pop cursor
- releaseCursor(this);
- };
- List$6.prototype.forEachRight = List$6.prototype.eachRight;
- List$6.prototype.reduce = function(fn, initialValue, context) {
- var item;
- if (context === undefined) {
- context = this;
- }
- // push cursor
- var cursor = allocateCursor(this, null, this.head);
- var acc = initialValue;
- while (cursor.next !== null) {
- item = cursor.next;
- cursor.next = item.next;
- acc = fn.call(context, acc, item.data, item, this);
- }
- // pop cursor
- releaseCursor(this);
- return acc;
- };
- List$6.prototype.reduceRight = function(fn, initialValue, context) {
- var item;
- if (context === undefined) {
- context = this;
- }
- // push cursor
- var cursor = allocateCursor(this, this.tail, null);
- var acc = initialValue;
- while (cursor.prev !== null) {
- item = cursor.prev;
- cursor.prev = item.prev;
- acc = fn.call(context, acc, item.data, item, this);
- }
- // pop cursor
- releaseCursor(this);
- return acc;
- };
- List$6.prototype.nextUntil = function(start, fn, context) {
- if (start === null) {
- return;
- }
- var item;
- if (context === undefined) {
- context = this;
- }
- // push cursor
- var cursor = allocateCursor(this, null, start);
- while (cursor.next !== null) {
- item = cursor.next;
- cursor.next = item.next;
- if (fn.call(context, item.data, item, this)) {
- break;
- }
- }
- // pop cursor
- releaseCursor(this);
- };
- List$6.prototype.prevUntil = function(start, fn, context) {
- if (start === null) {
- return;
- }
- var item;
- if (context === undefined) {
- context = this;
- }
- // push cursor
- var cursor = allocateCursor(this, start, null);
- while (cursor.prev !== null) {
- item = cursor.prev;
- cursor.prev = item.prev;
- if (fn.call(context, item.data, item, this)) {
- break;
- }
- }
- // pop cursor
- releaseCursor(this);
- };
- List$6.prototype.some = function(fn, context) {
- var cursor = this.head;
- if (context === undefined) {
- context = this;
- }
- while (cursor !== null) {
- if (fn.call(context, cursor.data, cursor, this)) {
- return true;
- }
- cursor = cursor.next;
- }
- return false;
- };
- List$6.prototype.map = function(fn, context) {
- var result = new List$6();
- var cursor = this.head;
- if (context === undefined) {
- context = this;
- }
- while (cursor !== null) {
- result.appendData(fn.call(context, cursor.data, cursor, this));
- cursor = cursor.next;
- }
- return result;
- };
- List$6.prototype.filter = function(fn, context) {
- var result = new List$6();
- var cursor = this.head;
- if (context === undefined) {
- context = this;
- }
- while (cursor !== null) {
- if (fn.call(context, cursor.data, cursor, this)) {
- result.appendData(cursor.data);
- }
- cursor = cursor.next;
- }
- return result;
- };
- List$6.prototype.clear = function() {
- this.head = null;
- this.tail = null;
- };
- List$6.prototype.copy = function() {
- var result = new List$6();
- var cursor = this.head;
- while (cursor !== null) {
- result.insert(createItem(cursor.data));
- cursor = cursor.next;
- }
- return result;
- };
- List$6.prototype.prepend = function(item) {
- // head
- // ^
- // item
- this.updateCursors(null, item, this.head, item);
- // insert to the beginning of the list
- if (this.head !== null) {
- // new item <- first item
- this.head.prev = item;
- // new item -> first item
- item.next = this.head;
- } else {
- // if list has no head, then it also has no tail
- // in this case tail points to the new item
- this.tail = item;
- }
- // head always points to new item
- this.head = item;
- return this;
- };
- List$6.prototype.prependData = function(data) {
- return this.prepend(createItem(data));
- };
- List$6.prototype.append = function(item) {
- return this.insert(item);
- };
- List$6.prototype.appendData = function(data) {
- return this.insert(createItem(data));
- };
- List$6.prototype.insert = function(item, before) {
- if (before !== undefined && before !== null) {
- // prev before
- // ^
- // item
- this.updateCursors(before.prev, item, before, item);
- if (before.prev === null) {
- // insert to the beginning of list
- if (this.head !== before) {
- throw new Error('before doesn\'t belong to list');
- }
- // since head points to before therefore list doesn't empty
- // no need to check tail
- this.head = item;
- before.prev = item;
- item.next = before;
- this.updateCursors(null, item);
- } else {
- // insert between two items
- before.prev.next = item;
- item.prev = before.prev;
- before.prev = item;
- item.next = before;
- }
- } else {
- // tail
- // ^
- // item
- this.updateCursors(this.tail, item, null, item);
- // insert to the ending of the list
- if (this.tail !== null) {
- // last item -> new item
- this.tail.next = item;
- // last item <- new item
- item.prev = this.tail;
- } else {
- // if list has no tail, then it also has no head
- // in this case head points to new item
- this.head = item;
- }
- // tail always points to new item
- this.tail = item;
- }
- return this;
- };
- List$6.prototype.insertData = function(data, before) {
- return this.insert(createItem(data), before);
- };
- List$6.prototype.remove = function(item) {
- // item
- // ^
- // prev next
- this.updateCursors(item, item.prev, item, item.next);
- if (item.prev !== null) {
- item.prev.next = item.next;
- } else {
- if (this.head !== item) {
- throw new Error('item doesn\'t belong to list');
- }
- this.head = item.next;
- }
- if (item.next !== null) {
- item.next.prev = item.prev;
- } else {
- if (this.tail !== item) {
- throw new Error('item doesn\'t belong to list');
- }
- this.tail = item.prev;
- }
- item.prev = null;
- item.next = null;
- return item;
- };
- List$6.prototype.push = function(data) {
- this.insert(createItem(data));
- };
- List$6.prototype.pop = function() {
- if (this.tail !== null) {
- return this.remove(this.tail);
- }
- };
- List$6.prototype.unshift = function(data) {
- this.prepend(createItem(data));
- };
- List$6.prototype.shift = function() {
- if (this.head !== null) {
- return this.remove(this.head);
- }
- };
- List$6.prototype.prependList = function(list) {
- return this.insertList(list, this.head);
- };
- List$6.prototype.appendList = function(list) {
- return this.insertList(list);
- };
- List$6.prototype.insertList = function(list, before) {
- // ignore empty lists
- if (list.head === null) {
- return this;
- }
- if (before !== undefined && before !== null) {
- this.updateCursors(before.prev, list.tail, before, list.head);
- // insert in the middle of dist list
- if (before.prev !== null) {
- // before.prev <-> list.head
- before.prev.next = list.head;
- list.head.prev = before.prev;
- } else {
- this.head = list.head;
- }
- before.prev = list.tail;
- list.tail.next = before;
- } else {
- this.updateCursors(this.tail, list.tail, null, list.head);
- // insert to end of the list
- if (this.tail !== null) {
- // if destination list has a tail, then it also has a head,
- // but head doesn't change
- // dest tail -> source head
- this.tail.next = list.head;
- // dest tail <- source head
- list.head.prev = this.tail;
- } else {
- // if list has no a tail, then it also has no a head
- // in this case points head to new item
- this.head = list.head;
- }
- // tail always start point to new item
- this.tail = list.tail;
- }
- list.head = null;
- list.tail = null;
- return this;
- };
- List$6.prototype.replace = function(oldItem, newItemOrList) {
- if ('head' in newItemOrList) {
- this.insertList(newItemOrList, oldItem);
- } else {
- this.insert(newItemOrList, oldItem);
- }
- this.remove(oldItem);
- };
- var List_1 = List$6;
- var createCustomError$3 = function createCustomError(name, message) {
- // use Object.create(), because some VMs prevent setting line/column otherwise
- // (iOS Safari 10 even throws an exception)
- var error = Object.create(SyntaxError.prototype);
- var errorStack = new Error();
- error.name = name;
- error.message = message;
- Object.defineProperty(error, 'stack', {
- get: function() {
- return (errorStack.stack || '').replace(/^(.+\n){1,3}/, name + ': ' + message + '\n');
- }
- });
- return error;
- };
- var createCustomError$2 = createCustomError$3;
- var MAX_LINE_LENGTH = 100;
- var OFFSET_CORRECTION = 60;
- var TAB_REPLACEMENT = ' ';
- function sourceFragment(error, extraLines) {
- function processLines(start, end) {
- return lines.slice(start, end).map(function(line, idx) {
- var num = String(start + idx + 1);
- while (num.length < maxNumLength) {
- num = ' ' + num;
- }
- return num + ' |' + line;
- }).join('\n');
- }
- var lines = error.source.split(/\r\n?|\n|\f/);
- var line = error.line;
- var column = error.column;
- var startLine = Math.max(1, line - extraLines) - 1;
- var endLine = Math.min(line + extraLines, lines.length + 1);
- var maxNumLength = Math.max(4, String(endLine).length) + 1;
- var cutLeft = 0;
- // column correction according to replaced tab before column
- column += (TAB_REPLACEMENT.length - 1) * (lines[line - 1].substr(0, column - 1).match(/\t/g) || []).length;
- if (column > MAX_LINE_LENGTH) {
- cutLeft = column - OFFSET_CORRECTION + 3;
- column = OFFSET_CORRECTION - 2;
- }
- for (var i = startLine; i <= endLine; i++) {
- if (i >= 0 && i < lines.length) {
- lines[i] = lines[i].replace(/\t/g, TAB_REPLACEMENT);
- lines[i] =
- (cutLeft > 0 && lines[i].length > cutLeft ? '\u2026' : '') +
- lines[i].substr(cutLeft, MAX_LINE_LENGTH - 2) +
- (lines[i].length > cutLeft + MAX_LINE_LENGTH - 1 ? '\u2026' : '');
- }
- }
- return [
- processLines(startLine, line),
- new Array(column + maxNumLength + 2).join('-') + '^',
- processLines(line, endLine)
- ].filter(Boolean).join('\n');
- }
- var SyntaxError$4 = function(message, source, offset, line, column) {
- var error = createCustomError$2('SyntaxError', message);
- error.source = source;
- error.offset = offset;
- error.line = line;
- error.column = column;
- error.sourceFragment = function(extraLines) {
- return sourceFragment(error, isNaN(extraLines) ? 0 : extraLines);
- };
- Object.defineProperty(error, 'formattedMessage', {
- get: function() {
- return (
- 'Parse error: ' + error.message + '\n' +
- sourceFragment(error, 2)
- );
- }
- });
- // for backward capability
- error.parseError = {
- offset: offset,
- line: line,
- column: column
- };
- return error;
- };
- var _SyntaxError$1 = SyntaxError$4;
- // CSS Syntax Module Level 3
- // https://www.w3.org/TR/css-syntax-3/
- var TYPE$H = {
- EOF: 0, // <EOF-token>
- Ident: 1, // <ident-token>
- Function: 2, // <function-token>
- AtKeyword: 3, // <at-keyword-token>
- Hash: 4, // <hash-token>
- String: 5, // <string-token>
- BadString: 6, // <bad-string-token>
- Url: 7, // <url-token>
- BadUrl: 8, // <bad-url-token>
- Delim: 9, // <delim-token>
- Number: 10, // <number-token>
- Percentage: 11, // <percentage-token>
- Dimension: 12, // <dimension-token>
- WhiteSpace: 13, // <whitespace-token>
- CDO: 14, // <CDO-token>
- CDC: 15, // <CDC-token>
- Colon: 16, // <colon-token> :
- Semicolon: 17, // <semicolon-token> ;
- Comma: 18, // <comma-token> ,
- LeftSquareBracket: 19, // <[-token>
- RightSquareBracket: 20, // <]-token>
- LeftParenthesis: 21, // <(-token>
- RightParenthesis: 22, // <)-token>
- LeftCurlyBracket: 23, // <{-token>
- RightCurlyBracket: 24, // <}-token>
- Comment: 25
- };
- var NAME$3 = Object.keys(TYPE$H).reduce(function(result, key) {
- result[TYPE$H[key]] = key;
- return result;
- }, {});
- var _const = {
- TYPE: TYPE$H,
- NAME: NAME$3
- };
- var EOF$1 = 0;
- // https://drafts.csswg.org/css-syntax-3/
- // § 4.2. Definitions
- // digit
- // A code point between U+0030 DIGIT ZERO (0) and U+0039 DIGIT NINE (9).
- function isDigit$5(code) {
- return code >= 0x0030 && code <= 0x0039;
- }
- // hex digit
- // A digit, or a code point between U+0041 LATIN CAPITAL LETTER A (A) and U+0046 LATIN CAPITAL LETTER F (F),
- // or a code point between U+0061 LATIN SMALL LETTER A (a) and U+0066 LATIN SMALL LETTER F (f).
- function isHexDigit$4(code) {
- return (
- isDigit$5(code) || // 0 .. 9
- (code >= 0x0041 && code <= 0x0046) || // A .. F
- (code >= 0x0061 && code <= 0x0066) // a .. f
- );
- }
- // uppercase letter
- // A code point between U+0041 LATIN CAPITAL LETTER A (A) and U+005A LATIN CAPITAL LETTER Z (Z).
- function isUppercaseLetter$1(code) {
- return code >= 0x0041 && code <= 0x005A;
- }
- // lowercase letter
- // A code point between U+0061 LATIN SMALL LETTER A (a) and U+007A LATIN SMALL LETTER Z (z).
- function isLowercaseLetter(code) {
- return code >= 0x0061 && code <= 0x007A;
- }
- // letter
- // An uppercase letter or a lowercase letter.
- function isLetter(code) {
- return isUppercaseLetter$1(code) || isLowercaseLetter(code);
- }
- // non-ASCII code point
- // A code point with a value equal to or greater than U+0080 <control>.
- function isNonAscii(code) {
- return code >= 0x0080;
- }
- // name-start code point
- // A letter, a non-ASCII code point, or U+005F LOW LINE (_).
- function isNameStart(code) {
- return isLetter(code) || isNonAscii(code) || code === 0x005F;
- }
- // name code point
- // A name-start code point, a digit, or U+002D HYPHEN-MINUS (-).
- function isName$2(code) {
- return isNameStart(code) || isDigit$5(code) || code === 0x002D;
- }
- // non-printable code point
- // A code point between U+0000 NULL and U+0008 BACKSPACE, or U+000B LINE TABULATION,
- // or a code point between U+000E SHIFT OUT and U+001F INFORMATION SEPARATOR ONE, or U+007F DELETE.
- function isNonPrintable(code) {
- return (
- (code >= 0x0000 && code <= 0x0008) ||
- (code === 0x000B) ||
- (code >= 0x000E && code <= 0x001F) ||
- (code === 0x007F)
- );
- }
- // newline
- // U+000A LINE FEED. Note that U+000D CARRIAGE RETURN and U+000C FORM FEED are not included in this definition,
- // as they are converted to U+000A LINE FEED during preprocessing.
- // TODO: we doesn't do a preprocessing, so check a code point for U+000D CARRIAGE RETURN and U+000C FORM FEED
- function isNewline$1(code) {
- return code === 0x000A || code === 0x000D || code === 0x000C;
- }
- // whitespace
- // A newline, U+0009 CHARACTER TABULATION, or U+0020 SPACE.
- function isWhiteSpace$2(code) {
- return isNewline$1(code) || code === 0x0020 || code === 0x0009;
- }
- // § 4.3.8. Check if two code points are a valid escape
- function isValidEscape$2(first, second) {
- // If the first code point is not U+005C REVERSE SOLIDUS (\), return false.
- if (first !== 0x005C) {
- return false;
- }
- // Otherwise, if the second code point is a newline or EOF, return false.
- if (isNewline$1(second) || second === EOF$1) {
- return false;
- }
- // Otherwise, return true.
- return true;
- }
- // § 4.3.9. Check if three code points would start an identifier
- function isIdentifierStart$2(first, second, third) {
- // Look at the first code point:
- // U+002D HYPHEN-MINUS
- if (first === 0x002D) {
- // If the second code point is a name-start code point or a U+002D HYPHEN-MINUS,
- // or the second and third code points are a valid escape, return true. Otherwise, return false.
- return (
- isNameStart(second) ||
- second === 0x002D ||
- isValidEscape$2(second, third)
- );
- }
- // name-start code point
- if (isNameStart(first)) {
- // Return true.
- return true;
- }
- // U+005C REVERSE SOLIDUS (\)
- if (first === 0x005C) {
- // If the first and second code points are a valid escape, return true. Otherwise, return false.
- return isValidEscape$2(first, second);
- }
- // anything else
- // Return false.
- return false;
- }
- // § 4.3.10. Check if three code points would start a number
- function isNumberStart$1(first, second, third) {
- // Look at the first code point:
- // U+002B PLUS SIGN (+)
- // U+002D HYPHEN-MINUS (-)
- if (first === 0x002B || first === 0x002D) {
- // If the second code point is a digit, return true.
- if (isDigit$5(second)) {
- return 2;
- }
- // Otherwise, if the second code point is a U+002E FULL STOP (.)
- // and the third code point is a digit, return true.
- // Otherwise, return false.
- return second === 0x002E && isDigit$5(third) ? 3 : 0;
- }
- // U+002E FULL STOP (.)
- if (first === 0x002E) {
- // If the second code point is a digit, return true. Otherwise, return false.
- return isDigit$5(second) ? 2 : 0;
- }
- // digit
- if (isDigit$5(first)) {
- // Return true.
- return 1;
- }
- // anything else
- // Return false.
- return 0;
- }
- //
- // Misc
- //
- // detect BOM (https://en.wikipedia.org/wiki/Byte_order_mark)
- function isBOM$2(code) {
- // UTF-16BE
- if (code === 0xFEFF) {
- return 1;
- }
- // UTF-16LE
- if (code === 0xFFFE) {
- return 1;
- }
- return 0;
- }
- // Fast code category
- //
- // https://drafts.csswg.org/css-syntax/#tokenizer-definitions
- // > non-ASCII code point
- // > A code point with a value equal to or greater than U+0080 <control>
- // > name-start code point
- // > A letter, a non-ASCII code point, or U+005F LOW LINE (_).
- // > name code point
- // > A name-start code point, a digit, or U+002D HYPHEN-MINUS (-)
- // That means only ASCII code points has a special meaning and we define a maps for 0..127 codes only
- var CATEGORY = new Array(0x80);
- charCodeCategory$1.Eof = 0x80;
- charCodeCategory$1.WhiteSpace = 0x82;
- charCodeCategory$1.Digit = 0x83;
- charCodeCategory$1.NameStart = 0x84;
- charCodeCategory$1.NonPrintable = 0x85;
- for (var i = 0; i < CATEGORY.length; i++) {
- switch (true) {
- case isWhiteSpace$2(i):
- CATEGORY[i] = charCodeCategory$1.WhiteSpace;
- break;
- case isDigit$5(i):
- CATEGORY[i] = charCodeCategory$1.Digit;
- break;
- case isNameStart(i):
- CATEGORY[i] = charCodeCategory$1.NameStart;
- break;
- case isNonPrintable(i):
- CATEGORY[i] = charCodeCategory$1.NonPrintable;
- break;
- default:
- CATEGORY[i] = i || charCodeCategory$1.Eof;
- }
- }
- function charCodeCategory$1(code) {
- return code < 0x80 ? CATEGORY[code] : charCodeCategory$1.NameStart;
- }
- var charCodeDefinitions$1 = {
- isDigit: isDigit$5,
- isHexDigit: isHexDigit$4,
- isUppercaseLetter: isUppercaseLetter$1,
- isLowercaseLetter: isLowercaseLetter,
- isLetter: isLetter,
- isNonAscii: isNonAscii,
- isNameStart: isNameStart,
- isName: isName$2,
- isNonPrintable: isNonPrintable,
- isNewline: isNewline$1,
- isWhiteSpace: isWhiteSpace$2,
- isValidEscape: isValidEscape$2,
- isIdentifierStart: isIdentifierStart$2,
- isNumberStart: isNumberStart$1,
- isBOM: isBOM$2,
- charCodeCategory: charCodeCategory$1
- };
- var charCodeDef = charCodeDefinitions$1;
- var isDigit$4 = charCodeDef.isDigit;
- var isHexDigit$3 = charCodeDef.isHexDigit;
- var isUppercaseLetter = charCodeDef.isUppercaseLetter;
- var isName$1 = charCodeDef.isName;
- var isWhiteSpace$1 = charCodeDef.isWhiteSpace;
- var isValidEscape$1 = charCodeDef.isValidEscape;
- function getCharCode(source, offset) {
- return offset < source.length ? source.charCodeAt(offset) : 0;
- }
- function getNewlineLength$1(source, offset, code) {
- if (code === 13 /* \r */ && getCharCode(source, offset + 1) === 10 /* \n */) {
- return 2;
- }
- return 1;
- }
- function cmpChar$5(testStr, offset, referenceCode) {
- var code = testStr.charCodeAt(offset);
- // code.toLowerCase() for A..Z
- if (isUppercaseLetter(code)) {
- code = code | 32;
- }
- return code === referenceCode;
- }
- function cmpStr$6(testStr, start, end, referenceStr) {
- if (end - start !== referenceStr.length) {
- return false;
- }
- if (start < 0 || end > testStr.length) {
- return false;
- }
- for (var i = start; i < end; i++) {
- var testCode = testStr.charCodeAt(i);
- var referenceCode = referenceStr.charCodeAt(i - start);
- // testCode.toLowerCase() for A..Z
- if (isUppercaseLetter(testCode)) {
- testCode = testCode | 32;
- }
- if (testCode !== referenceCode) {
- return false;
- }
- }
- return true;
- }
- function findWhiteSpaceStart$1(source, offset) {
- for (; offset >= 0; offset--) {
- if (!isWhiteSpace$1(source.charCodeAt(offset))) {
- break;
- }
- }
- return offset + 1;
- }
- function findWhiteSpaceEnd$1(source, offset) {
- for (; offset < source.length; offset++) {
- if (!isWhiteSpace$1(source.charCodeAt(offset))) {
- break;
- }
- }
- return offset;
- }
- function findDecimalNumberEnd(source, offset) {
- for (; offset < source.length; offset++) {
- if (!isDigit$4(source.charCodeAt(offset))) {
- break;
- }
- }
- return offset;
- }
- // § 4.3.7. Consume an escaped code point
- function consumeEscaped$1(source, offset) {
- // It assumes that the U+005C REVERSE SOLIDUS (\) has already been consumed and
- // that the next input code point has already been verified to be part of a valid escape.
- offset += 2;
- // hex digit
- if (isHexDigit$3(getCharCode(source, offset - 1))) {
- // Consume as many hex digits as possible, but no more than 5.
- // Note that this means 1-6 hex digits have been consumed in total.
- for (var maxOffset = Math.min(source.length, offset + 5); offset < maxOffset; offset++) {
- if (!isHexDigit$3(getCharCode(source, offset))) {
- break;
- }
- }
- // If the next input code point is whitespace, consume it as well.
- var code = getCharCode(source, offset);
- if (isWhiteSpace$1(code)) {
- offset += getNewlineLength$1(source, offset, code);
- }
- }
- return offset;
- }
- // §4.3.11. Consume a name
- // Note: This algorithm does not do the verification of the first few code points that are necessary
- // to ensure the returned code points would constitute an <ident-token>. If that is the intended use,
- // ensure that the stream starts with an identifier before calling this algorithm.
- function consumeName$1(source, offset) {
- // Let result initially be an empty string.
- // Repeatedly consume the next input code point from the stream:
- for (; offset < source.length; offset++) {
- var code = source.charCodeAt(offset);
- // name code point
- if (isName$1(code)) {
- // Append the code point to result.
- continue;
- }
- // the stream starts with a valid escape
- if (isValidEscape$1(code, getCharCode(source, offset + 1))) {
- // Consume an escaped code point. Append the returned code point to result.
- offset = consumeEscaped$1(source, offset) - 1;
- continue;
- }
- // anything else
- // Reconsume the current input code point. Return result.
- break;
- }
- return offset;
- }
- // §4.3.12. Consume a number
- function consumeNumber$5(source, offset) {
- var code = source.charCodeAt(offset);
- // 2. If the next input code point is U+002B PLUS SIGN (+) or U+002D HYPHEN-MINUS (-),
- // consume it and append it to repr.
- if (code === 0x002B || code === 0x002D) {
- code = source.charCodeAt(offset += 1);
- }
- // 3. While the next input code point is a digit, consume it and append it to repr.
- if (isDigit$4(code)) {
- offset = findDecimalNumberEnd(source, offset + 1);
- code = source.charCodeAt(offset);
- }
- // 4. If the next 2 input code points are U+002E FULL STOP (.) followed by a digit, then:
- if (code === 0x002E && isDigit$4(source.charCodeAt(offset + 1))) {
- // 4.1 Consume them.
- // 4.2 Append them to repr.
- code = source.charCodeAt(offset += 2);
- // 4.3 Set type to "number".
- // TODO
- // 4.4 While the next input code point is a digit, consume it and append it to repr.
- offset = findDecimalNumberEnd(source, offset);
- }
- // 5. If the next 2 or 3 input code points are U+0045 LATIN CAPITAL LETTER E (E)
- // or U+0065 LATIN SMALL LETTER E (e), ... , followed by a digit, then:
- if (cmpChar$5(source, offset, 101 /* e */)) {
- var sign = 0;
- code = source.charCodeAt(offset + 1);
- // ... optionally followed by U+002D HYPHEN-MINUS (-) or U+002B PLUS SIGN (+) ...
- if (code === 0x002D || code === 0x002B) {
- sign = 1;
- code = source.charCodeAt(offset + 2);
- }
- // ... followed by a digit
- if (isDigit$4(code)) {
- // 5.1 Consume them.
- // 5.2 Append them to repr.
- // 5.3 Set type to "number".
- // TODO
- // 5.4 While the next input code point is a digit, consume it and append it to repr.
- offset = findDecimalNumberEnd(source, offset + 1 + sign + 1);
- }
- }
- return offset;
- }
- // § 4.3.14. Consume the remnants of a bad url
- // ... its sole use is to consume enough of the input stream to reach a recovery point
- // where normal tokenizing can resume.
- function consumeBadUrlRemnants$1(source, offset) {
- // Repeatedly consume the next input code point from the stream:
- for (; offset < source.length; offset++) {
- var code = source.charCodeAt(offset);
- // U+0029 RIGHT PARENTHESIS ())
- // EOF
- if (code === 0x0029) {
- // Return.
- offset++;
- break;
- }
- if (isValidEscape$1(code, getCharCode(source, offset + 1))) {
- // Consume an escaped code point.
- // Note: This allows an escaped right parenthesis ("\)") to be encountered
- // without ending the <bad-url-token>. This is otherwise identical to
- // the "anything else" clause.
- offset = consumeEscaped$1(source, offset);
- }
- }
- return offset;
- }
- var utils$2 = {
- consumeEscaped: consumeEscaped$1,
- consumeName: consumeName$1,
- consumeNumber: consumeNumber$5,
- consumeBadUrlRemnants: consumeBadUrlRemnants$1,
- cmpChar: cmpChar$5,
- cmpStr: cmpStr$6,
- getNewlineLength: getNewlineLength$1,
- findWhiteSpaceStart: findWhiteSpaceStart$1,
- findWhiteSpaceEnd: findWhiteSpaceEnd$1
- };
- var constants$2 = _const;
- var TYPE$G = constants$2.TYPE;
- var NAME$2 = constants$2.NAME;
- var utils$1 = utils$2;
- var cmpStr$5 = utils$1.cmpStr;
- var EOF = TYPE$G.EOF;
- var WHITESPACE$c = TYPE$G.WhiteSpace;
- var COMMENT$a = TYPE$G.Comment;
- var OFFSET_MASK$1 = 0x00FFFFFF;
- var TYPE_SHIFT$1 = 24;
- var TokenStream$4 = function() {
- this.offsetAndType = null;
- this.balance = null;
- this.reset();
- };
- TokenStream$4.prototype = {
- reset: function() {
- this.eof = false;
- this.tokenIndex = -1;
- this.tokenType = 0;
- this.tokenStart = this.firstCharOffset;
- this.tokenEnd = this.firstCharOffset;
- },
- lookupType: function(offset) {
- offset += this.tokenIndex;
- if (offset < this.tokenCount) {
- return this.offsetAndType[offset] >> TYPE_SHIFT$1;
- }
- return EOF;
- },
- lookupOffset: function(offset) {
- offset += this.tokenIndex;
- if (offset < this.tokenCount) {
- return this.offsetAndType[offset - 1] & OFFSET_MASK$1;
- }
- return this.source.length;
- },
- lookupValue: function(offset, referenceStr) {
- offset += this.tokenIndex;
- if (offset < this.tokenCount) {
- return cmpStr$5(
- this.source,
- this.offsetAndType[offset - 1] & OFFSET_MASK$1,
- this.offsetAndType[offset] & OFFSET_MASK$1,
- referenceStr
- );
- }
- return false;
- },
- getTokenStart: function(tokenIndex) {
- if (tokenIndex === this.tokenIndex) {
- return this.tokenStart;
- }
- if (tokenIndex > 0) {
- return tokenIndex < this.tokenCount
- ? this.offsetAndType[tokenIndex - 1] & OFFSET_MASK$1
- : this.offsetAndType[this.tokenCount] & OFFSET_MASK$1;
- }
- return this.firstCharOffset;
- },
- // TODO: -> skipUntilBalanced
- getRawLength: function(startToken, mode) {
- var cursor = startToken;
- var balanceEnd;
- var offset = this.offsetAndType[Math.max(cursor - 1, 0)] & OFFSET_MASK$1;
- var type;
- loop:
- for (; cursor < this.tokenCount; cursor++) {
- balanceEnd = this.balance[cursor];
- // stop scanning on balance edge that points to offset before start token
- if (balanceEnd < startToken) {
- break loop;
- }
- type = this.offsetAndType[cursor] >> TYPE_SHIFT$1;
- // check token is stop type
- switch (mode(type, this.source, offset)) {
- case 1:
- break loop;
- case 2:
- cursor++;
- break loop;
- default:
- // fast forward to the end of balanced block
- if (this.balance[balanceEnd] === cursor) {
- cursor = balanceEnd;
- }
- offset = this.offsetAndType[cursor] & OFFSET_MASK$1;
- }
- }
- return cursor - this.tokenIndex;
- },
- isBalanceEdge: function(pos) {
- return this.balance[this.tokenIndex] < pos;
- },
- isDelim: function(code, offset) {
- if (offset) {
- return (
- this.lookupType(offset) === TYPE$G.Delim &&
- this.source.charCodeAt(this.lookupOffset(offset)) === code
- );
- }
- return (
- this.tokenType === TYPE$G.Delim &&
- this.source.charCodeAt(this.tokenStart) === code
- );
- },
- getTokenValue: function() {
- return this.source.substring(this.tokenStart, this.tokenEnd);
- },
- getTokenLength: function() {
- return this.tokenEnd - this.tokenStart;
- },
- substrToCursor: function(start) {
- return this.source.substring(start, this.tokenStart);
- },
- skipWS: function() {
- for (var i = this.tokenIndex, skipTokenCount = 0; i < this.tokenCount; i++, skipTokenCount++) {
- if ((this.offsetAndType[i] >> TYPE_SHIFT$1) !== WHITESPACE$c) {
- break;
- }
- }
- if (skipTokenCount > 0) {
- this.skip(skipTokenCount);
- }
- },
- skipSC: function() {
- while (this.tokenType === WHITESPACE$c || this.tokenType === COMMENT$a) {
- this.next();
- }
- },
- skip: function(tokenCount) {
- var next = this.tokenIndex + tokenCount;
- if (next < this.tokenCount) {
- this.tokenIndex = next;
- this.tokenStart = this.offsetAndType[next - 1] & OFFSET_MASK$1;
- next = this.offsetAndType[next];
- this.tokenType = next >> TYPE_SHIFT$1;
- this.tokenEnd = next & OFFSET_MASK$1;
- } else {
- this.tokenIndex = this.tokenCount;
- this.next();
- }
- },
- next: function() {
- var next = this.tokenIndex + 1;
- if (next < this.tokenCount) {
- this.tokenIndex = next;
- this.tokenStart = this.tokenEnd;
- next = this.offsetAndType[next];
- this.tokenType = next >> TYPE_SHIFT$1;
- this.tokenEnd = next & OFFSET_MASK$1;
- } else {
- this.tokenIndex = this.tokenCount;
- this.eof = true;
- this.tokenType = EOF;
- this.tokenStart = this.tokenEnd = this.source.length;
- }
- },
- forEachToken(fn) {
- for (var i = 0, offset = this.firstCharOffset; i < this.tokenCount; i++) {
- var start = offset;
- var item = this.offsetAndType[i];
- var end = item & OFFSET_MASK$1;
- var type = item >> TYPE_SHIFT$1;
- offset = end;
- fn(type, start, end, i);
- }
- },
- dump() {
- var tokens = new Array(this.tokenCount);
- this.forEachToken((type, start, end, index) => {
- tokens[index] = {
- idx: index,
- type: NAME$2[type],
- chunk: this.source.substring(start, end),
- balance: this.balance[index]
- };
- });
- return tokens;
- }
- };
- var TokenStream_1 = TokenStream$4;
- function noop$3(value) {
- return value;
- }
- function generateMultiplier(multiplier) {
- if (multiplier.min === 0 && multiplier.max === 0) {
- return '*';
- }
- if (multiplier.min === 0 && multiplier.max === 1) {
- return '?';
- }
- if (multiplier.min === 1 && multiplier.max === 0) {
- return multiplier.comma ? '#' : '+';
- }
- if (multiplier.min === 1 && multiplier.max === 1) {
- return '';
- }
- return (
- (multiplier.comma ? '#' : '') +
- (multiplier.min === multiplier.max
- ? '{' + multiplier.min + '}'
- : '{' + multiplier.min + ',' + (multiplier.max !== 0 ? multiplier.max : '') + '}'
- )
- );
- }
- function generateTypeOpts(node) {
- switch (node.type) {
- case 'Range':
- return (
- ' [' +
- (node.min === null ? '-∞' : node.min) +
- ',' +
- (node.max === null ? '∞' : node.max) +
- ']'
- );
- default:
- throw new Error('Unknown node type `' + node.type + '`');
- }
- }
- function generateSequence(node, decorate, forceBraces, compact) {
- var combinator = node.combinator === ' ' || compact ? node.combinator : ' ' + node.combinator + ' ';
- var result = node.terms.map(function(term) {
- return generate$2(term, decorate, forceBraces, compact);
- }).join(combinator);
- if (node.explicit || forceBraces) {
- result = (compact || result[0] === ',' ? '[' : '[ ') + result + (compact ? ']' : ' ]');
- }
- return result;
- }
- function generate$2(node, decorate, forceBraces, compact) {
- var result;
- switch (node.type) {
- case 'Group':
- result =
- generateSequence(node, decorate, forceBraces, compact) +
- (node.disallowEmpty ? '!' : '');
- break;
- case 'Multiplier':
- // return since node is a composition
- return (
- generate$2(node.term, decorate, forceBraces, compact) +
- decorate(generateMultiplier(node), node)
- );
- case 'Type':
- result = '<' + node.name + (node.opts ? decorate(generateTypeOpts(node.opts), node.opts) : '') + '>';
- break;
- case 'Property':
- result = '<\'' + node.name + '\'>';
- break;
- case 'Keyword':
- result = node.name;
- break;
- case 'AtKeyword':
- result = '@' + node.name;
- break;
- case 'Function':
- result = node.name + '(';
- break;
- case 'String':
- case 'Token':
- result = node.value;
- break;
- case 'Comma':
- result = ',';
- break;
- default:
- throw new Error('Unknown node type `' + node.type + '`');
- }
- return decorate(result, node);
- }
- var generate_1 = function(node, options) {
- var decorate = noop$3;
- var forceBraces = false;
- var compact = false;
- if (typeof options === 'function') {
- decorate = options;
- } else if (options) {
- forceBraces = Boolean(options.forceBraces);
- compact = Boolean(options.compact);
- if (typeof options.decorate === 'function') {
- decorate = options.decorate;
- }
- }
- return generate$2(node, decorate, forceBraces, compact);
- };
- const createCustomError$1 = createCustomError$3;
- const generate$1 = generate_1;
- const defaultLoc = { offset: 0, line: 1, column: 1 };
- function locateMismatch(matchResult, node) {
- const tokens = matchResult.tokens;
- const longestMatch = matchResult.longestMatch;
- const mismatchNode = longestMatch < tokens.length ? tokens[longestMatch].node || null : null;
- const badNode = mismatchNode !== node ? mismatchNode : null;
- let mismatchOffset = 0;
- let mismatchLength = 0;
- let entries = 0;
- let css = '';
- let start;
- let end;
- for (let i = 0; i < tokens.length; i++) {
- const token = tokens[i].value;
- if (i === longestMatch) {
- mismatchLength = token.length;
- mismatchOffset = css.length;
- }
- if (badNode !== null && tokens[i].node === badNode) {
- if (i <= longestMatch) {
- entries++;
- } else {
- entries = 0;
- }
- }
- css += token;
- }
- if (longestMatch === tokens.length || entries > 1) { // last
- start = fromLoc(badNode || node, 'end') || buildLoc(defaultLoc, css);
- end = buildLoc(start);
- } else {
- start = fromLoc(badNode, 'start') ||
- buildLoc(fromLoc(node, 'start') || defaultLoc, css.slice(0, mismatchOffset));
- end = fromLoc(badNode, 'end') ||
- buildLoc(start, css.substr(mismatchOffset, mismatchLength));
- }
- return {
- css,
- mismatchOffset,
- mismatchLength,
- start,
- end
- };
- }
- function fromLoc(node, point) {
- const value = node && node.loc && node.loc[point];
- if (value) {
- return 'line' in value ? buildLoc(value) : value;
- }
- return null;
- }
- function buildLoc({ offset, line, column }, extra) {
- const loc = {
- offset,
- line,
- column
- };
- if (extra) {
- const lines = extra.split(/\n|\r\n?|\f/);
- loc.offset += extra.length;
- loc.line += lines.length - 1;
- loc.column = lines.length === 1 ? loc.column + extra.length : lines.pop().length + 1;
- }
- return loc;
- }
- const SyntaxReferenceError$1 = function(type, referenceName) {
- const error = createCustomError$1(
- 'SyntaxReferenceError',
- type + (referenceName ? ' `' + referenceName + '`' : '')
- );
- error.reference = referenceName;
- return error;
- };
- const SyntaxMatchError$1 = function(message, syntax, node, matchResult) {
- const error = createCustomError$1('SyntaxMatchError', message);
- const {
- css,
- mismatchOffset,
- mismatchLength,
- start,
- end
- } = locateMismatch(matchResult, node);
- error.rawMessage = message;
- error.syntax = syntax ? generate$1(syntax) : '<generic>';
- error.css = css;
- error.mismatchOffset = mismatchOffset;
- error.mismatchLength = mismatchLength;
- error.message = message + '\n' +
- ' syntax: ' + error.syntax + '\n' +
- ' value: ' + (css || '<empty string>') + '\n' +
- ' --------' + new Array(error.mismatchOffset + 1).join('-') + '^';
- Object.assign(error, start);
- error.loc = {
- source: (node && node.loc && node.loc.source) || '<unknown>',
- start,
- end
- };
- return error;
- };
- var error = {
- SyntaxReferenceError: SyntaxReferenceError$1,
- SyntaxMatchError: SyntaxMatchError$1
- };
- var hasOwnProperty$7 = Object.prototype.hasOwnProperty;
- var keywords$1 = Object.create(null);
- var properties$1 = Object.create(null);
- var HYPHENMINUS$5 = 45; // '-'.charCodeAt()
- function isCustomProperty$1(str, offset) {
- offset = offset || 0;
- return str.length - offset >= 2 &&
- str.charCodeAt(offset) === HYPHENMINUS$5 &&
- str.charCodeAt(offset + 1) === HYPHENMINUS$5;
- }
- function getVendorPrefix(str, offset) {
- offset = offset || 0;
- // verdor prefix should be at least 3 chars length
- if (str.length - offset >= 3) {
- // vendor prefix starts with hyper minus following non-hyper minus
- if (str.charCodeAt(offset) === HYPHENMINUS$5 &&
- str.charCodeAt(offset + 1) !== HYPHENMINUS$5) {
- // vendor prefix should contain a hyper minus at the ending
- var secondDashIndex = str.indexOf('-', offset + 2);
- if (secondDashIndex !== -1) {
- return str.substring(offset, secondDashIndex + 1);
- }
- }
- }
- return '';
- }
- function getKeywordDescriptor(keyword) {
- if (hasOwnProperty$7.call(keywords$1, keyword)) {
- return keywords$1[keyword];
- }
- var name = keyword.toLowerCase();
- if (hasOwnProperty$7.call(keywords$1, name)) {
- return keywords$1[keyword] = keywords$1[name];
- }
- var custom = isCustomProperty$1(name, 0);
- var vendor = !custom ? getVendorPrefix(name, 0) : '';
- return keywords$1[keyword] = Object.freeze({
- basename: name.substr(vendor.length),
- name: name,
- vendor: vendor,
- prefix: vendor,
- custom: custom
- });
- }
- function getPropertyDescriptor(property) {
- if (hasOwnProperty$7.call(properties$1, property)) {
- return properties$1[property];
- }
- var name = property;
- var hack = property[0];
- if (hack === '/') {
- hack = property[1] === '/' ? '//' : '/';
- } else if (hack !== '_' &&
- hack !== '*' &&
- hack !== '$' &&
- hack !== '#' &&
- hack !== '+' &&
- hack !== '&') {
- hack = '';
- }
- var custom = isCustomProperty$1(name, hack.length);
- // re-use result when possible (the same as for lower case)
- if (!custom) {
- name = name.toLowerCase();
- if (hasOwnProperty$7.call(properties$1, name)) {
- return properties$1[property] = properties$1[name];
- }
- }
- var vendor = !custom ? getVendorPrefix(name, hack.length) : '';
- var prefix = name.substr(0, hack.length + vendor.length);
- return properties$1[property] = Object.freeze({
- basename: name.substr(prefix.length),
- name: name.substr(hack.length),
- hack: hack,
- vendor: vendor,
- prefix: prefix,
- custom: custom
- });
- }
- var names$2 = {
- keyword: getKeywordDescriptor,
- property: getPropertyDescriptor,
- isCustomProperty: isCustomProperty$1,
- vendorPrefix: getVendorPrefix
- };
- var MIN_SIZE = 16 * 1024;
- var SafeUint32Array = typeof Uint32Array !== 'undefined' ? Uint32Array : Array; // fallback on Array when TypedArray is not supported
- var adoptBuffer$2 = function adoptBuffer(buffer, size) {
- if (buffer === null || buffer.length < size) {
- return new SafeUint32Array(Math.max(size + 1024, MIN_SIZE));
- }
- return buffer;
- };
- var TokenStream$3 = TokenStream_1;
- var adoptBuffer$1 = adoptBuffer$2;
- var constants$1 = _const;
- var TYPE$F = constants$1.TYPE;
- var charCodeDefinitions = charCodeDefinitions$1;
- var isNewline = charCodeDefinitions.isNewline;
- var isName = charCodeDefinitions.isName;
- var isValidEscape = charCodeDefinitions.isValidEscape;
- var isNumberStart = charCodeDefinitions.isNumberStart;
- var isIdentifierStart$1 = charCodeDefinitions.isIdentifierStart;
- var charCodeCategory = charCodeDefinitions.charCodeCategory;
- var isBOM$1 = charCodeDefinitions.isBOM;
- var utils = utils$2;
- var cmpStr$4 = utils.cmpStr;
- var getNewlineLength = utils.getNewlineLength;
- var findWhiteSpaceEnd = utils.findWhiteSpaceEnd;
- var consumeEscaped = utils.consumeEscaped;
- var consumeName = utils.consumeName;
- var consumeNumber$4 = utils.consumeNumber;
- var consumeBadUrlRemnants = utils.consumeBadUrlRemnants;
- var OFFSET_MASK = 0x00FFFFFF;
- var TYPE_SHIFT = 24;
- function tokenize$3(source, stream) {
- function getCharCode(offset) {
- return offset < sourceLength ? source.charCodeAt(offset) : 0;
- }
- // § 4.3.3. Consume a numeric token
- function consumeNumericToken() {
- // Consume a number and let number be the result.
- offset = consumeNumber$4(source, offset);
- // If the next 3 input code points would start an identifier, then:
- if (isIdentifierStart$1(getCharCode(offset), getCharCode(offset + 1), getCharCode(offset + 2))) {
- // Create a <dimension-token> with the same value and type flag as number, and a unit set initially to the empty string.
- // Consume a name. Set the <dimension-token>’s unit to the returned value.
- // Return the <dimension-token>.
- type = TYPE$F.Dimension;
- offset = consumeName(source, offset);
- return;
- }
- // Otherwise, if the next input code point is U+0025 PERCENTAGE SIGN (%), consume it.
- if (getCharCode(offset) === 0x0025) {
- // Create a <percentage-token> with the same value as number, and return it.
- type = TYPE$F.Percentage;
- offset++;
- return;
- }
- // Otherwise, create a <number-token> with the same value and type flag as number, and return it.
- type = TYPE$F.Number;
- }
- // § 4.3.4. Consume an ident-like token
- function consumeIdentLikeToken() {
- const nameStartOffset = offset;
- // Consume a name, and let string be the result.
- offset = consumeName(source, offset);
- // If string’s value is an ASCII case-insensitive match for "url",
- // and the next input code point is U+0028 LEFT PARENTHESIS ((), consume it.
- if (cmpStr$4(source, nameStartOffset, offset, 'url') && getCharCode(offset) === 0x0028) {
- // While the next two input code points are whitespace, consume the next input code point.
- offset = findWhiteSpaceEnd(source, offset + 1);
- // If the next one or two input code points are U+0022 QUOTATION MARK ("), U+0027 APOSTROPHE ('),
- // or whitespace followed by U+0022 QUOTATION MARK (") or U+0027 APOSTROPHE ('),
- // then create a <function-token> with its value set to string and return it.
- if (getCharCode(offset) === 0x0022 ||
- getCharCode(offset) === 0x0027) {
- type = TYPE$F.Function;
- offset = nameStartOffset + 4;
- return;
- }
- // Otherwise, consume a url token, and return it.
- consumeUrlToken();
- return;
- }
- // Otherwise, if the next input code point is U+0028 LEFT PARENTHESIS ((), consume it.
- // Create a <function-token> with its value set to string and return it.
- if (getCharCode(offset) === 0x0028) {
- type = TYPE$F.Function;
- offset++;
- return;
- }
- // Otherwise, create an <ident-token> with its value set to string and return it.
- type = TYPE$F.Ident;
- }
- // § 4.3.5. Consume a string token
- function consumeStringToken(endingCodePoint) {
- // This algorithm may be called with an ending code point, which denotes the code point
- // that ends the string. If an ending code point is not specified,
- // the current input code point is used.
- if (!endingCodePoint) {
- endingCodePoint = getCharCode(offset++);
- }
- // Initially create a <string-token> with its value set to the empty string.
- type = TYPE$F.String;
- // Repeatedly consume the next input code point from the stream:
- for (; offset < source.length; offset++) {
- var code = source.charCodeAt(offset);
- switch (charCodeCategory(code)) {
- // ending code point
- case endingCodePoint:
- // Return the <string-token>.
- offset++;
- return;
- // EOF
- case charCodeCategory.Eof:
- // This is a parse error. Return the <string-token>.
- return;
- // newline
- case charCodeCategory.WhiteSpace:
- if (isNewline(code)) {
- // This is a parse error. Reconsume the current input code point,
- // create a <bad-string-token>, and return it.
- offset += getNewlineLength(source, offset, code);
- type = TYPE$F.BadString;
- return;
- }
- break;
- // U+005C REVERSE SOLIDUS (\)
- case 0x005C:
- // If the next input code point is EOF, do nothing.
- if (offset === source.length - 1) {
- break;
- }
- var nextCode = getCharCode(offset + 1);
- // Otherwise, if the next input code point is a newline, consume it.
- if (isNewline(nextCode)) {
- offset += getNewlineLength(source, offset + 1, nextCode);
- } else if (isValidEscape(code, nextCode)) {
- // Otherwise, (the stream starts with a valid escape) consume
- // an escaped code point and append the returned code point to
- // the <string-token>’s value.
- offset = consumeEscaped(source, offset) - 1;
- }
- break;
- // anything else
- // Append the current input code point to the <string-token>’s value.
- }
- }
- }
- // § 4.3.6. Consume a url token
- // Note: This algorithm assumes that the initial "url(" has already been consumed.
- // This algorithm also assumes that it’s being called to consume an "unquoted" value, like url(foo).
- // A quoted value, like url("foo"), is parsed as a <function-token>. Consume an ident-like token
- // automatically handles this distinction; this algorithm shouldn’t be called directly otherwise.
- function consumeUrlToken() {
- // Initially create a <url-token> with its value set to the empty string.
- type = TYPE$F.Url;
- // Consume as much whitespace as possible.
- offset = findWhiteSpaceEnd(source, offset);
- // Repeatedly consume the next input code point from the stream:
- for (; offset < source.length; offset++) {
- var code = source.charCodeAt(offset);
- switch (charCodeCategory(code)) {
- // U+0029 RIGHT PARENTHESIS ())
- case 0x0029:
- // Return the <url-token>.
- offset++;
- return;
- // EOF
- case charCodeCategory.Eof:
- // This is a parse error. Return the <url-token>.
- return;
- // whitespace
- case charCodeCategory.WhiteSpace:
- // Consume as much whitespace as possible.
- offset = findWhiteSpaceEnd(source, offset);
- // If the next input code point is U+0029 RIGHT PARENTHESIS ()) or EOF,
- // consume it and return the <url-token>
- // (if EOF was encountered, this is a parse error);
- if (getCharCode(offset) === 0x0029 || offset >= source.length) {
- if (offset < source.length) {
- offset++;
- }
- return;
- }
- // otherwise, consume the remnants of a bad url, create a <bad-url-token>,
- // and return it.
- offset = consumeBadUrlRemnants(source, offset);
- type = TYPE$F.BadUrl;
- return;
- // U+0022 QUOTATION MARK (")
- // U+0027 APOSTROPHE (')
- // U+0028 LEFT PARENTHESIS (()
- // non-printable code point
- case 0x0022:
- case 0x0027:
- case 0x0028:
- case charCodeCategory.NonPrintable:
- // This is a parse error. Consume the remnants of a bad url,
- // create a <bad-url-token>, and return it.
- offset = consumeBadUrlRemnants(source, offset);
- type = TYPE$F.BadUrl;
- return;
- // U+005C REVERSE SOLIDUS (\)
- case 0x005C:
- // If the stream starts with a valid escape, consume an escaped code point and
- // append the returned code point to the <url-token>’s value.
- if (isValidEscape(code, getCharCode(offset + 1))) {
- offset = consumeEscaped(source, offset) - 1;
- break;
- }
- // Otherwise, this is a parse error. Consume the remnants of a bad url,
- // create a <bad-url-token>, and return it.
- offset = consumeBadUrlRemnants(source, offset);
- type = TYPE$F.BadUrl;
- return;
- // anything else
- // Append the current input code point to the <url-token>’s value.
- }
- }
- }
- if (!stream) {
- stream = new TokenStream$3();
- }
- // ensure source is a string
- source = String(source || '');
- var sourceLength = source.length;
- var offsetAndType = adoptBuffer$1(stream.offsetAndType, sourceLength + 1); // +1 because of eof-token
- var balance = adoptBuffer$1(stream.balance, sourceLength + 1);
- var tokenCount = 0;
- var start = isBOM$1(getCharCode(0));
- var offset = start;
- var balanceCloseType = 0;
- var balanceStart = 0;
- var balancePrev = 0;
- // https://drafts.csswg.org/css-syntax-3/#consume-token
- // § 4.3.1. Consume a token
- while (offset < sourceLength) {
- var code = source.charCodeAt(offset);
- var type = 0;
- balance[tokenCount] = sourceLength;
- switch (charCodeCategory(code)) {
- // whitespace
- case charCodeCategory.WhiteSpace:
- // Consume as much whitespace as possible. Return a <whitespace-token>.
- type = TYPE$F.WhiteSpace;
- offset = findWhiteSpaceEnd(source, offset + 1);
- break;
- // U+0022 QUOTATION MARK (")
- case 0x0022:
- // Consume a string token and return it.
- consumeStringToken();
- break;
- // U+0023 NUMBER SIGN (#)
- case 0x0023:
- // If the next input code point is a name code point or the next two input code points are a valid escape, then:
- if (isName(getCharCode(offset + 1)) || isValidEscape(getCharCode(offset + 1), getCharCode(offset + 2))) {
- // Create a <hash-token>.
- type = TYPE$F.Hash;
- // If the next 3 input code points would start an identifier, set the <hash-token>’s type flag to "id".
- // if (isIdentifierStart(getCharCode(offset + 1), getCharCode(offset + 2), getCharCode(offset + 3))) {
- // // TODO: set id flag
- // }
- // Consume a name, and set the <hash-token>’s value to the returned string.
- offset = consumeName(source, offset + 1);
- // Return the <hash-token>.
- } else {
- // Otherwise, return a <delim-token> with its value set to the current input code point.
- type = TYPE$F.Delim;
- offset++;
- }
- break;
- // U+0027 APOSTROPHE (')
- case 0x0027:
- // Consume a string token and return it.
- consumeStringToken();
- break;
- // U+0028 LEFT PARENTHESIS (()
- case 0x0028:
- // Return a <(-token>.
- type = TYPE$F.LeftParenthesis;
- offset++;
- break;
- // U+0029 RIGHT PARENTHESIS ())
- case 0x0029:
- // Return a <)-token>.
- type = TYPE$F.RightParenthesis;
- offset++;
- break;
- // U+002B PLUS SIGN (+)
- case 0x002B:
- // If the input stream starts with a number, ...
- if (isNumberStart(code, getCharCode(offset + 1), getCharCode(offset + 2))) {
- // ... reconsume the current input code point, consume a numeric token, and return it.
- consumeNumericToken();
- } else {
- // Otherwise, return a <delim-token> with its value set to the current input code point.
- type = TYPE$F.Delim;
- offset++;
- }
- break;
- // U+002C COMMA (,)
- case 0x002C:
- // Return a <comma-token>.
- type = TYPE$F.Comma;
- offset++;
- break;
- // U+002D HYPHEN-MINUS (-)
- case 0x002D:
- // If the input stream starts with a number, reconsume the current input code point, consume a numeric token, and return it.
- if (isNumberStart(code, getCharCode(offset + 1), getCharCode(offset + 2))) {
- consumeNumericToken();
- } else {
- // Otherwise, if the next 2 input code points are U+002D HYPHEN-MINUS U+003E GREATER-THAN SIGN (->), consume them and return a <CDC-token>.
- if (getCharCode(offset + 1) === 0x002D &&
- getCharCode(offset + 2) === 0x003E) {
- type = TYPE$F.CDC;
- offset = offset + 3;
- } else {
- // Otherwise, if the input stream starts with an identifier, ...
- if (isIdentifierStart$1(code, getCharCode(offset + 1), getCharCode(offset + 2))) {
- // ... reconsume the current input code point, consume an ident-like token, and return it.
- consumeIdentLikeToken();
- } else {
- // Otherwise, return a <delim-token> with its value set to the current input code point.
- type = TYPE$F.Delim;
- offset++;
- }
- }
- }
- break;
- // U+002E FULL STOP (.)
- case 0x002E:
- // If the input stream starts with a number, ...
- if (isNumberStart(code, getCharCode(offset + 1), getCharCode(offset + 2))) {
- // ... reconsume the current input code point, consume a numeric token, and return it.
- consumeNumericToken();
- } else {
- // Otherwise, return a <delim-token> with its value set to the current input code point.
- type = TYPE$F.Delim;
- offset++;
- }
- break;
- // U+002F SOLIDUS (/)
- case 0x002F:
- // If the next two input code point are U+002F SOLIDUS (/) followed by a U+002A ASTERISK (*),
- if (getCharCode(offset + 1) === 0x002A) {
- // ... consume them and all following code points up to and including the first U+002A ASTERISK (*)
- // followed by a U+002F SOLIDUS (/), or up to an EOF code point.
- type = TYPE$F.Comment;
- offset = source.indexOf('*/', offset + 2) + 2;
- if (offset === 1) {
- offset = source.length;
- }
- } else {
- type = TYPE$F.Delim;
- offset++;
- }
- break;
- // U+003A COLON (:)
- case 0x003A:
- // Return a <colon-token>.
- type = TYPE$F.Colon;
- offset++;
- break;
- // U+003B SEMICOLON (;)
- case 0x003B:
- // Return a <semicolon-token>.
- type = TYPE$F.Semicolon;
- offset++;
- break;
- // U+003C LESS-THAN SIGN (<)
- case 0x003C:
- // If the next 3 input code points are U+0021 EXCLAMATION MARK U+002D HYPHEN-MINUS U+002D HYPHEN-MINUS (!--), ...
- if (getCharCode(offset + 1) === 0x0021 &&
- getCharCode(offset + 2) === 0x002D &&
- getCharCode(offset + 3) === 0x002D) {
- // ... consume them and return a <CDO-token>.
- type = TYPE$F.CDO;
- offset = offset + 4;
- } else {
- // Otherwise, return a <delim-token> with its value set to the current input code point.
- type = TYPE$F.Delim;
- offset++;
- }
- break;
- // U+0040 COMMERCIAL AT (@)
- case 0x0040:
- // If the next 3 input code points would start an identifier, ...
- if (isIdentifierStart$1(getCharCode(offset + 1), getCharCode(offset + 2), getCharCode(offset + 3))) {
- // ... consume a name, create an <at-keyword-token> with its value set to the returned value, and return it.
- type = TYPE$F.AtKeyword;
- offset = consumeName(source, offset + 1);
- } else {
- // Otherwise, return a <delim-token> with its value set to the current input code point.
- type = TYPE$F.Delim;
- offset++;
- }
- break;
- // U+005B LEFT SQUARE BRACKET ([)
- case 0x005B:
- // Return a <[-token>.
- type = TYPE$F.LeftSquareBracket;
- offset++;
- break;
- // U+005C REVERSE SOLIDUS (\)
- case 0x005C:
- // If the input stream starts with a valid escape, ...
- if (isValidEscape(code, getCharCode(offset + 1))) {
- // ... reconsume the current input code point, consume an ident-like token, and return it.
- consumeIdentLikeToken();
- } else {
- // Otherwise, this is a parse error. Return a <delim-token> with its value set to the current input code point.
- type = TYPE$F.Delim;
- offset++;
- }
- break;
- // U+005D RIGHT SQUARE BRACKET (])
- case 0x005D:
- // Return a <]-token>.
- type = TYPE$F.RightSquareBracket;
- offset++;
- break;
- // U+007B LEFT CURLY BRACKET ({)
- case 0x007B:
- // Return a <{-token>.
- type = TYPE$F.LeftCurlyBracket;
- offset++;
- break;
- // U+007D RIGHT CURLY BRACKET (})
- case 0x007D:
- // Return a <}-token>.
- type = TYPE$F.RightCurlyBracket;
- offset++;
- break;
- // digit
- case charCodeCategory.Digit:
- // Reconsume the current input code point, consume a numeric token, and return it.
- consumeNumericToken();
- break;
- // name-start code point
- case charCodeCategory.NameStart:
- // Reconsume the current input code point, consume an ident-like token, and return it.
- consumeIdentLikeToken();
- break;
- // EOF
- case charCodeCategory.Eof:
- // Return an <EOF-token>.
- break;
- // anything else
- default:
- // Return a <delim-token> with its value set to the current input code point.
- type = TYPE$F.Delim;
- offset++;
- }
- switch (type) {
- case balanceCloseType:
- balancePrev = balanceStart & OFFSET_MASK;
- balanceStart = balance[balancePrev];
- balanceCloseType = balanceStart >> TYPE_SHIFT;
- balance[tokenCount] = balancePrev;
- balance[balancePrev++] = tokenCount;
- for (; balancePrev < tokenCount; balancePrev++) {
- if (balance[balancePrev] === sourceLength) {
- balance[balancePrev] = tokenCount;
- }
- }
- break;
- case TYPE$F.LeftParenthesis:
- case TYPE$F.Function:
- balance[tokenCount] = balanceStart;
- balanceCloseType = TYPE$F.RightParenthesis;
- balanceStart = (balanceCloseType << TYPE_SHIFT) | tokenCount;
- break;
- case TYPE$F.LeftSquareBracket:
- balance[tokenCount] = balanceStart;
- balanceCloseType = TYPE$F.RightSquareBracket;
- balanceStart = (balanceCloseType << TYPE_SHIFT) | tokenCount;
- break;
- case TYPE$F.LeftCurlyBracket:
- balance[tokenCount] = balanceStart;
- balanceCloseType = TYPE$F.RightCurlyBracket;
- balanceStart = (balanceCloseType << TYPE_SHIFT) | tokenCount;
- break;
- }
- offsetAndType[tokenCount++] = (type << TYPE_SHIFT) | offset;
- }
- // finalize buffers
- offsetAndType[tokenCount] = (TYPE$F.EOF << TYPE_SHIFT) | offset; // <EOF-token>
- balance[tokenCount] = sourceLength;
- balance[sourceLength] = sourceLength; // prevents false positive balance match with any token
- while (balanceStart !== 0) {
- balancePrev = balanceStart & OFFSET_MASK;
- balanceStart = balance[balancePrev];
- balance[balancePrev] = sourceLength;
- }
- // update stream
- stream.source = source;
- stream.firstCharOffset = start;
- stream.offsetAndType = offsetAndType;
- stream.tokenCount = tokenCount;
- stream.balance = balance;
- stream.reset();
- stream.next();
- return stream;
- }
- // extend tokenizer with constants
- Object.keys(constants$1).forEach(function(key) {
- tokenize$3[key] = constants$1[key];
- });
- // extend tokenizer with static methods from utils
- Object.keys(charCodeDefinitions).forEach(function(key) {
- tokenize$3[key] = charCodeDefinitions[key];
- });
- Object.keys(utils).forEach(function(key) {
- tokenize$3[key] = utils[key];
- });
- var tokenizer$3 = tokenize$3;
- var isDigit$3 = tokenizer$3.isDigit;
- var cmpChar$4 = tokenizer$3.cmpChar;
- var TYPE$E = tokenizer$3.TYPE;
- var DELIM$6 = TYPE$E.Delim;
- var WHITESPACE$b = TYPE$E.WhiteSpace;
- var COMMENT$9 = TYPE$E.Comment;
- var IDENT$i = TYPE$E.Ident;
- var NUMBER$9 = TYPE$E.Number;
- var DIMENSION$7 = TYPE$E.Dimension;
- var PLUSSIGN$8 = 0x002B; // U+002B PLUS SIGN (+)
- var HYPHENMINUS$4 = 0x002D; // U+002D HYPHEN-MINUS (-)
- var N$4 = 0x006E; // U+006E LATIN SMALL LETTER N (n)
- var DISALLOW_SIGN$1 = true;
- var ALLOW_SIGN$1 = false;
- function isDelim$1(token, code) {
- return token !== null && token.type === DELIM$6 && token.value.charCodeAt(0) === code;
- }
- function skipSC(token, offset, getNextToken) {
- while (token !== null && (token.type === WHITESPACE$b || token.type === COMMENT$9)) {
- token = getNextToken(++offset);
- }
- return offset;
- }
- function checkInteger$1(token, valueOffset, disallowSign, offset) {
- if (!token) {
- return 0;
- }
- var code = token.value.charCodeAt(valueOffset);
- if (code === PLUSSIGN$8 || code === HYPHENMINUS$4) {
- if (disallowSign) {
- // Number sign is not allowed
- return 0;
- }
- valueOffset++;
- }
- for (; valueOffset < token.value.length; valueOffset++) {
- if (!isDigit$3(token.value.charCodeAt(valueOffset))) {
- // Integer is expected
- return 0;
- }
- }
- return offset + 1;
- }
- // ... <signed-integer>
- // ... ['+' | '-'] <signless-integer>
- function consumeB$1(token, offset_, getNextToken) {
- var sign = false;
- var offset = skipSC(token, offset_, getNextToken);
- token = getNextToken(offset);
- if (token === null) {
- return offset_;
- }
- if (token.type !== NUMBER$9) {
- if (isDelim$1(token, PLUSSIGN$8) || isDelim$1(token, HYPHENMINUS$4)) {
- sign = true;
- offset = skipSC(getNextToken(++offset), offset, getNextToken);
- token = getNextToken(offset);
- if (token === null && token.type !== NUMBER$9) {
- return 0;
- }
- } else {
- return offset_;
- }
- }
- if (!sign) {
- var code = token.value.charCodeAt(0);
- if (code !== PLUSSIGN$8 && code !== HYPHENMINUS$4) {
- // Number sign is expected
- return 0;
- }
- }
- return checkInteger$1(token, sign ? 0 : 1, sign, offset);
- }
- // An+B microsyntax https://www.w3.org/TR/css-syntax-3/#anb
- var genericAnPlusB = function anPlusB(token, getNextToken) {
- /* eslint-disable brace-style*/
- var offset = 0;
- if (!token) {
- return 0;
- }
- // <integer>
- if (token.type === NUMBER$9) {
- return checkInteger$1(token, 0, ALLOW_SIGN$1, offset); // b
- }
- // -n
- // -n <signed-integer>
- // -n ['+' | '-'] <signless-integer>
- // -n- <signless-integer>
- // <dashndashdigit-ident>
- else if (token.type === IDENT$i && token.value.charCodeAt(0) === HYPHENMINUS$4) {
- // expect 1st char is N
- if (!cmpChar$4(token.value, 1, N$4)) {
- return 0;
- }
- switch (token.value.length) {
- // -n
- // -n <signed-integer>
- // -n ['+' | '-'] <signless-integer>
- case 2:
- return consumeB$1(getNextToken(++offset), offset, getNextToken);
- // -n- <signless-integer>
- case 3:
- if (token.value.charCodeAt(2) !== HYPHENMINUS$4) {
- return 0;
- }
- offset = skipSC(getNextToken(++offset), offset, getNextToken);
- token = getNextToken(offset);
- return checkInteger$1(token, 0, DISALLOW_SIGN$1, offset);
- // <dashndashdigit-ident>
- default:
- if (token.value.charCodeAt(2) !== HYPHENMINUS$4) {
- return 0;
- }
- return checkInteger$1(token, 3, DISALLOW_SIGN$1, offset);
- }
- }
- // '+'? n
- // '+'? n <signed-integer>
- // '+'? n ['+' | '-'] <signless-integer>
- // '+'? n- <signless-integer>
- // '+'? <ndashdigit-ident>
- else if (token.type === IDENT$i || (isDelim$1(token, PLUSSIGN$8) && getNextToken(offset + 1).type === IDENT$i)) {
- // just ignore a plus
- if (token.type !== IDENT$i) {
- token = getNextToken(++offset);
- }
- if (token === null || !cmpChar$4(token.value, 0, N$4)) {
- return 0;
- }
- switch (token.value.length) {
- // '+'? n
- // '+'? n <signed-integer>
- // '+'? n ['+' | '-'] <signless-integer>
- case 1:
- return consumeB$1(getNextToken(++offset), offset, getNextToken);
- // '+'? n- <signless-integer>
- case 2:
- if (token.value.charCodeAt(1) !== HYPHENMINUS$4) {
- return 0;
- }
- offset = skipSC(getNextToken(++offset), offset, getNextToken);
- token = getNextToken(offset);
- return checkInteger$1(token, 0, DISALLOW_SIGN$1, offset);
- // '+'? <ndashdigit-ident>
- default:
- if (token.value.charCodeAt(1) !== HYPHENMINUS$4) {
- return 0;
- }
- return checkInteger$1(token, 2, DISALLOW_SIGN$1, offset);
- }
- }
- // <ndashdigit-dimension>
- // <ndash-dimension> <signless-integer>
- // <n-dimension>
- // <n-dimension> <signed-integer>
- // <n-dimension> ['+' | '-'] <signless-integer>
- else if (token.type === DIMENSION$7) {
- var code = token.value.charCodeAt(0);
- var sign = code === PLUSSIGN$8 || code === HYPHENMINUS$4 ? 1 : 0;
- for (var i = sign; i < token.value.length; i++) {
- if (!isDigit$3(token.value.charCodeAt(i))) {
- break;
- }
- }
- if (i === sign) {
- // Integer is expected
- return 0;
- }
- if (!cmpChar$4(token.value, i, N$4)) {
- return 0;
- }
- // <n-dimension>
- // <n-dimension> <signed-integer>
- // <n-dimension> ['+' | '-'] <signless-integer>
- if (i + 1 === token.value.length) {
- return consumeB$1(getNextToken(++offset), offset, getNextToken);
- } else {
- if (token.value.charCodeAt(i + 1) !== HYPHENMINUS$4) {
- return 0;
- }
- // <ndash-dimension> <signless-integer>
- if (i + 2 === token.value.length) {
- offset = skipSC(getNextToken(++offset), offset, getNextToken);
- token = getNextToken(offset);
- return checkInteger$1(token, 0, DISALLOW_SIGN$1, offset);
- }
- // <ndashdigit-dimension>
- else {
- return checkInteger$1(token, i + 2, DISALLOW_SIGN$1, offset);
- }
- }
- }
- return 0;
- };
- var isHexDigit$2 = tokenizer$3.isHexDigit;
- var cmpChar$3 = tokenizer$3.cmpChar;
- var TYPE$D = tokenizer$3.TYPE;
- var IDENT$h = TYPE$D.Ident;
- var DELIM$5 = TYPE$D.Delim;
- var NUMBER$8 = TYPE$D.Number;
- var DIMENSION$6 = TYPE$D.Dimension;
- var PLUSSIGN$7 = 0x002B; // U+002B PLUS SIGN (+)
- var HYPHENMINUS$3 = 0x002D; // U+002D HYPHEN-MINUS (-)
- var QUESTIONMARK$2 = 0x003F; // U+003F QUESTION MARK (?)
- var U$2 = 0x0075; // U+0075 LATIN SMALL LETTER U (u)
- function isDelim(token, code) {
- return token !== null && token.type === DELIM$5 && token.value.charCodeAt(0) === code;
- }
- function startsWith$1(token, code) {
- return token.value.charCodeAt(0) === code;
- }
- function hexSequence(token, offset, allowDash) {
- for (var pos = offset, hexlen = 0; pos < token.value.length; pos++) {
- var code = token.value.charCodeAt(pos);
- if (code === HYPHENMINUS$3 && allowDash && hexlen !== 0) {
- if (hexSequence(token, offset + hexlen + 1, false) > 0) {
- return 6; // dissallow following question marks
- }
- return 0; // dash at the ending of a hex sequence is not allowed
- }
- if (!isHexDigit$2(code)) {
- return 0; // not a hex digit
- }
- if (++hexlen > 6) {
- return 0; // too many hex digits
- } }
- return hexlen;
- }
- function withQuestionMarkSequence(consumed, length, getNextToken) {
- if (!consumed) {
- return 0; // nothing consumed
- }
- while (isDelim(getNextToken(length), QUESTIONMARK$2)) {
- if (++consumed > 6) {
- return 0; // too many question marks
- }
- length++;
- }
- return length;
- }
- // https://drafts.csswg.org/css-syntax/#urange
- // Informally, the <urange> production has three forms:
- // U+0001
- // Defines a range consisting of a single code point, in this case the code point "1".
- // U+0001-00ff
- // Defines a range of codepoints between the first and the second value, in this case
- // the range between "1" and "ff" (255 in decimal) inclusive.
- // U+00??
- // Defines a range of codepoints where the "?" characters range over all hex digits,
- // in this case defining the same as the value U+0000-00ff.
- // In each form, a maximum of 6 digits is allowed for each hexadecimal number (if you treat "?" as a hexadecimal digit).
- //
- // <urange> =
- // u '+' <ident-token> '?'* |
- // u <dimension-token> '?'* |
- // u <number-token> '?'* |
- // u <number-token> <dimension-token> |
- // u <number-token> <number-token> |
- // u '+' '?'+
- var genericUrange = function urange(token, getNextToken) {
- var length = 0;
- // should start with `u` or `U`
- if (token === null || token.type !== IDENT$h || !cmpChar$3(token.value, 0, U$2)) {
- return 0;
- }
- token = getNextToken(++length);
- if (token === null) {
- return 0;
- }
- // u '+' <ident-token> '?'*
- // u '+' '?'+
- if (isDelim(token, PLUSSIGN$7)) {
- token = getNextToken(++length);
- if (token === null) {
- return 0;
- }
- if (token.type === IDENT$h) {
- // u '+' <ident-token> '?'*
- return withQuestionMarkSequence(hexSequence(token, 0, true), ++length, getNextToken);
- }
- if (isDelim(token, QUESTIONMARK$2)) {
- // u '+' '?'+
- return withQuestionMarkSequence(1, ++length, getNextToken);
- }
- // Hex digit or question mark is expected
- return 0;
- }
- // u <number-token> '?'*
- // u <number-token> <dimension-token>
- // u <number-token> <number-token>
- if (token.type === NUMBER$8) {
- if (!startsWith$1(token, PLUSSIGN$7)) {
- return 0;
- }
- var consumedHexLength = hexSequence(token, 1, true);
- if (consumedHexLength === 0) {
- return 0;
- }
- token = getNextToken(++length);
- if (token === null) {
- // u <number-token> <eof>
- return length;
- }
- if (token.type === DIMENSION$6 || token.type === NUMBER$8) {
- // u <number-token> <dimension-token>
- // u <number-token> <number-token>
- if (!startsWith$1(token, HYPHENMINUS$3) || !hexSequence(token, 1, false)) {
- return 0;
- }
- return length + 1;
- }
- // u <number-token> '?'*
- return withQuestionMarkSequence(consumedHexLength, length, getNextToken);
- }
- // u <dimension-token> '?'*
- if (token.type === DIMENSION$6) {
- if (!startsWith$1(token, PLUSSIGN$7)) {
- return 0;
- }
- return withQuestionMarkSequence(hexSequence(token, 1, true), ++length, getNextToken);
- }
- return 0;
- };
- var tokenizer$2 = tokenizer$3;
- var isIdentifierStart = tokenizer$2.isIdentifierStart;
- var isHexDigit$1 = tokenizer$2.isHexDigit;
- var isDigit$2 = tokenizer$2.isDigit;
- var cmpStr$3 = tokenizer$2.cmpStr;
- var consumeNumber$3 = tokenizer$2.consumeNumber;
- var TYPE$C = tokenizer$2.TYPE;
- var anPlusB = genericAnPlusB;
- var urange = genericUrange;
- var cssWideKeywords$1 = ['unset', 'initial', 'inherit'];
- var calcFunctionNames = ['calc(', '-moz-calc(', '-webkit-calc('];
- // https://www.w3.org/TR/css-values-3/#lengths
- var LENGTH = {
- // absolute length units
- 'px': true,
- 'mm': true,
- 'cm': true,
- 'in': true,
- 'pt': true,
- 'pc': true,
- 'q': true,
- // relative length units
- 'em': true,
- 'ex': true,
- 'ch': true,
- 'rem': true,
- // viewport-percentage lengths
- 'vh': true,
- 'vw': true,
- 'vmin': true,
- 'vmax': true,
- 'vm': true
- };
- var ANGLE = {
- 'deg': true,
- 'grad': true,
- 'rad': true,
- 'turn': true
- };
- var TIME = {
- 's': true,
- 'ms': true
- };
- var FREQUENCY = {
- 'hz': true,
- 'khz': true
- };
- // https://www.w3.org/TR/css-values-3/#resolution (https://drafts.csswg.org/css-values/#resolution)
- var RESOLUTION = {
- 'dpi': true,
- 'dpcm': true,
- 'dppx': true,
- 'x': true // https://github.com/w3c/csswg-drafts/issues/461
- };
- // https://drafts.csswg.org/css-grid/#fr-unit
- var FLEX = {
- 'fr': true
- };
- // https://www.w3.org/TR/css3-speech/#mixing-props-voice-volume
- var DECIBEL = {
- 'db': true
- };
- // https://www.w3.org/TR/css3-speech/#voice-props-voice-pitch
- var SEMITONES = {
- 'st': true
- };
- // safe char code getter
- function charCode(str, index) {
- return index < str.length ? str.charCodeAt(index) : 0;
- }
- function eqStr(actual, expected) {
- return cmpStr$3(actual, 0, actual.length, expected);
- }
- function eqStrAny(actual, expected) {
- for (var i = 0; i < expected.length; i++) {
- if (eqStr(actual, expected[i])) {
- return true;
- }
- }
- return false;
- }
- // IE postfix hack, i.e. 123\0 or 123px\9
- function isPostfixIeHack(str, offset) {
- if (offset !== str.length - 2) {
- return false;
- }
- return (
- str.charCodeAt(offset) === 0x005C && // U+005C REVERSE SOLIDUS (\)
- isDigit$2(str.charCodeAt(offset + 1))
- );
- }
- function outOfRange(opts, value, numEnd) {
- if (opts && opts.type === 'Range') {
- var num = Number(
- numEnd !== undefined && numEnd !== value.length
- ? value.substr(0, numEnd)
- : value
- );
- if (isNaN(num)) {
- return true;
- }
- if (opts.min !== null && num < opts.min) {
- return true;
- }
- if (opts.max !== null && num > opts.max) {
- return true;
- }
- }
- return false;
- }
- function consumeFunction(token, getNextToken) {
- var startIdx = token.index;
- var length = 0;
- // balanced token consuming
- do {
- length++;
- if (token.balance <= startIdx) {
- break;
- }
- } while (token = getNextToken(length));
- return length;
- }
- // TODO: implement
- // can be used wherever <length>, <frequency>, <angle>, <time>, <percentage>, <number>, or <integer> values are allowed
- // https://drafts.csswg.org/css-values/#calc-notation
- function calc(next) {
- return function(token, getNextToken, opts) {
- if (token === null) {
- return 0;
- }
- if (token.type === TYPE$C.Function && eqStrAny(token.value, calcFunctionNames)) {
- return consumeFunction(token, getNextToken);
- }
- return next(token, getNextToken, opts);
- };
- }
- function tokenType(expectedTokenType) {
- return function(token) {
- if (token === null || token.type !== expectedTokenType) {
- return 0;
- }
- return 1;
- };
- }
- function func(name) {
- name = name + '(';
- return function(token, getNextToken) {
- if (token !== null && eqStr(token.value, name)) {
- return consumeFunction(token, getNextToken);
- }
- return 0;
- };
- }
- // =========================
- // Complex types
- //
- // https://drafts.csswg.org/css-values-4/#custom-idents
- // 4.2. Author-defined Identifiers: the <custom-ident> type
- // Some properties accept arbitrary author-defined identifiers as a component value.
- // This generic data type is denoted by <custom-ident>, and represents any valid CSS identifier
- // that would not be misinterpreted as a pre-defined keyword in that property’s value definition.
- //
- // See also: https://developer.mozilla.org/en-US/docs/Web/CSS/custom-ident
- function customIdent(token) {
- if (token === null || token.type !== TYPE$C.Ident) {
- return 0;
- }
- var name = token.value.toLowerCase();
- // The CSS-wide keywords are not valid <custom-ident>s
- if (eqStrAny(name, cssWideKeywords$1)) {
- return 0;
- }
- // The default keyword is reserved and is also not a valid <custom-ident>
- if (eqStr(name, 'default')) {
- return 0;
- }
- // TODO: ignore property specific keywords (as described https://developer.mozilla.org/en-US/docs/Web/CSS/custom-ident)
- // Specifications using <custom-ident> must specify clearly what other keywords
- // are excluded from <custom-ident>, if any—for example by saying that any pre-defined keywords
- // in that property’s value definition are excluded. Excluded keywords are excluded
- // in all ASCII case permutations.
- return 1;
- }
- // https://drafts.csswg.org/css-variables/#typedef-custom-property-name
- // A custom property is any property whose name starts with two dashes (U+002D HYPHEN-MINUS), like --foo.
- // The <custom-property-name> production corresponds to this: it’s defined as any valid identifier
- // that starts with two dashes, except -- itself, which is reserved for future use by CSS.
- // NOTE: Current implementation treat `--` as a valid name since most (all?) major browsers treat it as valid.
- function customPropertyName(token) {
- // ... defined as any valid identifier
- if (token === null || token.type !== TYPE$C.Ident) {
- return 0;
- }
- // ... that starts with two dashes (U+002D HYPHEN-MINUS)
- if (charCode(token.value, 0) !== 0x002D || charCode(token.value, 1) !== 0x002D) {
- return 0;
- }
- return 1;
- }
- // https://drafts.csswg.org/css-color-4/#hex-notation
- // The syntax of a <hex-color> is a <hash-token> token whose value consists of 3, 4, 6, or 8 hexadecimal digits.
- // In other words, a hex color is written as a hash character, "#", followed by some number of digits 0-9 or
- // letters a-f (the case of the letters doesn’t matter - #00ff00 is identical to #00FF00).
- function hexColor(token) {
- if (token === null || token.type !== TYPE$C.Hash) {
- return 0;
- }
- var length = token.value.length;
- // valid values (length): #rgb (4), #rgba (5), #rrggbb (7), #rrggbbaa (9)
- if (length !== 4 && length !== 5 && length !== 7 && length !== 9) {
- return 0;
- }
- for (var i = 1; i < length; i++) {
- if (!isHexDigit$1(token.value.charCodeAt(i))) {
- return 0;
- }
- }
- return 1;
- }
- function idSelector(token) {
- if (token === null || token.type !== TYPE$C.Hash) {
- return 0;
- }
- if (!isIdentifierStart(charCode(token.value, 1), charCode(token.value, 2), charCode(token.value, 3))) {
- return 0;
- }
- return 1;
- }
- // https://drafts.csswg.org/css-syntax/#any-value
- // It represents the entirety of what a valid declaration can have as its value.
- function declarationValue(token, getNextToken) {
- if (!token) {
- return 0;
- }
- var length = 0;
- var level = 0;
- var startIdx = token.index;
- // The <declaration-value> production matches any sequence of one or more tokens,
- // so long as the sequence ...
- scan:
- do {
- switch (token.type) {
- // ... does not contain <bad-string-token>, <bad-url-token>,
- case TYPE$C.BadString:
- case TYPE$C.BadUrl:
- break scan;
- // ... unmatched <)-token>, <]-token>, or <}-token>,
- case TYPE$C.RightCurlyBracket:
- case TYPE$C.RightParenthesis:
- case TYPE$C.RightSquareBracket:
- if (token.balance > token.index || token.balance < startIdx) {
- break scan;
- }
- level--;
- break;
- // ... or top-level <semicolon-token> tokens
- case TYPE$C.Semicolon:
- if (level === 0) {
- break scan;
- }
- break;
- // ... or <delim-token> tokens with a value of "!"
- case TYPE$C.Delim:
- if (token.value === '!' && level === 0) {
- break scan;
- }
- break;
- case TYPE$C.Function:
- case TYPE$C.LeftParenthesis:
- case TYPE$C.LeftSquareBracket:
- case TYPE$C.LeftCurlyBracket:
- level++;
- break;
- }
- length++;
- // until balance closing
- if (token.balance <= startIdx) {
- break;
- }
- } while (token = getNextToken(length));
- return length;
- }
- // https://drafts.csswg.org/css-syntax/#any-value
- // The <any-value> production is identical to <declaration-value>, but also
- // allows top-level <semicolon-token> tokens and <delim-token> tokens
- // with a value of "!". It represents the entirety of what valid CSS can be in any context.
- function anyValue(token, getNextToken) {
- if (!token) {
- return 0;
- }
- var startIdx = token.index;
- var length = 0;
- // The <any-value> production matches any sequence of one or more tokens,
- // so long as the sequence ...
- scan:
- do {
- switch (token.type) {
- // ... does not contain <bad-string-token>, <bad-url-token>,
- case TYPE$C.BadString:
- case TYPE$C.BadUrl:
- break scan;
- // ... unmatched <)-token>, <]-token>, or <}-token>,
- case TYPE$C.RightCurlyBracket:
- case TYPE$C.RightParenthesis:
- case TYPE$C.RightSquareBracket:
- if (token.balance > token.index || token.balance < startIdx) {
- break scan;
- }
- break;
- }
- length++;
- // until balance closing
- if (token.balance <= startIdx) {
- break;
- }
- } while (token = getNextToken(length));
- return length;
- }
- // =========================
- // Dimensions
- //
- function dimension(type) {
- return function(token, getNextToken, opts) {
- if (token === null || token.type !== TYPE$C.Dimension) {
- return 0;
- }
- var numberEnd = consumeNumber$3(token.value, 0);
- // check unit
- if (type !== null) {
- // check for IE postfix hack, i.e. 123px\0 or 123px\9
- var reverseSolidusOffset = token.value.indexOf('\\', numberEnd);
- var unit = reverseSolidusOffset === -1 || !isPostfixIeHack(token.value, reverseSolidusOffset)
- ? token.value.substr(numberEnd)
- : token.value.substring(numberEnd, reverseSolidusOffset);
- if (type.hasOwnProperty(unit.toLowerCase()) === false) {
- return 0;
- }
- }
- // check range if specified
- if (outOfRange(opts, token.value, numberEnd)) {
- return 0;
- }
- return 1;
- };
- }
- // =========================
- // Percentage
- //
- // §5.5. Percentages: the <percentage> type
- // https://drafts.csswg.org/css-values-4/#percentages
- function percentage(token, getNextToken, opts) {
- // ... corresponds to the <percentage-token> production
- if (token === null || token.type !== TYPE$C.Percentage) {
- return 0;
- }
- // check range if specified
- if (outOfRange(opts, token.value, token.value.length - 1)) {
- return 0;
- }
- return 1;
- }
- // =========================
- // Numeric
- //
- // https://drafts.csswg.org/css-values-4/#numbers
- // The value <zero> represents a literal number with the value 0. Expressions that merely
- // evaluate to a <number> with the value 0 (for example, calc(0)) do not match <zero>;
- // only literal <number-token>s do.
- function zero(next) {
- if (typeof next !== 'function') {
- next = function() {
- return 0;
- };
- }
- return function(token, getNextToken, opts) {
- if (token !== null && token.type === TYPE$C.Number) {
- if (Number(token.value) === 0) {
- return 1;
- }
- }
- return next(token, getNextToken, opts);
- };
- }
- // § 5.3. Real Numbers: the <number> type
- // https://drafts.csswg.org/css-values-4/#numbers
- // Number values are denoted by <number>, and represent real numbers, possibly with a fractional component.
- // ... It corresponds to the <number-token> production
- function number(token, getNextToken, opts) {
- if (token === null) {
- return 0;
- }
- var numberEnd = consumeNumber$3(token.value, 0);
- var isNumber = numberEnd === token.value.length;
- if (!isNumber && !isPostfixIeHack(token.value, numberEnd)) {
- return 0;
- }
- // check range if specified
- if (outOfRange(opts, token.value, numberEnd)) {
- return 0;
- }
- return 1;
- }
- // §5.2. Integers: the <integer> type
- // https://drafts.csswg.org/css-values-4/#integers
- function integer(token, getNextToken, opts) {
- // ... corresponds to a subset of the <number-token> production
- if (token === null || token.type !== TYPE$C.Number) {
- return 0;
- }
- // The first digit of an integer may be immediately preceded by `-` or `+` to indicate the integer’s sign.
- var i = token.value.charCodeAt(0) === 0x002B || // U+002B PLUS SIGN (+)
- token.value.charCodeAt(0) === 0x002D ? 1 : 0; // U+002D HYPHEN-MINUS (-)
- // When written literally, an integer is one or more decimal digits 0 through 9 ...
- for (; i < token.value.length; i++) {
- if (!isDigit$2(token.value.charCodeAt(i))) {
- return 0;
- }
- }
- // check range if specified
- if (outOfRange(opts, token.value, i)) {
- return 0;
- }
- return 1;
- }
- var generic$1 = {
- // token types
- 'ident-token': tokenType(TYPE$C.Ident),
- 'function-token': tokenType(TYPE$C.Function),
- 'at-keyword-token': tokenType(TYPE$C.AtKeyword),
- 'hash-token': tokenType(TYPE$C.Hash),
- 'string-token': tokenType(TYPE$C.String),
- 'bad-string-token': tokenType(TYPE$C.BadString),
- 'url-token': tokenType(TYPE$C.Url),
- 'bad-url-token': tokenType(TYPE$C.BadUrl),
- 'delim-token': tokenType(TYPE$C.Delim),
- 'number-token': tokenType(TYPE$C.Number),
- 'percentage-token': tokenType(TYPE$C.Percentage),
- 'dimension-token': tokenType(TYPE$C.Dimension),
- 'whitespace-token': tokenType(TYPE$C.WhiteSpace),
- 'CDO-token': tokenType(TYPE$C.CDO),
- 'CDC-token': tokenType(TYPE$C.CDC),
- 'colon-token': tokenType(TYPE$C.Colon),
- 'semicolon-token': tokenType(TYPE$C.Semicolon),
- 'comma-token': tokenType(TYPE$C.Comma),
- '[-token': tokenType(TYPE$C.LeftSquareBracket),
- ']-token': tokenType(TYPE$C.RightSquareBracket),
- '(-token': tokenType(TYPE$C.LeftParenthesis),
- ')-token': tokenType(TYPE$C.RightParenthesis),
- '{-token': tokenType(TYPE$C.LeftCurlyBracket),
- '}-token': tokenType(TYPE$C.RightCurlyBracket),
- // token type aliases
- 'string': tokenType(TYPE$C.String),
- 'ident': tokenType(TYPE$C.Ident),
- // complex types
- 'custom-ident': customIdent,
- 'custom-property-name': customPropertyName,
- 'hex-color': hexColor,
- 'id-selector': idSelector, // element( <id-selector> )
- 'an-plus-b': anPlusB,
- 'urange': urange,
- 'declaration-value': declarationValue,
- 'any-value': anyValue,
- // dimensions
- 'dimension': calc(dimension(null)),
- 'angle': calc(dimension(ANGLE)),
- 'decibel': calc(dimension(DECIBEL)),
- 'frequency': calc(dimension(FREQUENCY)),
- 'flex': calc(dimension(FLEX)),
- 'length': calc(zero(dimension(LENGTH))),
- 'resolution': calc(dimension(RESOLUTION)),
- 'semitones': calc(dimension(SEMITONES)),
- 'time': calc(dimension(TIME)),
- // percentage
- 'percentage': calc(percentage),
- // numeric
- 'zero': zero(),
- 'number': calc(number),
- 'integer': calc(integer),
- // old IE stuff
- '-ms-legacy-expression': func('expression')
- };
- var createCustomError = createCustomError$3;
- var _SyntaxError = function SyntaxError(message, input, offset) {
- var error = createCustomError('SyntaxError', message);
- error.input = input;
- error.offset = offset;
- error.rawMessage = message;
- error.message = error.rawMessage + '\n' +
- ' ' + error.input + '\n' +
- '--' + new Array((error.offset || error.input.length) + 1).join('-') + '^';
- return error;
- };
- var SyntaxError$3 = _SyntaxError;
- var TAB$1 = 9;
- var N$3 = 10;
- var F$2 = 12;
- var R$2 = 13;
- var SPACE$2 = 32;
- var Tokenizer$1 = function(str) {
- this.str = str;
- this.pos = 0;
- };
- Tokenizer$1.prototype = {
- charCodeAt: function(pos) {
- return pos < this.str.length ? this.str.charCodeAt(pos) : 0;
- },
- charCode: function() {
- return this.charCodeAt(this.pos);
- },
- nextCharCode: function() {
- return this.charCodeAt(this.pos + 1);
- },
- nextNonWsCode: function(pos) {
- return this.charCodeAt(this.findWsEnd(pos));
- },
- findWsEnd: function(pos) {
- for (; pos < this.str.length; pos++) {
- var code = this.str.charCodeAt(pos);
- if (code !== R$2 && code !== N$3 && code !== F$2 && code !== SPACE$2 && code !== TAB$1) {
- break;
- }
- }
- return pos;
- },
- substringToPos: function(end) {
- return this.str.substring(this.pos, this.pos = end);
- },
- eat: function(code) {
- if (this.charCode() !== code) {
- this.error('Expect `' + String.fromCharCode(code) + '`');
- }
- this.pos++;
- },
- peek: function() {
- return this.pos < this.str.length ? this.str.charAt(this.pos++) : '';
- },
- error: function(message) {
- throw new SyntaxError$3(message, this.str, this.pos);
- }
- };
- var tokenizer$1 = Tokenizer$1;
- var Tokenizer = tokenizer$1;
- var TAB = 9;
- var N$2 = 10;
- var F$1 = 12;
- var R$1 = 13;
- var SPACE$1 = 32;
- var EXCLAMATIONMARK$3 = 33; // !
- var NUMBERSIGN$4 = 35; // #
- var AMPERSAND$1 = 38; // &
- var APOSTROPHE = 39; // '
- var LEFTPARENTHESIS$7 = 40; // (
- var RIGHTPARENTHESIS$7 = 41; // )
- var ASTERISK$6 = 42; // *
- var PLUSSIGN$6 = 43; // +
- var COMMA$4 = 44; // ,
- var HYPERMINUS = 45; // -
- var LESSTHANSIGN = 60; // <
- var GREATERTHANSIGN$2 = 62; // >
- var QUESTIONMARK$1 = 63; // ?
- var COMMERCIALAT = 64; // @
- var LEFTSQUAREBRACKET$4 = 91; // [
- var RIGHTSQUAREBRACKET$2 = 93; // ]
- var LEFTCURLYBRACKET$4 = 123; // {
- var VERTICALLINE$3 = 124; // |
- var RIGHTCURLYBRACKET$2 = 125; // }
- var INFINITY = 8734; // ∞
- var NAME_CHAR = createCharMap(function(ch) {
- return /[a-zA-Z0-9\-]/.test(ch);
- });
- var COMBINATOR_PRECEDENCE = {
- ' ': 1,
- '&&': 2,
- '||': 3,
- '|': 4
- };
- function createCharMap(fn) {
- var array = typeof Uint32Array === 'function' ? new Uint32Array(128) : new Array(128);
- for (var i = 0; i < 128; i++) {
- array[i] = fn(String.fromCharCode(i)) ? 1 : 0;
- }
- return array;
- }
- function scanSpaces(tokenizer) {
- return tokenizer.substringToPos(
- tokenizer.findWsEnd(tokenizer.pos)
- );
- }
- function scanWord(tokenizer) {
- var end = tokenizer.pos;
- for (; end < tokenizer.str.length; end++) {
- var code = tokenizer.str.charCodeAt(end);
- if (code >= 128 || NAME_CHAR[code] === 0) {
- break;
- }
- }
- if (tokenizer.pos === end) {
- tokenizer.error('Expect a keyword');
- }
- return tokenizer.substringToPos(end);
- }
- function scanNumber(tokenizer) {
- var end = tokenizer.pos;
- for (; end < tokenizer.str.length; end++) {
- var code = tokenizer.str.charCodeAt(end);
- if (code < 48 || code > 57) {
- break;
- }
- }
- if (tokenizer.pos === end) {
- tokenizer.error('Expect a number');
- }
- return tokenizer.substringToPos(end);
- }
- function scanString(tokenizer) {
- var end = tokenizer.str.indexOf('\'', tokenizer.pos + 1);
- if (end === -1) {
- tokenizer.pos = tokenizer.str.length;
- tokenizer.error('Expect an apostrophe');
- }
- return tokenizer.substringToPos(end + 1);
- }
- function readMultiplierRange(tokenizer) {
- var min = null;
- var max = null;
- tokenizer.eat(LEFTCURLYBRACKET$4);
- min = scanNumber(tokenizer);
- if (tokenizer.charCode() === COMMA$4) {
- tokenizer.pos++;
- if (tokenizer.charCode() !== RIGHTCURLYBRACKET$2) {
- max = scanNumber(tokenizer);
- }
- } else {
- max = min;
- }
- tokenizer.eat(RIGHTCURLYBRACKET$2);
- return {
- min: Number(min),
- max: max ? Number(max) : 0
- };
- }
- function readMultiplier(tokenizer) {
- var range = null;
- var comma = false;
- switch (tokenizer.charCode()) {
- case ASTERISK$6:
- tokenizer.pos++;
- range = {
- min: 0,
- max: 0
- };
- break;
- case PLUSSIGN$6:
- tokenizer.pos++;
- range = {
- min: 1,
- max: 0
- };
- break;
- case QUESTIONMARK$1:
- tokenizer.pos++;
- range = {
- min: 0,
- max: 1
- };
- break;
- case NUMBERSIGN$4:
- tokenizer.pos++;
- comma = true;
- if (tokenizer.charCode() === LEFTCURLYBRACKET$4) {
- range = readMultiplierRange(tokenizer);
- } else {
- range = {
- min: 1,
- max: 0
- };
- }
- break;
- case LEFTCURLYBRACKET$4:
- range = readMultiplierRange(tokenizer);
- break;
- default:
- return null;
- }
- return {
- type: 'Multiplier',
- comma: comma,
- min: range.min,
- max: range.max,
- term: null
- };
- }
- function maybeMultiplied(tokenizer, node) {
- var multiplier = readMultiplier(tokenizer);
- if (multiplier !== null) {
- multiplier.term = node;
- return multiplier;
- }
- return node;
- }
- function maybeToken(tokenizer) {
- var ch = tokenizer.peek();
- if (ch === '') {
- return null;
- }
- return {
- type: 'Token',
- value: ch
- };
- }
- function readProperty$1(tokenizer) {
- var name;
- tokenizer.eat(LESSTHANSIGN);
- tokenizer.eat(APOSTROPHE);
- name = scanWord(tokenizer);
- tokenizer.eat(APOSTROPHE);
- tokenizer.eat(GREATERTHANSIGN$2);
- return maybeMultiplied(tokenizer, {
- type: 'Property',
- name: name
- });
- }
- // https://drafts.csswg.org/css-values-3/#numeric-ranges
- // 4.1. Range Restrictions and Range Definition Notation
- //
- // Range restrictions can be annotated in the numeric type notation using CSS bracketed
- // range notation—[min,max]—within the angle brackets, after the identifying keyword,
- // indicating a closed range between (and including) min and max.
- // For example, <integer [0, 10]> indicates an integer between 0 and 10, inclusive.
- function readTypeRange(tokenizer) {
- // use null for Infinity to make AST format JSON serializable/deserializable
- var min = null; // -Infinity
- var max = null; // Infinity
- var sign = 1;
- tokenizer.eat(LEFTSQUAREBRACKET$4);
- if (tokenizer.charCode() === HYPERMINUS) {
- tokenizer.peek();
- sign = -1;
- }
- if (sign == -1 && tokenizer.charCode() === INFINITY) {
- tokenizer.peek();
- } else {
- min = sign * Number(scanNumber(tokenizer));
- }
- scanSpaces(tokenizer);
- tokenizer.eat(COMMA$4);
- scanSpaces(tokenizer);
- if (tokenizer.charCode() === INFINITY) {
- tokenizer.peek();
- } else {
- sign = 1;
- if (tokenizer.charCode() === HYPERMINUS) {
- tokenizer.peek();
- sign = -1;
- }
- max = sign * Number(scanNumber(tokenizer));
- }
- tokenizer.eat(RIGHTSQUAREBRACKET$2);
- // If no range is indicated, either by using the bracketed range notation
- // or in the property description, then [−∞,∞] is assumed.
- if (min === null && max === null) {
- return null;
- }
- return {
- type: 'Range',
- min: min,
- max: max
- };
- }
- function readType(tokenizer) {
- var name;
- var opts = null;
- tokenizer.eat(LESSTHANSIGN);
- name = scanWord(tokenizer);
- if (tokenizer.charCode() === LEFTPARENTHESIS$7 &&
- tokenizer.nextCharCode() === RIGHTPARENTHESIS$7) {
- tokenizer.pos += 2;
- name += '()';
- }
- if (tokenizer.charCodeAt(tokenizer.findWsEnd(tokenizer.pos)) === LEFTSQUAREBRACKET$4) {
- scanSpaces(tokenizer);
- opts = readTypeRange(tokenizer);
- }
- tokenizer.eat(GREATERTHANSIGN$2);
- return maybeMultiplied(tokenizer, {
- type: 'Type',
- name: name,
- opts: opts
- });
- }
- function readKeywordOrFunction(tokenizer) {
- var name;
- name = scanWord(tokenizer);
- if (tokenizer.charCode() === LEFTPARENTHESIS$7) {
- tokenizer.pos++;
- return {
- type: 'Function',
- name: name
- };
- }
- return maybeMultiplied(tokenizer, {
- type: 'Keyword',
- name: name
- });
- }
- function regroupTerms(terms, combinators) {
- function createGroup(terms, combinator) {
- return {
- type: 'Group',
- terms: terms,
- combinator: combinator,
- disallowEmpty: false,
- explicit: false
- };
- }
- combinators = Object.keys(combinators).sort(function(a, b) {
- return COMBINATOR_PRECEDENCE[a] - COMBINATOR_PRECEDENCE[b];
- });
- while (combinators.length > 0) {
- var combinator = combinators.shift();
- for (var i = 0, subgroupStart = 0; i < terms.length; i++) {
- var term = terms[i];
- if (term.type === 'Combinator') {
- if (term.value === combinator) {
- if (subgroupStart === -1) {
- subgroupStart = i - 1;
- }
- terms.splice(i, 1);
- i--;
- } else {
- if (subgroupStart !== -1 && i - subgroupStart > 1) {
- terms.splice(
- subgroupStart,
- i - subgroupStart,
- createGroup(terms.slice(subgroupStart, i), combinator)
- );
- i = subgroupStart + 1;
- }
- subgroupStart = -1;
- }
- }
- }
- if (subgroupStart !== -1 && combinators.length) {
- terms.splice(
- subgroupStart,
- i - subgroupStart,
- createGroup(terms.slice(subgroupStart, i), combinator)
- );
- }
- }
- return combinator;
- }
- function readImplicitGroup(tokenizer) {
- var terms = [];
- var combinators = {};
- var token;
- var prevToken = null;
- var prevTokenPos = tokenizer.pos;
- while (token = peek(tokenizer)) {
- if (token.type !== 'Spaces') {
- if (token.type === 'Combinator') {
- // check for combinator in group beginning and double combinator sequence
- if (prevToken === null || prevToken.type === 'Combinator') {
- tokenizer.pos = prevTokenPos;
- tokenizer.error('Unexpected combinator');
- }
- combinators[token.value] = true;
- } else if (prevToken !== null && prevToken.type !== 'Combinator') {
- combinators[' '] = true; // a b
- terms.push({
- type: 'Combinator',
- value: ' '
- });
- }
- terms.push(token);
- prevToken = token;
- prevTokenPos = tokenizer.pos;
- }
- }
- // check for combinator in group ending
- if (prevToken !== null && prevToken.type === 'Combinator') {
- tokenizer.pos -= prevTokenPos;
- tokenizer.error('Unexpected combinator');
- }
- return {
- type: 'Group',
- terms: terms,
- combinator: regroupTerms(terms, combinators) || ' ',
- disallowEmpty: false,
- explicit: false
- };
- }
- function readGroup(tokenizer) {
- var result;
- tokenizer.eat(LEFTSQUAREBRACKET$4);
- result = readImplicitGroup(tokenizer);
- tokenizer.eat(RIGHTSQUAREBRACKET$2);
- result.explicit = true;
- if (tokenizer.charCode() === EXCLAMATIONMARK$3) {
- tokenizer.pos++;
- result.disallowEmpty = true;
- }
- return result;
- }
- function peek(tokenizer) {
- var code = tokenizer.charCode();
- if (code < 128 && NAME_CHAR[code] === 1) {
- return readKeywordOrFunction(tokenizer);
- }
- switch (code) {
- case RIGHTSQUAREBRACKET$2:
- // don't eat, stop scan a group
- break;
- case LEFTSQUAREBRACKET$4:
- return maybeMultiplied(tokenizer, readGroup(tokenizer));
- case LESSTHANSIGN:
- return tokenizer.nextCharCode() === APOSTROPHE
- ? readProperty$1(tokenizer)
- : readType(tokenizer);
- case VERTICALLINE$3:
- return {
- type: 'Combinator',
- value: tokenizer.substringToPos(
- tokenizer.nextCharCode() === VERTICALLINE$3
- ? tokenizer.pos + 2
- : tokenizer.pos + 1
- )
- };
- case AMPERSAND$1:
- tokenizer.pos++;
- tokenizer.eat(AMPERSAND$1);
- return {
- type: 'Combinator',
- value: '&&'
- };
- case COMMA$4:
- tokenizer.pos++;
- return {
- type: 'Comma'
- };
- case APOSTROPHE:
- return maybeMultiplied(tokenizer, {
- type: 'String',
- value: scanString(tokenizer)
- });
- case SPACE$1:
- case TAB:
- case N$2:
- case R$1:
- case F$1:
- return {
- type: 'Spaces',
- value: scanSpaces(tokenizer)
- };
- case COMMERCIALAT:
- code = tokenizer.nextCharCode();
- if (code < 128 && NAME_CHAR[code] === 1) {
- tokenizer.pos++;
- return {
- type: 'AtKeyword',
- name: scanWord(tokenizer)
- };
- }
- return maybeToken(tokenizer);
- case ASTERISK$6:
- case PLUSSIGN$6:
- case QUESTIONMARK$1:
- case NUMBERSIGN$4:
- case EXCLAMATIONMARK$3:
- // prohibited tokens (used as a multiplier start)
- break;
- case LEFTCURLYBRACKET$4:
- // LEFTCURLYBRACKET is allowed since mdn/data uses it w/o quoting
- // check next char isn't a number, because it's likely a disjoined multiplier
- code = tokenizer.nextCharCode();
- if (code < 48 || code > 57) {
- return maybeToken(tokenizer);
- }
- break;
- default:
- return maybeToken(tokenizer);
- }
- }
- function parse$2(source) {
- var tokenizer = new Tokenizer(source);
- var result = readImplicitGroup(tokenizer);
- if (tokenizer.pos !== source.length) {
- tokenizer.error('Unexpected input');
- }
- // reduce redundant groups with single group term
- if (result.terms.length === 1 && result.terms[0].type === 'Group') {
- result = result.terms[0];
- }
- return result;
- }
- // warm up parse to elimitate code branches that never execute
- // fix soft deoptimizations (insufficient type feedback)
- parse$2('[a&&<b>#|<\'c\'>*||e() f{2} /,(% g#{1,2} h{2,})]!');
- var parse_1 = parse$2;
- var noop$2 = function() {};
- function ensureFunction$1(value) {
- return typeof value === 'function' ? value : noop$2;
- }
- var walk$1 = function(node, options, context) {
- function walk(node) {
- enter.call(context, node);
- switch (node.type) {
- case 'Group':
- node.terms.forEach(walk);
- break;
- case 'Multiplier':
- walk(node.term);
- break;
- case 'Type':
- case 'Property':
- case 'Keyword':
- case 'AtKeyword':
- case 'Function':
- case 'String':
- case 'Token':
- case 'Comma':
- break;
- default:
- throw new Error('Unknown type: ' + node.type);
- }
- leave.call(context, node);
- }
- var enter = noop$2;
- var leave = noop$2;
- if (typeof options === 'function') {
- enter = options;
- } else if (options) {
- enter = ensureFunction$1(options.enter);
- leave = ensureFunction$1(options.leave);
- }
- if (enter === noop$2 && leave === noop$2) {
- throw new Error('Neither `enter` nor `leave` walker handler is set or both aren\'t a function');
- }
- walk(node);
- };
- var tokenize$2 = tokenizer$3;
- var TokenStream$2 = TokenStream_1;
- var tokenStream = new TokenStream$2();
- var astToTokens = {
- decorator: function(handlers) {
- var curNode = null;
- var prev = { len: 0, node: null };
- var nodes = [prev];
- var buffer = '';
- return {
- children: handlers.children,
- node: function(node) {
- var tmp = curNode;
- curNode = node;
- handlers.node.call(this, node);
- curNode = tmp;
- },
- chunk: function(chunk) {
- buffer += chunk;
- if (prev.node !== curNode) {
- nodes.push({
- len: chunk.length,
- node: curNode
- });
- } else {
- prev.len += chunk.length;
- }
- },
- result: function() {
- return prepareTokens$1(buffer, nodes);
- }
- };
- }
- };
- function prepareTokens$1(str, nodes) {
- var tokens = [];
- var nodesOffset = 0;
- var nodesIndex = 0;
- var currentNode = nodes ? nodes[nodesIndex].node : null;
- tokenize$2(str, tokenStream);
- while (!tokenStream.eof) {
- if (nodes) {
- while (nodesIndex < nodes.length && nodesOffset + nodes[nodesIndex].len <= tokenStream.tokenStart) {
- nodesOffset += nodes[nodesIndex++].len;
- currentNode = nodes[nodesIndex].node;
- }
- }
- tokens.push({
- type: tokenStream.tokenType,
- value: tokenStream.getTokenValue(),
- index: tokenStream.tokenIndex, // TODO: remove it, temporary solution
- balance: tokenStream.balance[tokenStream.tokenIndex], // TODO: remove it, temporary solution
- node: currentNode
- });
- tokenStream.next();
- // console.log({ ...tokens[tokens.length - 1], node: undefined });
- }
- return tokens;
- }
- var prepareTokens_1 = function(value, syntax) {
- if (typeof value === 'string') {
- return prepareTokens$1(value, null);
- }
- return syntax.generate(value, astToTokens);
- };
- var parse$1 = parse_1;
- var MATCH$1 = { type: 'Match' };
- var MISMATCH$1 = { type: 'Mismatch' };
- var DISALLOW_EMPTY$1 = { type: 'DisallowEmpty' };
- var LEFTPARENTHESIS$6 = 40; // (
- var RIGHTPARENTHESIS$6 = 41; // )
- function createCondition(match, thenBranch, elseBranch) {
- // reduce node count
- if (thenBranch === MATCH$1 && elseBranch === MISMATCH$1) {
- return match;
- }
- if (match === MATCH$1 && thenBranch === MATCH$1 && elseBranch === MATCH$1) {
- return match;
- }
- if (match.type === 'If' && match.else === MISMATCH$1 && thenBranch === MATCH$1) {
- thenBranch = match.then;
- match = match.match;
- }
- return {
- type: 'If',
- match: match,
- then: thenBranch,
- else: elseBranch
- };
- }
- function isFunctionType(name) {
- return (
- name.length > 2 &&
- name.charCodeAt(name.length - 2) === LEFTPARENTHESIS$6 &&
- name.charCodeAt(name.length - 1) === RIGHTPARENTHESIS$6
- );
- }
- function isEnumCapatible(term) {
- return (
- term.type === 'Keyword' ||
- term.type === 'AtKeyword' ||
- term.type === 'Function' ||
- term.type === 'Type' && isFunctionType(term.name)
- );
- }
- function buildGroupMatchGraph(combinator, terms, atLeastOneTermMatched) {
- switch (combinator) {
- case ' ':
- // Juxtaposing components means that all of them must occur, in the given order.
- //
- // a b c
- // =
- // match a
- // then match b
- // then match c
- // then MATCH
- // else MISMATCH
- // else MISMATCH
- // else MISMATCH
- var result = MATCH$1;
- for (var i = terms.length - 1; i >= 0; i--) {
- var term = terms[i];
- result = createCondition(
- term,
- result,
- MISMATCH$1
- );
- }
- return result;
- case '|':
- // A bar (|) separates two or more alternatives: exactly one of them must occur.
- //
- // a | b | c
- // =
- // match a
- // then MATCH
- // else match b
- // then MATCH
- // else match c
- // then MATCH
- // else MISMATCH
- var result = MISMATCH$1;
- var map = null;
- for (var i = terms.length - 1; i >= 0; i--) {
- var term = terms[i];
- // reduce sequence of keywords into a Enum
- if (isEnumCapatible(term)) {
- if (map === null && i > 0 && isEnumCapatible(terms[i - 1])) {
- map = Object.create(null);
- result = createCondition(
- {
- type: 'Enum',
- map: map
- },
- MATCH$1,
- result
- );
- }
- if (map !== null) {
- var key = (isFunctionType(term.name) ? term.name.slice(0, -1) : term.name).toLowerCase();
- if (key in map === false) {
- map[key] = term;
- continue;
- }
- }
- }
- map = null;
- // create a new conditonal node
- result = createCondition(
- term,
- MATCH$1,
- result
- );
- }
- return result;
- case '&&':
- // A double ampersand (&&) separates two or more components,
- // all of which must occur, in any order.
- // Use MatchOnce for groups with a large number of terms,
- // since &&-groups produces at least N!-node trees
- if (terms.length > 5) {
- return {
- type: 'MatchOnce',
- terms: terms,
- all: true
- };
- }
- // Use a combination tree for groups with small number of terms
- //
- // a && b && c
- // =
- // match a
- // then [b && c]
- // else match b
- // then [a && c]
- // else match c
- // then [a && b]
- // else MISMATCH
- //
- // a && b
- // =
- // match a
- // then match b
- // then MATCH
- // else MISMATCH
- // else match b
- // then match a
- // then MATCH
- // else MISMATCH
- // else MISMATCH
- var result = MISMATCH$1;
- for (var i = terms.length - 1; i >= 0; i--) {
- var term = terms[i];
- var thenClause;
- if (terms.length > 1) {
- thenClause = buildGroupMatchGraph(
- combinator,
- terms.filter(function(newGroupTerm) {
- return newGroupTerm !== term;
- }),
- false
- );
- } else {
- thenClause = MATCH$1;
- }
- result = createCondition(
- term,
- thenClause,
- result
- );
- }
- return result;
- case '||':
- // A double bar (||) separates two or more options:
- // one or more of them must occur, in any order.
- // Use MatchOnce for groups with a large number of terms,
- // since ||-groups produces at least N!-node trees
- if (terms.length > 5) {
- return {
- type: 'MatchOnce',
- terms: terms,
- all: false
- };
- }
- // Use a combination tree for groups with small number of terms
- //
- // a || b || c
- // =
- // match a
- // then [b || c]
- // else match b
- // then [a || c]
- // else match c
- // then [a || b]
- // else MISMATCH
- //
- // a || b
- // =
- // match a
- // then match b
- // then MATCH
- // else MATCH
- // else match b
- // then match a
- // then MATCH
- // else MATCH
- // else MISMATCH
- var result = atLeastOneTermMatched ? MATCH$1 : MISMATCH$1;
- for (var i = terms.length - 1; i >= 0; i--) {
- var term = terms[i];
- var thenClause;
- if (terms.length > 1) {
- thenClause = buildGroupMatchGraph(
- combinator,
- terms.filter(function(newGroupTerm) {
- return newGroupTerm !== term;
- }),
- true
- );
- } else {
- thenClause = MATCH$1;
- }
- result = createCondition(
- term,
- thenClause,
- result
- );
- }
- return result;
- }
- }
- function buildMultiplierMatchGraph(node) {
- var result = MATCH$1;
- var matchTerm = buildMatchGraph$1(node.term);
- if (node.max === 0) {
- // disable repeating of empty match to prevent infinite loop
- matchTerm = createCondition(
- matchTerm,
- DISALLOW_EMPTY$1,
- MISMATCH$1
- );
- // an occurrence count is not limited, make a cycle;
- // to collect more terms on each following matching mismatch
- result = createCondition(
- matchTerm,
- null, // will be a loop
- MISMATCH$1
- );
- result.then = createCondition(
- MATCH$1,
- MATCH$1,
- result // make a loop
- );
- if (node.comma) {
- result.then.else = createCondition(
- { type: 'Comma', syntax: node },
- result,
- MISMATCH$1
- );
- }
- } else {
- // create a match node chain for [min .. max] interval with optional matches
- for (var i = node.min || 1; i <= node.max; i++) {
- if (node.comma && result !== MATCH$1) {
- result = createCondition(
- { type: 'Comma', syntax: node },
- result,
- MISMATCH$1
- );
- }
- result = createCondition(
- matchTerm,
- createCondition(
- MATCH$1,
- MATCH$1,
- result
- ),
- MISMATCH$1
- );
- }
- }
- if (node.min === 0) {
- // allow zero match
- result = createCondition(
- MATCH$1,
- MATCH$1,
- result
- );
- } else {
- // create a match node chain to collect [0 ... min - 1] required matches
- for (var i = 0; i < node.min - 1; i++) {
- if (node.comma && result !== MATCH$1) {
- result = createCondition(
- { type: 'Comma', syntax: node },
- result,
- MISMATCH$1
- );
- }
- result = createCondition(
- matchTerm,
- result,
- MISMATCH$1
- );
- }
- }
- return result;
- }
- function buildMatchGraph$1(node) {
- if (typeof node === 'function') {
- return {
- type: 'Generic',
- fn: node
- };
- }
- switch (node.type) {
- case 'Group':
- var result = buildGroupMatchGraph(
- node.combinator,
- node.terms.map(buildMatchGraph$1),
- false
- );
- if (node.disallowEmpty) {
- result = createCondition(
- result,
- DISALLOW_EMPTY$1,
- MISMATCH$1
- );
- }
- return result;
- case 'Multiplier':
- return buildMultiplierMatchGraph(node);
- case 'Type':
- case 'Property':
- return {
- type: node.type,
- name: node.name,
- syntax: node
- };
- case 'Keyword':
- return {
- type: node.type,
- name: node.name.toLowerCase(),
- syntax: node
- };
- case 'AtKeyword':
- return {
- type: node.type,
- name: '@' + node.name.toLowerCase(),
- syntax: node
- };
- case 'Function':
- return {
- type: node.type,
- name: node.name.toLowerCase() + '(',
- syntax: node
- };
- case 'String':
- // convert a one char length String to a Token
- if (node.value.length === 3) {
- return {
- type: 'Token',
- value: node.value.charAt(1),
- syntax: node
- };
- }
- // otherwise use it as is
- return {
- type: node.type,
- value: node.value.substr(1, node.value.length - 2).replace(/\\'/g, '\''),
- syntax: node
- };
- case 'Token':
- return {
- type: node.type,
- value: node.value,
- syntax: node
- };
- case 'Comma':
- return {
- type: node.type,
- syntax: node
- };
- default:
- throw new Error('Unknown node type:', node.type);
- }
- }
- var matchGraph$1 = {
- MATCH: MATCH$1,
- MISMATCH: MISMATCH$1,
- DISALLOW_EMPTY: DISALLOW_EMPTY$1,
- buildMatchGraph: function(syntaxTree, ref) {
- if (typeof syntaxTree === 'string') {
- syntaxTree = parse$1(syntaxTree);
- }
- return {
- type: 'MatchGraph',
- match: buildMatchGraph$1(syntaxTree),
- syntax: ref || null,
- source: syntaxTree
- };
- }
- };
- var hasOwnProperty$6 = Object.prototype.hasOwnProperty;
- var matchGraph = matchGraph$1;
- var MATCH = matchGraph.MATCH;
- var MISMATCH = matchGraph.MISMATCH;
- var DISALLOW_EMPTY = matchGraph.DISALLOW_EMPTY;
- var TYPE$B = _const.TYPE;
- var STUB = 0;
- var TOKEN = 1;
- var OPEN_SYNTAX = 2;
- var CLOSE_SYNTAX = 3;
- var EXIT_REASON_MATCH = 'Match';
- var EXIT_REASON_MISMATCH = 'Mismatch';
- var EXIT_REASON_ITERATION_LIMIT = 'Maximum iteration number exceeded (please fill an issue on https://github.com/csstree/csstree/issues)';
- var ITERATION_LIMIT = 15000;
- var totalIterationCount = 0;
- function reverseList(list) {
- var prev = null;
- var next = null;
- var item = list;
- while (item !== null) {
- next = item.prev;
- item.prev = prev;
- prev = item;
- item = next;
- }
- return prev;
- }
- function areStringsEqualCaseInsensitive(testStr, referenceStr) {
- if (testStr.length !== referenceStr.length) {
- return false;
- }
- for (var i = 0; i < testStr.length; i++) {
- var testCode = testStr.charCodeAt(i);
- var referenceCode = referenceStr.charCodeAt(i);
- // testCode.toLowerCase() for U+0041 LATIN CAPITAL LETTER A (A) .. U+005A LATIN CAPITAL LETTER Z (Z).
- if (testCode >= 0x0041 && testCode <= 0x005A) {
- testCode = testCode | 32;
- }
- if (testCode !== referenceCode) {
- return false;
- }
- }
- return true;
- }
- function isContextEdgeDelim(token) {
- if (token.type !== TYPE$B.Delim) {
- return false;
- }
- // Fix matching for unicode-range: U+30??, U+FF00-FF9F
- // Probably we need to check out previous match instead
- return token.value !== '?';
- }
- function isCommaContextStart(token) {
- if (token === null) {
- return true;
- }
- return (
- token.type === TYPE$B.Comma ||
- token.type === TYPE$B.Function ||
- token.type === TYPE$B.LeftParenthesis ||
- token.type === TYPE$B.LeftSquareBracket ||
- token.type === TYPE$B.LeftCurlyBracket ||
- isContextEdgeDelim(token)
- );
- }
- function isCommaContextEnd(token) {
- if (token === null) {
- return true;
- }
- return (
- token.type === TYPE$B.RightParenthesis ||
- token.type === TYPE$B.RightSquareBracket ||
- token.type === TYPE$B.RightCurlyBracket ||
- token.type === TYPE$B.Delim
- );
- }
- function internalMatch(tokens, state, syntaxes) {
- function moveToNextToken() {
- do {
- tokenIndex++;
- token = tokenIndex < tokens.length ? tokens[tokenIndex] : null;
- } while (token !== null && (token.type === TYPE$B.WhiteSpace || token.type === TYPE$B.Comment));
- }
- function getNextToken(offset) {
- var nextIndex = tokenIndex + offset;
- return nextIndex < tokens.length ? tokens[nextIndex] : null;
- }
- function stateSnapshotFromSyntax(nextState, prev) {
- return {
- nextState: nextState,
- matchStack: matchStack,
- syntaxStack: syntaxStack,
- thenStack: thenStack,
- tokenIndex: tokenIndex,
- prev: prev
- };
- }
- function pushThenStack(nextState) {
- thenStack = {
- nextState: nextState,
- matchStack: matchStack,
- syntaxStack: syntaxStack,
- prev: thenStack
- };
- }
- function pushElseStack(nextState) {
- elseStack = stateSnapshotFromSyntax(nextState, elseStack);
- }
- function addTokenToMatch() {
- matchStack = {
- type: TOKEN,
- syntax: state.syntax,
- token: token,
- prev: matchStack
- };
- moveToNextToken();
- syntaxStash = null;
- if (tokenIndex > longestMatch) {
- longestMatch = tokenIndex;
- }
- }
- function openSyntax() {
- syntaxStack = {
- syntax: state.syntax,
- opts: state.syntax.opts || (syntaxStack !== null && syntaxStack.opts) || null,
- prev: syntaxStack
- };
- matchStack = {
- type: OPEN_SYNTAX,
- syntax: state.syntax,
- token: matchStack.token,
- prev: matchStack
- };
- }
- function closeSyntax() {
- if (matchStack.type === OPEN_SYNTAX) {
- matchStack = matchStack.prev;
- } else {
- matchStack = {
- type: CLOSE_SYNTAX,
- syntax: syntaxStack.syntax,
- token: matchStack.token,
- prev: matchStack
- };
- }
- syntaxStack = syntaxStack.prev;
- }
- var syntaxStack = null;
- var thenStack = null;
- var elseStack = null;
- // null – stashing allowed, nothing stashed
- // false – stashing disabled, nothing stashed
- // anithing else – fail stashable syntaxes, some syntax stashed
- var syntaxStash = null;
- var iterationCount = 0; // count iterations and prevent infinite loop
- var exitReason = null;
- var token = null;
- var tokenIndex = -1;
- var longestMatch = 0;
- var matchStack = {
- type: STUB,
- syntax: null,
- token: null,
- prev: null
- };
- moveToNextToken();
- while (exitReason === null && ++iterationCount < ITERATION_LIMIT) {
- // function mapList(list, fn) {
- // var result = [];
- // while (list) {
- // result.unshift(fn(list));
- // list = list.prev;
- // }
- // return result;
- // }
- // console.log('--\n',
- // '#' + iterationCount,
- // require('util').inspect({
- // match: mapList(matchStack, x => x.type === TOKEN ? x.token && x.token.value : x.syntax ? ({ [OPEN_SYNTAX]: '<', [CLOSE_SYNTAX]: '</' }[x.type] || x.type) + '!' + x.syntax.name : null),
- // token: token && token.value,
- // tokenIndex,
- // syntax: syntax.type + (syntax.id ? ' #' + syntax.id : '')
- // }, { depth: null })
- // );
- switch (state.type) {
- case 'Match':
- if (thenStack === null) {
- // turn to MISMATCH when some tokens left unmatched
- if (token !== null) {
- // doesn't mismatch if just one token left and it's an IE hack
- if (tokenIndex !== tokens.length - 1 || (token.value !== '\\0' && token.value !== '\\9')) {
- state = MISMATCH;
- break;
- }
- }
- // break the main loop, return a result - MATCH
- exitReason = EXIT_REASON_MATCH;
- break;
- }
- // go to next syntax (`then` branch)
- state = thenStack.nextState;
- // check match is not empty
- if (state === DISALLOW_EMPTY) {
- if (thenStack.matchStack === matchStack) {
- state = MISMATCH;
- break;
- } else {
- state = MATCH;
- }
- }
- // close syntax if needed
- while (thenStack.syntaxStack !== syntaxStack) {
- closeSyntax();
- }
- // pop stack
- thenStack = thenStack.prev;
- break;
- case 'Mismatch':
- // when some syntax is stashed
- if (syntaxStash !== null && syntaxStash !== false) {
- // there is no else branches or a branch reduce match stack
- if (elseStack === null || tokenIndex > elseStack.tokenIndex) {
- // restore state from the stash
- elseStack = syntaxStash;
- syntaxStash = false; // disable stashing
- }
- } else if (elseStack === null) {
- // no else branches -> break the main loop
- // return a result - MISMATCH
- exitReason = EXIT_REASON_MISMATCH;
- break;
- }
- // go to next syntax (`else` branch)
- state = elseStack.nextState;
- // restore all the rest stack states
- thenStack = elseStack.thenStack;
- syntaxStack = elseStack.syntaxStack;
- matchStack = elseStack.matchStack;
- tokenIndex = elseStack.tokenIndex;
- token = tokenIndex < tokens.length ? tokens[tokenIndex] : null;
- // pop stack
- elseStack = elseStack.prev;
- break;
- case 'MatchGraph':
- state = state.match;
- break;
- case 'If':
- // IMPORTANT: else stack push must go first,
- // since it stores the state of thenStack before changes
- if (state.else !== MISMATCH) {
- pushElseStack(state.else);
- }
- if (state.then !== MATCH) {
- pushThenStack(state.then);
- }
- state = state.match;
- break;
- case 'MatchOnce':
- state = {
- type: 'MatchOnceBuffer',
- syntax: state,
- index: 0,
- mask: 0
- };
- break;
- case 'MatchOnceBuffer':
- var terms = state.syntax.terms;
- if (state.index === terms.length) {
- // no matches at all or it's required all terms to be matched
- if (state.mask === 0 || state.syntax.all) {
- state = MISMATCH;
- break;
- }
- // a partial match is ok
- state = MATCH;
- break;
- }
- // all terms are matched
- if (state.mask === (1 << terms.length) - 1) {
- state = MATCH;
- break;
- }
- for (; state.index < terms.length; state.index++) {
- var matchFlag = 1 << state.index;
- if ((state.mask & matchFlag) === 0) {
- // IMPORTANT: else stack push must go first,
- // since it stores the state of thenStack before changes
- pushElseStack(state);
- pushThenStack({
- type: 'AddMatchOnce',
- syntax: state.syntax,
- mask: state.mask | matchFlag
- });
- // match
- state = terms[state.index++];
- break;
- }
- }
- break;
- case 'AddMatchOnce':
- state = {
- type: 'MatchOnceBuffer',
- syntax: state.syntax,
- index: 0,
- mask: state.mask
- };
- break;
- case 'Enum':
- if (token !== null) {
- var name = token.value.toLowerCase();
- // drop \0 and \9 hack from keyword name
- if (name.indexOf('\\') !== -1) {
- name = name.replace(/\\[09].*$/, '');
- }
- if (hasOwnProperty$6.call(state.map, name)) {
- state = state.map[name];
- break;
- }
- }
- state = MISMATCH;
- break;
- case 'Generic':
- var opts = syntaxStack !== null ? syntaxStack.opts : null;
- var lastTokenIndex = tokenIndex + Math.floor(state.fn(token, getNextToken, opts));
- if (!isNaN(lastTokenIndex) && lastTokenIndex > tokenIndex) {
- while (tokenIndex < lastTokenIndex) {
- addTokenToMatch();
- }
- state = MATCH;
- } else {
- state = MISMATCH;
- }
- break;
- case 'Type':
- case 'Property':
- var syntaxDict = state.type === 'Type' ? 'types' : 'properties';
- var dictSyntax = hasOwnProperty$6.call(syntaxes, syntaxDict) ? syntaxes[syntaxDict][state.name] : null;
- if (!dictSyntax || !dictSyntax.match) {
- throw new Error(
- 'Bad syntax reference: ' +
- (state.type === 'Type'
- ? '<' + state.name + '>'
- : '<\'' + state.name + '\'>')
- );
- }
- // stash a syntax for types with low priority
- if (syntaxStash !== false && token !== null && state.type === 'Type') {
- var lowPriorityMatching =
- // https://drafts.csswg.org/css-values-4/#custom-idents
- // When parsing positionally-ambiguous keywords in a property value, a <custom-ident> production
- // can only claim the keyword if no other unfulfilled production can claim it.
- (state.name === 'custom-ident' && token.type === TYPE$B.Ident) ||
- // https://drafts.csswg.org/css-values-4/#lengths
- // ... if a `0` could be parsed as either a <number> or a <length> in a property (such as line-height),
- // it must parse as a <number>
- (state.name === 'length' && token.value === '0');
- if (lowPriorityMatching) {
- if (syntaxStash === null) {
- syntaxStash = stateSnapshotFromSyntax(state, elseStack);
- }
- state = MISMATCH;
- break;
- }
- }
- openSyntax();
- state = dictSyntax.match;
- break;
- case 'Keyword':
- var name = state.name;
- if (token !== null) {
- var keywordName = token.value;
- // drop \0 and \9 hack from keyword name
- if (keywordName.indexOf('\\') !== -1) {
- keywordName = keywordName.replace(/\\[09].*$/, '');
- }
- if (areStringsEqualCaseInsensitive(keywordName, name)) {
- addTokenToMatch();
- state = MATCH;
- break;
- }
- }
- state = MISMATCH;
- break;
- case 'AtKeyword':
- case 'Function':
- if (token !== null && areStringsEqualCaseInsensitive(token.value, state.name)) {
- addTokenToMatch();
- state = MATCH;
- break;
- }
- state = MISMATCH;
- break;
- case 'Token':
- if (token !== null && token.value === state.value) {
- addTokenToMatch();
- state = MATCH;
- break;
- }
- state = MISMATCH;
- break;
- case 'Comma':
- if (token !== null && token.type === TYPE$B.Comma) {
- if (isCommaContextStart(matchStack.token)) {
- state = MISMATCH;
- } else {
- addTokenToMatch();
- state = isCommaContextEnd(token) ? MISMATCH : MATCH;
- }
- } else {
- state = isCommaContextStart(matchStack.token) || isCommaContextEnd(token) ? MATCH : MISMATCH;
- }
- break;
- case 'String':
- var string = '';
- for (var lastTokenIndex = tokenIndex; lastTokenIndex < tokens.length && string.length < state.value.length; lastTokenIndex++) {
- string += tokens[lastTokenIndex].value;
- }
- if (areStringsEqualCaseInsensitive(string, state.value)) {
- while (tokenIndex < lastTokenIndex) {
- addTokenToMatch();
- }
- state = MATCH;
- } else {
- state = MISMATCH;
- }
- break;
- default:
- throw new Error('Unknown node type: ' + state.type);
- }
- }
- totalIterationCount += iterationCount;
- switch (exitReason) {
- case null:
- console.warn('[csstree-match] BREAK after ' + ITERATION_LIMIT + ' iterations');
- exitReason = EXIT_REASON_ITERATION_LIMIT;
- matchStack = null;
- break;
- case EXIT_REASON_MATCH:
- while (syntaxStack !== null) {
- closeSyntax();
- }
- break;
- default:
- matchStack = null;
- }
- return {
- tokens: tokens,
- reason: exitReason,
- iterations: iterationCount,
- match: matchStack,
- longestMatch: longestMatch
- };
- }
- function matchAsList(tokens, matchGraph, syntaxes) {
- var matchResult = internalMatch(tokens, matchGraph, syntaxes || {});
- if (matchResult.match !== null) {
- var item = reverseList(matchResult.match).prev;
- matchResult.match = [];
- while (item !== null) {
- switch (item.type) {
- case STUB:
- break;
- case OPEN_SYNTAX:
- case CLOSE_SYNTAX:
- matchResult.match.push({
- type: item.type,
- syntax: item.syntax
- });
- break;
- default:
- matchResult.match.push({
- token: item.token.value,
- node: item.token.node
- });
- break;
- }
- item = item.prev;
- }
- }
- return matchResult;
- }
- function matchAsTree$1(tokens, matchGraph, syntaxes) {
- var matchResult = internalMatch(tokens, matchGraph, syntaxes || {});
- if (matchResult.match === null) {
- return matchResult;
- }
- var item = matchResult.match;
- var host = matchResult.match = {
- syntax: matchGraph.syntax || null,
- match: []
- };
- var hostStack = [host];
- // revert a list and start with 2nd item since 1st is a stub item
- item = reverseList(item).prev;
- // build a tree
- while (item !== null) {
- switch (item.type) {
- case OPEN_SYNTAX:
- host.match.push(host = {
- syntax: item.syntax,
- match: []
- });
- hostStack.push(host);
- break;
- case CLOSE_SYNTAX:
- hostStack.pop();
- host = hostStack[hostStack.length - 1];
- break;
- default:
- host.match.push({
- syntax: item.syntax || null,
- token: item.token.value,
- node: item.token.node
- });
- }
- item = item.prev;
- }
- return matchResult;
- }
- var match = {
- matchAsList: matchAsList,
- matchAsTree: matchAsTree$1,
- getTotalIterationCount: function() {
- return totalIterationCount;
- }
- };
- function getTrace(node) {
- function shouldPutToTrace(syntax) {
- if (syntax === null) {
- return false;
- }
- return (
- syntax.type === 'Type' ||
- syntax.type === 'Property' ||
- syntax.type === 'Keyword'
- );
- }
- function hasMatch(matchNode) {
- if (Array.isArray(matchNode.match)) {
- // use for-loop for better perfomance
- for (var i = 0; i < matchNode.match.length; i++) {
- if (hasMatch(matchNode.match[i])) {
- if (shouldPutToTrace(matchNode.syntax)) {
- result.unshift(matchNode.syntax);
- }
- return true;
- }
- }
- } else if (matchNode.node === node) {
- result = shouldPutToTrace(matchNode.syntax)
- ? [matchNode.syntax]
- : [];
- return true;
- }
- return false;
- }
- var result = null;
- if (this.matched !== null) {
- hasMatch(this.matched);
- }
- return result;
- }
- function testNode(match, node, fn) {
- var trace = getTrace.call(match, node);
- if (trace === null) {
- return false;
- }
- return trace.some(fn);
- }
- function isType(node, type) {
- return testNode(this, node, function(matchNode) {
- return matchNode.type === 'Type' && matchNode.name === type;
- });
- }
- function isProperty(node, property) {
- return testNode(this, node, function(matchNode) {
- return matchNode.type === 'Property' && matchNode.name === property;
- });
- }
- function isKeyword(node) {
- return testNode(this, node, function(matchNode) {
- return matchNode.type === 'Keyword';
- });
- }
- var trace$1 = {
- getTrace: getTrace,
- isType: isType,
- isProperty: isProperty,
- isKeyword: isKeyword
- };
- var List$5 = List_1;
- function getFirstMatchNode(matchNode) {
- if ('node' in matchNode) {
- return matchNode.node;
- }
- return getFirstMatchNode(matchNode.match[0]);
- }
- function getLastMatchNode(matchNode) {
- if ('node' in matchNode) {
- return matchNode.node;
- }
- return getLastMatchNode(matchNode.match[matchNode.match.length - 1]);
- }
- function matchFragments(lexer, ast, match, type, name) {
- function findFragments(matchNode) {
- if (matchNode.syntax !== null &&
- matchNode.syntax.type === type &&
- matchNode.syntax.name === name) {
- var start = getFirstMatchNode(matchNode);
- var end = getLastMatchNode(matchNode);
- lexer.syntax.walk(ast, function(node, item, list) {
- if (node === start) {
- var nodes = new List$5();
- do {
- nodes.appendData(item.data);
- if (item.data === end) {
- break;
- }
- item = item.next;
- } while (item !== null);
- fragments.push({
- parent: list,
- nodes: nodes
- });
- }
- });
- }
- if (Array.isArray(matchNode.match)) {
- matchNode.match.forEach(findFragments);
- }
- }
- var fragments = [];
- if (match.matched !== null) {
- findFragments(match.matched);
- }
- return fragments;
- }
- var search$1 = {
- matchFragments: matchFragments
- };
- var List$4 = List_1;
- var hasOwnProperty$5 = Object.prototype.hasOwnProperty;
- function isValidNumber(value) {
- // Number.isInteger(value) && value >= 0
- return (
- typeof value === 'number' &&
- isFinite(value) &&
- Math.floor(value) === value &&
- value >= 0
- );
- }
- function isValidLocation(loc) {
- return (
- Boolean(loc) &&
- isValidNumber(loc.offset) &&
- isValidNumber(loc.line) &&
- isValidNumber(loc.column)
- );
- }
- function createNodeStructureChecker(type, fields) {
- return function checkNode(node, warn) {
- if (!node || node.constructor !== Object) {
- return warn(node, 'Type of node should be an Object');
- }
- for (var key in node) {
- var valid = true;
- if (hasOwnProperty$5.call(node, key) === false) {
- continue;
- }
- if (key === 'type') {
- if (node.type !== type) {
- warn(node, 'Wrong node type `' + node.type + '`, expected `' + type + '`');
- }
- } else if (key === 'loc') {
- if (node.loc === null) {
- continue;
- } else if (node.loc && node.loc.constructor === Object) {
- if (typeof node.loc.source !== 'string') {
- key += '.source';
- } else if (!isValidLocation(node.loc.start)) {
- key += '.start';
- } else if (!isValidLocation(node.loc.end)) {
- key += '.end';
- } else {
- continue;
- }
- }
- valid = false;
- } else if (fields.hasOwnProperty(key)) {
- for (var i = 0, valid = false; !valid && i < fields[key].length; i++) {
- var fieldType = fields[key][i];
- switch (fieldType) {
- case String:
- valid = typeof node[key] === 'string';
- break;
- case Boolean:
- valid = typeof node[key] === 'boolean';
- break;
- case null:
- valid = node[key] === null;
- break;
- default:
- if (typeof fieldType === 'string') {
- valid = node[key] && node[key].type === fieldType;
- } else if (Array.isArray(fieldType)) {
- valid = node[key] instanceof List$4;
- }
- }
- }
- } else {
- warn(node, 'Unknown field `' + key + '` for ' + type + ' node type');
- }
- if (!valid) {
- warn(node, 'Bad value for `' + type + '.' + key + '`');
- }
- }
- for (var key in fields) {
- if (hasOwnProperty$5.call(fields, key) &&
- hasOwnProperty$5.call(node, key) === false) {
- warn(node, 'Field `' + type + '.' + key + '` is missed');
- }
- }
- };
- }
- function processStructure(name, nodeType) {
- var structure = nodeType.structure;
- var fields = {
- type: String,
- loc: true
- };
- var docs = {
- type: '"' + name + '"'
- };
- for (var key in structure) {
- if (hasOwnProperty$5.call(structure, key) === false) {
- continue;
- }
- var docsTypes = [];
- var fieldTypes = fields[key] = Array.isArray(structure[key])
- ? structure[key].slice()
- : [structure[key]];
- for (var i = 0; i < fieldTypes.length; i++) {
- var fieldType = fieldTypes[i];
- if (fieldType === String || fieldType === Boolean) {
- docsTypes.push(fieldType.name);
- } else if (fieldType === null) {
- docsTypes.push('null');
- } else if (typeof fieldType === 'string') {
- docsTypes.push('<' + fieldType + '>');
- } else if (Array.isArray(fieldType)) {
- docsTypes.push('List'); // TODO: use type enum
- } else {
- throw new Error('Wrong value `' + fieldType + '` in `' + name + '.' + key + '` structure definition');
- }
- }
- docs[key] = docsTypes.join(' | ');
- }
- return {
- docs: docs,
- check: createNodeStructureChecker(name, fields)
- };
- }
- var structure = {
- getStructureFromConfig: function(config) {
- var structure = {};
- if (config.node) {
- for (var name in config.node) {
- if (hasOwnProperty$5.call(config.node, name)) {
- var nodeType = config.node[name];
- if (nodeType.structure) {
- structure[name] = processStructure(name, nodeType);
- } else {
- throw new Error('Missed `structure` field in `' + name + '` node type definition');
- }
- }
- }
- }
- return structure;
- }
- };
- var SyntaxReferenceError = error.SyntaxReferenceError;
- var SyntaxMatchError = error.SyntaxMatchError;
- var names$1 = names$2;
- var generic = generic$1;
- var parse = parse_1;
- var generate = generate_1;
- var walk = walk$1;
- var prepareTokens = prepareTokens_1;
- var buildMatchGraph = matchGraph$1.buildMatchGraph;
- var matchAsTree = match.matchAsTree;
- var trace = trace$1;
- var search = search$1;
- var getStructureFromConfig = structure.getStructureFromConfig;
- var cssWideKeywords = buildMatchGraph('inherit | initial | unset');
- var cssWideKeywordsWithExpression = buildMatchGraph('inherit | initial | unset | <-ms-legacy-expression>');
- function dumpMapSyntax(map, compact, syntaxAsAst) {
- var result = {};
- for (var name in map) {
- if (map[name].syntax) {
- result[name] = syntaxAsAst
- ? map[name].syntax
- : generate(map[name].syntax, { compact: compact });
- }
- }
- return result;
- }
- function dumpAtruleMapSyntax(map, compact, syntaxAsAst) {
- const result = {};
- for (const [name, atrule] of Object.entries(map)) {
- result[name] = {
- prelude: atrule.prelude && (
- syntaxAsAst
- ? atrule.prelude.syntax
- : generate(atrule.prelude.syntax, { compact })
- ),
- descriptors: atrule.descriptors && dumpMapSyntax(atrule.descriptors, compact, syntaxAsAst)
- };
- }
- return result;
- }
- function valueHasVar(tokens) {
- for (var i = 0; i < tokens.length; i++) {
- if (tokens[i].value.toLowerCase() === 'var(') {
- return true;
- }
- }
- return false;
- }
- function buildMatchResult(match, error, iterations) {
- return {
- matched: match,
- iterations: iterations,
- error: error,
- getTrace: trace.getTrace,
- isType: trace.isType,
- isProperty: trace.isProperty,
- isKeyword: trace.isKeyword
- };
- }
- function matchSyntax(lexer, syntax, value, useCommon) {
- var tokens = prepareTokens(value, lexer.syntax);
- var result;
- if (valueHasVar(tokens)) {
- return buildMatchResult(null, new Error('Matching for a tree with var() is not supported'));
- }
- if (useCommon) {
- result = matchAsTree(tokens, lexer.valueCommonSyntax, lexer);
- }
- if (!useCommon || !result.match) {
- result = matchAsTree(tokens, syntax.match, lexer);
- if (!result.match) {
- return buildMatchResult(
- null,
- new SyntaxMatchError(result.reason, syntax.syntax, value, result),
- result.iterations
- );
- }
- }
- return buildMatchResult(result.match, null, result.iterations);
- }
- var Lexer$1 = function(config, syntax, structure) {
- this.valueCommonSyntax = cssWideKeywords;
- this.syntax = syntax;
- this.generic = false;
- this.atrules = {};
- this.properties = {};
- this.types = {};
- this.structure = structure || getStructureFromConfig(config);
- if (config) {
- if (config.types) {
- for (var name in config.types) {
- this.addType_(name, config.types[name]);
- }
- }
- if (config.generic) {
- this.generic = true;
- for (var name in generic) {
- this.addType_(name, generic[name]);
- }
- }
- if (config.atrules) {
- for (var name in config.atrules) {
- this.addAtrule_(name, config.atrules[name]);
- }
- }
- if (config.properties) {
- for (var name in config.properties) {
- this.addProperty_(name, config.properties[name]);
- }
- }
- }
- };
- Lexer$1.prototype = {
- structure: {},
- checkStructure: function(ast) {
- function collectWarning(node, message) {
- warns.push({
- node: node,
- message: message
- });
- }
- var structure = this.structure;
- var warns = [];
- this.syntax.walk(ast, function(node) {
- if (structure.hasOwnProperty(node.type)) {
- structure[node.type].check(node, collectWarning);
- } else {
- collectWarning(node, 'Unknown node type `' + node.type + '`');
- }
- });
- return warns.length ? warns : false;
- },
- createDescriptor: function(syntax, type, name, parent = null) {
- var ref = {
- type: type,
- name: name
- };
- var descriptor = {
- type: type,
- name: name,
- parent: parent,
- syntax: null,
- match: null
- };
- if (typeof syntax === 'function') {
- descriptor.match = buildMatchGraph(syntax, ref);
- } else {
- if (typeof syntax === 'string') {
- // lazy parsing on first access
- Object.defineProperty(descriptor, 'syntax', {
- get: function() {
- Object.defineProperty(descriptor, 'syntax', {
- value: parse(syntax)
- });
- return descriptor.syntax;
- }
- });
- } else {
- descriptor.syntax = syntax;
- }
- // lazy graph build on first access
- Object.defineProperty(descriptor, 'match', {
- get: function() {
- Object.defineProperty(descriptor, 'match', {
- value: buildMatchGraph(descriptor.syntax, ref)
- });
- return descriptor.match;
- }
- });
- }
- return descriptor;
- },
- addAtrule_: function(name, syntax) {
- if (!syntax) {
- return;
- }
- this.atrules[name] = {
- type: 'Atrule',
- name: name,
- prelude: syntax.prelude ? this.createDescriptor(syntax.prelude, 'AtrulePrelude', name) : null,
- descriptors: syntax.descriptors
- ? Object.keys(syntax.descriptors).reduce((res, descName) => {
- res[descName] = this.createDescriptor(syntax.descriptors[descName], 'AtruleDescriptor', descName, name);
- return res;
- }, {})
- : null
- };
- },
- addProperty_: function(name, syntax) {
- if (!syntax) {
- return;
- }
- this.properties[name] = this.createDescriptor(syntax, 'Property', name);
- },
- addType_: function(name, syntax) {
- if (!syntax) {
- return;
- }
- this.types[name] = this.createDescriptor(syntax, 'Type', name);
- if (syntax === generic['-ms-legacy-expression']) {
- this.valueCommonSyntax = cssWideKeywordsWithExpression;
- }
- },
- checkAtruleName: function(atruleName) {
- if (!this.getAtrule(atruleName)) {
- return new SyntaxReferenceError('Unknown at-rule', '@' + atruleName);
- }
- },
- checkAtrulePrelude: function(atruleName, prelude) {
- let error = this.checkAtruleName(atruleName);
- if (error) {
- return error;
- }
- var atrule = this.getAtrule(atruleName);
- if (!atrule.prelude && prelude) {
- return new SyntaxError('At-rule `@' + atruleName + '` should not contain a prelude');
- }
- if (atrule.prelude && !prelude) {
- return new SyntaxError('At-rule `@' + atruleName + '` should contain a prelude');
- }
- },
- checkAtruleDescriptorName: function(atruleName, descriptorName) {
- let error = this.checkAtruleName(atruleName);
- if (error) {
- return error;
- }
- var atrule = this.getAtrule(atruleName);
- var descriptor = names$1.keyword(descriptorName);
- if (!atrule.descriptors) {
- return new SyntaxError('At-rule `@' + atruleName + '` has no known descriptors');
- }
- if (!atrule.descriptors[descriptor.name] &&
- !atrule.descriptors[descriptor.basename]) {
- return new SyntaxReferenceError('Unknown at-rule descriptor', descriptorName);
- }
- },
- checkPropertyName: function(propertyName) {
- var property = names$1.property(propertyName);
- // don't match syntax for a custom property
- if (property.custom) {
- return new Error('Lexer matching doesn\'t applicable for custom properties');
- }
- if (!this.getProperty(propertyName)) {
- return new SyntaxReferenceError('Unknown property', propertyName);
- }
- },
- matchAtrulePrelude: function(atruleName, prelude) {
- var error = this.checkAtrulePrelude(atruleName, prelude);
- if (error) {
- return buildMatchResult(null, error);
- }
- if (!prelude) {
- return buildMatchResult(null, null);
- }
- return matchSyntax(this, this.getAtrule(atruleName).prelude, prelude, false);
- },
- matchAtruleDescriptor: function(atruleName, descriptorName, value) {
- var error = this.checkAtruleDescriptorName(atruleName, descriptorName);
- if (error) {
- return buildMatchResult(null, error);
- }
- var atrule = this.getAtrule(atruleName);
- var descriptor = names$1.keyword(descriptorName);
- return matchSyntax(this, atrule.descriptors[descriptor.name] || atrule.descriptors[descriptor.basename], value, false);
- },
- matchDeclaration: function(node) {
- if (node.type !== 'Declaration') {
- return buildMatchResult(null, new Error('Not a Declaration node'));
- }
- return this.matchProperty(node.property, node.value);
- },
- matchProperty: function(propertyName, value) {
- var error = this.checkPropertyName(propertyName);
- if (error) {
- return buildMatchResult(null, error);
- }
- return matchSyntax(this, this.getProperty(propertyName), value, true);
- },
- matchType: function(typeName, value) {
- var typeSyntax = this.getType(typeName);
- if (!typeSyntax) {
- return buildMatchResult(null, new SyntaxReferenceError('Unknown type', typeName));
- }
- return matchSyntax(this, typeSyntax, value, false);
- },
- match: function(syntax, value) {
- if (typeof syntax !== 'string' && (!syntax || !syntax.type)) {
- return buildMatchResult(null, new SyntaxReferenceError('Bad syntax'));
- }
- if (typeof syntax === 'string' || !syntax.match) {
- syntax = this.createDescriptor(syntax, 'Type', 'anonymous');
- }
- return matchSyntax(this, syntax, value, false);
- },
- findValueFragments: function(propertyName, value, type, name) {
- return search.matchFragments(this, value, this.matchProperty(propertyName, value), type, name);
- },
- findDeclarationValueFragments: function(declaration, type, name) {
- return search.matchFragments(this, declaration.value, this.matchDeclaration(declaration), type, name);
- },
- findAllFragments: function(ast, type, name) {
- var result = [];
- this.syntax.walk(ast, {
- visit: 'Declaration',
- enter: function(declaration) {
- result.push.apply(result, this.findDeclarationValueFragments(declaration, type, name));
- }.bind(this)
- });
- return result;
- },
- getAtrule: function(atruleName, fallbackBasename = true) {
- var atrule = names$1.keyword(atruleName);
- var atruleEntry = atrule.vendor && fallbackBasename
- ? this.atrules[atrule.name] || this.atrules[atrule.basename]
- : this.atrules[atrule.name];
- return atruleEntry || null;
- },
- getAtrulePrelude: function(atruleName, fallbackBasename = true) {
- const atrule = this.getAtrule(atruleName, fallbackBasename);
- return atrule && atrule.prelude || null;
- },
- getAtruleDescriptor: function(atruleName, name) {
- return this.atrules.hasOwnProperty(atruleName) && this.atrules.declarators
- ? this.atrules[atruleName].declarators[name] || null
- : null;
- },
- getProperty: function(propertyName, fallbackBasename = true) {
- var property = names$1.property(propertyName);
- var propertyEntry = property.vendor && fallbackBasename
- ? this.properties[property.name] || this.properties[property.basename]
- : this.properties[property.name];
- return propertyEntry || null;
- },
- getType: function(name) {
- return this.types.hasOwnProperty(name) ? this.types[name] : null;
- },
- validate: function() {
- function validate(syntax, name, broken, descriptor) {
- if (broken.hasOwnProperty(name)) {
- return broken[name];
- }
- broken[name] = false;
- if (descriptor.syntax !== null) {
- walk(descriptor.syntax, function(node) {
- if (node.type !== 'Type' && node.type !== 'Property') {
- return;
- }
- var map = node.type === 'Type' ? syntax.types : syntax.properties;
- var brokenMap = node.type === 'Type' ? brokenTypes : brokenProperties;
- if (!map.hasOwnProperty(node.name) || validate(syntax, node.name, brokenMap, map[node.name])) {
- broken[name] = true;
- }
- }, this);
- }
- }
- var brokenTypes = {};
- var brokenProperties = {};
- for (var key in this.types) {
- validate(this, key, brokenTypes, this.types[key]);
- }
- for (var key in this.properties) {
- validate(this, key, brokenProperties, this.properties[key]);
- }
- brokenTypes = Object.keys(brokenTypes).filter(function(name) {
- return brokenTypes[name];
- });
- brokenProperties = Object.keys(brokenProperties).filter(function(name) {
- return brokenProperties[name];
- });
- if (brokenTypes.length || brokenProperties.length) {
- return {
- types: brokenTypes,
- properties: brokenProperties
- };
- }
- return null;
- },
- dump: function(syntaxAsAst, pretty) {
- return {
- generic: this.generic,
- types: dumpMapSyntax(this.types, !pretty, syntaxAsAst),
- properties: dumpMapSyntax(this.properties, !pretty, syntaxAsAst),
- atrules: dumpAtruleMapSyntax(this.atrules, !pretty, syntaxAsAst)
- };
- },
- toString: function() {
- return JSON.stringify(this.dump());
- }
- };
- var Lexer_1 = Lexer$1;
- var definitionSyntax$1 = {
- SyntaxError: _SyntaxError,
- parse: parse_1,
- generate: generate_1,
- walk: walk$1
- };
- var adoptBuffer = adoptBuffer$2;
- var isBOM = tokenizer$3.isBOM;
- var N$1 = 10;
- var F = 12;
- var R = 13;
- function computeLinesAndColumns(host, source) {
- var sourceLength = source.length;
- var lines = adoptBuffer(host.lines, sourceLength); // +1
- var line = host.startLine;
- var columns = adoptBuffer(host.columns, sourceLength);
- var column = host.startColumn;
- var startOffset = source.length > 0 ? isBOM(source.charCodeAt(0)) : 0;
- for (var i = startOffset; i < sourceLength; i++) { // -1
- var code = source.charCodeAt(i);
- lines[i] = line;
- columns[i] = column++;
- if (code === N$1 || code === R || code === F) {
- if (code === R && i + 1 < sourceLength && source.charCodeAt(i + 1) === N$1) {
- i++;
- lines[i] = line;
- columns[i] = column;
- }
- line++;
- column = 1;
- }
- }
- lines[i] = line;
- columns[i] = column;
- host.lines = lines;
- host.columns = columns;
- }
- var OffsetToLocation$1 = function() {
- this.lines = null;
- this.columns = null;
- this.linesAndColumnsComputed = false;
- };
- OffsetToLocation$1.prototype = {
- setSource: function(source, startOffset, startLine, startColumn) {
- this.source = source;
- this.startOffset = typeof startOffset === 'undefined' ? 0 : startOffset;
- this.startLine = typeof startLine === 'undefined' ? 1 : startLine;
- this.startColumn = typeof startColumn === 'undefined' ? 1 : startColumn;
- this.linesAndColumnsComputed = false;
- },
- ensureLinesAndColumnsComputed: function() {
- if (!this.linesAndColumnsComputed) {
- computeLinesAndColumns(this, this.source);
- this.linesAndColumnsComputed = true;
- }
- },
- getLocation: function(offset, filename) {
- this.ensureLinesAndColumnsComputed();
- return {
- source: filename,
- offset: this.startOffset + offset,
- line: this.lines[offset],
- column: this.columns[offset]
- };
- },
- getLocationRange: function(start, end, filename) {
- this.ensureLinesAndColumnsComputed();
- return {
- source: filename,
- start: {
- offset: this.startOffset + start,
- line: this.lines[start],
- column: this.columns[start]
- },
- end: {
- offset: this.startOffset + end,
- line: this.lines[end],
- column: this.columns[end]
- }
- };
- }
- };
- var OffsetToLocation_1 = OffsetToLocation$1;
- var TYPE$A = tokenizer$3.TYPE;
- var WHITESPACE$a = TYPE$A.WhiteSpace;
- var COMMENT$8 = TYPE$A.Comment;
- var sequence$1 = function readSequence(recognizer) {
- var children = this.createList();
- var child = null;
- var context = {
- recognizer: recognizer,
- space: null,
- ignoreWS: false,
- ignoreWSAfter: false
- };
- this.scanner.skipSC();
- while (!this.scanner.eof) {
- switch (this.scanner.tokenType) {
- case COMMENT$8:
- this.scanner.next();
- continue;
- case WHITESPACE$a:
- if (context.ignoreWS) {
- this.scanner.next();
- } else {
- context.space = this.WhiteSpace();
- }
- continue;
- }
- child = recognizer.getNode.call(this, context);
- if (child === undefined) {
- break;
- }
- if (context.space !== null) {
- children.push(context.space);
- context.space = null;
- }
- children.push(child);
- if (context.ignoreWSAfter) {
- context.ignoreWSAfter = false;
- context.ignoreWS = true;
- } else {
- context.ignoreWS = false;
- }
- }
- return children;
- };
- var OffsetToLocation = OffsetToLocation_1;
- var SyntaxError$2 = _SyntaxError$1;
- var TokenStream$1 = TokenStream_1;
- var List$3 = List_1;
- var tokenize$1 = tokenizer$3;
- var constants = _const;
- var { findWhiteSpaceStart, cmpStr: cmpStr$2 } = utils$2;
- var sequence = sequence$1;
- var noop$1 = function() {};
- var TYPE$z = constants.TYPE;
- var NAME$1 = constants.NAME;
- var WHITESPACE$9 = TYPE$z.WhiteSpace;
- var COMMENT$7 = TYPE$z.Comment;
- var IDENT$g = TYPE$z.Ident;
- var FUNCTION$6 = TYPE$z.Function;
- var URL$4 = TYPE$z.Url;
- var HASH$5 = TYPE$z.Hash;
- var PERCENTAGE$3 = TYPE$z.Percentage;
- var NUMBER$7 = TYPE$z.Number;
- var NUMBERSIGN$3 = 0x0023; // U+0023 NUMBER SIGN (#)
- var NULL = 0;
- function createParseContext(name) {
- return function() {
- return this[name]();
- };
- }
- function processConfig(config) {
- var parserConfig = {
- context: {},
- scope: {},
- atrule: {},
- pseudo: {}
- };
- if (config.parseContext) {
- for (var name in config.parseContext) {
- switch (typeof config.parseContext[name]) {
- case 'function':
- parserConfig.context[name] = config.parseContext[name];
- break;
- case 'string':
- parserConfig.context[name] = createParseContext(config.parseContext[name]);
- break;
- }
- }
- }
- if (config.scope) {
- for (var name in config.scope) {
- parserConfig.scope[name] = config.scope[name];
- }
- }
- if (config.atrule) {
- for (var name in config.atrule) {
- var atrule = config.atrule[name];
- if (atrule.parse) {
- parserConfig.atrule[name] = atrule.parse;
- }
- }
- }
- if (config.pseudo) {
- for (var name in config.pseudo) {
- var pseudo = config.pseudo[name];
- if (pseudo.parse) {
- parserConfig.pseudo[name] = pseudo.parse;
- }
- }
- }
- if (config.node) {
- for (var name in config.node) {
- parserConfig[name] = config.node[name].parse;
- }
- }
- return parserConfig;
- }
- var create$3 = function createParser(config) {
- var parser = {
- scanner: new TokenStream$1(),
- locationMap: new OffsetToLocation(),
- filename: '<unknown>',
- needPositions: false,
- onParseError: noop$1,
- onParseErrorThrow: false,
- parseAtrulePrelude: true,
- parseRulePrelude: true,
- parseValue: true,
- parseCustomProperty: false,
- readSequence: sequence,
- createList: function() {
- return new List$3();
- },
- createSingleNodeList: function(node) {
- return new List$3().appendData(node);
- },
- getFirstListNode: function(list) {
- return list && list.first();
- },
- getLastListNode: function(list) {
- return list.last();
- },
- parseWithFallback: function(consumer, fallback) {
- var startToken = this.scanner.tokenIndex;
- try {
- return consumer.call(this);
- } catch (e) {
- if (this.onParseErrorThrow) {
- throw e;
- }
- var fallbackNode = fallback.call(this, startToken);
- this.onParseErrorThrow = true;
- this.onParseError(e, fallbackNode);
- this.onParseErrorThrow = false;
- return fallbackNode;
- }
- },
- lookupNonWSType: function(offset) {
- do {
- var type = this.scanner.lookupType(offset++);
- if (type !== WHITESPACE$9) {
- return type;
- }
- } while (type !== NULL);
- return NULL;
- },
- eat: function(tokenType) {
- if (this.scanner.tokenType !== tokenType) {
- var offset = this.scanner.tokenStart;
- var message = NAME$1[tokenType] + ' is expected';
- // tweak message and offset
- switch (tokenType) {
- case IDENT$g:
- // when identifier is expected but there is a function or url
- if (this.scanner.tokenType === FUNCTION$6 || this.scanner.tokenType === URL$4) {
- offset = this.scanner.tokenEnd - 1;
- message = 'Identifier is expected but function found';
- } else {
- message = 'Identifier is expected';
- }
- break;
- case HASH$5:
- if (this.scanner.isDelim(NUMBERSIGN$3)) {
- this.scanner.next();
- offset++;
- message = 'Name is expected';
- }
- break;
- case PERCENTAGE$3:
- if (this.scanner.tokenType === NUMBER$7) {
- offset = this.scanner.tokenEnd;
- message = 'Percent sign is expected';
- }
- break;
- default:
- // when test type is part of another token show error for current position + 1
- // e.g. eat(HYPHENMINUS) will fail on "-foo", but pointing on "-" is odd
- if (this.scanner.source.charCodeAt(this.scanner.tokenStart) === tokenType) {
- offset = offset + 1;
- }
- }
- this.error(message, offset);
- }
- this.scanner.next();
- },
- consume: function(tokenType) {
- var value = this.scanner.getTokenValue();
- this.eat(tokenType);
- return value;
- },
- consumeFunctionName: function() {
- var name = this.scanner.source.substring(this.scanner.tokenStart, this.scanner.tokenEnd - 1);
- this.eat(FUNCTION$6);
- return name;
- },
- getLocation: function(start, end) {
- if (this.needPositions) {
- return this.locationMap.getLocationRange(
- start,
- end,
- this.filename
- );
- }
- return null;
- },
- getLocationFromList: function(list) {
- if (this.needPositions) {
- var head = this.getFirstListNode(list);
- var tail = this.getLastListNode(list);
- return this.locationMap.getLocationRange(
- head !== null ? head.loc.start.offset - this.locationMap.startOffset : this.scanner.tokenStart,
- tail !== null ? tail.loc.end.offset - this.locationMap.startOffset : this.scanner.tokenStart,
- this.filename
- );
- }
- return null;
- },
- error: function(message, offset) {
- var location = typeof offset !== 'undefined' && offset < this.scanner.source.length
- ? this.locationMap.getLocation(offset)
- : this.scanner.eof
- ? this.locationMap.getLocation(findWhiteSpaceStart(this.scanner.source, this.scanner.source.length - 1))
- : this.locationMap.getLocation(this.scanner.tokenStart);
- throw new SyntaxError$2(
- message || 'Unexpected input',
- this.scanner.source,
- location.offset,
- location.line,
- location.column
- );
- }
- };
- config = processConfig(config || {});
- for (var key in config) {
- parser[key] = config[key];
- }
- return function(source, options) {
- options = options || {};
- var context = options.context || 'default';
- var onComment = options.onComment;
- var ast;
- tokenize$1(source, parser.scanner);
- parser.locationMap.setSource(
- source,
- options.offset,
- options.line,
- options.column
- );
- parser.filename = options.filename || '<unknown>';
- parser.needPositions = Boolean(options.positions);
- parser.onParseError = typeof options.onParseError === 'function' ? options.onParseError : noop$1;
- parser.onParseErrorThrow = false;
- parser.parseAtrulePrelude = 'parseAtrulePrelude' in options ? Boolean(options.parseAtrulePrelude) : true;
- parser.parseRulePrelude = 'parseRulePrelude' in options ? Boolean(options.parseRulePrelude) : true;
- parser.parseValue = 'parseValue' in options ? Boolean(options.parseValue) : true;
- parser.parseCustomProperty = 'parseCustomProperty' in options ? Boolean(options.parseCustomProperty) : false;
- if (!parser.context.hasOwnProperty(context)) {
- throw new Error('Unknown context `' + context + '`');
- }
- if (typeof onComment === 'function') {
- parser.scanner.forEachToken((type, start, end) => {
- if (type === COMMENT$7) {
- const loc = parser.getLocation(start, end);
- const value = cmpStr$2(source, end - 2, end, '*/')
- ? source.slice(start + 2, end - 2)
- : source.slice(start + 2, end);
- onComment(value, loc);
- }
- });
- }
- ast = parser.context[context].call(parser, options);
- if (!parser.scanner.eof) {
- parser.error();
- }
- return ast;
- };
- };
- var sourceMapGenerator = {};
- var base64Vlq = {};
- var base64$1 = {};
- /* -*- Mode: js; js-indent-level: 2; -*- */
- /*
- * Copyright 2011 Mozilla Foundation and contributors
- * Licensed under the New BSD license. See LICENSE or:
- * http://opensource.org/licenses/BSD-3-Clause
- */
- var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');
- /**
- * Encode an integer in the range of 0 to 63 to a single base 64 digit.
- */
- base64$1.encode = function (number) {
- if (0 <= number && number < intToCharMap.length) {
- return intToCharMap[number];
- }
- throw new TypeError("Must be between 0 and 63: " + number);
- };
- /**
- * Decode a single base 64 character code digit to an integer. Returns -1 on
- * failure.
- */
- base64$1.decode = function (charCode) {
- var bigA = 65; // 'A'
- var bigZ = 90; // 'Z'
- var littleA = 97; // 'a'
- var littleZ = 122; // 'z'
- var zero = 48; // '0'
- var nine = 57; // '9'
- var plus = 43; // '+'
- var slash = 47; // '/'
- var littleOffset = 26;
- var numberOffset = 52;
- // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ
- if (bigA <= charCode && charCode <= bigZ) {
- return (charCode - bigA);
- }
- // 26 - 51: abcdefghijklmnopqrstuvwxyz
- if (littleA <= charCode && charCode <= littleZ) {
- return (charCode - littleA + littleOffset);
- }
- // 52 - 61: 0123456789
- if (zero <= charCode && charCode <= nine) {
- return (charCode - zero + numberOffset);
- }
- // 62: +
- if (charCode == plus) {
- return 62;
- }
- // 63: /
- if (charCode == slash) {
- return 63;
- }
- // Invalid base64 digit.
- return -1;
- };
- /* -*- Mode: js; js-indent-level: 2; -*- */
- /*
- * Copyright 2011 Mozilla Foundation and contributors
- * Licensed under the New BSD license. See LICENSE or:
- * http://opensource.org/licenses/BSD-3-Clause
- *
- * Based on the Base 64 VLQ implementation in Closure Compiler:
- * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java
- *
- * Copyright 2011 The Closure Compiler Authors. All rights reserved.
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
- var base64 = base64$1;
- // A single base 64 digit can contain 6 bits of data. For the base 64 variable
- // length quantities we use in the source map spec, the first bit is the sign,
- // the next four bits are the actual value, and the 6th bit is the
- // continuation bit. The continuation bit tells us whether there are more
- // digits in this value following this digit.
- //
- // Continuation
- // | Sign
- // | |
- // V V
- // 101011
- var VLQ_BASE_SHIFT = 5;
- // binary: 100000
- var VLQ_BASE = 1 << VLQ_BASE_SHIFT;
- // binary: 011111
- var VLQ_BASE_MASK = VLQ_BASE - 1;
- // binary: 100000
- var VLQ_CONTINUATION_BIT = VLQ_BASE;
- /**
- * Converts from a two-complement value to a value where the sign bit is
- * placed in the least significant bit. For example, as decimals:
- * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary)
- * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary)
- */
- function toVLQSigned(aValue) {
- return aValue < 0
- ? ((-aValue) << 1) + 1
- : (aValue << 1) + 0;
- }
- /**
- * Converts to a two-complement value from a value where the sign bit is
- * placed in the least significant bit. For example, as decimals:
- * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1
- * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2
- */
- function fromVLQSigned(aValue) {
- var isNegative = (aValue & 1) === 1;
- var shifted = aValue >> 1;
- return isNegative
- ? -shifted
- : shifted;
- }
- /**
- * Returns the base 64 VLQ encoded value.
- */
- base64Vlq.encode = function base64VLQ_encode(aValue) {
- var encoded = "";
- var digit;
- var vlq = toVLQSigned(aValue);
- do {
- digit = vlq & VLQ_BASE_MASK;
- vlq >>>= VLQ_BASE_SHIFT;
- if (vlq > 0) {
- // There are still more digits in this value, so we must make sure the
- // continuation bit is marked.
- digit |= VLQ_CONTINUATION_BIT;
- }
- encoded += base64.encode(digit);
- } while (vlq > 0);
- return encoded;
- };
- /**
- * Decodes the next base 64 VLQ value from the given string and returns the
- * value and the rest of the string via the out parameter.
- */
- base64Vlq.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) {
- var strLen = aStr.length;
- var result = 0;
- var shift = 0;
- var continuation, digit;
- do {
- if (aIndex >= strLen) {
- throw new Error("Expected more digits in base 64 VLQ value.");
- }
- digit = base64.decode(aStr.charCodeAt(aIndex++));
- if (digit === -1) {
- throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1));
- }
- continuation = !!(digit & VLQ_CONTINUATION_BIT);
- digit &= VLQ_BASE_MASK;
- result = result + (digit << shift);
- shift += VLQ_BASE_SHIFT;
- } while (continuation);
- aOutParam.value = fromVLQSigned(result);
- aOutParam.rest = aIndex;
- };
- var util$3 = {};
- /* -*- Mode: js; js-indent-level: 2; -*- */
- (function (exports) {
- /*
- * Copyright 2011 Mozilla Foundation and contributors
- * Licensed under the New BSD license. See LICENSE or:
- * http://opensource.org/licenses/BSD-3-Clause
- */
- /**
- * This is a helper function for getting values from parameter/options
- * objects.
- *
- * @param args The object we are extracting values from
- * @param name The name of the property we are getting.
- * @param defaultValue An optional value to return if the property is missing
- * from the object. If this is not specified and the property is missing, an
- * error will be thrown.
- */
- function getArg(aArgs, aName, aDefaultValue) {
- if (aName in aArgs) {
- return aArgs[aName];
- } else if (arguments.length === 3) {
- return aDefaultValue;
- } else {
- throw new Error('"' + aName + '" is a required argument.');
- }
- }
- exports.getArg = getArg;
- var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/;
- var dataUrlRegexp = /^data:.+\,.+$/;
- function urlParse(aUrl) {
- var match = aUrl.match(urlRegexp);
- if (!match) {
- return null;
- }
- return {
- scheme: match[1],
- auth: match[2],
- host: match[3],
- port: match[4],
- path: match[5]
- };
- }
- exports.urlParse = urlParse;
- function urlGenerate(aParsedUrl) {
- var url = '';
- if (aParsedUrl.scheme) {
- url += aParsedUrl.scheme + ':';
- }
- url += '//';
- if (aParsedUrl.auth) {
- url += aParsedUrl.auth + '@';
- }
- if (aParsedUrl.host) {
- url += aParsedUrl.host;
- }
- if (aParsedUrl.port) {
- url += ":" + aParsedUrl.port;
- }
- if (aParsedUrl.path) {
- url += aParsedUrl.path;
- }
- return url;
- }
- exports.urlGenerate = urlGenerate;
- /**
- * Normalizes a path, or the path portion of a URL:
- *
- * - Replaces consecutive slashes with one slash.
- * - Removes unnecessary '.' parts.
- * - Removes unnecessary '<dir>/..' parts.
- *
- * Based on code in the Node.js 'path' core module.
- *
- * @param aPath The path or url to normalize.
- */
- function normalize(aPath) {
- var path = aPath;
- var url = urlParse(aPath);
- if (url) {
- if (!url.path) {
- return aPath;
- }
- path = url.path;
- }
- var isAbsolute = exports.isAbsolute(path);
- var parts = path.split(/\/+/);
- for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {
- part = parts[i];
- if (part === '.') {
- parts.splice(i, 1);
- } else if (part === '..') {
- up++;
- } else if (up > 0) {
- if (part === '') {
- // The first part is blank if the path is absolute. Trying to go
- // above the root is a no-op. Therefore we can remove all '..' parts
- // directly after the root.
- parts.splice(i + 1, up);
- up = 0;
- } else {
- parts.splice(i, 2);
- up--;
- }
- }
- }
- path = parts.join('/');
- if (path === '') {
- path = isAbsolute ? '/' : '.';
- }
- if (url) {
- url.path = path;
- return urlGenerate(url);
- }
- return path;
- }
- exports.normalize = normalize;
- /**
- * Joins two paths/URLs.
- *
- * @param aRoot The root path or URL.
- * @param aPath The path or URL to be joined with the root.
- *
- * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a
- * scheme-relative URL: Then the scheme of aRoot, if any, is prepended
- * first.
- * - Otherwise aPath is a path. If aRoot is a URL, then its path portion
- * is updated with the result and aRoot is returned. Otherwise the result
- * is returned.
- * - If aPath is absolute, the result is aPath.
- * - Otherwise the two paths are joined with a slash.
- * - Joining for example 'http://' and 'www.example.com' is also supported.
- */
- function join(aRoot, aPath) {
- if (aRoot === "") {
- aRoot = ".";
- }
- if (aPath === "") {
- aPath = ".";
- }
- var aPathUrl = urlParse(aPath);
- var aRootUrl = urlParse(aRoot);
- if (aRootUrl) {
- aRoot = aRootUrl.path || '/';
- }
- // `join(foo, '//www.example.org')`
- if (aPathUrl && !aPathUrl.scheme) {
- if (aRootUrl) {
- aPathUrl.scheme = aRootUrl.scheme;
- }
- return urlGenerate(aPathUrl);
- }
- if (aPathUrl || aPath.match(dataUrlRegexp)) {
- return aPath;
- }
- // `join('http://', 'www.example.com')`
- if (aRootUrl && !aRootUrl.host && !aRootUrl.path) {
- aRootUrl.host = aPath;
- return urlGenerate(aRootUrl);
- }
- var joined = aPath.charAt(0) === '/'
- ? aPath
- : normalize(aRoot.replace(/\/+$/, '') + '/' + aPath);
- if (aRootUrl) {
- aRootUrl.path = joined;
- return urlGenerate(aRootUrl);
- }
- return joined;
- }
- exports.join = join;
- exports.isAbsolute = function (aPath) {
- return aPath.charAt(0) === '/' || urlRegexp.test(aPath);
- };
- /**
- * Make a path relative to a URL or another path.
- *
- * @param aRoot The root path or URL.
- * @param aPath The path or URL to be made relative to aRoot.
- */
- function relative(aRoot, aPath) {
- if (aRoot === "") {
- aRoot = ".";
- }
- aRoot = aRoot.replace(/\/$/, '');
- // It is possible for the path to be above the root. In this case, simply
- // checking whether the root is a prefix of the path won't work. Instead, we
- // need to remove components from the root one by one, until either we find
- // a prefix that fits, or we run out of components to remove.
- var level = 0;
- while (aPath.indexOf(aRoot + '/') !== 0) {
- var index = aRoot.lastIndexOf("/");
- if (index < 0) {
- return aPath;
- }
- // If the only part of the root that is left is the scheme (i.e. http://,
- // file:///, etc.), one or more slashes (/), or simply nothing at all, we
- // have exhausted all components, so the path is not relative to the root.
- aRoot = aRoot.slice(0, index);
- if (aRoot.match(/^([^\/]+:\/)?\/*$/)) {
- return aPath;
- }
- ++level;
- }
- // Make sure we add a "../" for each component we removed from the root.
- return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1);
- }
- exports.relative = relative;
- var supportsNullProto = (function () {
- var obj = Object.create(null);
- return !('__proto__' in obj);
- }());
- function identity (s) {
- return s;
- }
- /**
- * Because behavior goes wacky when you set `__proto__` on objects, we
- * have to prefix all the strings in our set with an arbitrary character.
- *
- * See https://github.com/mozilla/source-map/pull/31 and
- * https://github.com/mozilla/source-map/issues/30
- *
- * @param String aStr
- */
- function toSetString(aStr) {
- if (isProtoString(aStr)) {
- return '$' + aStr;
- }
- return aStr;
- }
- exports.toSetString = supportsNullProto ? identity : toSetString;
- function fromSetString(aStr) {
- if (isProtoString(aStr)) {
- return aStr.slice(1);
- }
- return aStr;
- }
- exports.fromSetString = supportsNullProto ? identity : fromSetString;
- function isProtoString(s) {
- if (!s) {
- return false;
- }
- var length = s.length;
- if (length < 9 /* "__proto__".length */) {
- return false;
- }
- if (s.charCodeAt(length - 1) !== 95 /* '_' */ ||
- s.charCodeAt(length - 2) !== 95 /* '_' */ ||
- s.charCodeAt(length - 3) !== 111 /* 'o' */ ||
- s.charCodeAt(length - 4) !== 116 /* 't' */ ||
- s.charCodeAt(length - 5) !== 111 /* 'o' */ ||
- s.charCodeAt(length - 6) !== 114 /* 'r' */ ||
- s.charCodeAt(length - 7) !== 112 /* 'p' */ ||
- s.charCodeAt(length - 8) !== 95 /* '_' */ ||
- s.charCodeAt(length - 9) !== 95 /* '_' */) {
- return false;
- }
- for (var i = length - 10; i >= 0; i--) {
- if (s.charCodeAt(i) !== 36 /* '$' */) {
- return false;
- }
- }
- return true;
- }
- /**
- * Comparator between two mappings where the original positions are compared.
- *
- * Optionally pass in `true` as `onlyCompareGenerated` to consider two
- * mappings with the same original source/line/column, but different generated
- * line and column the same. Useful when searching for a mapping with a
- * stubbed out mapping.
- */
- function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {
- var cmp = strcmp(mappingA.source, mappingB.source);
- if (cmp !== 0) {
- return cmp;
- }
- cmp = mappingA.originalLine - mappingB.originalLine;
- if (cmp !== 0) {
- return cmp;
- }
- cmp = mappingA.originalColumn - mappingB.originalColumn;
- if (cmp !== 0 || onlyCompareOriginal) {
- return cmp;
- }
- cmp = mappingA.generatedColumn - mappingB.generatedColumn;
- if (cmp !== 0) {
- return cmp;
- }
- cmp = mappingA.generatedLine - mappingB.generatedLine;
- if (cmp !== 0) {
- return cmp;
- }
- return strcmp(mappingA.name, mappingB.name);
- }
- exports.compareByOriginalPositions = compareByOriginalPositions;
- /**
- * Comparator between two mappings with deflated source and name indices where
- * the generated positions are compared.
- *
- * Optionally pass in `true` as `onlyCompareGenerated` to consider two
- * mappings with the same generated line and column, but different
- * source/name/original line and column the same. Useful when searching for a
- * mapping with a stubbed out mapping.
- */
- function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) {
- var cmp = mappingA.generatedLine - mappingB.generatedLine;
- if (cmp !== 0) {
- return cmp;
- }
- cmp = mappingA.generatedColumn - mappingB.generatedColumn;
- if (cmp !== 0 || onlyCompareGenerated) {
- return cmp;
- }
- cmp = strcmp(mappingA.source, mappingB.source);
- if (cmp !== 0) {
- return cmp;
- }
- cmp = mappingA.originalLine - mappingB.originalLine;
- if (cmp !== 0) {
- return cmp;
- }
- cmp = mappingA.originalColumn - mappingB.originalColumn;
- if (cmp !== 0) {
- return cmp;
- }
- return strcmp(mappingA.name, mappingB.name);
- }
- exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;
- function strcmp(aStr1, aStr2) {
- if (aStr1 === aStr2) {
- return 0;
- }
- if (aStr1 === null) {
- return 1; // aStr2 !== null
- }
- if (aStr2 === null) {
- return -1; // aStr1 !== null
- }
- if (aStr1 > aStr2) {
- return 1;
- }
- return -1;
- }
- /**
- * Comparator between two mappings with inflated source and name strings where
- * the generated positions are compared.
- */
- function compareByGeneratedPositionsInflated(mappingA, mappingB) {
- var cmp = mappingA.generatedLine - mappingB.generatedLine;
- if (cmp !== 0) {
- return cmp;
- }
- cmp = mappingA.generatedColumn - mappingB.generatedColumn;
- if (cmp !== 0) {
- return cmp;
- }
- cmp = strcmp(mappingA.source, mappingB.source);
- if (cmp !== 0) {
- return cmp;
- }
- cmp = mappingA.originalLine - mappingB.originalLine;
- if (cmp !== 0) {
- return cmp;
- }
- cmp = mappingA.originalColumn - mappingB.originalColumn;
- if (cmp !== 0) {
- return cmp;
- }
- return strcmp(mappingA.name, mappingB.name);
- }
- exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;
- /**
- * Strip any JSON XSSI avoidance prefix from the string (as documented
- * in the source maps specification), and then parse the string as
- * JSON.
- */
- function parseSourceMapInput(str) {
- return JSON.parse(str.replace(/^\)]}'[^\n]*\n/, ''));
- }
- exports.parseSourceMapInput = parseSourceMapInput;
- /**
- * Compute the URL of a source given the the source root, the source's
- * URL, and the source map's URL.
- */
- function computeSourceURL(sourceRoot, sourceURL, sourceMapURL) {
- sourceURL = sourceURL || '';
- if (sourceRoot) {
- // This follows what Chrome does.
- if (sourceRoot[sourceRoot.length - 1] !== '/' && sourceURL[0] !== '/') {
- sourceRoot += '/';
- }
- // The spec says:
- // Line 4: An optional source root, useful for relocating source
- // files on a server or removing repeated values in the
- // “sources” entry. This value is prepended to the individual
- // entries in the “source” field.
- sourceURL = sourceRoot + sourceURL;
- }
- // Historically, SourceMapConsumer did not take the sourceMapURL as
- // a parameter. This mode is still somewhat supported, which is why
- // this code block is conditional. However, it's preferable to pass
- // the source map URL to SourceMapConsumer, so that this function
- // can implement the source URL resolution algorithm as outlined in
- // the spec. This block is basically the equivalent of:
- // new URL(sourceURL, sourceMapURL).toString()
- // ... except it avoids using URL, which wasn't available in the
- // older releases of node still supported by this library.
- //
- // The spec says:
- // If the sources are not absolute URLs after prepending of the
- // “sourceRoot”, the sources are resolved relative to the
- // SourceMap (like resolving script src in a html document).
- if (sourceMapURL) {
- var parsed = urlParse(sourceMapURL);
- if (!parsed) {
- throw new Error("sourceMapURL could not be parsed");
- }
- if (parsed.path) {
- // Strip the last path component, but keep the "/".
- var index = parsed.path.lastIndexOf('/');
- if (index >= 0) {
- parsed.path = parsed.path.substring(0, index + 1);
- }
- }
- sourceURL = join(urlGenerate(parsed), sourceURL);
- }
- return normalize(sourceURL);
- }
- exports.computeSourceURL = computeSourceURL;
- } (util$3));
- var arraySet = {};
- /* -*- Mode: js; js-indent-level: 2; -*- */
- /*
- * Copyright 2011 Mozilla Foundation and contributors
- * Licensed under the New BSD license. See LICENSE or:
- * http://opensource.org/licenses/BSD-3-Clause
- */
- var util$2 = util$3;
- var has$1 = Object.prototype.hasOwnProperty;
- var hasNativeMap = typeof Map !== "undefined";
- /**
- * A data structure which is a combination of an array and a set. Adding a new
- * member is O(1), testing for membership is O(1), and finding the index of an
- * element is O(1). Removing elements from the set is not supported. Only
- * strings are supported for membership.
- */
- function ArraySet$1() {
- this._array = [];
- this._set = hasNativeMap ? new Map() : Object.create(null);
- }
- /**
- * Static method for creating ArraySet instances from an existing array.
- */
- ArraySet$1.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) {
- var set = new ArraySet$1();
- for (var i = 0, len = aArray.length; i < len; i++) {
- set.add(aArray[i], aAllowDuplicates);
- }
- return set;
- };
- /**
- * Return how many unique items are in this ArraySet. If duplicates have been
- * added, than those do not count towards the size.
- *
- * @returns Number
- */
- ArraySet$1.prototype.size = function ArraySet_size() {
- return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length;
- };
- /**
- * Add the given string to this set.
- *
- * @param String aStr
- */
- ArraySet$1.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) {
- var sStr = hasNativeMap ? aStr : util$2.toSetString(aStr);
- var isDuplicate = hasNativeMap ? this.has(aStr) : has$1.call(this._set, sStr);
- var idx = this._array.length;
- if (!isDuplicate || aAllowDuplicates) {
- this._array.push(aStr);
- }
- if (!isDuplicate) {
- if (hasNativeMap) {
- this._set.set(aStr, idx);
- } else {
- this._set[sStr] = idx;
- }
- }
- };
- /**
- * Is the given string a member of this set?
- *
- * @param String aStr
- */
- ArraySet$1.prototype.has = function ArraySet_has(aStr) {
- if (hasNativeMap) {
- return this._set.has(aStr);
- } else {
- var sStr = util$2.toSetString(aStr);
- return has$1.call(this._set, sStr);
- }
- };
- /**
- * What is the index of the given string in the array?
- *
- * @param String aStr
- */
- ArraySet$1.prototype.indexOf = function ArraySet_indexOf(aStr) {
- if (hasNativeMap) {
- var idx = this._set.get(aStr);
- if (idx >= 0) {
- return idx;
- }
- } else {
- var sStr = util$2.toSetString(aStr);
- if (has$1.call(this._set, sStr)) {
- return this._set[sStr];
- }
- }
- throw new Error('"' + aStr + '" is not in the set.');
- };
- /**
- * What is the element at the given index?
- *
- * @param Number aIdx
- */
- ArraySet$1.prototype.at = function ArraySet_at(aIdx) {
- if (aIdx >= 0 && aIdx < this._array.length) {
- return this._array[aIdx];
- }
- throw new Error('No element indexed by ' + aIdx);
- };
- /**
- * Returns the array representation of this set (which has the proper indices
- * indicated by indexOf). Note that this is a copy of the internal array used
- * for storing the members so that no one can mess with internal state.
- */
- ArraySet$1.prototype.toArray = function ArraySet_toArray() {
- return this._array.slice();
- };
- arraySet.ArraySet = ArraySet$1;
- var mappingList = {};
- /* -*- Mode: js; js-indent-level: 2; -*- */
- /*
- * Copyright 2014 Mozilla Foundation and contributors
- * Licensed under the New BSD license. See LICENSE or:
- * http://opensource.org/licenses/BSD-3-Clause
- */
- var util$1 = util$3;
- /**
- * Determine whether mappingB is after mappingA with respect to generated
- * position.
- */
- function generatedPositionAfter(mappingA, mappingB) {
- // Optimized for most common case
- var lineA = mappingA.generatedLine;
- var lineB = mappingB.generatedLine;
- var columnA = mappingA.generatedColumn;
- var columnB = mappingB.generatedColumn;
- return lineB > lineA || lineB == lineA && columnB >= columnA ||
- util$1.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0;
- }
- /**
- * A data structure to provide a sorted view of accumulated mappings in a
- * performance conscious manner. It trades a neglibable overhead in general
- * case for a large speedup in case of mappings being added in order.
- */
- function MappingList$1() {
- this._array = [];
- this._sorted = true;
- // Serves as infimum
- this._last = {generatedLine: -1, generatedColumn: 0};
- }
- /**
- * Iterate through internal items. This method takes the same arguments that
- * `Array.prototype.forEach` takes.
- *
- * NOTE: The order of the mappings is NOT guaranteed.
- */
- MappingList$1.prototype.unsortedForEach =
- function MappingList_forEach(aCallback, aThisArg) {
- this._array.forEach(aCallback, aThisArg);
- };
- /**
- * Add the given source mapping.
- *
- * @param Object aMapping
- */
- MappingList$1.prototype.add = function MappingList_add(aMapping) {
- if (generatedPositionAfter(this._last, aMapping)) {
- this._last = aMapping;
- this._array.push(aMapping);
- } else {
- this._sorted = false;
- this._array.push(aMapping);
- }
- };
- /**
- * Returns the flat, sorted array of mappings. The mappings are sorted by
- * generated position.
- *
- * WARNING: This method returns internal data without copying, for
- * performance. The return value must NOT be mutated, and should be treated as
- * an immutable borrow. If you want to take ownership, you must make your own
- * copy.
- */
- MappingList$1.prototype.toArray = function MappingList_toArray() {
- if (!this._sorted) {
- this._array.sort(util$1.compareByGeneratedPositionsInflated);
- this._sorted = true;
- }
- return this._array;
- };
- mappingList.MappingList = MappingList$1;
- /* -*- Mode: js; js-indent-level: 2; -*- */
- /*
- * Copyright 2011 Mozilla Foundation and contributors
- * Licensed under the New BSD license. See LICENSE or:
- * http://opensource.org/licenses/BSD-3-Clause
- */
- var base64VLQ = base64Vlq;
- var util = util$3;
- var ArraySet = arraySet.ArraySet;
- var MappingList = mappingList.MappingList;
- /**
- * An instance of the SourceMapGenerator represents a source map which is
- * being built incrementally. You may pass an object with the following
- * properties:
- *
- * - file: The filename of the generated source.
- * - sourceRoot: A root for all relative URLs in this source map.
- */
- function SourceMapGenerator$1(aArgs) {
- if (!aArgs) {
- aArgs = {};
- }
- this._file = util.getArg(aArgs, 'file', null);
- this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null);
- this._skipValidation = util.getArg(aArgs, 'skipValidation', false);
- this._sources = new ArraySet();
- this._names = new ArraySet();
- this._mappings = new MappingList();
- this._sourcesContents = null;
- }
- SourceMapGenerator$1.prototype._version = 3;
- /**
- * Creates a new SourceMapGenerator based on a SourceMapConsumer
- *
- * @param aSourceMapConsumer The SourceMap.
- */
- SourceMapGenerator$1.fromSourceMap =
- function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) {
- var sourceRoot = aSourceMapConsumer.sourceRoot;
- var generator = new SourceMapGenerator$1({
- file: aSourceMapConsumer.file,
- sourceRoot: sourceRoot
- });
- aSourceMapConsumer.eachMapping(function (mapping) {
- var newMapping = {
- generated: {
- line: mapping.generatedLine,
- column: mapping.generatedColumn
- }
- };
- if (mapping.source != null) {
- newMapping.source = mapping.source;
- if (sourceRoot != null) {
- newMapping.source = util.relative(sourceRoot, newMapping.source);
- }
- newMapping.original = {
- line: mapping.originalLine,
- column: mapping.originalColumn
- };
- if (mapping.name != null) {
- newMapping.name = mapping.name;
- }
- }
- generator.addMapping(newMapping);
- });
- aSourceMapConsumer.sources.forEach(function (sourceFile) {
- var sourceRelative = sourceFile;
- if (sourceRoot !== null) {
- sourceRelative = util.relative(sourceRoot, sourceFile);
- }
- if (!generator._sources.has(sourceRelative)) {
- generator._sources.add(sourceRelative);
- }
- var content = aSourceMapConsumer.sourceContentFor(sourceFile);
- if (content != null) {
- generator.setSourceContent(sourceFile, content);
- }
- });
- return generator;
- };
- /**
- * Add a single mapping from original source line and column to the generated
- * source's line and column for this source map being created. The mapping
- * object should have the following properties:
- *
- * - generated: An object with the generated line and column positions.
- * - original: An object with the original line and column positions.
- * - source: The original source file (relative to the sourceRoot).
- * - name: An optional original token name for this mapping.
- */
- SourceMapGenerator$1.prototype.addMapping =
- function SourceMapGenerator_addMapping(aArgs) {
- var generated = util.getArg(aArgs, 'generated');
- var original = util.getArg(aArgs, 'original', null);
- var source = util.getArg(aArgs, 'source', null);
- var name = util.getArg(aArgs, 'name', null);
- if (!this._skipValidation) {
- this._validateMapping(generated, original, source, name);
- }
- if (source != null) {
- source = String(source);
- if (!this._sources.has(source)) {
- this._sources.add(source);
- }
- }
- if (name != null) {
- name = String(name);
- if (!this._names.has(name)) {
- this._names.add(name);
- }
- }
- this._mappings.add({
- generatedLine: generated.line,
- generatedColumn: generated.column,
- originalLine: original != null && original.line,
- originalColumn: original != null && original.column,
- source: source,
- name: name
- });
- };
- /**
- * Set the source content for a source file.
- */
- SourceMapGenerator$1.prototype.setSourceContent =
- function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) {
- var source = aSourceFile;
- if (this._sourceRoot != null) {
- source = util.relative(this._sourceRoot, source);
- }
- if (aSourceContent != null) {
- // Add the source content to the _sourcesContents map.
- // Create a new _sourcesContents map if the property is null.
- if (!this._sourcesContents) {
- this._sourcesContents = Object.create(null);
- }
- this._sourcesContents[util.toSetString(source)] = aSourceContent;
- } else if (this._sourcesContents) {
- // Remove the source file from the _sourcesContents map.
- // If the _sourcesContents map is empty, set the property to null.
- delete this._sourcesContents[util.toSetString(source)];
- if (Object.keys(this._sourcesContents).length === 0) {
- this._sourcesContents = null;
- }
- }
- };
- /**
- * Applies the mappings of a sub-source-map for a specific source file to the
- * source map being generated. Each mapping to the supplied source file is
- * rewritten using the supplied source map. Note: The resolution for the
- * resulting mappings is the minimium of this map and the supplied map.
- *
- * @param aSourceMapConsumer The source map to be applied.
- * @param aSourceFile Optional. The filename of the source file.
- * If omitted, SourceMapConsumer's file property will be used.
- * @param aSourceMapPath Optional. The dirname of the path to the source map
- * to be applied. If relative, it is relative to the SourceMapConsumer.
- * This parameter is needed when the two source maps aren't in the same
- * directory, and the source map to be applied contains relative source
- * paths. If so, those relative source paths need to be rewritten
- * relative to the SourceMapGenerator.
- */
- SourceMapGenerator$1.prototype.applySourceMap =
- function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) {
- var sourceFile = aSourceFile;
- // If aSourceFile is omitted, we will use the file property of the SourceMap
- if (aSourceFile == null) {
- if (aSourceMapConsumer.file == null) {
- throw new Error(
- 'SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' +
- 'or the source map\'s "file" property. Both were omitted.'
- );
- }
- sourceFile = aSourceMapConsumer.file;
- }
- var sourceRoot = this._sourceRoot;
- // Make "sourceFile" relative if an absolute Url is passed.
- if (sourceRoot != null) {
- sourceFile = util.relative(sourceRoot, sourceFile);
- }
- // Applying the SourceMap can add and remove items from the sources and
- // the names array.
- var newSources = new ArraySet();
- var newNames = new ArraySet();
- // Find mappings for the "sourceFile"
- this._mappings.unsortedForEach(function (mapping) {
- if (mapping.source === sourceFile && mapping.originalLine != null) {
- // Check if it can be mapped by the source map, then update the mapping.
- var original = aSourceMapConsumer.originalPositionFor({
- line: mapping.originalLine,
- column: mapping.originalColumn
- });
- if (original.source != null) {
- // Copy mapping
- mapping.source = original.source;
- if (aSourceMapPath != null) {
- mapping.source = util.join(aSourceMapPath, mapping.source);
- }
- if (sourceRoot != null) {
- mapping.source = util.relative(sourceRoot, mapping.source);
- }
- mapping.originalLine = original.line;
- mapping.originalColumn = original.column;
- if (original.name != null) {
- mapping.name = original.name;
- }
- }
- }
- var source = mapping.source;
- if (source != null && !newSources.has(source)) {
- newSources.add(source);
- }
- var name = mapping.name;
- if (name != null && !newNames.has(name)) {
- newNames.add(name);
- }
- }, this);
- this._sources = newSources;
- this._names = newNames;
- // Copy sourcesContents of applied map.
- aSourceMapConsumer.sources.forEach(function (sourceFile) {
- var content = aSourceMapConsumer.sourceContentFor(sourceFile);
- if (content != null) {
- if (aSourceMapPath != null) {
- sourceFile = util.join(aSourceMapPath, sourceFile);
- }
- if (sourceRoot != null) {
- sourceFile = util.relative(sourceRoot, sourceFile);
- }
- this.setSourceContent(sourceFile, content);
- }
- }, this);
- };
- /**
- * A mapping can have one of the three levels of data:
- *
- * 1. Just the generated position.
- * 2. The Generated position, original position, and original source.
- * 3. Generated and original position, original source, as well as a name
- * token.
- *
- * To maintain consistency, we validate that any new mapping being added falls
- * in to one of these categories.
- */
- SourceMapGenerator$1.prototype._validateMapping =
- function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource,
- aName) {
- // When aOriginal is truthy but has empty values for .line and .column,
- // it is most likely a programmer error. In this case we throw a very
- // specific error message to try to guide them the right way.
- // For example: https://github.com/Polymer/polymer-bundler/pull/519
- if (aOriginal && typeof aOriginal.line !== 'number' && typeof aOriginal.column !== 'number') {
- throw new Error(
- 'original.line and original.column are not numbers -- you probably meant to omit ' +
- 'the original mapping entirely and only map the generated position. If so, pass ' +
- 'null for the original mapping instead of an object with empty or null values.'
- );
- }
- if (aGenerated && 'line' in aGenerated && 'column' in aGenerated
- && aGenerated.line > 0 && aGenerated.column >= 0
- && !aOriginal && !aSource && !aName) {
- // Case 1.
- return;
- }
- else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated
- && aOriginal && 'line' in aOriginal && 'column' in aOriginal
- && aGenerated.line > 0 && aGenerated.column >= 0
- && aOriginal.line > 0 && aOriginal.column >= 0
- && aSource) {
- // Cases 2 and 3.
- return;
- }
- else {
- throw new Error('Invalid mapping: ' + JSON.stringify({
- generated: aGenerated,
- source: aSource,
- original: aOriginal,
- name: aName
- }));
- }
- };
- /**
- * Serialize the accumulated mappings in to the stream of base 64 VLQs
- * specified by the source map format.
- */
- SourceMapGenerator$1.prototype._serializeMappings =
- function SourceMapGenerator_serializeMappings() {
- var previousGeneratedColumn = 0;
- var previousGeneratedLine = 1;
- var previousOriginalColumn = 0;
- var previousOriginalLine = 0;
- var previousName = 0;
- var previousSource = 0;
- var result = '';
- var next;
- var mapping;
- var nameIdx;
- var sourceIdx;
- var mappings = this._mappings.toArray();
- for (var i = 0, len = mappings.length; i < len; i++) {
- mapping = mappings[i];
- next = '';
- if (mapping.generatedLine !== previousGeneratedLine) {
- previousGeneratedColumn = 0;
- while (mapping.generatedLine !== previousGeneratedLine) {
- next += ';';
- previousGeneratedLine++;
- }
- }
- else {
- if (i > 0) {
- if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) {
- continue;
- }
- next += ',';
- }
- }
- next += base64VLQ.encode(mapping.generatedColumn
- - previousGeneratedColumn);
- previousGeneratedColumn = mapping.generatedColumn;
- if (mapping.source != null) {
- sourceIdx = this._sources.indexOf(mapping.source);
- next += base64VLQ.encode(sourceIdx - previousSource);
- previousSource = sourceIdx;
- // lines are stored 0-based in SourceMap spec version 3
- next += base64VLQ.encode(mapping.originalLine - 1
- - previousOriginalLine);
- previousOriginalLine = mapping.originalLine - 1;
- next += base64VLQ.encode(mapping.originalColumn
- - previousOriginalColumn);
- previousOriginalColumn = mapping.originalColumn;
- if (mapping.name != null) {
- nameIdx = this._names.indexOf(mapping.name);
- next += base64VLQ.encode(nameIdx - previousName);
- previousName = nameIdx;
- }
- }
- result += next;
- }
- return result;
- };
- SourceMapGenerator$1.prototype._generateSourcesContent =
- function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) {
- return aSources.map(function (source) {
- if (!this._sourcesContents) {
- return null;
- }
- if (aSourceRoot != null) {
- source = util.relative(aSourceRoot, source);
- }
- var key = util.toSetString(source);
- return Object.prototype.hasOwnProperty.call(this._sourcesContents, key)
- ? this._sourcesContents[key]
- : null;
- }, this);
- };
- /**
- * Externalize the source map.
- */
- SourceMapGenerator$1.prototype.toJSON =
- function SourceMapGenerator_toJSON() {
- var map = {
- version: this._version,
- sources: this._sources.toArray(),
- names: this._names.toArray(),
- mappings: this._serializeMappings()
- };
- if (this._file != null) {
- map.file = this._file;
- }
- if (this._sourceRoot != null) {
- map.sourceRoot = this._sourceRoot;
- }
- if (this._sourcesContents) {
- map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot);
- }
- return map;
- };
- /**
- * Render the source map being generated to a string.
- */
- SourceMapGenerator$1.prototype.toString =
- function SourceMapGenerator_toString() {
- return JSON.stringify(this.toJSON());
- };
- sourceMapGenerator.SourceMapGenerator = SourceMapGenerator$1;
- var SourceMapGenerator = sourceMapGenerator.SourceMapGenerator;
- var trackNodes = {
- Atrule: true,
- Selector: true,
- Declaration: true
- };
- var sourceMap$1 = function generateSourceMap(handlers) {
- var map = new SourceMapGenerator();
- var line = 1;
- var column = 0;
- var generated = {
- line: 1,
- column: 0
- };
- var original = {
- line: 0, // should be zero to add first mapping
- column: 0
- };
- var sourceMappingActive = false;
- var activatedGenerated = {
- line: 1,
- column: 0
- };
- var activatedMapping = {
- generated: activatedGenerated
- };
- var handlersNode = handlers.node;
- handlers.node = function(node) {
- if (node.loc && node.loc.start && trackNodes.hasOwnProperty(node.type)) {
- var nodeLine = node.loc.start.line;
- var nodeColumn = node.loc.start.column - 1;
- if (original.line !== nodeLine ||
- original.column !== nodeColumn) {
- original.line = nodeLine;
- original.column = nodeColumn;
- generated.line = line;
- generated.column = column;
- if (sourceMappingActive) {
- sourceMappingActive = false;
- if (generated.line !== activatedGenerated.line ||
- generated.column !== activatedGenerated.column) {
- map.addMapping(activatedMapping);
- }
- }
- sourceMappingActive = true;
- map.addMapping({
- source: node.loc.source,
- original: original,
- generated: generated
- });
- }
- }
- handlersNode.call(this, node);
- if (sourceMappingActive && trackNodes.hasOwnProperty(node.type)) {
- activatedGenerated.line = line;
- activatedGenerated.column = column;
- }
- };
- var handlersChunk = handlers.chunk;
- handlers.chunk = function(chunk) {
- for (var i = 0; i < chunk.length; i++) {
- if (chunk.charCodeAt(i) === 10) { // \n
- line++;
- column = 0;
- } else {
- column++;
- }
- }
- handlersChunk(chunk);
- };
- var handlersResult = handlers.result;
- handlers.result = function() {
- if (sourceMappingActive) {
- map.addMapping(activatedMapping);
- }
- return {
- css: handlersResult(),
- map: map
- };
- };
- return handlers;
- };
- var sourceMap = sourceMap$1;
- var hasOwnProperty$4 = Object.prototype.hasOwnProperty;
- function processChildren(node, delimeter) {
- var list = node.children;
- var prev = null;
- if (typeof delimeter !== 'function') {
- list.forEach(this.node, this);
- } else {
- list.forEach(function(node) {
- if (prev !== null) {
- delimeter.call(this, prev);
- }
- this.node(node);
- prev = node;
- }, this);
- }
- }
- var create$2 = function createGenerator(config) {
- function processNode(node) {
- if (hasOwnProperty$4.call(types, node.type)) {
- types[node.type].call(this, node);
- } else {
- throw new Error('Unknown node type: ' + node.type);
- }
- }
- var types = {};
- if (config.node) {
- for (var name in config.node) {
- types[name] = config.node[name].generate;
- }
- }
- return function(node, options) {
- var buffer = '';
- var handlers = {
- children: processChildren,
- node: processNode,
- chunk: function(chunk) {
- buffer += chunk;
- },
- result: function() {
- return buffer;
- }
- };
- if (options) {
- if (typeof options.decorator === 'function') {
- handlers = options.decorator(handlers);
- }
- if (options.sourceMap) {
- handlers = sourceMap(handlers);
- }
- }
- handlers.node(node);
- return handlers.result();
- };
- };
- var List$2 = List_1;
- var create$1 = function createConvertors(walk) {
- return {
- fromPlainObject: function(ast) {
- walk(ast, {
- enter: function(node) {
- if (node.children && node.children instanceof List$2 === false) {
- node.children = new List$2().fromArray(node.children);
- }
- }
- });
- return ast;
- },
- toPlainObject: function(ast) {
- walk(ast, {
- leave: function(node) {
- if (node.children && node.children instanceof List$2) {
- node.children = node.children.toArray();
- }
- }
- });
- return ast;
- }
- };
- };
- var hasOwnProperty$3 = Object.prototype.hasOwnProperty;
- var noop = function() {};
- function ensureFunction(value) {
- return typeof value === 'function' ? value : noop;
- }
- function invokeForType(fn, type) {
- return function(node, item, list) {
- if (node.type === type) {
- fn.call(this, node, item, list);
- }
- };
- }
- function getWalkersFromStructure(name, nodeType) {
- var structure = nodeType.structure;
- var walkers = [];
- for (var key in structure) {
- if (hasOwnProperty$3.call(structure, key) === false) {
- continue;
- }
- var fieldTypes = structure[key];
- var walker = {
- name: key,
- type: false,
- nullable: false
- };
- if (!Array.isArray(structure[key])) {
- fieldTypes = [structure[key]];
- }
- for (var i = 0; i < fieldTypes.length; i++) {
- var fieldType = fieldTypes[i];
- if (fieldType === null) {
- walker.nullable = true;
- } else if (typeof fieldType === 'string') {
- walker.type = 'node';
- } else if (Array.isArray(fieldType)) {
- walker.type = 'list';
- }
- }
- if (walker.type) {
- walkers.push(walker);
- }
- }
- if (walkers.length) {
- return {
- context: nodeType.walkContext,
- fields: walkers
- };
- }
- return null;
- }
- function getTypesFromConfig(config) {
- var types = {};
- for (var name in config.node) {
- if (hasOwnProperty$3.call(config.node, name)) {
- var nodeType = config.node[name];
- if (!nodeType.structure) {
- throw new Error('Missed `structure` field in `' + name + '` node type definition');
- }
- types[name] = getWalkersFromStructure(name, nodeType);
- }
- }
- return types;
- }
- function createTypeIterator(config, reverse) {
- var fields = config.fields.slice();
- var contextName = config.context;
- var useContext = typeof contextName === 'string';
- if (reverse) {
- fields.reverse();
- }
- return function(node, context, walk, walkReducer) {
- var prevContextValue;
- if (useContext) {
- prevContextValue = context[contextName];
- context[contextName] = node;
- }
- for (var i = 0; i < fields.length; i++) {
- var field = fields[i];
- var ref = node[field.name];
- if (!field.nullable || ref) {
- if (field.type === 'list') {
- var breakWalk = reverse
- ? ref.reduceRight(walkReducer, false)
- : ref.reduce(walkReducer, false);
- if (breakWalk) {
- return true;
- }
- } else if (walk(ref)) {
- return true;
- }
- }
- }
- if (useContext) {
- context[contextName] = prevContextValue;
- }
- };
- }
- function createFastTraveralMap(iterators) {
- return {
- Atrule: {
- StyleSheet: iterators.StyleSheet,
- Atrule: iterators.Atrule,
- Rule: iterators.Rule,
- Block: iterators.Block
- },
- Rule: {
- StyleSheet: iterators.StyleSheet,
- Atrule: iterators.Atrule,
- Rule: iterators.Rule,
- Block: iterators.Block
- },
- Declaration: {
- StyleSheet: iterators.StyleSheet,
- Atrule: iterators.Atrule,
- Rule: iterators.Rule,
- Block: iterators.Block,
- DeclarationList: iterators.DeclarationList
- }
- };
- }
- var create = function createWalker(config) {
- var types = getTypesFromConfig(config);
- var iteratorsNatural = {};
- var iteratorsReverse = {};
- var breakWalk = Symbol('break-walk');
- var skipNode = Symbol('skip-node');
- for (var name in types) {
- if (hasOwnProperty$3.call(types, name) && types[name] !== null) {
- iteratorsNatural[name] = createTypeIterator(types[name], false);
- iteratorsReverse[name] = createTypeIterator(types[name], true);
- }
- }
- var fastTraversalIteratorsNatural = createFastTraveralMap(iteratorsNatural);
- var fastTraversalIteratorsReverse = createFastTraveralMap(iteratorsReverse);
- var walk = function(root, options) {
- function walkNode(node, item, list) {
- var enterRet = enter.call(context, node, item, list);
- if (enterRet === breakWalk) {
- debugger;
- return true;
- }
- if (enterRet === skipNode) {
- return false;
- }
- if (iterators.hasOwnProperty(node.type)) {
- if (iterators[node.type](node, context, walkNode, walkReducer)) {
- return true;
- }
- }
- if (leave.call(context, node, item, list) === breakWalk) {
- return true;
- }
- return false;
- }
- var walkReducer = (ret, data, item, list) => ret || walkNode(data, item, list);
- var enter = noop;
- var leave = noop;
- var iterators = iteratorsNatural;
- var context = {
- break: breakWalk,
- skip: skipNode,
- root: root,
- stylesheet: null,
- atrule: null,
- atrulePrelude: null,
- rule: null,
- selector: null,
- block: null,
- declaration: null,
- function: null
- };
- if (typeof options === 'function') {
- enter = options;
- } else if (options) {
- enter = ensureFunction(options.enter);
- leave = ensureFunction(options.leave);
- if (options.reverse) {
- iterators = iteratorsReverse;
- }
- if (options.visit) {
- if (fastTraversalIteratorsNatural.hasOwnProperty(options.visit)) {
- iterators = options.reverse
- ? fastTraversalIteratorsReverse[options.visit]
- : fastTraversalIteratorsNatural[options.visit];
- } else if (!types.hasOwnProperty(options.visit)) {
- throw new Error('Bad value `' + options.visit + '` for `visit` option (should be: ' + Object.keys(types).join(', ') + ')');
- }
- enter = invokeForType(enter, options.visit);
- leave = invokeForType(leave, options.visit);
- }
- }
- if (enter === noop && leave === noop) {
- throw new Error('Neither `enter` nor `leave` walker handler is set or both aren\'t a function');
- }
- walkNode(root);
- };
- walk.break = breakWalk;
- walk.skip = skipNode;
- walk.find = function(ast, fn) {
- var found = null;
- walk(ast, function(node, item, list) {
- if (fn.call(this, node, item, list)) {
- found = node;
- return breakWalk;
- }
- });
- return found;
- };
- walk.findLast = function(ast, fn) {
- var found = null;
- walk(ast, {
- reverse: true,
- enter: function(node, item, list) {
- if (fn.call(this, node, item, list)) {
- found = node;
- return breakWalk;
- }
- }
- });
- return found;
- };
- walk.findAll = function(ast, fn) {
- var found = [];
- walk(ast, function(node, item, list) {
- if (fn.call(this, node, item, list)) {
- found.push(node);
- }
- });
- return found;
- };
- return walk;
- };
- var List$1 = List_1;
- var clone$1 = function clone(node) {
- var result = {};
- for (var key in node) {
- var value = node[key];
- if (value) {
- if (Array.isArray(value) || value instanceof List$1) {
- value = value.map(clone);
- } else if (value.constructor === Object) {
- value = clone(value);
- }
- }
- result[key] = value;
- }
- return result;
- };
- const hasOwnProperty$2 = Object.prototype.hasOwnProperty;
- const shape$1 = {
- generic: true,
- types: appendOrAssign,
- atrules: {
- prelude: appendOrAssignOrNull,
- descriptors: appendOrAssignOrNull
- },
- properties: appendOrAssign,
- parseContext: assign,
- scope: deepAssign,
- atrule: ['parse'],
- pseudo: ['parse'],
- node: ['name', 'structure', 'parse', 'generate', 'walkContext']
- };
- function isObject$2(value) {
- return value && value.constructor === Object;
- }
- function copy(value) {
- return isObject$2(value)
- ? Object.assign({}, value)
- : value;
- }
- function assign(dest, src) {
- return Object.assign(dest, src);
- }
- function deepAssign(dest, src) {
- for (const key in src) {
- if (hasOwnProperty$2.call(src, key)) {
- if (isObject$2(dest[key])) {
- deepAssign(dest[key], copy(src[key]));
- } else {
- dest[key] = copy(src[key]);
- }
- }
- }
- return dest;
- }
- function append(a, b) {
- if (typeof b === 'string' && /^\s*\|/.test(b)) {
- return typeof a === 'string'
- ? a + b
- : b.replace(/^\s*\|\s*/, '');
- }
- return b || null;
- }
- function appendOrAssign(a, b) {
- if (typeof b === 'string') {
- return append(a, b);
- }
- const result = Object.assign({}, a);
- for (let key in b) {
- if (hasOwnProperty$2.call(b, key)) {
- result[key] = append(hasOwnProperty$2.call(a, key) ? a[key] : undefined, b[key]);
- }
- }
- return result;
- }
- function appendOrAssignOrNull(a, b) {
- const result = appendOrAssign(a, b);
- return !isObject$2(result) || Object.keys(result).length
- ? result
- : null;
- }
- function mix$1(dest, src, shape) {
- for (const key in shape) {
- if (hasOwnProperty$2.call(shape, key) === false) {
- continue;
- }
- if (shape[key] === true) {
- if (key in src) {
- if (hasOwnProperty$2.call(src, key)) {
- dest[key] = copy(src[key]);
- }
- }
- } else if (shape[key]) {
- if (typeof shape[key] === 'function') {
- const fn = shape[key];
- dest[key] = fn({}, dest[key]);
- dest[key] = fn(dest[key] || {}, src[key]);
- } else if (isObject$2(shape[key])) {
- const result = {};
- for (let name in dest[key]) {
- result[name] = mix$1({}, dest[key][name], shape[key]);
- }
- for (let name in src[key]) {
- result[name] = mix$1(result[name] || {}, src[key][name], shape[key]);
- }
- dest[key] = result;
- } else if (Array.isArray(shape[key])) {
- const res = {};
- const innerShape = shape[key].reduce(function(s, k) {
- s[k] = true;
- return s;
- }, {});
- for (const [name, value] of Object.entries(dest[key] || {})) {
- res[name] = {};
- if (value) {
- mix$1(res[name], value, innerShape);
- }
- }
- for (const name in src[key]) {
- if (hasOwnProperty$2.call(src[key], name)) {
- if (!res[name]) {
- res[name] = {};
- }
- if (src[key] && src[key][name]) {
- mix$1(res[name], src[key][name], innerShape);
- }
- }
- }
- dest[key] = res;
- }
- }
- }
- return dest;
- }
- var mix_1 = (dest, src) => mix$1(dest, src, shape$1);
- var List = List_1;
- var SyntaxError$1 = _SyntaxError$1;
- var TokenStream = TokenStream_1;
- var Lexer = Lexer_1;
- var definitionSyntax = definitionSyntax$1;
- var tokenize = tokenizer$3;
- var createParser = create$3;
- var createGenerator = create$2;
- var createConvertor = create$1;
- var createWalker = create;
- var clone = clone$1;
- var names = names$2;
- var mix = mix_1;
- function createSyntax(config) {
- var parse = createParser(config);
- var walk = createWalker(config);
- var generate = createGenerator(config);
- var convert = createConvertor(walk);
- var syntax = {
- List: List,
- SyntaxError: SyntaxError$1,
- TokenStream: TokenStream,
- Lexer: Lexer,
- vendorPrefix: names.vendorPrefix,
- keyword: names.keyword,
- property: names.property,
- isCustomProperty: names.isCustomProperty,
- definitionSyntax: definitionSyntax,
- lexer: null,
- createLexer: function(config) {
- return new Lexer(config, syntax, syntax.lexer.structure);
- },
- tokenize: tokenize,
- parse: parse,
- walk: walk,
- generate: generate,
- find: walk.find,
- findLast: walk.findLast,
- findAll: walk.findAll,
- clone: clone,
- fromPlainObject: convert.fromPlainObject,
- toPlainObject: convert.toPlainObject,
- createSyntax: function(config) {
- return createSyntax(mix({}, config));
- },
- fork: function(extension) {
- var base = mix({}, config); // copy of config
- return createSyntax(
- typeof extension === 'function'
- ? extension(base, Object.assign)
- : mix(base, extension)
- );
- }
- };
- syntax.lexer = new Lexer({
- generic: true,
- types: config.types,
- atrules: config.atrules,
- properties: config.properties,
- node: config.node
- }, syntax);
- return syntax;
- }
- create$4.create = function(config) {
- return createSyntax(mix({}, config));
- };
- var require$$0 = {
- "@charset": {
- syntax: "@charset \"<charset>\";",
- groups: [
- "CSS Charsets"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/@charset"
- },
- "@counter-style": {
- syntax: "@counter-style <counter-style-name> {\n [ system: <counter-system>; ] ||\n [ symbols: <counter-symbols>; ] ||\n [ additive-symbols: <additive-symbols>; ] ||\n [ negative: <negative-symbol>; ] ||\n [ prefix: <prefix>; ] ||\n [ suffix: <suffix>; ] ||\n [ range: <range>; ] ||\n [ pad: <padding>; ] ||\n [ speak-as: <speak-as>; ] ||\n [ fallback: <counter-style-name>; ]\n}",
- interfaces: [
- "CSSCounterStyleRule"
- ],
- groups: [
- "CSS Counter Styles"
- ],
- descriptors: {
- "additive-symbols": {
- syntax: "[ <integer> && <symbol> ]#",
- media: "all",
- initial: "n/a (required)",
- percentages: "no",
- computed: "asSpecified",
- order: "orderOfAppearance",
- status: "standard"
- },
- fallback: {
- syntax: "<counter-style-name>",
- media: "all",
- initial: "decimal",
- percentages: "no",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard"
- },
- negative: {
- syntax: "<symbol> <symbol>?",
- media: "all",
- initial: "\"-\" hyphen-minus",
- percentages: "no",
- computed: "asSpecified",
- order: "orderOfAppearance",
- status: "standard"
- },
- pad: {
- syntax: "<integer> && <symbol>",
- media: "all",
- initial: "0 \"\"",
- percentages: "no",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard"
- },
- prefix: {
- syntax: "<symbol>",
- media: "all",
- initial: "\"\"",
- percentages: "no",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard"
- },
- range: {
- syntax: "[ [ <integer> | infinite ]{2} ]# | auto",
- media: "all",
- initial: "auto",
- percentages: "no",
- computed: "asSpecified",
- order: "orderOfAppearance",
- status: "standard"
- },
- "speak-as": {
- syntax: "auto | bullets | numbers | words | spell-out | <counter-style-name>",
- media: "all",
- initial: "auto",
- percentages: "no",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard"
- },
- suffix: {
- syntax: "<symbol>",
- media: "all",
- initial: "\". \"",
- percentages: "no",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard"
- },
- symbols: {
- syntax: "<symbol>+",
- media: "all",
- initial: "n/a (required)",
- percentages: "no",
- computed: "asSpecified",
- order: "orderOfAppearance",
- status: "standard"
- },
- system: {
- syntax: "cyclic | numeric | alphabetic | symbolic | additive | [ fixed <integer>? ] | [ extends <counter-style-name> ]",
- media: "all",
- initial: "symbolic",
- percentages: "no",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard"
- }
- },
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/@counter-style"
- },
- "@document": {
- syntax: "@document [ <url> | url-prefix(<string>) | domain(<string>) | media-document(<string>) | regexp(<string>) ]# {\n <group-rule-body>\n}",
- interfaces: [
- "CSSGroupingRule",
- "CSSConditionRule"
- ],
- groups: [
- "CSS Conditional Rules"
- ],
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/@document"
- },
- "@font-face": {
- syntax: "@font-face {\n [ font-family: <family-name>; ] ||\n [ src: <src>; ] ||\n [ unicode-range: <unicode-range>; ] ||\n [ font-variant: <font-variant>; ] ||\n [ font-feature-settings: <font-feature-settings>; ] ||\n [ font-variation-settings: <font-variation-settings>; ] ||\n [ font-stretch: <font-stretch>; ] ||\n [ font-weight: <font-weight>; ] ||\n [ font-style: <font-style>; ]\n}",
- interfaces: [
- "CSSFontFaceRule"
- ],
- groups: [
- "CSS Fonts"
- ],
- descriptors: {
- "font-display": {
- syntax: "[ auto | block | swap | fallback | optional ]",
- media: "visual",
- percentages: "no",
- initial: "auto",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "experimental"
- },
- "font-family": {
- syntax: "<family-name>",
- media: "all",
- initial: "n/a (required)",
- percentages: "no",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard"
- },
- "font-feature-settings": {
- syntax: "normal | <feature-tag-value>#",
- media: "all",
- initial: "normal",
- percentages: "no",
- computed: "asSpecified",
- order: "orderOfAppearance",
- status: "standard"
- },
- "font-variation-settings": {
- syntax: "normal | [ <string> <number> ]#",
- media: "all",
- initial: "normal",
- percentages: "no",
- computed: "asSpecified",
- order: "orderOfAppearance",
- status: "standard"
- },
- "font-stretch": {
- syntax: "<font-stretch-absolute>{1,2}",
- media: "all",
- initial: "normal",
- percentages: "no",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard"
- },
- "font-style": {
- syntax: "normal | italic | oblique <angle>{0,2}",
- media: "all",
- initial: "normal",
- percentages: "no",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard"
- },
- "font-weight": {
- syntax: "<font-weight-absolute>{1,2}",
- media: "all",
- initial: "normal",
- percentages: "no",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard"
- },
- "font-variant": {
- syntax: "normal | none | [ <common-lig-values> || <discretionary-lig-values> || <historical-lig-values> || <contextual-alt-values> || stylistic(<feature-value-name>) || historical-forms || styleset(<feature-value-name>#) || character-variant(<feature-value-name>#) || swash(<feature-value-name>) || ornaments(<feature-value-name>) || annotation(<feature-value-name>) || [ small-caps | all-small-caps | petite-caps | all-petite-caps | unicase | titling-caps ] || <numeric-figure-values> || <numeric-spacing-values> || <numeric-fraction-values> || ordinal || slashed-zero || <east-asian-variant-values> || <east-asian-width-values> || ruby ]",
- media: "all",
- initial: "normal",
- percentages: "no",
- computed: "asSpecified",
- order: "orderOfAppearance",
- status: "standard"
- },
- src: {
- syntax: "[ <url> [ format( <string># ) ]? | local( <family-name> ) ]#",
- media: "all",
- initial: "n/a (required)",
- percentages: "no",
- computed: "asSpecified",
- order: "orderOfAppearance",
- status: "standard"
- },
- "unicode-range": {
- syntax: "<unicode-range>#",
- media: "all",
- initial: "U+0-10FFFF",
- percentages: "no",
- computed: "asSpecified",
- order: "orderOfAppearance",
- status: "standard"
- }
- },
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/@font-face"
- },
- "@font-feature-values": {
- syntax: "@font-feature-values <family-name># {\n <feature-value-block-list>\n}",
- interfaces: [
- "CSSFontFeatureValuesRule"
- ],
- groups: [
- "CSS Fonts"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/@font-feature-values"
- },
- "@import": {
- syntax: "@import [ <string> | <url> ] [ <media-query-list> ]?;",
- groups: [
- "Media Queries"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/@import"
- },
- "@keyframes": {
- syntax: "@keyframes <keyframes-name> {\n <keyframe-block-list>\n}",
- interfaces: [
- "CSSKeyframeRule",
- "CSSKeyframesRule"
- ],
- groups: [
- "CSS Animations"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/@keyframes"
- },
- "@media": {
- syntax: "@media <media-query-list> {\n <group-rule-body>\n}",
- interfaces: [
- "CSSGroupingRule",
- "CSSConditionRule",
- "CSSMediaRule",
- "CSSCustomMediaRule"
- ],
- groups: [
- "CSS Conditional Rules",
- "Media Queries"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/@media"
- },
- "@namespace": {
- syntax: "@namespace <namespace-prefix>? [ <string> | <url> ];",
- groups: [
- "CSS Namespaces"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/@namespace"
- },
- "@page": {
- syntax: "@page <page-selector-list> {\n <page-body>\n}",
- interfaces: [
- "CSSPageRule"
- ],
- groups: [
- "CSS Pages"
- ],
- descriptors: {
- bleed: {
- syntax: "auto | <length>",
- media: [
- "visual",
- "paged"
- ],
- initial: "auto",
- percentages: "no",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard"
- },
- marks: {
- syntax: "none | [ crop || cross ]",
- media: [
- "visual",
- "paged"
- ],
- initial: "none",
- percentages: "no",
- computed: "asSpecified",
- order: "orderOfAppearance",
- status: "standard"
- },
- size: {
- syntax: "<length>{1,2} | auto | [ <page-size> || [ portrait | landscape ] ]",
- media: [
- "visual",
- "paged"
- ],
- initial: "auto",
- percentages: "no",
- computed: "asSpecifiedRelativeToAbsoluteLengths",
- order: "orderOfAppearance",
- status: "standard"
- }
- },
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/@page"
- },
- "@property": {
- syntax: "@property <custom-property-name> {\n <declaration-list>\n}",
- interfaces: [
- "CSS",
- "CSSPropertyRule"
- ],
- groups: [
- "CSS Houdini"
- ],
- descriptors: {
- syntax: {
- syntax: "<string>",
- media: "all",
- percentages: "no",
- initial: "n/a (required)",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "experimental"
- },
- inherits: {
- syntax: "true | false",
- media: "all",
- percentages: "no",
- initial: "auto",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "experimental"
- },
- "initial-value": {
- syntax: "<string>",
- media: "all",
- initial: "n/a (required)",
- percentages: "no",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "experimental"
- }
- },
- status: "experimental",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/@property"
- },
- "@supports": {
- syntax: "@supports <supports-condition> {\n <group-rule-body>\n}",
- interfaces: [
- "CSSGroupingRule",
- "CSSConditionRule",
- "CSSSupportsRule"
- ],
- groups: [
- "CSS Conditional Rules"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/@supports"
- },
- "@viewport": {
- syntax: "@viewport {\n <group-rule-body>\n}",
- interfaces: [
- "CSSViewportRule"
- ],
- groups: [
- "CSS Device Adaptation"
- ],
- descriptors: {
- height: {
- syntax: "<viewport-length>{1,2}",
- media: [
- "visual",
- "continuous"
- ],
- initial: [
- "min-height",
- "max-height"
- ],
- percentages: [
- "min-height",
- "max-height"
- ],
- computed: [
- "min-height",
- "max-height"
- ],
- order: "orderOfAppearance",
- status: "standard"
- },
- "max-height": {
- syntax: "<viewport-length>",
- media: [
- "visual",
- "continuous"
- ],
- initial: "auto",
- percentages: "referToHeightOfInitialViewport",
- computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
- order: "uniqueOrder",
- status: "standard"
- },
- "max-width": {
- syntax: "<viewport-length>",
- media: [
- "visual",
- "continuous"
- ],
- initial: "auto",
- percentages: "referToWidthOfInitialViewport",
- computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
- order: "uniqueOrder",
- status: "standard"
- },
- "max-zoom": {
- syntax: "auto | <number> | <percentage>",
- media: [
- "visual",
- "continuous"
- ],
- initial: "auto",
- percentages: "the zoom factor itself",
- computed: "autoNonNegativeOrPercentage",
- order: "uniqueOrder",
- status: "standard"
- },
- "min-height": {
- syntax: "<viewport-length>",
- media: [
- "visual",
- "continuous"
- ],
- initial: "auto",
- percentages: "referToHeightOfInitialViewport",
- computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
- order: "uniqueOrder",
- status: "standard"
- },
- "min-width": {
- syntax: "<viewport-length>",
- media: [
- "visual",
- "continuous"
- ],
- initial: "auto",
- percentages: "referToWidthOfInitialViewport",
- computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
- order: "uniqueOrder",
- status: "standard"
- },
- "min-zoom": {
- syntax: "auto | <number> | <percentage>",
- media: [
- "visual",
- "continuous"
- ],
- initial: "auto",
- percentages: "the zoom factor itself",
- computed: "autoNonNegativeOrPercentage",
- order: "uniqueOrder",
- status: "standard"
- },
- orientation: {
- syntax: "auto | portrait | landscape",
- media: [
- "visual",
- "continuous"
- ],
- initial: "auto",
- percentages: "referToSizeOfBoundingBox",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard"
- },
- "user-zoom": {
- syntax: "zoom | fixed",
- media: [
- "visual",
- "continuous"
- ],
- initial: "zoom",
- percentages: "referToSizeOfBoundingBox",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard"
- },
- "viewport-fit": {
- syntax: "auto | contain | cover",
- media: [
- "visual",
- "continuous"
- ],
- initial: "auto",
- percentages: "no",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard"
- },
- width: {
- syntax: "<viewport-length>{1,2}",
- media: [
- "visual",
- "continuous"
- ],
- initial: [
- "min-width",
- "max-width"
- ],
- percentages: [
- "min-width",
- "max-width"
- ],
- computed: [
- "min-width",
- "max-width"
- ],
- order: "orderOfAppearance",
- status: "standard"
- },
- zoom: {
- syntax: "auto | <number> | <percentage>",
- media: [
- "visual",
- "continuous"
- ],
- initial: "auto",
- percentages: "the zoom factor itself",
- computed: "autoNonNegativeOrPercentage",
- order: "uniqueOrder",
- status: "standard"
- }
- },
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/@viewport"
- }
- };
- var all = {
- syntax: "initial | inherit | unset | revert",
- media: "noPracticalMedia",
- inherited: false,
- animationType: "eachOfShorthandPropertiesExceptUnicodeBiDiAndDirection",
- percentages: "no",
- groups: [
- "CSS Miscellaneous"
- ],
- initial: "noPracticalInitialValue",
- appliesto: "allElements",
- computed: "asSpecifiedAppliesToEachProperty",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/all"
- };
- var animation = {
- syntax: "<single-animation>#",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Animations"
- ],
- initial: [
- "animation-name",
- "animation-duration",
- "animation-timing-function",
- "animation-delay",
- "animation-iteration-count",
- "animation-direction",
- "animation-fill-mode",
- "animation-play-state"
- ],
- appliesto: "allElementsAndPseudos",
- computed: [
- "animation-name",
- "animation-duration",
- "animation-timing-function",
- "animation-delay",
- "animation-direction",
- "animation-iteration-count",
- "animation-fill-mode",
- "animation-play-state"
- ],
- order: "orderOfAppearance",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/animation"
- };
- var appearance = {
- syntax: "none | auto | textfield | menulist-button | <compat-auto>",
- media: "all",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Basic User Interface"
- ],
- initial: "auto",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "perGrammar",
- status: "experimental",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/appearance"
- };
- var azimuth = {
- syntax: "<angle> | [ [ left-side | far-left | left | center-left | center | center-right | right | far-right | right-side ] || behind ] | leftwards | rightwards",
- media: "aural",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Speech"
- ],
- initial: "center",
- appliesto: "allElements",
- computed: "normalizedAngle",
- order: "orderOfAppearance",
- status: "obsolete",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/azimuth"
- };
- var background = {
- syntax: "[ <bg-layer> , ]* <final-bg-layer>",
- media: "visual",
- inherited: false,
- animationType: [
- "background-color",
- "background-image",
- "background-clip",
- "background-position",
- "background-size",
- "background-repeat",
- "background-attachment"
- ],
- percentages: [
- "background-position",
- "background-size"
- ],
- groups: [
- "CSS Backgrounds and Borders"
- ],
- initial: [
- "background-image",
- "background-position",
- "background-size",
- "background-repeat",
- "background-origin",
- "background-clip",
- "background-attachment",
- "background-color"
- ],
- appliesto: "allElements",
- computed: [
- "background-image",
- "background-position",
- "background-size",
- "background-repeat",
- "background-origin",
- "background-clip",
- "background-attachment",
- "background-color"
- ],
- order: "orderOfAppearance",
- alsoAppliesTo: [
- "::first-letter",
- "::first-line",
- "::placeholder"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/background"
- };
- var border = {
- syntax: "<line-width> || <line-style> || <color>",
- media: "visual",
- inherited: false,
- animationType: [
- "border-color",
- "border-style",
- "border-width"
- ],
- percentages: "no",
- groups: [
- "CSS Backgrounds and Borders"
- ],
- initial: [
- "border-width",
- "border-style",
- "border-color"
- ],
- appliesto: "allElements",
- computed: [
- "border-width",
- "border-style",
- "border-color"
- ],
- order: "orderOfAppearance",
- alsoAppliesTo: [
- "::first-letter"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border"
- };
- var bottom = {
- syntax: "<length> | <percentage> | auto",
- media: "visual",
- inherited: false,
- animationType: "lpc",
- percentages: "referToContainingBlockHeight",
- groups: [
- "CSS Positioning"
- ],
- initial: "auto",
- appliesto: "positionedElements",
- computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/bottom"
- };
- var clear = {
- syntax: "none | left | right | both | inline-start | inline-end",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Positioning"
- ],
- initial: "none",
- appliesto: "blockLevelElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/clear"
- };
- var clip = {
- syntax: "<shape> | auto",
- media: "visual",
- inherited: false,
- animationType: "rectangle",
- percentages: "no",
- groups: [
- "CSS Masking"
- ],
- initial: "auto",
- appliesto: "absolutelyPositionedElements",
- computed: "autoOrRectangle",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/clip"
- };
- var color$1 = {
- syntax: "<color>",
- media: "visual",
- inherited: true,
- animationType: "color",
- percentages: "no",
- groups: [
- "CSS Color"
- ],
- initial: "variesFromBrowserToBrowser",
- appliesto: "allElements",
- computed: "translucentValuesRGBAOtherwiseRGB",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter",
- "::first-line",
- "::placeholder"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/color"
- };
- var columns = {
- syntax: "<'column-width'> || <'column-count'>",
- media: "visual",
- inherited: false,
- animationType: [
- "column-width",
- "column-count"
- ],
- percentages: "no",
- groups: [
- "CSS Columns"
- ],
- initial: [
- "column-width",
- "column-count"
- ],
- appliesto: "blockContainersExceptTableWrappers",
- computed: [
- "column-width",
- "column-count"
- ],
- order: "perGrammar",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/columns"
- };
- var contain = {
- syntax: "none | strict | content | [ size || layout || style || paint ]",
- media: "all",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Containment"
- ],
- initial: "none",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "perGrammar",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/contain"
- };
- var content = {
- syntax: "normal | none | [ <content-replacement> | <content-list> ] [/ <string> ]?",
- media: "all",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Generated Content"
- ],
- initial: "normal",
- appliesto: "beforeAndAfterPseudos",
- computed: "normalOnElementsForPseudosNoneAbsoluteURIStringOrAsSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/content"
- };
- var cursor = {
- syntax: "[ [ <url> [ <x> <y> ]? , ]* [ auto | default | none | context-menu | help | pointer | progress | wait | cell | crosshair | text | vertical-text | alias | copy | move | no-drop | not-allowed | e-resize | n-resize | ne-resize | nw-resize | s-resize | se-resize | sw-resize | w-resize | ew-resize | ns-resize | nesw-resize | nwse-resize | col-resize | row-resize | all-scroll | zoom-in | zoom-out | grab | grabbing ] ]",
- media: [
- "visual",
- "interactive"
- ],
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Basic User Interface"
- ],
- initial: "auto",
- appliesto: "allElements",
- computed: "asSpecifiedURLsAbsolute",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/cursor"
- };
- var direction = {
- syntax: "ltr | rtl",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Writing Modes"
- ],
- initial: "ltr",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/direction"
- };
- var display = {
- syntax: "[ <display-outside> || <display-inside> ] | <display-listitem> | <display-internal> | <display-box> | <display-legacy>",
- media: "all",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Display"
- ],
- initial: "inline",
- appliesto: "allElements",
- computed: "asSpecifiedExceptPositionedFloatingAndRootElementsKeywordMaybeDifferent",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/display"
- };
- var filter = {
- syntax: "none | <filter-function-list>",
- media: "visual",
- inherited: false,
- animationType: "filterList",
- percentages: "no",
- groups: [
- "Filter Effects"
- ],
- initial: "none",
- appliesto: "allElementsSVGContainerElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/filter"
- };
- var flex = {
- syntax: "none | [ <'flex-grow'> <'flex-shrink'>? || <'flex-basis'> ]",
- media: "visual",
- inherited: false,
- animationType: [
- "flex-grow",
- "flex-shrink",
- "flex-basis"
- ],
- percentages: "no",
- groups: [
- "CSS Flexible Box Layout"
- ],
- initial: [
- "flex-grow",
- "flex-shrink",
- "flex-basis"
- ],
- appliesto: "flexItemsAndInFlowPseudos",
- computed: [
- "flex-grow",
- "flex-shrink",
- "flex-basis"
- ],
- order: "orderOfAppearance",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/flex"
- };
- var float = {
- syntax: "left | right | none | inline-start | inline-end",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Positioning"
- ],
- initial: "none",
- appliesto: "allElementsNoEffectIfDisplayNone",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/float"
- };
- var font = {
- syntax: "[ [ <'font-style'> || <font-variant-css21> || <'font-weight'> || <'font-stretch'> ]? <'font-size'> [ / <'line-height'> ]? <'font-family'> ] | caption | icon | menu | message-box | small-caption | status-bar",
- media: "visual",
- inherited: true,
- animationType: [
- "font-style",
- "font-variant",
- "font-weight",
- "font-stretch",
- "font-size",
- "line-height",
- "font-family"
- ],
- percentages: [
- "font-size",
- "line-height"
- ],
- groups: [
- "CSS Fonts"
- ],
- initial: [
- "font-style",
- "font-variant",
- "font-weight",
- "font-stretch",
- "font-size",
- "line-height",
- "font-family"
- ],
- appliesto: "allElements",
- computed: [
- "font-style",
- "font-variant",
- "font-weight",
- "font-stretch",
- "font-size",
- "line-height",
- "font-family"
- ],
- order: "orderOfAppearance",
- alsoAppliesTo: [
- "::first-letter",
- "::first-line",
- "::placeholder"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font"
- };
- var gap = {
- syntax: "<'row-gap'> <'column-gap'>?",
- media: "visual",
- inherited: false,
- animationType: [
- "row-gap",
- "column-gap"
- ],
- percentages: "no",
- groups: [
- "CSS Box Alignment"
- ],
- initial: [
- "row-gap",
- "column-gap"
- ],
- appliesto: "multiColumnElementsFlexContainersGridContainers",
- computed: [
- "row-gap",
- "column-gap"
- ],
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/gap"
- };
- var grid = {
- syntax: "<'grid-template'> | <'grid-template-rows'> / [ auto-flow && dense? ] <'grid-auto-columns'>? | [ auto-flow && dense? ] <'grid-auto-rows'>? / <'grid-template-columns'>",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: [
- "grid-template-rows",
- "grid-template-columns",
- "grid-auto-rows",
- "grid-auto-columns"
- ],
- groups: [
- "CSS Grid Layout"
- ],
- initial: [
- "grid-template-rows",
- "grid-template-columns",
- "grid-template-areas",
- "grid-auto-rows",
- "grid-auto-columns",
- "grid-auto-flow",
- "grid-column-gap",
- "grid-row-gap",
- "column-gap",
- "row-gap"
- ],
- appliesto: "gridContainers",
- computed: [
- "grid-template-rows",
- "grid-template-columns",
- "grid-template-areas",
- "grid-auto-rows",
- "grid-auto-columns",
- "grid-auto-flow",
- "grid-column-gap",
- "grid-row-gap",
- "column-gap",
- "row-gap"
- ],
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid"
- };
- var height = {
- syntax: "auto | <length> | <percentage> | min-content | max-content | fit-content(<length-percentage>)",
- media: "visual",
- inherited: false,
- animationType: "lpc",
- percentages: "regardingHeightOfGeneratedBoxContainingBlockPercentagesRelativeToContainingBlock",
- groups: [
- "CSS Box Model"
- ],
- initial: "auto",
- appliesto: "allElementsButNonReplacedAndTableColumns",
- computed: "percentageAutoOrAbsoluteLength",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/height"
- };
- var hyphens = {
- syntax: "none | manual | auto",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Text"
- ],
- initial: "manual",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/hyphens"
- };
- var inset = {
- syntax: "<'top'>{1,4}",
- media: "visual",
- inherited: false,
- animationType: "lpc",
- percentages: "logicalHeightOfContainingBlock",
- groups: [
- "CSS Logical Properties"
- ],
- initial: "auto",
- appliesto: "positionedElements",
- computed: "sameAsBoxOffsets",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/inset"
- };
- var isolation = {
- syntax: "auto | isolate",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Compositing and Blending"
- ],
- initial: "auto",
- appliesto: "allElementsSVGContainerGraphicsAndGraphicsReferencingElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/isolation"
- };
- var left = {
- syntax: "<length> | <percentage> | auto",
- media: "visual",
- inherited: false,
- animationType: "lpc",
- percentages: "referToWidthOfContainingBlock",
- groups: [
- "CSS Positioning"
- ],
- initial: "auto",
- appliesto: "positionedElements",
- computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/left"
- };
- var margin = {
- syntax: "[ <length> | <percentage> | auto ]{1,4}",
- media: "visual",
- inherited: false,
- animationType: "length",
- percentages: "referToWidthOfContainingBlock",
- groups: [
- "CSS Box Model"
- ],
- initial: [
- "margin-bottom",
- "margin-left",
- "margin-right",
- "margin-top"
- ],
- appliesto: "allElementsExceptTableDisplayTypes",
- computed: [
- "margin-bottom",
- "margin-left",
- "margin-right",
- "margin-top"
- ],
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter",
- "::first-line"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/margin"
- };
- var mask = {
- syntax: "<mask-layer>#",
- media: "visual",
- inherited: false,
- animationType: [
- "mask-image",
- "mask-mode",
- "mask-repeat",
- "mask-position",
- "mask-clip",
- "mask-origin",
- "mask-size",
- "mask-composite"
- ],
- percentages: [
- "mask-position"
- ],
- groups: [
- "CSS Masking"
- ],
- initial: [
- "mask-image",
- "mask-mode",
- "mask-repeat",
- "mask-position",
- "mask-clip",
- "mask-origin",
- "mask-size",
- "mask-composite"
- ],
- appliesto: "allElementsSVGContainerElements",
- computed: [
- "mask-image",
- "mask-mode",
- "mask-repeat",
- "mask-position",
- "mask-clip",
- "mask-origin",
- "mask-size",
- "mask-composite"
- ],
- order: "perGrammar",
- stacking: true,
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask"
- };
- var offset = {
- syntax: "[ <'offset-position'>? [ <'offset-path'> [ <'offset-distance'> || <'offset-rotate'> ]? ]? ]! [ / <'offset-anchor'> ]?",
- media: "visual",
- inherited: false,
- animationType: [
- "offset-position",
- "offset-path",
- "offset-distance",
- "offset-anchor",
- "offset-rotate"
- ],
- percentages: [
- "offset-position",
- "offset-distance",
- "offset-anchor"
- ],
- groups: [
- "CSS Motion Path"
- ],
- initial: [
- "offset-position",
- "offset-path",
- "offset-distance",
- "offset-anchor",
- "offset-rotate"
- ],
- appliesto: "transformableElements",
- computed: [
- "offset-position",
- "offset-path",
- "offset-distance",
- "offset-anchor",
- "offset-rotate"
- ],
- order: "perGrammar",
- stacking: true,
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/offset"
- };
- var opacity = {
- syntax: "<alpha-value>",
- media: "visual",
- inherited: false,
- animationType: "number",
- percentages: "no",
- groups: [
- "CSS Color"
- ],
- initial: "1.0",
- appliesto: "allElements",
- computed: "specifiedValueClipped0To1",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::placeholder"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/opacity"
- };
- var order = {
- syntax: "<integer>",
- media: "visual",
- inherited: false,
- animationType: "integer",
- percentages: "no",
- groups: [
- "CSS Flexible Box Layout"
- ],
- initial: "0",
- appliesto: "flexItemsGridItemsAbsolutelyPositionedContainerChildren",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/order"
- };
- var orphans = {
- syntax: "<integer>",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Fragmentation"
- ],
- initial: "2",
- appliesto: "blockContainerElements",
- computed: "asSpecified",
- order: "perGrammar",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/orphans"
- };
- var outline = {
- syntax: "[ <'outline-color'> || <'outline-style'> || <'outline-width'> ]",
- media: [
- "visual",
- "interactive"
- ],
- inherited: false,
- animationType: [
- "outline-color",
- "outline-width",
- "outline-style"
- ],
- percentages: "no",
- groups: [
- "CSS Basic User Interface"
- ],
- initial: [
- "outline-color",
- "outline-style",
- "outline-width"
- ],
- appliesto: "allElements",
- computed: [
- "outline-color",
- "outline-width",
- "outline-style"
- ],
- order: "orderOfAppearance",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/outline"
- };
- var overflow = {
- syntax: "[ visible | hidden | clip | scroll | auto ]{1,2}",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Overflow"
- ],
- initial: "visible",
- appliesto: "blockContainersFlexContainersGridContainers",
- computed: [
- "overflow-x",
- "overflow-y"
- ],
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/overflow"
- };
- var padding = {
- syntax: "[ <length> | <percentage> ]{1,4}",
- media: "visual",
- inherited: false,
- animationType: "length",
- percentages: "referToWidthOfContainingBlock",
- groups: [
- "CSS Box Model"
- ],
- initial: [
- "padding-bottom",
- "padding-left",
- "padding-right",
- "padding-top"
- ],
- appliesto: "allElementsExceptInternalTableDisplayTypes",
- computed: [
- "padding-bottom",
- "padding-left",
- "padding-right",
- "padding-top"
- ],
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter",
- "::first-line"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/padding"
- };
- var perspective = {
- syntax: "none | <length>",
- media: "visual",
- inherited: false,
- animationType: "length",
- percentages: "no",
- groups: [
- "CSS Transforms"
- ],
- initial: "none",
- appliesto: "transformableElements",
- computed: "absoluteLengthOrNone",
- order: "uniqueOrder",
- stacking: true,
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/perspective"
- };
- var position$1 = {
- syntax: "static | relative | absolute | sticky | fixed",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Positioning"
- ],
- initial: "static",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- stacking: true,
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/position"
- };
- var quotes = {
- syntax: "none | auto | [ <string> <string> ]+",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Generated Content"
- ],
- initial: "dependsOnUserAgent",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/quotes"
- };
- var resize = {
- syntax: "none | both | horizontal | vertical | block | inline",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Basic User Interface"
- ],
- initial: "none",
- appliesto: "elementsWithOverflowNotVisibleAndReplacedElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/resize"
- };
- var right = {
- syntax: "<length> | <percentage> | auto",
- media: "visual",
- inherited: false,
- animationType: "lpc",
- percentages: "referToWidthOfContainingBlock",
- groups: [
- "CSS Positioning"
- ],
- initial: "auto",
- appliesto: "positionedElements",
- computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/right"
- };
- var rotate = {
- syntax: "none | <angle> | [ x | y | z | <number>{3} ] && <angle>",
- media: "visual",
- inherited: false,
- animationType: "transform",
- percentages: "no",
- groups: [
- "CSS Transforms"
- ],
- initial: "none",
- appliesto: "transformableElements",
- computed: "asSpecified",
- order: "perGrammar",
- stacking: true,
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/rotate"
- };
- var scale = {
- syntax: "none | <number>{1,3}",
- media: "visual",
- inherited: false,
- animationType: "transform",
- percentages: "no",
- groups: [
- "CSS Transforms"
- ],
- initial: "none",
- appliesto: "transformableElements",
- computed: "asSpecified",
- order: "perGrammar",
- stacking: true,
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scale"
- };
- var top = {
- syntax: "<length> | <percentage> | auto",
- media: "visual",
- inherited: false,
- animationType: "lpc",
- percentages: "referToContainingBlockHeight",
- groups: [
- "CSS Positioning"
- ],
- initial: "auto",
- appliesto: "positionedElements",
- computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/top"
- };
- var transform = {
- syntax: "none | <transform-list>",
- media: "visual",
- inherited: false,
- animationType: "transform",
- percentages: "referToSizeOfBoundingBox",
- groups: [
- "CSS Transforms"
- ],
- initial: "none",
- appliesto: "transformableElements",
- computed: "asSpecifiedRelativeToAbsoluteLengths",
- order: "uniqueOrder",
- stacking: true,
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/transform"
- };
- var transition = {
- syntax: "<single-transition>#",
- media: "interactive",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Transitions"
- ],
- initial: [
- "transition-delay",
- "transition-duration",
- "transition-property",
- "transition-timing-function"
- ],
- appliesto: "allElementsAndPseudos",
- computed: [
- "transition-delay",
- "transition-duration",
- "transition-property",
- "transition-timing-function"
- ],
- order: "orderOfAppearance",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/transition"
- };
- var translate = {
- syntax: "none | <length-percentage> [ <length-percentage> <length>? ]?",
- media: "visual",
- inherited: false,
- animationType: "transform",
- percentages: "referToSizeOfBoundingBox",
- groups: [
- "CSS Transforms"
- ],
- initial: "none",
- appliesto: "transformableElements",
- computed: "asSpecifiedRelativeToAbsoluteLengths",
- order: "perGrammar",
- stacking: true,
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/translate"
- };
- var visibility = {
- syntax: "visible | hidden | collapse",
- media: "visual",
- inherited: true,
- animationType: "visibility",
- percentages: "no",
- groups: [
- "CSS Box Model"
- ],
- initial: "visible",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/visibility"
- };
- var widows = {
- syntax: "<integer>",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Fragmentation"
- ],
- initial: "2",
- appliesto: "blockContainerElements",
- computed: "asSpecified",
- order: "perGrammar",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/widows"
- };
- var width = {
- syntax: "auto | <length> | <percentage> | min-content | max-content | fit-content(<length-percentage>)",
- media: "visual",
- inherited: false,
- animationType: "lpc",
- percentages: "referToWidthOfContainingBlock",
- groups: [
- "CSS Box Model"
- ],
- initial: "auto",
- appliesto: "allElementsButNonReplacedAndTableRows",
- computed: "percentageAutoOrAbsoluteLength",
- order: "lengthOrPercentageBeforeKeywordIfBothPresent",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/width"
- };
- var zoom = {
- syntax: "normal | reset | <number> | <percentage>",
- media: "visual",
- inherited: false,
- animationType: "integer",
- percentages: "no",
- groups: [
- "Microsoft Extensions"
- ],
- initial: "normal",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/zoom"
- };
- var require$$1 = {
- "--*": {
- syntax: "<declaration-value>",
- media: "all",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Variables"
- ],
- initial: "seeProse",
- appliesto: "allElements",
- computed: "asSpecifiedWithVarsSubstituted",
- order: "perGrammar",
- status: "experimental",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/--*"
- },
- "-ms-accelerator": {
- syntax: "false | true",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Microsoft Extensions"
- ],
- initial: "false",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-accelerator"
- },
- "-ms-block-progression": {
- syntax: "tb | rl | bt | lr",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Microsoft Extensions"
- ],
- initial: "tb",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-block-progression"
- },
- "-ms-content-zoom-chaining": {
- syntax: "none | chained",
- media: "interactive",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Microsoft Extensions"
- ],
- initial: "none",
- appliesto: "nonReplacedBlockAndInlineBlockElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-content-zoom-chaining"
- },
- "-ms-content-zooming": {
- syntax: "none | zoom",
- media: "interactive",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Microsoft Extensions"
- ],
- initial: "zoomForTheTopLevelNoneForTheRest",
- appliesto: "nonReplacedBlockAndInlineBlockElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-content-zooming"
- },
- "-ms-content-zoom-limit": {
- syntax: "<'-ms-content-zoom-limit-min'> <'-ms-content-zoom-limit-max'>",
- media: "interactive",
- inherited: false,
- animationType: "discrete",
- percentages: [
- "-ms-content-zoom-limit-max",
- "-ms-content-zoom-limit-min"
- ],
- groups: [
- "Microsoft Extensions"
- ],
- initial: [
- "-ms-content-zoom-limit-max",
- "-ms-content-zoom-limit-min"
- ],
- appliesto: "nonReplacedBlockAndInlineBlockElements",
- computed: [
- "-ms-content-zoom-limit-max",
- "-ms-content-zoom-limit-min"
- ],
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-content-zoom-limit"
- },
- "-ms-content-zoom-limit-max": {
- syntax: "<percentage>",
- media: "interactive",
- inherited: false,
- animationType: "discrete",
- percentages: "maxZoomFactor",
- groups: [
- "Microsoft Extensions"
- ],
- initial: "400%",
- appliesto: "nonReplacedBlockAndInlineBlockElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-content-zoom-limit-max"
- },
- "-ms-content-zoom-limit-min": {
- syntax: "<percentage>",
- media: "interactive",
- inherited: false,
- animationType: "discrete",
- percentages: "minZoomFactor",
- groups: [
- "Microsoft Extensions"
- ],
- initial: "100%",
- appliesto: "nonReplacedBlockAndInlineBlockElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-content-zoom-limit-min"
- },
- "-ms-content-zoom-snap": {
- syntax: "<'-ms-content-zoom-snap-type'> || <'-ms-content-zoom-snap-points'>",
- media: "interactive",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Microsoft Extensions"
- ],
- initial: [
- "-ms-content-zoom-snap-type",
- "-ms-content-zoom-snap-points"
- ],
- appliesto: "nonReplacedBlockAndInlineBlockElements",
- computed: [
- "-ms-content-zoom-snap-type",
- "-ms-content-zoom-snap-points"
- ],
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-content-zoom-snap"
- },
- "-ms-content-zoom-snap-points": {
- syntax: "snapInterval( <percentage>, <percentage> ) | snapList( <percentage># )",
- media: "interactive",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Microsoft Extensions"
- ],
- initial: "snapInterval(0%, 100%)",
- appliesto: "nonReplacedBlockAndInlineBlockElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-content-zoom-snap-points"
- },
- "-ms-content-zoom-snap-type": {
- syntax: "none | proximity | mandatory",
- media: "interactive",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Microsoft Extensions"
- ],
- initial: "none",
- appliesto: "nonReplacedBlockAndInlineBlockElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-content-zoom-snap-type"
- },
- "-ms-filter": {
- syntax: "<string>",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Microsoft Extensions"
- ],
- initial: "\"\"",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-filter"
- },
- "-ms-flow-from": {
- syntax: "[ none | <custom-ident> ]#",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Microsoft Extensions"
- ],
- initial: "none",
- appliesto: "nonReplacedElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-flow-from"
- },
- "-ms-flow-into": {
- syntax: "[ none | <custom-ident> ]#",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Microsoft Extensions"
- ],
- initial: "none",
- appliesto: "iframeElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-flow-into"
- },
- "-ms-grid-columns": {
- syntax: "none | <track-list> | <auto-track-list>",
- media: "visual",
- inherited: false,
- animationType: "simpleListOfLpcDifferenceLpc",
- percentages: "referToDimensionOfContentArea",
- groups: [
- "CSS Grid Layout"
- ],
- initial: "none",
- appliesto: "gridContainers",
- computed: "asSpecifiedRelativeToAbsoluteLengths",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-grid-columns"
- },
- "-ms-grid-rows": {
- syntax: "none | <track-list> | <auto-track-list>",
- media: "visual",
- inherited: false,
- animationType: "simpleListOfLpcDifferenceLpc",
- percentages: "referToDimensionOfContentArea",
- groups: [
- "CSS Grid Layout"
- ],
- initial: "none",
- appliesto: "gridContainers",
- computed: "asSpecifiedRelativeToAbsoluteLengths",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-grid-rows"
- },
- "-ms-high-contrast-adjust": {
- syntax: "auto | none",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Microsoft Extensions"
- ],
- initial: "auto",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-high-contrast-adjust"
- },
- "-ms-hyphenate-limit-chars": {
- syntax: "auto | <integer>{1,3}",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Microsoft Extensions"
- ],
- initial: "auto",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-hyphenate-limit-chars"
- },
- "-ms-hyphenate-limit-lines": {
- syntax: "no-limit | <integer>",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Microsoft Extensions"
- ],
- initial: "no-limit",
- appliesto: "blockContainerElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-hyphenate-limit-lines"
- },
- "-ms-hyphenate-limit-zone": {
- syntax: "<percentage> | <length>",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "referToLineBoxWidth",
- groups: [
- "Microsoft Extensions"
- ],
- initial: "0",
- appliesto: "blockContainerElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-hyphenate-limit-zone"
- },
- "-ms-ime-align": {
- syntax: "auto | after",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Microsoft Extensions"
- ],
- initial: "auto",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-ime-align"
- },
- "-ms-overflow-style": {
- syntax: "auto | none | scrollbar | -ms-autohiding-scrollbar",
- media: "interactive",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Microsoft Extensions"
- ],
- initial: "auto",
- appliesto: "nonReplacedBlockAndInlineBlockElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-overflow-style"
- },
- "-ms-scrollbar-3dlight-color": {
- syntax: "<color>",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Microsoft Extensions"
- ],
- initial: "dependsOnUserAgent",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scrollbar-3dlight-color"
- },
- "-ms-scrollbar-arrow-color": {
- syntax: "<color>",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Microsoft Extensions"
- ],
- initial: "ButtonText",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scrollbar-arrow-color"
- },
- "-ms-scrollbar-base-color": {
- syntax: "<color>",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Microsoft Extensions"
- ],
- initial: "dependsOnUserAgent",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scrollbar-base-color"
- },
- "-ms-scrollbar-darkshadow-color": {
- syntax: "<color>",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Microsoft Extensions"
- ],
- initial: "ThreeDDarkShadow",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scrollbar-darkshadow-color"
- },
- "-ms-scrollbar-face-color": {
- syntax: "<color>",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Microsoft Extensions"
- ],
- initial: "ThreeDFace",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scrollbar-face-color"
- },
- "-ms-scrollbar-highlight-color": {
- syntax: "<color>",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Microsoft Extensions"
- ],
- initial: "ThreeDHighlight",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scrollbar-highlight-color"
- },
- "-ms-scrollbar-shadow-color": {
- syntax: "<color>",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Microsoft Extensions"
- ],
- initial: "ThreeDDarkShadow",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scrollbar-shadow-color"
- },
- "-ms-scrollbar-track-color": {
- syntax: "<color>",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Microsoft Extensions"
- ],
- initial: "Scrollbar",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scrollbar-track-color"
- },
- "-ms-scroll-chaining": {
- syntax: "chained | none",
- media: "interactive",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Microsoft Extensions"
- ],
- initial: "chained",
- appliesto: "nonReplacedBlockAndInlineBlockElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-chaining"
- },
- "-ms-scroll-limit": {
- syntax: "<'-ms-scroll-limit-x-min'> <'-ms-scroll-limit-y-min'> <'-ms-scroll-limit-x-max'> <'-ms-scroll-limit-y-max'>",
- media: "interactive",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Microsoft Extensions"
- ],
- initial: [
- "-ms-scroll-limit-x-min",
- "-ms-scroll-limit-y-min",
- "-ms-scroll-limit-x-max",
- "-ms-scroll-limit-y-max"
- ],
- appliesto: "nonReplacedBlockAndInlineBlockElements",
- computed: [
- "-ms-scroll-limit-x-min",
- "-ms-scroll-limit-y-min",
- "-ms-scroll-limit-x-max",
- "-ms-scroll-limit-y-max"
- ],
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-limit"
- },
- "-ms-scroll-limit-x-max": {
- syntax: "auto | <length>",
- media: "interactive",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Microsoft Extensions"
- ],
- initial: "auto",
- appliesto: "nonReplacedBlockAndInlineBlockElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-limit-x-max"
- },
- "-ms-scroll-limit-x-min": {
- syntax: "<length>",
- media: "interactive",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Microsoft Extensions"
- ],
- initial: "0",
- appliesto: "nonReplacedBlockAndInlineBlockElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-limit-x-min"
- },
- "-ms-scroll-limit-y-max": {
- syntax: "auto | <length>",
- media: "interactive",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Microsoft Extensions"
- ],
- initial: "auto",
- appliesto: "nonReplacedBlockAndInlineBlockElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-limit-y-max"
- },
- "-ms-scroll-limit-y-min": {
- syntax: "<length>",
- media: "interactive",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Microsoft Extensions"
- ],
- initial: "0",
- appliesto: "nonReplacedBlockAndInlineBlockElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-limit-y-min"
- },
- "-ms-scroll-rails": {
- syntax: "none | railed",
- media: "interactive",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Microsoft Extensions"
- ],
- initial: "railed",
- appliesto: "nonReplacedBlockAndInlineBlockElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-rails"
- },
- "-ms-scroll-snap-points-x": {
- syntax: "snapInterval( <length-percentage>, <length-percentage> ) | snapList( <length-percentage># )",
- media: "interactive",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Microsoft Extensions"
- ],
- initial: "snapInterval(0px, 100%)",
- appliesto: "nonReplacedBlockAndInlineBlockElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-snap-points-x"
- },
- "-ms-scroll-snap-points-y": {
- syntax: "snapInterval( <length-percentage>, <length-percentage> ) | snapList( <length-percentage># )",
- media: "interactive",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Microsoft Extensions"
- ],
- initial: "snapInterval(0px, 100%)",
- appliesto: "nonReplacedBlockAndInlineBlockElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-snap-points-y"
- },
- "-ms-scroll-snap-type": {
- syntax: "none | proximity | mandatory",
- media: "interactive",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Microsoft Extensions"
- ],
- initial: "none",
- appliesto: "nonReplacedBlockAndInlineBlockElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-snap-type"
- },
- "-ms-scroll-snap-x": {
- syntax: "<'-ms-scroll-snap-type'> <'-ms-scroll-snap-points-x'>",
- media: "interactive",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Microsoft Extensions"
- ],
- initial: [
- "-ms-scroll-snap-type",
- "-ms-scroll-snap-points-x"
- ],
- appliesto: "nonReplacedBlockAndInlineBlockElements",
- computed: [
- "-ms-scroll-snap-type",
- "-ms-scroll-snap-points-x"
- ],
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-snap-x"
- },
- "-ms-scroll-snap-y": {
- syntax: "<'-ms-scroll-snap-type'> <'-ms-scroll-snap-points-y'>",
- media: "interactive",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Microsoft Extensions"
- ],
- initial: [
- "-ms-scroll-snap-type",
- "-ms-scroll-snap-points-y"
- ],
- appliesto: "nonReplacedBlockAndInlineBlockElements",
- computed: [
- "-ms-scroll-snap-type",
- "-ms-scroll-snap-points-y"
- ],
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-snap-y"
- },
- "-ms-scroll-translation": {
- syntax: "none | vertical-to-horizontal",
- media: "interactive",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Microsoft Extensions"
- ],
- initial: "none",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-translation"
- },
- "-ms-text-autospace": {
- syntax: "none | ideograph-alpha | ideograph-numeric | ideograph-parenthesis | ideograph-space",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Microsoft Extensions"
- ],
- initial: "none",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-text-autospace"
- },
- "-ms-touch-select": {
- syntax: "grippers | none",
- media: "interactive",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Microsoft Extensions"
- ],
- initial: "grippers",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-touch-select"
- },
- "-ms-user-select": {
- syntax: "none | element | text",
- media: "interactive",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Microsoft Extensions"
- ],
- initial: "text",
- appliesto: "nonReplacedElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-user-select"
- },
- "-ms-wrap-flow": {
- syntax: "auto | both | start | end | maximum | clear",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Microsoft Extensions"
- ],
- initial: "auto",
- appliesto: "blockLevelElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-wrap-flow"
- },
- "-ms-wrap-margin": {
- syntax: "<length>",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Microsoft Extensions"
- ],
- initial: "0",
- appliesto: "exclusionElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-wrap-margin"
- },
- "-ms-wrap-through": {
- syntax: "wrap | none",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Microsoft Extensions"
- ],
- initial: "wrap",
- appliesto: "blockLevelElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-ms-wrap-through"
- },
- "-moz-appearance": {
- syntax: "none | button | button-arrow-down | button-arrow-next | button-arrow-previous | button-arrow-up | button-bevel | button-focus | caret | checkbox | checkbox-container | checkbox-label | checkmenuitem | dualbutton | groupbox | listbox | listitem | menuarrow | menubar | menucheckbox | menuimage | menuitem | menuitemtext | menulist | menulist-button | menulist-text | menulist-textfield | menupopup | menuradio | menuseparator | meterbar | meterchunk | progressbar | progressbar-vertical | progresschunk | progresschunk-vertical | radio | radio-container | radio-label | radiomenuitem | range | range-thumb | resizer | resizerpanel | scale-horizontal | scalethumbend | scalethumb-horizontal | scalethumbstart | scalethumbtick | scalethumb-vertical | scale-vertical | scrollbarbutton-down | scrollbarbutton-left | scrollbarbutton-right | scrollbarbutton-up | scrollbarthumb-horizontal | scrollbarthumb-vertical | scrollbartrack-horizontal | scrollbartrack-vertical | searchfield | separator | sheet | spinner | spinner-downbutton | spinner-textfield | spinner-upbutton | splitter | statusbar | statusbarpanel | tab | tabpanel | tabpanels | tab-scroll-arrow-back | tab-scroll-arrow-forward | textfield | textfield-multiline | toolbar | toolbarbutton | toolbarbutton-dropdown | toolbargripper | toolbox | tooltip | treeheader | treeheadercell | treeheadersortarrow | treeitem | treeline | treetwisty | treetwistyopen | treeview | -moz-mac-unified-toolbar | -moz-win-borderless-glass | -moz-win-browsertabbar-toolbox | -moz-win-communicationstext | -moz-win-communications-toolbox | -moz-win-exclude-glass | -moz-win-glass | -moz-win-mediatext | -moz-win-media-toolbox | -moz-window-button-box | -moz-window-button-box-maximized | -moz-window-button-close | -moz-window-button-maximize | -moz-window-button-minimize | -moz-window-button-restore | -moz-window-frame-bottom | -moz-window-frame-left | -moz-window-frame-right | -moz-window-titlebar | -moz-window-titlebar-maximized",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Mozilla Extensions",
- "WebKit Extensions"
- ],
- initial: "noneButOverriddenInUserAgentCSS",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/appearance"
- },
- "-moz-binding": {
- syntax: "<url> | none",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Mozilla Extensions"
- ],
- initial: "none",
- appliesto: "allElementsExceptGeneratedContentOrPseudoElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-binding"
- },
- "-moz-border-bottom-colors": {
- syntax: "<color>+ | none",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Mozilla Extensions"
- ],
- initial: "none",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-border-bottom-colors"
- },
- "-moz-border-left-colors": {
- syntax: "<color>+ | none",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Mozilla Extensions"
- ],
- initial: "none",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-border-left-colors"
- },
- "-moz-border-right-colors": {
- syntax: "<color>+ | none",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Mozilla Extensions"
- ],
- initial: "none",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-border-right-colors"
- },
- "-moz-border-top-colors": {
- syntax: "<color>+ | none",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Mozilla Extensions"
- ],
- initial: "none",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-border-top-colors"
- },
- "-moz-context-properties": {
- syntax: "none | [ fill | fill-opacity | stroke | stroke-opacity ]#",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Mozilla Extensions"
- ],
- initial: "none",
- appliesto: "allElementsThatCanReferenceImages",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-context-properties"
- },
- "-moz-float-edge": {
- syntax: "border-box | content-box | margin-box | padding-box",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Mozilla Extensions"
- ],
- initial: "content-box",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-float-edge"
- },
- "-moz-force-broken-image-icon": {
- syntax: "<integer [0,1]>",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Mozilla Extensions"
- ],
- initial: "0",
- appliesto: "images",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-force-broken-image-icon"
- },
- "-moz-image-region": {
- syntax: "<shape> | auto",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Mozilla Extensions"
- ],
- initial: "auto",
- appliesto: "xulImageElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-image-region"
- },
- "-moz-orient": {
- syntax: "inline | block | horizontal | vertical",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Mozilla Extensions"
- ],
- initial: "inline",
- appliesto: "anyElementEffectOnProgressAndMeter",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-orient"
- },
- "-moz-outline-radius": {
- syntax: "<outline-radius>{1,4} [ / <outline-radius>{1,4} ]?",
- media: "visual",
- inherited: false,
- animationType: [
- "-moz-outline-radius-topleft",
- "-moz-outline-radius-topright",
- "-moz-outline-radius-bottomright",
- "-moz-outline-radius-bottomleft"
- ],
- percentages: [
- "-moz-outline-radius-topleft",
- "-moz-outline-radius-topright",
- "-moz-outline-radius-bottomright",
- "-moz-outline-radius-bottomleft"
- ],
- groups: [
- "Mozilla Extensions"
- ],
- initial: [
- "-moz-outline-radius-topleft",
- "-moz-outline-radius-topright",
- "-moz-outline-radius-bottomright",
- "-moz-outline-radius-bottomleft"
- ],
- appliesto: "allElements",
- computed: [
- "-moz-outline-radius-topleft",
- "-moz-outline-radius-topright",
- "-moz-outline-radius-bottomright",
- "-moz-outline-radius-bottomleft"
- ],
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-outline-radius"
- },
- "-moz-outline-radius-bottomleft": {
- syntax: "<outline-radius>",
- media: "visual",
- inherited: false,
- animationType: "lpc",
- percentages: "referToDimensionOfBorderBox",
- groups: [
- "Mozilla Extensions"
- ],
- initial: "0",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-outline-radius-bottomleft"
- },
- "-moz-outline-radius-bottomright": {
- syntax: "<outline-radius>",
- media: "visual",
- inherited: false,
- animationType: "lpc",
- percentages: "referToDimensionOfBorderBox",
- groups: [
- "Mozilla Extensions"
- ],
- initial: "0",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-outline-radius-bottomright"
- },
- "-moz-outline-radius-topleft": {
- syntax: "<outline-radius>",
- media: "visual",
- inherited: false,
- animationType: "lpc",
- percentages: "referToDimensionOfBorderBox",
- groups: [
- "Mozilla Extensions"
- ],
- initial: "0",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-outline-radius-topleft"
- },
- "-moz-outline-radius-topright": {
- syntax: "<outline-radius>",
- media: "visual",
- inherited: false,
- animationType: "lpc",
- percentages: "referToDimensionOfBorderBox",
- groups: [
- "Mozilla Extensions"
- ],
- initial: "0",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-outline-radius-topright"
- },
- "-moz-stack-sizing": {
- syntax: "ignore | stretch-to-fit",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Mozilla Extensions"
- ],
- initial: "stretch-to-fit",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-stack-sizing"
- },
- "-moz-text-blink": {
- syntax: "none | blink",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Mozilla Extensions"
- ],
- initial: "none",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-text-blink"
- },
- "-moz-user-focus": {
- syntax: "ignore | normal | select-after | select-before | select-menu | select-same | select-all | none",
- media: "interactive",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Mozilla Extensions"
- ],
- initial: "none",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-user-focus"
- },
- "-moz-user-input": {
- syntax: "auto | none | enabled | disabled",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Mozilla Extensions"
- ],
- initial: "auto",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-user-input"
- },
- "-moz-user-modify": {
- syntax: "read-only | read-write | write-only",
- media: "interactive",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Mozilla Extensions"
- ],
- initial: "read-only",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-user-modify"
- },
- "-moz-window-dragging": {
- syntax: "drag | no-drag",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Mozilla Extensions"
- ],
- initial: "drag",
- appliesto: "allElementsCreatingNativeWindows",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-window-dragging"
- },
- "-moz-window-shadow": {
- syntax: "default | menu | tooltip | sheet | none",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Mozilla Extensions"
- ],
- initial: "default",
- appliesto: "allElementsCreatingNativeWindows",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-moz-window-shadow"
- },
- "-webkit-appearance": {
- syntax: "none | button | button-bevel | caret | checkbox | default-button | inner-spin-button | listbox | listitem | media-controls-background | media-controls-fullscreen-background | media-current-time-display | media-enter-fullscreen-button | media-exit-fullscreen-button | media-fullscreen-button | media-mute-button | media-overlay-play-button | media-play-button | media-seek-back-button | media-seek-forward-button | media-slider | media-sliderthumb | media-time-remaining-display | media-toggle-closed-captions-button | media-volume-slider | media-volume-slider-container | media-volume-sliderthumb | menulist | menulist-button | menulist-text | menulist-textfield | meter | progress-bar | progress-bar-value | push-button | radio | searchfield | searchfield-cancel-button | searchfield-decoration | searchfield-results-button | searchfield-results-decoration | slider-horizontal | slider-vertical | sliderthumb-horizontal | sliderthumb-vertical | square-button | textarea | textfield | -apple-pay-button",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "WebKit Extensions"
- ],
- initial: "noneButOverriddenInUserAgentCSS",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/appearance"
- },
- "-webkit-border-before": {
- syntax: "<'border-width'> || <'border-style'> || <'color'>",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: [
- "-webkit-border-before-width"
- ],
- groups: [
- "WebKit Extensions"
- ],
- initial: [
- "border-width",
- "border-style",
- "color"
- ],
- appliesto: "allElements",
- computed: [
- "border-width",
- "border-style",
- "color"
- ],
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-border-before"
- },
- "-webkit-border-before-color": {
- syntax: "<'color'>",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "WebKit Extensions"
- ],
- initial: "currentcolor",
- appliesto: "allElements",
- computed: "computedColor",
- order: "uniqueOrder",
- status: "nonstandard"
- },
- "-webkit-border-before-style": {
- syntax: "<'border-style'>",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "WebKit Extensions"
- ],
- initial: "none",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard"
- },
- "-webkit-border-before-width": {
- syntax: "<'border-width'>",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "logicalWidthOfContainingBlock",
- groups: [
- "WebKit Extensions"
- ],
- initial: "medium",
- appliesto: "allElements",
- computed: "absoluteLengthZeroIfBorderStyleNoneOrHidden",
- order: "uniqueOrder",
- status: "nonstandard"
- },
- "-webkit-box-reflect": {
- syntax: "[ above | below | right | left ]? <length>? <image>?",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "WebKit Extensions"
- ],
- initial: "none",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-box-reflect"
- },
- "-webkit-line-clamp": {
- syntax: "none | <integer>",
- media: "visual",
- inherited: false,
- animationType: "byComputedValueType",
- percentages: "no",
- groups: [
- "WebKit Extensions",
- "CSS Overflow"
- ],
- initial: "none",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-line-clamp"
- },
- "-webkit-mask": {
- syntax: "[ <mask-reference> || <position> [ / <bg-size> ]? || <repeat-style> || [ <box> | border | padding | content | text ] || [ <box> | border | padding | content ] ]#",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "WebKit Extensions"
- ],
- initial: [
- "-webkit-mask-image",
- "-webkit-mask-repeat",
- "-webkit-mask-attachment",
- "-webkit-mask-position",
- "-webkit-mask-origin",
- "-webkit-mask-clip"
- ],
- appliesto: "allElements",
- computed: [
- "-webkit-mask-image",
- "-webkit-mask-repeat",
- "-webkit-mask-attachment",
- "-webkit-mask-position",
- "-webkit-mask-origin",
- "-webkit-mask-clip"
- ],
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask"
- },
- "-webkit-mask-attachment": {
- syntax: "<attachment>#",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "WebKit Extensions"
- ],
- initial: "scroll",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "orderOfAppearance",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-mask-attachment"
- },
- "-webkit-mask-clip": {
- syntax: "[ <box> | border | padding | content | text ]#",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "WebKit Extensions"
- ],
- initial: "border",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "orderOfAppearance",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-clip"
- },
- "-webkit-mask-composite": {
- syntax: "<composite-style>#",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "WebKit Extensions"
- ],
- initial: "source-over",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "orderOfAppearance",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-mask-composite"
- },
- "-webkit-mask-image": {
- syntax: "<mask-reference>#",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "WebKit Extensions"
- ],
- initial: "none",
- appliesto: "allElements",
- computed: "absoluteURIOrNone",
- order: "orderOfAppearance",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-image"
- },
- "-webkit-mask-origin": {
- syntax: "[ <box> | border | padding | content ]#",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "WebKit Extensions"
- ],
- initial: "padding",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "orderOfAppearance",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-origin"
- },
- "-webkit-mask-position": {
- syntax: "<position>#",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "referToSizeOfElement",
- groups: [
- "WebKit Extensions"
- ],
- initial: "0% 0%",
- appliesto: "allElements",
- computed: "absoluteLengthOrPercentage",
- order: "orderOfAppearance",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-position"
- },
- "-webkit-mask-position-x": {
- syntax: "[ <length-percentage> | left | center | right ]#",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "referToSizeOfElement",
- groups: [
- "WebKit Extensions"
- ],
- initial: "0%",
- appliesto: "allElements",
- computed: "absoluteLengthOrPercentage",
- order: "orderOfAppearance",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-mask-position-x"
- },
- "-webkit-mask-position-y": {
- syntax: "[ <length-percentage> | top | center | bottom ]#",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "referToSizeOfElement",
- groups: [
- "WebKit Extensions"
- ],
- initial: "0%",
- appliesto: "allElements",
- computed: "absoluteLengthOrPercentage",
- order: "orderOfAppearance",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-mask-position-y"
- },
- "-webkit-mask-repeat": {
- syntax: "<repeat-style>#",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "WebKit Extensions"
- ],
- initial: "repeat",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "orderOfAppearance",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-repeat"
- },
- "-webkit-mask-repeat-x": {
- syntax: "repeat | no-repeat | space | round",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "WebKit Extensions"
- ],
- initial: "repeat",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "orderOfAppearance",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-mask-repeat-x"
- },
- "-webkit-mask-repeat-y": {
- syntax: "repeat | no-repeat | space | round",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "WebKit Extensions"
- ],
- initial: "repeat",
- appliesto: "allElements",
- computed: "absoluteLengthOrPercentage",
- order: "orderOfAppearance",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-mask-repeat-y"
- },
- "-webkit-mask-size": {
- syntax: "<bg-size>#",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "relativeToBackgroundPositioningArea",
- groups: [
- "WebKit Extensions"
- ],
- initial: "auto auto",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "orderOfAppearance",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-size"
- },
- "-webkit-overflow-scrolling": {
- syntax: "auto | touch",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "WebKit Extensions"
- ],
- initial: "auto",
- appliesto: "scrollingBoxes",
- computed: "asSpecified",
- order: "orderOfAppearance",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-overflow-scrolling"
- },
- "-webkit-tap-highlight-color": {
- syntax: "<color>",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "WebKit Extensions"
- ],
- initial: "black",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-tap-highlight-color"
- },
- "-webkit-text-fill-color": {
- syntax: "<color>",
- media: "visual",
- inherited: true,
- animationType: "color",
- percentages: "no",
- groups: [
- "WebKit Extensions"
- ],
- initial: "currentcolor",
- appliesto: "allElements",
- computed: "computedColor",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-text-fill-color"
- },
- "-webkit-text-stroke": {
- syntax: "<length> || <color>",
- media: "visual",
- inherited: true,
- animationType: [
- "-webkit-text-stroke-width",
- "-webkit-text-stroke-color"
- ],
- percentages: "no",
- groups: [
- "WebKit Extensions"
- ],
- initial: [
- "-webkit-text-stroke-width",
- "-webkit-text-stroke-color"
- ],
- appliesto: "allElements",
- computed: [
- "-webkit-text-stroke-width",
- "-webkit-text-stroke-color"
- ],
- order: "canonicalOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-text-stroke"
- },
- "-webkit-text-stroke-color": {
- syntax: "<color>",
- media: "visual",
- inherited: true,
- animationType: "color",
- percentages: "no",
- groups: [
- "WebKit Extensions"
- ],
- initial: "currentcolor",
- appliesto: "allElements",
- computed: "computedColor",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-text-stroke-color"
- },
- "-webkit-text-stroke-width": {
- syntax: "<length>",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "WebKit Extensions"
- ],
- initial: "0",
- appliesto: "allElements",
- computed: "absoluteLength",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-text-stroke-width"
- },
- "-webkit-touch-callout": {
- syntax: "default | none",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "WebKit Extensions"
- ],
- initial: "default",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/-webkit-touch-callout"
- },
- "-webkit-user-modify": {
- syntax: "read-only | read-write | read-write-plaintext-only",
- media: "interactive",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "WebKit Extensions"
- ],
- initial: "read-only",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard"
- },
- "align-content": {
- syntax: "normal | <baseline-position> | <content-distribution> | <overflow-position>? <content-position>",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Box Alignment"
- ],
- initial: "normal",
- appliesto: "multilineFlexContainers",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/align-content"
- },
- "align-items": {
- syntax: "normal | stretch | <baseline-position> | [ <overflow-position>? <self-position> ]",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Box Alignment"
- ],
- initial: "normal",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/align-items"
- },
- "align-self": {
- syntax: "auto | normal | stretch | <baseline-position> | <overflow-position>? <self-position>",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Box Alignment"
- ],
- initial: "auto",
- appliesto: "flexItemsGridItemsAndAbsolutelyPositionedBoxes",
- computed: "autoOnAbsolutelyPositionedElementsValueOfAlignItemsOnParent",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/align-self"
- },
- "align-tracks": {
- syntax: "[ normal | <baseline-position> | <content-distribution> | <overflow-position>? <content-position> ]#",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Grid Layout"
- ],
- initial: "normal",
- appliesto: "gridContainersWithMasonryLayoutInTheirBlockAxis",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "experimental",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/align-tracks"
- },
- all: all,
- animation: animation,
- "animation-delay": {
- syntax: "<time>#",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Animations"
- ],
- initial: "0s",
- appliesto: "allElementsAndPseudos",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/animation-delay"
- },
- "animation-direction": {
- syntax: "<single-animation-direction>#",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Animations"
- ],
- initial: "normal",
- appliesto: "allElementsAndPseudos",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/animation-direction"
- },
- "animation-duration": {
- syntax: "<time>#",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Animations"
- ],
- initial: "0s",
- appliesto: "allElementsAndPseudos",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/animation-duration"
- },
- "animation-fill-mode": {
- syntax: "<single-animation-fill-mode>#",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Animations"
- ],
- initial: "none",
- appliesto: "allElementsAndPseudos",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/animation-fill-mode"
- },
- "animation-iteration-count": {
- syntax: "<single-animation-iteration-count>#",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Animations"
- ],
- initial: "1",
- appliesto: "allElementsAndPseudos",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/animation-iteration-count"
- },
- "animation-name": {
- syntax: "[ none | <keyframes-name> ]#",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Animations"
- ],
- initial: "none",
- appliesto: "allElementsAndPseudos",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/animation-name"
- },
- "animation-play-state": {
- syntax: "<single-animation-play-state>#",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Animations"
- ],
- initial: "running",
- appliesto: "allElementsAndPseudos",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/animation-play-state"
- },
- "animation-timing-function": {
- syntax: "<timing-function>#",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Animations"
- ],
- initial: "ease",
- appliesto: "allElementsAndPseudos",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/animation-timing-function"
- },
- appearance: appearance,
- "aspect-ratio": {
- syntax: "auto | <ratio>",
- media: "all",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Basic User Interface"
- ],
- initial: "auto",
- appliesto: "allElementsExceptInlineBoxesAndInternalRubyOrTableBoxes",
- computed: "asSpecified",
- order: "perGrammar",
- status: "experimental",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/aspect-ratio"
- },
- azimuth: azimuth,
- "backdrop-filter": {
- syntax: "none | <filter-function-list>",
- media: "visual",
- inherited: false,
- animationType: "filterList",
- percentages: "no",
- groups: [
- "Filter Effects"
- ],
- initial: "none",
- appliesto: "allElementsSVGContainerElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/backdrop-filter"
- },
- "backface-visibility": {
- syntax: "visible | hidden",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Transforms"
- ],
- initial: "visible",
- appliesto: "transformableElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/backface-visibility"
- },
- background: background,
- "background-attachment": {
- syntax: "<attachment>#",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Backgrounds and Borders"
- ],
- initial: "scroll",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter",
- "::first-line",
- "::placeholder"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/background-attachment"
- },
- "background-blend-mode": {
- syntax: "<blend-mode>#",
- media: "none",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Compositing and Blending"
- ],
- initial: "normal",
- appliesto: "allElementsSVGContainerGraphicsAndGraphicsReferencingElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter",
- "::first-line",
- "::placeholder"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/background-blend-mode"
- },
- "background-clip": {
- syntax: "<box>#",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Backgrounds and Borders"
- ],
- initial: "border-box",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter",
- "::first-line",
- "::placeholder"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/background-clip"
- },
- "background-color": {
- syntax: "<color>",
- media: "visual",
- inherited: false,
- animationType: "color",
- percentages: "no",
- groups: [
- "CSS Backgrounds and Borders"
- ],
- initial: "transparent",
- appliesto: "allElements",
- computed: "computedColor",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter",
- "::first-line",
- "::placeholder"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/background-color"
- },
- "background-image": {
- syntax: "<bg-image>#",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Backgrounds and Borders"
- ],
- initial: "none",
- appliesto: "allElements",
- computed: "asSpecifiedURLsAbsolute",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter",
- "::first-line",
- "::placeholder"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/background-image"
- },
- "background-origin": {
- syntax: "<box>#",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Backgrounds and Borders"
- ],
- initial: "padding-box",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter",
- "::first-line",
- "::placeholder"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/background-origin"
- },
- "background-position": {
- syntax: "<bg-position>#",
- media: "visual",
- inherited: false,
- animationType: "repeatableListOfSimpleListOfLpc",
- percentages: "referToSizeOfBackgroundPositioningAreaMinusBackgroundImageSize",
- groups: [
- "CSS Backgrounds and Borders"
- ],
- initial: "0% 0%",
- appliesto: "allElements",
- computed: "listEachItemTwoKeywordsOriginOffsets",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter",
- "::first-line",
- "::placeholder"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/background-position"
- },
- "background-position-x": {
- syntax: "[ center | [ [ left | right | x-start | x-end ]? <length-percentage>? ]! ]#",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "referToWidthOfBackgroundPositioningAreaMinusBackgroundImageHeight",
- groups: [
- "CSS Backgrounds and Borders"
- ],
- initial: "left",
- appliesto: "allElements",
- computed: "listEachItemConsistingOfAbsoluteLengthPercentageAndOrigin",
- order: "uniqueOrder",
- status: "experimental",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/background-position-x"
- },
- "background-position-y": {
- syntax: "[ center | [ [ top | bottom | y-start | y-end ]? <length-percentage>? ]! ]#",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "referToHeightOfBackgroundPositioningAreaMinusBackgroundImageHeight",
- groups: [
- "CSS Backgrounds and Borders"
- ],
- initial: "top",
- appliesto: "allElements",
- computed: "listEachItemConsistingOfAbsoluteLengthPercentageAndOrigin",
- order: "uniqueOrder",
- status: "experimental",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/background-position-y"
- },
- "background-repeat": {
- syntax: "<repeat-style>#",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Backgrounds and Borders"
- ],
- initial: "repeat",
- appliesto: "allElements",
- computed: "listEachItemHasTwoKeywordsOnePerDimension",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter",
- "::first-line",
- "::placeholder"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/background-repeat"
- },
- "background-size": {
- syntax: "<bg-size>#",
- media: "visual",
- inherited: false,
- animationType: "repeatableListOfSimpleListOfLpc",
- percentages: "relativeToBackgroundPositioningArea",
- groups: [
- "CSS Backgrounds and Borders"
- ],
- initial: "auto auto",
- appliesto: "allElements",
- computed: "asSpecifiedRelativeToAbsoluteLengths",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter",
- "::first-line",
- "::placeholder"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/background-size"
- },
- "block-overflow": {
- syntax: "clip | ellipsis | <string>",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Overflow"
- ],
- initial: "clip",
- appliesto: "blockContainers",
- computed: "asSpecified",
- order: "perGrammar",
- status: "experimental"
- },
- "block-size": {
- syntax: "<'width'>",
- media: "visual",
- inherited: false,
- animationType: "lpc",
- percentages: "blockSizeOfContainingBlock",
- groups: [
- "CSS Logical Properties"
- ],
- initial: "auto",
- appliesto: "sameAsWidthAndHeight",
- computed: "sameAsWidthAndHeight",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/block-size"
- },
- border: border,
- "border-block": {
- syntax: "<'border-top-width'> || <'border-top-style'> || <'color'>",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Logical Properties"
- ],
- initial: [
- "border-top-width",
- "border-top-style",
- "border-top-color"
- ],
- appliesto: "allElements",
- computed: [
- "border-top-width",
- "border-top-style",
- "border-top-color"
- ],
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-block"
- },
- "border-block-color": {
- syntax: "<'border-top-color'>{1,2}",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Logical Properties"
- ],
- initial: "currentcolor",
- appliesto: "allElements",
- computed: "computedColor",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-block-color"
- },
- "border-block-style": {
- syntax: "<'border-top-style'>",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Logical Properties"
- ],
- initial: "none",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-block-style"
- },
- "border-block-width": {
- syntax: "<'border-top-width'>",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "logicalWidthOfContainingBlock",
- groups: [
- "CSS Logical Properties"
- ],
- initial: "medium",
- appliesto: "allElements",
- computed: "absoluteLengthZeroIfBorderStyleNoneOrHidden",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-block-width"
- },
- "border-block-end": {
- syntax: "<'border-top-width'> || <'border-top-style'> || <'color'>",
- media: "visual",
- inherited: false,
- animationType: [
- "border-block-end-color",
- "border-block-end-style",
- "border-block-end-width"
- ],
- percentages: "no",
- groups: [
- "CSS Logical Properties"
- ],
- initial: [
- "border-top-width",
- "border-top-style",
- "border-top-color"
- ],
- appliesto: "allElements",
- computed: [
- "border-top-width",
- "border-top-style",
- "border-top-color"
- ],
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-block-end"
- },
- "border-block-end-color": {
- syntax: "<'border-top-color'>",
- media: "visual",
- inherited: false,
- animationType: "color",
- percentages: "no",
- groups: [
- "CSS Logical Properties"
- ],
- initial: "currentcolor",
- appliesto: "allElements",
- computed: "computedColor",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-block-end-color"
- },
- "border-block-end-style": {
- syntax: "<'border-top-style'>",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Logical Properties"
- ],
- initial: "none",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-block-end-style"
- },
- "border-block-end-width": {
- syntax: "<'border-top-width'>",
- media: "visual",
- inherited: false,
- animationType: "length",
- percentages: "logicalWidthOfContainingBlock",
- groups: [
- "CSS Logical Properties"
- ],
- initial: "medium",
- appliesto: "allElements",
- computed: "absoluteLengthZeroIfBorderStyleNoneOrHidden",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-block-end-width"
- },
- "border-block-start": {
- syntax: "<'border-top-width'> || <'border-top-style'> || <'color'>",
- media: "visual",
- inherited: false,
- animationType: [
- "border-block-start-color",
- "border-block-start-style",
- "border-block-start-width"
- ],
- percentages: "no",
- groups: [
- "CSS Logical Properties"
- ],
- initial: [
- "border-width",
- "border-style",
- "color"
- ],
- appliesto: "allElements",
- computed: [
- "border-width",
- "border-style",
- "border-block-start-color"
- ],
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-block-start"
- },
- "border-block-start-color": {
- syntax: "<'border-top-color'>",
- media: "visual",
- inherited: false,
- animationType: "color",
- percentages: "no",
- groups: [
- "CSS Logical Properties"
- ],
- initial: "currentcolor",
- appliesto: "allElements",
- computed: "computedColor",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-block-start-color"
- },
- "border-block-start-style": {
- syntax: "<'border-top-style'>",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Logical Properties"
- ],
- initial: "none",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-block-start-style"
- },
- "border-block-start-width": {
- syntax: "<'border-top-width'>",
- media: "visual",
- inherited: false,
- animationType: "length",
- percentages: "logicalWidthOfContainingBlock",
- groups: [
- "CSS Logical Properties"
- ],
- initial: "medium",
- appliesto: "allElements",
- computed: "absoluteLengthZeroIfBorderStyleNoneOrHidden",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-block-start-width"
- },
- "border-bottom": {
- syntax: "<line-width> || <line-style> || <color>",
- media: "visual",
- inherited: false,
- animationType: [
- "border-bottom-color",
- "border-bottom-style",
- "border-bottom-width"
- ],
- percentages: "no",
- groups: [
- "CSS Backgrounds and Borders"
- ],
- initial: [
- "border-bottom-width",
- "border-bottom-style",
- "border-bottom-color"
- ],
- appliesto: "allElements",
- computed: [
- "border-bottom-width",
- "border-bottom-style",
- "border-bottom-color"
- ],
- order: "orderOfAppearance",
- alsoAppliesTo: [
- "::first-letter"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-bottom"
- },
- "border-bottom-color": {
- syntax: "<'border-top-color'>",
- media: "visual",
- inherited: false,
- animationType: "color",
- percentages: "no",
- groups: [
- "CSS Backgrounds and Borders"
- ],
- initial: "currentcolor",
- appliesto: "allElements",
- computed: "computedColor",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-bottom-color"
- },
- "border-bottom-left-radius": {
- syntax: "<length-percentage>{1,2}",
- media: "visual",
- inherited: false,
- animationType: "lpc",
- percentages: "referToDimensionOfBorderBox",
- groups: [
- "CSS Backgrounds and Borders"
- ],
- initial: "0",
- appliesto: "allElementsUAsNotRequiredWhenCollapse",
- computed: "twoAbsoluteLengthOrPercentages",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-bottom-left-radius"
- },
- "border-bottom-right-radius": {
- syntax: "<length-percentage>{1,2}",
- media: "visual",
- inherited: false,
- animationType: "lpc",
- percentages: "referToDimensionOfBorderBox",
- groups: [
- "CSS Backgrounds and Borders"
- ],
- initial: "0",
- appliesto: "allElementsUAsNotRequiredWhenCollapse",
- computed: "twoAbsoluteLengthOrPercentages",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-bottom-right-radius"
- },
- "border-bottom-style": {
- syntax: "<line-style>",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Backgrounds and Borders"
- ],
- initial: "none",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-bottom-style"
- },
- "border-bottom-width": {
- syntax: "<line-width>",
- media: "visual",
- inherited: false,
- animationType: "length",
- percentages: "no",
- groups: [
- "CSS Backgrounds and Borders"
- ],
- initial: "medium",
- appliesto: "allElements",
- computed: "absoluteLengthOr0IfBorderBottomStyleNoneOrHidden",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-bottom-width"
- },
- "border-collapse": {
- syntax: "collapse | separate",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Table"
- ],
- initial: "separate",
- appliesto: "tableElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-collapse"
- },
- "border-color": {
- syntax: "<color>{1,4}",
- media: "visual",
- inherited: false,
- animationType: [
- "border-bottom-color",
- "border-left-color",
- "border-right-color",
- "border-top-color"
- ],
- percentages: "no",
- groups: [
- "CSS Backgrounds and Borders"
- ],
- initial: [
- "border-top-color",
- "border-right-color",
- "border-bottom-color",
- "border-left-color"
- ],
- appliesto: "allElements",
- computed: [
- "border-bottom-color",
- "border-left-color",
- "border-right-color",
- "border-top-color"
- ],
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-color"
- },
- "border-end-end-radius": {
- syntax: "<length-percentage>{1,2}",
- media: "visual",
- inherited: false,
- animationType: "lpc",
- percentages: "referToDimensionOfBorderBox",
- groups: [
- "CSS Logical Properties"
- ],
- initial: "0",
- appliesto: "allElementsUAsNotRequiredWhenCollapse",
- computed: "twoAbsoluteLengthOrPercentages",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-end-end-radius"
- },
- "border-end-start-radius": {
- syntax: "<length-percentage>{1,2}",
- media: "visual",
- inherited: false,
- animationType: "lpc",
- percentages: "referToDimensionOfBorderBox",
- groups: [
- "CSS Logical Properties"
- ],
- initial: "0",
- appliesto: "allElementsUAsNotRequiredWhenCollapse",
- computed: "twoAbsoluteLengthOrPercentages",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-end-start-radius"
- },
- "border-image": {
- syntax: "<'border-image-source'> || <'border-image-slice'> [ / <'border-image-width'> | / <'border-image-width'>? / <'border-image-outset'> ]? || <'border-image-repeat'>",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: [
- "border-image-slice",
- "border-image-width"
- ],
- groups: [
- "CSS Backgrounds and Borders"
- ],
- initial: [
- "border-image-source",
- "border-image-slice",
- "border-image-width",
- "border-image-outset",
- "border-image-repeat"
- ],
- appliesto: "allElementsExceptTableElementsWhenCollapse",
- computed: [
- "border-image-outset",
- "border-image-repeat",
- "border-image-slice",
- "border-image-source",
- "border-image-width"
- ],
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-image"
- },
- "border-image-outset": {
- syntax: "[ <length> | <number> ]{1,4}",
- media: "visual",
- inherited: false,
- animationType: "byComputedValueType",
- percentages: "no",
- groups: [
- "CSS Backgrounds and Borders"
- ],
- initial: "0",
- appliesto: "allElementsExceptTableElementsWhenCollapse",
- computed: "asSpecifiedRelativeToAbsoluteLengths",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-image-outset"
- },
- "border-image-repeat": {
- syntax: "[ stretch | repeat | round | space ]{1,2}",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Backgrounds and Borders"
- ],
- initial: "stretch",
- appliesto: "allElementsExceptTableElementsWhenCollapse",
- computed: "asSpecified",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-image-repeat"
- },
- "border-image-slice": {
- syntax: "<number-percentage>{1,4} && fill?",
- media: "visual",
- inherited: false,
- animationType: "byComputedValueType",
- percentages: "referToSizeOfBorderImage",
- groups: [
- "CSS Backgrounds and Borders"
- ],
- initial: "100%",
- appliesto: "allElementsExceptTableElementsWhenCollapse",
- computed: "oneToFourPercentagesOrAbsoluteLengthsPlusFill",
- order: "percentagesOrLengthsFollowedByFill",
- alsoAppliesTo: [
- "::first-letter"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-image-slice"
- },
- "border-image-source": {
- syntax: "none | <image>",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Backgrounds and Borders"
- ],
- initial: "none",
- appliesto: "allElementsExceptTableElementsWhenCollapse",
- computed: "noneOrImageWithAbsoluteURI",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-image-source"
- },
- "border-image-width": {
- syntax: "[ <length-percentage> | <number> | auto ]{1,4}",
- media: "visual",
- inherited: false,
- animationType: "byComputedValueType",
- percentages: "referToWidthOrHeightOfBorderImageArea",
- groups: [
- "CSS Backgrounds and Borders"
- ],
- initial: "1",
- appliesto: "allElementsExceptTableElementsWhenCollapse",
- computed: "asSpecifiedRelativeToAbsoluteLengths",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-image-width"
- },
- "border-inline": {
- syntax: "<'border-top-width'> || <'border-top-style'> || <'color'>",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Logical Properties"
- ],
- initial: [
- "border-top-width",
- "border-top-style",
- "border-top-color"
- ],
- appliesto: "allElements",
- computed: [
- "border-top-width",
- "border-top-style",
- "border-top-color"
- ],
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-inline"
- },
- "border-inline-end": {
- syntax: "<'border-top-width'> || <'border-top-style'> || <'color'>",
- media: "visual",
- inherited: false,
- animationType: [
- "border-inline-end-color",
- "border-inline-end-style",
- "border-inline-end-width"
- ],
- percentages: "no",
- groups: [
- "CSS Logical Properties"
- ],
- initial: [
- "border-width",
- "border-style",
- "color"
- ],
- appliesto: "allElements",
- computed: [
- "border-width",
- "border-style",
- "border-inline-end-color"
- ],
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-inline-end"
- },
- "border-inline-color": {
- syntax: "<'border-top-color'>{1,2}",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Logical Properties"
- ],
- initial: "currentcolor",
- appliesto: "allElements",
- computed: "computedColor",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-inline-color"
- },
- "border-inline-style": {
- syntax: "<'border-top-style'>",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Logical Properties"
- ],
- initial: "none",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-inline-style"
- },
- "border-inline-width": {
- syntax: "<'border-top-width'>",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "logicalWidthOfContainingBlock",
- groups: [
- "CSS Logical Properties"
- ],
- initial: "medium",
- appliesto: "allElements",
- computed: "absoluteLengthZeroIfBorderStyleNoneOrHidden",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-inline-width"
- },
- "border-inline-end-color": {
- syntax: "<'border-top-color'>",
- media: "visual",
- inherited: false,
- animationType: "color",
- percentages: "no",
- groups: [
- "CSS Logical Properties"
- ],
- initial: "currentcolor",
- appliesto: "allElements",
- computed: "computedColor",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-inline-end-color"
- },
- "border-inline-end-style": {
- syntax: "<'border-top-style'>",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Logical Properties"
- ],
- initial: "none",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-inline-end-style"
- },
- "border-inline-end-width": {
- syntax: "<'border-top-width'>",
- media: "visual",
- inherited: false,
- animationType: "length",
- percentages: "logicalWidthOfContainingBlock",
- groups: [
- "CSS Logical Properties"
- ],
- initial: "medium",
- appliesto: "allElements",
- computed: "absoluteLengthZeroIfBorderStyleNoneOrHidden",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-inline-end-width"
- },
- "border-inline-start": {
- syntax: "<'border-top-width'> || <'border-top-style'> || <'color'>",
- media: "visual",
- inherited: false,
- animationType: [
- "border-inline-start-color",
- "border-inline-start-style",
- "border-inline-start-width"
- ],
- percentages: "no",
- groups: [
- "CSS Logical Properties"
- ],
- initial: [
- "border-width",
- "border-style",
- "color"
- ],
- appliesto: "allElements",
- computed: [
- "border-width",
- "border-style",
- "border-inline-start-color"
- ],
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-inline-start"
- },
- "border-inline-start-color": {
- syntax: "<'border-top-color'>",
- media: "visual",
- inherited: false,
- animationType: "color",
- percentages: "no",
- groups: [
- "CSS Logical Properties"
- ],
- initial: "currentcolor",
- appliesto: "allElements",
- computed: "computedColor",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-inline-start-color"
- },
- "border-inline-start-style": {
- syntax: "<'border-top-style'>",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Logical Properties"
- ],
- initial: "none",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-inline-start-style"
- },
- "border-inline-start-width": {
- syntax: "<'border-top-width'>",
- media: "visual",
- inherited: false,
- animationType: "length",
- percentages: "logicalWidthOfContainingBlock",
- groups: [
- "CSS Logical Properties"
- ],
- initial: "medium",
- appliesto: "allElements",
- computed: "absoluteLengthZeroIfBorderStyleNoneOrHidden",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-inline-start-width"
- },
- "border-left": {
- syntax: "<line-width> || <line-style> || <color>",
- media: "visual",
- inherited: false,
- animationType: [
- "border-left-color",
- "border-left-style",
- "border-left-width"
- ],
- percentages: "no",
- groups: [
- "CSS Backgrounds and Borders"
- ],
- initial: [
- "border-left-width",
- "border-left-style",
- "border-left-color"
- ],
- appliesto: "allElements",
- computed: [
- "border-left-width",
- "border-left-style",
- "border-left-color"
- ],
- order: "orderOfAppearance",
- alsoAppliesTo: [
- "::first-letter"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-left"
- },
- "border-left-color": {
- syntax: "<color>",
- media: "visual",
- inherited: false,
- animationType: "color",
- percentages: "no",
- groups: [
- "CSS Backgrounds and Borders"
- ],
- initial: "currentcolor",
- appliesto: "allElements",
- computed: "computedColor",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-left-color"
- },
- "border-left-style": {
- syntax: "<line-style>",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Backgrounds and Borders"
- ],
- initial: "none",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-left-style"
- },
- "border-left-width": {
- syntax: "<line-width>",
- media: "visual",
- inherited: false,
- animationType: "length",
- percentages: "no",
- groups: [
- "CSS Backgrounds and Borders"
- ],
- initial: "medium",
- appliesto: "allElements",
- computed: "absoluteLengthOr0IfBorderLeftStyleNoneOrHidden",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-left-width"
- },
- "border-radius": {
- syntax: "<length-percentage>{1,4} [ / <length-percentage>{1,4} ]?",
- media: "visual",
- inherited: false,
- animationType: [
- "border-top-left-radius",
- "border-top-right-radius",
- "border-bottom-right-radius",
- "border-bottom-left-radius"
- ],
- percentages: "referToDimensionOfBorderBox",
- groups: [
- "CSS Backgrounds and Borders"
- ],
- initial: [
- "border-top-left-radius",
- "border-top-right-radius",
- "border-bottom-right-radius",
- "border-bottom-left-radius"
- ],
- appliesto: "allElementsUAsNotRequiredWhenCollapse",
- computed: [
- "border-bottom-left-radius",
- "border-bottom-right-radius",
- "border-top-left-radius",
- "border-top-right-radius"
- ],
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-radius"
- },
- "border-right": {
- syntax: "<line-width> || <line-style> || <color>",
- media: "visual",
- inherited: false,
- animationType: [
- "border-right-color",
- "border-right-style",
- "border-right-width"
- ],
- percentages: "no",
- groups: [
- "CSS Backgrounds and Borders"
- ],
- initial: [
- "border-right-width",
- "border-right-style",
- "border-right-color"
- ],
- appliesto: "allElements",
- computed: [
- "border-right-width",
- "border-right-style",
- "border-right-color"
- ],
- order: "orderOfAppearance",
- alsoAppliesTo: [
- "::first-letter"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-right"
- },
- "border-right-color": {
- syntax: "<color>",
- media: "visual",
- inherited: false,
- animationType: "color",
- percentages: "no",
- groups: [
- "CSS Backgrounds and Borders"
- ],
- initial: "currentcolor",
- appliesto: "allElements",
- computed: "computedColor",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-right-color"
- },
- "border-right-style": {
- syntax: "<line-style>",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Backgrounds and Borders"
- ],
- initial: "none",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-right-style"
- },
- "border-right-width": {
- syntax: "<line-width>",
- media: "visual",
- inherited: false,
- animationType: "length",
- percentages: "no",
- groups: [
- "CSS Backgrounds and Borders"
- ],
- initial: "medium",
- appliesto: "allElements",
- computed: "absoluteLengthOr0IfBorderRightStyleNoneOrHidden",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-right-width"
- },
- "border-spacing": {
- syntax: "<length> <length>?",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Table"
- ],
- initial: "0",
- appliesto: "tableElements",
- computed: "twoAbsoluteLengths",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-spacing"
- },
- "border-start-end-radius": {
- syntax: "<length-percentage>{1,2}",
- media: "visual",
- inherited: false,
- animationType: "lpc",
- percentages: "referToDimensionOfBorderBox",
- groups: [
- "CSS Logical Properties"
- ],
- initial: "0",
- appliesto: "allElementsUAsNotRequiredWhenCollapse",
- computed: "twoAbsoluteLengthOrPercentages",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-start-end-radius"
- },
- "border-start-start-radius": {
- syntax: "<length-percentage>{1,2}",
- media: "visual",
- inherited: false,
- animationType: "lpc",
- percentages: "referToDimensionOfBorderBox",
- groups: [
- "CSS Logical Properties"
- ],
- initial: "0",
- appliesto: "allElementsUAsNotRequiredWhenCollapse",
- computed: "twoAbsoluteLengthOrPercentages",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-start-start-radius"
- },
- "border-style": {
- syntax: "<line-style>{1,4}",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Backgrounds and Borders"
- ],
- initial: [
- "border-top-style",
- "border-right-style",
- "border-bottom-style",
- "border-left-style"
- ],
- appliesto: "allElements",
- computed: [
- "border-bottom-style",
- "border-left-style",
- "border-right-style",
- "border-top-style"
- ],
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-style"
- },
- "border-top": {
- syntax: "<line-width> || <line-style> || <color>",
- media: "visual",
- inherited: false,
- animationType: [
- "border-top-color",
- "border-top-style",
- "border-top-width"
- ],
- percentages: "no",
- groups: [
- "CSS Backgrounds and Borders"
- ],
- initial: [
- "border-top-width",
- "border-top-style",
- "border-top-color"
- ],
- appliesto: "allElements",
- computed: [
- "border-top-width",
- "border-top-style",
- "border-top-color"
- ],
- order: "orderOfAppearance",
- alsoAppliesTo: [
- "::first-letter"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-top"
- },
- "border-top-color": {
- syntax: "<color>",
- media: "visual",
- inherited: false,
- animationType: "color",
- percentages: "no",
- groups: [
- "CSS Backgrounds and Borders"
- ],
- initial: "currentcolor",
- appliesto: "allElements",
- computed: "computedColor",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-top-color"
- },
- "border-top-left-radius": {
- syntax: "<length-percentage>{1,2}",
- media: "visual",
- inherited: false,
- animationType: "lpc",
- percentages: "referToDimensionOfBorderBox",
- groups: [
- "CSS Backgrounds and Borders"
- ],
- initial: "0",
- appliesto: "allElementsUAsNotRequiredWhenCollapse",
- computed: "twoAbsoluteLengthOrPercentages",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-top-left-radius"
- },
- "border-top-right-radius": {
- syntax: "<length-percentage>{1,2}",
- media: "visual",
- inherited: false,
- animationType: "lpc",
- percentages: "referToDimensionOfBorderBox",
- groups: [
- "CSS Backgrounds and Borders"
- ],
- initial: "0",
- appliesto: "allElementsUAsNotRequiredWhenCollapse",
- computed: "twoAbsoluteLengthOrPercentages",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-top-right-radius"
- },
- "border-top-style": {
- syntax: "<line-style>",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Backgrounds and Borders"
- ],
- initial: "none",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-top-style"
- },
- "border-top-width": {
- syntax: "<line-width>",
- media: "visual",
- inherited: false,
- animationType: "length",
- percentages: "no",
- groups: [
- "CSS Backgrounds and Borders"
- ],
- initial: "medium",
- appliesto: "allElements",
- computed: "absoluteLengthOr0IfBorderTopStyleNoneOrHidden",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-top-width"
- },
- "border-width": {
- syntax: "<line-width>{1,4}",
- media: "visual",
- inherited: false,
- animationType: [
- "border-bottom-width",
- "border-left-width",
- "border-right-width",
- "border-top-width"
- ],
- percentages: "no",
- groups: [
- "CSS Backgrounds and Borders"
- ],
- initial: [
- "border-top-width",
- "border-right-width",
- "border-bottom-width",
- "border-left-width"
- ],
- appliesto: "allElements",
- computed: [
- "border-bottom-width",
- "border-left-width",
- "border-right-width",
- "border-top-width"
- ],
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/border-width"
- },
- bottom: bottom,
- "box-align": {
- syntax: "start | center | end | baseline | stretch",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Mozilla Extensions",
- "WebKit Extensions"
- ],
- initial: "stretch",
- appliesto: "elementsWithDisplayBoxOrInlineBox",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/box-align"
- },
- "box-decoration-break": {
- syntax: "slice | clone",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Fragmentation"
- ],
- initial: "slice",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/box-decoration-break"
- },
- "box-direction": {
- syntax: "normal | reverse | inherit",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Mozilla Extensions",
- "WebKit Extensions"
- ],
- initial: "normal",
- appliesto: "elementsWithDisplayBoxOrInlineBox",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/box-direction"
- },
- "box-flex": {
- syntax: "<number>",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Mozilla Extensions",
- "WebKit Extensions"
- ],
- initial: "0",
- appliesto: "directChildrenOfElementsWithDisplayMozBoxMozInlineBox",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/box-flex"
- },
- "box-flex-group": {
- syntax: "<integer>",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Mozilla Extensions",
- "WebKit Extensions"
- ],
- initial: "1",
- appliesto: "inFlowChildrenOfBoxElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/box-flex-group"
- },
- "box-lines": {
- syntax: "single | multiple",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Mozilla Extensions",
- "WebKit Extensions"
- ],
- initial: "single",
- appliesto: "boxElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/box-lines"
- },
- "box-ordinal-group": {
- syntax: "<integer>",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Mozilla Extensions",
- "WebKit Extensions"
- ],
- initial: "1",
- appliesto: "childrenOfBoxElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/box-ordinal-group"
- },
- "box-orient": {
- syntax: "horizontal | vertical | inline-axis | block-axis | inherit",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Mozilla Extensions",
- "WebKit Extensions"
- ],
- initial: "inlineAxisHorizontalInXUL",
- appliesto: "elementsWithDisplayBoxOrInlineBox",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/box-orient"
- },
- "box-pack": {
- syntax: "start | center | end | justify",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Mozilla Extensions",
- "WebKit Extensions"
- ],
- initial: "start",
- appliesto: "elementsWithDisplayMozBoxMozInlineBox",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/box-pack"
- },
- "box-shadow": {
- syntax: "none | <shadow>#",
- media: "visual",
- inherited: false,
- animationType: "shadowList",
- percentages: "no",
- groups: [
- "CSS Backgrounds and Borders"
- ],
- initial: "none",
- appliesto: "allElements",
- computed: "absoluteLengthsSpecifiedColorAsSpecified",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/box-shadow"
- },
- "box-sizing": {
- syntax: "content-box | border-box",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Basic User Interface"
- ],
- initial: "content-box",
- appliesto: "allElementsAcceptingWidthOrHeight",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/box-sizing"
- },
- "break-after": {
- syntax: "auto | avoid | always | all | avoid-page | page | left | right | recto | verso | avoid-column | column | avoid-region | region",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Fragmentation"
- ],
- initial: "auto",
- appliesto: "blockLevelElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/break-after"
- },
- "break-before": {
- syntax: "auto | avoid | always | all | avoid-page | page | left | right | recto | verso | avoid-column | column | avoid-region | region",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Fragmentation"
- ],
- initial: "auto",
- appliesto: "blockLevelElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/break-before"
- },
- "break-inside": {
- syntax: "auto | avoid | avoid-page | avoid-column | avoid-region",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Fragmentation"
- ],
- initial: "auto",
- appliesto: "blockLevelElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/break-inside"
- },
- "caption-side": {
- syntax: "top | bottom | block-start | block-end | inline-start | inline-end",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Table"
- ],
- initial: "top",
- appliesto: "tableCaptionElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/caption-side"
- },
- "caret-color": {
- syntax: "auto | <color>",
- media: "interactive",
- inherited: true,
- animationType: "color",
- percentages: "no",
- groups: [
- "CSS Basic User Interface"
- ],
- initial: "auto",
- appliesto: "allElements",
- computed: "asAutoOrColor",
- order: "perGrammar",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/caret-color"
- },
- clear: clear,
- clip: clip,
- "clip-path": {
- syntax: "<clip-source> | [ <basic-shape> || <geometry-box> ] | none",
- media: "visual",
- inherited: false,
- animationType: "basicShapeOtherwiseNo",
- percentages: "referToReferenceBoxWhenSpecifiedOtherwiseBorderBox",
- groups: [
- "CSS Masking"
- ],
- initial: "none",
- appliesto: "allElementsSVGContainerElements",
- computed: "asSpecifiedURLsAbsolute",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/clip-path"
- },
- color: color$1,
- "color-adjust": {
- syntax: "economy | exact",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Color"
- ],
- initial: "economy",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "perGrammar",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/color-adjust"
- },
- "column-count": {
- syntax: "<integer> | auto",
- media: "visual",
- inherited: false,
- animationType: "integer",
- percentages: "no",
- groups: [
- "CSS Columns"
- ],
- initial: "auto",
- appliesto: "blockContainersExceptTableWrappers",
- computed: "asSpecified",
- order: "perGrammar",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/column-count"
- },
- "column-fill": {
- syntax: "auto | balance | balance-all",
- media: "visualInContinuousMediaNoEffectInOverflowColumns",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Columns"
- ],
- initial: "balance",
- appliesto: "multicolElements",
- computed: "asSpecified",
- order: "perGrammar",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/column-fill"
- },
- "column-gap": {
- syntax: "normal | <length-percentage>",
- media: "visual",
- inherited: false,
- animationType: "lpc",
- percentages: "referToDimensionOfContentArea",
- groups: [
- "CSS Box Alignment"
- ],
- initial: "normal",
- appliesto: "multiColumnElementsFlexContainersGridContainers",
- computed: "asSpecifiedWithLengthsAbsoluteAndNormalComputingToZeroExceptMultiColumn",
- order: "perGrammar",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/column-gap"
- },
- "column-rule": {
- syntax: "<'column-rule-width'> || <'column-rule-style'> || <'column-rule-color'>",
- media: "visual",
- inherited: false,
- animationType: [
- "column-rule-color",
- "column-rule-style",
- "column-rule-width"
- ],
- percentages: "no",
- groups: [
- "CSS Columns"
- ],
- initial: [
- "column-rule-width",
- "column-rule-style",
- "column-rule-color"
- ],
- appliesto: "multicolElements",
- computed: [
- "column-rule-color",
- "column-rule-style",
- "column-rule-width"
- ],
- order: "perGrammar",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/column-rule"
- },
- "column-rule-color": {
- syntax: "<color>",
- media: "visual",
- inherited: false,
- animationType: "color",
- percentages: "no",
- groups: [
- "CSS Columns"
- ],
- initial: "currentcolor",
- appliesto: "multicolElements",
- computed: "computedColor",
- order: "perGrammar",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/column-rule-color"
- },
- "column-rule-style": {
- syntax: "<'border-style'>",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Columns"
- ],
- initial: "none",
- appliesto: "multicolElements",
- computed: "asSpecified",
- order: "perGrammar",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/column-rule-style"
- },
- "column-rule-width": {
- syntax: "<'border-width'>",
- media: "visual",
- inherited: false,
- animationType: "length",
- percentages: "no",
- groups: [
- "CSS Columns"
- ],
- initial: "medium",
- appliesto: "multicolElements",
- computed: "absoluteLength0IfColumnRuleStyleNoneOrHidden",
- order: "perGrammar",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/column-rule-width"
- },
- "column-span": {
- syntax: "none | all",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Columns"
- ],
- initial: "none",
- appliesto: "inFlowBlockLevelElements",
- computed: "asSpecified",
- order: "perGrammar",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/column-span"
- },
- "column-width": {
- syntax: "<length> | auto",
- media: "visual",
- inherited: false,
- animationType: "length",
- percentages: "no",
- groups: [
- "CSS Columns"
- ],
- initial: "auto",
- appliesto: "blockContainersExceptTableWrappers",
- computed: "absoluteLengthZeroOrLarger",
- order: "perGrammar",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/column-width"
- },
- columns: columns,
- contain: contain,
- content: content,
- "counter-increment": {
- syntax: "[ <custom-ident> <integer>? ]+ | none",
- media: "all",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Counter Styles"
- ],
- initial: "none",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/counter-increment"
- },
- "counter-reset": {
- syntax: "[ <custom-ident> <integer>? ]+ | none",
- media: "all",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Counter Styles"
- ],
- initial: "none",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/counter-reset"
- },
- "counter-set": {
- syntax: "[ <custom-ident> <integer>? ]+ | none",
- media: "all",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Counter Styles"
- ],
- initial: "none",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/counter-set"
- },
- cursor: cursor,
- direction: direction,
- display: display,
- "empty-cells": {
- syntax: "show | hide",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Table"
- ],
- initial: "show",
- appliesto: "tableCellElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/empty-cells"
- },
- filter: filter,
- flex: flex,
- "flex-basis": {
- syntax: "content | <'width'>",
- media: "visual",
- inherited: false,
- animationType: "lpc",
- percentages: "referToFlexContainersInnerMainSize",
- groups: [
- "CSS Flexible Box Layout"
- ],
- initial: "auto",
- appliesto: "flexItemsAndInFlowPseudos",
- computed: "asSpecifiedRelativeToAbsoluteLengths",
- order: "lengthOrPercentageBeforeKeywordIfBothPresent",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/flex-basis"
- },
- "flex-direction": {
- syntax: "row | row-reverse | column | column-reverse",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Flexible Box Layout"
- ],
- initial: "row",
- appliesto: "flexContainers",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/flex-direction"
- },
- "flex-flow": {
- syntax: "<'flex-direction'> || <'flex-wrap'>",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Flexible Box Layout"
- ],
- initial: [
- "flex-direction",
- "flex-wrap"
- ],
- appliesto: "flexContainers",
- computed: [
- "flex-direction",
- "flex-wrap"
- ],
- order: "orderOfAppearance",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/flex-flow"
- },
- "flex-grow": {
- syntax: "<number>",
- media: "visual",
- inherited: false,
- animationType: "number",
- percentages: "no",
- groups: [
- "CSS Flexible Box Layout"
- ],
- initial: "0",
- appliesto: "flexItemsAndInFlowPseudos",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/flex-grow"
- },
- "flex-shrink": {
- syntax: "<number>",
- media: "visual",
- inherited: false,
- animationType: "number",
- percentages: "no",
- groups: [
- "CSS Flexible Box Layout"
- ],
- initial: "1",
- appliesto: "flexItemsAndInFlowPseudos",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/flex-shrink"
- },
- "flex-wrap": {
- syntax: "nowrap | wrap | wrap-reverse",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Flexible Box Layout"
- ],
- initial: "nowrap",
- appliesto: "flexContainers",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/flex-wrap"
- },
- float: float,
- font: font,
- "font-family": {
- syntax: "[ <family-name> | <generic-family> ]#",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Fonts"
- ],
- initial: "dependsOnUserAgent",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter",
- "::first-line",
- "::placeholder"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-family"
- },
- "font-feature-settings": {
- syntax: "normal | <feature-tag-value>#",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Fonts"
- ],
- initial: "normal",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter",
- "::first-line",
- "::placeholder"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-feature-settings"
- },
- "font-kerning": {
- syntax: "auto | normal | none",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Fonts"
- ],
- initial: "auto",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter",
- "::first-line",
- "::placeholder"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-kerning"
- },
- "font-language-override": {
- syntax: "normal | <string>",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Fonts"
- ],
- initial: "normal",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter",
- "::first-line",
- "::placeholder"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-language-override"
- },
- "font-optical-sizing": {
- syntax: "auto | none",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Fonts"
- ],
- initial: "auto",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "perGrammar",
- alsoAppliesTo: [
- "::first-letter",
- "::first-line",
- "::placeholder"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-optical-sizing"
- },
- "font-variation-settings": {
- syntax: "normal | [ <string> <number> ]#",
- media: "visual",
- inherited: true,
- animationType: "transform",
- percentages: "no",
- groups: [
- "CSS Fonts"
- ],
- initial: "normal",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "perGrammar",
- alsoAppliesTo: [
- "::first-letter",
- "::first-line",
- "::placeholder"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-variation-settings"
- },
- "font-size": {
- syntax: "<absolute-size> | <relative-size> | <length-percentage>",
- media: "visual",
- inherited: true,
- animationType: "length",
- percentages: "referToParentElementsFontSize",
- groups: [
- "CSS Fonts"
- ],
- initial: "medium",
- appliesto: "allElements",
- computed: "asSpecifiedRelativeToAbsoluteLengths",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter",
- "::first-line",
- "::placeholder"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-size"
- },
- "font-size-adjust": {
- syntax: "none | <number>",
- media: "visual",
- inherited: true,
- animationType: "number",
- percentages: "no",
- groups: [
- "CSS Fonts"
- ],
- initial: "none",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter",
- "::first-line",
- "::placeholder"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-size-adjust"
- },
- "font-smooth": {
- syntax: "auto | never | always | <absolute-size> | <length>",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Fonts"
- ],
- initial: "auto",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-smooth"
- },
- "font-stretch": {
- syntax: "<font-stretch-absolute>",
- media: "visual",
- inherited: true,
- animationType: "fontStretch",
- percentages: "no",
- groups: [
- "CSS Fonts"
- ],
- initial: "normal",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter",
- "::first-line",
- "::placeholder"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-stretch"
- },
- "font-style": {
- syntax: "normal | italic | oblique <angle>?",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Fonts"
- ],
- initial: "normal",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter",
- "::first-line",
- "::placeholder"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-style"
- },
- "font-synthesis": {
- syntax: "none | [ weight || style ]",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Fonts"
- ],
- initial: "weight style",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "orderOfAppearance",
- alsoAppliesTo: [
- "::first-letter",
- "::first-line",
- "::placeholder"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-synthesis"
- },
- "font-variant": {
- syntax: "normal | none | [ <common-lig-values> || <discretionary-lig-values> || <historical-lig-values> || <contextual-alt-values> || stylistic( <feature-value-name> ) || historical-forms || styleset( <feature-value-name># ) || character-variant( <feature-value-name># ) || swash( <feature-value-name> ) || ornaments( <feature-value-name> ) || annotation( <feature-value-name> ) || [ small-caps | all-small-caps | petite-caps | all-petite-caps | unicase | titling-caps ] || <numeric-figure-values> || <numeric-spacing-values> || <numeric-fraction-values> || ordinal || slashed-zero || <east-asian-variant-values> || <east-asian-width-values> || ruby ]",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Fonts"
- ],
- initial: "normal",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter",
- "::first-line",
- "::placeholder"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-variant"
- },
- "font-variant-alternates": {
- syntax: "normal | [ stylistic( <feature-value-name> ) || historical-forms || styleset( <feature-value-name># ) || character-variant( <feature-value-name># ) || swash( <feature-value-name> ) || ornaments( <feature-value-name> ) || annotation( <feature-value-name> ) ]",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Fonts"
- ],
- initial: "normal",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "orderOfAppearance",
- alsoAppliesTo: [
- "::first-letter",
- "::first-line",
- "::placeholder"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-variant-alternates"
- },
- "font-variant-caps": {
- syntax: "normal | small-caps | all-small-caps | petite-caps | all-petite-caps | unicase | titling-caps",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Fonts"
- ],
- initial: "normal",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter",
- "::first-line",
- "::placeholder"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-variant-caps"
- },
- "font-variant-east-asian": {
- syntax: "normal | [ <east-asian-variant-values> || <east-asian-width-values> || ruby ]",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Fonts"
- ],
- initial: "normal",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "orderOfAppearance",
- alsoAppliesTo: [
- "::first-letter",
- "::first-line",
- "::placeholder"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-variant-east-asian"
- },
- "font-variant-ligatures": {
- syntax: "normal | none | [ <common-lig-values> || <discretionary-lig-values> || <historical-lig-values> || <contextual-alt-values> ]",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Fonts"
- ],
- initial: "normal",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "orderOfAppearance",
- alsoAppliesTo: [
- "::first-letter",
- "::first-line",
- "::placeholder"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-variant-ligatures"
- },
- "font-variant-numeric": {
- syntax: "normal | [ <numeric-figure-values> || <numeric-spacing-values> || <numeric-fraction-values> || ordinal || slashed-zero ]",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Fonts"
- ],
- initial: "normal",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "orderOfAppearance",
- alsoAppliesTo: [
- "::first-letter",
- "::first-line",
- "::placeholder"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-variant-numeric"
- },
- "font-variant-position": {
- syntax: "normal | sub | super",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Fonts"
- ],
- initial: "normal",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter",
- "::first-line",
- "::placeholder"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-variant-position"
- },
- "font-weight": {
- syntax: "<font-weight-absolute> | bolder | lighter",
- media: "visual",
- inherited: true,
- animationType: "fontWeight",
- percentages: "no",
- groups: [
- "CSS Fonts"
- ],
- initial: "normal",
- appliesto: "allElements",
- computed: "keywordOrNumericalValueBolderLighterTransformedToRealValue",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter",
- "::first-line",
- "::placeholder"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/font-weight"
- },
- gap: gap,
- grid: grid,
- "grid-area": {
- syntax: "<grid-line> [ / <grid-line> ]{0,3}",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Grid Layout"
- ],
- initial: [
- "grid-row-start",
- "grid-column-start",
- "grid-row-end",
- "grid-column-end"
- ],
- appliesto: "gridItemsAndBoxesWithinGridContainer",
- computed: [
- "grid-row-start",
- "grid-column-start",
- "grid-row-end",
- "grid-column-end"
- ],
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-area"
- },
- "grid-auto-columns": {
- syntax: "<track-size>+",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "referToDimensionOfContentArea",
- groups: [
- "CSS Grid Layout"
- ],
- initial: "auto",
- appliesto: "gridContainers",
- computed: "percentageAsSpecifiedOrAbsoluteLength",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-auto-columns"
- },
- "grid-auto-flow": {
- syntax: "[ row | column ] || dense",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Grid Layout"
- ],
- initial: "row",
- appliesto: "gridContainers",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-auto-flow"
- },
- "grid-auto-rows": {
- syntax: "<track-size>+",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "referToDimensionOfContentArea",
- groups: [
- "CSS Grid Layout"
- ],
- initial: "auto",
- appliesto: "gridContainers",
- computed: "percentageAsSpecifiedOrAbsoluteLength",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-auto-rows"
- },
- "grid-column": {
- syntax: "<grid-line> [ / <grid-line> ]?",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Grid Layout"
- ],
- initial: [
- "grid-column-start",
- "grid-column-end"
- ],
- appliesto: "gridItemsAndBoxesWithinGridContainer",
- computed: [
- "grid-column-start",
- "grid-column-end"
- ],
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-column"
- },
- "grid-column-end": {
- syntax: "<grid-line>",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Grid Layout"
- ],
- initial: "auto",
- appliesto: "gridItemsAndBoxesWithinGridContainer",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-column-end"
- },
- "grid-column-gap": {
- syntax: "<length-percentage>",
- media: "visual",
- inherited: false,
- animationType: "length",
- percentages: "referToDimensionOfContentArea",
- groups: [
- "CSS Grid Layout"
- ],
- initial: "0",
- appliesto: "gridContainers",
- computed: "percentageAsSpecifiedOrAbsoluteLength",
- order: "uniqueOrder",
- status: "obsolete",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/column-gap"
- },
- "grid-column-start": {
- syntax: "<grid-line>",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Grid Layout"
- ],
- initial: "auto",
- appliesto: "gridItemsAndBoxesWithinGridContainer",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-column-start"
- },
- "grid-gap": {
- syntax: "<'grid-row-gap'> <'grid-column-gap'>?",
- media: "visual",
- inherited: false,
- animationType: [
- "grid-row-gap",
- "grid-column-gap"
- ],
- percentages: "no",
- groups: [
- "CSS Grid Layout"
- ],
- initial: [
- "grid-row-gap",
- "grid-column-gap"
- ],
- appliesto: "gridContainers",
- computed: [
- "grid-row-gap",
- "grid-column-gap"
- ],
- order: "uniqueOrder",
- status: "obsolete",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/gap"
- },
- "grid-row": {
- syntax: "<grid-line> [ / <grid-line> ]?",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Grid Layout"
- ],
- initial: [
- "grid-row-start",
- "grid-row-end"
- ],
- appliesto: "gridItemsAndBoxesWithinGridContainer",
- computed: [
- "grid-row-start",
- "grid-row-end"
- ],
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-row"
- },
- "grid-row-end": {
- syntax: "<grid-line>",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Grid Layout"
- ],
- initial: "auto",
- appliesto: "gridItemsAndBoxesWithinGridContainer",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-row-end"
- },
- "grid-row-gap": {
- syntax: "<length-percentage>",
- media: "visual",
- inherited: false,
- animationType: "length",
- percentages: "referToDimensionOfContentArea",
- groups: [
- "CSS Grid Layout"
- ],
- initial: "0",
- appliesto: "gridContainers",
- computed: "percentageAsSpecifiedOrAbsoluteLength",
- order: "uniqueOrder",
- status: "obsolete",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/row-gap"
- },
- "grid-row-start": {
- syntax: "<grid-line>",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Grid Layout"
- ],
- initial: "auto",
- appliesto: "gridItemsAndBoxesWithinGridContainer",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-row-start"
- },
- "grid-template": {
- syntax: "none | [ <'grid-template-rows'> / <'grid-template-columns'> ] | [ <line-names>? <string> <track-size>? <line-names>? ]+ [ / <explicit-track-list> ]?",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: [
- "grid-template-columns",
- "grid-template-rows"
- ],
- groups: [
- "CSS Grid Layout"
- ],
- initial: [
- "grid-template-columns",
- "grid-template-rows",
- "grid-template-areas"
- ],
- appliesto: "gridContainers",
- computed: [
- "grid-template-columns",
- "grid-template-rows",
- "grid-template-areas"
- ],
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-template"
- },
- "grid-template-areas": {
- syntax: "none | <string>+",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Grid Layout"
- ],
- initial: "none",
- appliesto: "gridContainers",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-template-areas"
- },
- "grid-template-columns": {
- syntax: "none | <track-list> | <auto-track-list> | subgrid <line-name-list>?",
- media: "visual",
- inherited: false,
- animationType: "simpleListOfLpcDifferenceLpc",
- percentages: "referToDimensionOfContentArea",
- groups: [
- "CSS Grid Layout"
- ],
- initial: "none",
- appliesto: "gridContainers",
- computed: "asSpecifiedRelativeToAbsoluteLengths",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-template-columns"
- },
- "grid-template-rows": {
- syntax: "none | <track-list> | <auto-track-list> | subgrid <line-name-list>?",
- media: "visual",
- inherited: false,
- animationType: "simpleListOfLpcDifferenceLpc",
- percentages: "referToDimensionOfContentArea",
- groups: [
- "CSS Grid Layout"
- ],
- initial: "none",
- appliesto: "gridContainers",
- computed: "asSpecifiedRelativeToAbsoluteLengths",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/grid-template-rows"
- },
- "hanging-punctuation": {
- syntax: "none | [ first || [ force-end | allow-end ] || last ]",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Text"
- ],
- initial: "none",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/hanging-punctuation"
- },
- height: height,
- hyphens: hyphens,
- "image-orientation": {
- syntax: "from-image | <angle> | [ <angle>? flip ]",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Images"
- ],
- initial: "from-image",
- appliesto: "allElements",
- computed: "angleRoundedToNextQuarter",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/image-orientation"
- },
- "image-rendering": {
- syntax: "auto | crisp-edges | pixelated",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Images"
- ],
- initial: "auto",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/image-rendering"
- },
- "image-resolution": {
- syntax: "[ from-image || <resolution> ] && snap?",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Images"
- ],
- initial: "1dppx",
- appliesto: "allElements",
- computed: "asSpecifiedWithExceptionOfResolution",
- order: "uniqueOrder",
- status: "experimental"
- },
- "ime-mode": {
- syntax: "auto | normal | active | inactive | disabled",
- media: "interactive",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Basic User Interface"
- ],
- initial: "auto",
- appliesto: "textFields",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "obsolete",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/ime-mode"
- },
- "initial-letter": {
- syntax: "normal | [ <number> <integer>? ]",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Inline"
- ],
- initial: "normal",
- appliesto: "firstLetterPseudoElementsAndInlineLevelFirstChildren",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "experimental",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/initial-letter"
- },
- "initial-letter-align": {
- syntax: "[ auto | alphabetic | hanging | ideographic ]",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Inline"
- ],
- initial: "auto",
- appliesto: "firstLetterPseudoElementsAndInlineLevelFirstChildren",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "experimental",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/initial-letter-align"
- },
- "inline-size": {
- syntax: "<'width'>",
- media: "visual",
- inherited: false,
- animationType: "lpc",
- percentages: "inlineSizeOfContainingBlock",
- groups: [
- "CSS Logical Properties"
- ],
- initial: "auto",
- appliesto: "sameAsWidthAndHeight",
- computed: "sameAsWidthAndHeight",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/inline-size"
- },
- inset: inset,
- "inset-block": {
- syntax: "<'top'>{1,2}",
- media: "visual",
- inherited: false,
- animationType: "lpc",
- percentages: "logicalHeightOfContainingBlock",
- groups: [
- "CSS Logical Properties"
- ],
- initial: "auto",
- appliesto: "positionedElements",
- computed: "sameAsBoxOffsets",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/inset-block"
- },
- "inset-block-end": {
- syntax: "<'top'>",
- media: "visual",
- inherited: false,
- animationType: "lpc",
- percentages: "logicalHeightOfContainingBlock",
- groups: [
- "CSS Logical Properties"
- ],
- initial: "auto",
- appliesto: "positionedElements",
- computed: "sameAsBoxOffsets",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/inset-block-end"
- },
- "inset-block-start": {
- syntax: "<'top'>",
- media: "visual",
- inherited: false,
- animationType: "lpc",
- percentages: "logicalHeightOfContainingBlock",
- groups: [
- "CSS Logical Properties"
- ],
- initial: "auto",
- appliesto: "positionedElements",
- computed: "sameAsBoxOffsets",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/inset-block-start"
- },
- "inset-inline": {
- syntax: "<'top'>{1,2}",
- media: "visual",
- inherited: false,
- animationType: "lpc",
- percentages: "logicalWidthOfContainingBlock",
- groups: [
- "CSS Logical Properties"
- ],
- initial: "auto",
- appliesto: "positionedElements",
- computed: "sameAsBoxOffsets",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/inset-inline"
- },
- "inset-inline-end": {
- syntax: "<'top'>",
- media: "visual",
- inherited: false,
- animationType: "lpc",
- percentages: "logicalWidthOfContainingBlock",
- groups: [
- "CSS Logical Properties"
- ],
- initial: "auto",
- appliesto: "positionedElements",
- computed: "sameAsBoxOffsets",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/inset-inline-end"
- },
- "inset-inline-start": {
- syntax: "<'top'>",
- media: "visual",
- inherited: false,
- animationType: "lpc",
- percentages: "logicalWidthOfContainingBlock",
- groups: [
- "CSS Logical Properties"
- ],
- initial: "auto",
- appliesto: "positionedElements",
- computed: "sameAsBoxOffsets",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/inset-inline-start"
- },
- isolation: isolation,
- "justify-content": {
- syntax: "normal | <content-distribution> | <overflow-position>? [ <content-position> | left | right ]",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Box Alignment"
- ],
- initial: "normal",
- appliesto: "flexContainers",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/justify-content"
- },
- "justify-items": {
- syntax: "normal | stretch | <baseline-position> | <overflow-position>? [ <self-position> | left | right ] | legacy | legacy && [ left | right | center ]",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Box Alignment"
- ],
- initial: "legacy",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "perGrammar",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/justify-items"
- },
- "justify-self": {
- syntax: "auto | normal | stretch | <baseline-position> | <overflow-position>? [ <self-position> | left | right ]",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Box Alignment"
- ],
- initial: "auto",
- appliesto: "blockLevelBoxesAndAbsolutelyPositionedBoxesAndGridItems",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/justify-self"
- },
- "justify-tracks": {
- syntax: "[ normal | <content-distribution> | <overflow-position>? [ <content-position> | left | right ] ]#",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Grid Layout"
- ],
- initial: "normal",
- appliesto: "gridContainersWithMasonryLayoutInTheirInlineAxis",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "experimental",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/justify-tracks"
- },
- left: left,
- "letter-spacing": {
- syntax: "normal | <length>",
- media: "visual",
- inherited: true,
- animationType: "length",
- percentages: "no",
- groups: [
- "CSS Text"
- ],
- initial: "normal",
- appliesto: "allElements",
- computed: "optimumValueOfAbsoluteLengthOrNormal",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter",
- "::first-line"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/letter-spacing"
- },
- "line-break": {
- syntax: "auto | loose | normal | strict | anywhere",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Text"
- ],
- initial: "auto",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/line-break"
- },
- "line-clamp": {
- syntax: "none | <integer>",
- media: "visual",
- inherited: false,
- animationType: "integer",
- percentages: "no",
- groups: [
- "CSS Overflow"
- ],
- initial: "none",
- appliesto: "blockContainersExceptMultiColumnContainers",
- computed: "asSpecified",
- order: "perGrammar",
- status: "experimental"
- },
- "line-height": {
- syntax: "normal | <number> | <length> | <percentage>",
- media: "visual",
- inherited: true,
- animationType: "numberOrLength",
- percentages: "referToElementFontSize",
- groups: [
- "CSS Fonts"
- ],
- initial: "normal",
- appliesto: "allElements",
- computed: "absoluteLengthOrAsSpecified",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter",
- "::first-line",
- "::placeholder"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/line-height"
- },
- "line-height-step": {
- syntax: "<length>",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Fonts"
- ],
- initial: "0",
- appliesto: "blockContainers",
- computed: "absoluteLength",
- order: "perGrammar",
- status: "experimental",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/line-height-step"
- },
- "list-style": {
- syntax: "<'list-style-type'> || <'list-style-position'> || <'list-style-image'>",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Lists and Counters"
- ],
- initial: [
- "list-style-type",
- "list-style-position",
- "list-style-image"
- ],
- appliesto: "listItems",
- computed: [
- "list-style-image",
- "list-style-position",
- "list-style-type"
- ],
- order: "orderOfAppearance",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/list-style"
- },
- "list-style-image": {
- syntax: "<url> | none",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Lists and Counters"
- ],
- initial: "none",
- appliesto: "listItems",
- computed: "noneOrImageWithAbsoluteURI",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/list-style-image"
- },
- "list-style-position": {
- syntax: "inside | outside",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Lists and Counters"
- ],
- initial: "outside",
- appliesto: "listItems",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/list-style-position"
- },
- "list-style-type": {
- syntax: "<counter-style> | <string> | none",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Lists and Counters"
- ],
- initial: "disc",
- appliesto: "listItems",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/list-style-type"
- },
- margin: margin,
- "margin-block": {
- syntax: "<'margin-left'>{1,2}",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "dependsOnLayoutModel",
- groups: [
- "CSS Logical Properties"
- ],
- initial: "0",
- appliesto: "sameAsMargin",
- computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/margin-block"
- },
- "margin-block-end": {
- syntax: "<'margin-left'>",
- media: "visual",
- inherited: false,
- animationType: "length",
- percentages: "dependsOnLayoutModel",
- groups: [
- "CSS Logical Properties"
- ],
- initial: "0",
- appliesto: "sameAsMargin",
- computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/margin-block-end"
- },
- "margin-block-start": {
- syntax: "<'margin-left'>",
- media: "visual",
- inherited: false,
- animationType: "length",
- percentages: "dependsOnLayoutModel",
- groups: [
- "CSS Logical Properties"
- ],
- initial: "0",
- appliesto: "sameAsMargin",
- computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/margin-block-start"
- },
- "margin-bottom": {
- syntax: "<length> | <percentage> | auto",
- media: "visual",
- inherited: false,
- animationType: "length",
- percentages: "referToWidthOfContainingBlock",
- groups: [
- "CSS Box Model"
- ],
- initial: "0",
- appliesto: "allElementsExceptTableDisplayTypes",
- computed: "percentageAsSpecifiedOrAbsoluteLength",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter",
- "::first-line"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/margin-bottom"
- },
- "margin-inline": {
- syntax: "<'margin-left'>{1,2}",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "dependsOnLayoutModel",
- groups: [
- "CSS Logical Properties"
- ],
- initial: "0",
- appliesto: "sameAsMargin",
- computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/margin-inline"
- },
- "margin-inline-end": {
- syntax: "<'margin-left'>",
- media: "visual",
- inherited: false,
- animationType: "length",
- percentages: "dependsOnLayoutModel",
- groups: [
- "CSS Logical Properties"
- ],
- initial: "0",
- appliesto: "sameAsMargin",
- computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/margin-inline-end"
- },
- "margin-inline-start": {
- syntax: "<'margin-left'>",
- media: "visual",
- inherited: false,
- animationType: "length",
- percentages: "dependsOnLayoutModel",
- groups: [
- "CSS Logical Properties"
- ],
- initial: "0",
- appliesto: "sameAsMargin",
- computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/margin-inline-start"
- },
- "margin-left": {
- syntax: "<length> | <percentage> | auto",
- media: "visual",
- inherited: false,
- animationType: "length",
- percentages: "referToWidthOfContainingBlock",
- groups: [
- "CSS Box Model"
- ],
- initial: "0",
- appliesto: "allElementsExceptTableDisplayTypes",
- computed: "percentageAsSpecifiedOrAbsoluteLength",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter",
- "::first-line"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/margin-left"
- },
- "margin-right": {
- syntax: "<length> | <percentage> | auto",
- media: "visual",
- inherited: false,
- animationType: "length",
- percentages: "referToWidthOfContainingBlock",
- groups: [
- "CSS Box Model"
- ],
- initial: "0",
- appliesto: "allElementsExceptTableDisplayTypes",
- computed: "percentageAsSpecifiedOrAbsoluteLength",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter",
- "::first-line"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/margin-right"
- },
- "margin-top": {
- syntax: "<length> | <percentage> | auto",
- media: "visual",
- inherited: false,
- animationType: "length",
- percentages: "referToWidthOfContainingBlock",
- groups: [
- "CSS Box Model"
- ],
- initial: "0",
- appliesto: "allElementsExceptTableDisplayTypes",
- computed: "percentageAsSpecifiedOrAbsoluteLength",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter",
- "::first-line"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/margin-top"
- },
- "margin-trim": {
- syntax: "none | in-flow | all",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Box Model"
- ],
- initial: "none",
- appliesto: "blockContainersAndMultiColumnContainers",
- computed: "asSpecified",
- order: "perGrammar",
- alsoAppliesTo: [
- "::first-letter",
- "::first-line"
- ],
- status: "experimental",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/margin-trim"
- },
- mask: mask,
- "mask-border": {
- syntax: "<'mask-border-source'> || <'mask-border-slice'> [ / <'mask-border-width'>? [ / <'mask-border-outset'> ]? ]? || <'mask-border-repeat'> || <'mask-border-mode'>",
- media: "visual",
- inherited: false,
- animationType: [
- "mask-border-mode",
- "mask-border-outset",
- "mask-border-repeat",
- "mask-border-slice",
- "mask-border-source",
- "mask-border-width"
- ],
- percentages: [
- "mask-border-slice",
- "mask-border-width"
- ],
- groups: [
- "CSS Masking"
- ],
- initial: [
- "mask-border-mode",
- "mask-border-outset",
- "mask-border-repeat",
- "mask-border-slice",
- "mask-border-source",
- "mask-border-width"
- ],
- appliesto: "allElementsSVGContainerElements",
- computed: [
- "mask-border-mode",
- "mask-border-outset",
- "mask-border-repeat",
- "mask-border-slice",
- "mask-border-source",
- "mask-border-width"
- ],
- order: "perGrammar",
- stacking: true,
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-border"
- },
- "mask-border-mode": {
- syntax: "luminance | alpha",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Masking"
- ],
- initial: "alpha",
- appliesto: "allElementsSVGContainerElements",
- computed: "asSpecified",
- order: "perGrammar",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-border-mode"
- },
- "mask-border-outset": {
- syntax: "[ <length> | <number> ]{1,4}",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Masking"
- ],
- initial: "0",
- appliesto: "allElementsSVGContainerElements",
- computed: "asSpecifiedRelativeToAbsoluteLengths",
- order: "perGrammar",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-border-outset"
- },
- "mask-border-repeat": {
- syntax: "[ stretch | repeat | round | space ]{1,2}",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Masking"
- ],
- initial: "stretch",
- appliesto: "allElementsSVGContainerElements",
- computed: "asSpecified",
- order: "perGrammar",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-border-repeat"
- },
- "mask-border-slice": {
- syntax: "<number-percentage>{1,4} fill?",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "referToSizeOfMaskBorderImage",
- groups: [
- "CSS Masking"
- ],
- initial: "0",
- appliesto: "allElementsSVGContainerElements",
- computed: "asSpecified",
- order: "perGrammar",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-border-slice"
- },
- "mask-border-source": {
- syntax: "none | <image>",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Masking"
- ],
- initial: "none",
- appliesto: "allElementsSVGContainerElements",
- computed: "asSpecifiedURLsAbsolute",
- order: "perGrammar",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-border-source"
- },
- "mask-border-width": {
- syntax: "[ <length-percentage> | <number> | auto ]{1,4}",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "relativeToMaskBorderImageArea",
- groups: [
- "CSS Masking"
- ],
- initial: "auto",
- appliesto: "allElementsSVGContainerElements",
- computed: "asSpecifiedRelativeToAbsoluteLengths",
- order: "perGrammar",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-border-width"
- },
- "mask-clip": {
- syntax: "[ <geometry-box> | no-clip ]#",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Masking"
- ],
- initial: "border-box",
- appliesto: "allElementsSVGContainerElements",
- computed: "asSpecified",
- order: "perGrammar",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-clip"
- },
- "mask-composite": {
- syntax: "<compositing-operator>#",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Masking"
- ],
- initial: "add",
- appliesto: "allElementsSVGContainerElements",
- computed: "asSpecified",
- order: "perGrammar",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-composite"
- },
- "mask-image": {
- syntax: "<mask-reference>#",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Masking"
- ],
- initial: "none",
- appliesto: "allElementsSVGContainerElements",
- computed: "asSpecifiedURLsAbsolute",
- order: "perGrammar",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-image"
- },
- "mask-mode": {
- syntax: "<masking-mode>#",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Masking"
- ],
- initial: "match-source",
- appliesto: "allElementsSVGContainerElements",
- computed: "asSpecified",
- order: "perGrammar",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-mode"
- },
- "mask-origin": {
- syntax: "<geometry-box>#",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Masking"
- ],
- initial: "border-box",
- appliesto: "allElementsSVGContainerElements",
- computed: "asSpecified",
- order: "perGrammar",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-origin"
- },
- "mask-position": {
- syntax: "<position>#",
- media: "visual",
- inherited: false,
- animationType: "repeatableListOfSimpleListOfLpc",
- percentages: "referToSizeOfMaskPaintingArea",
- groups: [
- "CSS Masking"
- ],
- initial: "center",
- appliesto: "allElementsSVGContainerElements",
- computed: "consistsOfTwoKeywordsForOriginAndOffsets",
- order: "perGrammar",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-position"
- },
- "mask-repeat": {
- syntax: "<repeat-style>#",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Masking"
- ],
- initial: "no-repeat",
- appliesto: "allElementsSVGContainerElements",
- computed: "consistsOfTwoDimensionKeywords",
- order: "perGrammar",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-repeat"
- },
- "mask-size": {
- syntax: "<bg-size>#",
- media: "visual",
- inherited: false,
- animationType: "repeatableListOfSimpleListOfLpc",
- percentages: "no",
- groups: [
- "CSS Masking"
- ],
- initial: "auto",
- appliesto: "allElementsSVGContainerElements",
- computed: "asSpecifiedRelativeToAbsoluteLengths",
- order: "perGrammar",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-size"
- },
- "mask-type": {
- syntax: "luminance | alpha",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Masking"
- ],
- initial: "luminance",
- appliesto: "maskElements",
- computed: "asSpecified",
- order: "perGrammar",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mask-type"
- },
- "masonry-auto-flow": {
- syntax: "[ pack | next ] || [ definite-first | ordered ]",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Grid Layout"
- ],
- initial: "pack",
- appliesto: "gridContainersWithMasonryLayout",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "experimental",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/masonry-auto-flow"
- },
- "math-style": {
- syntax: "normal | compact",
- media: "visual",
- inherited: true,
- animationType: "notAnimatable",
- percentages: "no",
- groups: [
- "MathML"
- ],
- initial: "normal",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "perGrammar",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/math-style"
- },
- "max-block-size": {
- syntax: "<'max-width'>",
- media: "visual",
- inherited: false,
- animationType: "lpc",
- percentages: "blockSizeOfContainingBlock",
- groups: [
- "CSS Logical Properties"
- ],
- initial: "0",
- appliesto: "sameAsWidthAndHeight",
- computed: "sameAsMaxWidthAndMaxHeight",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/max-block-size"
- },
- "max-height": {
- syntax: "none | <length-percentage> | min-content | max-content | fit-content(<length-percentage>)",
- media: "visual",
- inherited: false,
- animationType: "lpc",
- percentages: "regardingHeightOfGeneratedBoxContainingBlockPercentagesNone",
- groups: [
- "CSS Box Model"
- ],
- initial: "none",
- appliesto: "allElementsButNonReplacedAndTableColumns",
- computed: "percentageAsSpecifiedAbsoluteLengthOrNone",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/max-height"
- },
- "max-inline-size": {
- syntax: "<'max-width'>",
- media: "visual",
- inherited: false,
- animationType: "lpc",
- percentages: "inlineSizeOfContainingBlock",
- groups: [
- "CSS Logical Properties"
- ],
- initial: "0",
- appliesto: "sameAsWidthAndHeight",
- computed: "sameAsMaxWidthAndMaxHeight",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/max-inline-size"
- },
- "max-lines": {
- syntax: "none | <integer>",
- media: "visual",
- inherited: false,
- animationType: "integer",
- percentages: "no",
- groups: [
- "CSS Overflow"
- ],
- initial: "none",
- appliesto: "blockContainersExceptMultiColumnContainers",
- computed: "asSpecified",
- order: "perGrammar",
- status: "experimental"
- },
- "max-width": {
- syntax: "none | <length-percentage> | min-content | max-content | fit-content(<length-percentage>)",
- media: "visual",
- inherited: false,
- animationType: "lpc",
- percentages: "referToWidthOfContainingBlock",
- groups: [
- "CSS Box Model"
- ],
- initial: "none",
- appliesto: "allElementsButNonReplacedAndTableRows",
- computed: "percentageAsSpecifiedAbsoluteLengthOrNone",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/max-width"
- },
- "min-block-size": {
- syntax: "<'min-width'>",
- media: "visual",
- inherited: false,
- animationType: "lpc",
- percentages: "blockSizeOfContainingBlock",
- groups: [
- "CSS Logical Properties"
- ],
- initial: "0",
- appliesto: "sameAsWidthAndHeight",
- computed: "sameAsMinWidthAndMinHeight",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/min-block-size"
- },
- "min-height": {
- syntax: "auto | <length> | <percentage> | min-content | max-content | fit-content(<length-percentage>)",
- media: "visual",
- inherited: false,
- animationType: "lpc",
- percentages: "regardingHeightOfGeneratedBoxContainingBlockPercentages0",
- groups: [
- "CSS Box Model"
- ],
- initial: "auto",
- appliesto: "allElementsButNonReplacedAndTableColumns",
- computed: "percentageAsSpecifiedOrAbsoluteLength",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/min-height"
- },
- "min-inline-size": {
- syntax: "<'min-width'>",
- media: "visual",
- inherited: false,
- animationType: "lpc",
- percentages: "inlineSizeOfContainingBlock",
- groups: [
- "CSS Logical Properties"
- ],
- initial: "0",
- appliesto: "sameAsWidthAndHeight",
- computed: "sameAsMinWidthAndMinHeight",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/min-inline-size"
- },
- "min-width": {
- syntax: "auto | <length> | <percentage> | min-content | max-content | fit-content(<length-percentage>)",
- media: "visual",
- inherited: false,
- animationType: "lpc",
- percentages: "referToWidthOfContainingBlock",
- groups: [
- "CSS Box Model"
- ],
- initial: "auto",
- appliesto: "allElementsButNonReplacedAndTableRows",
- computed: "percentageAsSpecifiedOrAbsoluteLength",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/min-width"
- },
- "mix-blend-mode": {
- syntax: "<blend-mode>",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Compositing and Blending"
- ],
- initial: "normal",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- stacking: true,
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/mix-blend-mode"
- },
- "object-fit": {
- syntax: "fill | contain | cover | none | scale-down",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Images"
- ],
- initial: "fill",
- appliesto: "replacedElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/object-fit"
- },
- "object-position": {
- syntax: "<position>",
- media: "visual",
- inherited: true,
- animationType: "repeatableListOfSimpleListOfLpc",
- percentages: "referToWidthAndHeightOfElement",
- groups: [
- "CSS Images"
- ],
- initial: "50% 50%",
- appliesto: "replacedElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/object-position"
- },
- offset: offset,
- "offset-anchor": {
- syntax: "auto | <position>",
- media: "visual",
- inherited: false,
- animationType: "position",
- percentages: "relativeToWidthAndHeight",
- groups: [
- "CSS Motion Path"
- ],
- initial: "auto",
- appliesto: "transformableElements",
- computed: "forLengthAbsoluteValueOtherwisePercentage",
- order: "perGrammar",
- status: "standard"
- },
- "offset-distance": {
- syntax: "<length-percentage>",
- media: "visual",
- inherited: false,
- animationType: "lpc",
- percentages: "referToTotalPathLength",
- groups: [
- "CSS Motion Path"
- ],
- initial: "0",
- appliesto: "transformableElements",
- computed: "forLengthAbsoluteValueOtherwisePercentage",
- order: "perGrammar",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/offset-distance"
- },
- "offset-path": {
- syntax: "none | ray( [ <angle> && <size> && contain? ] ) | <path()> | <url> | [ <basic-shape> || <geometry-box> ]",
- media: "visual",
- inherited: false,
- animationType: "angleOrBasicShapeOrPath",
- percentages: "no",
- groups: [
- "CSS Motion Path"
- ],
- initial: "none",
- appliesto: "transformableElements",
- computed: "asSpecified",
- order: "perGrammar",
- stacking: true,
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/offset-path"
- },
- "offset-position": {
- syntax: "auto | <position>",
- media: "visual",
- inherited: false,
- animationType: "position",
- percentages: "referToSizeOfContainingBlock",
- groups: [
- "CSS Motion Path"
- ],
- initial: "auto",
- appliesto: "transformableElements",
- computed: "forLengthAbsoluteValueOtherwisePercentage",
- order: "perGrammar",
- status: "experimental"
- },
- "offset-rotate": {
- syntax: "[ auto | reverse ] || <angle>",
- media: "visual",
- inherited: false,
- animationType: "angleOrBasicShapeOrPath",
- percentages: "no",
- groups: [
- "CSS Motion Path"
- ],
- initial: "auto",
- appliesto: "transformableElements",
- computed: "asSpecified",
- order: "perGrammar",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/offset-rotate"
- },
- opacity: opacity,
- order: order,
- orphans: orphans,
- outline: outline,
- "outline-color": {
- syntax: "<color> | invert",
- media: [
- "visual",
- "interactive"
- ],
- inherited: false,
- animationType: "color",
- percentages: "no",
- groups: [
- "CSS Basic User Interface"
- ],
- initial: "invertOrCurrentColor",
- appliesto: "allElements",
- computed: "invertForTranslucentColorRGBAOtherwiseRGB",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/outline-color"
- },
- "outline-offset": {
- syntax: "<length>",
- media: [
- "visual",
- "interactive"
- ],
- inherited: false,
- animationType: "length",
- percentages: "no",
- groups: [
- "CSS Basic User Interface"
- ],
- initial: "0",
- appliesto: "allElements",
- computed: "asSpecifiedRelativeToAbsoluteLengths",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/outline-offset"
- },
- "outline-style": {
- syntax: "auto | <'border-style'>",
- media: [
- "visual",
- "interactive"
- ],
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Basic User Interface"
- ],
- initial: "none",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/outline-style"
- },
- "outline-width": {
- syntax: "<line-width>",
- media: [
- "visual",
- "interactive"
- ],
- inherited: false,
- animationType: "length",
- percentages: "no",
- groups: [
- "CSS Basic User Interface"
- ],
- initial: "medium",
- appliesto: "allElements",
- computed: "absoluteLength0ForNone",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/outline-width"
- },
- overflow: overflow,
- "overflow-anchor": {
- syntax: "auto | none",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Scroll Anchoring"
- ],
- initial: "auto",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "perGrammar",
- status: "standard"
- },
- "overflow-block": {
- syntax: "visible | hidden | clip | scroll | auto",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Overflow"
- ],
- initial: "auto",
- appliesto: "blockContainersFlexContainersGridContainers",
- computed: "asSpecifiedButVisibleOrClipReplacedToAutoOrHiddenIfOtherValueDifferent",
- order: "perGrammar",
- status: "standard"
- },
- "overflow-clip-box": {
- syntax: "padding-box | content-box",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Mozilla Extensions"
- ],
- initial: "padding-box",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Mozilla/CSS/overflow-clip-box"
- },
- "overflow-inline": {
- syntax: "visible | hidden | clip | scroll | auto",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Overflow"
- ],
- initial: "auto",
- appliesto: "blockContainersFlexContainersGridContainers",
- computed: "asSpecifiedButVisibleOrClipReplacedToAutoOrHiddenIfOtherValueDifferent",
- order: "perGrammar",
- status: "standard"
- },
- "overflow-wrap": {
- syntax: "normal | break-word | anywhere",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Text"
- ],
- initial: "normal",
- appliesto: "nonReplacedInlineElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/overflow-wrap"
- },
- "overflow-x": {
- syntax: "visible | hidden | clip | scroll | auto",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Overflow"
- ],
- initial: "visible",
- appliesto: "blockContainersFlexContainersGridContainers",
- computed: "asSpecifiedButVisibleOrClipReplacedToAutoOrHiddenIfOtherValueDifferent",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/overflow-x"
- },
- "overflow-y": {
- syntax: "visible | hidden | clip | scroll | auto",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Overflow"
- ],
- initial: "visible",
- appliesto: "blockContainersFlexContainersGridContainers",
- computed: "asSpecifiedButVisibleOrClipReplacedToAutoOrHiddenIfOtherValueDifferent",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/overflow-y"
- },
- "overscroll-behavior": {
- syntax: "[ contain | none | auto ]{1,2}",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Box Model"
- ],
- initial: "auto",
- appliesto: "nonReplacedBlockAndInlineBlockElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/overscroll-behavior"
- },
- "overscroll-behavior-block": {
- syntax: "contain | none | auto",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Box Model"
- ],
- initial: "auto",
- appliesto: "nonReplacedBlockAndInlineBlockElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/overscroll-behavior-block"
- },
- "overscroll-behavior-inline": {
- syntax: "contain | none | auto",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Box Model"
- ],
- initial: "auto",
- appliesto: "nonReplacedBlockAndInlineBlockElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/overscroll-behavior-inline"
- },
- "overscroll-behavior-x": {
- syntax: "contain | none | auto",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Box Model"
- ],
- initial: "auto",
- appliesto: "nonReplacedBlockAndInlineBlockElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/overscroll-behavior-x"
- },
- "overscroll-behavior-y": {
- syntax: "contain | none | auto",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Box Model"
- ],
- initial: "auto",
- appliesto: "nonReplacedBlockAndInlineBlockElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/overscroll-behavior-y"
- },
- padding: padding,
- "padding-block": {
- syntax: "<'padding-left'>{1,2}",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "logicalWidthOfContainingBlock",
- groups: [
- "CSS Logical Properties"
- ],
- initial: "0",
- appliesto: "allElements",
- computed: "asLength",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/padding-block"
- },
- "padding-block-end": {
- syntax: "<'padding-left'>",
- media: "visual",
- inherited: false,
- animationType: "length",
- percentages: "logicalWidthOfContainingBlock",
- groups: [
- "CSS Logical Properties"
- ],
- initial: "0",
- appliesto: "allElements",
- computed: "asLength",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/padding-block-end"
- },
- "padding-block-start": {
- syntax: "<'padding-left'>",
- media: "visual",
- inherited: false,
- animationType: "length",
- percentages: "logicalWidthOfContainingBlock",
- groups: [
- "CSS Logical Properties"
- ],
- initial: "0",
- appliesto: "allElements",
- computed: "asLength",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/padding-block-start"
- },
- "padding-bottom": {
- syntax: "<length> | <percentage>",
- media: "visual",
- inherited: false,
- animationType: "length",
- percentages: "referToWidthOfContainingBlock",
- groups: [
- "CSS Box Model"
- ],
- initial: "0",
- appliesto: "allElementsExceptInternalTableDisplayTypes",
- computed: "percentageAsSpecifiedOrAbsoluteLength",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter",
- "::first-line"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/padding-bottom"
- },
- "padding-inline": {
- syntax: "<'padding-left'>{1,2}",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "logicalWidthOfContainingBlock",
- groups: [
- "CSS Logical Properties"
- ],
- initial: "0",
- appliesto: "allElements",
- computed: "asLength",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/padding-inline"
- },
- "padding-inline-end": {
- syntax: "<'padding-left'>",
- media: "visual",
- inherited: false,
- animationType: "length",
- percentages: "logicalWidthOfContainingBlock",
- groups: [
- "CSS Logical Properties"
- ],
- initial: "0",
- appliesto: "allElements",
- computed: "asLength",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/padding-inline-end"
- },
- "padding-inline-start": {
- syntax: "<'padding-left'>",
- media: "visual",
- inherited: false,
- animationType: "length",
- percentages: "logicalWidthOfContainingBlock",
- groups: [
- "CSS Logical Properties"
- ],
- initial: "0",
- appliesto: "allElements",
- computed: "asLength",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/padding-inline-start"
- },
- "padding-left": {
- syntax: "<length> | <percentage>",
- media: "visual",
- inherited: false,
- animationType: "length",
- percentages: "referToWidthOfContainingBlock",
- groups: [
- "CSS Box Model"
- ],
- initial: "0",
- appliesto: "allElementsExceptInternalTableDisplayTypes",
- computed: "percentageAsSpecifiedOrAbsoluteLength",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter",
- "::first-line"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/padding-left"
- },
- "padding-right": {
- syntax: "<length> | <percentage>",
- media: "visual",
- inherited: false,
- animationType: "length",
- percentages: "referToWidthOfContainingBlock",
- groups: [
- "CSS Box Model"
- ],
- initial: "0",
- appliesto: "allElementsExceptInternalTableDisplayTypes",
- computed: "percentageAsSpecifiedOrAbsoluteLength",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter",
- "::first-line"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/padding-right"
- },
- "padding-top": {
- syntax: "<length> | <percentage>",
- media: "visual",
- inherited: false,
- animationType: "length",
- percentages: "referToWidthOfContainingBlock",
- groups: [
- "CSS Box Model"
- ],
- initial: "0",
- appliesto: "allElementsExceptInternalTableDisplayTypes",
- computed: "percentageAsSpecifiedOrAbsoluteLength",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter",
- "::first-line"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/padding-top"
- },
- "page-break-after": {
- syntax: "auto | always | avoid | left | right | recto | verso",
- media: [
- "visual",
- "paged"
- ],
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Pages"
- ],
- initial: "auto",
- appliesto: "blockElementsInNormalFlow",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/page-break-after"
- },
- "page-break-before": {
- syntax: "auto | always | avoid | left | right | recto | verso",
- media: [
- "visual",
- "paged"
- ],
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Pages"
- ],
- initial: "auto",
- appliesto: "blockElementsInNormalFlow",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/page-break-before"
- },
- "page-break-inside": {
- syntax: "auto | avoid",
- media: [
- "visual",
- "paged"
- ],
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Pages"
- ],
- initial: "auto",
- appliesto: "blockElementsInNormalFlow",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/page-break-inside"
- },
- "paint-order": {
- syntax: "normal | [ fill || stroke || markers ]",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Text"
- ],
- initial: "normal",
- appliesto: "textElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/paint-order"
- },
- perspective: perspective,
- "perspective-origin": {
- syntax: "<position>",
- media: "visual",
- inherited: false,
- animationType: "simpleListOfLpc",
- percentages: "referToSizeOfBoundingBox",
- groups: [
- "CSS Transforms"
- ],
- initial: "50% 50%",
- appliesto: "transformableElements",
- computed: "forLengthAbsoluteValueOtherwisePercentage",
- order: "oneOrTwoValuesLengthAbsoluteKeywordsPercentages",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/perspective-origin"
- },
- "place-content": {
- syntax: "<'align-content'> <'justify-content'>?",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Box Alignment"
- ],
- initial: "normal",
- appliesto: "multilineFlexContainers",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/place-content"
- },
- "place-items": {
- syntax: "<'align-items'> <'justify-items'>?",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Box Alignment"
- ],
- initial: [
- "align-items",
- "justify-items"
- ],
- appliesto: "allElements",
- computed: [
- "align-items",
- "justify-items"
- ],
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/place-items"
- },
- "place-self": {
- syntax: "<'align-self'> <'justify-self'>?",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Box Alignment"
- ],
- initial: [
- "align-self",
- "justify-self"
- ],
- appliesto: "blockLevelBoxesAndAbsolutelyPositionedBoxesAndGridItems",
- computed: [
- "align-self",
- "justify-self"
- ],
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/place-self"
- },
- "pointer-events": {
- syntax: "auto | none | visiblePainted | visibleFill | visibleStroke | visible | painted | fill | stroke | all | inherit",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Pointer Events"
- ],
- initial: "auto",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/pointer-events"
- },
- position: position$1,
- quotes: quotes,
- resize: resize,
- right: right,
- rotate: rotate,
- "row-gap": {
- syntax: "normal | <length-percentage>",
- media: "visual",
- inherited: false,
- animationType: "lpc",
- percentages: "referToDimensionOfContentArea",
- groups: [
- "CSS Box Alignment"
- ],
- initial: "normal",
- appliesto: "multiColumnElementsFlexContainersGridContainers",
- computed: "asSpecifiedWithLengthsAbsoluteAndNormalComputingToZeroExceptMultiColumn",
- order: "perGrammar",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/row-gap"
- },
- "ruby-align": {
- syntax: "start | center | space-between | space-around",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Ruby"
- ],
- initial: "space-around",
- appliesto: "rubyBasesAnnotationsBaseAnnotationContainers",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "experimental",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/ruby-align"
- },
- "ruby-merge": {
- syntax: "separate | collapse | auto",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Ruby"
- ],
- initial: "separate",
- appliesto: "rubyAnnotationsContainers",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "experimental"
- },
- "ruby-position": {
- syntax: "over | under | inter-character",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Ruby"
- ],
- initial: "over",
- appliesto: "rubyAnnotationsContainers",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "experimental",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/ruby-position"
- },
- scale: scale,
- "scrollbar-color": {
- syntax: "auto | dark | light | <color>{2}",
- media: "visual",
- inherited: true,
- animationType: "color",
- percentages: "no",
- groups: [
- "CSS Scrollbars"
- ],
- initial: "auto",
- appliesto: "scrollingBoxes",
- computed: "asSpecified",
- order: "perGrammar",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scrollbar-color"
- },
- "scrollbar-gutter": {
- syntax: "auto | [ stable | always ] && both? && force?",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Overflow"
- ],
- initial: "auto",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "perGrammar",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scrollbar-gutter"
- },
- "scrollbar-width": {
- syntax: "auto | thin | none",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Scrollbars"
- ],
- initial: "auto",
- appliesto: "scrollingBoxes",
- computed: "asSpecified",
- order: "perGrammar",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scrollbar-width"
- },
- "scroll-behavior": {
- syntax: "auto | smooth",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSSOM View"
- ],
- initial: "auto",
- appliesto: "scrollingBoxes",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-behavior"
- },
- "scroll-margin": {
- syntax: "<length>{1,4}",
- media: "visual",
- inherited: false,
- animationType: "byComputedValueType",
- percentages: "no",
- groups: [
- "CSS Scroll Snap"
- ],
- initial: "0",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "perGrammar",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-margin"
- },
- "scroll-margin-block": {
- syntax: "<length>{1,2}",
- media: "visual",
- inherited: false,
- animationType: "byComputedValueType",
- percentages: "no",
- groups: [
- "CSS Scroll Snap"
- ],
- initial: "0",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "perGrammar",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-margin-block"
- },
- "scroll-margin-block-start": {
- syntax: "<length>",
- media: "visual",
- inherited: false,
- animationType: "byComputedValueType",
- percentages: "no",
- groups: [
- "CSS Scroll Snap"
- ],
- initial: "0",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "perGrammar",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-margin-block-start"
- },
- "scroll-margin-block-end": {
- syntax: "<length>",
- media: "visual",
- inherited: false,
- animationType: "byComputedValueType",
- percentages: "no",
- groups: [
- "CSS Scroll Snap"
- ],
- initial: "0",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "perGrammar",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-margin-block-end"
- },
- "scroll-margin-bottom": {
- syntax: "<length>",
- media: "visual",
- inherited: false,
- animationType: "byComputedValueType",
- percentages: "no",
- groups: [
- "CSS Scroll Snap"
- ],
- initial: "0",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "perGrammar",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-margin-bottom"
- },
- "scroll-margin-inline": {
- syntax: "<length>{1,2}",
- media: "visual",
- inherited: false,
- animationType: "byComputedValueType",
- percentages: "no",
- groups: [
- "CSS Scroll Snap"
- ],
- initial: "0",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "perGrammar",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-margin-inline"
- },
- "scroll-margin-inline-start": {
- syntax: "<length>",
- media: "visual",
- inherited: false,
- animationType: "byComputedValueType",
- percentages: "no",
- groups: [
- "CSS Scroll Snap"
- ],
- initial: "0",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "perGrammar",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-margin-inline-start"
- },
- "scroll-margin-inline-end": {
- syntax: "<length>",
- media: "visual",
- inherited: false,
- animationType: "byComputedValueType",
- percentages: "no",
- groups: [
- "CSS Scroll Snap"
- ],
- initial: "0",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "perGrammar",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-margin-inline-end"
- },
- "scroll-margin-left": {
- syntax: "<length>",
- media: "visual",
- inherited: false,
- animationType: "byComputedValueType",
- percentages: "no",
- groups: [
- "CSS Scroll Snap"
- ],
- initial: "0",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "perGrammar",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-margin-left"
- },
- "scroll-margin-right": {
- syntax: "<length>",
- media: "visual",
- inherited: false,
- animationType: "byComputedValueType",
- percentages: "no",
- groups: [
- "CSS Scroll Snap"
- ],
- initial: "0",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "perGrammar",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-margin-right"
- },
- "scroll-margin-top": {
- syntax: "<length>",
- media: "visual",
- inherited: false,
- animationType: "byComputedValueType",
- percentages: "no",
- groups: [
- "CSS Scroll Snap"
- ],
- initial: "0",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "perGrammar",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-margin-top"
- },
- "scroll-padding": {
- syntax: "[ auto | <length-percentage> ]{1,4}",
- media: "visual",
- inherited: false,
- animationType: "byComputedValueType",
- percentages: "relativeToTheScrollContainersScrollport",
- groups: [
- "CSS Scroll Snap"
- ],
- initial: "auto",
- appliesto: "scrollContainers",
- computed: "asSpecified",
- order: "perGrammar",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-padding"
- },
- "scroll-padding-block": {
- syntax: "[ auto | <length-percentage> ]{1,2}",
- media: "visual",
- inherited: false,
- animationType: "byComputedValueType",
- percentages: "relativeToTheScrollContainersScrollport",
- groups: [
- "CSS Scroll Snap"
- ],
- initial: "auto",
- appliesto: "scrollContainers",
- computed: "asSpecified",
- order: "perGrammar",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-padding-block"
- },
- "scroll-padding-block-start": {
- syntax: "auto | <length-percentage>",
- media: "visual",
- inherited: false,
- animationType: "byComputedValueType",
- percentages: "relativeToTheScrollContainersScrollport",
- groups: [
- "CSS Scroll Snap"
- ],
- initial: "auto",
- appliesto: "scrollContainers",
- computed: "asSpecified",
- order: "perGrammar",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-padding-block-start"
- },
- "scroll-padding-block-end": {
- syntax: "auto | <length-percentage>",
- media: "visual",
- inherited: false,
- animationType: "byComputedValueType",
- percentages: "relativeToTheScrollContainersScrollport",
- groups: [
- "CSS Scroll Snap"
- ],
- initial: "auto",
- appliesto: "scrollContainers",
- computed: "asSpecified",
- order: "perGrammar",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-padding-block-end"
- },
- "scroll-padding-bottom": {
- syntax: "auto | <length-percentage>",
- media: "visual",
- inherited: false,
- animationType: "byComputedValueType",
- percentages: "relativeToTheScrollContainersScrollport",
- groups: [
- "CSS Scroll Snap"
- ],
- initial: "auto",
- appliesto: "scrollContainers",
- computed: "asSpecified",
- order: "perGrammar",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-padding-bottom"
- },
- "scroll-padding-inline": {
- syntax: "[ auto | <length-percentage> ]{1,2}",
- media: "visual",
- inherited: false,
- animationType: "byComputedValueType",
- percentages: "relativeToTheScrollContainersScrollport",
- groups: [
- "CSS Scroll Snap"
- ],
- initial: "auto",
- appliesto: "scrollContainers",
- computed: "asSpecified",
- order: "perGrammar",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-padding-inline"
- },
- "scroll-padding-inline-start": {
- syntax: "auto | <length-percentage>",
- media: "visual",
- inherited: false,
- animationType: "byComputedValueType",
- percentages: "relativeToTheScrollContainersScrollport",
- groups: [
- "CSS Scroll Snap"
- ],
- initial: "auto",
- appliesto: "scrollContainers",
- computed: "asSpecified",
- order: "perGrammar",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-padding-inline-start"
- },
- "scroll-padding-inline-end": {
- syntax: "auto | <length-percentage>",
- media: "visual",
- inherited: false,
- animationType: "byComputedValueType",
- percentages: "relativeToTheScrollContainersScrollport",
- groups: [
- "CSS Scroll Snap"
- ],
- initial: "auto",
- appliesto: "scrollContainers",
- computed: "asSpecified",
- order: "perGrammar",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-padding-inline-end"
- },
- "scroll-padding-left": {
- syntax: "auto | <length-percentage>",
- media: "visual",
- inherited: false,
- animationType: "byComputedValueType",
- percentages: "relativeToTheScrollContainersScrollport",
- groups: [
- "CSS Scroll Snap"
- ],
- initial: "auto",
- appliesto: "scrollContainers",
- computed: "asSpecified",
- order: "perGrammar",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-padding-left"
- },
- "scroll-padding-right": {
- syntax: "auto | <length-percentage>",
- media: "visual",
- inherited: false,
- animationType: "byComputedValueType",
- percentages: "relativeToTheScrollContainersScrollport",
- groups: [
- "CSS Scroll Snap"
- ],
- initial: "auto",
- appliesto: "scrollContainers",
- computed: "asSpecified",
- order: "perGrammar",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-padding-right"
- },
- "scroll-padding-top": {
- syntax: "auto | <length-percentage>",
- media: "visual",
- inherited: false,
- animationType: "byComputedValueType",
- percentages: "relativeToTheScrollContainersScrollport",
- groups: [
- "CSS Scroll Snap"
- ],
- initial: "auto",
- appliesto: "scrollContainers",
- computed: "asSpecified",
- order: "perGrammar",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-padding-top"
- },
- "scroll-snap-align": {
- syntax: "[ none | start | end | center ]{1,2}",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Scroll Snap"
- ],
- initial: "none",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "perGrammar",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-snap-align"
- },
- "scroll-snap-coordinate": {
- syntax: "none | <position>#",
- media: "interactive",
- inherited: false,
- animationType: "position",
- percentages: "referToBorderBox",
- groups: [
- "CSS Scroll Snap"
- ],
- initial: "none",
- appliesto: "allElements",
- computed: "asSpecifiedRelativeToAbsoluteLengths",
- order: "uniqueOrder",
- status: "obsolete",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-snap-coordinate"
- },
- "scroll-snap-destination": {
- syntax: "<position>",
- media: "interactive",
- inherited: false,
- animationType: "position",
- percentages: "relativeToScrollContainerPaddingBoxAxis",
- groups: [
- "CSS Scroll Snap"
- ],
- initial: "0px 0px",
- appliesto: "scrollContainers",
- computed: "asSpecifiedRelativeToAbsoluteLengths",
- order: "uniqueOrder",
- status: "obsolete",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-snap-destination"
- },
- "scroll-snap-points-x": {
- syntax: "none | repeat( <length-percentage> )",
- media: "interactive",
- inherited: false,
- animationType: "discrete",
- percentages: "relativeToScrollContainerPaddingBoxAxis",
- groups: [
- "CSS Scroll Snap"
- ],
- initial: "none",
- appliesto: "scrollContainers",
- computed: "asSpecifiedRelativeToAbsoluteLengths",
- order: "uniqueOrder",
- status: "obsolete",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-snap-points-x"
- },
- "scroll-snap-points-y": {
- syntax: "none | repeat( <length-percentage> )",
- media: "interactive",
- inherited: false,
- animationType: "discrete",
- percentages: "relativeToScrollContainerPaddingBoxAxis",
- groups: [
- "CSS Scroll Snap"
- ],
- initial: "none",
- appliesto: "scrollContainers",
- computed: "asSpecifiedRelativeToAbsoluteLengths",
- order: "uniqueOrder",
- status: "obsolete",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-snap-points-y"
- },
- "scroll-snap-stop": {
- syntax: "normal | always",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Scroll Snap"
- ],
- initial: "normal",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "perGrammar",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-snap-stop"
- },
- "scroll-snap-type": {
- syntax: "none | [ x | y | block | inline | both ] [ mandatory | proximity ]?",
- media: "interactive",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Scroll Snap"
- ],
- initial: "none",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-snap-type"
- },
- "scroll-snap-type-x": {
- syntax: "none | mandatory | proximity",
- media: "interactive",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Scroll Snap"
- ],
- initial: "none",
- appliesto: "scrollContainers",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "obsolete",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-snap-type-x"
- },
- "scroll-snap-type-y": {
- syntax: "none | mandatory | proximity",
- media: "interactive",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Scroll Snap"
- ],
- initial: "none",
- appliesto: "scrollContainers",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "obsolete",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/scroll-snap-type-y"
- },
- "shape-image-threshold": {
- syntax: "<alpha-value>",
- media: "visual",
- inherited: false,
- animationType: "number",
- percentages: "no",
- groups: [
- "CSS Shapes"
- ],
- initial: "0.0",
- appliesto: "floats",
- computed: "specifiedValueNumberClipped0To1",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/shape-image-threshold"
- },
- "shape-margin": {
- syntax: "<length-percentage>",
- media: "visual",
- inherited: false,
- animationType: "lpc",
- percentages: "referToWidthOfContainingBlock",
- groups: [
- "CSS Shapes"
- ],
- initial: "0",
- appliesto: "floats",
- computed: "asSpecifiedRelativeToAbsoluteLengths",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/shape-margin"
- },
- "shape-outside": {
- syntax: "none | <shape-box> || <basic-shape> | <image>",
- media: "visual",
- inherited: false,
- animationType: "basicShapeOtherwiseNo",
- percentages: "no",
- groups: [
- "CSS Shapes"
- ],
- initial: "none",
- appliesto: "floats",
- computed: "asDefinedForBasicShapeWithAbsoluteURIOtherwiseAsSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/shape-outside"
- },
- "tab-size": {
- syntax: "<integer> | <length>",
- media: "visual",
- inherited: true,
- animationType: "length",
- percentages: "no",
- groups: [
- "CSS Text"
- ],
- initial: "8",
- appliesto: "blockContainers",
- computed: "specifiedIntegerOrAbsoluteLength",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/tab-size"
- },
- "table-layout": {
- syntax: "auto | fixed",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Table"
- ],
- initial: "auto",
- appliesto: "tableElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/table-layout"
- },
- "text-align": {
- syntax: "start | end | left | right | center | justify | match-parent",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Text"
- ],
- initial: "startOrNamelessValueIfLTRRightIfRTL",
- appliesto: "blockContainers",
- computed: "asSpecifiedExceptMatchParent",
- order: "orderOfAppearance",
- alsoAppliesTo: [
- "::placeholder"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-align"
- },
- "text-align-last": {
- syntax: "auto | start | end | left | right | center | justify",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Text"
- ],
- initial: "auto",
- appliesto: "blockContainers",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-align-last"
- },
- "text-combine-upright": {
- syntax: "none | all | [ digits <integer>? ]",
- media: "visual",
- inherited: true,
- animationType: "notAnimatable",
- percentages: "no",
- groups: [
- "CSS Writing Modes"
- ],
- initial: "none",
- appliesto: "nonReplacedInlineElements",
- computed: "keywordPlusIntegerIfDigits",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-combine-upright"
- },
- "text-decoration": {
- syntax: "<'text-decoration-line'> || <'text-decoration-style'> || <'text-decoration-color'> || <'text-decoration-thickness'>",
- media: "visual",
- inherited: false,
- animationType: [
- "text-decoration-color",
- "text-decoration-style",
- "text-decoration-line",
- "text-decoration-thickness"
- ],
- percentages: "no",
- groups: [
- "CSS Text Decoration"
- ],
- initial: [
- "text-decoration-color",
- "text-decoration-style",
- "text-decoration-line"
- ],
- appliesto: "allElements",
- computed: [
- "text-decoration-line",
- "text-decoration-style",
- "text-decoration-color",
- "text-decoration-thickness"
- ],
- order: "orderOfAppearance",
- alsoAppliesTo: [
- "::first-letter",
- "::first-line",
- "::placeholder"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-decoration"
- },
- "text-decoration-color": {
- syntax: "<color>",
- media: "visual",
- inherited: false,
- animationType: "color",
- percentages: "no",
- groups: [
- "CSS Text Decoration"
- ],
- initial: "currentcolor",
- appliesto: "allElements",
- computed: "computedColor",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter",
- "::first-line",
- "::placeholder"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-decoration-color"
- },
- "text-decoration-line": {
- syntax: "none | [ underline || overline || line-through || blink ] | spelling-error | grammar-error",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Text Decoration"
- ],
- initial: "none",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "orderOfAppearance",
- alsoAppliesTo: [
- "::first-letter",
- "::first-line",
- "::placeholder"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-decoration-line"
- },
- "text-decoration-skip": {
- syntax: "none | [ objects || [ spaces | [ leading-spaces || trailing-spaces ] ] || edges || box-decoration ]",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Text Decoration"
- ],
- initial: "objects",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "orderOfAppearance",
- status: "experimental",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-decoration-skip"
- },
- "text-decoration-skip-ink": {
- syntax: "auto | all | none",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Text Decoration"
- ],
- initial: "auto",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "orderOfAppearance",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-decoration-skip-ink"
- },
- "text-decoration-style": {
- syntax: "solid | double | dotted | dashed | wavy",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Text Decoration"
- ],
- initial: "solid",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter",
- "::first-line",
- "::placeholder"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-decoration-style"
- },
- "text-decoration-thickness": {
- syntax: "auto | from-font | <length> | <percentage> ",
- media: "visual",
- inherited: false,
- animationType: "byComputedValueType",
- percentages: "referToElementFontSize",
- groups: [
- "CSS Text Decoration"
- ],
- initial: "auto",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter",
- "::first-line",
- "::placeholder"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-decoration-thickness"
- },
- "text-emphasis": {
- syntax: "<'text-emphasis-style'> || <'text-emphasis-color'>",
- media: "visual",
- inherited: false,
- animationType: [
- "text-emphasis-color",
- "text-emphasis-style"
- ],
- percentages: "no",
- groups: [
- "CSS Text Decoration"
- ],
- initial: [
- "text-emphasis-style",
- "text-emphasis-color"
- ],
- appliesto: "allElements",
- computed: [
- "text-emphasis-style",
- "text-emphasis-color"
- ],
- order: "orderOfAppearance",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-emphasis"
- },
- "text-emphasis-color": {
- syntax: "<color>",
- media: "visual",
- inherited: false,
- animationType: "color",
- percentages: "no",
- groups: [
- "CSS Text Decoration"
- ],
- initial: "currentcolor",
- appliesto: "allElements",
- computed: "computedColor",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-emphasis-color"
- },
- "text-emphasis-position": {
- syntax: "[ over | under ] && [ right | left ]",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Text Decoration"
- ],
- initial: "over right",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-emphasis-position"
- },
- "text-emphasis-style": {
- syntax: "none | [ [ filled | open ] || [ dot | circle | double-circle | triangle | sesame ] ] | <string>",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Text Decoration"
- ],
- initial: "none",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-emphasis-style"
- },
- "text-indent": {
- syntax: "<length-percentage> && hanging? && each-line?",
- media: "visual",
- inherited: true,
- animationType: "lpc",
- percentages: "referToWidthOfContainingBlock",
- groups: [
- "CSS Text"
- ],
- initial: "0",
- appliesto: "blockContainers",
- computed: "percentageOrAbsoluteLengthPlusKeywords",
- order: "lengthOrPercentageBeforeKeywords",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-indent"
- },
- "text-justify": {
- syntax: "auto | inter-character | inter-word | none",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Text"
- ],
- initial: "auto",
- appliesto: "inlineLevelAndTableCellElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-justify"
- },
- "text-orientation": {
- syntax: "mixed | upright | sideways",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Writing Modes"
- ],
- initial: "mixed",
- appliesto: "allElementsExceptTableRowGroupsRowsColumnGroupsAndColumns",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-orientation"
- },
- "text-overflow": {
- syntax: "[ clip | ellipsis | <string> ]{1,2}",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Basic User Interface"
- ],
- initial: "clip",
- appliesto: "blockContainerElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::placeholder"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-overflow"
- },
- "text-rendering": {
- syntax: "auto | optimizeSpeed | optimizeLegibility | geometricPrecision",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Miscellaneous"
- ],
- initial: "auto",
- appliesto: "textElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-rendering"
- },
- "text-shadow": {
- syntax: "none | <shadow-t>#",
- media: "visual",
- inherited: true,
- animationType: "shadowList",
- percentages: "no",
- groups: [
- "CSS Text Decoration"
- ],
- initial: "none",
- appliesto: "allElements",
- computed: "colorPlusThreeAbsoluteLengths",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter",
- "::first-line",
- "::placeholder"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-shadow"
- },
- "text-size-adjust": {
- syntax: "none | auto | <percentage>",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "referToSizeOfFont",
- groups: [
- "CSS Text"
- ],
- initial: "autoForSmartphoneBrowsersSupportingInflation",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "experimental",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-size-adjust"
- },
- "text-transform": {
- syntax: "none | capitalize | uppercase | lowercase | full-width | full-size-kana",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Text"
- ],
- initial: "none",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter",
- "::first-line",
- "::placeholder"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-transform"
- },
- "text-underline-offset": {
- syntax: "auto | <length> | <percentage> ",
- media: "visual",
- inherited: true,
- animationType: "byComputedValueType",
- percentages: "referToElementFontSize",
- groups: [
- "CSS Text Decoration"
- ],
- initial: "auto",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter",
- "::first-line",
- "::placeholder"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-underline-offset"
- },
- "text-underline-position": {
- syntax: "auto | from-font | [ under || [ left | right ] ]",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Text Decoration"
- ],
- initial: "auto",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "orderOfAppearance",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/text-underline-position"
- },
- top: top,
- "touch-action": {
- syntax: "auto | none | [ [ pan-x | pan-left | pan-right ] || [ pan-y | pan-up | pan-down ] || pinch-zoom ] | manipulation",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "Pointer Events"
- ],
- initial: "auto",
- appliesto: "allElementsExceptNonReplacedInlineElementsTableRowsColumnsRowColumnGroups",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/touch-action"
- },
- transform: transform,
- "transform-box": {
- syntax: "content-box | border-box | fill-box | stroke-box | view-box",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Transforms"
- ],
- initial: "view-box",
- appliesto: "transformableElements",
- computed: "asSpecified",
- order: "perGrammar",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/transform-box"
- },
- "transform-origin": {
- syntax: "[ <length-percentage> | left | center | right | top | bottom ] | [ [ <length-percentage> | left | center | right ] && [ <length-percentage> | top | center | bottom ] ] <length>?",
- media: "visual",
- inherited: false,
- animationType: "simpleListOfLpc",
- percentages: "referToSizeOfBoundingBox",
- groups: [
- "CSS Transforms"
- ],
- initial: "50% 50% 0",
- appliesto: "transformableElements",
- computed: "forLengthAbsoluteValueOtherwisePercentage",
- order: "oneOrTwoValuesLengthAbsoluteKeywordsPercentages",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/transform-origin"
- },
- "transform-style": {
- syntax: "flat | preserve-3d",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Transforms"
- ],
- initial: "flat",
- appliesto: "transformableElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- stacking: true,
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/transform-style"
- },
- transition: transition,
- "transition-delay": {
- syntax: "<time>#",
- media: "interactive",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Transitions"
- ],
- initial: "0s",
- appliesto: "allElementsAndPseudos",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/transition-delay"
- },
- "transition-duration": {
- syntax: "<time>#",
- media: "interactive",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Transitions"
- ],
- initial: "0s",
- appliesto: "allElementsAndPseudos",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/transition-duration"
- },
- "transition-property": {
- syntax: "none | <single-transition-property>#",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Transitions"
- ],
- initial: "all",
- appliesto: "allElementsAndPseudos",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/transition-property"
- },
- "transition-timing-function": {
- syntax: "<timing-function>#",
- media: "interactive",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Transitions"
- ],
- initial: "ease",
- appliesto: "allElementsAndPseudos",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/transition-timing-function"
- },
- translate: translate,
- "unicode-bidi": {
- syntax: "normal | embed | isolate | bidi-override | isolate-override | plaintext",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Writing Modes"
- ],
- initial: "normal",
- appliesto: "allElementsSomeValuesNoEffectOnNonInlineElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/unicode-bidi"
- },
- "user-select": {
- syntax: "auto | text | none | contain | all",
- media: "visual",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Basic User Interface"
- ],
- initial: "auto",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "nonstandard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/user-select"
- },
- "vertical-align": {
- syntax: "baseline | sub | super | text-top | text-bottom | middle | top | bottom | <percentage> | <length>",
- media: "visual",
- inherited: false,
- animationType: "length",
- percentages: "referToLineHeight",
- groups: [
- "CSS Table"
- ],
- initial: "baseline",
- appliesto: "inlineLevelAndTableCellElements",
- computed: "absoluteLengthOrKeyword",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter",
- "::first-line",
- "::placeholder"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/vertical-align"
- },
- visibility: visibility,
- "white-space": {
- syntax: "normal | pre | nowrap | pre-wrap | pre-line | break-spaces",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Text"
- ],
- initial: "normal",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/white-space"
- },
- widows: widows,
- width: width,
- "will-change": {
- syntax: "auto | <animateable-feature>#",
- media: "all",
- inherited: false,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Will Change"
- ],
- initial: "auto",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/will-change"
- },
- "word-break": {
- syntax: "normal | break-all | keep-all | break-word",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Text"
- ],
- initial: "normal",
- appliesto: "allElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/word-break"
- },
- "word-spacing": {
- syntax: "normal | <length-percentage>",
- media: "visual",
- inherited: true,
- animationType: "length",
- percentages: "referToWidthOfAffectedGlyph",
- groups: [
- "CSS Text"
- ],
- initial: "normal",
- appliesto: "allElements",
- computed: "optimumMinAndMaxValueOfAbsoluteLengthPercentageOrNormal",
- order: "uniqueOrder",
- alsoAppliesTo: [
- "::first-letter",
- "::first-line",
- "::placeholder"
- ],
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/word-spacing"
- },
- "word-wrap": {
- syntax: "normal | break-word",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Text"
- ],
- initial: "normal",
- appliesto: "nonReplacedInlineElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/overflow-wrap"
- },
- "writing-mode": {
- syntax: "horizontal-tb | vertical-rl | vertical-lr | sideways-rl | sideways-lr",
- media: "visual",
- inherited: true,
- animationType: "discrete",
- percentages: "no",
- groups: [
- "CSS Writing Modes"
- ],
- initial: "horizontal-tb",
- appliesto: "allElementsExceptTableRowColumnGroupsTableRowsColumns",
- computed: "asSpecified",
- order: "uniqueOrder",
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/writing-mode"
- },
- "z-index": {
- syntax: "auto | <integer>",
- media: "visual",
- inherited: false,
- animationType: "integer",
- percentages: "no",
- groups: [
- "CSS Positioning"
- ],
- initial: "auto",
- appliesto: "positionedElements",
- computed: "asSpecified",
- order: "uniqueOrder",
- stacking: true,
- status: "standard",
- mdn_url: "https://developer.mozilla.org/docs/Web/CSS/z-index"
- },
- zoom: zoom
- };
- var attachment = {
- syntax: "scroll | fixed | local"
- };
- var box = {
- syntax: "border-box | padding-box | content-box"
- };
- var color = {
- syntax: "<rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>"
- };
- var combinator = {
- syntax: "'>' | '+' | '~' | [ '||' ]"
- };
- var gradient = {
- syntax: "<linear-gradient()> | <repeating-linear-gradient()> | <radial-gradient()> | <repeating-radial-gradient()> | <conic-gradient()>"
- };
- var hue = {
- syntax: "<number> | <angle>"
- };
- var image = {
- syntax: "<url> | <image()> | <image-set()> | <element()> | <paint()> | <cross-fade()> | <gradient>"
- };
- var nth$1 = {
- syntax: "<an-plus-b> | even | odd"
- };
- var position = {
- syntax: "[ [ left | center | right ] || [ top | center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? | [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ]"
- };
- var quote = {
- syntax: "open-quote | close-quote | no-open-quote | no-close-quote"
- };
- var shadow = {
- syntax: "inset? && <length>{2,4} && <color>?"
- };
- var shape = {
- syntax: "rect(<top>, <right>, <bottom>, <left>)"
- };
- var size = {
- syntax: "closest-side | farthest-side | closest-corner | farthest-corner | <length> | <length-percentage>{2}"
- };
- var symbol = {
- syntax: "<string> | <image> | <custom-ident>"
- };
- var target = {
- syntax: "<target-counter()> | <target-counters()> | <target-text()>"
- };
- var require$$2 = {
- "absolute-size": {
- syntax: "xx-small | x-small | small | medium | large | x-large | xx-large | xxx-large"
- },
- "alpha-value": {
- syntax: "<number> | <percentage>"
- },
- "angle-percentage": {
- syntax: "<angle> | <percentage>"
- },
- "angular-color-hint": {
- syntax: "<angle-percentage>"
- },
- "angular-color-stop": {
- syntax: "<color> && <color-stop-angle>?"
- },
- "angular-color-stop-list": {
- syntax: "[ <angular-color-stop> [, <angular-color-hint>]? ]# , <angular-color-stop>"
- },
- "animateable-feature": {
- syntax: "scroll-position | contents | <custom-ident>"
- },
- attachment: attachment,
- "attr()": {
- syntax: "attr( <attr-name> <type-or-unit>? [, <attr-fallback> ]? )"
- },
- "attr-matcher": {
- syntax: "[ '~' | '|' | '^' | '$' | '*' ]? '='"
- },
- "attr-modifier": {
- syntax: "i | s"
- },
- "attribute-selector": {
- syntax: "'[' <wq-name> ']' | '[' <wq-name> <attr-matcher> [ <string-token> | <ident-token> ] <attr-modifier>? ']'"
- },
- "auto-repeat": {
- syntax: "repeat( [ auto-fill | auto-fit ] , [ <line-names>? <fixed-size> ]+ <line-names>? )"
- },
- "auto-track-list": {
- syntax: "[ <line-names>? [ <fixed-size> | <fixed-repeat> ] ]* <line-names>? <auto-repeat>\n[ <line-names>? [ <fixed-size> | <fixed-repeat> ] ]* <line-names>?"
- },
- "baseline-position": {
- syntax: "[ first | last ]? baseline"
- },
- "basic-shape": {
- syntax: "<inset()> | <circle()> | <ellipse()> | <polygon()> | <path()>"
- },
- "bg-image": {
- syntax: "none | <image>"
- },
- "bg-layer": {
- syntax: "<bg-image> || <bg-position> [ / <bg-size> ]? || <repeat-style> || <attachment> || <box> || <box>"
- },
- "bg-position": {
- syntax: "[ [ left | center | right | top | bottom | <length-percentage> ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ] | [ center | [ left | right ] <length-percentage>? ] && [ center | [ top | bottom ] <length-percentage>? ] ]"
- },
- "bg-size": {
- syntax: "[ <length-percentage> | auto ]{1,2} | cover | contain"
- },
- "blur()": {
- syntax: "blur( <length> )"
- },
- "blend-mode": {
- syntax: "normal | multiply | screen | overlay | darken | lighten | color-dodge | color-burn | hard-light | soft-light | difference | exclusion | hue | saturation | color | luminosity"
- },
- box: box,
- "brightness()": {
- syntax: "brightness( <number-percentage> )"
- },
- "calc()": {
- syntax: "calc( <calc-sum> )"
- },
- "calc-sum": {
- syntax: "<calc-product> [ [ '+' | '-' ] <calc-product> ]*"
- },
- "calc-product": {
- syntax: "<calc-value> [ '*' <calc-value> | '/' <number> ]*"
- },
- "calc-value": {
- syntax: "<number> | <dimension> | <percentage> | ( <calc-sum> )"
- },
- "cf-final-image": {
- syntax: "<image> | <color>"
- },
- "cf-mixing-image": {
- syntax: "<percentage>? && <image>"
- },
- "circle()": {
- syntax: "circle( [ <shape-radius> ]? [ at <position> ]? )"
- },
- "clamp()": {
- syntax: "clamp( <calc-sum>#{3} )"
- },
- "class-selector": {
- syntax: "'.' <ident-token>"
- },
- "clip-source": {
- syntax: "<url>"
- },
- color: color,
- "color-stop": {
- syntax: "<color-stop-length> | <color-stop-angle>"
- },
- "color-stop-angle": {
- syntax: "<angle-percentage>{1,2}"
- },
- "color-stop-length": {
- syntax: "<length-percentage>{1,2}"
- },
- "color-stop-list": {
- syntax: "[ <linear-color-stop> [, <linear-color-hint>]? ]# , <linear-color-stop>"
- },
- combinator: combinator,
- "common-lig-values": {
- syntax: "[ common-ligatures | no-common-ligatures ]"
- },
- "compat-auto": {
- syntax: "searchfield | textarea | push-button | slider-horizontal | checkbox | radio | square-button | menulist | listbox | meter | progress-bar | button"
- },
- "composite-style": {
- syntax: "clear | copy | source-over | source-in | source-out | source-atop | destination-over | destination-in | destination-out | destination-atop | xor"
- },
- "compositing-operator": {
- syntax: "add | subtract | intersect | exclude"
- },
- "compound-selector": {
- syntax: "[ <type-selector>? <subclass-selector>* [ <pseudo-element-selector> <pseudo-class-selector>* ]* ]!"
- },
- "compound-selector-list": {
- syntax: "<compound-selector>#"
- },
- "complex-selector": {
- syntax: "<compound-selector> [ <combinator>? <compound-selector> ]*"
- },
- "complex-selector-list": {
- syntax: "<complex-selector>#"
- },
- "conic-gradient()": {
- syntax: "conic-gradient( [ from <angle> ]? [ at <position> ]?, <angular-color-stop-list> )"
- },
- "contextual-alt-values": {
- syntax: "[ contextual | no-contextual ]"
- },
- "content-distribution": {
- syntax: "space-between | space-around | space-evenly | stretch"
- },
- "content-list": {
- syntax: "[ <string> | contents | <image> | <quote> | <target> | <leader()> ]+"
- },
- "content-position": {
- syntax: "center | start | end | flex-start | flex-end"
- },
- "content-replacement": {
- syntax: "<image>"
- },
- "contrast()": {
- syntax: "contrast( [ <number-percentage> ] )"
- },
- "counter()": {
- syntax: "counter( <custom-ident>, <counter-style>? )"
- },
- "counter-style": {
- syntax: "<counter-style-name> | symbols()"
- },
- "counter-style-name": {
- syntax: "<custom-ident>"
- },
- "counters()": {
- syntax: "counters( <custom-ident>, <string>, <counter-style>? )"
- },
- "cross-fade()": {
- syntax: "cross-fade( <cf-mixing-image> , <cf-final-image>? )"
- },
- "cubic-bezier-timing-function": {
- syntax: "ease | ease-in | ease-out | ease-in-out | cubic-bezier(<number [0,1]>, <number>, <number [0,1]>, <number>)"
- },
- "deprecated-system-color": {
- syntax: "ActiveBorder | ActiveCaption | AppWorkspace | Background | ButtonFace | ButtonHighlight | ButtonShadow | ButtonText | CaptionText | GrayText | Highlight | HighlightText | InactiveBorder | InactiveCaption | InactiveCaptionText | InfoBackground | InfoText | Menu | MenuText | Scrollbar | ThreeDDarkShadow | ThreeDFace | ThreeDHighlight | ThreeDLightShadow | ThreeDShadow | Window | WindowFrame | WindowText"
- },
- "discretionary-lig-values": {
- syntax: "[ discretionary-ligatures | no-discretionary-ligatures ]"
- },
- "display-box": {
- syntax: "contents | none"
- },
- "display-inside": {
- syntax: "flow | flow-root | table | flex | grid | ruby"
- },
- "display-internal": {
- syntax: "table-row-group | table-header-group | table-footer-group | table-row | table-cell | table-column-group | table-column | table-caption | ruby-base | ruby-text | ruby-base-container | ruby-text-container"
- },
- "display-legacy": {
- syntax: "inline-block | inline-list-item | inline-table | inline-flex | inline-grid"
- },
- "display-listitem": {
- syntax: "<display-outside>? && [ flow | flow-root ]? && list-item"
- },
- "display-outside": {
- syntax: "block | inline | run-in"
- },
- "drop-shadow()": {
- syntax: "drop-shadow( <length>{2,3} <color>? )"
- },
- "east-asian-variant-values": {
- syntax: "[ jis78 | jis83 | jis90 | jis04 | simplified | traditional ]"
- },
- "east-asian-width-values": {
- syntax: "[ full-width | proportional-width ]"
- },
- "element()": {
- syntax: "element( <id-selector> )"
- },
- "ellipse()": {
- syntax: "ellipse( [ <shape-radius>{2} ]? [ at <position> ]? )"
- },
- "ending-shape": {
- syntax: "circle | ellipse"
- },
- "env()": {
- syntax: "env( <custom-ident> , <declaration-value>? )"
- },
- "explicit-track-list": {
- syntax: "[ <line-names>? <track-size> ]+ <line-names>?"
- },
- "family-name": {
- syntax: "<string> | <custom-ident>+"
- },
- "feature-tag-value": {
- syntax: "<string> [ <integer> | on | off ]?"
- },
- "feature-type": {
- syntax: "@stylistic | @historical-forms | @styleset | @character-variant | @swash | @ornaments | @annotation"
- },
- "feature-value-block": {
- syntax: "<feature-type> '{' <feature-value-declaration-list> '}'"
- },
- "feature-value-block-list": {
- syntax: "<feature-value-block>+"
- },
- "feature-value-declaration": {
- syntax: "<custom-ident>: <integer>+;"
- },
- "feature-value-declaration-list": {
- syntax: "<feature-value-declaration>"
- },
- "feature-value-name": {
- syntax: "<custom-ident>"
- },
- "fill-rule": {
- syntax: "nonzero | evenodd"
- },
- "filter-function": {
- syntax: "<blur()> | <brightness()> | <contrast()> | <drop-shadow()> | <grayscale()> | <hue-rotate()> | <invert()> | <opacity()> | <saturate()> | <sepia()>"
- },
- "filter-function-list": {
- syntax: "[ <filter-function> | <url> ]+"
- },
- "final-bg-layer": {
- syntax: "<'background-color'> || <bg-image> || <bg-position> [ / <bg-size> ]? || <repeat-style> || <attachment> || <box> || <box>"
- },
- "fit-content()": {
- syntax: "fit-content( [ <length> | <percentage> ] )"
- },
- "fixed-breadth": {
- syntax: "<length-percentage>"
- },
- "fixed-repeat": {
- syntax: "repeat( [ <positive-integer> ] , [ <line-names>? <fixed-size> ]+ <line-names>? )"
- },
- "fixed-size": {
- syntax: "<fixed-breadth> | minmax( <fixed-breadth> , <track-breadth> ) | minmax( <inflexible-breadth> , <fixed-breadth> )"
- },
- "font-stretch-absolute": {
- syntax: "normal | ultra-condensed | extra-condensed | condensed | semi-condensed | semi-expanded | expanded | extra-expanded | ultra-expanded | <percentage>"
- },
- "font-variant-css21": {
- syntax: "[ normal | small-caps ]"
- },
- "font-weight-absolute": {
- syntax: "normal | bold | <number [1,1000]>"
- },
- "frequency-percentage": {
- syntax: "<frequency> | <percentage>"
- },
- "general-enclosed": {
- syntax: "[ <function-token> <any-value> ) ] | ( <ident> <any-value> )"
- },
- "generic-family": {
- syntax: "serif | sans-serif | cursive | fantasy | monospace"
- },
- "generic-name": {
- syntax: "serif | sans-serif | cursive | fantasy | monospace"
- },
- "geometry-box": {
- syntax: "<shape-box> | fill-box | stroke-box | view-box"
- },
- gradient: gradient,
- "grayscale()": {
- syntax: "grayscale( <number-percentage> )"
- },
- "grid-line": {
- syntax: "auto | <custom-ident> | [ <integer> && <custom-ident>? ] | [ span && [ <integer> || <custom-ident> ] ]"
- },
- "historical-lig-values": {
- syntax: "[ historical-ligatures | no-historical-ligatures ]"
- },
- "hsl()": {
- syntax: "hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )"
- },
- "hsla()": {
- syntax: "hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )"
- },
- hue: hue,
- "hue-rotate()": {
- syntax: "hue-rotate( <angle> )"
- },
- "id-selector": {
- syntax: "<hash-token>"
- },
- image: image,
- "image()": {
- syntax: "image( <image-tags>? [ <image-src>? , <color>? ]! )"
- },
- "image-set()": {
- syntax: "image-set( <image-set-option># )"
- },
- "image-set-option": {
- syntax: "[ <image> | <string> ] <resolution>"
- },
- "image-src": {
- syntax: "<url> | <string>"
- },
- "image-tags": {
- syntax: "ltr | rtl"
- },
- "inflexible-breadth": {
- syntax: "<length> | <percentage> | min-content | max-content | auto"
- },
- "inset()": {
- syntax: "inset( <length-percentage>{1,4} [ round <'border-radius'> ]? )"
- },
- "invert()": {
- syntax: "invert( <number-percentage> )"
- },
- "keyframes-name": {
- syntax: "<custom-ident> | <string>"
- },
- "keyframe-block": {
- syntax: "<keyframe-selector># {\n <declaration-list>\n}"
- },
- "keyframe-block-list": {
- syntax: "<keyframe-block>+"
- },
- "keyframe-selector": {
- syntax: "from | to | <percentage>"
- },
- "leader()": {
- syntax: "leader( <leader-type> )"
- },
- "leader-type": {
- syntax: "dotted | solid | space | <string>"
- },
- "length-percentage": {
- syntax: "<length> | <percentage>"
- },
- "line-names": {
- syntax: "'[' <custom-ident>* ']'"
- },
- "line-name-list": {
- syntax: "[ <line-names> | <name-repeat> ]+"
- },
- "line-style": {
- syntax: "none | hidden | dotted | dashed | solid | double | groove | ridge | inset | outset"
- },
- "line-width": {
- syntax: "<length> | thin | medium | thick"
- },
- "linear-color-hint": {
- syntax: "<length-percentage>"
- },
- "linear-color-stop": {
- syntax: "<color> <color-stop-length>?"
- },
- "linear-gradient()": {
- syntax: "linear-gradient( [ <angle> | to <side-or-corner> ]? , <color-stop-list> )"
- },
- "mask-layer": {
- syntax: "<mask-reference> || <position> [ / <bg-size> ]? || <repeat-style> || <geometry-box> || [ <geometry-box> | no-clip ] || <compositing-operator> || <masking-mode>"
- },
- "mask-position": {
- syntax: "[ <length-percentage> | left | center | right ] [ <length-percentage> | top | center | bottom ]?"
- },
- "mask-reference": {
- syntax: "none | <image> | <mask-source>"
- },
- "mask-source": {
- syntax: "<url>"
- },
- "masking-mode": {
- syntax: "alpha | luminance | match-source"
- },
- "matrix()": {
- syntax: "matrix( <number>#{6} )"
- },
- "matrix3d()": {
- syntax: "matrix3d( <number>#{16} )"
- },
- "max()": {
- syntax: "max( <calc-sum># )"
- },
- "media-and": {
- syntax: "<media-in-parens> [ and <media-in-parens> ]+"
- },
- "media-condition": {
- syntax: "<media-not> | <media-and> | <media-or> | <media-in-parens>"
- },
- "media-condition-without-or": {
- syntax: "<media-not> | <media-and> | <media-in-parens>"
- },
- "media-feature": {
- syntax: "( [ <mf-plain> | <mf-boolean> | <mf-range> ] )"
- },
- "media-in-parens": {
- syntax: "( <media-condition> ) | <media-feature> | <general-enclosed>"
- },
- "media-not": {
- syntax: "not <media-in-parens>"
- },
- "media-or": {
- syntax: "<media-in-parens> [ or <media-in-parens> ]+"
- },
- "media-query": {
- syntax: "<media-condition> | [ not | only ]? <media-type> [ and <media-condition-without-or> ]?"
- },
- "media-query-list": {
- syntax: "<media-query>#"
- },
- "media-type": {
- syntax: "<ident>"
- },
- "mf-boolean": {
- syntax: "<mf-name>"
- },
- "mf-name": {
- syntax: "<ident>"
- },
- "mf-plain": {
- syntax: "<mf-name> : <mf-value>"
- },
- "mf-range": {
- syntax: "<mf-name> [ '<' | '>' ]? '='? <mf-value>\n| <mf-value> [ '<' | '>' ]? '='? <mf-name>\n| <mf-value> '<' '='? <mf-name> '<' '='? <mf-value>\n| <mf-value> '>' '='? <mf-name> '>' '='? <mf-value>"
- },
- "mf-value": {
- syntax: "<number> | <dimension> | <ident> | <ratio>"
- },
- "min()": {
- syntax: "min( <calc-sum># )"
- },
- "minmax()": {
- syntax: "minmax( [ <length> | <percentage> | min-content | max-content | auto ] , [ <length> | <percentage> | <flex> | min-content | max-content | auto ] )"
- },
- "named-color": {
- syntax: "transparent | aliceblue | antiquewhite | aqua | aquamarine | azure | beige | bisque | black | blanchedalmond | blue | blueviolet | brown | burlywood | cadetblue | chartreuse | chocolate | coral | cornflowerblue | cornsilk | crimson | cyan | darkblue | darkcyan | darkgoldenrod | darkgray | darkgreen | darkgrey | darkkhaki | darkmagenta | darkolivegreen | darkorange | darkorchid | darkred | darksalmon | darkseagreen | darkslateblue | darkslategray | darkslategrey | darkturquoise | darkviolet | deeppink | deepskyblue | dimgray | dimgrey | dodgerblue | firebrick | floralwhite | forestgreen | fuchsia | gainsboro | ghostwhite | gold | goldenrod | gray | green | greenyellow | grey | honeydew | hotpink | indianred | indigo | ivory | khaki | lavender | lavenderblush | lawngreen | lemonchiffon | lightblue | lightcoral | lightcyan | lightgoldenrodyellow | lightgray | lightgreen | lightgrey | lightpink | lightsalmon | lightseagreen | lightskyblue | lightslategray | lightslategrey | lightsteelblue | lightyellow | lime | limegreen | linen | magenta | maroon | mediumaquamarine | mediumblue | mediumorchid | mediumpurple | mediumseagreen | mediumslateblue | mediumspringgreen | mediumturquoise | mediumvioletred | midnightblue | mintcream | mistyrose | moccasin | navajowhite | navy | oldlace | olive | olivedrab | orange | orangered | orchid | palegoldenrod | palegreen | paleturquoise | palevioletred | papayawhip | peachpuff | peru | pink | plum | powderblue | purple | rebeccapurple | red | rosybrown | royalblue | saddlebrown | salmon | sandybrown | seagreen | seashell | sienna | silver | skyblue | slateblue | slategray | slategrey | snow | springgreen | steelblue | tan | teal | thistle | tomato | turquoise | violet | wheat | white | whitesmoke | yellow | yellowgreen"
- },
- "namespace-prefix": {
- syntax: "<ident>"
- },
- "ns-prefix": {
- syntax: "[ <ident-token> | '*' ]? '|'"
- },
- "number-percentage": {
- syntax: "<number> | <percentage>"
- },
- "numeric-figure-values": {
- syntax: "[ lining-nums | oldstyle-nums ]"
- },
- "numeric-fraction-values": {
- syntax: "[ diagonal-fractions | stacked-fractions ]"
- },
- "numeric-spacing-values": {
- syntax: "[ proportional-nums | tabular-nums ]"
- },
- nth: nth$1,
- "opacity()": {
- syntax: "opacity( [ <number-percentage> ] )"
- },
- "overflow-position": {
- syntax: "unsafe | safe"
- },
- "outline-radius": {
- syntax: "<length> | <percentage>"
- },
- "page-body": {
- syntax: "<declaration>? [ ; <page-body> ]? | <page-margin-box> <page-body>"
- },
- "page-margin-box": {
- syntax: "<page-margin-box-type> '{' <declaration-list> '}'"
- },
- "page-margin-box-type": {
- syntax: "@top-left-corner | @top-left | @top-center | @top-right | @top-right-corner | @bottom-left-corner | @bottom-left | @bottom-center | @bottom-right | @bottom-right-corner | @left-top | @left-middle | @left-bottom | @right-top | @right-middle | @right-bottom"
- },
- "page-selector-list": {
- syntax: "[ <page-selector># ]?"
- },
- "page-selector": {
- syntax: "<pseudo-page>+ | <ident> <pseudo-page>*"
- },
- "path()": {
- syntax: "path( [ <fill-rule>, ]? <string> )"
- },
- "paint()": {
- syntax: "paint( <ident>, <declaration-value>? )"
- },
- "perspective()": {
- syntax: "perspective( <length> )"
- },
- "polygon()": {
- syntax: "polygon( <fill-rule>? , [ <length-percentage> <length-percentage> ]# )"
- },
- position: position,
- "pseudo-class-selector": {
- syntax: "':' <ident-token> | ':' <function-token> <any-value> ')'"
- },
- "pseudo-element-selector": {
- syntax: "':' <pseudo-class-selector>"
- },
- "pseudo-page": {
- syntax: ": [ left | right | first | blank ]"
- },
- quote: quote,
- "radial-gradient()": {
- syntax: "radial-gradient( [ <ending-shape> || <size> ]? [ at <position> ]? , <color-stop-list> )"
- },
- "relative-selector": {
- syntax: "<combinator>? <complex-selector>"
- },
- "relative-selector-list": {
- syntax: "<relative-selector>#"
- },
- "relative-size": {
- syntax: "larger | smaller"
- },
- "repeat-style": {
- syntax: "repeat-x | repeat-y | [ repeat | space | round | no-repeat ]{1,2}"
- },
- "repeating-linear-gradient()": {
- syntax: "repeating-linear-gradient( [ <angle> | to <side-or-corner> ]? , <color-stop-list> )"
- },
- "repeating-radial-gradient()": {
- syntax: "repeating-radial-gradient( [ <ending-shape> || <size> ]? [ at <position> ]? , <color-stop-list> )"
- },
- "rgb()": {
- syntax: "rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <number>#{3} , <alpha-value>? )"
- },
- "rgba()": {
- syntax: "rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <number>#{3} , <alpha-value>? )"
- },
- "rotate()": {
- syntax: "rotate( [ <angle> | <zero> ] )"
- },
- "rotate3d()": {
- syntax: "rotate3d( <number> , <number> , <number> , [ <angle> | <zero> ] )"
- },
- "rotateX()": {
- syntax: "rotateX( [ <angle> | <zero> ] )"
- },
- "rotateY()": {
- syntax: "rotateY( [ <angle> | <zero> ] )"
- },
- "rotateZ()": {
- syntax: "rotateZ( [ <angle> | <zero> ] )"
- },
- "saturate()": {
- syntax: "saturate( <number-percentage> )"
- },
- "scale()": {
- syntax: "scale( <number> , <number>? )"
- },
- "scale3d()": {
- syntax: "scale3d( <number> , <number> , <number> )"
- },
- "scaleX()": {
- syntax: "scaleX( <number> )"
- },
- "scaleY()": {
- syntax: "scaleY( <number> )"
- },
- "scaleZ()": {
- syntax: "scaleZ( <number> )"
- },
- "self-position": {
- syntax: "center | start | end | self-start | self-end | flex-start | flex-end"
- },
- "shape-radius": {
- syntax: "<length-percentage> | closest-side | farthest-side"
- },
- "skew()": {
- syntax: "skew( [ <angle> | <zero> ] , [ <angle> | <zero> ]? )"
- },
- "skewX()": {
- syntax: "skewX( [ <angle> | <zero> ] )"
- },
- "skewY()": {
- syntax: "skewY( [ <angle> | <zero> ] )"
- },
- "sepia()": {
- syntax: "sepia( <number-percentage> )"
- },
- shadow: shadow,
- "shadow-t": {
- syntax: "[ <length>{2,3} && <color>? ]"
- },
- shape: shape,
- "shape-box": {
- syntax: "<box> | margin-box"
- },
- "side-or-corner": {
- syntax: "[ left | right ] || [ top | bottom ]"
- },
- "single-animation": {
- syntax: "<time> || <timing-function> || <time> || <single-animation-iteration-count> || <single-animation-direction> || <single-animation-fill-mode> || <single-animation-play-state> || [ none | <keyframes-name> ]"
- },
- "single-animation-direction": {
- syntax: "normal | reverse | alternate | alternate-reverse"
- },
- "single-animation-fill-mode": {
- syntax: "none | forwards | backwards | both"
- },
- "single-animation-iteration-count": {
- syntax: "infinite | <number>"
- },
- "single-animation-play-state": {
- syntax: "running | paused"
- },
- "single-transition": {
- syntax: "[ none | <single-transition-property> ] || <time> || <timing-function> || <time>"
- },
- "single-transition-property": {
- syntax: "all | <custom-ident>"
- },
- size: size,
- "step-position": {
- syntax: "jump-start | jump-end | jump-none | jump-both | start | end"
- },
- "step-timing-function": {
- syntax: "step-start | step-end | steps(<integer>[, <step-position>]?)"
- },
- "subclass-selector": {
- syntax: "<id-selector> | <class-selector> | <attribute-selector> | <pseudo-class-selector>"
- },
- "supports-condition": {
- syntax: "not <supports-in-parens> | <supports-in-parens> [ and <supports-in-parens> ]* | <supports-in-parens> [ or <supports-in-parens> ]*"
- },
- "supports-in-parens": {
- syntax: "( <supports-condition> ) | <supports-feature> | <general-enclosed>"
- },
- "supports-feature": {
- syntax: "<supports-decl> | <supports-selector-fn>"
- },
- "supports-decl": {
- syntax: "( <declaration> )"
- },
- "supports-selector-fn": {
- syntax: "selector( <complex-selector> )"
- },
- symbol: symbol,
- target: target,
- "target-counter()": {
- syntax: "target-counter( [ <string> | <url> ] , <custom-ident> , <counter-style>? )"
- },
- "target-counters()": {
- syntax: "target-counters( [ <string> | <url> ] , <custom-ident> , <string> , <counter-style>? )"
- },
- "target-text()": {
- syntax: "target-text( [ <string> | <url> ] , [ content | before | after | first-letter ]? )"
- },
- "time-percentage": {
- syntax: "<time> | <percentage>"
- },
- "timing-function": {
- syntax: "linear | <cubic-bezier-timing-function> | <step-timing-function>"
- },
- "track-breadth": {
- syntax: "<length-percentage> | <flex> | min-content | max-content | auto"
- },
- "track-list": {
- syntax: "[ <line-names>? [ <track-size> | <track-repeat> ] ]+ <line-names>?"
- },
- "track-repeat": {
- syntax: "repeat( [ <positive-integer> ] , [ <line-names>? <track-size> ]+ <line-names>? )"
- },
- "track-size": {
- syntax: "<track-breadth> | minmax( <inflexible-breadth> , <track-breadth> ) | fit-content( [ <length> | <percentage> ] )"
- },
- "transform-function": {
- syntax: "<matrix()> | <translate()> | <translateX()> | <translateY()> | <scale()> | <scaleX()> | <scaleY()> | <rotate()> | <skew()> | <skewX()> | <skewY()> | <matrix3d()> | <translate3d()> | <translateZ()> | <scale3d()> | <scaleZ()> | <rotate3d()> | <rotateX()> | <rotateY()> | <rotateZ()> | <perspective()>"
- },
- "transform-list": {
- syntax: "<transform-function>+"
- },
- "translate()": {
- syntax: "translate( <length-percentage> , <length-percentage>? )"
- },
- "translate3d()": {
- syntax: "translate3d( <length-percentage> , <length-percentage> , <length> )"
- },
- "translateX()": {
- syntax: "translateX( <length-percentage> )"
- },
- "translateY()": {
- syntax: "translateY( <length-percentage> )"
- },
- "translateZ()": {
- syntax: "translateZ( <length> )"
- },
- "type-or-unit": {
- syntax: "string | color | url | integer | number | length | angle | time | frequency | cap | ch | em | ex | ic | lh | rlh | rem | vb | vi | vw | vh | vmin | vmax | mm | Q | cm | in | pt | pc | px | deg | grad | rad | turn | ms | s | Hz | kHz | %"
- },
- "type-selector": {
- syntax: "<wq-name> | <ns-prefix>? '*'"
- },
- "var()": {
- syntax: "var( <custom-property-name> , <declaration-value>? )"
- },
- "viewport-length": {
- syntax: "auto | <length-percentage>"
- },
- "wq-name": {
- syntax: "<ns-prefix>? <ident-token>"
- }
- };
- var atrules = {
- charset: {
- prelude: "<string>"
- },
- "font-face": {
- descriptors: {
- "unicode-range": {
- comment: "replaces <unicode-range>, an old production name",
- syntax: "<urange>#"
- }
- }
- }
- };
- var properties = {
- "-moz-background-clip": {
- comment: "deprecated syntax in old Firefox, https://developer.mozilla.org/en/docs/Web/CSS/background-clip",
- syntax: "padding | border"
- },
- "-moz-border-radius-bottomleft": {
- comment: "https://developer.mozilla.org/en-US/docs/Web/CSS/border-bottom-left-radius",
- syntax: "<'border-bottom-left-radius'>"
- },
- "-moz-border-radius-bottomright": {
- comment: "https://developer.mozilla.org/en-US/docs/Web/CSS/border-bottom-right-radius",
- syntax: "<'border-bottom-right-radius'>"
- },
- "-moz-border-radius-topleft": {
- comment: "https://developer.mozilla.org/en-US/docs/Web/CSS/border-top-left-radius",
- syntax: "<'border-top-left-radius'>"
- },
- "-moz-border-radius-topright": {
- comment: "https://developer.mozilla.org/en-US/docs/Web/CSS/border-bottom-right-radius",
- syntax: "<'border-bottom-right-radius'>"
- },
- "-moz-control-character-visibility": {
- comment: "firefox specific keywords, https://bugzilla.mozilla.org/show_bug.cgi?id=947588",
- syntax: "visible | hidden"
- },
- "-moz-osx-font-smoothing": {
- comment: "misssed old syntax https://developer.mozilla.org/en-US/docs/Web/CSS/font-smooth",
- syntax: "auto | grayscale"
- },
- "-moz-user-select": {
- comment: "https://developer.mozilla.org/en-US/docs/Web/CSS/user-select",
- syntax: "none | text | all | -moz-none"
- },
- "-ms-flex-align": {
- comment: "misssed old syntax implemented in IE, https://www.w3.org/TR/2012/WD-css3-flexbox-20120322/#flex-align",
- syntax: "start | end | center | baseline | stretch"
- },
- "-ms-flex-item-align": {
- comment: "misssed old syntax implemented in IE, https://www.w3.org/TR/2012/WD-css3-flexbox-20120322/#flex-align",
- syntax: "auto | start | end | center | baseline | stretch"
- },
- "-ms-flex-line-pack": {
- comment: "misssed old syntax implemented in IE, https://www.w3.org/TR/2012/WD-css3-flexbox-20120322/#flex-line-pack",
- syntax: "start | end | center | justify | distribute | stretch"
- },
- "-ms-flex-negative": {
- comment: "misssed old syntax implemented in IE; TODO: find references for comfirmation",
- syntax: "<'flex-shrink'>"
- },
- "-ms-flex-pack": {
- comment: "misssed old syntax implemented in IE, https://www.w3.org/TR/2012/WD-css3-flexbox-20120322/#flex-pack",
- syntax: "start | end | center | justify | distribute"
- },
- "-ms-flex-order": {
- comment: "misssed old syntax implemented in IE; https://msdn.microsoft.com/en-us/library/jj127303(v=vs.85).aspx",
- syntax: "<integer>"
- },
- "-ms-flex-positive": {
- comment: "misssed old syntax implemented in IE; TODO: find references for comfirmation",
- syntax: "<'flex-grow'>"
- },
- "-ms-flex-preferred-size": {
- comment: "misssed old syntax implemented in IE; TODO: find references for comfirmation",
- syntax: "<'flex-basis'>"
- },
- "-ms-interpolation-mode": {
- comment: "https://msdn.microsoft.com/en-us/library/ff521095(v=vs.85).aspx",
- syntax: "nearest-neighbor | bicubic"
- },
- "-ms-grid-column-align": {
- comment: "add this property first since it uses as fallback for flexbox, https://msdn.microsoft.com/en-us/library/windows/apps/hh466338.aspx",
- syntax: "start | end | center | stretch"
- },
- "-ms-grid-row-align": {
- comment: "add this property first since it uses as fallback for flexbox, https://msdn.microsoft.com/en-us/library/windows/apps/hh466348.aspx",
- syntax: "start | end | center | stretch"
- },
- "-ms-hyphenate-limit-last": {
- comment: "misssed old syntax implemented in IE; https://www.w3.org/TR/css-text-4/#hyphenate-line-limits",
- syntax: "none | always | column | page | spread"
- },
- "-webkit-appearance": {
- comment: "webkit specific keywords",
- references: [
- "http://css-infos.net/property/-webkit-appearance"
- ],
- syntax: "none | button | button-bevel | caps-lock-indicator | caret | checkbox | default-button | inner-spin-button | listbox | listitem | media-controls-background | media-controls-fullscreen-background | media-current-time-display | media-enter-fullscreen-button | media-exit-fullscreen-button | media-fullscreen-button | media-mute-button | media-overlay-play-button | media-play-button | media-seek-back-button | media-seek-forward-button | media-slider | media-sliderthumb | media-time-remaining-display | media-toggle-closed-captions-button | media-volume-slider | media-volume-slider-container | media-volume-sliderthumb | menulist | menulist-button | menulist-text | menulist-textfield | meter | progress-bar | progress-bar-value | push-button | radio | scrollbarbutton-down | scrollbarbutton-left | scrollbarbutton-right | scrollbarbutton-up | scrollbargripper-horizontal | scrollbargripper-vertical | scrollbarthumb-horizontal | scrollbarthumb-vertical | scrollbartrack-horizontal | scrollbartrack-vertical | searchfield | searchfield-cancel-button | searchfield-decoration | searchfield-results-button | searchfield-results-decoration | slider-horizontal | slider-vertical | sliderthumb-horizontal | sliderthumb-vertical | square-button | textarea | textfield | -apple-pay-button"
- },
- "-webkit-background-clip": {
- comment: "https://developer.mozilla.org/en/docs/Web/CSS/background-clip",
- syntax: "[ <box> | border | padding | content | text ]#"
- },
- "-webkit-column-break-after": {
- comment: "added, http://help.dottoro.com/lcrthhhv.php",
- syntax: "always | auto | avoid"
- },
- "-webkit-column-break-before": {
- comment: "added, http://help.dottoro.com/lcxquvkf.php",
- syntax: "always | auto | avoid"
- },
- "-webkit-column-break-inside": {
- comment: "added, http://help.dottoro.com/lclhnthl.php",
- syntax: "always | auto | avoid"
- },
- "-webkit-font-smoothing": {
- comment: "https://developer.mozilla.org/en-US/docs/Web/CSS/font-smooth",
- syntax: "auto | none | antialiased | subpixel-antialiased"
- },
- "-webkit-mask-box-image": {
- comment: "missed; https://developer.mozilla.org/en-US/docs/Web/CSS/-webkit-mask-box-image",
- syntax: "[ <url> | <gradient> | none ] [ <length-percentage>{4} <-webkit-mask-box-repeat>{2} ]?"
- },
- "-webkit-print-color-adjust": {
- comment: "missed",
- references: [
- "https://developer.mozilla.org/en/docs/Web/CSS/-webkit-print-color-adjust"
- ],
- syntax: "economy | exact"
- },
- "-webkit-text-security": {
- comment: "missed; http://help.dottoro.com/lcbkewgt.php",
- syntax: "none | circle | disc | square"
- },
- "-webkit-user-drag": {
- comment: "missed; http://help.dottoro.com/lcbixvwm.php",
- syntax: "none | element | auto"
- },
- "-webkit-user-select": {
- comment: "auto is supported by old webkit, https://developer.mozilla.org/en-US/docs/Web/CSS/user-select",
- syntax: "auto | none | text | all"
- },
- "alignment-baseline": {
- comment: "added SVG property",
- references: [
- "https://www.w3.org/TR/SVG/text.html#AlignmentBaselineProperty"
- ],
- syntax: "auto | baseline | before-edge | text-before-edge | middle | central | after-edge | text-after-edge | ideographic | alphabetic | hanging | mathematical"
- },
- "baseline-shift": {
- comment: "added SVG property",
- references: [
- "https://www.w3.org/TR/SVG/text.html#BaselineShiftProperty"
- ],
- syntax: "baseline | sub | super | <svg-length>"
- },
- behavior: {
- comment: "added old IE property https://msdn.microsoft.com/en-us/library/ms530723(v=vs.85).aspx",
- syntax: "<url>+"
- },
- "clip-rule": {
- comment: "added SVG property",
- references: [
- "https://www.w3.org/TR/SVG/masking.html#ClipRuleProperty"
- ],
- syntax: "nonzero | evenodd"
- },
- cue: {
- comment: "https://www.w3.org/TR/css3-speech/#property-index",
- syntax: "<'cue-before'> <'cue-after'>?"
- },
- "cue-after": {
- comment: "https://www.w3.org/TR/css3-speech/#property-index",
- syntax: "<url> <decibel>? | none"
- },
- "cue-before": {
- comment: "https://www.w3.org/TR/css3-speech/#property-index",
- syntax: "<url> <decibel>? | none"
- },
- cursor: {
- comment: "added legacy keywords: hand, -webkit-grab. -webkit-grabbing, -webkit-zoom-in, -webkit-zoom-out, -moz-grab, -moz-grabbing, -moz-zoom-in, -moz-zoom-out",
- references: [
- "https://www.sitepoint.com/css3-cursor-styles/"
- ],
- syntax: "[ [ <url> [ <x> <y> ]? , ]* [ auto | default | none | context-menu | help | pointer | progress | wait | cell | crosshair | text | vertical-text | alias | copy | move | no-drop | not-allowed | e-resize | n-resize | ne-resize | nw-resize | s-resize | se-resize | sw-resize | w-resize | ew-resize | ns-resize | nesw-resize | nwse-resize | col-resize | row-resize | all-scroll | zoom-in | zoom-out | grab | grabbing | hand | -webkit-grab | -webkit-grabbing | -webkit-zoom-in | -webkit-zoom-out | -moz-grab | -moz-grabbing | -moz-zoom-in | -moz-zoom-out ] ]"
- },
- display: {
- comment: "extended with -ms-flexbox",
- syntax: "| <-non-standard-display>"
- },
- position: {
- comment: "extended with -webkit-sticky",
- syntax: "| -webkit-sticky"
- },
- "dominant-baseline": {
- comment: "added SVG property",
- references: [
- "https://www.w3.org/TR/SVG/text.html#DominantBaselineProperty"
- ],
- syntax: "auto | use-script | no-change | reset-size | ideographic | alphabetic | hanging | mathematical | central | middle | text-after-edge | text-before-edge"
- },
- "image-rendering": {
- comment: "extended with <-non-standard-image-rendering>, added SVG keywords optimizeSpeed and optimizeQuality",
- references: [
- "https://developer.mozilla.org/en/docs/Web/CSS/image-rendering",
- "https://www.w3.org/TR/SVG/painting.html#ImageRenderingProperty"
- ],
- syntax: "| optimizeSpeed | optimizeQuality | <-non-standard-image-rendering>"
- },
- fill: {
- comment: "added SVG property",
- references: [
- "https://www.w3.org/TR/SVG/painting.html#FillProperty"
- ],
- syntax: "<paint>"
- },
- "fill-opacity": {
- comment: "added SVG property",
- references: [
- "https://www.w3.org/TR/SVG/painting.html#FillProperty"
- ],
- syntax: "<number-zero-one>"
- },
- "fill-rule": {
- comment: "added SVG property",
- references: [
- "https://www.w3.org/TR/SVG/painting.html#FillProperty"
- ],
- syntax: "nonzero | evenodd"
- },
- filter: {
- comment: "extend with IE legacy syntaxes",
- syntax: "| <-ms-filter-function-list>"
- },
- "glyph-orientation-horizontal": {
- comment: "added SVG property",
- references: [
- "https://www.w3.org/TR/SVG/text.html#GlyphOrientationHorizontalProperty"
- ],
- syntax: "<angle>"
- },
- "glyph-orientation-vertical": {
- comment: "added SVG property",
- references: [
- "https://www.w3.org/TR/SVG/text.html#GlyphOrientationVerticalProperty"
- ],
- syntax: "<angle>"
- },
- kerning: {
- comment: "added SVG property",
- references: [
- "https://www.w3.org/TR/SVG/text.html#KerningProperty"
- ],
- syntax: "auto | <svg-length>"
- },
- "letter-spacing": {
- comment: "fix syntax <length> -> <length-percentage>",
- references: [
- "https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/letter-spacing"
- ],
- syntax: "normal | <length-percentage>"
- },
- marker: {
- comment: "added SVG property",
- references: [
- "https://www.w3.org/TR/SVG/painting.html#MarkerProperties"
- ],
- syntax: "none | <url>"
- },
- "marker-end": {
- comment: "added SVG property",
- references: [
- "https://www.w3.org/TR/SVG/painting.html#MarkerProperties"
- ],
- syntax: "none | <url>"
- },
- "marker-mid": {
- comment: "added SVG property",
- references: [
- "https://www.w3.org/TR/SVG/painting.html#MarkerProperties"
- ],
- syntax: "none | <url>"
- },
- "marker-start": {
- comment: "added SVG property",
- references: [
- "https://www.w3.org/TR/SVG/painting.html#MarkerProperties"
- ],
- syntax: "none | <url>"
- },
- "max-width": {
- comment: "fix auto -> none (https://github.com/mdn/data/pull/431); extend by non-standard width keywords https://developer.mozilla.org/en-US/docs/Web/CSS/max-width",
- syntax: "none | <length-percentage> | min-content | max-content | fit-content(<length-percentage>) | <-non-standard-width>"
- },
- width: {
- comment: "per spec fit-content should be a function, however browsers are supporting it as a keyword (https://github.com/csstree/stylelint-validator/issues/29)",
- syntax: "| fit-content | -moz-fit-content | -webkit-fit-content"
- },
- "min-width": {
- comment: "extend by non-standard width keywords https://developer.mozilla.org/en-US/docs/Web/CSS/width",
- syntax: "auto | <length-percentage> | min-content | max-content | fit-content(<length-percentage>) | <-non-standard-width>"
- },
- overflow: {
- comment: "extend by vendor keywords https://developer.mozilla.org/en-US/docs/Web/CSS/overflow",
- syntax: "| <-non-standard-overflow>"
- },
- pause: {
- comment: "https://www.w3.org/TR/css3-speech/#property-index",
- syntax: "<'pause-before'> <'pause-after'>?"
- },
- "pause-after": {
- comment: "https://www.w3.org/TR/css3-speech/#property-index",
- syntax: "<time> | none | x-weak | weak | medium | strong | x-strong"
- },
- "pause-before": {
- comment: "https://www.w3.org/TR/css3-speech/#property-index",
- syntax: "<time> | none | x-weak | weak | medium | strong | x-strong"
- },
- rest: {
- comment: "https://www.w3.org/TR/css3-speech/#property-index",
- syntax: "<'rest-before'> <'rest-after'>?"
- },
- "rest-after": {
- comment: "https://www.w3.org/TR/css3-speech/#property-index",
- syntax: "<time> | none | x-weak | weak | medium | strong | x-strong"
- },
- "rest-before": {
- comment: "https://www.w3.org/TR/css3-speech/#property-index",
- syntax: "<time> | none | x-weak | weak | medium | strong | x-strong"
- },
- "shape-rendering": {
- comment: "added SVG property",
- references: [
- "https://www.w3.org/TR/SVG/painting.html#ShapeRenderingPropert"
- ],
- syntax: "auto | optimizeSpeed | crispEdges | geometricPrecision"
- },
- src: {
- comment: "added @font-face's src property https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/src",
- syntax: "[ <url> [ format( <string># ) ]? | local( <family-name> ) ]#"
- },
- speak: {
- comment: "https://www.w3.org/TR/css3-speech/#property-index",
- syntax: "auto | none | normal"
- },
- "speak-as": {
- comment: "https://www.w3.org/TR/css3-speech/#property-index",
- syntax: "normal | spell-out || digits || [ literal-punctuation | no-punctuation ]"
- },
- stroke: {
- comment: "added SVG property",
- references: [
- "https://www.w3.org/TR/SVG/painting.html#StrokeProperties"
- ],
- syntax: "<paint>"
- },
- "stroke-dasharray": {
- comment: "added SVG property; a list of comma and/or white space separated <length>s and <percentage>s",
- references: [
- "https://www.w3.org/TR/SVG/painting.html#StrokeProperties"
- ],
- syntax: "none | [ <svg-length>+ ]#"
- },
- "stroke-dashoffset": {
- comment: "added SVG property",
- references: [
- "https://www.w3.org/TR/SVG/painting.html#StrokeProperties"
- ],
- syntax: "<svg-length>"
- },
- "stroke-linecap": {
- comment: "added SVG property",
- references: [
- "https://www.w3.org/TR/SVG/painting.html#StrokeProperties"
- ],
- syntax: "butt | round | square"
- },
- "stroke-linejoin": {
- comment: "added SVG property",
- references: [
- "https://www.w3.org/TR/SVG/painting.html#StrokeProperties"
- ],
- syntax: "miter | round | bevel"
- },
- "stroke-miterlimit": {
- comment: "added SVG property (<miterlimit> = <number-one-or-greater>) ",
- references: [
- "https://www.w3.org/TR/SVG/painting.html#StrokeProperties"
- ],
- syntax: "<number-one-or-greater>"
- },
- "stroke-opacity": {
- comment: "added SVG property",
- references: [
- "https://www.w3.org/TR/SVG/painting.html#StrokeProperties"
- ],
- syntax: "<number-zero-one>"
- },
- "stroke-width": {
- comment: "added SVG property",
- references: [
- "https://www.w3.org/TR/SVG/painting.html#StrokeProperties"
- ],
- syntax: "<svg-length>"
- },
- "text-anchor": {
- comment: "added SVG property",
- references: [
- "https://www.w3.org/TR/SVG/text.html#TextAlignmentProperties"
- ],
- syntax: "start | middle | end"
- },
- "unicode-bidi": {
- comment: "added prefixed keywords https://developer.mozilla.org/en-US/docs/Web/CSS/unicode-bidi",
- syntax: "| -moz-isolate | -moz-isolate-override | -moz-plaintext | -webkit-isolate | -webkit-isolate-override | -webkit-plaintext"
- },
- "unicode-range": {
- comment: "added missed property https://developer.mozilla.org/en-US/docs/Web/CSS/%40font-face/unicode-range",
- syntax: "<urange>#"
- },
- "voice-balance": {
- comment: "https://www.w3.org/TR/css3-speech/#property-index",
- syntax: "<number> | left | center | right | leftwards | rightwards"
- },
- "voice-duration": {
- comment: "https://www.w3.org/TR/css3-speech/#property-index",
- syntax: "auto | <time>"
- },
- "voice-family": {
- comment: "<name> -> <family-name>, https://www.w3.org/TR/css3-speech/#property-index",
- syntax: "[ [ <family-name> | <generic-voice> ] , ]* [ <family-name> | <generic-voice> ] | preserve"
- },
- "voice-pitch": {
- comment: "https://www.w3.org/TR/css3-speech/#property-index",
- syntax: "<frequency> && absolute | [ [ x-low | low | medium | high | x-high ] || [ <frequency> | <semitones> | <percentage> ] ]"
- },
- "voice-range": {
- comment: "https://www.w3.org/TR/css3-speech/#property-index",
- syntax: "<frequency> && absolute | [ [ x-low | low | medium | high | x-high ] || [ <frequency> | <semitones> | <percentage> ] ]"
- },
- "voice-rate": {
- comment: "https://www.w3.org/TR/css3-speech/#property-index",
- syntax: "[ normal | x-slow | slow | medium | fast | x-fast ] || <percentage>"
- },
- "voice-stress": {
- comment: "https://www.w3.org/TR/css3-speech/#property-index",
- syntax: "normal | strong | moderate | none | reduced"
- },
- "voice-volume": {
- comment: "https://www.w3.org/TR/css3-speech/#property-index",
- syntax: "silent | [ [ x-soft | soft | medium | loud | x-loud ] || <decibel> ]"
- },
- "writing-mode": {
- comment: "extend with SVG keywords",
- syntax: "| <svg-writing-mode>"
- }
- };
- var syntaxes = {
- "-legacy-gradient": {
- comment: "added collection of legacy gradient syntaxes",
- syntax: "<-webkit-gradient()> | <-legacy-linear-gradient> | <-legacy-repeating-linear-gradient> | <-legacy-radial-gradient> | <-legacy-repeating-radial-gradient>"
- },
- "-legacy-linear-gradient": {
- comment: "like standard syntax but w/o `to` keyword https://developer.mozilla.org/en-US/docs/Web/CSS/linear-gradient",
- syntax: "-moz-linear-gradient( <-legacy-linear-gradient-arguments> ) | -webkit-linear-gradient( <-legacy-linear-gradient-arguments> ) | -o-linear-gradient( <-legacy-linear-gradient-arguments> )"
- },
- "-legacy-repeating-linear-gradient": {
- comment: "like standard syntax but w/o `to` keyword https://developer.mozilla.org/en-US/docs/Web/CSS/linear-gradient",
- syntax: "-moz-repeating-linear-gradient( <-legacy-linear-gradient-arguments> ) | -webkit-repeating-linear-gradient( <-legacy-linear-gradient-arguments> ) | -o-repeating-linear-gradient( <-legacy-linear-gradient-arguments> )"
- },
- "-legacy-linear-gradient-arguments": {
- comment: "like standard syntax but w/o `to` keyword https://developer.mozilla.org/en-US/docs/Web/CSS/linear-gradient",
- syntax: "[ <angle> | <side-or-corner> ]? , <color-stop-list>"
- },
- "-legacy-radial-gradient": {
- comment: "deprecated syntax that implemented by some browsers https://www.w3.org/TR/2011/WD-css3-images-20110908/#radial-gradients",
- syntax: "-moz-radial-gradient( <-legacy-radial-gradient-arguments> ) | -webkit-radial-gradient( <-legacy-radial-gradient-arguments> ) | -o-radial-gradient( <-legacy-radial-gradient-arguments> )"
- },
- "-legacy-repeating-radial-gradient": {
- comment: "deprecated syntax that implemented by some browsers https://www.w3.org/TR/2011/WD-css3-images-20110908/#radial-gradients",
- syntax: "-moz-repeating-radial-gradient( <-legacy-radial-gradient-arguments> ) | -webkit-repeating-radial-gradient( <-legacy-radial-gradient-arguments> ) | -o-repeating-radial-gradient( <-legacy-radial-gradient-arguments> )"
- },
- "-legacy-radial-gradient-arguments": {
- comment: "deprecated syntax that implemented by some browsers https://www.w3.org/TR/2011/WD-css3-images-20110908/#radial-gradients",
- syntax: "[ <position> , ]? [ [ [ <-legacy-radial-gradient-shape> || <-legacy-radial-gradient-size> ] | [ <length> | <percentage> ]{2} ] , ]? <color-stop-list>"
- },
- "-legacy-radial-gradient-size": {
- comment: "before a standard it contains 2 extra keywords (`contain` and `cover`) https://www.w3.org/TR/2011/WD-css3-images-20110908/#ltsize",
- syntax: "closest-side | closest-corner | farthest-side | farthest-corner | contain | cover"
- },
- "-legacy-radial-gradient-shape": {
- comment: "define to double sure it doesn't extends in future https://www.w3.org/TR/2011/WD-css3-images-20110908/#ltshape",
- syntax: "circle | ellipse"
- },
- "-non-standard-font": {
- comment: "non standard fonts",
- references: [
- "https://webkit.org/blog/3709/using-the-system-font-in-web-content/"
- ],
- syntax: "-apple-system-body | -apple-system-headline | -apple-system-subheadline | -apple-system-caption1 | -apple-system-caption2 | -apple-system-footnote | -apple-system-short-body | -apple-system-short-headline | -apple-system-short-subheadline | -apple-system-short-caption1 | -apple-system-short-footnote | -apple-system-tall-body"
- },
- "-non-standard-color": {
- comment: "non standard colors",
- references: [
- "http://cssdot.ru/%D0%A1%D0%BF%D1%80%D0%B0%D0%B2%D0%BE%D1%87%D0%BD%D0%B8%D0%BA_CSS/color-i305.html",
- "https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#Mozilla_Color_Preference_Extensions"
- ],
- syntax: "-moz-ButtonDefault | -moz-ButtonHoverFace | -moz-ButtonHoverText | -moz-CellHighlight | -moz-CellHighlightText | -moz-Combobox | -moz-ComboboxText | -moz-Dialog | -moz-DialogText | -moz-dragtargetzone | -moz-EvenTreeRow | -moz-Field | -moz-FieldText | -moz-html-CellHighlight | -moz-html-CellHighlightText | -moz-mac-accentdarkestshadow | -moz-mac-accentdarkshadow | -moz-mac-accentface | -moz-mac-accentlightesthighlight | -moz-mac-accentlightshadow | -moz-mac-accentregularhighlight | -moz-mac-accentregularshadow | -moz-mac-chrome-active | -moz-mac-chrome-inactive | -moz-mac-focusring | -moz-mac-menuselect | -moz-mac-menushadow | -moz-mac-menutextselect | -moz-MenuHover | -moz-MenuHoverText | -moz-MenuBarText | -moz-MenuBarHoverText | -moz-nativehyperlinktext | -moz-OddTreeRow | -moz-win-communicationstext | -moz-win-mediatext | -moz-activehyperlinktext | -moz-default-background-color | -moz-default-color | -moz-hyperlinktext | -moz-visitedhyperlinktext | -webkit-activelink | -webkit-focus-ring-color | -webkit-link | -webkit-text"
- },
- "-non-standard-image-rendering": {
- comment: "non-standard keywords http://phrogz.net/tmp/canvas_image_zoom.html",
- syntax: "optimize-contrast | -moz-crisp-edges | -o-crisp-edges | -webkit-optimize-contrast"
- },
- "-non-standard-overflow": {
- comment: "non-standard keywords https://developer.mozilla.org/en-US/docs/Web/CSS/overflow",
- syntax: "-moz-scrollbars-none | -moz-scrollbars-horizontal | -moz-scrollbars-vertical | -moz-hidden-unscrollable"
- },
- "-non-standard-width": {
- comment: "non-standard keywords https://developer.mozilla.org/en-US/docs/Web/CSS/width",
- syntax: "fill-available | min-intrinsic | intrinsic | -moz-available | -moz-fit-content | -moz-min-content | -moz-max-content | -webkit-min-content | -webkit-max-content"
- },
- "-webkit-gradient()": {
- comment: "first Apple proposal gradient syntax https://webkit.org/blog/175/introducing-css-gradients/ - TODO: simplify when after match algorithm improvement ( [, point, radius | , point] -> [, radius]? , point )",
- syntax: "-webkit-gradient( <-webkit-gradient-type>, <-webkit-gradient-point> [, <-webkit-gradient-point> | , <-webkit-gradient-radius>, <-webkit-gradient-point> ] [, <-webkit-gradient-radius>]? [, <-webkit-gradient-color-stop>]* )"
- },
- "-webkit-gradient-color-stop": {
- comment: "first Apple proposal gradient syntax https://webkit.org/blog/175/introducing-css-gradients/",
- syntax: "from( <color> ) | color-stop( [ <number-zero-one> | <percentage> ] , <color> ) | to( <color> )"
- },
- "-webkit-gradient-point": {
- comment: "first Apple proposal gradient syntax https://webkit.org/blog/175/introducing-css-gradients/",
- syntax: "[ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]"
- },
- "-webkit-gradient-radius": {
- comment: "first Apple proposal gradient syntax https://webkit.org/blog/175/introducing-css-gradients/",
- syntax: "<length> | <percentage>"
- },
- "-webkit-gradient-type": {
- comment: "first Apple proposal gradient syntax https://webkit.org/blog/175/introducing-css-gradients/",
- syntax: "linear | radial"
- },
- "-webkit-mask-box-repeat": {
- comment: "missed; https://developer.mozilla.org/en-US/docs/Web/CSS/-webkit-mask-box-image",
- syntax: "repeat | stretch | round"
- },
- "-webkit-mask-clip-style": {
- comment: "missed; there is no enough information about `-webkit-mask-clip` property, but looks like all those keywords are working",
- syntax: "border | border-box | padding | padding-box | content | content-box | text"
- },
- "-ms-filter-function-list": {
- comment: "https://developer.mozilla.org/en-US/docs/Web/CSS/-ms-filter",
- syntax: "<-ms-filter-function>+"
- },
- "-ms-filter-function": {
- comment: "https://developer.mozilla.org/en-US/docs/Web/CSS/-ms-filter",
- syntax: "<-ms-filter-function-progid> | <-ms-filter-function-legacy>"
- },
- "-ms-filter-function-progid": {
- comment: "https://developer.mozilla.org/en-US/docs/Web/CSS/-ms-filter",
- syntax: "'progid:' [ <ident-token> '.' ]* [ <ident-token> | <function-token> <any-value>? ) ]"
- },
- "-ms-filter-function-legacy": {
- comment: "https://developer.mozilla.org/en-US/docs/Web/CSS/-ms-filter",
- syntax: "<ident-token> | <function-token> <any-value>? )"
- },
- "-ms-filter": {
- syntax: "<string>"
- },
- age: {
- comment: "https://www.w3.org/TR/css3-speech/#voice-family",
- syntax: "child | young | old"
- },
- "attr-name": {
- syntax: "<wq-name>"
- },
- "attr-fallback": {
- syntax: "<any-value>"
- },
- "border-radius": {
- comment: "missed, https://drafts.csswg.org/css-backgrounds-3/#the-border-radius",
- syntax: "<length-percentage>{1,2}"
- },
- bottom: {
- comment: "missed; not sure we should add it, but no others except `shape` is using it so it's ok for now; https://drafts.fxtf.org/css-masking-1/#funcdef-clip-rect",
- syntax: "<length> | auto"
- },
- "content-list": {
- comment: "missed -> https://drafts.csswg.org/css-content/#typedef-content-list (document-url, <target> and leader() is omitted util stabilization)",
- syntax: "[ <string> | contents | <image> | <quote> | <target> | <leader()> | <attr()> | counter( <ident>, <'list-style-type'>? ) ]+"
- },
- "element()": {
- comment: "https://drafts.csswg.org/css-gcpm/#element-syntax & https://drafts.csswg.org/css-images-4/#element-notation",
- syntax: "element( <custom-ident> , [ first | start | last | first-except ]? ) | element( <id-selector> )"
- },
- "generic-voice": {
- comment: "https://www.w3.org/TR/css3-speech/#voice-family",
- syntax: "[ <age>? <gender> <integer>? ]"
- },
- gender: {
- comment: "https://www.w3.org/TR/css3-speech/#voice-family",
- syntax: "male | female | neutral"
- },
- "generic-family": {
- comment: "added -apple-system",
- references: [
- "https://webkit.org/blog/3709/using-the-system-font-in-web-content/"
- ],
- syntax: "| -apple-system"
- },
- gradient: {
- comment: "added legacy syntaxes support",
- syntax: "| <-legacy-gradient>"
- },
- left: {
- comment: "missed; not sure we should add it, but no others except `shape` is using it so it's ok for now; https://drafts.fxtf.org/css-masking-1/#funcdef-clip-rect",
- syntax: "<length> | auto"
- },
- "mask-image": {
- comment: "missed; https://drafts.fxtf.org/css-masking-1/#the-mask-image",
- syntax: "<mask-reference>#"
- },
- "name-repeat": {
- comment: "missed, and looks like obsolete, keep it as is since other property syntaxes should be changed too; https://www.w3.org/TR/2015/WD-css-grid-1-20150917/#typedef-name-repeat",
- syntax: "repeat( [ <positive-integer> | auto-fill ], <line-names>+)"
- },
- "named-color": {
- comment: "added non standard color names",
- syntax: "| <-non-standard-color>"
- },
- paint: {
- comment: "used by SVG https://www.w3.org/TR/SVG/painting.html#SpecifyingPaint",
- syntax: "none | <color> | <url> [ none | <color> ]? | context-fill | context-stroke"
- },
- "page-size": {
- comment: "https://www.w3.org/TR/css-page-3/#typedef-page-size-page-size",
- syntax: "A5 | A4 | A3 | B5 | B4 | JIS-B5 | JIS-B4 | letter | legal | ledger"
- },
- ratio: {
- comment: "missed, https://drafts.csswg.org/mediaqueries-4/#typedef-ratio",
- syntax: "<integer> / <integer>"
- },
- right: {
- comment: "missed; not sure we should add it, but no others except `shape` is using it so it's ok for now; https://drafts.fxtf.org/css-masking-1/#funcdef-clip-rect",
- syntax: "<length> | auto"
- },
- shape: {
- comment: "missed spaces in function body and add backwards compatible syntax",
- syntax: "rect( <top>, <right>, <bottom>, <left> ) | rect( <top> <right> <bottom> <left> )"
- },
- "svg-length": {
- comment: "All coordinates and lengths in SVG can be specified with or without a unit identifier",
- references: [
- "https://www.w3.org/TR/SVG11/coords.html#Units"
- ],
- syntax: "<percentage> | <length> | <number>"
- },
- "svg-writing-mode": {
- comment: "SVG specific keywords (deprecated for CSS)",
- references: [
- "https://developer.mozilla.org/en/docs/Web/CSS/writing-mode",
- "https://www.w3.org/TR/SVG/text.html#WritingModeProperty"
- ],
- syntax: "lr-tb | rl-tb | tb-rl | lr | rl | tb"
- },
- top: {
- comment: "missed; not sure we should add it, but no others except `shape` is using it so it's ok for now; https://drafts.fxtf.org/css-masking-1/#funcdef-clip-rect",
- syntax: "<length> | auto"
- },
- "track-group": {
- comment: "used by old grid-columns and grid-rows syntax v0",
- syntax: "'(' [ <string>* <track-minmax> <string>* ]+ ')' [ '[' <positive-integer> ']' ]? | <track-minmax>"
- },
- "track-list-v0": {
- comment: "used by old grid-columns and grid-rows syntax v0",
- syntax: "[ <string>* <track-group> <string>* ]+ | none"
- },
- "track-minmax": {
- comment: "used by old grid-columns and grid-rows syntax v0",
- syntax: "minmax( <track-breadth> , <track-breadth> ) | auto | <track-breadth> | fit-content"
- },
- x: {
- comment: "missed; not sure we should add it, but no others except `cursor` is using it so it's ok for now; https://drafts.csswg.org/css-ui-3/#cursor",
- syntax: "<number>"
- },
- y: {
- comment: "missed; not sure we should add it, but no others except `cursor` is using so it's ok for now; https://drafts.csswg.org/css-ui-3/#cursor",
- syntax: "<number>"
- },
- declaration: {
- comment: "missed, restored by https://drafts.csswg.org/css-syntax",
- syntax: "<ident-token> : <declaration-value>? [ '!' important ]?"
- },
- "declaration-list": {
- comment: "missed, restored by https://drafts.csswg.org/css-syntax",
- syntax: "[ <declaration>? ';' ]* <declaration>?"
- },
- url: {
- comment: "https://drafts.csswg.org/css-values-4/#urls",
- syntax: "url( <string> <url-modifier>* ) | <url-token>"
- },
- "url-modifier": {
- comment: "https://drafts.csswg.org/css-values-4/#typedef-url-modifier",
- syntax: "<ident> | <function-token> <any-value> )"
- },
- "number-zero-one": {
- syntax: "<number [0,1]>"
- },
- "number-one-or-greater": {
- syntax: "<number [1,∞]>"
- },
- "positive-integer": {
- syntax: "<integer [0,∞]>"
- },
- "-non-standard-display": {
- syntax: "-ms-inline-flexbox | -ms-grid | -ms-inline-grid | -webkit-flex | -webkit-inline-flex | -webkit-box | -webkit-inline-box | -moz-inline-stack | -moz-box | -moz-inline-box"
- }
- };
- var require$$3 = {
- atrules: atrules,
- properties: properties,
- syntaxes: syntaxes
- };
- const mdnAtrules = require$$0;
- const mdnProperties = require$$1;
- const mdnSyntaxes = require$$2;
- const patch = require$$3;
- const extendSyntax = /^\s*\|\s*/;
- function preprocessAtrules(dict) {
- const result = Object.create(null);
- for (const atruleName in dict) {
- const atrule = dict[atruleName];
- let descriptors = null;
- if (atrule.descriptors) {
- descriptors = Object.create(null);
- for (const descriptor in atrule.descriptors) {
- descriptors[descriptor] = atrule.descriptors[descriptor].syntax;
- }
- }
- result[atruleName.substr(1)] = {
- prelude: atrule.syntax.trim().match(/^@\S+\s+([^;\{]*)/)[1].trim() || null,
- descriptors
- };
- }
- return result;
- }
- function patchDictionary(dict, patchDict) {
- const result = {};
- // copy all syntaxes for an original dict
- for (const key in dict) {
- result[key] = dict[key].syntax || dict[key];
- }
- // apply a patch
- for (const key in patchDict) {
- if (key in dict) {
- if (patchDict[key].syntax) {
- result[key] = extendSyntax.test(patchDict[key].syntax)
- ? result[key] + ' ' + patchDict[key].syntax.trim()
- : patchDict[key].syntax;
- } else {
- delete result[key];
- }
- } else {
- if (patchDict[key].syntax) {
- result[key] = patchDict[key].syntax.replace(extendSyntax, '');
- }
- }
- }
- return result;
- }
- function unpackSyntaxes(dict) {
- const result = {};
- for (const key in dict) {
- result[key] = dict[key].syntax;
- }
- return result;
- }
- function patchAtrules(dict, patchDict) {
- const result = {};
- // copy all syntaxes for an original dict
- for (const key in dict) {
- const patchDescriptors = (patchDict[key] && patchDict[key].descriptors) || null;
- result[key] = {
- prelude: key in patchDict && 'prelude' in patchDict[key]
- ? patchDict[key].prelude
- : dict[key].prelude || null,
- descriptors: dict[key].descriptors
- ? patchDictionary(dict[key].descriptors, patchDescriptors || {})
- : patchDescriptors && unpackSyntaxes(patchDescriptors)
- };
- }
- // apply a patch
- for (const key in patchDict) {
- if (!hasOwnProperty.call(dict, key)) {
- result[key] = {
- prelude: patchDict[key].prelude || null,
- descriptors: patchDict[key].descriptors && unpackSyntaxes(patchDict[key].descriptors)
- };
- }
- }
- return result;
- }
- var data$1 = {
- types: patchDictionary(mdnSyntaxes, patch.syntaxes),
- atrules: patchAtrules(preprocessAtrules(mdnAtrules), patch.atrules),
- properties: patchDictionary(mdnProperties, patch.properties)
- };
- var cmpChar$2 = tokenizer$3.cmpChar;
- var isDigit$1 = tokenizer$3.isDigit;
- var TYPE$y = tokenizer$3.TYPE;
- var WHITESPACE$8 = TYPE$y.WhiteSpace;
- var COMMENT$6 = TYPE$y.Comment;
- var IDENT$f = TYPE$y.Ident;
- var NUMBER$6 = TYPE$y.Number;
- var DIMENSION$5 = TYPE$y.Dimension;
- var PLUSSIGN$5 = 0x002B; // U+002B PLUS SIGN (+)
- var HYPHENMINUS$2 = 0x002D; // U+002D HYPHEN-MINUS (-)
- var N = 0x006E; // U+006E LATIN SMALL LETTER N (n)
- var DISALLOW_SIGN = true;
- var ALLOW_SIGN = false;
- function checkInteger(offset, disallowSign) {
- var pos = this.scanner.tokenStart + offset;
- var code = this.scanner.source.charCodeAt(pos);
- if (code === PLUSSIGN$5 || code === HYPHENMINUS$2) {
- if (disallowSign) {
- this.error('Number sign is not allowed');
- }
- pos++;
- }
- for (; pos < this.scanner.tokenEnd; pos++) {
- if (!isDigit$1(this.scanner.source.charCodeAt(pos))) {
- this.error('Integer is expected', pos);
- }
- }
- }
- function checkTokenIsInteger(disallowSign) {
- return checkInteger.call(this, 0, disallowSign);
- }
- function expectCharCode(offset, code) {
- if (!cmpChar$2(this.scanner.source, this.scanner.tokenStart + offset, code)) {
- var msg = '';
- switch (code) {
- case N:
- msg = 'N is expected';
- break;
- case HYPHENMINUS$2:
- msg = 'HyphenMinus is expected';
- break;
- }
- this.error(msg, this.scanner.tokenStart + offset);
- }
- }
- // ... <signed-integer>
- // ... ['+' | '-'] <signless-integer>
- function consumeB() {
- var offset = 0;
- var sign = 0;
- var type = this.scanner.tokenType;
- while (type === WHITESPACE$8 || type === COMMENT$6) {
- type = this.scanner.lookupType(++offset);
- }
- if (type !== NUMBER$6) {
- if (this.scanner.isDelim(PLUSSIGN$5, offset) ||
- this.scanner.isDelim(HYPHENMINUS$2, offset)) {
- sign = this.scanner.isDelim(PLUSSIGN$5, offset) ? PLUSSIGN$5 : HYPHENMINUS$2;
- do {
- type = this.scanner.lookupType(++offset);
- } while (type === WHITESPACE$8 || type === COMMENT$6);
- if (type !== NUMBER$6) {
- this.scanner.skip(offset);
- checkTokenIsInteger.call(this, DISALLOW_SIGN);
- }
- } else {
- return null;
- }
- }
- if (offset > 0) {
- this.scanner.skip(offset);
- }
- if (sign === 0) {
- type = this.scanner.source.charCodeAt(this.scanner.tokenStart);
- if (type !== PLUSSIGN$5 && type !== HYPHENMINUS$2) {
- this.error('Number sign is expected');
- }
- }
- checkTokenIsInteger.call(this, sign !== 0);
- return sign === HYPHENMINUS$2 ? '-' + this.consume(NUMBER$6) : this.consume(NUMBER$6);
- }
- // An+B microsyntax https://www.w3.org/TR/css-syntax-3/#anb
- var AnPlusB = {
- name: 'AnPlusB',
- structure: {
- a: [String, null],
- b: [String, null]
- },
- parse: function() {
- /* eslint-disable brace-style*/
- var start = this.scanner.tokenStart;
- var a = null;
- var b = null;
- // <integer>
- if (this.scanner.tokenType === NUMBER$6) {
- checkTokenIsInteger.call(this, ALLOW_SIGN);
- b = this.consume(NUMBER$6);
- }
- // -n
- // -n <signed-integer>
- // -n ['+' | '-'] <signless-integer>
- // -n- <signless-integer>
- // <dashndashdigit-ident>
- else if (this.scanner.tokenType === IDENT$f && cmpChar$2(this.scanner.source, this.scanner.tokenStart, HYPHENMINUS$2)) {
- a = '-1';
- expectCharCode.call(this, 1, N);
- switch (this.scanner.getTokenLength()) {
- // -n
- // -n <signed-integer>
- // -n ['+' | '-'] <signless-integer>
- case 2:
- this.scanner.next();
- b = consumeB.call(this);
- break;
- // -n- <signless-integer>
- case 3:
- expectCharCode.call(this, 2, HYPHENMINUS$2);
- this.scanner.next();
- this.scanner.skipSC();
- checkTokenIsInteger.call(this, DISALLOW_SIGN);
- b = '-' + this.consume(NUMBER$6);
- break;
- // <dashndashdigit-ident>
- default:
- expectCharCode.call(this, 2, HYPHENMINUS$2);
- checkInteger.call(this, 3, DISALLOW_SIGN);
- this.scanner.next();
- b = this.scanner.substrToCursor(start + 2);
- }
- }
- // '+'? n
- // '+'? n <signed-integer>
- // '+'? n ['+' | '-'] <signless-integer>
- // '+'? n- <signless-integer>
- // '+'? <ndashdigit-ident>
- else if (this.scanner.tokenType === IDENT$f || (this.scanner.isDelim(PLUSSIGN$5) && this.scanner.lookupType(1) === IDENT$f)) {
- var sign = 0;
- a = '1';
- // just ignore a plus
- if (this.scanner.isDelim(PLUSSIGN$5)) {
- sign = 1;
- this.scanner.next();
- }
- expectCharCode.call(this, 0, N);
- switch (this.scanner.getTokenLength()) {
- // '+'? n
- // '+'? n <signed-integer>
- // '+'? n ['+' | '-'] <signless-integer>
- case 1:
- this.scanner.next();
- b = consumeB.call(this);
- break;
- // '+'? n- <signless-integer>
- case 2:
- expectCharCode.call(this, 1, HYPHENMINUS$2);
- this.scanner.next();
- this.scanner.skipSC();
- checkTokenIsInteger.call(this, DISALLOW_SIGN);
- b = '-' + this.consume(NUMBER$6);
- break;
- // '+'? <ndashdigit-ident>
- default:
- expectCharCode.call(this, 1, HYPHENMINUS$2);
- checkInteger.call(this, 2, DISALLOW_SIGN);
- this.scanner.next();
- b = this.scanner.substrToCursor(start + sign + 1);
- }
- }
- // <ndashdigit-dimension>
- // <ndash-dimension> <signless-integer>
- // <n-dimension>
- // <n-dimension> <signed-integer>
- // <n-dimension> ['+' | '-'] <signless-integer>
- else if (this.scanner.tokenType === DIMENSION$5) {
- var code = this.scanner.source.charCodeAt(this.scanner.tokenStart);
- var sign = code === PLUSSIGN$5 || code === HYPHENMINUS$2;
- for (var i = this.scanner.tokenStart + sign; i < this.scanner.tokenEnd; i++) {
- if (!isDigit$1(this.scanner.source.charCodeAt(i))) {
- break;
- }
- }
- if (i === this.scanner.tokenStart + sign) {
- this.error('Integer is expected', this.scanner.tokenStart + sign);
- }
- expectCharCode.call(this, i - this.scanner.tokenStart, N);
- a = this.scanner.source.substring(start, i);
- // <n-dimension>
- // <n-dimension> <signed-integer>
- // <n-dimension> ['+' | '-'] <signless-integer>
- if (i + 1 === this.scanner.tokenEnd) {
- this.scanner.next();
- b = consumeB.call(this);
- } else {
- expectCharCode.call(this, i - this.scanner.tokenStart + 1, HYPHENMINUS$2);
- // <ndash-dimension> <signless-integer>
- if (i + 2 === this.scanner.tokenEnd) {
- this.scanner.next();
- this.scanner.skipSC();
- checkTokenIsInteger.call(this, DISALLOW_SIGN);
- b = '-' + this.consume(NUMBER$6);
- }
- // <ndashdigit-dimension>
- else {
- checkInteger.call(this, i - this.scanner.tokenStart + 2, DISALLOW_SIGN);
- this.scanner.next();
- b = this.scanner.substrToCursor(i + 1);
- }
- }
- } else {
- this.error();
- }
- if (a !== null && a.charCodeAt(0) === PLUSSIGN$5) {
- a = a.substr(1);
- }
- if (b !== null && b.charCodeAt(0) === PLUSSIGN$5) {
- b = b.substr(1);
- }
- return {
- type: 'AnPlusB',
- loc: this.getLocation(start, this.scanner.tokenStart),
- a: a,
- b: b
- };
- },
- generate: function(node) {
- var a = node.a !== null && node.a !== undefined;
- var b = node.b !== null && node.b !== undefined;
- if (a) {
- this.chunk(
- node.a === '+1' ? '+n' : // eslint-disable-line operator-linebreak, indent
- node.a === '1' ? 'n' : // eslint-disable-line operator-linebreak, indent
- node.a === '-1' ? '-n' : // eslint-disable-line operator-linebreak, indent
- node.a + 'n' // eslint-disable-line operator-linebreak, indent
- );
- if (b) {
- b = String(node.b);
- if (b.charAt(0) === '-' || b.charAt(0) === '+') {
- this.chunk(b.charAt(0));
- this.chunk(b.substr(1));
- } else {
- this.chunk('+');
- this.chunk(b);
- }
- }
- } else {
- this.chunk(String(node.b));
- }
- }
- };
- var tokenizer = tokenizer$3;
- var TYPE$x = tokenizer.TYPE;
- var WhiteSpace$1 = TYPE$x.WhiteSpace;
- var Semicolon = TYPE$x.Semicolon;
- var LeftCurlyBracket = TYPE$x.LeftCurlyBracket;
- var Delim = TYPE$x.Delim;
- var EXCLAMATIONMARK$2 = 0x0021; // U+0021 EXCLAMATION MARK (!)
- function getOffsetExcludeWS() {
- if (this.scanner.tokenIndex > 0) {
- if (this.scanner.lookupType(-1) === WhiteSpace$1) {
- return this.scanner.tokenIndex > 1
- ? this.scanner.getTokenStart(this.scanner.tokenIndex - 1)
- : this.scanner.firstCharOffset;
- }
- }
- return this.scanner.tokenStart;
- }
- // 0, 0, false
- function balanceEnd() {
- return 0;
- }
- // LEFTCURLYBRACKET, 0, false
- function leftCurlyBracket(tokenType) {
- return tokenType === LeftCurlyBracket ? 1 : 0;
- }
- // LEFTCURLYBRACKET, SEMICOLON, false
- function leftCurlyBracketOrSemicolon(tokenType) {
- return tokenType === LeftCurlyBracket || tokenType === Semicolon ? 1 : 0;
- }
- // EXCLAMATIONMARK, SEMICOLON, false
- function exclamationMarkOrSemicolon(tokenType, source, offset) {
- if (tokenType === Delim && source.charCodeAt(offset) === EXCLAMATIONMARK$2) {
- return 1;
- }
- return tokenType === Semicolon ? 1 : 0;
- }
- // 0, SEMICOLON, true
- function semicolonIncluded(tokenType) {
- return tokenType === Semicolon ? 2 : 0;
- }
- var Raw = {
- name: 'Raw',
- structure: {
- value: String
- },
- parse: function(startToken, mode, excludeWhiteSpace) {
- var startOffset = this.scanner.getTokenStart(startToken);
- var endOffset;
- this.scanner.skip(
- this.scanner.getRawLength(startToken, mode || balanceEnd)
- );
- if (excludeWhiteSpace && this.scanner.tokenStart > startOffset) {
- endOffset = getOffsetExcludeWS.call(this);
- } else {
- endOffset = this.scanner.tokenStart;
- }
- return {
- type: 'Raw',
- loc: this.getLocation(startOffset, endOffset),
- value: this.scanner.source.substring(startOffset, endOffset)
- };
- },
- generate: function(node) {
- this.chunk(node.value);
- },
- mode: {
- default: balanceEnd,
- leftCurlyBracket: leftCurlyBracket,
- leftCurlyBracketOrSemicolon: leftCurlyBracketOrSemicolon,
- exclamationMarkOrSemicolon: exclamationMarkOrSemicolon,
- semicolonIncluded: semicolonIncluded
- }
- };
- var TYPE$w = tokenizer$3.TYPE;
- var rawMode$5 = Raw.mode;
- var ATKEYWORD$2 = TYPE$w.AtKeyword;
- var SEMICOLON$4 = TYPE$w.Semicolon;
- var LEFTCURLYBRACKET$3 = TYPE$w.LeftCurlyBracket;
- var RIGHTCURLYBRACKET$1 = TYPE$w.RightCurlyBracket;
- function consumeRaw$5(startToken) {
- return this.Raw(startToken, rawMode$5.leftCurlyBracketOrSemicolon, true);
- }
- function isDeclarationBlockAtrule() {
- for (var offset = 1, type; type = this.scanner.lookupType(offset); offset++) {
- if (type === RIGHTCURLYBRACKET$1) {
- return true;
- }
- if (type === LEFTCURLYBRACKET$3 ||
- type === ATKEYWORD$2) {
- return false;
- }
- }
- return false;
- }
- var Atrule = {
- name: 'Atrule',
- structure: {
- name: String,
- prelude: ['AtrulePrelude', 'Raw', null],
- block: ['Block', null]
- },
- parse: function() {
- var start = this.scanner.tokenStart;
- var name;
- var nameLowerCase;
- var prelude = null;
- var block = null;
- this.eat(ATKEYWORD$2);
- name = this.scanner.substrToCursor(start + 1);
- nameLowerCase = name.toLowerCase();
- this.scanner.skipSC();
- // parse prelude
- if (this.scanner.eof === false &&
- this.scanner.tokenType !== LEFTCURLYBRACKET$3 &&
- this.scanner.tokenType !== SEMICOLON$4) {
- if (this.parseAtrulePrelude) {
- prelude = this.parseWithFallback(this.AtrulePrelude.bind(this, name), consumeRaw$5);
- // turn empty AtrulePrelude into null
- if (prelude.type === 'AtrulePrelude' && prelude.children.head === null) {
- prelude = null;
- }
- } else {
- prelude = consumeRaw$5.call(this, this.scanner.tokenIndex);
- }
- this.scanner.skipSC();
- }
- switch (this.scanner.tokenType) {
- case SEMICOLON$4:
- this.scanner.next();
- break;
- case LEFTCURLYBRACKET$3:
- if (this.atrule.hasOwnProperty(nameLowerCase) &&
- typeof this.atrule[nameLowerCase].block === 'function') {
- block = this.atrule[nameLowerCase].block.call(this);
- } else {
- // TODO: should consume block content as Raw?
- block = this.Block(isDeclarationBlockAtrule.call(this));
- }
- break;
- }
- return {
- type: 'Atrule',
- loc: this.getLocation(start, this.scanner.tokenStart),
- name: name,
- prelude: prelude,
- block: block
- };
- },
- generate: function(node) {
- this.chunk('@');
- this.chunk(node.name);
- if (node.prelude !== null) {
- this.chunk(' ');
- this.node(node.prelude);
- }
- if (node.block) {
- this.node(node.block);
- } else {
- this.chunk(';');
- }
- },
- walkContext: 'atrule'
- };
- var TYPE$v = tokenizer$3.TYPE;
- var SEMICOLON$3 = TYPE$v.Semicolon;
- var LEFTCURLYBRACKET$2 = TYPE$v.LeftCurlyBracket;
- var AtrulePrelude = {
- name: 'AtrulePrelude',
- structure: {
- children: [[]]
- },
- parse: function(name) {
- var children = null;
- if (name !== null) {
- name = name.toLowerCase();
- }
- this.scanner.skipSC();
- if (this.atrule.hasOwnProperty(name) &&
- typeof this.atrule[name].prelude === 'function') {
- // custom consumer
- children = this.atrule[name].prelude.call(this);
- } else {
- // default consumer
- children = this.readSequence(this.scope.AtrulePrelude);
- }
- this.scanner.skipSC();
- if (this.scanner.eof !== true &&
- this.scanner.tokenType !== LEFTCURLYBRACKET$2 &&
- this.scanner.tokenType !== SEMICOLON$3) {
- this.error('Semicolon or block is expected');
- }
- if (children === null) {
- children = this.createList();
- }
- return {
- type: 'AtrulePrelude',
- loc: this.getLocationFromList(children),
- children: children
- };
- },
- generate: function(node) {
- this.children(node);
- },
- walkContext: 'atrulePrelude'
- };
- var TYPE$u = tokenizer$3.TYPE;
- var IDENT$e = TYPE$u.Ident;
- var STRING$3 = TYPE$u.String;
- var COLON$6 = TYPE$u.Colon;
- var LEFTSQUAREBRACKET$3 = TYPE$u.LeftSquareBracket;
- var RIGHTSQUAREBRACKET$1 = TYPE$u.RightSquareBracket;
- var DOLLARSIGN$1 = 0x0024; // U+0024 DOLLAR SIGN ($)
- var ASTERISK$5 = 0x002A; // U+002A ASTERISK (*)
- var EQUALSSIGN = 0x003D; // U+003D EQUALS SIGN (=)
- var CIRCUMFLEXACCENT = 0x005E; // U+005E (^)
- var VERTICALLINE$2 = 0x007C; // U+007C VERTICAL LINE (|)
- var TILDE$2 = 0x007E; // U+007E TILDE (~)
- function getAttributeName() {
- if (this.scanner.eof) {
- this.error('Unexpected end of input');
- }
- var start = this.scanner.tokenStart;
- var expectIdent = false;
- var checkColon = true;
- if (this.scanner.isDelim(ASTERISK$5)) {
- expectIdent = true;
- checkColon = false;
- this.scanner.next();
- } else if (!this.scanner.isDelim(VERTICALLINE$2)) {
- this.eat(IDENT$e);
- }
- if (this.scanner.isDelim(VERTICALLINE$2)) {
- if (this.scanner.source.charCodeAt(this.scanner.tokenStart + 1) !== EQUALSSIGN) {
- this.scanner.next();
- this.eat(IDENT$e);
- } else if (expectIdent) {
- this.error('Identifier is expected', this.scanner.tokenEnd);
- }
- } else if (expectIdent) {
- this.error('Vertical line is expected');
- }
- if (checkColon && this.scanner.tokenType === COLON$6) {
- this.scanner.next();
- this.eat(IDENT$e);
- }
- return {
- type: 'Identifier',
- loc: this.getLocation(start, this.scanner.tokenStart),
- name: this.scanner.substrToCursor(start)
- };
- }
- function getOperator() {
- var start = this.scanner.tokenStart;
- var code = this.scanner.source.charCodeAt(start);
- if (code !== EQUALSSIGN && // =
- code !== TILDE$2 && // ~=
- code !== CIRCUMFLEXACCENT && // ^=
- code !== DOLLARSIGN$1 && // $=
- code !== ASTERISK$5 && // *=
- code !== VERTICALLINE$2 // |=
- ) {
- this.error('Attribute selector (=, ~=, ^=, $=, *=, |=) is expected');
- }
- this.scanner.next();
- if (code !== EQUALSSIGN) {
- if (!this.scanner.isDelim(EQUALSSIGN)) {
- this.error('Equal sign is expected');
- }
- this.scanner.next();
- }
- return this.scanner.substrToCursor(start);
- }
- // '[' <wq-name> ']'
- // '[' <wq-name> <attr-matcher> [ <string-token> | <ident-token> ] <attr-modifier>? ']'
- var AttributeSelector = {
- name: 'AttributeSelector',
- structure: {
- name: 'Identifier',
- matcher: [String, null],
- value: ['String', 'Identifier', null],
- flags: [String, null]
- },
- parse: function() {
- var start = this.scanner.tokenStart;
- var name;
- var matcher = null;
- var value = null;
- var flags = null;
- this.eat(LEFTSQUAREBRACKET$3);
- this.scanner.skipSC();
- name = getAttributeName.call(this);
- this.scanner.skipSC();
- if (this.scanner.tokenType !== RIGHTSQUAREBRACKET$1) {
- // avoid case `[name i]`
- if (this.scanner.tokenType !== IDENT$e) {
- matcher = getOperator.call(this);
- this.scanner.skipSC();
- value = this.scanner.tokenType === STRING$3
- ? this.String()
- : this.Identifier();
- this.scanner.skipSC();
- }
- // attribute flags
- if (this.scanner.tokenType === IDENT$e) {
- flags = this.scanner.getTokenValue();
- this.scanner.next();
- this.scanner.skipSC();
- }
- }
- this.eat(RIGHTSQUAREBRACKET$1);
- return {
- type: 'AttributeSelector',
- loc: this.getLocation(start, this.scanner.tokenStart),
- name: name,
- matcher: matcher,
- value: value,
- flags: flags
- };
- },
- generate: function(node) {
- var flagsPrefix = ' ';
- this.chunk('[');
- this.node(node.name);
- if (node.matcher !== null) {
- this.chunk(node.matcher);
- if (node.value !== null) {
- this.node(node.value);
- // space between string and flags is not required
- if (node.value.type === 'String') {
- flagsPrefix = '';
- }
- }
- }
- if (node.flags !== null) {
- this.chunk(flagsPrefix);
- this.chunk(node.flags);
- }
- this.chunk(']');
- }
- };
- var TYPE$t = tokenizer$3.TYPE;
- var rawMode$4 = Raw.mode;
- var WHITESPACE$7 = TYPE$t.WhiteSpace;
- var COMMENT$5 = TYPE$t.Comment;
- var SEMICOLON$2 = TYPE$t.Semicolon;
- var ATKEYWORD$1 = TYPE$t.AtKeyword;
- var LEFTCURLYBRACKET$1 = TYPE$t.LeftCurlyBracket;
- var RIGHTCURLYBRACKET = TYPE$t.RightCurlyBracket;
- function consumeRaw$4(startToken) {
- return this.Raw(startToken, null, true);
- }
- function consumeRule() {
- return this.parseWithFallback(this.Rule, consumeRaw$4);
- }
- function consumeRawDeclaration(startToken) {
- return this.Raw(startToken, rawMode$4.semicolonIncluded, true);
- }
- function consumeDeclaration() {
- if (this.scanner.tokenType === SEMICOLON$2) {
- return consumeRawDeclaration.call(this, this.scanner.tokenIndex);
- }
- var node = this.parseWithFallback(this.Declaration, consumeRawDeclaration);
- if (this.scanner.tokenType === SEMICOLON$2) {
- this.scanner.next();
- }
- return node;
- }
- var Block = {
- name: 'Block',
- structure: {
- children: [[
- 'Atrule',
- 'Rule',
- 'Declaration'
- ]]
- },
- parse: function(isDeclaration) {
- var consumer = isDeclaration ? consumeDeclaration : consumeRule;
- var start = this.scanner.tokenStart;
- var children = this.createList();
- this.eat(LEFTCURLYBRACKET$1);
- scan:
- while (!this.scanner.eof) {
- switch (this.scanner.tokenType) {
- case RIGHTCURLYBRACKET:
- break scan;
- case WHITESPACE$7:
- case COMMENT$5:
- this.scanner.next();
- break;
- case ATKEYWORD$1:
- children.push(this.parseWithFallback(this.Atrule, consumeRaw$4));
- break;
- default:
- children.push(consumer.call(this));
- }
- }
- if (!this.scanner.eof) {
- this.eat(RIGHTCURLYBRACKET);
- }
- return {
- type: 'Block',
- loc: this.getLocation(start, this.scanner.tokenStart),
- children: children
- };
- },
- generate: function(node) {
- this.chunk('{');
- this.children(node, function(prev) {
- if (prev.type === 'Declaration') {
- this.chunk(';');
- }
- });
- this.chunk('}');
- },
- walkContext: 'block'
- };
- var TYPE$s = tokenizer$3.TYPE;
- var LEFTSQUAREBRACKET$2 = TYPE$s.LeftSquareBracket;
- var RIGHTSQUAREBRACKET = TYPE$s.RightSquareBracket;
- var Brackets = {
- name: 'Brackets',
- structure: {
- children: [[]]
- },
- parse: function(readSequence, recognizer) {
- var start = this.scanner.tokenStart;
- var children = null;
- this.eat(LEFTSQUAREBRACKET$2);
- children = readSequence.call(this, recognizer);
- if (!this.scanner.eof) {
- this.eat(RIGHTSQUAREBRACKET);
- }
- return {
- type: 'Brackets',
- loc: this.getLocation(start, this.scanner.tokenStart),
- children: children
- };
- },
- generate: function(node) {
- this.chunk('[');
- this.children(node);
- this.chunk(']');
- }
- };
- var CDC$1 = tokenizer$3.TYPE.CDC;
- var CDC_1 = {
- name: 'CDC',
- structure: [],
- parse: function() {
- var start = this.scanner.tokenStart;
- this.eat(CDC$1); // -->
- return {
- type: 'CDC',
- loc: this.getLocation(start, this.scanner.tokenStart)
- };
- },
- generate: function() {
- this.chunk('-->');
- }
- };
- var CDO$1 = tokenizer$3.TYPE.CDO;
- var CDO_1 = {
- name: 'CDO',
- structure: [],
- parse: function() {
- var start = this.scanner.tokenStart;
- this.eat(CDO$1); // <!--
- return {
- type: 'CDO',
- loc: this.getLocation(start, this.scanner.tokenStart)
- };
- },
- generate: function() {
- this.chunk('<!--');
- }
- };
- var TYPE$r = tokenizer$3.TYPE;
- var IDENT$d = TYPE$r.Ident;
- var FULLSTOP$2 = 0x002E; // U+002E FULL STOP (.)
- // '.' ident
- var ClassSelector = {
- name: 'ClassSelector',
- structure: {
- name: String
- },
- parse: function() {
- if (!this.scanner.isDelim(FULLSTOP$2)) {
- this.error('Full stop is expected');
- }
- this.scanner.next();
- return {
- type: 'ClassSelector',
- loc: this.getLocation(this.scanner.tokenStart - 1, this.scanner.tokenEnd),
- name: this.consume(IDENT$d)
- };
- },
- generate: function(node) {
- this.chunk('.');
- this.chunk(node.name);
- }
- };
- var TYPE$q = tokenizer$3.TYPE;
- var IDENT$c = TYPE$q.Ident;
- var PLUSSIGN$4 = 0x002B; // U+002B PLUS SIGN (+)
- var SOLIDUS$5 = 0x002F; // U+002F SOLIDUS (/)
- var GREATERTHANSIGN$1 = 0x003E; // U+003E GREATER-THAN SIGN (>)
- var TILDE$1 = 0x007E; // U+007E TILDE (~)
- // + | > | ~ | /deep/
- var Combinator = {
- name: 'Combinator',
- structure: {
- name: String
- },
- parse: function() {
- var start = this.scanner.tokenStart;
- var code = this.scanner.source.charCodeAt(this.scanner.tokenStart);
- switch (code) {
- case GREATERTHANSIGN$1:
- case PLUSSIGN$4:
- case TILDE$1:
- this.scanner.next();
- break;
- case SOLIDUS$5:
- this.scanner.next();
- if (this.scanner.tokenType !== IDENT$c || this.scanner.lookupValue(0, 'deep') === false) {
- this.error('Identifier `deep` is expected');
- }
- this.scanner.next();
- if (!this.scanner.isDelim(SOLIDUS$5)) {
- this.error('Solidus is expected');
- }
- this.scanner.next();
- break;
- default:
- this.error('Combinator is expected');
- }
- return {
- type: 'Combinator',
- loc: this.getLocation(start, this.scanner.tokenStart),
- name: this.scanner.substrToCursor(start)
- };
- },
- generate: function(node) {
- this.chunk(node.name);
- }
- };
- var TYPE$p = tokenizer$3.TYPE;
- var COMMENT$4 = TYPE$p.Comment;
- var ASTERISK$4 = 0x002A; // U+002A ASTERISK (*)
- var SOLIDUS$4 = 0x002F; // U+002F SOLIDUS (/)
- // '/*' .* '*/'
- var Comment = {
- name: 'Comment',
- structure: {
- value: String
- },
- parse: function() {
- var start = this.scanner.tokenStart;
- var end = this.scanner.tokenEnd;
- this.eat(COMMENT$4);
- if ((end - start + 2) >= 2 &&
- this.scanner.source.charCodeAt(end - 2) === ASTERISK$4 &&
- this.scanner.source.charCodeAt(end - 1) === SOLIDUS$4) {
- end -= 2;
- }
- return {
- type: 'Comment',
- loc: this.getLocation(start, this.scanner.tokenStart),
- value: this.scanner.source.substring(start + 2, end)
- };
- },
- generate: function(node) {
- this.chunk('/*');
- this.chunk(node.value);
- this.chunk('*/');
- }
- };
- var isCustomProperty = names$2.isCustomProperty;
- var TYPE$o = tokenizer$3.TYPE;
- var rawMode$3 = Raw.mode;
- var IDENT$b = TYPE$o.Ident;
- var HASH$4 = TYPE$o.Hash;
- var COLON$5 = TYPE$o.Colon;
- var SEMICOLON$1 = TYPE$o.Semicolon;
- var DELIM$4 = TYPE$o.Delim;
- var WHITESPACE$6 = TYPE$o.WhiteSpace;
- var EXCLAMATIONMARK$1 = 0x0021; // U+0021 EXCLAMATION MARK (!)
- var NUMBERSIGN$2 = 0x0023; // U+0023 NUMBER SIGN (#)
- var DOLLARSIGN = 0x0024; // U+0024 DOLLAR SIGN ($)
- var AMPERSAND = 0x0026; // U+0026 ANPERSAND (&)
- var ASTERISK$3 = 0x002A; // U+002A ASTERISK (*)
- var PLUSSIGN$3 = 0x002B; // U+002B PLUS SIGN (+)
- var SOLIDUS$3 = 0x002F; // U+002F SOLIDUS (/)
- function consumeValueRaw(startToken) {
- return this.Raw(startToken, rawMode$3.exclamationMarkOrSemicolon, true);
- }
- function consumeCustomPropertyRaw(startToken) {
- return this.Raw(startToken, rawMode$3.exclamationMarkOrSemicolon, false);
- }
- function consumeValue() {
- var startValueToken = this.scanner.tokenIndex;
- var value = this.Value();
- if (value.type !== 'Raw' &&
- this.scanner.eof === false &&
- this.scanner.tokenType !== SEMICOLON$1 &&
- this.scanner.isDelim(EXCLAMATIONMARK$1) === false &&
- this.scanner.isBalanceEdge(startValueToken) === false) {
- this.error();
- }
- return value;
- }
- var Declaration = {
- name: 'Declaration',
- structure: {
- important: [Boolean, String],
- property: String,
- value: ['Value', 'Raw']
- },
- parse: function() {
- var start = this.scanner.tokenStart;
- var startToken = this.scanner.tokenIndex;
- var property = readProperty.call(this);
- var customProperty = isCustomProperty(property);
- var parseValue = customProperty ? this.parseCustomProperty : this.parseValue;
- var consumeRaw = customProperty ? consumeCustomPropertyRaw : consumeValueRaw;
- var important = false;
- var value;
- this.scanner.skipSC();
- this.eat(COLON$5);
- const valueStart = this.scanner.tokenIndex;
- if (!customProperty) {
- this.scanner.skipSC();
- }
- if (parseValue) {
- value = this.parseWithFallback(consumeValue, consumeRaw);
- } else {
- value = consumeRaw.call(this, this.scanner.tokenIndex);
- }
- if (customProperty && value.type === 'Value' && value.children.isEmpty()) {
- for (let offset = valueStart - this.scanner.tokenIndex; offset <= 0; offset++) {
- if (this.scanner.lookupType(offset) === WHITESPACE$6) {
- value.children.appendData({
- type: 'WhiteSpace',
- loc: null,
- value: ' '
- });
- break;
- }
- }
- }
- if (this.scanner.isDelim(EXCLAMATIONMARK$1)) {
- important = getImportant.call(this);
- this.scanner.skipSC();
- }
- // Do not include semicolon to range per spec
- // https://drafts.csswg.org/css-syntax/#declaration-diagram
- if (this.scanner.eof === false &&
- this.scanner.tokenType !== SEMICOLON$1 &&
- this.scanner.isBalanceEdge(startToken) === false) {
- this.error();
- }
- return {
- type: 'Declaration',
- loc: this.getLocation(start, this.scanner.tokenStart),
- important: important,
- property: property,
- value: value
- };
- },
- generate: function(node) {
- this.chunk(node.property);
- this.chunk(':');
- this.node(node.value);
- if (node.important) {
- this.chunk(node.important === true ? '!important' : '!' + node.important);
- }
- },
- walkContext: 'declaration'
- };
- function readProperty() {
- var start = this.scanner.tokenStart;
- // hacks
- if (this.scanner.tokenType === DELIM$4) {
- switch (this.scanner.source.charCodeAt(this.scanner.tokenStart)) {
- case ASTERISK$3:
- case DOLLARSIGN:
- case PLUSSIGN$3:
- case NUMBERSIGN$2:
- case AMPERSAND:
- this.scanner.next();
- break;
- // TODO: not sure we should support this hack
- case SOLIDUS$3:
- this.scanner.next();
- if (this.scanner.isDelim(SOLIDUS$3)) {
- this.scanner.next();
- }
- break;
- }
- }
- if (this.scanner.tokenType === HASH$4) {
- this.eat(HASH$4);
- } else {
- this.eat(IDENT$b);
- }
- return this.scanner.substrToCursor(start);
- }
- // ! ws* important
- function getImportant() {
- this.eat(DELIM$4);
- this.scanner.skipSC();
- var important = this.consume(IDENT$b);
- // store original value in case it differ from `important`
- // for better original source restoring and hacks like `!ie` support
- return important === 'important' ? true : important;
- }
- var TYPE$n = tokenizer$3.TYPE;
- var rawMode$2 = Raw.mode;
- var WHITESPACE$5 = TYPE$n.WhiteSpace;
- var COMMENT$3 = TYPE$n.Comment;
- var SEMICOLON = TYPE$n.Semicolon;
- function consumeRaw$3(startToken) {
- return this.Raw(startToken, rawMode$2.semicolonIncluded, true);
- }
- var DeclarationList = {
- name: 'DeclarationList',
- structure: {
- children: [[
- 'Declaration'
- ]]
- },
- parse: function() {
- var children = this.createList();
- while (!this.scanner.eof) {
- switch (this.scanner.tokenType) {
- case WHITESPACE$5:
- case COMMENT$3:
- case SEMICOLON:
- this.scanner.next();
- break;
- default:
- children.push(this.parseWithFallback(this.Declaration, consumeRaw$3));
- }
- }
- return {
- type: 'DeclarationList',
- loc: this.getLocationFromList(children),
- children: children
- };
- },
- generate: function(node) {
- this.children(node, function(prev) {
- if (prev.type === 'Declaration') {
- this.chunk(';');
- }
- });
- }
- };
- var consumeNumber$2 = utils$2.consumeNumber;
- var TYPE$m = tokenizer$3.TYPE;
- var DIMENSION$4 = TYPE$m.Dimension;
- var Dimension = {
- name: 'Dimension',
- structure: {
- value: String,
- unit: String
- },
- parse: function() {
- var start = this.scanner.tokenStart;
- var numberEnd = consumeNumber$2(this.scanner.source, start);
- this.eat(DIMENSION$4);
- return {
- type: 'Dimension',
- loc: this.getLocation(start, this.scanner.tokenStart),
- value: this.scanner.source.substring(start, numberEnd),
- unit: this.scanner.source.substring(numberEnd, this.scanner.tokenStart)
- };
- },
- generate: function(node) {
- this.chunk(node.value);
- this.chunk(node.unit);
- }
- };
- var TYPE$l = tokenizer$3.TYPE;
- var RIGHTPARENTHESIS$5 = TYPE$l.RightParenthesis;
- // <function-token> <sequence> )
- var _Function = {
- name: 'Function',
- structure: {
- name: String,
- children: [[]]
- },
- parse: function(readSequence, recognizer) {
- var start = this.scanner.tokenStart;
- var name = this.consumeFunctionName();
- var nameLowerCase = name.toLowerCase();
- var children;
- children = recognizer.hasOwnProperty(nameLowerCase)
- ? recognizer[nameLowerCase].call(this, recognizer)
- : readSequence.call(this, recognizer);
- if (!this.scanner.eof) {
- this.eat(RIGHTPARENTHESIS$5);
- }
- return {
- type: 'Function',
- loc: this.getLocation(start, this.scanner.tokenStart),
- name: name,
- children: children
- };
- },
- generate: function(node) {
- this.chunk(node.name);
- this.chunk('(');
- this.children(node);
- this.chunk(')');
- },
- walkContext: 'function'
- };
- var TYPE$k = tokenizer$3.TYPE;
- var HASH$3 = TYPE$k.Hash;
- // '#' ident
- var Hash = {
- name: 'Hash',
- structure: {
- value: String
- },
- parse: function() {
- var start = this.scanner.tokenStart;
- this.eat(HASH$3);
- return {
- type: 'Hash',
- loc: this.getLocation(start, this.scanner.tokenStart),
- value: this.scanner.substrToCursor(start + 1)
- };
- },
- generate: function(node) {
- this.chunk('#');
- this.chunk(node.value);
- }
- };
- var TYPE$j = tokenizer$3.TYPE;
- var IDENT$a = TYPE$j.Ident;
- var Identifier = {
- name: 'Identifier',
- structure: {
- name: String
- },
- parse: function() {
- return {
- type: 'Identifier',
- loc: this.getLocation(this.scanner.tokenStart, this.scanner.tokenEnd),
- name: this.consume(IDENT$a)
- };
- },
- generate: function(node) {
- this.chunk(node.name);
- }
- };
- var TYPE$i = tokenizer$3.TYPE;
- var HASH$2 = TYPE$i.Hash;
- // <hash-token>
- var IdSelector = {
- name: 'IdSelector',
- structure: {
- name: String
- },
- parse: function() {
- var start = this.scanner.tokenStart;
- // TODO: check value is an ident
- this.eat(HASH$2);
- return {
- type: 'IdSelector',
- loc: this.getLocation(start, this.scanner.tokenStart),
- name: this.scanner.substrToCursor(start + 1)
- };
- },
- generate: function(node) {
- this.chunk('#');
- this.chunk(node.name);
- }
- };
- var TYPE$h = tokenizer$3.TYPE;
- var IDENT$9 = TYPE$h.Ident;
- var NUMBER$5 = TYPE$h.Number;
- var DIMENSION$3 = TYPE$h.Dimension;
- var LEFTPARENTHESIS$5 = TYPE$h.LeftParenthesis;
- var RIGHTPARENTHESIS$4 = TYPE$h.RightParenthesis;
- var COLON$4 = TYPE$h.Colon;
- var DELIM$3 = TYPE$h.Delim;
- var MediaFeature = {
- name: 'MediaFeature',
- structure: {
- name: String,
- value: ['Identifier', 'Number', 'Dimension', 'Ratio', null]
- },
- parse: function() {
- var start = this.scanner.tokenStart;
- var name;
- var value = null;
- this.eat(LEFTPARENTHESIS$5);
- this.scanner.skipSC();
- name = this.consume(IDENT$9);
- this.scanner.skipSC();
- if (this.scanner.tokenType !== RIGHTPARENTHESIS$4) {
- this.eat(COLON$4);
- this.scanner.skipSC();
- switch (this.scanner.tokenType) {
- case NUMBER$5:
- if (this.lookupNonWSType(1) === DELIM$3) {
- value = this.Ratio();
- } else {
- value = this.Number();
- }
- break;
- case DIMENSION$3:
- value = this.Dimension();
- break;
- case IDENT$9:
- value = this.Identifier();
- break;
- default:
- this.error('Number, dimension, ratio or identifier is expected');
- }
- this.scanner.skipSC();
- }
- this.eat(RIGHTPARENTHESIS$4);
- return {
- type: 'MediaFeature',
- loc: this.getLocation(start, this.scanner.tokenStart),
- name: name,
- value: value
- };
- },
- generate: function(node) {
- this.chunk('(');
- this.chunk(node.name);
- if (node.value !== null) {
- this.chunk(':');
- this.node(node.value);
- }
- this.chunk(')');
- }
- };
- var TYPE$g = tokenizer$3.TYPE;
- var WHITESPACE$4 = TYPE$g.WhiteSpace;
- var COMMENT$2 = TYPE$g.Comment;
- var IDENT$8 = TYPE$g.Ident;
- var LEFTPARENTHESIS$4 = TYPE$g.LeftParenthesis;
- var MediaQuery = {
- name: 'MediaQuery',
- structure: {
- children: [[
- 'Identifier',
- 'MediaFeature',
- 'WhiteSpace'
- ]]
- },
- parse: function() {
- this.scanner.skipSC();
- var children = this.createList();
- var child = null;
- var space = null;
- scan:
- while (!this.scanner.eof) {
- switch (this.scanner.tokenType) {
- case COMMENT$2:
- this.scanner.next();
- continue;
- case WHITESPACE$4:
- space = this.WhiteSpace();
- continue;
- case IDENT$8:
- child = this.Identifier();
- break;
- case LEFTPARENTHESIS$4:
- child = this.MediaFeature();
- break;
- default:
- break scan;
- }
- if (space !== null) {
- children.push(space);
- space = null;
- }
- children.push(child);
- }
- if (child === null) {
- this.error('Identifier or parenthesis is expected');
- }
- return {
- type: 'MediaQuery',
- loc: this.getLocationFromList(children),
- children: children
- };
- },
- generate: function(node) {
- this.children(node);
- }
- };
- var COMMA$3 = tokenizer$3.TYPE.Comma;
- var MediaQueryList = {
- name: 'MediaQueryList',
- structure: {
- children: [[
- 'MediaQuery'
- ]]
- },
- parse: function(relative) {
- var children = this.createList();
- this.scanner.skipSC();
- while (!this.scanner.eof) {
- children.push(this.MediaQuery(relative));
- if (this.scanner.tokenType !== COMMA$3) {
- break;
- }
- this.scanner.next();
- }
- return {
- type: 'MediaQueryList',
- loc: this.getLocationFromList(children),
- children: children
- };
- },
- generate: function(node) {
- this.children(node, function() {
- this.chunk(',');
- });
- }
- };
- var Nth = {
- name: 'Nth',
- structure: {
- nth: ['AnPlusB', 'Identifier'],
- selector: ['SelectorList', null]
- },
- parse: function(allowOfClause) {
- this.scanner.skipSC();
- var start = this.scanner.tokenStart;
- var end = start;
- var selector = null;
- var query;
- if (this.scanner.lookupValue(0, 'odd') || this.scanner.lookupValue(0, 'even')) {
- query = this.Identifier();
- } else {
- query = this.AnPlusB();
- }
- this.scanner.skipSC();
- if (allowOfClause && this.scanner.lookupValue(0, 'of')) {
- this.scanner.next();
- selector = this.SelectorList();
- if (this.needPositions) {
- end = this.getLastListNode(selector.children).loc.end.offset;
- }
- } else {
- if (this.needPositions) {
- end = query.loc.end.offset;
- }
- }
- return {
- type: 'Nth',
- loc: this.getLocation(start, end),
- nth: query,
- selector: selector
- };
- },
- generate: function(node) {
- this.node(node.nth);
- if (node.selector !== null) {
- this.chunk(' of ');
- this.node(node.selector);
- }
- }
- };
- var NUMBER$4 = tokenizer$3.TYPE.Number;
- var _Number = {
- name: 'Number',
- structure: {
- value: String
- },
- parse: function() {
- return {
- type: 'Number',
- loc: this.getLocation(this.scanner.tokenStart, this.scanner.tokenEnd),
- value: this.consume(NUMBER$4)
- };
- },
- generate: function(node) {
- this.chunk(node.value);
- }
- };
- // '/' | '*' | ',' | ':' | '+' | '-'
- var Operator = {
- name: 'Operator',
- structure: {
- value: String
- },
- parse: function() {
- var start = this.scanner.tokenStart;
- this.scanner.next();
- return {
- type: 'Operator',
- loc: this.getLocation(start, this.scanner.tokenStart),
- value: this.scanner.substrToCursor(start)
- };
- },
- generate: function(node) {
- this.chunk(node.value);
- }
- };
- var TYPE$f = tokenizer$3.TYPE;
- var LEFTPARENTHESIS$3 = TYPE$f.LeftParenthesis;
- var RIGHTPARENTHESIS$3 = TYPE$f.RightParenthesis;
- var Parentheses = {
- name: 'Parentheses',
- structure: {
- children: [[]]
- },
- parse: function(readSequence, recognizer) {
- var start = this.scanner.tokenStart;
- var children = null;
- this.eat(LEFTPARENTHESIS$3);
- children = readSequence.call(this, recognizer);
- if (!this.scanner.eof) {
- this.eat(RIGHTPARENTHESIS$3);
- }
- return {
- type: 'Parentheses',
- loc: this.getLocation(start, this.scanner.tokenStart),
- children: children
- };
- },
- generate: function(node) {
- this.chunk('(');
- this.children(node);
- this.chunk(')');
- }
- };
- var consumeNumber$1 = utils$2.consumeNumber;
- var TYPE$e = tokenizer$3.TYPE;
- var PERCENTAGE$2 = TYPE$e.Percentage;
- var Percentage = {
- name: 'Percentage',
- structure: {
- value: String
- },
- parse: function() {
- var start = this.scanner.tokenStart;
- var numberEnd = consumeNumber$1(this.scanner.source, start);
- this.eat(PERCENTAGE$2);
- return {
- type: 'Percentage',
- loc: this.getLocation(start, this.scanner.tokenStart),
- value: this.scanner.source.substring(start, numberEnd)
- };
- },
- generate: function(node) {
- this.chunk(node.value);
- this.chunk('%');
- }
- };
- var TYPE$d = tokenizer$3.TYPE;
- var IDENT$7 = TYPE$d.Ident;
- var FUNCTION$5 = TYPE$d.Function;
- var COLON$3 = TYPE$d.Colon;
- var RIGHTPARENTHESIS$2 = TYPE$d.RightParenthesis;
- // : [ <ident> | <function-token> <any-value>? ) ]
- var PseudoClassSelector = {
- name: 'PseudoClassSelector',
- structure: {
- name: String,
- children: [['Raw'], null]
- },
- parse: function() {
- var start = this.scanner.tokenStart;
- var children = null;
- var name;
- var nameLowerCase;
- this.eat(COLON$3);
- if (this.scanner.tokenType === FUNCTION$5) {
- name = this.consumeFunctionName();
- nameLowerCase = name.toLowerCase();
- if (this.pseudo.hasOwnProperty(nameLowerCase)) {
- this.scanner.skipSC();
- children = this.pseudo[nameLowerCase].call(this);
- this.scanner.skipSC();
- } else {
- children = this.createList();
- children.push(
- this.Raw(this.scanner.tokenIndex, null, false)
- );
- }
- this.eat(RIGHTPARENTHESIS$2);
- } else {
- name = this.consume(IDENT$7);
- }
- return {
- type: 'PseudoClassSelector',
- loc: this.getLocation(start, this.scanner.tokenStart),
- name: name,
- children: children
- };
- },
- generate: function(node) {
- this.chunk(':');
- this.chunk(node.name);
- if (node.children !== null) {
- this.chunk('(');
- this.children(node);
- this.chunk(')');
- }
- },
- walkContext: 'function'
- };
- var TYPE$c = tokenizer$3.TYPE;
- var IDENT$6 = TYPE$c.Ident;
- var FUNCTION$4 = TYPE$c.Function;
- var COLON$2 = TYPE$c.Colon;
- var RIGHTPARENTHESIS$1 = TYPE$c.RightParenthesis;
- // :: [ <ident> | <function-token> <any-value>? ) ]
- var PseudoElementSelector = {
- name: 'PseudoElementSelector',
- structure: {
- name: String,
- children: [['Raw'], null]
- },
- parse: function() {
- var start = this.scanner.tokenStart;
- var children = null;
- var name;
- var nameLowerCase;
- this.eat(COLON$2);
- this.eat(COLON$2);
- if (this.scanner.tokenType === FUNCTION$4) {
- name = this.consumeFunctionName();
- nameLowerCase = name.toLowerCase();
- if (this.pseudo.hasOwnProperty(nameLowerCase)) {
- this.scanner.skipSC();
- children = this.pseudo[nameLowerCase].call(this);
- this.scanner.skipSC();
- } else {
- children = this.createList();
- children.push(
- this.Raw(this.scanner.tokenIndex, null, false)
- );
- }
- this.eat(RIGHTPARENTHESIS$1);
- } else {
- name = this.consume(IDENT$6);
- }
- return {
- type: 'PseudoElementSelector',
- loc: this.getLocation(start, this.scanner.tokenStart),
- name: name,
- children: children
- };
- },
- generate: function(node) {
- this.chunk('::');
- this.chunk(node.name);
- if (node.children !== null) {
- this.chunk('(');
- this.children(node);
- this.chunk(')');
- }
- },
- walkContext: 'function'
- };
- var isDigit = tokenizer$3.isDigit;
- var TYPE$b = tokenizer$3.TYPE;
- var NUMBER$3 = TYPE$b.Number;
- var DELIM$2 = TYPE$b.Delim;
- var SOLIDUS$2 = 0x002F; // U+002F SOLIDUS (/)
- var FULLSTOP$1 = 0x002E; // U+002E FULL STOP (.)
- // Terms of <ratio> should be a positive numbers (not zero or negative)
- // (see https://drafts.csswg.org/mediaqueries-3/#values)
- // However, -o-min-device-pixel-ratio takes fractional values as a ratio's term
- // and this is using by various sites. Therefore we relax checking on parse
- // to test a term is unsigned number without an exponent part.
- // Additional checking may be applied on lexer validation.
- function consumeNumber() {
- this.scanner.skipWS();
- var value = this.consume(NUMBER$3);
- for (var i = 0; i < value.length; i++) {
- var code = value.charCodeAt(i);
- if (!isDigit(code) && code !== FULLSTOP$1) {
- this.error('Unsigned number is expected', this.scanner.tokenStart - value.length + i);
- }
- }
- if (Number(value) === 0) {
- this.error('Zero number is not allowed', this.scanner.tokenStart - value.length);
- }
- return value;
- }
- // <positive-integer> S* '/' S* <positive-integer>
- var Ratio = {
- name: 'Ratio',
- structure: {
- left: String,
- right: String
- },
- parse: function() {
- var start = this.scanner.tokenStart;
- var left = consumeNumber.call(this);
- var right;
- this.scanner.skipWS();
- if (!this.scanner.isDelim(SOLIDUS$2)) {
- this.error('Solidus is expected');
- }
- this.eat(DELIM$2);
- right = consumeNumber.call(this);
- return {
- type: 'Ratio',
- loc: this.getLocation(start, this.scanner.tokenStart),
- left: left,
- right: right
- };
- },
- generate: function(node) {
- this.chunk(node.left);
- this.chunk('/');
- this.chunk(node.right);
- }
- };
- var TYPE$a = tokenizer$3.TYPE;
- var rawMode$1 = Raw.mode;
- var LEFTCURLYBRACKET = TYPE$a.LeftCurlyBracket;
- function consumeRaw$2(startToken) {
- return this.Raw(startToken, rawMode$1.leftCurlyBracket, true);
- }
- function consumePrelude() {
- var prelude = this.SelectorList();
- if (prelude.type !== 'Raw' &&
- this.scanner.eof === false &&
- this.scanner.tokenType !== LEFTCURLYBRACKET) {
- this.error();
- }
- return prelude;
- }
- var Rule = {
- name: 'Rule',
- structure: {
- prelude: ['SelectorList', 'Raw'],
- block: ['Block']
- },
- parse: function() {
- var startToken = this.scanner.tokenIndex;
- var startOffset = this.scanner.tokenStart;
- var prelude;
- var block;
- if (this.parseRulePrelude) {
- prelude = this.parseWithFallback(consumePrelude, consumeRaw$2);
- } else {
- prelude = consumeRaw$2.call(this, startToken);
- }
- block = this.Block(true);
- return {
- type: 'Rule',
- loc: this.getLocation(startOffset, this.scanner.tokenStart),
- prelude: prelude,
- block: block
- };
- },
- generate: function(node) {
- this.node(node.prelude);
- this.node(node.block);
- },
- walkContext: 'rule'
- };
- var Selector = {
- name: 'Selector',
- structure: {
- children: [[
- 'TypeSelector',
- 'IdSelector',
- 'ClassSelector',
- 'AttributeSelector',
- 'PseudoClassSelector',
- 'PseudoElementSelector',
- 'Combinator',
- 'WhiteSpace'
- ]]
- },
- parse: function() {
- var children = this.readSequence(this.scope.Selector);
- // nothing were consumed
- if (this.getFirstListNode(children) === null) {
- this.error('Selector is expected');
- }
- return {
- type: 'Selector',
- loc: this.getLocationFromList(children),
- children: children
- };
- },
- generate: function(node) {
- this.children(node);
- }
- };
- var TYPE$9 = tokenizer$3.TYPE;
- var COMMA$2 = TYPE$9.Comma;
- var SelectorList = {
- name: 'SelectorList',
- structure: {
- children: [[
- 'Selector',
- 'Raw'
- ]]
- },
- parse: function() {
- var children = this.createList();
- while (!this.scanner.eof) {
- children.push(this.Selector());
- if (this.scanner.tokenType === COMMA$2) {
- this.scanner.next();
- continue;
- }
- break;
- }
- return {
- type: 'SelectorList',
- loc: this.getLocationFromList(children),
- children: children
- };
- },
- generate: function(node) {
- this.children(node, function() {
- this.chunk(',');
- });
- },
- walkContext: 'selector'
- };
- var STRING$2 = tokenizer$3.TYPE.String;
- var _String = {
- name: 'String',
- structure: {
- value: String
- },
- parse: function() {
- return {
- type: 'String',
- loc: this.getLocation(this.scanner.tokenStart, this.scanner.tokenEnd),
- value: this.consume(STRING$2)
- };
- },
- generate: function(node) {
- this.chunk(node.value);
- }
- };
- var TYPE$8 = tokenizer$3.TYPE;
- var WHITESPACE$3 = TYPE$8.WhiteSpace;
- var COMMENT$1 = TYPE$8.Comment;
- var ATKEYWORD = TYPE$8.AtKeyword;
- var CDO = TYPE$8.CDO;
- var CDC = TYPE$8.CDC;
- var EXCLAMATIONMARK = 0x0021; // U+0021 EXCLAMATION MARK (!)
- function consumeRaw$1(startToken) {
- return this.Raw(startToken, null, false);
- }
- var StyleSheet = {
- name: 'StyleSheet',
- structure: {
- children: [[
- 'Comment',
- 'CDO',
- 'CDC',
- 'Atrule',
- 'Rule',
- 'Raw'
- ]]
- },
- parse: function() {
- var start = this.scanner.tokenStart;
- var children = this.createList();
- var child;
- while (!this.scanner.eof) {
- switch (this.scanner.tokenType) {
- case WHITESPACE$3:
- this.scanner.next();
- continue;
- case COMMENT$1:
- // ignore comments except exclamation comments (i.e. /*! .. */) on top level
- if (this.scanner.source.charCodeAt(this.scanner.tokenStart + 2) !== EXCLAMATIONMARK) {
- this.scanner.next();
- continue;
- }
- child = this.Comment();
- break;
- case CDO: // <!--
- child = this.CDO();
- break;
- case CDC: // -->
- child = this.CDC();
- break;
- // CSS Syntax Module Level 3
- // §2.2 Error handling
- // At the "top level" of a stylesheet, an <at-keyword-token> starts an at-rule.
- case ATKEYWORD:
- child = this.parseWithFallback(this.Atrule, consumeRaw$1);
- break;
- // Anything else starts a qualified rule ...
- default:
- child = this.parseWithFallback(this.Rule, consumeRaw$1);
- }
- children.push(child);
- }
- return {
- type: 'StyleSheet',
- loc: this.getLocation(start, this.scanner.tokenStart),
- children: children
- };
- },
- generate: function(node) {
- this.children(node);
- },
- walkContext: 'stylesheet'
- };
- var TYPE$7 = tokenizer$3.TYPE;
- var IDENT$5 = TYPE$7.Ident;
- var ASTERISK$2 = 0x002A; // U+002A ASTERISK (*)
- var VERTICALLINE$1 = 0x007C; // U+007C VERTICAL LINE (|)
- function eatIdentifierOrAsterisk() {
- if (this.scanner.tokenType !== IDENT$5 &&
- this.scanner.isDelim(ASTERISK$2) === false) {
- this.error('Identifier or asterisk is expected');
- }
- this.scanner.next();
- }
- // ident
- // ident|ident
- // ident|*
- // *
- // *|ident
- // *|*
- // |ident
- // |*
- var TypeSelector = {
- name: 'TypeSelector',
- structure: {
- name: String
- },
- parse: function() {
- var start = this.scanner.tokenStart;
- if (this.scanner.isDelim(VERTICALLINE$1)) {
- this.scanner.next();
- eatIdentifierOrAsterisk.call(this);
- } else {
- eatIdentifierOrAsterisk.call(this);
- if (this.scanner.isDelim(VERTICALLINE$1)) {
- this.scanner.next();
- eatIdentifierOrAsterisk.call(this);
- }
- }
- return {
- type: 'TypeSelector',
- loc: this.getLocation(start, this.scanner.tokenStart),
- name: this.scanner.substrToCursor(start)
- };
- },
- generate: function(node) {
- this.chunk(node.name);
- }
- };
- var isHexDigit = tokenizer$3.isHexDigit;
- var cmpChar$1 = tokenizer$3.cmpChar;
- var TYPE$6 = tokenizer$3.TYPE;
- var NAME = tokenizer$3.NAME;
- var IDENT$4 = TYPE$6.Ident;
- var NUMBER$2 = TYPE$6.Number;
- var DIMENSION$2 = TYPE$6.Dimension;
- var PLUSSIGN$2 = 0x002B; // U+002B PLUS SIGN (+)
- var HYPHENMINUS$1 = 0x002D; // U+002D HYPHEN-MINUS (-)
- var QUESTIONMARK = 0x003F; // U+003F QUESTION MARK (?)
- var U$1 = 0x0075; // U+0075 LATIN SMALL LETTER U (u)
- function eatHexSequence(offset, allowDash) {
- for (var pos = this.scanner.tokenStart + offset, len = 0; pos < this.scanner.tokenEnd; pos++) {
- var code = this.scanner.source.charCodeAt(pos);
- if (code === HYPHENMINUS$1 && allowDash && len !== 0) {
- if (eatHexSequence.call(this, offset + len + 1, false) === 0) {
- this.error();
- }
- return -1;
- }
- if (!isHexDigit(code)) {
- this.error(
- allowDash && len !== 0
- ? 'HyphenMinus' + (len < 6 ? ' or hex digit' : '') + ' is expected'
- : (len < 6 ? 'Hex digit is expected' : 'Unexpected input'),
- pos
- );
- }
- if (++len > 6) {
- this.error('Too many hex digits', pos);
- } }
- this.scanner.next();
- return len;
- }
- function eatQuestionMarkSequence(max) {
- var count = 0;
- while (this.scanner.isDelim(QUESTIONMARK)) {
- if (++count > max) {
- this.error('Too many question marks');
- }
- this.scanner.next();
- }
- }
- function startsWith(code) {
- if (this.scanner.source.charCodeAt(this.scanner.tokenStart) !== code) {
- this.error(NAME[code] + ' is expected');
- }
- }
- // https://drafts.csswg.org/css-syntax/#urange
- // Informally, the <urange> production has three forms:
- // U+0001
- // Defines a range consisting of a single code point, in this case the code point "1".
- // U+0001-00ff
- // Defines a range of codepoints between the first and the second value, in this case
- // the range between "1" and "ff" (255 in decimal) inclusive.
- // U+00??
- // Defines a range of codepoints where the "?" characters range over all hex digits,
- // in this case defining the same as the value U+0000-00ff.
- // In each form, a maximum of 6 digits is allowed for each hexadecimal number (if you treat "?" as a hexadecimal digit).
- //
- // <urange> =
- // u '+' <ident-token> '?'* |
- // u <dimension-token> '?'* |
- // u <number-token> '?'* |
- // u <number-token> <dimension-token> |
- // u <number-token> <number-token> |
- // u '+' '?'+
- function scanUnicodeRange() {
- var hexLength = 0;
- // u '+' <ident-token> '?'*
- // u '+' '?'+
- if (this.scanner.isDelim(PLUSSIGN$2)) {
- this.scanner.next();
- if (this.scanner.tokenType === IDENT$4) {
- hexLength = eatHexSequence.call(this, 0, true);
- if (hexLength > 0) {
- eatQuestionMarkSequence.call(this, 6 - hexLength);
- }
- return;
- }
- if (this.scanner.isDelim(QUESTIONMARK)) {
- this.scanner.next();
- eatQuestionMarkSequence.call(this, 5);
- return;
- }
- this.error('Hex digit or question mark is expected');
- return;
- }
- // u <number-token> '?'*
- // u <number-token> <dimension-token>
- // u <number-token> <number-token>
- if (this.scanner.tokenType === NUMBER$2) {
- startsWith.call(this, PLUSSIGN$2);
- hexLength = eatHexSequence.call(this, 1, true);
- if (this.scanner.isDelim(QUESTIONMARK)) {
- eatQuestionMarkSequence.call(this, 6 - hexLength);
- return;
- }
- if (this.scanner.tokenType === DIMENSION$2 ||
- this.scanner.tokenType === NUMBER$2) {
- startsWith.call(this, HYPHENMINUS$1);
- eatHexSequence.call(this, 1, false);
- return;
- }
- return;
- }
- // u <dimension-token> '?'*
- if (this.scanner.tokenType === DIMENSION$2) {
- startsWith.call(this, PLUSSIGN$2);
- hexLength = eatHexSequence.call(this, 1, true);
- if (hexLength > 0) {
- eatQuestionMarkSequence.call(this, 6 - hexLength);
- }
- return;
- }
- this.error();
- }
- var UnicodeRange = {
- name: 'UnicodeRange',
- structure: {
- value: String
- },
- parse: function() {
- var start = this.scanner.tokenStart;
- // U or u
- if (!cmpChar$1(this.scanner.source, start, U$1)) {
- this.error('U is expected');
- }
- if (!cmpChar$1(this.scanner.source, start + 1, PLUSSIGN$2)) {
- this.error('Plus sign is expected');
- }
- this.scanner.next();
- scanUnicodeRange.call(this);
- return {
- type: 'UnicodeRange',
- loc: this.getLocation(start, this.scanner.tokenStart),
- value: this.scanner.substrToCursor(start)
- };
- },
- generate: function(node) {
- this.chunk(node.value);
- }
- };
- var isWhiteSpace = tokenizer$3.isWhiteSpace;
- var cmpStr$1 = tokenizer$3.cmpStr;
- var TYPE$5 = tokenizer$3.TYPE;
- var FUNCTION$3 = TYPE$5.Function;
- var URL$3 = TYPE$5.Url;
- var RIGHTPARENTHESIS = TYPE$5.RightParenthesis;
- // <url-token> | <function-token> <string> )
- var Url = {
- name: 'Url',
- structure: {
- value: ['String', 'Raw']
- },
- parse: function() {
- var start = this.scanner.tokenStart;
- var value;
- switch (this.scanner.tokenType) {
- case URL$3:
- var rawStart = start + 4;
- var rawEnd = this.scanner.tokenEnd - 1;
- while (rawStart < rawEnd && isWhiteSpace(this.scanner.source.charCodeAt(rawStart))) {
- rawStart++;
- }
- while (rawStart < rawEnd && isWhiteSpace(this.scanner.source.charCodeAt(rawEnd - 1))) {
- rawEnd--;
- }
- value = {
- type: 'Raw',
- loc: this.getLocation(rawStart, rawEnd),
- value: this.scanner.source.substring(rawStart, rawEnd)
- };
- this.eat(URL$3);
- break;
- case FUNCTION$3:
- if (!cmpStr$1(this.scanner.source, this.scanner.tokenStart, this.scanner.tokenEnd, 'url(')) {
- this.error('Function name must be `url`');
- }
- this.eat(FUNCTION$3);
- this.scanner.skipSC();
- value = this.String();
- this.scanner.skipSC();
- this.eat(RIGHTPARENTHESIS);
- break;
- default:
- this.error('Url or Function is expected');
- }
- return {
- type: 'Url',
- loc: this.getLocation(start, this.scanner.tokenStart),
- value: value
- };
- },
- generate: function(node) {
- this.chunk('url');
- this.chunk('(');
- this.node(node.value);
- this.chunk(')');
- }
- };
- var Value = {
- name: 'Value',
- structure: {
- children: [[]]
- },
- parse: function() {
- var start = this.scanner.tokenStart;
- var children = this.readSequence(this.scope.Value);
- return {
- type: 'Value',
- loc: this.getLocation(start, this.scanner.tokenStart),
- children: children
- };
- },
- generate: function(node) {
- this.children(node);
- }
- };
- var WHITESPACE$2 = tokenizer$3.TYPE.WhiteSpace;
- var SPACE = Object.freeze({
- type: 'WhiteSpace',
- loc: null,
- value: ' '
- });
- var WhiteSpace = {
- name: 'WhiteSpace',
- structure: {
- value: String
- },
- parse: function() {
- this.eat(WHITESPACE$2);
- return SPACE;
- // return {
- // type: 'WhiteSpace',
- // loc: this.getLocation(this.scanner.tokenStart, this.scanner.tokenEnd),
- // value: this.consume(WHITESPACE)
- // };
- },
- generate: function(node) {
- this.chunk(node.value);
- }
- };
- var node = {
- AnPlusB: AnPlusB,
- Atrule: Atrule,
- AtrulePrelude: AtrulePrelude,
- AttributeSelector: AttributeSelector,
- Block: Block,
- Brackets: Brackets,
- CDC: CDC_1,
- CDO: CDO_1,
- ClassSelector: ClassSelector,
- Combinator: Combinator,
- Comment: Comment,
- Declaration: Declaration,
- DeclarationList: DeclarationList,
- Dimension: Dimension,
- Function: _Function,
- Hash: Hash,
- Identifier: Identifier,
- IdSelector: IdSelector,
- MediaFeature: MediaFeature,
- MediaQuery: MediaQuery,
- MediaQueryList: MediaQueryList,
- Nth: Nth,
- Number: _Number,
- Operator: Operator,
- Parentheses: Parentheses,
- Percentage: Percentage,
- PseudoClassSelector: PseudoClassSelector,
- PseudoElementSelector: PseudoElementSelector,
- Ratio: Ratio,
- Raw: Raw,
- Rule: Rule,
- Selector: Selector,
- SelectorList: SelectorList,
- String: _String,
- StyleSheet: StyleSheet,
- TypeSelector: TypeSelector,
- UnicodeRange: UnicodeRange,
- Url: Url,
- Value: Value,
- WhiteSpace: WhiteSpace
- };
- var data = data$1;
- var lexer = {
- generic: true,
- types: data.types,
- atrules: data.atrules,
- properties: data.properties,
- node: node
- };
- var cmpChar = tokenizer$3.cmpChar;
- var cmpStr = tokenizer$3.cmpStr;
- var TYPE$4 = tokenizer$3.TYPE;
- var IDENT$3 = TYPE$4.Ident;
- var STRING$1 = TYPE$4.String;
- var NUMBER$1 = TYPE$4.Number;
- var FUNCTION$2 = TYPE$4.Function;
- var URL$2 = TYPE$4.Url;
- var HASH$1 = TYPE$4.Hash;
- var DIMENSION$1 = TYPE$4.Dimension;
- var PERCENTAGE$1 = TYPE$4.Percentage;
- var LEFTPARENTHESIS$2 = TYPE$4.LeftParenthesis;
- var LEFTSQUAREBRACKET$1 = TYPE$4.LeftSquareBracket;
- var COMMA$1 = TYPE$4.Comma;
- var DELIM$1 = TYPE$4.Delim;
- var NUMBERSIGN$1 = 0x0023; // U+0023 NUMBER SIGN (#)
- var ASTERISK$1 = 0x002A; // U+002A ASTERISK (*)
- var PLUSSIGN$1 = 0x002B; // U+002B PLUS SIGN (+)
- var HYPHENMINUS = 0x002D; // U+002D HYPHEN-MINUS (-)
- var SOLIDUS$1 = 0x002F; // U+002F SOLIDUS (/)
- var U = 0x0075; // U+0075 LATIN SMALL LETTER U (u)
- var _default = function defaultRecognizer(context) {
- switch (this.scanner.tokenType) {
- case HASH$1:
- return this.Hash();
- case COMMA$1:
- context.space = null;
- context.ignoreWSAfter = true;
- return this.Operator();
- case LEFTPARENTHESIS$2:
- return this.Parentheses(this.readSequence, context.recognizer);
- case LEFTSQUAREBRACKET$1:
- return this.Brackets(this.readSequence, context.recognizer);
- case STRING$1:
- return this.String();
- case DIMENSION$1:
- return this.Dimension();
- case PERCENTAGE$1:
- return this.Percentage();
- case NUMBER$1:
- return this.Number();
- case FUNCTION$2:
- return cmpStr(this.scanner.source, this.scanner.tokenStart, this.scanner.tokenEnd, 'url(')
- ? this.Url()
- : this.Function(this.readSequence, context.recognizer);
- case URL$2:
- return this.Url();
- case IDENT$3:
- // check for unicode range, it should start with u+ or U+
- if (cmpChar(this.scanner.source, this.scanner.tokenStart, U) &&
- cmpChar(this.scanner.source, this.scanner.tokenStart + 1, PLUSSIGN$1)) {
- return this.UnicodeRange();
- } else {
- return this.Identifier();
- }
- case DELIM$1:
- var code = this.scanner.source.charCodeAt(this.scanner.tokenStart);
- if (code === SOLIDUS$1 ||
- code === ASTERISK$1 ||
- code === PLUSSIGN$1 ||
- code === HYPHENMINUS) {
- return this.Operator(); // TODO: replace with Delim
- }
- // TODO: produce a node with Delim node type
- if (code === NUMBERSIGN$1) {
- this.error('Hex or identifier is expected', this.scanner.tokenStart + 1);
- }
- break;
- }
- };
- var atrulePrelude = {
- getNode: _default
- };
- var TYPE$3 = tokenizer$3.TYPE;
- var DELIM = TYPE$3.Delim;
- var IDENT$2 = TYPE$3.Ident;
- var DIMENSION = TYPE$3.Dimension;
- var PERCENTAGE = TYPE$3.Percentage;
- var NUMBER = TYPE$3.Number;
- var HASH = TYPE$3.Hash;
- var COLON$1 = TYPE$3.Colon;
- var LEFTSQUAREBRACKET = TYPE$3.LeftSquareBracket;
- var NUMBERSIGN = 0x0023; // U+0023 NUMBER SIGN (#)
- var ASTERISK = 0x002A; // U+002A ASTERISK (*)
- var PLUSSIGN = 0x002B; // U+002B PLUS SIGN (+)
- var SOLIDUS = 0x002F; // U+002F SOLIDUS (/)
- var FULLSTOP = 0x002E; // U+002E FULL STOP (.)
- var GREATERTHANSIGN = 0x003E; // U+003E GREATER-THAN SIGN (>)
- var VERTICALLINE = 0x007C; // U+007C VERTICAL LINE (|)
- var TILDE = 0x007E; // U+007E TILDE (~)
- function getNode(context) {
- switch (this.scanner.tokenType) {
- case LEFTSQUAREBRACKET:
- return this.AttributeSelector();
- case HASH:
- return this.IdSelector();
- case COLON$1:
- if (this.scanner.lookupType(1) === COLON$1) {
- return this.PseudoElementSelector();
- } else {
- return this.PseudoClassSelector();
- }
- case IDENT$2:
- return this.TypeSelector();
- case NUMBER:
- case PERCENTAGE:
- return this.Percentage();
- case DIMENSION:
- // throws when .123ident
- if (this.scanner.source.charCodeAt(this.scanner.tokenStart) === FULLSTOP) {
- this.error('Identifier is expected', this.scanner.tokenStart + 1);
- }
- break;
- case DELIM:
- var code = this.scanner.source.charCodeAt(this.scanner.tokenStart);
- switch (code) {
- case PLUSSIGN:
- case GREATERTHANSIGN:
- case TILDE:
- context.space = null;
- context.ignoreWSAfter = true;
- return this.Combinator();
- case SOLIDUS: // /deep/
- return this.Combinator();
- case FULLSTOP:
- return this.ClassSelector();
- case ASTERISK:
- case VERTICALLINE:
- return this.TypeSelector();
- case NUMBERSIGN:
- return this.IdSelector();
- }
- break;
- }
- }
- var selector = {
- getNode: getNode
- };
- // legacy IE function
- // expression( <any-value> )
- var expression = function() {
- return this.createSingleNodeList(
- this.Raw(this.scanner.tokenIndex, null, false)
- );
- };
- var TYPE$2 = tokenizer$3.TYPE;
- var rawMode = Raw.mode;
- var COMMA = TYPE$2.Comma;
- var WHITESPACE$1 = TYPE$2.WhiteSpace;
- // var( <ident> , <value>? )
- var _var = function() {
- var children = this.createList();
- this.scanner.skipSC();
- // NOTE: Don't check more than a first argument is an ident, rest checks are for lexer
- children.push(this.Identifier());
- this.scanner.skipSC();
- if (this.scanner.tokenType === COMMA) {
- children.push(this.Operator());
- const startIndex = this.scanner.tokenIndex;
- const value = this.parseCustomProperty
- ? this.Value(null)
- : this.Raw(this.scanner.tokenIndex, rawMode.exclamationMarkOrSemicolon, false);
- if (value.type === 'Value' && value.children.isEmpty()) {
- for (let offset = startIndex - this.scanner.tokenIndex; offset <= 0; offset++) {
- if (this.scanner.lookupType(offset) === WHITESPACE$1) {
- value.children.appendData({
- type: 'WhiteSpace',
- loc: null,
- value: ' '
- });
- break;
- }
- }
- }
- children.push(value);
- }
- return children;
- };
- var value$2 = {
- getNode: _default,
- 'expression': expression,
- 'var': _var
- };
- var scope = {
- AtrulePrelude: atrulePrelude,
- Selector: selector,
- Value: value$2
- };
- var fontFace = {
- parse: {
- prelude: null,
- block: function() {
- return this.Block(true);
- }
- }
- };
- var TYPE$1 = tokenizer$3.TYPE;
- var STRING = TYPE$1.String;
- var IDENT$1 = TYPE$1.Ident;
- var URL$1 = TYPE$1.Url;
- var FUNCTION$1 = TYPE$1.Function;
- var LEFTPARENTHESIS$1 = TYPE$1.LeftParenthesis;
- var _import = {
- parse: {
- prelude: function() {
- var children = this.createList();
- this.scanner.skipSC();
- switch (this.scanner.tokenType) {
- case STRING:
- children.push(this.String());
- break;
- case URL$1:
- case FUNCTION$1:
- children.push(this.Url());
- break;
- default:
- this.error('String or url() is expected');
- }
- if (this.lookupNonWSType(0) === IDENT$1 ||
- this.lookupNonWSType(0) === LEFTPARENTHESIS$1) {
- children.push(this.WhiteSpace());
- children.push(this.MediaQueryList());
- }
- return children;
- },
- block: null
- }
- };
- var media = {
- parse: {
- prelude: function() {
- return this.createSingleNodeList(
- this.MediaQueryList()
- );
- },
- block: function() {
- return this.Block(false);
- }
- }
- };
- var page = {
- parse: {
- prelude: function() {
- return this.createSingleNodeList(
- this.SelectorList()
- );
- },
- block: function() {
- return this.Block(true);
- }
- }
- };
- var TYPE = tokenizer$3.TYPE;
- var WHITESPACE = TYPE.WhiteSpace;
- var COMMENT = TYPE.Comment;
- var IDENT = TYPE.Ident;
- var FUNCTION = TYPE.Function;
- var COLON = TYPE.Colon;
- var LEFTPARENTHESIS = TYPE.LeftParenthesis;
- function consumeRaw() {
- return this.createSingleNodeList(
- this.Raw(this.scanner.tokenIndex, null, false)
- );
- }
- function parentheses() {
- this.scanner.skipSC();
- if (this.scanner.tokenType === IDENT &&
- this.lookupNonWSType(1) === COLON) {
- return this.createSingleNodeList(
- this.Declaration()
- );
- }
- return readSequence.call(this);
- }
- function readSequence() {
- var children = this.createList();
- var space = null;
- var child;
- this.scanner.skipSC();
- scan:
- while (!this.scanner.eof) {
- switch (this.scanner.tokenType) {
- case WHITESPACE:
- space = this.WhiteSpace();
- continue;
- case COMMENT:
- this.scanner.next();
- continue;
- case FUNCTION:
- child = this.Function(consumeRaw, this.scope.AtrulePrelude);
- break;
- case IDENT:
- child = this.Identifier();
- break;
- case LEFTPARENTHESIS:
- child = this.Parentheses(parentheses, this.scope.AtrulePrelude);
- break;
- default:
- break scan;
- }
- if (space !== null) {
- children.push(space);
- space = null;
- }
- children.push(child);
- }
- return children;
- }
- var supports = {
- parse: {
- prelude: function() {
- var children = readSequence.call(this);
- if (this.getFirstListNode(children) === null) {
- this.error('Condition is expected');
- }
- return children;
- },
- block: function() {
- return this.Block(false);
- }
- }
- };
- var atrule = {
- 'font-face': fontFace,
- 'import': _import,
- 'media': media,
- 'page': page,
- 'supports': supports
- };
- var dir = {
- parse: function() {
- return this.createSingleNodeList(
- this.Identifier()
- );
- }
- };
- var has = {
- parse: function() {
- return this.createSingleNodeList(
- this.SelectorList()
- );
- }
- };
- var lang = {
- parse: function() {
- return this.createSingleNodeList(
- this.Identifier()
- );
- }
- };
- var selectorList = {
- parse: function selectorList() {
- return this.createSingleNodeList(
- this.SelectorList()
- );
- }
- };
- var matches = selectorList;
- var not = selectorList;
- var ALLOW_OF_CLAUSE = true;
- var nthWithOfClause = {
- parse: function nthWithOfClause() {
- return this.createSingleNodeList(
- this.Nth(ALLOW_OF_CLAUSE)
- );
- }
- };
- var nthChild = nthWithOfClause;
- var nthLastChild = nthWithOfClause;
- var DISALLOW_OF_CLAUSE = false;
- var nth = {
- parse: function nth() {
- return this.createSingleNodeList(
- this.Nth(DISALLOW_OF_CLAUSE)
- );
- }
- };
- var nthLastOfType = nth;
- var nthOfType = nth;
- var slotted = {
- parse: function compoundSelector() {
- return this.createSingleNodeList(
- this.Selector()
- );
- }
- };
- var pseudo = {
- 'dir': dir,
- 'has': has,
- 'lang': lang,
- 'matches': matches,
- 'not': not,
- 'nth-child': nthChild,
- 'nth-last-child': nthLastChild,
- 'nth-last-of-type': nthLastOfType,
- 'nth-of-type': nthOfType,
- 'slotted': slotted
- };
- var parser = {
- parseContext: {
- default: 'StyleSheet',
- stylesheet: 'StyleSheet',
- atrule: 'Atrule',
- atrulePrelude: function(options) {
- return this.AtrulePrelude(options.atrule ? String(options.atrule) : null);
- },
- mediaQueryList: 'MediaQueryList',
- mediaQuery: 'MediaQuery',
- rule: 'Rule',
- selectorList: 'SelectorList',
- selector: 'Selector',
- block: function() {
- return this.Block(true);
- },
- declarationList: 'DeclarationList',
- declaration: 'Declaration',
- value: 'Value'
- },
- scope: scope,
- atrule: atrule,
- pseudo: pseudo,
- node: node
- };
- var walker = {
- node: node
- };
- var _args = [
- [
- "css-tree@1.1.3",
- "/home/gitlab-runner/builds/BQJy2NwB/0/pagedjs/pagedjs"
- ]
- ];
- var _from = "css-tree@1.1.3";
- var _id = "css-tree@1.1.3";
- var _inBundle = false;
- var _integrity = "sha512-tRpdppF7TRazZrjJ6v3stzv93qxRcSsFmW6cX0Zm2NVKpxE1WV1HblnghVv9TreireHkqI/VDEsfolRF1p6y7Q==";
- var _location = "/css-tree";
- var _phantomChildren = {
- };
- var _requested = {
- type: "version",
- registry: true,
- raw: "css-tree@1.1.3",
- name: "css-tree",
- escapedName: "css-tree",
- rawSpec: "1.1.3",
- saveSpec: null,
- fetchSpec: "1.1.3"
- };
- var _requiredBy = [
- "/"
- ];
- var _resolved = "https://registry.npmjs.org/css-tree/-/css-tree-1.1.3.tgz";
- var _spec = "1.1.3";
- var _where = "/home/gitlab-runner/builds/BQJy2NwB/0/pagedjs/pagedjs";
- var author = {
- name: "Roman Dvornov",
- email: "rdvornov@gmail.com",
- url: "https://github.com/lahmatiy"
- };
- var bugs = {
- url: "https://github.com/csstree/csstree/issues"
- };
- var dependencies = {
- "mdn-data": "2.0.14",
- "source-map": "^0.6.1"
- };
- var description = "A tool set for CSS: fast detailed parser (CSS → AST), walker (AST traversal), generator (AST → CSS) and lexer (validation and matching) based on specs and browser implementations";
- var devDependencies = {
- "@rollup/plugin-commonjs": "^11.0.2",
- "@rollup/plugin-json": "^4.0.2",
- "@rollup/plugin-node-resolve": "^7.1.1",
- coveralls: "^3.0.9",
- eslint: "^6.8.0",
- "json-to-ast": "^2.1.0",
- mocha: "^6.2.3",
- nyc: "^14.1.1",
- rollup: "^1.32.1",
- "rollup-plugin-terser": "^5.3.0"
- };
- var engines = {
- node: ">=8.0.0"
- };
- var files = [
- "data",
- "dist",
- "lib"
- ];
- var homepage = "https://github.com/csstree/csstree#readme";
- var jsdelivr = "dist/csstree.min.js";
- var keywords = [
- "css",
- "ast",
- "tokenizer",
- "parser",
- "walker",
- "lexer",
- "generator",
- "utils",
- "syntax",
- "validation"
- ];
- var license = "MIT";
- var main = "lib/index.js";
- var name = "css-tree";
- var repository = {
- type: "git",
- url: "git+https://github.com/csstree/csstree.git"
- };
- var scripts = {
- build: "rollup --config",
- coverage: "nyc npm test",
- coveralls: "nyc report --reporter=text-lcov | coveralls",
- hydrogen: "node --trace-hydrogen --trace-phase=Z --trace-deopt --code-comments --hydrogen-track-positions --redirect-code-traces --redirect-code-traces-to=code.asm --trace_hydrogen_file=code.cfg --print-opt-code bin/parse --stat -o /dev/null",
- lint: "eslint data lib scripts test && node scripts/review-syntax-patch --lint && node scripts/update-docs --lint",
- "lint-and-test": "npm run lint && npm test",
- prepublishOnly: "npm run build",
- "review:syntax-patch": "node scripts/review-syntax-patch",
- test: "mocha --reporter progress",
- travis: "nyc npm run lint-and-test && npm run coveralls",
- "update:docs": "node scripts/update-docs"
- };
- var unpkg = "dist/csstree.min.js";
- var version = "1.1.3";
- var require$$4 = {
- _args: _args,
- _from: _from,
- _id: _id,
- _inBundle: _inBundle,
- _integrity: _integrity,
- _location: _location,
- _phantomChildren: _phantomChildren,
- _requested: _requested,
- _requiredBy: _requiredBy,
- _resolved: _resolved,
- _spec: _spec,
- _where: _where,
- author: author,
- bugs: bugs,
- dependencies: dependencies,
- description: description,
- devDependencies: devDependencies,
- engines: engines,
- files: files,
- homepage: homepage,
- jsdelivr: jsdelivr,
- keywords: keywords,
- license: license,
- main: main,
- name: name,
- repository: repository,
- scripts: scripts,
- unpkg: unpkg,
- version: version
- };
- function merge() {
- var dest = {};
- for (var i = 0; i < arguments.length; i++) {
- var src = arguments[i];
- for (var key in src) {
- dest[key] = src[key];
- }
- }
- return dest;
- }
- syntax.exports = create$4.create(
- merge(
- lexer,
- parser,
- walker
- )
- );
- syntax.exports.version = require$$4.version;
- var syntaxExports = syntax.exports;
- var lib = syntaxExports;
- var csstree = /*@__PURE__*/getDefaultExportFromCjs(lib);
- class Sheet {
- constructor(url, hooks) {
- if (hooks) {
- this.hooks = hooks;
- } else {
- this.hooks = {};
- this.hooks.onUrl = new Hook(this);
- this.hooks.onAtPage = new Hook(this);
- this.hooks.onAtMedia = new Hook(this);
- this.hooks.onRule = new Hook(this);
- this.hooks.onDeclaration = new Hook(this);
- this.hooks.onSelector = new Hook(this);
- this.hooks.onPseudoSelector = new Hook(this);
- this.hooks.onContent = new Hook(this);
- this.hooks.onImport = new Hook(this);
- this.hooks.beforeTreeParse = new Hook(this);
- this.hooks.beforeTreeWalk = new Hook(this);
- this.hooks.afterTreeWalk = new Hook(this);
- }
- try {
- this.url = new URL(url, window.location.href);
- } catch (e) {
- this.url = new URL(window.location.href);
- }
- }
- // parse
- async parse(text) {
- this.text = text;
- await this.hooks.beforeTreeParse.trigger(this.text, this);
- // send to csstree
- this.ast = csstree.parse(this._text);
- await this.hooks.beforeTreeWalk.trigger(this.ast);
- // Replace urls
- this.replaceUrls(this.ast);
- // Scope
- this.id = UUID();
- // this.addScope(this.ast, this.uuid);
- // Replace IDs with data-id
- this.replaceIds(this.ast);
- this.imported = [];
- // Trigger Hooks
- this.urls(this.ast);
- this.rules(this.ast);
- this.atrules(this.ast);
- await this.hooks.afterTreeWalk.trigger(this.ast, this);
- // return ast
- return this.ast;
- }
- insertRule(rule) {
- let inserted = this.ast.children.appendData(rule);
- this.declarations(rule);
- return inserted;
- }
- urls(ast) {
- csstree.walk(ast, {
- visit: "Url",
- enter: (node, item, list) => {
- this.hooks.onUrl.trigger(node, item, list);
- }
- });
- }
- atrules(ast) {
- csstree.walk(ast, {
- visit: "Atrule",
- enter: (node, item, list) => {
- const basename = csstree.keyword(node.name).basename;
- if (basename === "page") {
- this.hooks.onAtPage.trigger(node, item, list);
- this.declarations(node, item, list);
- }
- if (basename === "media") {
- this.hooks.onAtMedia.trigger(node, item, list);
- this.declarations(node, item, list);
- }
- if (basename === "import") {
- this.hooks.onImport.trigger(node, item, list);
- this.imports(node, item, list);
- }
- }
- });
- }
- rules(ast) {
- csstree.walk(ast, {
- visit: "Rule",
- enter: (ruleNode, ruleItem, rulelist) => {
- this.hooks.onRule.trigger(ruleNode, ruleItem, rulelist);
- this.declarations(ruleNode, ruleItem, rulelist);
- this.onSelector(ruleNode, ruleItem, rulelist);
- }
- });
- }
- declarations(ruleNode, ruleItem, rulelist) {
- csstree.walk(ruleNode, {
- visit: "Declaration",
- enter: (declarationNode, dItem, dList) => {
- this.hooks.onDeclaration.trigger(declarationNode, dItem, dList, {ruleNode, ruleItem, rulelist});
- if (declarationNode.property === "content") {
- csstree.walk(declarationNode, {
- visit: "Function",
- enter: (funcNode, fItem, fList) => {
- this.hooks.onContent.trigger(funcNode, fItem, fList, {declarationNode, dItem, dList}, {ruleNode, ruleItem, rulelist});
- }
- });
- }
- }
- });
- }
- // add pseudo elements to parser
- onSelector(ruleNode, ruleItem, rulelist) {
- csstree.walk(ruleNode, {
- visit: "Selector",
- enter: (selectNode, selectItem, selectList) => {
- this.hooks.onSelector.trigger(selectNode, selectItem, selectList, {ruleNode, ruleItem, rulelist});
- if (selectNode.children.forEach(node => {if (node.type === "PseudoElementSelector") {
- csstree.walk(node, {
- visit: "PseudoElementSelector",
- enter: (pseudoNode, pItem, pList) => {
- this.hooks.onPseudoSelector.trigger(pseudoNode, pItem, pList, {selectNode, selectItem, selectList}, {ruleNode, ruleItem, rulelist});
- }
- });
- }}));
- }
- });
- }
- replaceUrls(ast) {
- csstree.walk(ast, {
- visit: "Url",
- enter: (node, item, list) => {
- let content = node.value.value;
- if ((node.value.type === "Raw" && content.startsWith("data:")) || (node.value.type === "String" && (content.startsWith("\"data:") || content.startsWith("'data:")))) ; else {
- let href = content.replace(/["']/g, "");
- let url = new URL(href, this.url);
- node.value.value = url.toString();
- }
- }
- });
- }
- addScope(ast, id) {
- // Get all selector lists
- // add an id
- csstree.walk(ast, {
- visit: "Selector",
- enter: (node, item, list) => {
- let children = node.children;
- children.prepend(children.createItem({
- type: "WhiteSpace",
- value: " "
- }));
- children.prepend(children.createItem({
- type: "IdSelector",
- name: id,
- loc: null,
- children: null
- }));
- }
- });
- }
- getNamedPageSelectors(ast) {
- let namedPageSelectors = {};
- csstree.walk(ast, {
- visit: "Rule",
- enter: (node, item, list) => {
- csstree.walk(node, {
- visit: "Declaration",
- enter: (declaration, dItem, dList) => {
- if (declaration.property === "page") {
- let value = declaration.value.children.first();
- let name = value.name;
- let selector = csstree.generate(node.prelude);
- namedPageSelectors[name] = {
- name: name,
- selector: selector
- };
- // dList.remove(dItem);
- // Add in page break
- declaration.property = "break-before";
- value.type = "Identifier";
- value.name = "always";
- }
- }
- });
- }
- });
- return namedPageSelectors;
- }
- replaceIds(ast) {
- csstree.walk(ast, {
- visit: "Rule",
- enter: (node, item, list) => {
- csstree.walk(node, {
- visit: "IdSelector",
- enter: (idNode, idItem, idList) => {
- let name = idNode.name;
- idNode.flags = null;
- idNode.matcher = "=";
- idNode.name = {type: "Identifier", loc: null, name: "data-id"};
- idNode.type = "AttributeSelector";
- idNode.value = {type: "String", loc: null, value: `"${name}"`};
- }
- });
- }
- });
- }
- imports(node, item, list) {
- // console.log("import", node, item, list);
- let queries = [];
- csstree.walk(node, {
- visit: "MediaQuery",
- enter: (mqNode, mqItem, mqList) => {
- csstree.walk(mqNode, {
- visit: "Identifier",
- enter: (identNode, identItem, identList) => {
- queries.push(identNode.name);
- }
- });
- }
- });
- // Just basic media query support for now
- let shouldNotApply = queries.some((query, index) => {
- let q = query;
- if (q === "not") {
- q = queries[index + 1];
- return !(q === "screen" || q === "speech");
- } else {
- return (q === "screen" || q === "speech");
- }
- });
- if (shouldNotApply) {
- return;
- }
- csstree.walk(node, {
- visit: "String",
- enter: (urlNode, urlItem, urlList) => {
- let href = urlNode.value.replace(/["']/g, "");
- let url = new URL(href, this.url);
- let value = url.toString();
- this.imported.push(value);
- // Remove the original
- list.remove(item);
- }
- });
- }
- set text(t) {
- this._text = t;
- }
- get text() {
- return this._text;
- }
- // generate string
- toString(ast) {
- return csstree.generate(ast || this.ast);
- }
- }
- var baseStyles = `
- :root {
- --pagedjs-width: 8.5in;
- --pagedjs-height: 11in;
- --pagedjs-width-right: 8.5in;
- --pagedjs-height-right: 11in;
- --pagedjs-width-left: 8.5in;
- --pagedjs-height-left: 11in;
- --pagedjs-pagebox-width: 8.5in;
- --pagedjs-pagebox-height: 11in;
- --pagedjs-footnotes-height: 0mm;
- --pagedjs-margin-top: 1in;
- --pagedjs-margin-right: 1in;
- --pagedjs-margin-bottom: 1in;
- --pagedjs-margin-left: 1in;
- --pagedjs-padding-top: 0mm;
- --pagedjs-padding-right: 0mm;
- --pagedjs-padding-bottom: 0mm;
- --pagedjs-padding-left: 0mm;
- --pagedjs-border-top: 0mm;
- --pagedjs-border-right: 0mm;
- --pagedjs-border-bottom: 0mm;
- --pagedjs-border-left: 0mm;
- --pagedjs-bleed-top: 0mm;
- --pagedjs-bleed-right: 0mm;
- --pagedjs-bleed-bottom: 0mm;
- --pagedjs-bleed-left: 0mm;
- --pagedjs-bleed-right-top: 0mm;
- --pagedjs-bleed-right-right: 0mm;
- --pagedjs-bleed-right-bottom: 0mm;
- --pagedjs-bleed-right-left: 0mm;
- --pagedjs-bleed-left-top: 0mm;
- --pagedjs-bleed-left-right: 0mm;
- --pagedjs-bleed-left-bottom: 0mm;
- --pagedjs-bleed-left-left: 0mm;
- --pagedjs-crop-color: black;
- --pagedjs-crop-shadow: white;
- --pagedjs-crop-offset: 2mm;
- --pagedjs-crop-stroke: 1px;
- --pagedjs-cross-size: 5mm;
- --pagedjs-mark-cross-display: none;
- --pagedjs-mark-crop-display: none;
- --pagedjs-page-count: 0;
- --pagedjs-page-counter-increment: 1;
- --pagedjs-footnotes-count: 0;
- --pagedjs-column-gap-offset: 1000px;
- }
- @page {
- size: letter;
- margin: 0;
- }
- .pagedjs_sheet {
- box-sizing: border-box;
- width: var(--pagedjs-width);
- height: var(--pagedjs-height);
- overflow: hidden;
- position: relative;
- display: grid;
- grid-template-columns: [bleed-left] var(--pagedjs-bleed-left) [sheet-center] calc(var(--pagedjs-width) - var(--pagedjs-bleed-left) - var(--pagedjs-bleed-right)) [bleed-right] var(--pagedjs-bleed-right);
- grid-template-rows: [bleed-top] var(--pagedjs-bleed-top) [sheet-middle] calc(var(--pagedjs-height) - var(--pagedjs-bleed-top) - var(--pagedjs-bleed-bottom)) [bleed-bottom] var(--pagedjs-bleed-bottom);
- }
- .pagedjs_right_page .pagedjs_sheet {
- width: var(--pagedjs-width-right);
- height: var(--pagedjs-height-right);
- grid-template-columns: [bleed-left] var(--pagedjs-bleed-right-left) [sheet-center] calc(var(--pagedjs-width) - var(--pagedjs-bleed-right-left) - var(--pagedjs-bleed-right-right)) [bleed-right] var(--pagedjs-bleed-right-right);
- grid-template-rows: [bleed-top] var(--pagedjs-bleed-right-top) [sheet-middle] calc(var(--pagedjs-height) - var(--pagedjs-bleed-right-top) - var(--pagedjs-bleed-right-bottom)) [bleed-bottom] var(--pagedjs-bleed-right-bottom);
- }
- .pagedjs_left_page .pagedjs_sheet {
- width: var(--pagedjs-width-left);
- height: var(--pagedjs-height-left);
- grid-template-columns: [bleed-left] var(--pagedjs-bleed-left-left) [sheet-center] calc(var(--pagedjs-width) - var(--pagedjs-bleed-left-left) - var(--pagedjs-bleed-left-right)) [bleed-right] var(--pagedjs-bleed-left-right);
- grid-template-rows: [bleed-top] var(--pagedjs-bleed-left-top) [sheet-middle] calc(var(--pagedjs-height) - var(--pagedjs-bleed-left-top) - var(--pagedjs-bleed-left-bottom)) [bleed-bottom] var(--pagedjs-bleed-left-bottom);
- }
- .pagedjs_bleed {
- display: flex;
- align-items: center;
- justify-content: center;
- flex-wrap: nowrap;
- overflow: hidden;
- }
- .pagedjs_bleed-top {
- grid-column: bleed-left / -1;
- grid-row: bleed-top;
- flex-direction: row;
- }
- .pagedjs_bleed-bottom {
- grid-column: bleed-left / -1;
- grid-row: bleed-bottom;
- flex-direction: row;
- }
- .pagedjs_bleed-left {
- grid-column: bleed-left;
- grid-row: bleed-top / -1;
- flex-direction: column;
- }
- .pagedjs_bleed-right {
- grid-column: bleed-right;
- grid-row: bleed-top / -1;
- flex-direction: column;
- }
- .pagedjs_marks-crop {
- display: var(--pagedjs-mark-crop-display);
- flex-grow: 0;
- flex-shrink: 0;
- z-index: 9999999999;
- }
- .pagedjs_bleed-top .pagedjs_marks-crop:nth-child(1),
- .pagedjs_bleed-bottom .pagedjs_marks-crop:nth-child(1) {
- width: calc(var(--pagedjs-bleed-left) - var(--pagedjs-crop-stroke));
- border-right: var(--pagedjs-crop-stroke) solid var(--pagedjs-crop-color);
- box-shadow: 1px 0px 0px 0px var(--pagedjs-crop-shadow);
- }
- .pagedjs_right_page .pagedjs_bleed-top .pagedjs_marks-crop:nth-child(1),
- .pagedjs_right_page .pagedjs_bleed-bottom .pagedjs_marks-crop:nth-child(1) {
- width: calc(var(--pagedjs-bleed-right-left) - var(--pagedjs-crop-stroke));
- }
- .pagedjs_left_page .pagedjs_bleed-top .pagedjs_marks-crop:nth-child(1),
- .pagedjs_left_page .pagedjs_bleed-bottom .pagedjs_marks-crop:nth-child(1) {
- width: calc(var(--pagedjs-bleed-left-left) - var(--pagedjs-crop-stroke));
- }
- .pagedjs_bleed-top .pagedjs_marks-crop:nth-child(3),
- .pagedjs_bleed-bottom .pagedjs_marks-crop:nth-child(3) {
- width: calc(var(--pagedjs-bleed-right) - var(--pagedjs-crop-stroke));
- border-left: var(--pagedjs-crop-stroke) solid var(--pagedjs-crop-color);
- box-shadow: -1px 0px 0px 0px var(--pagedjs-crop-shadow);
- }
- .pagedjs_right_page .pagedjs_bleed-top .pagedjs_marks-crop:nth-child(3),
- .pagedjs_right_page .pagedjs_bleed-bottom .pagedjs_marks-crop:nth-child(3) {
- width: calc(var(--pagedjs-bleed-right-right) - var(--pagedjs-crop-stroke));
- }
- .pagedjs_left_page .pagedjs_bleed-top .pagedjs_marks-crop:nth-child(3),
- .pagedjs_left_page .pagedjs_bleed-bottom .pagedjs_marks-crop:nth-child(3) {
- width: calc(var(--pagedjs-bleed-left-right) - var(--pagedjs-crop-stroke));
- }
- .pagedjs_bleed-top .pagedjs_marks-crop {
- align-self: flex-start;
- height: calc(var(--pagedjs-bleed-top) - var(--pagedjs-crop-offset));
- }
- .pagedjs_right_page .pagedjs_bleed-top .pagedjs_marks-crop {
- height: calc(var(--pagedjs-bleed-right-top) - var(--pagedjs-crop-offset));
- }
- .pagedjs_left_page .pagedjs_bleed-top .pagedjs_marks-crop {
- height: calc(var(--pagedjs-bleed-left-top) - var(--pagedjs-crop-offset));
- }
- .pagedjs_bleed-bottom .pagedjs_marks-crop {
- align-self: flex-end;
- height: calc(var(--pagedjs-bleed-bottom) - var(--pagedjs-crop-offset));
- }
- .pagedjs_right_page .pagedjs_bleed-bottom .pagedjs_marks-crop {
- height: calc(var(--pagedjs-bleed-right-bottom) - var(--pagedjs-crop-offset));
- }
- .pagedjs_left_page .pagedjs_bleed-bottom .pagedjs_marks-crop {
- height: calc(var(--pagedjs-bleed-left-bottom) - var(--pagedjs-crop-offset));
- }
- .pagedjs_bleed-left .pagedjs_marks-crop:nth-child(1),
- .pagedjs_bleed-right .pagedjs_marks-crop:nth-child(1) {
- height: calc(var(--pagedjs-bleed-top) - var(--pagedjs-crop-stroke));
- border-bottom: var(--pagedjs-crop-stroke) solid var(--pagedjs-crop-color);
- box-shadow: 0px 1px 0px 0px var(--pagedjs-crop-shadow);
- }
- .pagedjs_right_page .pagedjs_bleed-left .pagedjs_marks-crop:nth-child(1),
- .pagedjs_right_page .pagedjs_bleed-right .pagedjs_marks-crop:nth-child(1) {
- height: calc(var(--pagedjs-bleed-right-top) - var(--pagedjs-crop-stroke));
- }
- .pagedjs_left_page .pagedjs_bleed-left .pagedjs_marks-crop:nth-child(1),
- .pagedjs_left_page .pagedjs_bleed-right .pagedjs_marks-crop:nth-child(1) {
- height: calc(var(--pagedjs-bleed-left-top) - var(--pagedjs-crop-stroke));
- }
- .pagedjs_bleed-left .pagedjs_marks-crop:nth-child(3),
- .pagedjs_bleed-right .pagedjs_marks-crop:nth-child(3) {
- height: calc(var(--pagedjs-bleed-bottom) - var(--pagedjs-crop-stroke));
- border-top: var(--pagedjs-crop-stroke) solid var(--pagedjs-crop-color);
- box-shadow: 0px -1px 0px 0px var(--pagedjs-crop-shadow);
- }
- .pagedjs_right_page .pagedjs_bleed-left .pagedjs_marks-crop:nth-child(3),
- .pagedjs_right_page .pagedjs_bleed-right .pagedjs_marks-crop:nth-child(3) {
- height: calc(var(--pagedjs-bleed-right-bottom) - var(--pagedjs-crop-stroke));
- }
- .pagedjs_left_page .pagedjs_bleed-left .pagedjs_marks-crop:nth-child(3),
- .pagedjs_left_page .pagedjs_bleed-right .pagedjs_marks-crop:nth-child(3) {
- height: calc(var(--pagedjs-bleed-left-bottom) - var(--pagedjs-crop-stroke));
- }
- .pagedjs_bleed-left .pagedjs_marks-crop {
- width: calc(var(--pagedjs-bleed-left) - var(--pagedjs-crop-offset));
- align-self: flex-start;
- }
- .pagedjs_right_page .pagedjs_bleed-left .pagedjs_marks-crop {
- width: calc(var(--pagedjs-bleed-right-left) - var(--pagedjs-crop-offset));
- }
- .pagedjs_left_page .pagedjs_bleed-left .pagedjs_marks-crop {
- width: calc(var(--pagedjs-bleed-left-left) - var(--pagedjs-crop-offset));
- }
- .pagedjs_bleed-right .pagedjs_marks-crop {
- width: calc(var(--pagedjs-bleed-right) - var(--pagedjs-crop-offset));
- align-self: flex-end;
- }
- .pagedjs_right_page .pagedjs_bleed-right .pagedjs_marks-crop {
- width: calc(var(--pagedjs-bleed-right-right) - var(--pagedjs-crop-offset));
- }
- .pagedjs_left_page .pagedjs_bleed-right .pagedjs_marks-crop {
- width: calc(var(--pagedjs-bleed-left-right) - var(--pagedjs-crop-offset));
- }
- .pagedjs_marks-middle {
- display: flex;
- flex-grow: 1;
- flex-shrink: 0;
- align-items: center;
- justify-content: center;
- }
- .pagedjs_marks-cross {
- display: var(--pagedjs-mark-cross-display);
- background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iTGF5ZXJfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiIHdpZHRoPSIzMi41MzdweCIgaGVpZ2h0PSIzMi41MzdweCIgdmlld0JveD0iMC4xMDQgMC4xMDQgMzIuNTM3IDMyLjUzNyIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAwLjEwNCAwLjEwNCAzMi41MzcgMzIuNTM3IiB4bWw6c3BhY2U9InByZXNlcnZlIj48cGF0aCBmaWxsPSJub25lIiBzdHJva2U9IiNGRkZGRkYiIHN0cm9rZS13aWR0aD0iMy4zODkzIiBzdHJva2UtbWl0ZXJsaW1pdD0iMTAiIGQ9Ik0yOS45MzEsMTYuMzczYzAsNy40ODktNi4wNjgsMTMuNTYtMTMuNTU4LDEzLjU2Yy03LjQ4MywwLTEzLjU1Ny02LjA3Mi0xMy41NTctMTMuNTZjMC03LjQ4Niw2LjA3NC0xMy41NTQsMTMuNTU3LTEzLjU1NEMyMy44NjIsMi44MTksMjkuOTMxLDguODg3LDI5LjkzMSwxNi4zNzN6Ii8+PGxpbmUgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjRkZGRkZGIiBzdHJva2Utd2lkdGg9IjMuMzg5MyIgc3Ryb2tlLW1pdGVybGltaXQ9IjEwIiB4MT0iMC4xMDQiIHkxPSIxNi4zNzMiIHgyPSIzMi42NDIiIHkyPSIxNi4zNzMiLz48bGluZSBmaWxsPSJub25lIiBzdHJva2U9IiNGRkZGRkYiIHN0cm9rZS13aWR0aD0iMy4zODkzIiBzdHJva2UtbWl0ZXJsaW1pdD0iMTAiIHgxPSIxNi4zNzMiIHkxPSIwLjEwNCIgeDI9IjE2LjM3MyIgeTI9IjMyLjY0MiIvPjxwYXRoIGZpbGw9Im5vbmUiIHN0cm9rZT0iI0ZGRkZGRiIgc3Ryb2tlLXdpZHRoPSIzLjM4OTMiIHN0cm9rZS1taXRlcmxpbWl0PSIxMCIgZD0iTTI0LjUwOCwxNi4zNzNjMCw0LjQ5Ni0zLjYzOCw4LjEzNS04LjEzNSw4LjEzNWMtNC40OTEsMC04LjEzNS0zLjYzOC04LjEzNS04LjEzNWMwLTQuNDg5LDMuNjQ0LTguMTM1LDguMTM1LTguMTM1QzIwLjg2OSw4LjIzOSwyNC41MDgsMTEuODg0LDI0LjUwOCwxNi4zNzN6Ii8+PHBhdGggZmlsbD0ibm9uZSIgc3Ryb2tlPSIjMDAwMDAwIiBzdHJva2Utd2lkdGg9IjAuNjc3OCIgc3Ryb2tlLW1pdGVybGltaXQ9IjEwIiBkPSJNMjkuOTMxLDE2LjM3M2MwLDcuNDg5LTYuMDY4LDEzLjU2LTEzLjU1OCwxMy41NmMtNy40ODMsMC0xMy41NTctNi4wNzItMTMuNTU3LTEzLjU2YzAtNy40ODYsNi4wNzQtMTMuNTU0LDEzLjU1Ny0xMy41NTRDMjMuODYyLDIuODE5LDI5LjkzMSw4Ljg4NywyOS45MzEsMTYuMzczeiIvPjxsaW5lIGZpbGw9Im5vbmUiIHN0cm9rZT0iIzAwMDAwMCIgc3Ryb2tlLXdpZHRoPSIwLjY3NzgiIHN0cm9rZS1taXRlcmxpbWl0PSIxMCIgeDE9IjAuMTA0IiB5MT0iMTYuMzczIiB4Mj0iMzIuNjQyIiB5Mj0iMTYuMzczIi8+PGxpbmUgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjMDAwMDAwIiBzdHJva2Utd2lkdGg9IjAuNjc3OCIgc3Ryb2tlLW1pdGVybGltaXQ9IjEwIiB4MT0iMTYuMzczIiB5MT0iMC4xMDQiIHgyPSIxNi4zNzMiIHkyPSIzMi42NDIiLz48cGF0aCBkPSJNMjQuNTA4LDE2LjM3M2MwLDQuNDk2LTMuNjM4LDguMTM1LTguMTM1LDguMTM1Yy00LjQ5MSwwLTguMTM1LTMuNjM4LTguMTM1LTguMTM1YzAtNC40ODksMy42NDQtOC4xMzUsOC4xMzUtOC4xMzVDMjAuODY5LDguMjM5LDI0LjUwOCwxMS44ODQsMjQuNTA4LDE2LjM3MyIvPjxsaW5lIGZpbGw9Im5vbmUiIHN0cm9rZT0iI0ZGRkZGRiIgc3Ryb2tlLXdpZHRoPSIwLjY3NzgiIHN0cm9rZS1taXRlcmxpbWl0PSIxMCIgeDE9IjguMjM5IiB5MT0iMTYuMzczIiB4Mj0iMjQuNTA4IiB5Mj0iMTYuMzczIi8+PGxpbmUgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjRkZGRkZGIiBzdHJva2Utd2lkdGg9IjAuNjc3OCIgc3Ryb2tlLW1pdGVybGltaXQ9IjEwIiB4MT0iMTYuMzczIiB5MT0iOC4yMzkiIHgyPSIxNi4zNzMiIHkyPSIyNC41MDgiLz48L3N2Zz4=);
- background-repeat: no-repeat;
- background-position: 50% 50%;
- background-size: var(--pagedjs-cross-size);
- z-index: 2147483647;
- width: var(--pagedjs-cross-size);
- height: var(--pagedjs-cross-size);
- }
- .pagedjs_pagebox {
- box-sizing: border-box;
- width: var(--pagedjs-pagebox-width);
- height: var(--pagedjs-pagebox-height);
- position: relative;
- display: grid;
- grid-template-columns: [left] var(--pagedjs-margin-left) [center] calc(var(--pagedjs-pagebox-width) - var(--pagedjs-margin-left) - var(--pagedjs-margin-right)) [right] var(--pagedjs-margin-right);
- grid-template-rows: [header] var(--pagedjs-margin-top) [page] calc(var(--pagedjs-pagebox-height) - var(--pagedjs-margin-top) - var(--pagedjs-margin-bottom)) [footer] var(--pagedjs-margin-bottom);
- grid-column: sheet-center;
- grid-row: sheet-middle;
- }
- .pagedjs_pagebox * {
- box-sizing: border-box;
- }
- .pagedjs_margin-top {
- width: calc(var(--pagedjs-pagebox-width) - var(--pagedjs-margin-left) - var(--pagedjs-margin-right));
- height: var(--pagedjs-margin-top);
- grid-column: center;
- grid-row: header;
- flex-wrap: nowrap;
- display: grid;
- grid-template-columns: repeat(3, 1fr);
- grid-template-rows: 100%;
- }
- .pagedjs_margin-top-left-corner-holder {
- width: var(--pagedjs-margin-left);
- height: var(--pagedjs-margin-top);
- display: flex;
- grid-column: left;
- grid-row: header;
- }
- .pagedjs_margin-top-right-corner-holder {
- width: var(--pagedjs-margin-right);
- height: var(--pagedjs-margin-top);
- display: flex;
- grid-column: right;
- grid-row: header;
- }
- .pagedjs_margin-top-left-corner {
- width: var(--pagedjs-margin-left);
- }
- .pagedjs_margin-top-right-corner {
- width: var(--pagedjs-margin-right);
- }
- .pagedjs_margin-right {
- height: calc(var(--pagedjs-pagebox-height) - var(--pagedjs-margin-top) - var(--pagedjs-margin-bottom));
- width: var(--pagedjs-margin-right);
- right: 0;
- grid-column: right;
- grid-row: page;
- display: grid;
- grid-template-rows: repeat(3, 33.3333%);
- grid-template-columns: 100%;
- }
- .pagedjs_margin-bottom {
- width: calc(var(--pagedjs-pagebox-width) - var(--pagedjs-margin-left) - var(--pagedjs-margin-right));
- height: var(--pagedjs-margin-bottom);
- grid-column: center;
- grid-row: footer;
- display: grid;
- grid-template-columns: repeat(3, 1fr);
- grid-template-rows: 100%;
- }
- .pagedjs_margin-bottom-left-corner-holder {
- width: var(--pagedjs-margin-left);
- height: var(--pagedjs-margin-bottom);
- display: flex;
- grid-column: left;
- grid-row: footer;
- }
- .pagedjs_margin-bottom-right-corner-holder {
- width: var(--pagedjs-margin-right);
- height: var(--pagedjs-margin-bottom);
- display: flex;
- grid-column: right;
- grid-row: footer;
- }
- .pagedjs_margin-bottom-left-corner {
- width: var(--pagedjs-margin-left);
- }
- .pagedjs_margin-bottom-right-corner {
- width: var(--pagedjs-margin-right);
- }
- .pagedjs_margin-left {
- height: calc(var(--pagedjs-pagebox-height) - var(--pagedjs-margin-top) - var(--pagedjs-margin-bottom));
- width: var(--pagedjs-margin-left);
- grid-column: left;
- grid-row: page;
- display: grid;
- grid-template-rows: repeat(3, 33.33333%);
- grid-template-columns: 100%;
- }
- .pagedjs_pages .pagedjs_pagebox .pagedjs_margin:not(.hasContent) {
- visibility: hidden;
- }
- .pagedjs_pagebox > .pagedjs_area {
- grid-column: center;
- grid-row: page;
- width: 100%;
- height: 100%;
- padding: var(--pagedjs-padding-top) var(--pagedjs-padding-right) var(--pagedjs-padding-bottom) var(--pagedjs-padding-left);
- border-top: var(--pagedjs-border-top);
- border-right: var(--pagedjs-border-right);
- border-bottom: var(--pagedjs-border-bottom);
- border-left: var(--pagedjs-border-left);
- }
- .pagedjs_pagebox > .pagedjs_area > .pagedjs_page_content {
- width: 100%;
- height: calc(100% - var(--pagedjs-footnotes-height));
- position: relative;
- column-fill: auto;
- }
- .pagedjs_pagebox > .pagedjs_area > .pagedjs_page_content > div {
- height: inherit;
- }
- .pagedjs_pagebox > .pagedjs_area > .pagedjs_footnote_area {
- position: relative;
- overflow: hidden;
- height: var(--pagedjs-footnotes-height);
- display: flex;
- justify-content: flex-end;
- flex-flow: column;
- }
- .pagedjs_pagebox > .pagedjs_area > .pagedjs_footnote_area > .pagedjs_footnote_content {
- overflow: hidden;
- }
- .pagedjs_pagebox > .pagedjs_area > .pagedjs_footnote_area > .pagedjs_footnote_inner_content {
- overflow: hidden;
- }
- .pagedjs_area [data-footnote-call] {
- all: unset;
- counter-increment: footnote;
- }
- .pagedjs_area [data-split-from] {
- counter-increment: unset;
- counter-reset: unset;
- }
- [data-footnote-call]::after {
- vertical-align: super;
- font-size: 65%;
- line-height: normal;
- content: counter(footnote);
- }
- @supports ( font-variant-position: super ) {
- [data-footnote-call]::after {
- vertical-align: baseline;
- font-size: 100%;
- line-height: inherit;
- font-variant-position: super;
- }
- }
- .pagedjs_footnote_empty {
- display: none;
- }
- .pagedjs_area [data-split-from] {
- counter-increment: unset;
- counter-reset: unset;
- }
- [data-footnote-marker] {
- text-indent: 0;
- display: list-item;
- list-style-position: inside;
- }
- [data-footnote-marker][data-split-from] {
- list-style: none;
- }
- [data-footnote-marker]:not([data-split-from]) {
- counter-increment: footnote-marker;
- }
- [data-footnote-marker]::marker {
- content: counter(footnote-marker) ". ";
- }
- [data-footnote-marker][data-split-from]::marker {
- content: unset;
- }
- .pagedjs_area .pagedjs_footnote_inner_content [data-note-display="inline"] {
- display: inline;
- }
- .pagedjs_page {
- counter-increment: page var(--pagedjs-page-counter-increment);
- width: var(--pagedjs-width);
- height: var(--pagedjs-height);
- }
- .pagedjs_page.pagedjs_right_page {
- width: var(--pagedjs-width-right);
- height: var(--pagedjs-height-right);
- }
- .pagedjs_page.pagedjs_left_page {
- width: var(--pagedjs-width-left);
- height: var(--pagedjs-height-left);
- }
- .pagedjs_pages {
- counter-reset: pages var(--pagedjs-page-count) footnote var(--pagedjs-footnotes-count) footnote-marker var(--pagedjs-footnotes-count);
- }
- .pagedjs_pagebox .pagedjs_margin-top-left-corner,
- .pagedjs_pagebox .pagedjs_margin-top-right-corner,
- .pagedjs_pagebox .pagedjs_margin-bottom-left-corner,
- .pagedjs_pagebox .pagedjs_margin-bottom-right-corner,
- .pagedjs_pagebox .pagedjs_margin-top-left,
- .pagedjs_pagebox .pagedjs_margin-top-right,
- .pagedjs_pagebox .pagedjs_margin-bottom-left,
- .pagedjs_pagebox .pagedjs_margin-bottom-right,
- .pagedjs_pagebox .pagedjs_margin-top-center,
- .pagedjs_pagebox .pagedjs_margin-bottom-center,
- .pagedjs_pagebox .pagedjs_margin-top-center,
- .pagedjs_pagebox .pagedjs_margin-bottom-center,
- .pagedjs_margin-right-middle,
- .pagedjs_margin-left-middle {
- display: flex;
- align-items: center;
- }
- .pagedjs_margin-right-top,
- .pagedjs_margin-left-top {
- display: flex;
- align-items: flex-top;
- }
- .pagedjs_margin-right-bottom,
- .pagedjs_margin-left-bottom {
- display: flex;
- align-items: flex-end;
- }
- /*
- .pagedjs_pagebox .pagedjs_margin-top-center,
- .pagedjs_pagebox .pagedjs_margin-bottom-center {
- height: 100%;
- display: none;
- align-items: center;
- flex: 1 0 33%;
- margin: 0 auto;
- }
- .pagedjs_pagebox .pagedjs_margin-top-left-corner,
- .pagedjs_pagebox .pagedjs_margin-top-right-corner,
- .pagedjs_pagebox .pagedjs_margin-bottom-right-corner,
- .pagedjs_pagebox .pagedjs_margin-bottom-left-corner {
- display: none;
- align-items: center;
- }
- .pagedjs_pagebox .pagedjs_margin-left-top,
- .pagedjs_pagebox .pagedjs_margin-right-top {
- display: none;
- align-items: flex-start;
- }
- .pagedjs_pagebox .pagedjs_margin-right-middle,
- .pagedjs_pagebox .pagedjs_margin-left-middle {
- display: none;
- align-items: center;
- }
- .pagedjs_pagebox .pagedjs_margin-left-bottom,
- .pagedjs_pagebox .pagedjs_margin-right-bottom {
- display: none;
- align-items: flex-end;
- }
- */
- .pagedjs_pagebox .pagedjs_margin-top-left,
- .pagedjs_pagebox .pagedjs_margin-top-right-corner,
- .pagedjs_pagebox .pagedjs_margin-bottom-left,
- .pagedjs_pagebox .pagedjs_margin-bottom-right-corner { text-align: left; }
- .pagedjs_pagebox .pagedjs_margin-top-left-corner,
- .pagedjs_pagebox .pagedjs_margin-top-right,
- .pagedjs_pagebox .pagedjs_margin-bottom-left-corner,
- .pagedjs_pagebox .pagedjs_margin-bottom-right { text-align: right; }
- .pagedjs_pagebox .pagedjs_margin-top-center,
- .pagedjs_pagebox .pagedjs_margin-bottom-center,
- .pagedjs_pagebox .pagedjs_margin-left-top,
- .pagedjs_pagebox .pagedjs_margin-left-middle,
- .pagedjs_pagebox .pagedjs_margin-left-bottom,
- .pagedjs_pagebox .pagedjs_margin-right-top,
- .pagedjs_pagebox .pagedjs_margin-right-middle,
- .pagedjs_pagebox .pagedjs_margin-right-bottom { text-align: center; }
- .pagedjs_pages .pagedjs_margin .pagedjs_margin-content {
- width: 100%;
- }
- .pagedjs_pages .pagedjs_margin-left .pagedjs_margin-content::after,
- .pagedjs_pages .pagedjs_margin-top .pagedjs_margin-content::after,
- .pagedjs_pages .pagedjs_margin-right .pagedjs_margin-content::after,
- .pagedjs_pages .pagedjs_margin-bottom .pagedjs_margin-content::after {
- display: block;
- }
- .pagedjs_pages > .pagedjs_page > .pagedjs_sheet > .pagedjs_pagebox > .pagedjs_area > div [data-split-to] {
- margin-bottom: unset;
- padding-bottom: unset;
- }
- .pagedjs_pages > .pagedjs_page > .pagedjs_sheet > .pagedjs_pagebox > .pagedjs_area > div [data-split-from] {
- text-indent: unset;
- margin-top: unset;
- padding-top: unset;
- initial-letter: unset;
- }
- .pagedjs_pages > .pagedjs_page > .pagedjs_sheet > .pagedjs_pagebox > .pagedjs_area > div [data-split-from] > *::first-letter,
- .pagedjs_pages > .pagedjs_page > .pagedjs_sheet > .pagedjs_pagebox > .pagedjs_area > div [data-split-from]::first-letter {
- color: unset;
- font-size: unset;
- font-weight: unset;
- font-family: unset;
- color: unset;
- line-height: unset;
- float: unset;
- padding: unset;
- margin: unset;
- }
- .pagedjs_pages > .pagedjs_page > .pagedjs_sheet > .pagedjs_pagebox > .pagedjs_area > div [data-split-to]:not([data-footnote-call]):after,
- .pagedjs_pages > .pagedjs_page > .pagedjs_sheet > .pagedjs_pagebox > .pagedjs_area > div [data-split-to]:not([data-footnote-call])::after {
- content: unset;
- }
- .pagedjs_pages > .pagedjs_page > .pagedjs_sheet > .pagedjs_pagebox > .pagedjs_area > div [data-split-from]:not([data-footnote-call]):before,
- .pagedjs_pages > .pagedjs_page > .pagedjs_sheet > .pagedjs_pagebox > .pagedjs_area > div [data-split-from]:not([data-footnote-call])::before {
- content: unset;
- }
- .pagedjs_pages > .pagedjs_page > .pagedjs_sheet > .pagedjs_pagebox > .pagedjs_area > div li[data-split-from]:first-of-type {
- list-style: none;
- }
- /*
- [data-page]:not([data-split-from]),
- [data-break-before="page"]:not([data-split-from]),
- [data-break-before="always"]:not([data-split-from]),
- [data-break-before="left"]:not([data-split-from]),
- [data-break-before="right"]:not([data-split-from]),
- [data-break-before="recto"]:not([data-split-from]),
- [data-break-before="verso"]:not([data-split-from])
- {
- break-before: column;
- }
- [data-page]:not([data-split-to]),
- [data-break-after="page"]:not([data-split-to]),
- [data-break-after="always"]:not([data-split-to]),
- [data-break-after="left"]:not([data-split-to]),
- [data-break-after="right"]:not([data-split-to]),
- [data-break-after="recto"]:not([data-split-to]),
- [data-break-after="verso"]:not([data-split-to])
- {
- break-after: column;
- }
- */
- .pagedjs_clear-after::after {
- content: none !important;
- }
- [data-align-last-split-element='justify'] {
- text-align-last: justify;
- }
- @media print {
- html {
- width: 100%;
- height: 100%;
- -webkit-print-color-adjust: exact;
- print-color-adjust: exact;
- }
- body {
- margin: 0;
- padding: 0;
- width: 100% !important;
- height: 100% !important;
- min-width: 100%;
- max-width: 100%;
- min-height: 100%;
- max-height: 100%;
- }
- .pagedjs_pages {
- width: auto;
- display: block !important;
- transform: none !important;
- height: 100% !important;
- min-height: 100%;
- max-height: 100%;
- overflow: visible;
- }
- .pagedjs_page {
- margin: 0;
- padding: 0;
- max-height: 100%;
- min-height: 100%;
- height: 100% !important;
- page-break-after: always;
- break-after: page;
- }
- .pagedjs_sheet {
- margin: 0;
- padding: 0;
- max-height: 100%;
- min-height: 100%;
- height: 100% !important;
- }
- }
- `;
- async function request(url, options={}) {
- return new Promise(function(resolve, reject) {
- let request = new XMLHttpRequest();
- request.open(options.method || "get", url, true);
- for (let i in options.headers) {
- request.setRequestHeader(i, options.headers[i]);
- }
- request.withCredentials = options.credentials === "include";
- request.onload = () => {
- // Chrome returns a status code of 0 for local files
- const status = request.status === 0 && url.startsWith("file://") ? 200 : request.status;
- resolve(new Response(request.responseText, {status}));
- };
- request.onerror = reject;
- request.send(options.body || null);
- });
- }
- class Polisher {
- constructor(setup) {
- this.sheets = [];
- this.inserted = [];
- this.hooks = {};
- this.hooks.onUrl = new Hook(this);
- this.hooks.onAtPage = new Hook(this);
- this.hooks.onAtMedia = new Hook(this);
- this.hooks.onRule = new Hook(this);
- this.hooks.onDeclaration = new Hook(this);
- this.hooks.onContent = new Hook(this);
- this.hooks.onSelector = new Hook(this);
- this.hooks.onPseudoSelector = new Hook(this);
- this.hooks.onImport = new Hook(this);
- this.hooks.beforeTreeParse = new Hook(this);
- this.hooks.beforeTreeWalk = new Hook(this);
- this.hooks.afterTreeWalk = new Hook(this);
- if (setup !== false) {
- this.setup();
- }
- }
- setup() {
- this.base = this.insert(baseStyles);
- this.styleEl = document.createElement("style");
- document.head.appendChild(this.styleEl);
- this.styleSheet = this.styleEl.sheet;
- return this.styleSheet;
- }
- async add() {
- let fetched = [];
- let urls = [];
- for (var i = 0; i < arguments.length; i++) {
- let f;
- if (typeof arguments[i] === "object") {
- for (let url in arguments[i]) {
- let obj = arguments[i];
- f = new Promise(function(resolve, reject) {
- urls.push(url);
- resolve(obj[url]);
- });
- }
- } else {
- urls.push(arguments[i]);
- f = request(arguments[i]).then((response) => {
- return response.text();
- });
- }
- fetched.push(f);
- }
- return await Promise.all(fetched)
- .then(async (originals) => {
- let text = "";
- for (let index = 0; index < originals.length; index++) {
- text = await this.convertViaSheet(originals[index], urls[index]);
- this.insert(text);
- }
- return text;
- });
- }
- async convertViaSheet(cssStr, href) {
- let sheet = new Sheet(href, this.hooks);
- await sheet.parse(cssStr);
- // Insert the imported sheets first
- for (let url of sheet.imported) {
- let str = await request(url).then((response) => {
- return response.text();
- });
- let text = await this.convertViaSheet(str, url);
- this.insert(text);
- }
- this.sheets.push(sheet);
- if (typeof sheet.width !== "undefined") {
- this.width = sheet.width;
- }
- if (typeof sheet.height !== "undefined") {
- this.height = sheet.height;
- }
- if (typeof sheet.orientation !== "undefined") {
- this.orientation = sheet.orientation;
- }
- return sheet.toString();
- }
- insert(text){
- let head = document.querySelector("head");
- let style = document.createElement("style");
- style.setAttribute("data-pagedjs-inserted-styles", "true");
- style.appendChild(document.createTextNode(text));
- head.appendChild(style);
- this.inserted.push(style);
- return style;
- }
- destroy() {
- this.styleEl.remove();
- this.inserted.forEach((s) => {
- s.remove();
- });
- this.sheets = [];
- }
- }
- class Handler {
- constructor(chunker, polisher, caller) {
- let hooks = Object.assign({}, chunker && chunker.hooks, polisher && polisher.hooks, caller && caller.hooks);
- this.chunker = chunker;
- this.polisher = polisher;
- this.caller = caller;
- for (let name in hooks) {
- if (name in this) {
- let hook = hooks[name];
- hook.register(this[name].bind(this));
- }
- }
- }
- }
- EventEmitter(Handler.prototype);
- // https://www.w3.org/TR/css3-page/#page-size-prop
- var pageSizes = {
- "A0": {
- width: {
- value: 841,
- unit: "mm"
- },
- height: {
- value: 1189,
- unit: "mm"
- }
- },
- "A1": {
- width: {
- value: 594,
- unit: "mm"
- },
- height: {
- value: 841,
- unit: "mm"
- }
- },
- "A2": {
- width: {
- value: 420,
- unit: "mm"
- },
- height: {
- value: 594,
- unit: "mm"
- }
- },
- "A3": {
- width: {
- value: 297,
- unit: "mm"
- },
- height: {
- value: 420,
- unit: "mm"
- }
- },
- "A4": {
- width: {
- value: 210,
- unit: "mm"
- },
- height: {
- value: 297,
- unit: "mm"
- }
- },
- "A5": {
- width: {
- value: 148,
- unit: "mm"
- },
- height: {
- value: 210,
- unit: "mm"
- }
- },
- "A6": {
- width: {
- value: 105,
- unit: "mm"
- },
- height: {
- value: 148,
- unit: "mm"
- }
- },
- "A7": {
- width: {
- value: 74,
- unit: "mm"
- },
- height: {
- value: 105,
- unit: "mm"
- }
- },
- "A8": {
- width: {
- value: 52,
- unit: "mm"
- },
- height: {
- value: 74,
- unit: "mm"
- }
- },
- "A9": {
- width: {
- value: 37,
- unit: "mm"
- },
- height: {
- value: 52,
- unit: "mm"
- }
- },
- "A10": {
- width: {
- value: 26,
- unit: "mm"
- },
- height: {
- value: 37,
- unit: "mm"
- }
- },
- "B4": {
- width: {
- value: 250,
- unit: "mm"
- },
- height: {
- value: 353,
- unit: "mm"
- }
- },
- "B5": {
- width: {
- value: 176,
- unit: "mm"
- },
- height: {
- value: 250,
- unit: "mm"
- }
- },
- "letter": {
- width: {
- value: 8.5,
- unit: "in"
- },
- height: {
- value: 11,
- unit: "in"
- }
- },
- "legal": {
- width: {
- value: 8.5,
- unit: "in"
- },
- height: {
- value: 14,
- unit: "in"
- }
- },
- "ledger": {
- width: {
- value: 11,
- unit: "in"
- },
- height: {
- value: 17,
- unit: "in"
- }
- }
- };
- class AtPage extends Handler {
- constructor(chunker, polisher, caller) {
- super(chunker, polisher, caller);
- this.pages = {};
- this.width = undefined;
- this.height = undefined;
- this.orientation = undefined;
- this.marginalia = {};
- }
- pageModel(selector) {
- return {
- selector: selector,
- name: undefined,
- psuedo: undefined,
- nth: undefined,
- marginalia: {},
- width: undefined,
- height: undefined,
- orientation: undefined,
- margin: {
- top: {},
- right: {},
- left: {},
- bottom: {}
- },
- padding: {
- top: {},
- right: {},
- left: {},
- bottom: {}
- },
- border: {
- top: {},
- right: {},
- left: {},
- bottom: {}
- },
- backgroundOrigin: undefined,
- block: {},
- marks: undefined,
- notes: undefined,
- added: false
- };
- }
- // Find and Remove @page rules
- onAtPage(node, item, list) {
- let page, marginalia;
- let selector = "";
- let named, psuedo, nth;
- let needsMerge = false;
- if (node.prelude) {
- named = this.getTypeSelector(node);
- psuedo = this.getPsuedoSelector(node);
- nth = this.getNthSelector(node);
- selector = csstree.generate(node.prelude);
- } else {
- selector = "*";
- }
- if (selector in this.pages) {
- // this.pages[selector] = Object.assign(this.pages[selector], page);
- // console.log("after", selector, this.pages[selector]);
- // this.pages[selector].added = false;
- page = this.pages[selector];
- marginalia = this.replaceMarginalia(node);
- needsMerge = true;
- // Mark page for getting classes added again
- page.added = false;
- } else {
- page = this.pageModel(selector);
- marginalia = this.replaceMarginalia(node);
- this.pages[selector] = page;
- }
- page.name = named;
- page.psuedo = psuedo;
- page.nth = nth;
- if (needsMerge) {
- page.marginalia = Object.assign(page.marginalia, marginalia);
- } else {
- page.marginalia = marginalia;
- }
- let notes = this.replaceNotes(node);
- page.notes = notes;
- let declarations = this.replaceDeclarations(node);
- if (declarations.size) {
- page.size = declarations.size;
- page.width = declarations.size.width;
- page.height = declarations.size.height;
- page.orientation = declarations.size.orientation;
- page.format = declarations.size.format;
- }
- if (declarations.bleed && declarations.bleed[0] != "auto") {
- switch (declarations.bleed.length) {
- case 4: // top right bottom left
- page.bleed = {
- top: declarations.bleed[0],
- right: declarations.bleed[1],
- bottom: declarations.bleed[2],
- left: declarations.bleed[3]
- };
- break;
- case 3: // top right bottom right
- page.bleed = {
- top: declarations.bleed[0],
- right: declarations.bleed[1],
- bottom: declarations.bleed[2],
- left: declarations.bleed[1]
- };
- break;
- case 2: // top right top right
- page.bleed = {
- top: declarations.bleed[0],
- right: declarations.bleed[1],
- bottom: declarations.bleed[0],
- left: declarations.bleed[1]
- };
- break;
- default:
- page.bleed = {
- top: declarations.bleed[0],
- right: declarations.bleed[0],
- bottom: declarations.bleed[0],
- left: declarations.bleed[0]
- };
- }
- }
- if (declarations.marks) {
- if (!declarations.bleed || declarations.bleed && declarations.bleed[0] === "auto") {
- // Spec say 6pt, but needs more space for marks
- page.bleed = {
- top: { value: 6, unit: "mm" },
- right: { value: 6, unit: "mm" },
- bottom: { value: 6, unit: "mm" },
- left: { value: 6, unit: "mm" }
- };
- }
- page.marks = declarations.marks;
- }
- if (declarations.margin) {
- page.margin = declarations.margin;
- }
- if (declarations.padding) {
- page.padding = declarations.padding;
- }
- if (declarations.border) {
- page.border = declarations.border;
- }
- if (declarations.marks) {
- page.marks = declarations.marks;
- }
- if (needsMerge) {
- page.block.children.appendList(node.block.children);
- } else {
- page.block = node.block;
- }
- // Remove the rule
- list.remove(item);
- }
- /* Handled in breaks */
- /*
- afterParsed(parsed) {
- for (let b in this.named) {
- // Find elements
- let elements = parsed.querySelectorAll(b);
- // Add break data
- for (var i = 0; i < elements.length; i++) {
- elements[i].setAttribute("data-page", this.named[b]);
- }
- }
- }
- */
- afterTreeWalk(ast, sheet) {
- let dirtyPage = "*" in this.pages && this.pages["*"].added === false;
- this.addPageClasses(this.pages, ast, sheet);
- if (dirtyPage) {
- let width = this.pages["*"].width;
- let height = this.pages["*"].height;
- let format = this.pages["*"].format;
- let orientation = this.pages["*"].orientation;
- let bleed = this.pages["*"].bleed;
- let marks = this.pages["*"].marks;
- let bleedverso = undefined;
- let bleedrecto = undefined;
- if (":left" in this.pages) {
- bleedverso = this.pages[":left"].bleed;
- }
- if (":right" in this.pages) {
- bleedrecto = this.pages[":right"].bleed;
- }
- if ((width && height) &&
- (this.width !== width || this.height !== height)) {
- this.width = width;
- this.height = height;
- this.format = format;
- this.orientation = orientation;
- this.addRootVars(ast, width, height, orientation, bleed, bleedrecto, bleedverso, marks);
- this.addRootPage(ast, this.pages["*"].size, bleed, bleedrecto, bleedverso);
- this.emit("size", { width, height, orientation, format, bleed });
- this.emit("atpages", this.pages);
- }
- }
- }
- getTypeSelector(ast) {
- // Find page name
- let name;
- csstree.walk(ast, {
- visit: "TypeSelector",
- enter: (node, item, list) => {
- name = node.name;
- }
- });
- return name;
- }
- getPsuedoSelector(ast) {
- // Find if it has :left & :right & :black & :first
- let name;
- csstree.walk(ast, {
- visit: "PseudoClassSelector",
- enter: (node, item, list) => {
- if (node.name !== "nth") {
- name = node.name;
- }
- }
- });
- return name;
- }
- getNthSelector(ast) {
- // Find if it has :nth
- let nth;
- csstree.walk(ast, {
- visit: "PseudoClassSelector",
- enter: (node, item, list) => {
- if (node.name === "nth" && node.children) {
- let raw = node.children.first();
- nth = raw.value;
- }
- }
- });
- return nth;
- }
- replaceMarginalia(ast) {
- let parsed = {};
- const MARGINS = [
- "top-left-corner", "top-left", "top", "top-center", "top-right", "top-right-corner",
- "bottom-left-corner", "bottom-left", "bottom", "bottom-center", "bottom-right", "bottom-right-corner",
- "left-top", "left-middle", "left", "left-bottom", "top-right-corner",
- "right-top", "right-middle", "right", "right-bottom", "right-right-corner"
- ];
- csstree.walk(ast.block, {
- visit: "Atrule",
- enter: (node, item, list) => {
- let name = node.name;
- if (MARGINS.includes(name)) {
- if (name === "top") {
- name = "top-center";
- }
- if (name === "right") {
- name = "right-middle";
- }
- if (name === "left") {
- name = "left-middle";
- }
- if (name === "bottom") {
- name = "bottom-center";
- }
- parsed[name] = node.block;
- list.remove(item);
- }
- }
- });
- return parsed;
- }
- replaceNotes(ast) {
- let parsed = {};
- csstree.walk(ast.block, {
- visit: "Atrule",
- enter: (node, item, list) => {
- let name = node.name;
- if (name === "footnote") {
- parsed[name] = node.block;
- list.remove(item);
- }
- }
- });
- return parsed;
- }
- replaceDeclarations(ast) {
- let parsed = {};
- csstree.walk(ast.block, {
- visit: "Declaration",
- enter: (declaration, dItem, dList) => {
- let prop = csstree.property(declaration.property).name;
- // let value = declaration.value;
- if (prop === "marks") {
- parsed.marks = [];
- csstree.walk(declaration, {
- visit: "Identifier",
- enter: (ident) => {
- parsed.marks.push(ident.name);
- }
- });
- dList.remove(dItem);
- } else if (prop === "margin") {
- parsed.margin = this.getMargins(declaration);
- dList.remove(dItem);
- } else if (prop.indexOf("margin-") === 0) {
- let m = prop.substring("margin-".length);
- if (!parsed.margin) {
- parsed.margin = {
- top: {},
- right: {},
- left: {},
- bottom: {}
- };
- }
- parsed.margin[m] = declaration.value.children.first();
- dList.remove(dItem);
- } else if (prop === "padding") {
- parsed.padding = this.getPaddings(declaration.value);
- dList.remove(dItem);
- } else if (prop.indexOf("padding-") === 0) {
- let p = prop.substring("padding-".length);
- if (!parsed.padding) {
- parsed.padding = {
- top: {},
- right: {},
- left: {},
- bottom: {}
- };
- }
- parsed.padding[p] = declaration.value.children.first();
- dList.remove(dItem);
- }
- else if (prop === "border") {
- if (!parsed.border) {
- parsed.border = {
- top: {},
- right: {},
- left: {},
- bottom: {}
- };
- }
- parsed.border.top = csstree.generate(declaration.value);
- parsed.border.right = csstree.generate(declaration.value);
- parsed.border.left = csstree.generate(declaration.value);
- parsed.border.bottom = csstree.generate(declaration.value);
- dList.remove(dItem);
- }
- else if (prop.indexOf("border-") === 0) {
- if (!parsed.border) {
- parsed.border = {
- top: {},
- right: {},
- left: {},
- bottom: {}
- };
- }
- let p = prop.substring("border-".length);
- parsed.border[p] = csstree.generate(declaration.value);
- dList.remove(dItem);
- }
- else if (prop === "size") {
- parsed.size = this.getSize(declaration);
- dList.remove(dItem);
- } else if (prop === "bleed") {
- parsed.bleed = [];
- csstree.walk(declaration, {
- enter: (subNode) => {
- switch (subNode.type) {
- case "String": // bleed: "auto"
- if (subNode.value.indexOf("auto") > -1) {
- parsed.bleed.push("auto");
- }
- break;
- case "Dimension": // bleed: 1in 2in, bleed: 20px ect.
- parsed.bleed.push({
- value: subNode.value,
- unit: subNode.unit
- });
- break;
- case "Number":
- parsed.bleed.push({
- value: subNode.value,
- unit: "px"
- });
- break;
- // ignore
- }
- }
- });
- dList.remove(dItem);
- }
- }
- });
- return parsed;
- }
- getSize(declaration) {
- let width, height, orientation, format;
- // Get size: Xmm Ymm
- csstree.walk(declaration, {
- visit: "Dimension",
- enter: (node, item, list) => {
- let { value, unit } = node;
- if (typeof width === "undefined") {
- width = { value, unit };
- } else if (typeof height === "undefined") {
- height = { value, unit };
- }
- }
- });
- // Get size: "A4"
- csstree.walk(declaration, {
- visit: "String",
- enter: (node, item, list) => {
- let name = node.value.replace(/["|']/g, "");
- let s = pageSizes[name];
- if (s) {
- width = s.width;
- height = s.height;
- }
- }
- });
- // Get Format or Landscape or Portrait
- csstree.walk(declaration, {
- visit: "Identifier",
- enter: (node, item, list) => {
- let name = node.name;
- if (name === "landscape" || name === "portrait") {
- orientation = node.name;
- } else if (name !== "auto") {
- let s = pageSizes[name];
- if (s) {
- width = s.width;
- height = s.height;
- }
- format = name;
- }
- }
- });
- return {
- width,
- height,
- orientation,
- format
- };
- }
- getMargins(declaration) {
- let margins = [];
- let margin = {
- top: {},
- right: {},
- left: {},
- bottom: {}
- };
- csstree.walk(declaration, {
- enter: (node) => {
- switch (node.type) {
- case "Dimension": // margin: 1in 2in, margin: 20px, etc...
- margins.push(node);
- break;
- case "Number": // margin: 0
- margins.push({value: node.value, unit: "px"});
- break;
- // ignore
- }
- }
- });
- if (margins.length === 1) {
- for (let m in margin) {
- margin[m] = margins[0];
- }
- } else if (margins.length === 2) {
- margin.top = margins[0];
- margin.right = margins[1];
- margin.bottom = margins[0];
- margin.left = margins[1];
- } else if (margins.length === 3) {
- margin.top = margins[0];
- margin.right = margins[1];
- margin.bottom = margins[2];
- margin.left = margins[1];
- } else if (margins.length === 4) {
- margin.top = margins[0];
- margin.right = margins[1];
- margin.bottom = margins[2];
- margin.left = margins[3];
- }
- return margin;
- }
- getPaddings(declaration) {
- let paddings = [];
- let padding = {
- top: {},
- right: {},
- left: {},
- bottom: {}
- };
- csstree.walk(declaration, {
- enter: (node) => {
- switch (node.type) {
- case "Dimension": // padding: 1in 2in, padding: 20px, etc...
- paddings.push(node);
- break;
- case "Number": // padding: 0
- paddings.push({value: node.value, unit: "px"});
- break;
- // ignore
- }
- }
- });
- if (paddings.length === 1) {
- for (let p in padding) {
- padding[p] = paddings[0];
- }
- } else if (paddings.length === 2) {
- padding.top = paddings[0];
- padding.right = paddings[1];
- padding.bottom = paddings[0];
- padding.left = paddings[1];
- } else if (paddings.length === 3) {
- padding.top = paddings[0];
- padding.right = paddings[1];
- padding.bottom = paddings[2];
- padding.left = paddings[1];
- } else if (paddings.length === 4) {
- padding.top = paddings[0];
- padding.right = paddings[1];
- padding.bottom = paddings[2];
- padding.left = paddings[3];
- }
- return padding;
- }
- // get values for the border on the @page to pass them to the element with the .pagedjs_area class
- getBorders(declaration) {
- let border = {
- top: {},
- right: {},
- left: {},
- bottom: {}
- };
- if (declaration.prop == "border") {
- border.top = csstree.generate(declaration.value);
- border.right = csstree.generate(declaration.value);
- border.bottom = csstree.generate(declaration.value);
- border.left = csstree.generate(declaration.value);
- }
- else if (declaration.prop == "border-top") {
- border.top = csstree.generate(declaration.value);
- }
- else if (declaration.prop == "border-right") {
- border.right = csstree.generate(declaration.value);
- }
- else if (declaration.prop == "border-bottom") {
- border.bottom = csstree.generate(declaration.value);
- }
- else if (declaration.prop == "border-left") {
- border.left = csstree.generate(declaration.value);
- }
- return border;
- }
- addPageClasses(pages, ast, sheet) {
- // First add * page
- if ("*" in pages && pages["*"].added === false) {
- let p = this.createPage(pages["*"], ast.children, sheet);
- sheet.insertRule(p);
- pages["*"].added = true;
- }
- // Add :left & :right
- if (":left" in pages && pages[":left"].added === false) {
- let left = this.createPage(pages[":left"], ast.children, sheet);
- sheet.insertRule(left);
- pages[":left"].added = true;
- }
- if (":right" in pages && pages[":right"].added === false) {
- let right = this.createPage(pages[":right"], ast.children, sheet);
- sheet.insertRule(right);
- pages[":right"].added = true;
- }
- // Add :first & :blank
- if (":first" in pages && pages[":first"].added === false) {
- let first = this.createPage(pages[":first"], ast.children, sheet);
- sheet.insertRule(first);
- pages[":first"].added = true;
- }
- if (":blank" in pages && pages[":blank"].added === false) {
- let blank = this.createPage(pages[":blank"], ast.children, sheet);
- sheet.insertRule(blank);
- pages[":blank"].added = true;
- }
- // Add nth pages
- for (let pg in pages) {
- if (pages[pg].nth && pages[pg].added === false) {
- let nth = this.createPage(pages[pg], ast.children, sheet);
- sheet.insertRule(nth);
- pages[pg].added = true;
- }
- }
- // Add named pages
- for (let pg in pages) {
- if (pages[pg].name && pages[pg].added === false) {
- let named = this.createPage(pages[pg], ast.children, sheet);
- sheet.insertRule(named);
- pages[pg].added = true;
- }
- }
- }
- createPage(page, ruleList, sheet) {
- let selectors = this.selectorsForPage(page);
- let children = page.block.children.copy();
- let block = {
- type: "Block",
- loc: 0,
- children: children
- };
- let rule = this.createRule(selectors, block);
- this.addMarginVars(page.margin, children, children.first());
- this.addPaddingVars(page.padding, children, children.first());
- this.addBorderVars(page.border, children, children.first());
- if (page.width) {
- this.addDimensions(page.width, page.height, page.orientation, children, children.first());
- }
- if (page.marginalia) {
- this.addMarginaliaStyles(page, ruleList, rule, sheet);
- this.addMarginaliaContent(page, ruleList, rule, sheet);
- }
- if(page.notes) {
- this.addNotesStyles(page.notes, page, ruleList, rule, sheet);
- }
- return rule;
- }
- addMarginVars(margin, list, item) {
- // variables for margins
- for (let m in margin) {
- if (typeof margin[m].value !== "undefined") {
- let value = margin[m].value + (margin[m].unit || "");
- let mVar = list.createItem({
- type: "Declaration",
- property: "--pagedjs-margin-" + m,
- value: {
- type: "Raw",
- value: value
- }
- });
- list.append(mVar, item);
- }
- }
- }
- addPaddingVars(padding, list, item) {
- // variables for padding
- for (let p in padding) {
- if (typeof padding[p].value !== "undefined") {
- let value = padding[p].value + (padding[p].unit || "");
- let pVar = list.createItem({
- type: "Declaration",
- property: "--pagedjs-padding-" + p,
- value: {
- type: "Raw",
- value: value
- }
- });
- list.append(pVar, item);
- }
- }
- }
- addBorderVars(border, list, item) {
- // variables for borders
- for (const name of Object.keys(border)) {
- const value = border[name];
- // value is an empty object when undefined
- if (typeof value === "string") {
- const borderItem = list.createItem({
- type: "Declaration",
- property: "--pagedjs-border-" + name,
- value: {
- type: "Raw",
- value: value
- }
- });
- list.append(borderItem, item);
- }
- }
- }
- addDimensions(width, height, orientation, list, item) {
- let widthString, heightString;
- widthString = CSSValueToString(width);
- heightString = CSSValueToString(height);
- if (orientation && orientation !== "portrait") {
- // reverse for orientation
- [widthString, heightString] = [heightString, widthString];
- }
- // width variable
- let wVar = this.createVariable("--pagedjs-pagebox-width", widthString);
- list.appendData(wVar);
- // height variable
- let hVar = this.createVariable("--pagedjs-pagebox-height", heightString);
- list.appendData(hVar);
- // let w = this.createDimension("width", width);
- // let h = this.createDimension("height", height);
- // list.appendData(w);
- // list.appendData(h);
- }
- addMarginaliaStyles(page, list, item, sheet) {
- for (let loc in page.marginalia) {
- let block = csstree.clone(page.marginalia[loc]);
- let hasContent = false;
- if (block.children.isEmpty()) {
- continue;
- }
- csstree.walk(block, {
- visit: "Declaration",
- enter: (node, item, list) => {
- if (node.property === "content") {
- if (node.value.children && node.value.children.first().name === "none") {
- hasContent = false;
- } else {
- hasContent = true;
- }
- list.remove(item);
- }
- if (node.property === "vertical-align") {
- csstree.walk(node, {
- visit: "Identifier",
- enter: (identNode, identItem, identlist) => {
- let name = identNode.name;
- if (name === "top") {
- identNode.name = "flex-start";
- } else if (name === "middle") {
- identNode.name = "center";
- } else if (name === "bottom") {
- identNode.name = "flex-end";
- }
- }
- });
- node.property = "align-items";
- }
- if (node.property === "width" &&
- (loc === "top-left" ||
- loc === "top-center" ||
- loc === "top-right" ||
- loc === "bottom-left" ||
- loc === "bottom-center" ||
- loc === "bottom-right")) {
- let c = csstree.clone(node);
- c.property = "max-width";
- list.appendData(c);
- }
- if (node.property === "height" &&
- (loc === "left-top" ||
- loc === "left-middle" ||
- loc === "left-bottom" ||
- loc === "right-top" ||
- loc === "right-middle" ||
- loc === "right-bottom")) {
- let c = csstree.clone(node);
- c.property = "max-height";
- list.appendData(c);
- }
- }
- });
- let marginSelectors = this.selectorsForPageMargin(page, loc);
- let marginRule = this.createRule(marginSelectors, block);
- list.appendData(marginRule);
- let sel = csstree.generate({
- type: "Selector",
- children: marginSelectors
- });
- this.marginalia[sel] = {
- page: page,
- selector: sel,
- block: page.marginalia[loc],
- hasContent: hasContent
- };
- }
- }
- addMarginaliaContent(page, list, item, sheet) {
- let displayNone;
- // Just content
- for (let loc in page.marginalia) {
- let content = csstree.clone(page.marginalia[loc]);
- csstree.walk(content, {
- visit: "Declaration",
- enter: (node, item, list) => {
- if (node.property !== "content") {
- list.remove(item);
- }
- if (node.value.children && node.value.children.first().name === "none") {
- displayNone = true;
- }
- }
- });
- if (content.children.isEmpty()) {
- continue;
- }
- let displaySelectors = this.selectorsForPageMargin(page, loc);
- let displayDeclaration;
- displaySelectors.insertData({
- type: "Combinator",
- name: ">"
- });
- displaySelectors.insertData({
- type: "ClassSelector",
- name: "pagedjs_margin-content"
- });
- displaySelectors.insertData({
- type: "Combinator",
- name: ">"
- });
- displaySelectors.insertData({
- type: "TypeSelector",
- name: "*"
- });
- if (displayNone) {
- displayDeclaration = this.createDeclaration("display", "none");
- } else {
- displayDeclaration = this.createDeclaration("display", "block");
- }
- let displayRule = this.createRule(displaySelectors, [displayDeclaration]);
- sheet.insertRule(displayRule);
- // insert content rule
- let contentSelectors = this.selectorsForPageMargin(page, loc);
- contentSelectors.insertData({
- type: "Combinator",
- name: ">"
- });
- contentSelectors.insertData({
- type: "ClassSelector",
- name: "pagedjs_margin-content"
- });
- contentSelectors.insertData({
- type: "PseudoElementSelector",
- name: "after",
- children: null
- });
- let contentRule = this.createRule(contentSelectors, content);
- sheet.insertRule(contentRule);
- }
- }
- addRootVars(ast, width, height, orientation, bleed, bleedrecto, bleedverso, marks) {
- let rules = [];
- let selectors = new csstree.List();
- selectors.insertData({
- type: "PseudoClassSelector",
- name: "root",
- children: null
- });
- let widthString, heightString;
- let widthStringRight, heightStringRight;
- let widthStringLeft, heightStringLeft;
- if (!bleed) {
- widthString = CSSValueToString(width);
- heightString = CSSValueToString(height);
- widthStringRight = CSSValueToString(width);
- heightStringRight = CSSValueToString(height);
- widthStringLeft = CSSValueToString(width);
- heightStringLeft = CSSValueToString(height);
- } else {
- widthString = `calc( ${CSSValueToString(width)} + ${CSSValueToString(bleed.left)} + ${CSSValueToString(bleed.right)} )`;
- heightString = `calc( ${CSSValueToString(height)} + ${CSSValueToString(bleed.top)} + ${CSSValueToString(bleed.bottom)} )`;
- widthStringRight = `calc( ${CSSValueToString(width)} + ${CSSValueToString(bleed.left)} + ${CSSValueToString(bleed.right)} )`;
- heightStringRight = `calc( ${CSSValueToString(height)} + ${CSSValueToString(bleed.top)} + ${CSSValueToString(bleed.bottom)} )`;
- widthStringLeft = `calc( ${CSSValueToString(width)} + ${CSSValueToString(bleed.left)} + ${CSSValueToString(bleed.right)} )`;
- heightStringLeft = `calc( ${CSSValueToString(height)} + ${CSSValueToString(bleed.top)} + ${CSSValueToString(bleed.bottom)} )`;
- let bleedTop = this.createVariable("--pagedjs-bleed-top", CSSValueToString(bleed.top));
- let bleedRight = this.createVariable("--pagedjs-bleed-right", CSSValueToString(bleed.right));
- let bleedBottom = this.createVariable("--pagedjs-bleed-bottom", CSSValueToString(bleed.bottom));
- let bleedLeft = this.createVariable("--pagedjs-bleed-left", CSSValueToString(bleed.left));
- let bleedTopRecto = this.createVariable("--pagedjs-bleed-right-top", CSSValueToString(bleed.top));
- let bleedRightRecto = this.createVariable("--pagedjs-bleed-right-right", CSSValueToString(bleed.right));
- let bleedBottomRecto = this.createVariable("--pagedjs-bleed-right-bottom", CSSValueToString(bleed.bottom));
- let bleedLeftRecto = this.createVariable("--pagedjs-bleed-right-left", CSSValueToString(bleed.left));
- let bleedTopVerso = this.createVariable("--pagedjs-bleed-left-top", CSSValueToString(bleed.top));
- let bleedRightVerso = this.createVariable("--pagedjs-bleed-left-right", CSSValueToString(bleed.right));
- let bleedBottomVerso = this.createVariable("--pagedjs-bleed-left-bottom", CSSValueToString(bleed.bottom));
- let bleedLeftVerso = this.createVariable("--pagedjs-bleed-left-left", CSSValueToString(bleed.left));
- if (bleedrecto) {
- bleedTopRecto = this.createVariable("--pagedjs-bleed-right-top", CSSValueToString(bleedrecto.top));
- bleedRightRecto = this.createVariable("--pagedjs-bleed-right-right", CSSValueToString(bleedrecto.right));
- bleedBottomRecto = this.createVariable("--pagedjs-bleed-right-bottom", CSSValueToString(bleedrecto.bottom));
- bleedLeftRecto = this.createVariable("--pagedjs-bleed-right-left", CSSValueToString(bleedrecto.left));
- widthStringRight = `calc( ${CSSValueToString(width)} + ${CSSValueToString(bleedrecto.left)} + ${CSSValueToString(bleedrecto.right)} )`;
- heightStringRight = `calc( ${CSSValueToString(height)} + ${CSSValueToString(bleedrecto.top)} + ${CSSValueToString(bleedrecto.bottom)} )`;
- }
- if (bleedverso) {
- bleedTopVerso = this.createVariable("--pagedjs-bleed-left-top", CSSValueToString(bleedverso.top));
- bleedRightVerso = this.createVariable("--pagedjs-bleed-left-right", CSSValueToString(bleedverso.right));
- bleedBottomVerso = this.createVariable("--pagedjs-bleed-left-bottom", CSSValueToString(bleedverso.bottom));
- bleedLeftVerso = this.createVariable("--pagedjs-bleed-left-left", CSSValueToString(bleedverso.left));
- widthStringLeft = `calc( ${CSSValueToString(width)} + ${CSSValueToString(bleedverso.left)} + ${CSSValueToString(bleedverso.right)} )`;
- heightStringLeft = `calc( ${CSSValueToString(height)} + ${CSSValueToString(bleedverso.top)} + ${CSSValueToString(bleedverso.bottom)} )`;
- }
- let pageWidthVar = this.createVariable("--pagedjs-width", CSSValueToString(width));
- let pageHeightVar = this.createVariable("--pagedjs-height", CSSValueToString(height));
- rules.push(
- bleedTop,
- bleedRight,
- bleedBottom,
- bleedLeft,
- bleedTopRecto,
- bleedRightRecto,
- bleedBottomRecto,
- bleedLeftRecto,
- bleedTopVerso,
- bleedRightVerso,
- bleedBottomVerso,
- bleedLeftVerso,
- pageWidthVar,
- pageHeightVar
- );
- }
- if (marks) {
- marks.forEach((mark) => {
- let markDisplay = this.createVariable("--pagedjs-mark-" + mark + "-display", "block");
- rules.push(markDisplay);
- });
- }
- // orientation variable
- if (orientation) {
- let oVar = this.createVariable("--pagedjs-orientation", orientation);
- rules.push(oVar);
- if (orientation !== "portrait") {
- // reverse for orientation
- [widthString, heightString] = [heightString, widthString];
- [widthStringRight, heightStringRight] = [heightStringRight, widthStringRight];
- [widthStringLeft, heightStringLeft] = [heightStringLeft, widthStringLeft];
- }
- }
- let wVar = this.createVariable("--pagedjs-width", widthString);
- let hVar = this.createVariable("--pagedjs-height", heightString);
- let wVarR = this.createVariable("--pagedjs-width-right", widthStringRight);
- let hVarR = this.createVariable("--pagedjs-height-right", heightStringRight);
- let wVarL = this.createVariable("--pagedjs-width-left", widthStringLeft);
- let hVarL = this.createVariable("--pagedjs-height-left", heightStringLeft);
- rules.push(wVar, hVar, wVarR, hVarR, wVarL, hVarL);
- let rule = this.createRule(selectors, rules);
- ast.children.appendData(rule);
- }
- addNotesStyles(notes, page, list, item, sheet) {
- for (const note in notes) {
- let selectors = this.selectorsForPage(page);
- selectors.insertData({
- type: "Combinator",
- name: " "
- });
- selectors.insertData({
- type: "ClassSelector",
- name: "pagedjs_" + note + "_content"
- });
- let notesRule = this.createRule(selectors, notes[note]);
- list.appendData(notesRule);
- }
- }
- /*
- @page {
- size: var(--pagedjs-width) var(--pagedjs-height);
- margin: 0;
- padding: 0;
- }
- */
- addRootPage(ast, size, bleed, bleedrecto, bleedverso) {
- let { width, height, orientation, format } = size;
- let children = new csstree.List();
- let childrenLeft = new csstree.List();
- let childrenRight = new csstree.List();
- let dimensions = new csstree.List();
- let dimensionsLeft = new csstree.List();
- let dimensionsRight = new csstree.List();
- if (bleed) {
- let widthCalculations = new csstree.List();
- let heightCalculations = new csstree.List();
- // width
- widthCalculations.appendData({
- type: "Dimension",
- unit: width.unit,
- value: width.value
- });
- widthCalculations.appendData({
- type: "WhiteSpace",
- value: " "
- });
- widthCalculations.appendData({
- type: "Operator",
- value: "+"
- });
- widthCalculations.appendData({
- type: "WhiteSpace",
- value: " "
- });
- widthCalculations.appendData({
- type: "Dimension",
- unit: bleed.left.unit,
- value: bleed.left.value
- });
- widthCalculations.appendData({
- type: "WhiteSpace",
- value: " "
- });
- widthCalculations.appendData({
- type: "Operator",
- value: "+"
- });
- widthCalculations.appendData({
- type: "WhiteSpace",
- value: " "
- });
- widthCalculations.appendData({
- type: "Dimension",
- unit: bleed.right.unit,
- value: bleed.right.value
- });
- // height
- heightCalculations.appendData({
- type: "Dimension",
- unit: height.unit,
- value: height.value
- });
- heightCalculations.appendData({
- type: "WhiteSpace",
- value: " "
- });
- heightCalculations.appendData({
- type: "Operator",
- value: "+"
- });
- heightCalculations.appendData({
- type: "WhiteSpace",
- value: " "
- });
- heightCalculations.appendData({
- type: "Dimension",
- unit: bleed.top.unit,
- value: bleed.top.value
- });
- heightCalculations.appendData({
- type: "WhiteSpace",
- value: " "
- });
- heightCalculations.appendData({
- type: "Operator",
- value: "+"
- });
- heightCalculations.appendData({
- type: "WhiteSpace",
- value: " "
- });
- heightCalculations.appendData({
- type: "Dimension",
- unit: bleed.bottom.unit,
- value: bleed.bottom.value
- });
- dimensions.appendData({
- type: "Function",
- name: "calc",
- children: widthCalculations
- });
- dimensions.appendData({
- type: "WhiteSpace",
- value: " "
- });
- dimensions.appendData({
- type: "Function",
- name: "calc",
- children: heightCalculations
- });
- } else if (format) {
- dimensions.appendData({
- type: "Identifier",
- name: format
- });
- if (orientation) {
- dimensions.appendData({
- type: "WhiteSpace",
- value: " "
- });
- dimensions.appendData({
- type: "Identifier",
- name: orientation
- });
- }
- } else {
- dimensions.appendData({
- type: "Dimension",
- unit: width.unit,
- value: width.value
- });
- dimensions.appendData({
- type: "WhiteSpace",
- value: " "
- });
- dimensions.appendData({
- type: "Dimension",
- unit: height.unit,
- value: height.value
- });
- }
- children.appendData({
- type: "Declaration",
- property: "size",
- loc: null,
- value: {
- type: "Value",
- children: dimensions
- }
- });
- children.appendData({
- type: "Declaration",
- property: "margin",
- loc: null,
- value: {
- type: "Value",
- children: [{
- type: "Dimension",
- unit: "px",
- value: 0
- }]
- }
- });
- children.appendData({
- type: "Declaration",
- property: "padding",
- loc: null,
- value: {
- type: "Value",
- children: [{
- type: "Dimension",
- unit: "px",
- value: 0
- }]
- }
- });
- children.appendData({
- type: "Declaration",
- property: "padding",
- loc: null,
- value: {
- type: "Value",
- children: [{
- type: "Dimension",
- unit: "px",
- value: 0
- }]
- }
- });
- let rule = ast.children.createItem({
- type: "Atrule",
- prelude: null,
- name: "page",
- block: {
- type: "Block",
- loc: null,
- children: children
- }
- });
- ast.children.append(rule);
- if (bleedverso) {
- let widthCalculationsLeft = new csstree.List();
- let heightCalculationsLeft = new csstree.List();
- // width
- widthCalculationsLeft.appendData({
- type: "Dimension",
- unit: width.unit,
- value: width.value
- });
- widthCalculationsLeft.appendData({
- type: "WhiteSpace",
- value: " "
- });
- widthCalculationsLeft.appendData({
- type: "Operator",
- value: "+"
- });
- widthCalculationsLeft.appendData({
- type: "WhiteSpace",
- value: " "
- });
- widthCalculationsLeft.appendData({
- type: "Dimension",
- unit: bleedverso.left.unit,
- value: bleedverso.left.value
- });
- widthCalculationsLeft.appendData({
- type: "WhiteSpace",
- value: " "
- });
- widthCalculationsLeft.appendData({
- type: "Operator",
- value: "+"
- });
- widthCalculationsLeft.appendData({
- type: "WhiteSpace",
- value: " "
- });
- widthCalculationsLeft.appendData({
- type: "Dimension",
- unit: bleedverso.right.unit,
- value: bleedverso.right.value
- });
- // height
- heightCalculationsLeft.appendData({
- type: "Dimension",
- unit: height.unit,
- value: height.value
- });
- heightCalculationsLeft.appendData({
- type: "WhiteSpace",
- value: " "
- });
- heightCalculationsLeft.appendData({
- type: "Operator",
- value: "+"
- });
- heightCalculationsLeft.appendData({
- type: "WhiteSpace",
- value: " "
- });
- heightCalculationsLeft.appendData({
- type: "Dimension",
- unit: bleedverso.top.unit,
- value: bleedverso.top.value
- });
- heightCalculationsLeft.appendData({
- type: "WhiteSpace",
- value: " "
- });
- heightCalculationsLeft.appendData({
- type: "Operator",
- value: "+"
- });
- heightCalculationsLeft.appendData({
- type: "WhiteSpace",
- value: " "
- });
- heightCalculationsLeft.appendData({
- type: "Dimension",
- unit: bleedverso.bottom.unit,
- value: bleedverso.bottom.value
- });
- dimensionsLeft.appendData({
- type: "Function",
- name: "calc",
- children: widthCalculationsLeft
- });
- dimensionsLeft.appendData({
- type: "WhiteSpace",
- value: " "
- });
- dimensionsLeft.appendData({
- type: "Function",
- name: "calc",
- children: heightCalculationsLeft
- });
- childrenLeft.appendData({
- type: "Declaration",
- property: "size",
- loc: null,
- value: {
- type: "Value",
- children: dimensionsLeft
- }
- });
- let ruleLeft = ast.children.createItem({
- type: "Atrule",
- prelude: null,
- name: "page :left",
- block: {
- type: "Block",
- loc: null,
- children: childrenLeft
- }
- });
- ast.children.append(ruleLeft);
- }
- if (bleedrecto) {
- let widthCalculationsRight = new csstree.List();
- let heightCalculationsRight = new csstree.List();
- // width
- widthCalculationsRight.appendData({
- type: "Dimension",
- unit: width.unit,
- value: width.value
- });
- widthCalculationsRight.appendData({
- type: "WhiteSpace",
- value: " "
- });
- widthCalculationsRight.appendData({
- type: "Operator",
- value: "+"
- });
- widthCalculationsRight.appendData({
- type: "WhiteSpace",
- value: " "
- });
- widthCalculationsRight.appendData({
- type: "Dimension",
- unit: bleedrecto.left.unit,
- value: bleedrecto.left.value
- });
- widthCalculationsRight.appendData({
- type: "WhiteSpace",
- value: " "
- });
- widthCalculationsRight.appendData({
- type: "Operator",
- value: "+"
- });
- widthCalculationsRight.appendData({
- type: "WhiteSpace",
- value: " "
- });
- widthCalculationsRight.appendData({
- type: "Dimension",
- unit: bleedrecto.right.unit,
- value: bleedrecto.right.value
- });
- // height
- heightCalculationsRight.appendData({
- type: "Dimension",
- unit: height.unit,
- value: height.value
- });
- heightCalculationsRight.appendData({
- type: "WhiteSpace",
- value: " "
- });
- heightCalculationsRight.appendData({
- type: "Operator",
- value: "+"
- });
- heightCalculationsRight.appendData({
- type: "WhiteSpace",
- value: " "
- });
- heightCalculationsRight.appendData({
- type: "Dimension",
- unit: bleedrecto.top.unit,
- value: bleedrecto.top.value
- });
- heightCalculationsRight.appendData({
- type: "WhiteSpace",
- value: " "
- });
- heightCalculationsRight.appendData({
- type: "Operator",
- value: "+"
- });
- heightCalculationsRight.appendData({
- type: "WhiteSpace",
- value: " "
- });
- heightCalculationsRight.appendData({
- type: "Dimension",
- unit: bleedrecto.bottom.unit,
- value: bleedrecto.bottom.value
- });
- dimensionsRight.appendData({
- type: "Function",
- name: "calc",
- children: widthCalculationsRight
- });
- dimensionsRight.appendData({
- type: "WhiteSpace",
- value: " "
- });
- dimensionsRight.appendData({
- type: "Function",
- name: "calc",
- children: heightCalculationsRight
- });
- childrenRight.appendData({
- type: "Declaration",
- property: "size",
- loc: null,
- value: {
- type: "Value",
- children: dimensionsRight
- }
- });
- let ruleRight = ast.children.createItem({
- type: "Atrule",
- prelude: null,
- name: "page :right",
- block: {
- type: "Block",
- loc: null,
- children: childrenRight
- }
- });
- ast.children.append(ruleRight);
- }
- }
- getNth(nth) {
- let n = nth.indexOf("n");
- let plus = nth.indexOf("+");
- let splitN = nth.split("n");
- let splitP = nth.split("+");
- let a = null;
- let b = null;
- if (n > -1) {
- a = splitN[0];
- if (plus > -1) {
- b = splitP[1];
- }
- } else {
- b = nth;
- }
- return {
- type: "Nth",
- loc: null,
- selector: null,
- nth: {
- type: "AnPlusB",
- loc: null,
- a: a,
- b: b
- }
- };
- }
- addPageAttributes(page, start, pages) {
- let namedPages = [start.dataset.page];
- if (namedPages && namedPages.length) {
- for (const named of namedPages) {
- if (!named) {
- continue;
- }
- page.name = named;
- page.element.classList.add("pagedjs_named_page");
- page.element.classList.add("pagedjs_" + named + "_page");
- if (!start.dataset.splitFrom) {
- page.element.classList.add("pagedjs_" + named + "_first_page");
- }
- }
- }
- }
- getStartElement(content, breakToken) {
- let node = breakToken && breakToken.node;
- if (!content && !breakToken) {
- return;
- }
- // No break
- if (!node) {
- return content.children[0];
- }
- // Top level element
- if (node.nodeType === 1 && node.parentNode.nodeType === 11) {
- return node;
- }
- // Named page
- if (node.nodeType === 1 && node.dataset.page) {
- return node;
- }
- // Get top level Named parent
- let fragment = rebuildAncestors(node);
- let pages = fragment.querySelectorAll("[data-page]");
- if (pages.length) {
- return pages[pages.length - 1];
- } else {
- return fragment.children[0];
- }
- }
- beforePageLayout(page, contents, breakToken, chunker) {
- let start = this.getStartElement(contents, breakToken);
- if (start) {
- this.addPageAttributes(page, start, chunker.pages);
- }
- // page.element.querySelector('.paged_area').style.color = red;
- }
- finalizePage(fragment, page, breakToken, chunker) {
- for (let m in this.marginalia) {
- let margin = this.marginalia[m];
- let sels = m.split(" ");
- let content;
- if (page.element.matches(sels[0]) && margin.hasContent) {
- content = page.element.querySelector(sels[1]);
- content.classList.add("hasContent");
- }
- }
- // check center
- ["top", "bottom"].forEach((loc) => {
- let marginGroup = page.element.querySelector(".pagedjs_margin-" + loc);
- let center = page.element.querySelector(".pagedjs_margin-" + loc + "-center");
- let left = page.element.querySelector(".pagedjs_margin-" + loc + "-left");
- let right = page.element.querySelector(".pagedjs_margin-" + loc + "-right");
- let centerContent = center.classList.contains("hasContent");
- let leftContent = left.classList.contains("hasContent");
- let rightContent = right.classList.contains("hasContent");
- let centerWidth, leftWidth, rightWidth;
- if (leftContent) {
- leftWidth = window.getComputedStyle(left)["max-width"];
- }
- if (rightContent) {
- rightWidth = window.getComputedStyle(right)["max-width"];
- }
- if (centerContent) {
- centerWidth = window.getComputedStyle(center)["max-width"];
- if (centerWidth === "none" || centerWidth === "auto") {
- if (!leftContent && !rightContent) {
- marginGroup.style["grid-template-columns"] = "0 1fr 0";
- } else if (leftContent) {
- if (!rightContent) {
- if (leftWidth !== "none" && leftWidth !== "auto") {
- marginGroup.style["grid-template-columns"] = leftWidth + " 1fr " + leftWidth;
- } else {
- marginGroup.style["grid-template-columns"] = "auto auto 1fr";
- left.style["white-space"] = "nowrap";
- center.style["white-space"] = "nowrap";
- let leftOuterWidth = left.offsetWidth;
- let centerOuterWidth = center.offsetWidth;
- let outerwidths = leftOuterWidth + centerOuterWidth;
- let newcenterWidth = centerOuterWidth * 100 / outerwidths;
- marginGroup.style["grid-template-columns"] = "minmax(16.66%, 1fr) minmax(33%, " + newcenterWidth + "%) minmax(16.66%, 1fr)";
- left.style["white-space"] = "normal";
- center.style["white-space"] = "normal";
- }
- } else {
- if (leftWidth !== "none" && leftWidth !== "auto") {
- if (rightWidth !== "none" && rightWidth !== "auto") {
- marginGroup.style["grid-template-columns"] = leftWidth + " 1fr " + rightWidth;
- } else {
- marginGroup.style["grid-template-columns"] = leftWidth + " 1fr " + leftWidth;
- }
- } else {
- if (rightWidth !== "none" && rightWidth !== "auto") {
- marginGroup.style["grid-template-columns"] = rightWidth + " 1fr " + rightWidth;
- } else {
- marginGroup.style["grid-template-columns"] = "auto auto 1fr";
- left.style["white-space"] = "nowrap";
- center.style["white-space"] = "nowrap";
- right.style["white-space"] = "nowrap";
- let leftOuterWidth = left.offsetWidth;
- let centerOuterWidth = center.offsetWidth;
- let rightOuterWidth = right.offsetWidth;
- let outerwidths = leftOuterWidth + centerOuterWidth + rightOuterWidth;
- let newcenterWidth = centerOuterWidth * 100 / outerwidths;
- if (newcenterWidth > 40) {
- marginGroup.style["grid-template-columns"] = "minmax(16.66%, 1fr) minmax(33%, " + newcenterWidth + "%) minmax(16.66%, 1fr)";
- } else {
- marginGroup.style["grid-template-columns"] = "repeat(3, 1fr)";
- }
- left.style["white-space"] = "normal";
- center.style["white-space"] = "normal";
- right.style["white-space"] = "normal";
- }
- }
- }
- } else {
- if (rightWidth !== "none" && rightWidth !== "auto") {
- marginGroup.style["grid-template-columns"] = rightWidth + " 1fr " + rightWidth;
- } else {
- marginGroup.style["grid-template-columns"] = "auto auto 1fr";
- right.style["white-space"] = "nowrap";
- center.style["white-space"] = "nowrap";
- let rightOuterWidth = right.offsetWidth;
- let centerOuterWidth = center.offsetWidth;
- let outerwidths = rightOuterWidth + centerOuterWidth;
- let newcenterWidth = centerOuterWidth * 100 / outerwidths;
- marginGroup.style["grid-template-columns"] = "minmax(16.66%, 1fr) minmax(33%, " + newcenterWidth + "%) minmax(16.66%, 1fr)";
- right.style["white-space"] = "normal";
- center.style["white-space"] = "normal";
- }
- }
- } else if (centerWidth !== "none" && centerWidth !== "auto") {
- if (leftContent && leftWidth !== "none" && leftWidth !== "auto") {
- marginGroup.style["grid-template-columns"] = leftWidth + " " + centerWidth + " 1fr";
- } else if (rightContent && rightWidth !== "none" && rightWidth !== "auto") {
- marginGroup.style["grid-template-columns"] = "1fr " + centerWidth + " " + rightWidth;
- } else {
- marginGroup.style["grid-template-columns"] = "1fr " + centerWidth + " 1fr";
- }
- }
- } else {
- if (leftContent) {
- if (!rightContent) {
- marginGroup.style["grid-template-columns"] = "1fr 0 0";
- } else {
- if (leftWidth !== "none" && leftWidth !== "auto") {
- if (rightWidth !== "none" && rightWidth !== "auto") {
- marginGroup.style["grid-template-columns"] = leftWidth + " 1fr " + rightWidth;
- } else {
- marginGroup.style["grid-template-columns"] = leftWidth + " 0 1fr";
- }
- } else {
- if (rightWidth !== "none" && rightWidth !== "auto") {
- marginGroup.style["grid-template-columns"] = "1fr 0 " + rightWidth;
- } else {
- marginGroup.style["grid-template-columns"] = "auto 1fr auto";
- left.style["white-space"] = "nowrap";
- right.style["white-space"] = "nowrap";
- let leftOuterWidth = left.offsetWidth;
- let rightOuterWidth = right.offsetWidth;
- let outerwidths = leftOuterWidth + rightOuterWidth;
- let newLeftWidth = leftOuterWidth * 100 / outerwidths;
- marginGroup.style["grid-template-columns"] = "minmax(16.66%, " + newLeftWidth + "%) 0 1fr";
- left.style["white-space"] = "normal";
- right.style["white-space"] = "normal";
- }
- }
- }
- } else {
- if (rightWidth !== "none" && rightWidth !== "auto") {
- marginGroup.style["grid-template-columns"] = "1fr 0 " + rightWidth;
- } else {
- marginGroup.style["grid-template-columns"] = "0 0 1fr";
- }
- }
- }
- });
- // check middle
- ["left", "right"].forEach((loc) => {
- let middle = page.element.querySelector(".pagedjs_margin-" + loc + "-middle.hasContent");
- let marginGroup = page.element.querySelector(".pagedjs_margin-" + loc);
- let top = page.element.querySelector(".pagedjs_margin-" + loc + "-top");
- let bottom = page.element.querySelector(".pagedjs_margin-" + loc + "-bottom");
- let topContent = top.classList.contains("hasContent");
- let bottomContent = bottom.classList.contains("hasContent");
- let middleHeight, topHeight, bottomHeight;
- if (topContent) {
- topHeight = window.getComputedStyle(top)["max-height"];
- }
- if (bottomContent) {
- bottomHeight = window.getComputedStyle(bottom)["max-height"];
- }
- if (middle) {
- middleHeight = window.getComputedStyle(middle)["max-height"];
- if (middleHeight === "none" || middleHeight === "auto") {
- if (!topContent && !bottomContent) {
- marginGroup.style["grid-template-rows"] = "0 1fr 0";
- } else if (topContent) {
- if (!bottomContent) {
- if (topHeight !== "none" && topHeight !== "auto") {
- marginGroup.style["grid-template-rows"] = topHeight + " calc(100% - " + topHeight + "*2) " + topHeight;
- }
- } else {
- if (topHeight !== "none" && topHeight !== "auto") {
- if (bottomHeight !== "none" && bottomHeight !== "auto") {
- marginGroup.style["grid-template-rows"] = topHeight + " calc(100% - " + topHeight + " - " + bottomHeight + ") " + bottomHeight;
- } else {
- marginGroup.style["grid-template-rows"] = topHeight + " calc(100% - " + topHeight + "*2) " + topHeight;
- }
- } else {
- if (bottomHeight !== "none" && bottomHeight !== "auto") {
- marginGroup.style["grid-template-rows"] = bottomHeight + " calc(100% - " + bottomHeight + "*2) " + bottomHeight;
- }
- }
- }
- } else {
- if (bottomHeight !== "none" && bottomHeight !== "auto") {
- marginGroup.style["grid-template-rows"] = bottomHeight + " calc(100% - " + bottomHeight + "*2) " + bottomHeight;
- }
- }
- } else {
- if (topContent && topHeight !== "none" && topHeight !== "auto") {
- marginGroup.style["grid-template-rows"] = topHeight + " " + middleHeight + " calc(100% - (" + topHeight + " + " + middleHeight + "))";
- } else if (bottomContent && bottomHeight !== "none" && bottomHeight !== "auto") {
- marginGroup.style["grid-template-rows"] = "1fr " + middleHeight + " " + bottomHeight;
- } else {
- marginGroup.style["grid-template-rows"] = "calc((100% - " + middleHeight + ")/2) " + middleHeight + " calc((100% - " + middleHeight + ")/2)";
- }
- }
- } else {
- if (topContent) {
- if (!bottomContent) {
- marginGroup.style["grid-template-rows"] = "1fr 0 0";
- } else {
- if (topHeight !== "none" && topHeight !== "auto") {
- if (bottomHeight !== "none" && bottomHeight !== "auto") {
- marginGroup.style["grid-template-rows"] = topHeight + " 1fr " + bottomHeight;
- } else {
- marginGroup.style["grid-template-rows"] = topHeight + " 0 1fr";
- }
- } else {
- if (bottomHeight !== "none" && bottomHeight !== "auto") {
- marginGroup.style["grid-template-rows"] = "1fr 0 " + bottomHeight;
- } else {
- marginGroup.style["grid-template-rows"] = "1fr 0 1fr";
- }
- }
- }
- } else {
- if (bottomHeight !== "none" && bottomHeight !== "auto") {
- marginGroup.style["grid-template-rows"] = "1fr 0 " + bottomHeight;
- } else {
- marginGroup.style["grid-template-rows"] = "0 0 1fr";
- }
- }
- }
- });
- }
- // CSS Tree Helpers
- selectorsForPage(page) {
- let nthlist;
- let nth;
- let selectors = new csstree.List();
- selectors.insertData({
- type: "ClassSelector",
- name: "pagedjs_page"
- });
- // Named page
- if (page.name) {
- selectors.insertData({
- type: "ClassSelector",
- name: "pagedjs_named_page"
- });
- selectors.insertData({
- type: "ClassSelector",
- name: "pagedjs_" + page.name + "_page"
- });
- }
- // PsuedoSelector
- if (page.psuedo && !(page.name && page.psuedo === "first")) {
- selectors.insertData({
- type: "ClassSelector",
- name: "pagedjs_" + page.psuedo + "_page"
- });
- }
- if (page.name && page.psuedo === "first") {
- selectors.insertData({
- type: "ClassSelector",
- name: "pagedjs_" + page.name + "_" + page.psuedo + "_page"
- });
- }
- // Nth
- if (page.nth) {
- nthlist = new csstree.List();
- nth = this.getNth(page.nth);
- nthlist.insertData(nth);
- selectors.insertData({
- type: "PseudoClassSelector",
- name: "nth-of-type",
- children: nthlist
- });
- }
- return selectors;
- }
- selectorsForPageMargin(page, margin) {
- let selectors = this.selectorsForPage(page);
- selectors.insertData({
- type: "Combinator",
- name: " "
- });
- selectors.insertData({
- type: "ClassSelector",
- name: "pagedjs_margin-" + margin
- });
- return selectors;
- }
- createDeclaration(property, value, important) {
- let children = new csstree.List();
- children.insertData({
- type: "Identifier",
- loc: null,
- name: value
- });
- return {
- type: "Declaration",
- loc: null,
- important: important,
- property: property,
- value: {
- type: "Value",
- loc: null,
- children: children
- }
- };
- }
- createVariable(property, value) {
- return {
- type: "Declaration",
- loc: null,
- property: property,
- value: {
- type: "Raw",
- value: value
- }
- };
- }
- createCalculatedDimension(property, items, important, operator = "+") {
- let children = new csstree.List();
- let calculations = new csstree.List();
- items.forEach((item, index) => {
- calculations.appendData({
- type: "Dimension",
- unit: item.unit,
- value: item.value
- });
- calculations.appendData({
- type: "WhiteSpace",
- value: " "
- });
- if (index + 1 < items.length) {
- calculations.appendData({
- type: "Operator",
- value: operator
- });
- calculations.appendData({
- type: "WhiteSpace",
- value: " "
- });
- }
- });
- children.insertData({
- type: "Function",
- loc: null,
- name: "calc",
- children: calculations
- });
- return {
- type: "Declaration",
- loc: null,
- important: important,
- property: property,
- value: {
- type: "Value",
- loc: null,
- children: children
- }
- };
- }
- createDimension(property, cssValue, important) {
- let children = new csstree.List();
- children.insertData({
- type: "Dimension",
- loc: null,
- value: cssValue.value,
- unit: cssValue.unit
- });
- return {
- type: "Declaration",
- loc: null,
- important: important,
- property: property,
- value: {
- type: "Value",
- loc: null,
- children: children
- }
- };
- }
- createBlock(declarations) {
- let block = new csstree.List();
- declarations.forEach((declaration) => {
- block.insertData(declaration);
- });
- return {
- type: "Block",
- loc: null,
- children: block
- };
- }
- createRule(selectors, block) {
- let selectorList = new csstree.List();
- selectorList.insertData({
- type: "Selector",
- children: selectors
- });
- if (Array.isArray(block)) {
- block = this.createBlock(block);
- }
- return {
- type: "Rule",
- prelude: {
- type: "SelectorList",
- children: selectorList
- },
- block: block
- };
- }
- }
- class Breaks extends Handler {
- constructor(chunker, polisher, caller) {
- super(chunker, polisher, caller);
- this.breaks = {};
- }
- onDeclaration(declaration, dItem, dList, rule) {
- let property = declaration.property;
- if (property === "page") {
- let children = declaration.value.children.first();
- let value = children.name;
- let selector = csstree.generate(rule.ruleNode.prelude);
- let name = value;
- let breaker = {
- property: property,
- value: value,
- selector: selector,
- name: name
- };
- selector.split(",").forEach((s) => {
- if (!this.breaks[s]) {
- this.breaks[s] = [breaker];
- } else {
- this.breaks[s].push(breaker);
- }
- });
- dList.remove(dItem);
- }
- if (property === "break-before" ||
- property === "break-after" ||
- property === "page-break-before" ||
- property === "page-break-after"
- ) {
- let child = declaration.value.children.first();
- let value = child.name;
- let selector = csstree.generate(rule.ruleNode.prelude);
- if (property === "page-break-before") {
- property = "break-before";
- } else if (property === "page-break-after") {
- property = "break-after";
- }
- let breaker = {
- property: property,
- value: value,
- selector: selector
- };
- selector.split(",").forEach((s) => {
- if (!this.breaks[s]) {
- this.breaks[s] = [breaker];
- } else {
- this.breaks[s].push(breaker);
- }
- });
- // Remove from CSS -- handle right / left in module
- dList.remove(dItem);
- }
- }
- afterParsed(parsed) {
- this.processBreaks(parsed, this.breaks);
- }
- processBreaks(parsed, breaks) {
- for (let b in breaks) {
- // Find elements
- let elements = parsed.querySelectorAll(b);
- // Add break data
- for (var i = 0; i < elements.length; i++) {
- for (let prop of breaks[b]) {
- if (prop.property === "break-after") {
- let nodeAfter = displayedElementAfter(elements[i], parsed);
- elements[i].setAttribute("data-break-after", prop.value);
- if (nodeAfter) {
- nodeAfter.setAttribute("data-previous-break-after", prop.value);
- }
- } else if (prop.property === "break-before") {
- let nodeBefore = displayedElementBefore(elements[i], parsed);
- // Breaks are only allowed between siblings, not between a box and its container.
- // If we cannot find a node before we should not break!
- // https://drafts.csswg.org/css-break-3/#break-propagation
- if (nodeBefore) {
- if (prop.value === "page" && needsPageBreak(elements[i], nodeBefore)) {
- // we ignore this explicit page break because an implicit page break is already needed
- continue;
- }
- elements[i].setAttribute("data-break-before", prop.value);
- nodeBefore.setAttribute("data-next-break-before", prop.value);
- }
- } else if (prop.property === "page") {
- elements[i].setAttribute("data-page", prop.value);
- let nodeAfter = displayedElementAfter(elements[i], parsed);
- if (nodeAfter) {
- nodeAfter.setAttribute("data-after-page", prop.value);
- }
- } else {
- elements[i].setAttribute("data-" + prop.property, prop.value);
- }
- }
- }
- }
- }
- mergeBreaks(pageBreaks, newBreaks) {
- for (let b in newBreaks) {
- if (b in pageBreaks) {
- pageBreaks[b] = pageBreaks[b].concat(newBreaks[b]);
- } else {
- pageBreaks[b] = newBreaks[b];
- }
- }
- return pageBreaks;
- }
- addBreakAttributes(pageElement, page) {
- let before = pageElement.querySelector("[data-break-before]");
- let after = pageElement.querySelector("[data-break-after]");
- let previousBreakAfter = pageElement.querySelector("[data-previous-break-after]");
- if (before) {
- if (before.dataset.splitFrom) {
- page.splitFrom = before.dataset.splitFrom;
- pageElement.setAttribute("data-split-from", before.dataset.splitFrom);
- } else if (before.dataset.breakBefore && before.dataset.breakBefore !== "avoid") {
- page.breakBefore = before.dataset.breakBefore;
- pageElement.setAttribute("data-break-before", before.dataset.breakBefore);
- }
- }
- if (after && after.dataset) {
- if (after.dataset.splitTo) {
- page.splitTo = after.dataset.splitTo;
- pageElement.setAttribute("data-split-to", after.dataset.splitTo);
- } else if (after.dataset.breakAfter && after.dataset.breakAfter !== "avoid") {
- page.breakAfter = after.dataset.breakAfter;
- pageElement.setAttribute("data-break-after", after.dataset.breakAfter);
- }
- }
- if (previousBreakAfter && previousBreakAfter.dataset) {
- if (previousBreakAfter.dataset.previousBreakAfter && previousBreakAfter.dataset.previousBreakAfter !== "avoid") {
- page.previousBreakAfter = previousBreakAfter.dataset.previousBreakAfter;
- }
- }
- }
- afterPageLayout(pageElement, page) {
- this.addBreakAttributes(pageElement, page);
- }
- }
- class PrintMedia extends Handler {
- constructor(chunker, polisher, caller) {
- super(chunker, polisher, caller);
- }
- onAtMedia(node, item, list) {
- let media = this.getMediaName(node);
- let rules;
- if (media.includes("print")) {
- rules = node.block.children;
- // Append rules to the end of main rules list
- // TODO: this isn't working right, needs to check what is in the prelude
- /*
- rules.forEach((selectList) => {
- if (selectList.prelude) {
- selectList.prelude.children.forEach((rule) => {
- rule.children.prependData({
- type: "Combinator",
- name: " "
- });
-
- rule.children.prependData({
- type: "ClassSelector",
- name: "pagedjs_page"
- });
- });
- }
- });
- list.insertList(rules, item);
- */
- // Append rules to the end of main rules list
- list.appendList(rules);
- // Remove rules from the @media block
- list.remove(item);
- } else if (!media.includes("all") && !media.includes("pagedjs-ignore")) {
- list.remove(item);
- }
- }
- getMediaName(node) {
- let media = [];
- if (typeof node.prelude === "undefined" ||
- node.prelude.type !== "AtrulePrelude" ) {
- return;
- }
- csstree.walk(node.prelude, {
- visit: "Identifier",
- enter: (identNode, iItem, iList) => {
- media.push(identNode.name);
- }
- });
- return media;
- }
- }
- class Splits extends Handler {
- constructor(chunker, polisher, caller) {
- super(chunker, polisher, caller);
- }
- afterPageLayout(pageElement, page, breakToken, chunker) {
- let splits = Array.from(pageElement.querySelectorAll("[data-split-from]"));
- let pages = pageElement.parentNode;
- let index = Array.prototype.indexOf.call(pages.children, pageElement);
- let prevPage;
- if (index === 0) {
- return;
- }
- prevPage = pages.children[index - 1];
- let from; // Capture the last from element
- splits.forEach((split) => {
- let ref = split.dataset.ref;
- from = prevPage.querySelector("[data-ref='"+ ref +"']:not([data-split-to])");
- if (from) {
- from.dataset.splitTo = ref;
- if (!from.dataset.splitFrom) {
- from.dataset.splitOriginal = true;
- }
- }
- });
- // Fix alignment on the deepest split element
- if (from) {
- this.handleAlignment(from);
- }
- }
- handleAlignment(node) {
- let styles = window.getComputedStyle(node);
- let align = styles["text-align"];
- let alignLast = styles["text-align-last"];
- node.dataset.lastSplitElement = "true";
- if (align === "justify" && alignLast === "auto") {
- node.dataset.alignLastSplitElement = "justify";
- } else {
- node.dataset.alignLastSplitElement = alignLast;
- }
- }
- }
- class Counters extends Handler {
- constructor(chunker, polisher, caller) {
- super(chunker, polisher, caller);
- this.styleSheet = polisher.styleSheet;
- this.counters = {};
- this.resetCountersMap = new Map();
- }
- onDeclaration(declaration, dItem, dList, rule) {
- let property = declaration.property;
- if (property === "counter-increment") {
- this.handleIncrement(declaration, rule);
- // clean up empty declaration
- let hasProperities = false;
- declaration.value.children.forEach((data) => {
- if (data.type && data.type !== "WhiteSpace") {
- hasProperities = true;
- }
- });
- if (!hasProperities) {
- dList.remove(dItem);
- }
- } else if (property === "counter-reset") {
- this.handleReset(declaration, rule);
- // clean up empty declaration
- let hasProperities = false;
- declaration.value.children.forEach((data) => {
- if (data.type && data.type !== "WhiteSpace") {
- hasProperities = true;
- }
- });
- if (!hasProperities) {
- dList.remove(dItem);
- }
- }
- }
- afterParsed(parsed) {
- this.processCounters(parsed, this.counters);
- this.scopeCounters(this.counters);
- }
- addCounter(name) {
- if (name in this.counters) {
- return this.counters[name];
- }
- this.counters[name] = {
- name: name,
- increments: {},
- resets: {}
- };
- return this.counters[name];
- }
- handleIncrement(declaration, rule) {
- let increments = [];
- let children = declaration.value.children;
- children.forEach((data, item) => {
- if (data.type && data.type === "Identifier") {
- let name = data.name;
- if (name === "page" || name.indexOf("target-counter-") === 0) {
- return;
- }
- let whitespace, number, value;
- if (item.next && item.next.data.type === "WhiteSpace") {
- whitespace = item.next;
- }
- if (whitespace && whitespace.next && whitespace.next.data.type === "Number") {
- number = whitespace.next;
- value = parseInt(number.data.value);
- }
- let selector = csstree.generate(rule.ruleNode.prelude);
- let counter;
- if (!(name in this.counters)) {
- counter = this.addCounter(name);
- } else {
- counter = this.counters[name];
- }
- let increment = {
- selector: selector,
- number: value || 1
- };
- counter.increments[selector] = increment;
- increments.push(increment);
- // Remove the parsed resets
- children.remove(item);
- if (whitespace) {
- children.remove(whitespace);
- }
- if (number) {
- children.remove(number);
- }
- }
- });
-
- return increments;
- }
- handleReset(declaration, rule) {
- let children = declaration.value.children;
- children.forEach((data, item) => {
- if (data.type && data.type === "Identifier") {
- let name = data.name;
- let whitespace, number, value;
- if (item.next && item.next.data.type === "WhiteSpace") {
- whitespace = item.next;
- }
- if (whitespace && whitespace.next) {
- if (whitespace.next.data.type === "Number") {
- // The counter reset value is specified using a number. E.g. counter-reset: c2 5;
- number = whitespace.next;
- value = parseInt(number.data.value);
- } else if (whitespace.next.data.type === "Function" && whitespace.next.data.name === "var") {
- // The counter reset value is specified using a CSS variable (custom property).
- // E.g. counter-reset: c2 var(--my-variable);
- // See https://developer.mozilla.org/en-US/docs/Web/CSS/var
- number = whitespace.next;
- // Use the variable name (e.g. '--my-variable') as value for now. The actual value is resolved later by the
- // processCounterResets function.
- value = whitespace.next.data.children.head.data.name;
- }
- }
- let counter;
- let selector;
- let prelude = rule.ruleNode.prelude;
- if (rule.ruleNode.type === "Atrule" && rule.ruleNode.name === "page") {
- selector = ".pagedjs_page";
- } else {
- selector = csstree.generate(prelude || rule.ruleNode);
- }
- if (name === "footnote") {
- this.addFootnoteMarkerCounter(declaration.value.children);
- }
- if (!(name in this.counters)) {
- counter = this.addCounter(name);
- } else {
- counter = this.counters[name];
- }
- let reset = {
- selector: selector,
- number: value || 0
- };
- counter.resets[selector] = reset;
- if (selector !== ".pagedjs_page") {
- // Remove the parsed resets
- children.remove(item);
- if (whitespace) {
- children.remove(whitespace);
- }
- if (number) {
- children.remove(number);
- }
- }
- }
- });
- }
- processCounters(parsed, counters) {
- let counter;
- for (let c in counters) {
- counter = this.counters[c];
- this.processCounterIncrements(parsed, counter);
- this.processCounterResets(parsed, counter);
- if (c !== "page") {
- this.addCounterValues(parsed, counter);
- }
- }
- }
- scopeCounters(counters) {
- let countersArray = [];
- for (let c in counters) {
- if(c !== "page") {
- countersArray.push(`${counters[c].name} 0`);
- }
- }
- // Add to pages to allow cross page scope
- this.insertRule(`.pagedjs_pages { counter-reset: ${countersArray.join(" ")} page 0 pages var(--pagedjs-page-count) footnote var(--pagedjs-footnotes-count) footnote-marker var(--pagedjs-footnotes-count)}`);
- }
- insertRule(rule) {
- this.styleSheet.insertRule(rule, this.styleSheet.cssRules.length);
- }
- processCounterIncrements(parsed, counter) {
- let increment;
- for (let inc in counter.increments) {
- increment = counter.increments[inc];
- // Find elements for increments
- let incrementElements = parsed.querySelectorAll(increment.selector);
- // Add counter data
- for (let i = 0; i < incrementElements.length; i++) {
- incrementElements[i].setAttribute("data-counter-"+ counter.name +"-increment", increment.number);
- if (incrementElements[i].getAttribute("data-counter-increment")) {
- incrementElements[i].setAttribute("data-counter-increment", incrementElements[i].getAttribute("data-counter-increment") + " " + counter.name);
- } else {
- incrementElements[i].setAttribute("data-counter-increment", counter.name);
- }
- }
- }
- }
- processCounterResets(parsed, counter) {
- let reset;
- for (let r in counter.resets) {
- reset = counter.resets[r];
- // Find elements for resets
- let resetElements = parsed.querySelectorAll(reset.selector);
- // Add counter data
- for (var i = 0; i < resetElements.length; i++) {
- let value = reset.number;
- if (typeof value === "string" && value.startsWith("--")) {
- // The value is specified using a CSS variable (custom property).
- // FIXME: We get the variable value only from the inline style of the element because at this point the
- // element is detached and thus using:
- //
- // getComputedStyle(resetElements[i]).getPropertyValue(value)
- //
- // always returns an empty string. We could try to temporarily attach the element to get its computed style,
- // but for now using the inline style is enough for us.
- value = resetElements[i].style.getPropertyValue(value) || 0;
- }
- resetElements[i].setAttribute("data-counter-"+ counter.name +"-reset", value);
- if (resetElements[i].getAttribute("data-counter-reset")) {
- resetElements[i].setAttribute("data-counter-reset", resetElements[i].getAttribute("data-counter-reset") + " " + counter.name);
- } else {
- resetElements[i].setAttribute("data-counter-reset", counter.name);
- }
- }
- }
- }
- addCounterValues(parsed, counter) {
- let counterName = counter.name;
- if (counterName === "page" || counterName === "footnote") {
- return;
- }
- let elements = parsed.querySelectorAll("[data-counter-"+ counterName +"-reset], [data-counter-"+ counterName +"-increment]");
- let count = 0;
- let element;
- let increment, reset;
- let resetValue, incrementValue, resetDelta;
- let incrementArray;
- for (let i = 0; i < elements.length; i++) {
- element = elements[i];
- resetDelta = 0;
- incrementArray = [];
- if (element.hasAttribute("data-counter-"+ counterName +"-reset")) {
- reset = element.getAttribute("data-counter-"+ counterName +"-reset");
- resetValue = parseInt(reset);
- // Use negative increment value inplace of reset
- resetDelta = resetValue - count;
- incrementArray.push(`${counterName} ${resetDelta}`);
- count = resetValue;
- }
- if (element.hasAttribute("data-counter-"+ counterName +"-increment")) {
- increment = element.getAttribute("data-counter-"+ counterName +"-increment");
- incrementValue = parseInt(increment);
- count += incrementValue;
- element.setAttribute("data-counter-"+counterName+"-value", count);
- incrementArray.push(`${counterName} ${incrementValue}`);
- }
- if (incrementArray.length > 0) {
- this.incrementCounterForElement(element, incrementArray);
- }
- }
- }
- addFootnoteMarkerCounter(list) {
- let markers = [];
- csstree.walk(list, {
- visit: "Identifier",
- enter: (identNode, iItem, iList) => {
- markers.push(identNode.name);
- }
- });
- // Already added
- if (markers.includes("footnote-maker")) {
- return;
- }
- list.insertData({
- type: "WhiteSpace",
- value: " "
- });
- list.insertData({
- type: "Identifier",
- name: "footnote-marker"
- });
- list.insertData({
- type: "WhiteSpace",
- value: " "
- });
- list.insertData({
- type: "Number",
- value: 0
- });
- }
- incrementCounterForElement(element, incrementArray) {
- if (!element || !incrementArray || incrementArray.length === 0) return;
- const ref = element.dataset.ref;
- const increments = Array.from(this.styleSheet.cssRules).filter((rule) => {
- return rule.selectorText === `[data-ref="${element.dataset.ref}"]:not([data-split-from])`
- && rule.style[0] === "counter-increment";
- }).map(rule => rule.style.counterIncrement);
- // Merge the current increments by summing the values because we generate both a decrement and an increment when the
- // element resets and increments the counter at the same time. E.g. ['c1 -7', 'c1 1'] should lead to 'c1 -6'.
- increments.push(this.mergeIncrements(incrementArray,
- (prev, next) => (parseInt(prev) || 0) + (parseInt(next) || 0)));
- // Keep the last value for each counter when merging with the previous increments. E.g. ['c1 -7 c2 3', 'c1 1']
- // should lead to 'c1 1 c2 3'.
- const counterIncrement = this.mergeIncrements(increments, (prev, next) => next);
- this.insertRule(`[data-ref="${ref}"]:not([data-split-from]) { counter-increment: ${counterIncrement} }`);
- }
- /**
- * Merge multiple values of a counter-increment CSS rule, using the specified operator.
- *
- * @param {Array} incrementArray the values to merge, e.g. ['c1 1', 'c1 -7 c2 1']
- * @param {Function} operator the function used to merge counter values (e.g. keep the last value of a counter or sum
- * the counter values)
- * @return {string} the merged value of the counter-increment CSS rule
- */
- mergeIncrements(incrementArray, operator) {
- const increments = {};
- incrementArray.forEach(increment => {
- let values = increment.split(" ");
- for (let i = 0; i < values.length; i+=2) {
- increments[values[i]] = operator(increments[values[i]], values[i + 1]);
- }
- });
- return Object.entries(increments).map(([key, value]) => `${key} ${value}`).join(" ");
- }
- afterPageLayout(pageElement, page) {
- let resets = [];
- let pgreset = pageElement.querySelectorAll("[data-counter-page-reset]:not([data-split-from])");
- pgreset.forEach((reset) => {
- const ref = reset.dataset && reset.dataset.ref;
- if (ref && this.resetCountersMap.has(ref)) ; else {
- if (ref) {
- this.resetCountersMap.set(ref, "");
- }
- let value = reset.dataset.counterPageReset;
- resets.push(`page ${value}`);
- }
- });
- let notereset = pageElement.querySelectorAll("[data-counter-footnote-reset]:not([data-split-from])");
- notereset.forEach((reset) => {
- let value = reset.dataset.counterFootnoteReset;
- resets.push(`footnote ${value}`);
- resets.push(`footnote-marker ${value}`);
- });
- if (resets.length) {
- this.styleSheet.insertRule(`[data-page-number="${pageElement.dataset.pageNumber}"] { counter-increment: none; counter-reset: ${resets.join(" ")} }`, this.styleSheet.cssRules.length);
- }
- }
- }
- class Lists extends Handler {
- constructor(chunker, polisher, caller) {
- super(chunker, polisher, caller);
- }
- afterParsed(content) {
- const orderedLists = content.querySelectorAll("ol");
- for (var list of orderedLists) {
- this.addDataNumbers(list);
- }
- }
- afterPageLayout(pageElement, page, breakToken, chunker) {
- var orderedLists = pageElement.getElementsByTagName("ol");
- for (var list of orderedLists) {
- if (list.firstElementChild) {
- list.start = list.firstElementChild.dataset.itemNum;
- }
- }
- }
- addDataNumbers(list) {
- let start = 1;
- if (list.hasAttribute("start")) {
- start = parseInt(list.getAttribute("start"), 10);
- if (isNaN(start)) {
- start = 1;
- }
- }
- let items = list.children;
- for (var i = 0; i < items.length; i++) {
- items[i].setAttribute("data-item-num", i + start);
- }
- }
- }
- class PositionFixed extends Handler {
- constructor(chunker, polisher, caller) {
- super(chunker, polisher, caller);
- this.styleSheet = polisher.styleSheet;
- this.fixedElementsSelector = [];
- this.fixedElements = [];
- }
- onDeclaration(declaration, dItem, dList, rule) {
- if (declaration.property === "position" && declaration.value.children.first().name === "fixed") {
- let selector = csstree.generate(rule.ruleNode.prelude);
- this.fixedElementsSelector.push(selector);
- dList.remove(dItem);
- }
- }
- afterParsed(fragment) {
- this.fixedElementsSelector.forEach(fixedEl => {
- fragment.querySelectorAll(`${fixedEl}`).forEach(el => {
- el.style.setProperty("position", "absolute");
- this.fixedElements.push(el);
- el.remove();
- });
- });
- }
- afterPageLayout(pageElement, page, breakToken) {
- this.fixedElements.forEach(el => {
- const clone = el.cloneNode(true);
- pageElement.querySelector(".pagedjs_pagebox").insertAdjacentElement("afterbegin", clone);
- });
- }
- }
- class PageCounterIncrement extends Handler {
- constructor(chunker, polisher, caller) {
- super(chunker, polisher, caller);
- this.styleSheet = polisher.styleSheet;
- this.pageCounter = {
- name: "page",
- increments: {},
- resets: {}
- };
- }
- onDeclaration(declaration, dItem, dList, rule) {
- const property = declaration.property;
- if (property === "counter-increment") {
- let inc = this.handleIncrement(declaration, rule);
- if (inc) {
- dList.remove(dItem);
- }
- }
- }
- afterParsed(_) {
- for (const inc in this.pageCounter.increments) {
- const increment = this.pageCounter.increments[inc];
- this.insertRule(`${increment.selector} { --pagedjs-page-counter-increment: ${increment.number} }`);
- }
- }
- handleIncrement(declaration, rule) {
- const identifier = declaration.value.children.first();
- const number = declaration.value.children.getSize() > 1 ? declaration.value.children.last().value : 1;
- const name = identifier && identifier.name;
- if (name && name.indexOf("target-counter-") === 0) {
- return;
- }
- // A counter named page is automatically created and incremented by 1 on every page of the document,
- // unless the counter-increment property in the page context explicitly specifies a different increment for the page counter.
- // https://www.w3.org/TR/css-page-3/#page-based-counters
- if (name !== "page") {
- return;
- }
- // the counter-increment property is not defined on the page context (i.e. @page rule), ignoring...
- if (rule.ruleNode.name === "page" && rule.ruleNode.type === "Atrule") {
- return;
- }
- const selector = csstree.generate(rule.ruleNode.prelude);
- return this.pageCounter.increments[selector] = {
- selector: selector,
- number
- };
- }
- insertRule(rule) {
- this.styleSheet.insertRule(rule, this.styleSheet.cssRules.length);
- }
- }
- class NthOfType extends Handler {
- constructor(chunker, polisher, caller) {
- super(chunker, polisher, caller);
- this.styleSheet = polisher.styleSheet;
- this.selectors = {};
- }
- onRule(ruleNode, ruleItem, rulelist) {
- let selector = csstree.generate(ruleNode.prelude);
- if (selector.match(/:(first|last|nth)-of-type/)) {
-
- let declarations = csstree.generate(ruleNode.block);
- declarations = declarations.replace(/[{}]/g,"");
- let uuid = "nth-of-type-" + UUID();
- selector.split(",").forEach((s) => {
- if (!this.selectors[s]) {
- this.selectors[s] = [uuid, declarations];
- } else {
- this.selectors[s][1] = `${this.selectors[s][1]};${declarations}` ;
- }
- });
- rulelist.remove(ruleItem);
- }
- }
- afterParsed(parsed) {
- this.processSelectors(parsed, this.selectors);
- }
- processSelectors(parsed, selectors) {
- // add the new attributes to matching elements
- for (let s in selectors) {
- let elements = parsed.querySelectorAll(s);
- for (var i = 0; i < elements.length; i++) {
- let dataNthOfType = elements[i].getAttribute("data-nth-of-type");
- if (dataNthOfType && dataNthOfType != "") {
- dataNthOfType = `${dataNthOfType},${selectors[s][0]}`;
- elements[i].setAttribute("data-nth-of-type", dataNthOfType);
- } else {
- elements[i].setAttribute("data-nth-of-type", selectors[s][0]);
- }
- }
- let rule = `*[data-nth-of-type*='${selectors[s][0]}'] { ${selectors[s][1]}; }`;
- this.styleSheet.insertRule(rule, this.styleSheet.cssRules.length);
- }
- }
- }
- class Following extends Handler {
- constructor(chunker, polisher, caller) {
- super(chunker, polisher, caller);
- this.styleSheet = polisher.styleSheet;
- this.selectors = {};
- }
- onRule(ruleNode, ruleItem, rulelist) {
- let selector = csstree.generate(ruleNode.prelude);
- if (selector.match(/\+/)) {
-
- let declarations = csstree.generate(ruleNode.block);
- declarations = declarations.replace(/[{}]/g,"");
- let uuid = "following-" + UUID();
- selector.split(",").forEach((s) => {
- if (!this.selectors[s]) {
- this.selectors[s] = [uuid, declarations];
- } else {
- this.selectors[s][1] = `${this.selectors[s][1]};${declarations}` ;
- }
- });
- rulelist.remove(ruleItem);
- }
- }
- afterParsed(parsed) {
- this.processSelectors(parsed, this.selectors);
- }
- processSelectors(parsed, selectors) {
- // add the new attributes to matching elements
- for (let s in selectors) {
- let elements = parsed.querySelectorAll(s);
- for (var i = 0; i < elements.length; i++) {
- let dataFollowing = elements[i].getAttribute("data-following");
- if (dataFollowing && dataFollowing != "") {
- dataFollowing = `${dataFollowing},${selectors[s][0]}`;
- elements[i].setAttribute("data-following", dataFollowing);
- } else {
- elements[i].setAttribute("data-following", selectors[s][0]);
- }
- }
- let rule = `*[data-following*='${selectors[s][0]}'] { ${selectors[s][1]}; }`;
- this.styleSheet.insertRule(rule, this.styleSheet.cssRules.length);
- }
- }
- }
- class Footnotes extends Handler {
- constructor(chunker, polisher, caller) {
- super(chunker, polisher, caller);
- this.footnotes = {};
- this.needsLayout = [];
- }
- onDeclaration(declaration, dItem, dList, rule) {
- let property = declaration.property;
- if (property === "float") {
- let identifier = declaration.value.children && declaration.value.children.first();
- let location = identifier && identifier.name;
- if (location === "footnote") {
- let selector = csstree.generate(rule.ruleNode.prelude);
- this.footnotes[selector] = {
- selector: selector,
- policy: "auto",
- display: "block"
- };
- dList.remove(dItem);
- }
- }
- if (property === "footnote-policy") {
- let identifier = declaration.value.children && declaration.value.children.first();
- let policy = identifier && identifier.name;
- if (policy) {
- let selector = csstree.generate(rule.ruleNode.prelude);
- let note = this.footnotes[selector];
- if (note) {
- note.policy = policy;
- }
- }
- }
- if (property === "footnote-display") {
- let identifier = declaration.value.children && declaration.value.children.first();
- let display = identifier && identifier.name;
- let selector = csstree.generate(rule.ruleNode.prelude);
- if (display && this.footnotes[selector]) {
- let note = this.footnotes[selector];
- if (note) {
- note.display = display;
- }
- }
- }
- }
- onPseudoSelector(pseudoNode, pItem, pList, selector, rule) {
- let name = pseudoNode.name;
- if (name === "footnote-marker") {
- // switch ::footnote-marker to [data-footnote-marker]::before
- let prelude = rule.ruleNode.prelude;
- let newPrelude = new csstree.List();
- // Can't get remove to work, so just copying everything else
- prelude.children.first().children.each((node) => {
- if (node.type !== "PseudoElementSelector") {
- newPrelude.appendData(node);
- }
- });
- // Add our data call
- newPrelude.appendData({
- type: "AttributeSelector",
- name: {
- type: "Identifier",
- name: "data-footnote-marker",
- },
- flags: null,
- loc: null,
- matcher: null,
- value: null
- });
- // Add new pseudo element
- newPrelude.appendData({
- type: "PseudoElementSelector",
- name: "marker",
- loc: null,
- children: null
- });
- prelude.children.first().children = newPrelude;
- }
- if (name === "footnote-call") {
- // switch ::footnote-call to [data-footnote-call]::after
- let prelude = rule.ruleNode.prelude;
- let newPrelude = new csstree.List();
- // Can't get remove to work, so just copying everything else
- prelude.children.first().children.each((node) => {
- if (node.type !== "PseudoElementSelector") {
- newPrelude.appendData(node);
- }
- });
- // Add our data call
- newPrelude.appendData({
- type: "AttributeSelector",
- name: {
- type: "Identifier",
- name: "data-footnote-call",
- },
- flags: null,
- loc: null,
- matcher: null,
- value: null
- });
- // Add new pseudo element
- newPrelude.appendData({
- type: "PseudoElementSelector",
- name: "after",
- loc: null,
- children: null
- });
- prelude.children.first().children = newPrelude;
- }
- }
- afterParsed(parsed) {
- this.processFootnotes(parsed, this.footnotes);
- }
- processFootnotes(parsed, notes) {
- for (let n in notes) {
- // Find elements
- let elements = parsed.querySelectorAll(n);
- let element;
- let note = notes[n];
- for (var i = 0; i < elements.length; i++) {
- element = elements[i];
- // Add note type
- element.setAttribute("data-note", "footnote");
- element.setAttribute("data-break-before", "avoid");
- element.setAttribute("data-note-policy", note.policy || "auto");
- element.setAttribute("data-note-display", note.display || "block");
- // Mark all parents
- this.processFootnoteContainer(element);
- }
- }
- }
- processFootnoteContainer(node) {
- // Find the container
- let element = node.parentElement;
- let prevElement = element;
- // Walk up the dom until we find a container element
- while (element) {
- if (isContainer(element)) {
- // Add flag to the previous non-container element that will render with children
- prevElement.setAttribute("data-has-notes", "true");
- break;
- }
- prevElement = element;
- element = element.parentElement;
- // If no containers were found and there are no further parents flag the last element
- if (!element) {
- prevElement.setAttribute("data-has-notes", "true");
- }
- }
- }
- renderNode(node) {
- if (node.nodeType == 1) {
- // Get all notes
- let notes;
- // Ingnore html element nodes, like mathml
- if (!node.dataset) {
- return;
- }
- if (node.dataset.note === "footnote") {
- notes = [node];
- } else if (node.dataset.hasNotes || node.querySelectorAll("[data-note='footnote']")) {
- notes = node.querySelectorAll("[data-note='footnote']");
- }
- if (notes && notes.length) {
- this.findVisibleFootnotes(notes, node);
- }
- }
- }
- findVisibleFootnotes(notes, node) {
- let area, size, right;
- area = node.closest(".pagedjs_page_content");
- size = area.getBoundingClientRect();
- right = size.left + size.width;
- for (let i = 0; i < notes.length; ++i) {
- let currentNote = notes[i];
- let bounds = currentNote.getBoundingClientRect();
- let left = bounds.left;
- if (left < right) {
- // Add call for the note
- this.moveFootnote(currentNote, node.closest(".pagedjs_area"), true);
- }
- }
- }
- moveFootnote(node, pageArea, needsNoteCall) {
- // let pageArea = node.closest(".pagedjs_area");
- let noteArea = pageArea.querySelector(".pagedjs_footnote_area");
- let noteContent = noteArea.querySelector(".pagedjs_footnote_content");
- let noteInnerContent = noteContent.querySelector(".pagedjs_footnote_inner_content");
- if (!isElement(node)) {
- return;
- }
- // Add call for the note
- let noteCall;
- if (needsNoteCall) {
- noteCall = this.createFootnoteCall(node);
- }
- // Remove the break before attribute for future layout
- node.removeAttribute("data-break-before");
- // Check if note already exists for overflow
- let existing = noteInnerContent.querySelector(`[data-ref="${node.dataset.ref}"]`);
- if (existing) {
- // Remove the note from the flow but no need to render it again
- node.remove();
- return;
- }
- // Add the note node
- noteInnerContent.appendChild(node);
- // Remove empty class
- if (noteContent.classList.contains("pagedjs_footnote_empty")) {
- noteContent.classList.remove("pagedjs_footnote_empty");
- }
- // Add marker
- node.dataset.footnoteMarker = node.dataset.ref;
- // Add Id
- node.id = `note-${node.dataset.ref}`;
- // Get note content size
- let height = noteContent.scrollHeight;
- // Check the noteCall is still on screen
- let area = pageArea.querySelector(".pagedjs_page_content");
- let size = area.getBoundingClientRect();
- let right = size.left + size.width;
- // TODO: add a max height in CSS
- // Check element sizes
- let noteCallBounds = noteCall && noteCall.getBoundingClientRect();
- let noteAreaBounds = noteArea.getBoundingClientRect();
- // Get the @footnote margins
- let noteContentMargins = this.marginsHeight(noteContent);
- let noteContentPadding = this.paddingHeight(noteContent);
- let noteContentBorders = this.borderHeight(noteContent);
- let total = noteContentMargins + noteContentPadding + noteContentBorders;
- // Get the top of the @footnote area
- let notAreaTop = Math.floor(noteAreaBounds.top);
- // If the height isn't set yet, remove the margins from the top
- if (noteAreaBounds.height === 0) {
- notAreaTop -= this.marginsHeight(noteContent, false);
- notAreaTop -= this.paddingHeight(noteContent, false);
- notAreaTop -= this.borderHeight(noteContent, false);
- }
- // Determine the note call position and offset per policy
- let notePolicy = node.dataset.notePolicy;
- let noteCallPosition = 0;
- let noteCallOffset = 0;
- if (noteCall) {
- // Get the correct line bottom for super or sub styled callouts
- let prevSibling = noteCall.previousSibling;
- let range = new Range();
- if (prevSibling) {
- range.setStartBefore(prevSibling);
- } else {
- range.setStartBefore(noteCall);
- }
- range.setEndAfter(noteCall);
- let rangeBounds = range.getBoundingClientRect();
- noteCallPosition = rangeBounds.bottom;
- if (!notePolicy || notePolicy === "auto") {
- noteCallOffset = Math.ceil(rangeBounds.bottom);
- } else if (notePolicy === "line") {
- noteCallOffset = Math.ceil(rangeBounds.top);
- } else if (notePolicy === "block") {
- // Check that there is a previous element on the page
- let parentParagraph = noteCall.closest("p").previousElementSibling;
- if (parentParagraph) {
- noteCallOffset = Math.ceil(
- parentParagraph.getBoundingClientRect().bottom
- );
- } else {
- noteCallOffset = Math.ceil(rangeBounds.bottom);
- }
- }
- }
- let contentDelta = height + total - noteAreaBounds.height;
- // Space between the top of the footnotes area and the bottom of the footnote call
- let noteDelta = noteCallPosition ? notAreaTop - noteCallPosition : 0;
- // Space needed for the force a break for the policy of the footnote
- let notePolicyDelta = noteCallPosition ? Math.floor(noteAreaBounds.top) - noteCallOffset : 0;
- let hasNotes = noteArea.querySelector("[data-note='footnote']");
- if (needsNoteCall && noteCallBounds.left > right) {
- // Note is offscreen and will be chunked to the next page on overflow
- node.remove();
- } else if (!hasNotes && needsNoteCall && total > noteDelta) {
- // No space to add even the footnote area
- pageArea.style.setProperty("--pagedjs-footnotes-height", "0px");
- // Add a wrapper as this div is removed later
- let wrapperDiv = document.createElement("div");
- wrapperDiv.appendChild(node);
- // Push to the layout queue for the next page
- this.needsLayout.push(wrapperDiv);
- } else if (!needsNoteCall) {
- // Call was previously added, force adding footnote
- pageArea.style.setProperty(
- "--pagedjs-footnotes-height",
- `${height + total}px`
- );
- } else if (noteCallPosition < noteAreaBounds.top - contentDelta) {
- // the current note content will fit without pushing the call to the next page
- pageArea.style.setProperty(
- "--pagedjs-footnotes-height",
- `${height + noteContentMargins + noteContentBorders}px`
- );
- } else {
- // set height to just before note call
- pageArea.style.setProperty(
- "--pagedjs-footnotes-height",
- `${noteAreaBounds.height + notePolicyDelta}px`
- );
- noteInnerContent.style.height =
- noteAreaBounds.height + notePolicyDelta - total + "px";
- }
- }
- createFootnoteCall(node) {
- let parentElement = node.parentElement;
- let footnoteCall = document.createElement("a");
- for (const className of node.classList) {
- footnoteCall.classList.add(`${className}`);
- }
- footnoteCall.dataset.footnoteCall = node.dataset.ref;
- footnoteCall.dataset.ref = node.dataset.ref;
- // Increment for counters
- footnoteCall.dataset.dataCounterFootnoteIncrement = 1;
- // Add link
- footnoteCall.href = `#note-${node.dataset.ref}`;
- parentElement.insertBefore(footnoteCall, node);
- return footnoteCall;
- }
- afterPageLayout(pageElement, page, breakToken, chunker) {
- let pageArea = pageElement.querySelector(".pagedjs_area");
- let noteArea = page.footnotesArea;
- let noteContent = noteArea.querySelector(".pagedjs_footnote_content");
- let noteInnerContent = noteArea.querySelector(".pagedjs_footnote_inner_content");
- let noteContentBounds = noteContent.getBoundingClientRect();
- let { width } = noteContentBounds;
- noteInnerContent.style.columnWidth = Math.round(width) + "px";
- noteInnerContent.style.columnGap = "calc(var(--pagedjs-margin-right) + var(--pagedjs-margin-left))";
- // Get overflow
- let layout = new Layout(noteArea, undefined, chunker.settings);
- let overflow = layout.findOverflow(noteInnerContent, noteContentBounds);
- if (overflow) {
- let { startContainer, startOffset } = overflow;
- let startIsNode;
- if (isElement(startContainer)) {
- let start = startContainer.childNodes[startOffset];
- startIsNode = isElement(start) && start.hasAttribute("data-footnote-marker");
- }
- let extracted = overflow.extractContents();
- if (!startIsNode) {
- let splitChild = extracted.firstElementChild;
- splitChild.dataset.splitFrom = splitChild.dataset.ref;
- this.handleAlignment(noteInnerContent.lastElementChild);
- }
- this.needsLayout.push(extracted);
- noteContent.style.removeProperty("height");
- noteInnerContent.style.removeProperty("height");
- let noteInnerContentBounds = noteInnerContent.getBoundingClientRect();
- let { height } = noteInnerContentBounds;
- // Get the @footnote margins
- let noteContentMargins = this.marginsHeight(noteContent);
- let noteContentPadding = this.paddingHeight(noteContent);
- let noteContentBorders = this.borderHeight(noteContent);
- pageArea.style.setProperty(
- "--pagedjs-footnotes-height",
- `${height + noteContentMargins + noteContentBorders + noteContentPadding}px`
- );
- // Hide footnote content if empty
- if (noteInnerContent.childNodes.length === 0) {
- noteContent.classList.add("pagedjs_footnote_empty");
- }
- if (!breakToken) {
- chunker.clonePage(page);
- } else {
- let breakBefore, previousBreakAfter;
- if (
- breakToken.node &&
- typeof breakToken.node.dataset !== "undefined" &&
- typeof breakToken.node.dataset.previousBreakAfter !== "undefined"
- ) {
- previousBreakAfter = breakToken.node.dataset.previousBreakAfter;
- }
- if (
- breakToken.node &&
- typeof breakToken.node.dataset !== "undefined" &&
- typeof breakToken.node.dataset.breakBefore !== "undefined"
- ) {
- breakBefore = breakToken.node.dataset.breakBefore;
- }
- if (breakBefore || previousBreakAfter) {
- chunker.clonePage(page);
- }
- }
- }
- noteInnerContent.style.height = "auto";
- }
- handleAlignment(node) {
- let styles = window.getComputedStyle(node);
- let alignLast = styles["text-align-last"];
- node.dataset.lastSplitElement = "true";
- if (alignLast === "auto") {
- node.dataset.alignLastSplitElement = "justify";
- } else {
- node.dataset.alignLastSplitElement = alignLast;
- }
- }
- beforePageLayout(page) {
- while (this.needsLayout.length) {
- let fragment = this.needsLayout.shift();
- Array.from(fragment.childNodes).forEach((node) => {
- this.moveFootnote(
- node,
- page.element.querySelector(".pagedjs_area"),
- false
- );
- });
- }
- }
- afterOverflowRemoved(removed, rendered) {
- // Find the page area
- let area = rendered.closest(".pagedjs_area");
- // Get any rendered footnotes
- let notes = area.querySelectorAll(".pagedjs_footnote_area [data-note='footnote']");
- for (let n = 0; n < notes.length; n++) {
- const note = notes[n];
- // Check if the call for that footnote has been removed with the overflow
- let call = removed.querySelector(`[data-footnote-call="${note.dataset.ref}"]`);
- if (call) {
- note.remove();
- }
- }
- // Hide footnote content if empty
- let noteInnerContent = area.querySelector(".pagedjs_footnote_inner_content");
- if (noteInnerContent && noteInnerContent.childNodes.length === 0) {
- noteInnerContent.parentElement.classList.add("pagedjs_footnote_empty");
- }
- }
- marginsHeight(element, total=true) {
- let styles = window.getComputedStyle(element);
- let marginTop = parseInt(styles.marginTop);
- let marginBottom = parseInt(styles.marginBottom);
- let margin = 0;
- if (marginTop) {
- margin += marginTop;
- }
- if (marginBottom && total) {
- margin += marginBottom;
- }
- return margin;
- }
- paddingHeight(element, total=true) {
- let styles = window.getComputedStyle(element);
- let paddingTop = parseInt(styles.paddingTop);
- let paddingBottom = parseInt(styles.paddingBottom);
- let padding = 0;
- if (paddingTop) {
- padding += paddingTop;
- }
- if (paddingBottom && total) {
- padding += paddingBottom;
- }
- return padding;
- }
- borderHeight(element, total=true) {
- let styles = window.getComputedStyle(element);
- let borderTop = parseInt(styles.borderTop);
- let borderBottom = parseInt(styles.borderBottom);
- let borders = 0;
- if (borderTop) {
- borders += borderTop;
- }
- if (borderBottom && total) {
- borders += borderBottom;
- }
- return borders;
- }
- }
- var pagedMediaHandlers = [
- PrintMedia,
- AtPage,
- Breaks,
- Splits,
- Counters,
- Lists,
- PositionFixed,
- PageCounterIncrement,
- NthOfType,
- Following,
- Footnotes
- ];
- class RunningHeaders extends Handler {
- constructor(chunker, polisher, caller) {
- super(chunker, polisher, caller);
- this.runningSelectors = {};
- this.elements = {};
- }
- onDeclaration(declaration, dItem, dList, rule) {
- if (declaration.property === "position") {
- let selector = csstree.generate(rule.ruleNode.prelude);
- let identifier = declaration.value.children.first().name;
- if (identifier === "running") {
- let value;
- csstree.walk(declaration, {
- visit: "Function",
- enter: (node, item, list) => {
- value = node.children.first().name;
- }
- });
- this.runningSelectors[value] = {
- identifier: identifier,
- value: value,
- selector: selector
- };
- }
- }
- if (declaration.property === "content") {
- csstree.walk(declaration, {
- visit: "Function",
- enter: (funcNode, fItem, fList) => {
- if (funcNode.name.indexOf("element") > -1) {
- let selector = csstree.generate(rule.ruleNode.prelude);
- let func = funcNode.name;
- let value = funcNode.children.first().name;
- let args = [value];
- // we only handle first for now
- let style = "first";
- selector.split(",").forEach((s) => {
- // remove before / after
- s = s.replace(/::after|::before/, "");
- this.elements[s] = {
- func: func,
- args: args,
- value: value,
- style: style ,
- selector: s,
- fullSelector: selector
- };
- });
- }
- }
- });
- }
- }
- afterParsed(fragment) {
- for (let name of Object.keys(this.runningSelectors)) {
- let set = this.runningSelectors[name];
- let selected = Array.from(fragment.querySelectorAll(set.selector));
- if (set.identifier === "running") {
- for (let header of selected) {
- header.style.display = "none";
- }
- }
- }
- }
- afterPageLayout(fragment) {
- for (let name of Object.keys(this.runningSelectors)) {
- let set = this.runningSelectors[name];
- let selected = fragment.querySelector(set.selector);
- if (selected) {
- // let cssVar;
- if (set.identifier === "running") {
- // cssVar = selected.textContent.replace(/\\([\s\S])|(["|'])/g,"\\$1$2");
- // this.styleSheet.insertRule(`:root { --string-${name}: "${cssVar}"; }`, this.styleSheet.cssRules.length);
- // fragment.style.setProperty(`--string-${name}`, `"${cssVar}"`);
- set.first = selected;
- } else {
- console.warn(set.value + "needs css replacement");
- }
- }
- }
- // move elements
- if (!this.orderedSelectors) {
- this.orderedSelectors = this.orderSelectors(this.elements);
- }
- for (let selector of this.orderedSelectors) {
- if (selector) {
- let el = this.elements[selector];
- let selected = fragment.querySelector(selector);
- if (selected) {
- let running = this.runningSelectors[el.args[0]];
- if (running && running.first) {
- selected.innerHTML = ""; // Clear node
- // selected.classList.add("pagedjs_clear-after"); // Clear ::after
- let clone = running.first.cloneNode(true);
- clone.style.display = null;
- selected.appendChild(clone);
- }
- }
- }
- }
- }
- /**
- * Assign a weight to @page selector classes
- * 1) page
- * 2) left & right
- * 3) blank
- * 4) first & nth
- * 5) named page
- * 6) named left & right
- * 7) named first & nth
- * @param {string} [s] selector string
- * @return {int} weight
- */
- pageWeight(s) {
- let weight = 1;
- let selector = s.split(" ");
- let parts = selector.length && selector[0].split(".");
- parts.shift(); // remove empty first part
- switch (parts.length) {
- case 4:
- if (/^pagedjs_[\w-]+_first_page$/.test(parts[3])) {
- weight = 7;
- } else if (parts[3] === "pagedjs_left_page" || parts[3] === "pagedjs_right_page") {
- weight = 6;
- }
- break;
- case 3:
- if (parts[1] === "pagedjs_named_page") {
- if (parts[2].indexOf(":nth-of-type") > -1) {
- weight = 7;
- } else {
- weight = 5;
- }
- }
- break;
- case 2:
- if (parts[1] === "pagedjs_first_page") {
- weight = 4;
- } else if (parts[1] === "pagedjs_blank_page") {
- weight = 3;
- } else if (parts[1] === "pagedjs_left_page" || parts[1] === "pagedjs_right_page") {
- weight = 2;
- }
- break;
- default:
- if (parts[0].indexOf(":nth-of-type") > -1) {
- weight = 4;
- } else {
- weight = 1;
- }
- }
- return weight;
- }
- /**
- * Orders the selectors based on weight
- *
- * Does not try to deduplicate base on specifity of the selector
- * Previous matched selector will just be overwritten
- * @param {obj} [obj] selectors object
- * @return {Array} orderedSelectors
- */
- orderSelectors(obj) {
- let selectors = Object.keys(obj);
- let weighted = {
- 1: [],
- 2: [],
- 3: [],
- 4: [],
- 5: [],
- 6: [],
- 7: []
- };
- let orderedSelectors = [];
- for (let s of selectors) {
- let w = this.pageWeight(s);
- weighted[w].unshift(s);
- }
- for (var i = 1; i <= 7; i++) {
- orderedSelectors = orderedSelectors.concat(weighted[i]);
- }
- return orderedSelectors;
- }
- beforeTreeParse(text, sheet) {
- // element(x) is parsed as image element selector, so update element to element-ident
- sheet.text = text.replace(/element[\s]*\(([^|^#)]*)\)/g, "element-ident($1)");
- }
- }
- function cleanPseudoContent(el, trim = "\"' ") {
- if(el == null) return;
- return el
- .replace(new RegExp(`^[${trim}]+`), "")
- .replace(new RegExp(`[${trim}]+$`), "")
- .replace(/["']/g, match => {
- return "\\" + match;
- })
- .replace(/[\n]/g, match => {
- return "\\00000A";
- });
- }
- function cleanSelector(el) {
- if(el == null) return;
- return el
- .replace(new RegExp("::footnote-call", "g"), "")
- .replace(new RegExp("::footnote-marker", "g"), "");
- }
- class StringSets extends Handler {
- constructor(chunker, polisher, caller) {
- super(chunker, polisher, caller);
- this.stringSetSelectors = {};
- this.type;
- // pageLastString = last string variable defined on the page
- this.pageLastString;
- }
-
- onDeclaration(declaration, dItem, dList, rule) {
- if (declaration.property === "string-set") {
- let selector = csstree.generate(rule.ruleNode.prelude);
- let identifiers = [];
- let functions = [];
- let values = [];
- declaration.value.children.forEach((child) => {
- if (child.type === "Identifier") {
- identifiers.push(child.name);
- }
- if (child.type === "Function") {
- functions.push(child.name);
- child.children.forEach((subchild) => {
- if (subchild.type === "Identifier") {
- values.push(subchild.name);
- }
- });
- }
- });
- identifiers.forEach((identifier, index) => {
- let func = functions[index];
- let value = values[index];
- this.stringSetSelectors[identifier] = {
- identifier,
- func,
- value,
- selector
- };
- });
- }
- }
- onContent(funcNode, fItem, fList, declaration, rule) {
- if (funcNode.name === "string") {
- let identifier = funcNode.children && funcNode.children.first().name;
- this.type = funcNode.children.last().name;
- funcNode.name = "var";
- funcNode.children = new csstree.List();
-
- if(this.type === "first" || this.type === "last" || this.type === "start" || this.type === "first-except"){
- funcNode.children.append(
- funcNode.children.createItem({
- type: "Identifier",
- loc: null,
- name: "--pagedjs-string-" + this.type + "-" + identifier
- })
- );
- }else {
- funcNode.children.append(
- funcNode.children.createItem({
- type: "Identifier",
- loc: null,
- name: "--pagedjs-string-first-" + identifier
- })
- );
- }
- }
- }
- afterPageLayout(fragment) {
-
- if ( this.pageLastString === undefined )
- {
- this.pageLastString = {};
- }
-
- for (let name of Object.keys(this.stringSetSelectors)) {
-
- let set = this.stringSetSelectors[name];
- let value = set.value;
- let func = set.func;
- let selected = fragment.querySelectorAll(set.selector);
- // Get the last found string for the current identifier
- let stringPrevPage = ( name in this.pageLastString ) ? this.pageLastString[name] : "";
- let varFirst, varLast, varStart, varFirstExcept;
- if(selected.length == 0){
- // if there is no sel. on the page
- varFirst = stringPrevPage;
- varLast = stringPrevPage;
- varStart = stringPrevPage;
- varFirstExcept = stringPrevPage;
- }else {
- selected.forEach((sel) => {
- // push each content into the array to define in the variable the first and the last element of the page.
- if (func === "content") {
- this.pageLastString[name] = selected[selected.length - 1].textContent;
- }
- if (func === "attr") {
- this.pageLastString[name] = selected[selected.length - 1].getAttribute(value) || "";
- }
- });
- /* FIRST */
-
- if (func === "content") {
- varFirst = selected[0].textContent;
- }
- if (func === "attr") {
- varFirst = selected[0].getAttribute(value) || "";
- }
- /* LAST */
- if (func === "content") {
- varLast = selected[selected.length - 1].textContent;
- }
- if (func === "attr") {
- varLast = selected[selected.length - 1].getAttribute(value) || "";
- }
- /* START */
- // Hack to find if the sel. is the first elem of the page / find a better way
- let selTop = selected[0].getBoundingClientRect().top;
- let pageContent = selected[0].closest(".pagedjs_page_content");
- let pageContentTop = pageContent.getBoundingClientRect().top;
- if(selTop == pageContentTop){
- varStart = varFirst;
- }else {
- varStart = stringPrevPage;
- }
- /* FIRST EXCEPT */
- varFirstExcept = "";
-
- }
- fragment.style.setProperty(`--pagedjs-string-first-${name}`, `"${cleanPseudoContent(varFirst)}`);
- fragment.style.setProperty(`--pagedjs-string-last-${name}`, `"${cleanPseudoContent(varLast)}`);
- fragment.style.setProperty(`--pagedjs-string-start-${name}`, `"${cleanPseudoContent(varStart)}`);
- fragment.style.setProperty(`--pagedjs-string-first-except-${name}`, `"${cleanPseudoContent(varFirstExcept)}`);
-
-
- }
- }
-
- }
- class TargetCounters extends Handler {
- constructor(chunker, polisher, caller) {
- super(chunker, polisher, caller);
- this.styleSheet = polisher.styleSheet;
- this.counterTargets = {};
- }
- onContent(funcNode, fItem, fList, declaration, rule) {
- if (funcNode.name === "target-counter") {
- let selector = csstree.generate(rule.ruleNode.prelude);
- let first = funcNode.children.first();
- let func = first.name;
- let value = csstree.generate(funcNode);
- let args = [];
- first.children.forEach((child) => {
- if (child.type === "Identifier") {
- args.push(child.name);
- }
- });
- let counter;
- let style;
- let styleIdentifier;
- funcNode.children.forEach((child) => {
- if (child.type === "Identifier") {
- if (!counter) {
- counter = child.name;
- } else if (!style) {
- styleIdentifier = csstree.clone(child);
- style = child.name;
- }
- }
- });
- let variable = "target-counter-" + UUID();
- selector.split(",").forEach((s) => {
- this.counterTargets[s] = {
- func: func,
- args: args,
- value: value,
- counter: counter,
- style: style,
- selector: s,
- fullSelector: selector,
- variable: variable
- };
- });
- // Replace with counter
- funcNode.name = "counter";
- funcNode.children = new csstree.List();
- funcNode.children.appendData({
- type: "Identifier",
- loc: 0,
- name: variable
- });
- if (styleIdentifier) {
- funcNode.children.appendData({type: "Operator", loc: null, value: ","});
- funcNode.children.appendData(styleIdentifier);
- }
- }
- }
- afterPageLayout(fragment, page, breakToken, chunker) {
- Object.keys(this.counterTargets).forEach((name) => {
- let target = this.counterTargets[name];
- let split = target.selector.split(/::?/g);
- let query = split[0];
- let queried = chunker.pagesArea.querySelectorAll(query + ":not([data-" + target.variable + "])");
- queried.forEach((selected, index) => {
- // TODO: handle func other than attr
- if (target.func !== "attr") {
- return;
- }
- let val = attr(selected, target.args);
- let element = chunker.pagesArea.querySelector(querySelectorEscape(val));
- if (element) {
- let selector = UUID();
- selected.setAttribute("data-" + target.variable, selector);
- // TODO: handle other counter types (by query)
- let pseudo = "";
- if (split.length > 1) {
- pseudo += "::" + split[1];
- }
- if (target.counter === "page") {
- let pages = chunker.pagesArea.querySelectorAll(".pagedjs_page");
- let pg = 0;
- for (let i = 0; i < pages.length; i++) {
- let page = pages[i];
- let styles = window.getComputedStyle(page);
- let reset = styles["counter-reset"].replace("page", "").trim();
- let increment = styles["counter-increment"].replace("page", "").trim();
- if (reset !== "none") {
- pg = parseInt(reset);
- }
- if (increment !== "none") {
- pg += parseInt(increment);
- }
- if (page.contains(element)){
- break;
- }
- }
- this.styleSheet.insertRule(`[data-${target.variable}="${selector}"]${pseudo} { counter-reset: ${target.variable} ${pg}; }`, this.styleSheet.cssRules.length);
- } else {
- let value = element.getAttribute(`data-counter-${target.counter}-value`);
- if (value) {
- this.styleSheet.insertRule(`[data-${target.variable}="${selector}"]${pseudo} { counter-reset: ${target.variable} ${target.variable} ${parseInt(value)}; }`, this.styleSheet.cssRules.length);
- }
- }
- // force redraw
- let el = document.querySelector(`[data-${target.variable}="${selector}"]`);
- if (el) {
- el.style.display = "none";
- el.clientHeight;
- el.style.removeProperty("display");
- }
- }
- });
- });
- }
- }
- // import { nodeAfter } from "../../utils/dom";
- class TargetText extends Handler {
- constructor(chunker, polisher, caller) {
- super(chunker, polisher, caller);
- this.styleSheet = polisher.styleSheet;
- this.textTargets = {};
- this.beforeContent = "";
- this.afterContent = "";
- this.selector = {};
- }
- onContent(funcNode, fItem, fList, declaration, rule) {
- if (funcNode.name === "target-text") {
- this.selector = csstree.generate(rule.ruleNode.prelude);
- let first = funcNode.children.first();
- let last = funcNode.children.last();
- let func = first.name;
- let value = csstree.generate(funcNode);
- let args = [];
- first.children.forEach(child => {
- if (child.type === "Identifier") {
- args.push(child.name);
- }
- });
- let style;
- if (last !== first) {
- style = last.name;
- }
- let variable = "--pagedjs-" + UUID();
- this.selector.split(",").forEach(s => {
- this.textTargets[s] = {
- func: func,
- args: args,
- value: value,
- style: style || "content",
- selector: s,
- fullSelector: this.selector,
- variable: variable
- };
- });
- // Replace with variable
- funcNode.name = "var";
- funcNode.children = new csstree.List();
- funcNode.children.appendData({
- type: "Identifier",
- loc: 0,
- name: variable
- });
- }
- }
- // parse this on the ONCONTENT : get all before and after and replace the value with a variable
- onPseudoSelector(pseudoNode, pItem, pList, selector, rule) {
- // console.log(pseudoNode);
- // console.log(rule);
- rule.ruleNode.block.children.forEach(properties => {
- if (pseudoNode.name === "before" && properties.property === "content") {
- // let beforeVariable = "--pagedjs-" + UUID();
- let contenu = properties.value.children;
- contenu.forEach(prop => {
- if (prop.type === "String") {
- this.beforeContent = prop.value;
- }
- });
- } else if (pseudoNode.name === "after" && properties.property === "content") {
- properties.value.children.forEach(prop => {
- if (prop.type === "String") {
- this.afterContent = prop.value;
- }
- });
- }
- });
- }
- afterParsed(fragment) {
- Object.keys(this.textTargets).forEach(name => {
- let target = this.textTargets[name];
- let split = target.selector.split("::");
- let query = split[0];
- let queried = fragment.querySelectorAll(query);
- let textContent;
- queried.forEach((selected, index) => {
- let val = attr(selected, target.args);
- let element = fragment.querySelector(querySelectorEscape(val));
- if (element) {
- // content & first-letter & before & after refactorized
- if (target.style) {
- this.selector = UUID();
- selected.setAttribute("data-target-text", this.selector);
- let psuedo = "";
- if (split.length > 1) {
- psuedo += "::" + split[1];
- }
-
- if (target.style === "before" || target.style === "after") {
- const pseudoType = `${target.style}Content`;
- textContent = cleanPseudoContent(this[pseudoType]);
- } else {
- textContent = cleanPseudoContent(element.textContent, " ");
- }
- textContent = target.style === "first-letter" ? textContent.charAt(0) : textContent;
- this.styleSheet.insertRule(`[data-target-text="${this.selector}"]${psuedo} { ${target.variable}: "${textContent}" }`);
- } else {
- console.warn("missed target", val);
- }
- }
- });
- });
- }
- }
- var generatedContentHandlers = [
- RunningHeaders,
- StringSets,
- TargetCounters,
- TargetText
- ];
- class WhiteSpaceFilter extends Handler {
- constructor(chunker, polisher, caller) {
- super(chunker, polisher, caller);
- }
- filter(content) {
- filterTree(content, (node) => {
- return this.filterEmpty(node);
- }, NodeFilter.SHOW_TEXT);
- }
- filterEmpty(node) {
- if (node.textContent.length > 1 && isIgnorable(node)) {
- // Do not touch the content if text is pre-formatted
- let parent = node.parentNode;
- let pre = isElement(parent) && parent.closest("pre");
- if (pre) {
- return NodeFilter.FILTER_REJECT;
- }
- const previousSibling = previousSignificantNode(node);
- const nextSibling = nextSignificantNode(node);
- if (nextSibling === null && previousSibling === null) {
- // we should not remove a Node that does not have any siblings.
- node.textContent = " ";
- return NodeFilter.FILTER_REJECT;
- }
- if (nextSibling === null) {
- // we can safely remove this node
- return NodeFilter.FILTER_ACCEPT;
- }
- if (previousSibling === null) {
- // we can safely remove this node
- return NodeFilter.FILTER_ACCEPT;
- }
- // replace the content with a single space
- node.textContent = " ";
- // TODO: we also need to preserve sequences of white spaces when the parent has "white-space" rule:
- // pre
- // Sequences of white space are preserved. Lines are only broken at newline characters in the source and at <br> elements.
- //
- // pre-wrap
- // Sequences of white space are preserved. Lines are broken at newline characters, at <br>, and as necessary to fill line boxes.
- //
- // pre-line
- // Sequences of white space are collapsed. Lines are broken at newline characters, at <br>, and as necessary to fill line boxes.
- //
- // break-spaces
- // The behavior is identical to that of pre-wrap, except that:
- // - Any sequence of preserved white space always takes up space, including at the end of the line.
- // - A line breaking opportunity exists after every preserved white space character, including between white space characters.
- // - Such preserved spaces take up space and do not hang, and thus affect the box’s intrinsic sizes (min-content size and max-content size).
- //
- // See: https://developer.mozilla.org/en-US/docs/Web/CSS/white-space#Values
- return NodeFilter.FILTER_REJECT;
- } else {
- return NodeFilter.FILTER_REJECT;
- }
- }
- }
- class CommentsFilter extends Handler {
- constructor(chunker, polisher, caller) {
- super(chunker, polisher, caller);
- }
- filter(content) {
- filterTree(content, null, NodeFilter.SHOW_COMMENT);
- }
- }
- class ScriptsFilter extends Handler {
- constructor(chunker, polisher, caller) {
- super(chunker, polisher, caller);
- }
- filter(content) {
- content.querySelectorAll("script").forEach( script => { script.remove(); });
- }
- }
- var clearCut = {};
- /**
- * Originally ported from https://github.com/keeganstreet/specificity/blob/866bf7ab4e7f62a7179c15b13a95af4e1c7b1afa/specificity.js
- *
- * Calculates the specificity of CSS selectors
- * http://www.w3.org/TR/css3-selectors/#specificity
- *
- * Returns a selector integer value
- */
- (function (exports) {
- // The following regular expressions assume that selectors matching the preceding regular expressions have been removed
- var attributeRegex = /(\[[^\]]+\])/g;
- var idRegex = /(#[^\s\+>~\.\[:]+)/g;
- var classRegex = /(\.[^\s\+>~\.\[:]+)/g;
- var pseudoElementRegex = /(::[^\s\+>~\.\[:]+|:first-line|:first-letter|:before|:after)/g;
- var pseudoClassRegex = /(:[^\s\+>~\.\[:]+)/g;
- var elementRegex = /([^\s\+>~\.\[:]+)/g;
- var notRegex = /:not\(([^\)]*)\)/g;
- var ruleRegex = /\{[^]*/gm;
- var separatorRegex = /[\*\s\+>~]/g;
- var straysRegex = /[#\.]/g;
- // Find matches for a regular expression in a string and push their details to parts
- // Type is "a" for IDs, "b" for classes, attributes and pseudo-classes and "c" for elements and pseudo-elements
- var findMatch = function(regex, type, types, selector) {
- var matches = selector.match(regex);
- if (matches) {
- for (var i = 0; i < matches.length; i++) {
- types[type]++;
- // Replace this simple selector with whitespace so it won't be counted in further simple selectors
- selector = selector.replace(matches[i], ' ');
- }
- }
- return selector;
- };
- // Calculate the specificity for a selector by dividing it into simple selectors and counting them
- var calculate = function(selector) {
- var commaIndex = selector.indexOf(',');
- if (commaIndex !== -1) {
- selector = selector.substring(0, commaIndex);
- }
- var types = {
- a: 0,
- b: 0,
- c: 0
- };
- // Remove the negation psuedo-class (:not) but leave its argument because specificity is calculated on its argument
- selector = selector.replace(notRegex, ' $1 ');
- // Remove anything after a left brace in case a user has pasted in a rule, not just a selector
- selector = selector.replace(ruleRegex, ' ');
- // Add attribute selectors to parts collection (type b)
- selector = findMatch(attributeRegex, 'b', types, selector);
- // Add ID selectors to parts collection (type a)
- selector = findMatch(idRegex, 'a', types, selector);
- // Add class selectors to parts collection (type b)
- selector = findMatch(classRegex, 'b', types, selector);
- // Add pseudo-element selectors to parts collection (type c)
- selector = findMatch(pseudoElementRegex, 'c', types, selector);
- // Add pseudo-class selectors to parts collection (type b)
- selector = findMatch(pseudoClassRegex, 'b', types, selector);
- // Remove universal selector and separator characters
- selector = selector.replace(separatorRegex, ' ');
- // Remove any stray dots or hashes which aren't attached to words
- // These may be present if the user is live-editing this selector
- selector = selector.replace(straysRegex, ' ');
- // The only things left should be element selectors (type c)
- findMatch(elementRegex, 'c', types, selector);
- return (types.a * 100) + (types.b * 10) + (types.c * 1);
- };
- var specificityCache = {};
- exports.calculateSpecificity = function(selector) {
- var specificity = specificityCache[selector];
- if (specificity === undefined) {
- specificity = calculate(selector);
- specificityCache[selector] = specificity;
- }
- return specificity;
- };
- var validSelectorCache = {};
- var testSelectorElement = null;
- exports.isSelectorValid = function(selector) {
- var valid = validSelectorCache[selector];
- if (valid === undefined) {
- if (testSelectorElement == null) {
- testSelectorElement = document.createElement('div');
- }
- try {
- testSelectorElement.querySelector(selector);
- valid = true;
- } catch (error) {
- valid = false;
- }
- validSelectorCache[selector] = valid;
- }
- return valid;
- };
- exports.validateSelector = function(selector) {
- if (!exports.isSelectorValid(selector)) {
- var error = new SyntaxError(selector + ' is not a valid selector');
- error.code = 'EBADSELECTOR';
- throw error;
- }
- };
- } (clearCut));
- class UndisplayedFilter extends Handler {
- constructor(chunker, polisher, caller) {
- super(chunker, polisher, caller);
- this.displayRules = {};
- }
- onDeclaration(declaration, dItem, dList, rule) {
- if (declaration.property === "display") {
- let selector = csstree.generate(rule.ruleNode.prelude);
- let value = declaration.value.children.first().name;
- selector.split(",").forEach((s) => {
- this.displayRules[s] = {
- value: value,
- selector: s,
- specificity: clearCut.calculateSpecificity(s),
- important: declaration.important
- };
- });
- }
- }
- filter(content) {
- let { matches, selectors } = this.sortDisplayedSelectors(content, this.displayRules);
- // Find matching elements that have display styles
- for (let i = 0; i < matches.length; i++) {
- let element = matches[i];
- let selector = selectors[i];
- let displayValue = selector[selector.length-1].value;
- if(this.removable(element) && displayValue === "none") {
- element.dataset.undisplayed = "undisplayed";
- }
- }
- // Find elements that have inline styles
- let styledElements = content.querySelectorAll("[style]");
- for (let i = 0; i < styledElements.length; i++) {
- let element = styledElements[i];
- if (this.removable(element)) {
- element.dataset.undisplayed = "undisplayed";
- }
- }
- }
- sorter(a, b) {
- if (a.important && !b.important) {
- return 1;
- }
- if (b.important && !a.important) {
- return -1;
- }
- return a.specificity - b.specificity;
- }
- sortDisplayedSelectors(content, displayRules=[]) {
- let matches = [];
- let selectors = [];
- for (let d in displayRules) {
- let displayItem = displayRules[d];
- let selector = displayItem.selector;
- let query = [];
- try {
- try {
- query = content.querySelectorAll(selector);
- } catch (e) {
- query = content.querySelectorAll(cleanSelector(selector));
- }
- } catch (e) {
- query = [];
- }
- let elements = Array.from(query);
- for (let e of elements) {
- if (matches.includes(e)) {
- let index = matches.indexOf(e);
- selectors[index].push(displayItem);
- selectors[index] = selectors[index].sort(this.sorter);
- } else {
- matches.push(e);
- selectors.push([displayItem]);
- }
- }
- }
- return { matches, selectors };
- }
- removable(element) {
- if (element.style &&
- element.style.display !== "" &&
- element.style.display !== "none") {
- return false;
- }
- return true;
- }
- }
- var filters = [
- WhiteSpaceFilter,
- CommentsFilter,
- ScriptsFilter,
- UndisplayedFilter
- ];
- var isImplemented$3 = function () {
- var from = Array.from, arr, result;
- if (typeof from !== "function") return false;
- arr = ["raz", "dwa"];
- result = from(arr);
- return Boolean(result && (result !== arr) && (result[1] === "dwa"));
- };
- var isImplemented$2;
- var hasRequiredIsImplemented;
- function requireIsImplemented () {
- if (hasRequiredIsImplemented) return isImplemented$2;
- hasRequiredIsImplemented = 1;
- var validTypes = { object: true, symbol: true };
- isImplemented$2 = function () {
- var symbol;
- if (typeof Symbol !== 'function') return false;
- symbol = Symbol('test symbol');
- try { String(symbol); } catch (e) { return false; }
- // Return 'true' also for polyfills
- if (!validTypes[typeof Symbol.iterator]) return false;
- if (!validTypes[typeof Symbol.toPrimitive]) return false;
- if (!validTypes[typeof Symbol.toStringTag]) return false;
- return true;
- };
- return isImplemented$2;
- }
- var isSymbol;
- var hasRequiredIsSymbol;
- function requireIsSymbol () {
- if (hasRequiredIsSymbol) return isSymbol;
- hasRequiredIsSymbol = 1;
- isSymbol = function (x) {
- if (!x) return false;
- if (typeof x === 'symbol') return true;
- if (!x.constructor) return false;
- if (x.constructor.name !== 'Symbol') return false;
- return (x[x.constructor.toStringTag] === 'Symbol');
- };
- return isSymbol;
- }
- var validateSymbol;
- var hasRequiredValidateSymbol;
- function requireValidateSymbol () {
- if (hasRequiredValidateSymbol) return validateSymbol;
- hasRequiredValidateSymbol = 1;
- var isSymbol = requireIsSymbol();
- validateSymbol = function (value) {
- if (!isSymbol(value)) throw new TypeError(value + " is not a symbol");
- return value;
- };
- return validateSymbol;
- }
- var polyfill;
- var hasRequiredPolyfill;
- function requirePolyfill () {
- if (hasRequiredPolyfill) return polyfill;
- hasRequiredPolyfill = 1;
- var d = dExports
- , validateSymbol = requireValidateSymbol()
- , create = Object.create, defineProperties = Object.defineProperties
- , defineProperty = Object.defineProperty, objPrototype = Object.prototype
- , NativeSymbol, SymbolPolyfill, HiddenSymbol, globalSymbols = create(null)
- , isNativeSafe;
- if (typeof Symbol === 'function') {
- NativeSymbol = Symbol;
- try {
- String(NativeSymbol());
- isNativeSafe = true;
- } catch (ignore) {}
- }
- var generateName = (function () {
- var created = create(null);
- return function (desc) {
- var postfix = 0, name, ie11BugWorkaround;
- while (created[desc + (postfix || '')]) ++postfix;
- desc += (postfix || '');
- created[desc] = true;
- name = '@@' + desc;
- defineProperty(objPrototype, name, d.gs(null, function (value) {
- // For IE11 issue see:
- // https://connect.microsoft.com/IE/feedbackdetail/view/1928508/
- // ie11-broken-getters-on-dom-objects
- // https://github.com/medikoo/es6-symbol/issues/12
- if (ie11BugWorkaround) return;
- ie11BugWorkaround = true;
- defineProperty(this, name, d(value));
- ie11BugWorkaround = false;
- }));
- return name;
- };
- }());
- // Internal constructor (not one exposed) for creating Symbol instances.
- // This one is used to ensure that `someSymbol instanceof Symbol` always return false
- HiddenSymbol = function Symbol(description) {
- if (this instanceof HiddenSymbol) throw new TypeError('Symbol is not a constructor');
- return SymbolPolyfill(description);
- };
- // Exposed `Symbol` constructor
- // (returns instances of HiddenSymbol)
- polyfill = SymbolPolyfill = function Symbol(description) {
- var symbol;
- if (this instanceof Symbol) throw new TypeError('Symbol is not a constructor');
- if (isNativeSafe) return NativeSymbol(description);
- symbol = create(HiddenSymbol.prototype);
- description = (description === undefined ? '' : String(description));
- return defineProperties(symbol, {
- __description__: d('', description),
- __name__: d('', generateName(description))
- });
- };
- defineProperties(SymbolPolyfill, {
- for: d(function (key) {
- if (globalSymbols[key]) return globalSymbols[key];
- return (globalSymbols[key] = SymbolPolyfill(String(key)));
- }),
- keyFor: d(function (s) {
- var key;
- validateSymbol(s);
- for (key in globalSymbols) if (globalSymbols[key] === s) return key;
- }),
- // To ensure proper interoperability with other native functions (e.g. Array.from)
- // fallback to eventual native implementation of given symbol
- hasInstance: d('', (NativeSymbol && NativeSymbol.hasInstance) || SymbolPolyfill('hasInstance')),
- isConcatSpreadable: d('', (NativeSymbol && NativeSymbol.isConcatSpreadable) ||
- SymbolPolyfill('isConcatSpreadable')),
- iterator: d('', (NativeSymbol && NativeSymbol.iterator) || SymbolPolyfill('iterator')),
- match: d('', (NativeSymbol && NativeSymbol.match) || SymbolPolyfill('match')),
- replace: d('', (NativeSymbol && NativeSymbol.replace) || SymbolPolyfill('replace')),
- search: d('', (NativeSymbol && NativeSymbol.search) || SymbolPolyfill('search')),
- species: d('', (NativeSymbol && NativeSymbol.species) || SymbolPolyfill('species')),
- split: d('', (NativeSymbol && NativeSymbol.split) || SymbolPolyfill('split')),
- toPrimitive: d('', (NativeSymbol && NativeSymbol.toPrimitive) || SymbolPolyfill('toPrimitive')),
- toStringTag: d('', (NativeSymbol && NativeSymbol.toStringTag) || SymbolPolyfill('toStringTag')),
- unscopables: d('', (NativeSymbol && NativeSymbol.unscopables) || SymbolPolyfill('unscopables'))
- });
- // Internal tweaks for real symbol producer
- defineProperties(HiddenSymbol.prototype, {
- constructor: d(SymbolPolyfill),
- toString: d('', function () { return this.__name__; })
- });
- // Proper implementation of methods exposed on Symbol.prototype
- // They won't be accessible on produced symbol instances as they derive from HiddenSymbol.prototype
- defineProperties(SymbolPolyfill.prototype, {
- toString: d(function () { return 'Symbol (' + validateSymbol(this).__description__ + ')'; }),
- valueOf: d(function () { return validateSymbol(this); })
- });
- defineProperty(SymbolPolyfill.prototype, SymbolPolyfill.toPrimitive, d('', function () {
- var symbol = validateSymbol(this);
- if (typeof symbol === 'symbol') return symbol;
- return symbol.toString();
- }));
- defineProperty(SymbolPolyfill.prototype, SymbolPolyfill.toStringTag, d('c', 'Symbol'));
- // Proper implementaton of toPrimitive and toStringTag for returned symbol instances
- defineProperty(HiddenSymbol.prototype, SymbolPolyfill.toStringTag,
- d('c', SymbolPolyfill.prototype[SymbolPolyfill.toStringTag]));
- // Note: It's important to define `toPrimitive` as last one, as some implementations
- // implement `toPrimitive` natively without implementing `toStringTag` (or other specified symbols)
- // And that may invoke error in definition flow:
- // See: https://github.com/medikoo/es6-symbol/issues/13#issuecomment-164146149
- defineProperty(HiddenSymbol.prototype, SymbolPolyfill.toPrimitive,
- d('c', SymbolPolyfill.prototype[SymbolPolyfill.toPrimitive]));
- return polyfill;
- }
- var es6Symbol;
- var hasRequiredEs6Symbol;
- function requireEs6Symbol () {
- if (hasRequiredEs6Symbol) return es6Symbol;
- hasRequiredEs6Symbol = 1;
- es6Symbol = requireIsImplemented()() ? Symbol : requirePolyfill();
- return es6Symbol;
- }
- var isArguments;
- var hasRequiredIsArguments;
- function requireIsArguments () {
- if (hasRequiredIsArguments) return isArguments;
- hasRequiredIsArguments = 1;
- var objToString = Object.prototype.toString
- , id = objToString.call(
- (function () {
- return arguments;
- })()
- );
- isArguments = function (value) {
- return objToString.call(value) === id;
- };
- return isArguments;
- }
- var isFunction;
- var hasRequiredIsFunction;
- function requireIsFunction () {
- if (hasRequiredIsFunction) return isFunction;
- hasRequiredIsFunction = 1;
- var objToString = Object.prototype.toString, id = objToString.call(noop$4);
- isFunction = function (value) {
- return typeof value === "function" && objToString.call(value) === id;
- };
- return isFunction;
- }
- var isImplemented$1 = function () {
- var sign = Math.sign;
- if (typeof sign !== "function") return false;
- return (sign(10) === 1) && (sign(-20) === -1);
- };
- var shim$2;
- var hasRequiredShim$2;
- function requireShim$2 () {
- if (hasRequiredShim$2) return shim$2;
- hasRequiredShim$2 = 1;
- shim$2 = function (value) {
- value = Number(value);
- if (isNaN(value) || (value === 0)) return value;
- return value > 0 ? 1 : -1;
- };
- return shim$2;
- }
- var sign$1 = isImplemented$1()
- ? Math.sign
- : requireShim$2();
- var sign = sign$1
- , abs$1 = Math.abs, floor$1 = Math.floor;
- var toInteger$1 = function (value) {
- if (isNaN(value)) return 0;
- value = Number(value);
- if ((value === 0) || !isFinite(value)) return value;
- return sign(value) * floor$1(abs$1(value));
- };
- var toInteger = toInteger$1
- , max = Math.max;
- var toPosInteger = function (value) {
- return max(0, toInteger(value));
- };
- var isString;
- var hasRequiredIsString;
- function requireIsString () {
- if (hasRequiredIsString) return isString;
- hasRequiredIsString = 1;
- var objToString = Object.prototype.toString, id = objToString.call("");
- isString = function (value) {
- return (
- typeof value === "string" ||
- (value &&
- typeof value === "object" &&
- (value instanceof String || objToString.call(value) === id)) ||
- false
- );
- };
- return isString;
- }
- var shim$1;
- var hasRequiredShim$1;
- function requireShim$1 () {
- if (hasRequiredShim$1) return shim$1;
- hasRequiredShim$1 = 1;
- var iteratorSymbol = requireEs6Symbol().iterator
- , isArguments = requireIsArguments()
- , isFunction = requireIsFunction()
- , toPosInt = toPosInteger
- , callable = validCallable
- , validValue$1 = validValue
- , isValue = isValue$3
- , isString = requireIsString()
- , isArray = Array.isArray
- , call = Function.prototype.call
- , desc = { configurable: true, enumerable: true, writable: true, value: null }
- , defineProperty = Object.defineProperty;
- // eslint-disable-next-line complexity
- shim$1 = function (arrayLike /*, mapFn, thisArg*/) {
- var mapFn = arguments[1]
- , thisArg = arguments[2]
- , Context
- , i
- , j
- , arr
- , length
- , code
- , iterator
- , result
- , getIterator
- , value;
- arrayLike = Object(validValue$1(arrayLike));
- if (isValue(mapFn)) callable(mapFn);
- if (!this || this === Array || !isFunction(this)) {
- // Result: Plain array
- if (!mapFn) {
- if (isArguments(arrayLike)) {
- // Source: Arguments
- length = arrayLike.length;
- if (length !== 1) return Array.apply(null, arrayLike);
- arr = new Array(1);
- arr[0] = arrayLike[0];
- return arr;
- }
- if (isArray(arrayLike)) {
- // Source: Array
- arr = new Array(length = arrayLike.length);
- for (i = 0; i < length; ++i) arr[i] = arrayLike[i];
- return arr;
- }
- }
- arr = [];
- } else {
- // Result: Non plain array
- Context = this;
- }
- if (!isArray(arrayLike)) {
- if ((getIterator = arrayLike[iteratorSymbol]) !== undefined) {
- // Source: Iterator
- iterator = callable(getIterator).call(arrayLike);
- if (Context) arr = new Context();
- result = iterator.next();
- i = 0;
- while (!result.done) {
- value = mapFn ? call.call(mapFn, thisArg, result.value, i) : result.value;
- if (Context) {
- desc.value = value;
- defineProperty(arr, i, desc);
- } else {
- arr[i] = value;
- }
- result = iterator.next();
- ++i;
- }
- length = i;
- } else if (isString(arrayLike)) {
- // Source: String
- length = arrayLike.length;
- if (Context) arr = new Context();
- for (i = 0, j = 0; i < length; ++i) {
- value = arrayLike[i];
- if (i + 1 < length) {
- code = value.charCodeAt(0);
- // eslint-disable-next-line max-depth
- if (code >= 0xd800 && code <= 0xdbff) value += arrayLike[++i];
- }
- value = mapFn ? call.call(mapFn, thisArg, value, j) : value;
- if (Context) {
- desc.value = value;
- defineProperty(arr, j, desc);
- } else {
- arr[j] = value;
- }
- ++j;
- }
- length = j;
- }
- }
- if (length === undefined) {
- // Source: array or array-like
- length = toPosInt(arrayLike.length);
- if (Context) arr = new Context(length);
- for (i = 0; i < length; ++i) {
- value = mapFn ? call.call(mapFn, thisArg, arrayLike[i], i) : arrayLike[i];
- if (Context) {
- desc.value = value;
- defineProperty(arr, i, desc);
- } else {
- arr[i] = value;
- }
- }
- }
- if (Context) {
- desc.value = null;
- arr.length = length;
- }
- return arr;
- };
- return shim$1;
- }
- var from = isImplemented$3()
- ? Array.from
- : requireShim$1();
- var isImplemented = function () {
- var numberIsNaN = Number.isNaN;
- if (typeof numberIsNaN !== "function") return false;
- return !numberIsNaN({}) && numberIsNaN(NaN) && !numberIsNaN(34);
- };
- var shim;
- var hasRequiredShim;
- function requireShim () {
- if (hasRequiredShim) return shim;
- hasRequiredShim = 1;
- shim = function (value) {
- // eslint-disable-next-line no-self-compare
- return value !== value;
- };
- return shim;
- }
- var isNan = isImplemented()
- ? Number.isNaN
- : requireShim();
- var numberIsNaN = isNan
- , toPosInt = toPosInteger
- , value$1 = validValue
- , indexOf$1 = Array.prototype.indexOf
- , objHasOwnProperty = Object.prototype.hasOwnProperty
- , abs = Math.abs
- , floor = Math.floor;
- var eIndexOf = function (searchElement /*, fromIndex*/) {
- var i, length, fromIndex, val;
- if (!numberIsNaN(searchElement)) return indexOf$1.apply(this, arguments);
- length = toPosInt(value$1(this).length);
- fromIndex = arguments[1];
- if (isNaN(fromIndex)) fromIndex = 0;
- else if (fromIndex >= 0) fromIndex = floor(fromIndex);
- else fromIndex = toPosInt(this.length) - floor(abs(fromIndex));
- for (i = fromIndex; i < length; ++i) {
- if (objHasOwnProperty.call(this, i)) {
- val = this[i];
- if (numberIsNaN(val)) return i; // Jslint: ignore
- }
- }
- return -1;
- };
- var indexOf = eIndexOf
- , forEach = Array.prototype.forEach
- , splice = Array.prototype.splice;
- // eslint-disable-next-line no-unused-vars
- var remove$1 = function (itemToRemove /*, …item*/) {
- forEach.call(
- arguments,
- function (item) {
- var index = indexOf.call(this, item);
- if (index !== -1) splice.call(this, index, 1);
- },
- this
- );
- };
- var isValue = isValue$3;
- var map = { function: true, object: true };
- var isObject$1 = function (value) {
- return (isValue(value) && map[typeof value]) || false;
- };
- var isObject = isObject$1;
- var validObject = function (value) {
- if (!isObject(value)) throw new TypeError(value + " is not an Object");
- return value;
- };
- var aFrom = from
- , remove = remove$1
- , value = validObject
- , d = dExports
- , emit = eventEmitterExports.methods.emit
- , defineProperty = Object.defineProperty
- , hasOwnProperty$1 = Object.prototype.hasOwnProperty
- , getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
- var pipe = function (e1, e2/*, name*/) {
- var pipes, pipe, desc, name;
- (value(e1) && value(e2));
- name = arguments[2];
- if (name === undefined) name = 'emit';
- pipe = {
- close: function () { remove.call(pipes, e2); }
- };
- if (hasOwnProperty$1.call(e1, '__eePipes__')) {
- (pipes = e1.__eePipes__).push(e2);
- return pipe;
- }
- defineProperty(e1, '__eePipes__', d('c', pipes = [e2]));
- desc = getOwnPropertyDescriptor(e1, name);
- if (!desc) {
- desc = d('c', undefined);
- } else {
- delete desc.get;
- delete desc.set;
- }
- desc.value = function () {
- var i, emitter, data = aFrom(pipes);
- emit.apply(this, arguments);
- for (i = 0; (emitter = data[i]); ++i) emit.apply(emitter, arguments);
- };
- defineProperty(e1, name, desc);
- return pipe;
- };
- var pipe$1 = /*@__PURE__*/getDefaultExportFromCjs(pipe);
- let registeredHandlers = [...pagedMediaHandlers, ...generatedContentHandlers, ...filters];
- class Handlers {
- constructor(chunker, polisher, caller) {
- registeredHandlers.forEach((Handler) => {
- let handler = new Handler(chunker, polisher, caller);
- pipe$1(handler, this);
- });
- }
- }
- EventEmitter(Handlers.prototype);
- function registerHandlers() {
- for (var i = 0; i < arguments.length; i++) {
- registeredHandlers.push(arguments[i]);
- }
- }
- function initializeHandlers(chunker, polisher, caller) {
- let handlers = new Handlers(chunker, polisher, caller);
- return handlers;
- }
- class Previewer {
- constructor(options) {
- // this.preview = this.getParams("preview") !== "false";
- this.settings = options || {};
- // Process styles
- this.polisher = new Polisher(false);
- // Chunk contents
- this.chunker = new Chunker(undefined, undefined, this.settings);
- // Hooks
- this.hooks = {};
- this.hooks.beforePreview = new Hook(this);
- this.hooks.afterPreview = new Hook(this);
- // default size
- this.size = {
- width: {
- value: 8.5,
- unit: "in"
- },
- height: {
- value: 11,
- unit: "in"
- },
- format: undefined,
- orientation: undefined
- };
- this.chunker.on("page", (page) => {
- this.emit("page", page);
- });
- this.chunker.on("rendering", () => {
- this.emit("rendering", this.chunker);
- });
- }
- initializeHandlers() {
- let handlers = initializeHandlers(this.chunker, this.polisher, this);
- handlers.on("size", (size) => {
- this.size = size;
- this.emit("size", size);
- });
- handlers.on("atpages", (pages) => {
- this.atpages = pages;
- this.emit("atpages", pages);
- });
- return handlers;
- }
- registerHandlers() {
- return registerHandlers.apply(registerHandlers, arguments);
- }
- getParams(name) {
- let param;
- let url = new URL(window.location);
- let params = new URLSearchParams(url.search);
- for(var pair of params.entries()) {
- if(pair[0] === name) {
- param = pair[1];
- }
- }
- return param;
- }
- wrapContent() {
- // Wrap body in template tag
- let body = document.querySelector("body");
- // Check if a template exists
- let template;
- template = body.querySelector(":scope > template[data-ref='pagedjs-content']");
- if (!template) {
- // Otherwise create one
- template = document.createElement("template");
- template.dataset.ref = "pagedjs-content";
- template.innerHTML = body.innerHTML;
- body.innerHTML = "";
- body.appendChild(template);
- }
- return template.content;
- }
- removeStyles(doc=document) {
- // Get all stylesheets
- const stylesheets = Array.from(doc.querySelectorAll("link[rel='stylesheet']:not([data-pagedjs-ignore], [media~='screen'])"));
- // Get inline styles
- const inlineStyles = Array.from(doc.querySelectorAll("style:not([data-pagedjs-inserted-styles], [data-pagedjs-ignore], [media~='screen'])"));
- const elements = [...stylesheets, ...inlineStyles];
- return elements
- // preserve order
- .sort(function (element1, element2) {
- const position = element1.compareDocumentPosition(element2);
- if (position === Node.DOCUMENT_POSITION_PRECEDING) {
- return 1;
- } else if (position === Node.DOCUMENT_POSITION_FOLLOWING) {
- return -1;
- }
- return 0;
- })
- // extract the href
- .map((element) => {
- if (element.nodeName === "STYLE") {
- const obj = {};
- obj[window.location.href] = element.textContent;
- element.remove();
- return obj;
- }
- if (element.nodeName === "LINK") {
- element.remove();
- return element.href;
- }
- // ignore
- console.warn(`Unable to process: ${element}, ignoring.`);
- });
- }
- async preview(content, stylesheets, renderTo) {
- await this.hooks.beforePreview.trigger(content, renderTo);
- if (!content) {
- content = this.wrapContent();
- }
- if (!stylesheets) {
- stylesheets = this.removeStyles();
- }
- this.polisher.setup();
- this.handlers = this.initializeHandlers();
- await this.polisher.add(...stylesheets);
- let startTime = performance.now();
- // Render flow
- let flow = await this.chunker.flow(content, renderTo);
- let endTime = performance.now();
- flow.performance = (endTime - startTime);
- flow.size = this.size;
- this.emit("rendered", flow);
- await this.hooks.afterPreview.trigger(flow.pages);
- return flow;
- }
- }
- EventEmitter(Previewer.prototype);
- var Paged = /*#__PURE__*/Object.freeze({
- __proto__: null,
- Chunker: Chunker,
- Handler: Handler,
- Polisher: Polisher,
- Previewer: Previewer,
- initializeHandlers: initializeHandlers,
- registerHandlers: registerHandlers,
- registeredHandlers: registeredHandlers
- });
- window.Paged = Paged;
- let ready = new Promise(function(resolve, reject){
- if (document.readyState === "interactive" || document.readyState === "complete") {
- resolve(document.readyState);
- return;
- }
- document.onreadystatechange = function ($) {
- if (document.readyState === "interactive") {
- resolve(document.readyState);
- }
- };
- });
- let config = window.PagedConfig || {
- auto: true,
- before: undefined,
- after: undefined,
- content: undefined,
- stylesheets: undefined,
- renderTo: undefined,
- settings: undefined
- };
- let previewer = new Previewer(config.settings);
- ready.then(async function () {
- let done;
- if (config.before) {
- await config.before();
- }
- if(config.auto !== false) {
- done = await previewer.preview(config.content, config.stylesheets, config.renderTo);
- }
- if (config.after) {
- await config.after(done);
- }
- });
- return previewer;
- }));
|