css-vars.js 243 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644
  1. "use strict";
  2. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  3. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  5. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  6. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  7. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8. function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
  9. (function (f) {
  10. if ((typeof exports === "undefined" ? "undefined" : _typeof(exports)) === "object" && typeof module !== "undefined") {
  11. module.exports = f();
  12. } else if (typeof define === "function" && define.amd) {
  13. define([], f);
  14. } else {
  15. var g;if (typeof window !== "undefined") {
  16. g = window;
  17. } else if (typeof global !== "undefined") {
  18. g = global;
  19. } else if (typeof self !== "undefined") {
  20. g = self;
  21. } else {
  22. g = this;
  23. }g.Fashion = f();
  24. }
  25. })(function () {
  26. var define, module, exports;return function () {
  27. function r(e, n, t) {
  28. function o(i, f) {
  29. if (!n[i]) {
  30. if (!e[i]) {
  31. var c = "function" == typeof require && require;if (!f && c) return c(i, !0);if (u) return u(i, !0);var a = new Error("Cannot find module '" + i + "'");throw a.code = "MODULE_NOT_FOUND", a;
  32. }var p = n[i] = { exports: {} };e[i][0].call(p.exports, function (r) {
  33. var n = e[i][1][r];return o(n || r);
  34. }, p, p.exports, r, e, n, t);
  35. }return n[i].exports;
  36. }for (var u = "function" == typeof require && require, i = 0; i < t.length; i++) {
  37. o(t[i]);
  38. }return o;
  39. }return r;
  40. }()({ 1: [function (require, module, exports) {
  41. var _Fashion$apply;
  42. var Fashion = require('./src/export/Base.js');
  43. var CssVariableManager = require('./src/export/css/CssVariableManager.js'),
  44. css = new CssVariableManager();
  45. Fashion.apply(Fashion, (_Fashion$apply = {
  46. css: css,
  47. CssExport: CssVariableManager,
  48. Types: require('./src/export/type/Types.js'),
  49. ValueParser: require('./src/export/parse/ValueParser.js'),
  50. Type: require('./src/export/type/Type.js'),
  51. Bool: require('./src/export/type/Bool.js'),
  52. Literal: require('./src/export/type/Literal.js'),
  53. ParentheticalExpression: require('./src/export/type/ParentheticalExpression.js'),
  54. Text: require('./src/export/type/Text.js'),
  55. Numeric: require('./src/export/type/Numeric.js'),
  56. List: require('./src/export/type/List.js'),
  57. Map: require('./src/export/type/Map.js'),
  58. Color: require('./src/export/type/Color.js'),
  59. ColorRGBA: require('./src/export/type/ColorRGBA.js'),
  60. ColorHSLA: require('./src/export/type/ColorHSLA.js'),
  61. ColorStop: require('./src/export/type/ColorStop.js'),
  62. FunctionCall: require('./src/export/type/FunctionCall.js'),
  63. LinearGradient: require('./src/export/type/LinearGradient.js'),
  64. RadialGradient: require('./src/export/type/RadialGradient.js'),
  65. Statics: require('./src/export/type/Statics.js'),
  66. SourceBuilder: require('./src/export/type/SourceBuilder.js')
  67. }, _defineProperty(_Fashion$apply, "Types", require('./src/export/type/Types.js')), _defineProperty(_Fashion$apply, "TypeVisitor", require('./src/export/type/TypeVisitor.js')), _defineProperty(_Fashion$apply, "Output", require('./src/export/Output.js')), _defineProperty(_Fashion$apply, "Runtime", require('./src/export/Runtime.js')), _Fashion$apply));
  68. module.exports = Fashion;
  69. }, { "./src/export/Base.js": 3, "./src/export/Output.js": 4, "./src/export/Runtime.js": 5, "./src/export/css/CssVariableManager.js": 6, "./src/export/parse/ValueParser.js": 7, "./src/export/type/Bool.js": 8, "./src/export/type/Color.js": 9, "./src/export/type/ColorHSLA.js": 10, "./src/export/type/ColorRGBA.js": 11, "./src/export/type/ColorStop.js": 12, "./src/export/type/FunctionCall.js": 13, "./src/export/type/LinearGradient.js": 14, "./src/export/type/List.js": 15, "./src/export/type/Literal.js": 16, "./src/export/type/Map.js": 17, "./src/export/type/Numeric.js": 18, "./src/export/type/ParentheticalExpression.js": 19, "./src/export/type/RadialGradient.js": 20, "./src/export/type/SourceBuilder.js": 21, "./src/export/type/Statics.js": 22, "./src/export/type/Text.js": 23, "./src/export/type/Type.js": 24, "./src/export/type/TypeVisitor.js": 25, "./src/export/type/Types.js": 26 }], 2: [function (require, module, exports) {
  70. "use strict";
  71. function getJsName(name) {
  72. return name.replace(/\-/g, '_').replace(/\//g, '_fs_').replace(/\\/g, '_bs_');
  73. }
  74. var NameConverter = function () {
  75. function NameConverter() {
  76. _classCallCheck(this, NameConverter);
  77. this.variableNameMap = {};
  78. }
  79. _createClass(NameConverter, [{
  80. key: "convertName",
  81. value: function convertName(name) {
  82. var map = this.variableNameMap,
  83. converted = map[name];
  84. if (converted === undefined) {
  85. converted = map[name] = getJsName(name);
  86. }
  87. return converted;
  88. }
  89. }]);
  90. return NameConverter;
  91. }();
  92. var converter = new NameConverter();
  93. module.exports = {
  94. NameConverter: NameConverter,
  95. getJsName: function getJsName(name) {
  96. return converter.convertName(name);
  97. }
  98. };
  99. }, {}], 3: [function (require, module, exports) {
  100. /*
  101. * Copyright (c) 2012-2016. Sencha Inc.
  102. */
  103. "use strict";
  104. var NameConverter = require('./../NameConverter.js');
  105. var debugging = {
  106. trace: false
  107. };
  108. var Base = function Base(config) {
  109. _classCallCheck(this, Base);
  110. if (config) {
  111. merge(this, config);
  112. }
  113. };
  114. var BaseSet = function () {
  115. function BaseSet() {
  116. _classCallCheck(this, BaseSet);
  117. }
  118. _createClass(BaseSet, [{
  119. key: "first",
  120. value: function first() {
  121. return _first(this.items);
  122. }
  123. }, {
  124. key: "last",
  125. value: function last() {
  126. return _last(this.items);
  127. }
  128. }, {
  129. key: "tail",
  130. value: function tail() {
  131. return _tail(this.items);
  132. }
  133. }]);
  134. return BaseSet;
  135. }();
  136. BaseSet.prototype.items = null;
  137. function _chainFunc() {}
  138. function apply(target, source) {
  139. target = target || {};
  140. if (source) {
  141. for (var name in source) {
  142. target[name] = source[name];
  143. }
  144. }
  145. return target;
  146. }
  147. function merge(destination, object) {
  148. destination = destination || {};
  149. var key, value, sourceKey;
  150. if (object) {
  151. for (key in object) {
  152. value = object[key];
  153. if (value && value.constructor === Object) {
  154. sourceKey = destination[key];
  155. if (sourceKey && sourceKey.constructor === Object) {
  156. merge(sourceKey, value);
  157. } else {
  158. destination[key] = value;
  159. }
  160. } else {
  161. destination[key] = value;
  162. }
  163. }
  164. }
  165. return destination;
  166. }
  167. var chain = Object.create || function (Parent) {
  168. _chainFunc.prototype = Parent;
  169. return new _chainFunc();
  170. };
  171. function createMessage(message, source) {
  172. if (source && source.isFashionScanner) {
  173. message += ': ' + source.currentFile + ':' + source.lineNumber;
  174. } else if (source) {
  175. message += ': ' + source.file + ':' + source.lineNumber;
  176. }
  177. return message;
  178. }
  179. function isFunction(obj) {
  180. return obj && typeof obj === 'function';
  181. }
  182. function trace(message, source) {
  183. if (debugging.trace) {
  184. console.log(createMessage('[DBG] ' + message, source));
  185. }
  186. }
  187. function debug(message, source) {
  188. console.log(createMessage('[DBG] ' + message, source));
  189. }
  190. function log(message, source) {
  191. console.log(createMessage('[LOG] ' + message, source));
  192. }
  193. function info(message, source) {
  194. console.log(createMessage('[INF] ' + message, source));
  195. }
  196. function warn(message, source) {
  197. console.log(createMessage('[WRN] ' + message, source));
  198. }
  199. function error(message, source) {
  200. console.log(createMessage('[ERR] ' + message, source));
  201. }
  202. function raise(message, extra) {
  203. if (Fashion.inspect) {
  204. debugger;
  205. }
  206. if (typeof message !== 'string') {
  207. extra = message;
  208. message = extra.message;
  209. delete extra.message;
  210. }
  211. var error = new Error(message);
  212. error.$isFashionError = true;
  213. throw apply(error, extra);
  214. }
  215. function raiseAt(message, source, stack) {
  216. var extra;
  217. if (source) {
  218. message = createMessage(message, source);
  219. if (source.isFashionScanner) {
  220. extra = {
  221. file: source.currentFile,
  222. lineNumber: source.lineNumber
  223. };
  224. } else {
  225. extra = {
  226. node: source,
  227. lineNumber: source.lineNumber,
  228. file: source.file
  229. };
  230. }
  231. }
  232. if (stack) {
  233. if (!extra) {
  234. extra = {};
  235. }
  236. extra.fashionStack = stack;
  237. }
  238. raise(message, extra);
  239. }
  240. function filter(array, func) {
  241. var result = [];
  242. for (var i = 0; i < array.length; i++) {
  243. var item = array[i];
  244. if (func(item, i)) {
  245. result.push(item);
  246. }
  247. }
  248. return result;
  249. }
  250. function convert(array, func) {
  251. var converted = [];
  252. for (var i = 0; i < array.length; i++) {
  253. converted.push(func(array[i]));
  254. }
  255. return converted;
  256. }
  257. function _first(array) {
  258. return array.length && array[0];
  259. }
  260. function _last(array) {
  261. return array.length && array[array.length - 1];
  262. }
  263. function _tail(array) {
  264. if (array.length > 2) {
  265. return array.slice(1);
  266. }
  267. return [];
  268. }
  269. function getAllKeys(obj, stop) {
  270. var keys = [],
  271. map = {},
  272. i,
  273. key,
  274. n,
  275. names;
  276. for (; obj && obj !== stop; obj = Object.getPrototypeOf(obj)) {
  277. names = Object.getOwnPropertyNames(obj);
  278. for (i = 0, n = names.length; i < n; ++i) {
  279. key = names[i];
  280. if (!map[key]) {
  281. map[key] = true;
  282. keys.push(key);
  283. }
  284. }
  285. }
  286. return keys;
  287. }
  288. function mixin(target, bases) {
  289. if (!Array.isArray(bases)) {
  290. bases = Array.prototype.slice.call(arguments, 1);
  291. }
  292. var proto = target.prototype;
  293. for (var b = 0; b < bases.length; b++) {
  294. var base = bases[b],
  295. baseProto = base.prototype;
  296. getAllKeys(baseProto, Base.prototype).forEach(function (name) {
  297. if (name in baseProto) {
  298. if (!(name in proto)) {
  299. proto[name] = baseProto[name];
  300. }
  301. }
  302. });
  303. }
  304. }
  305. function flatten(array, level, output) {
  306. output = output || [];
  307. level = typeof level === 'undefined' ? 1000 : level;
  308. for (var i = 0; i < array.length; i++) {
  309. var item = array[i];
  310. if (Array.isArray(item) && level) {
  311. flatten(item, level - 1, output);
  312. } else {
  313. output.push(item);
  314. }
  315. }
  316. return output;
  317. }
  318. module.exports = {
  319. EmptyArray: [],
  320. getJsName: NameConverter.getJsName,
  321. chain: chain,
  322. Base: Base,
  323. BaseSet: BaseSet,
  324. apply: apply,
  325. merge: merge,
  326. createMessage: createMessage,
  327. isFunction: isFunction,
  328. debugging: debugging,
  329. trace: trace,
  330. debug: debug,
  331. log: log,
  332. info: info,
  333. warn: warn,
  334. error: error,
  335. raise: raise,
  336. raiseAt: raiseAt,
  337. filter: filter,
  338. convert: convert,
  339. first: _first,
  340. last: _last,
  341. tail: _tail,
  342. mixin: mixin,
  343. flatten: flatten
  344. };
  345. }, { "./../NameConverter.js": 2 }], 4: [function (require, module, exports) {
  346. /*
  347. * Copyright (c) 2012-2016. Sencha Inc.
  348. */
  349. "use strict";
  350. var Fashion = require('./Base.js'),
  351. Base = Fashion.Base;
  352. var Output = function (_Base) {
  353. _inherits(Output, _Base);
  354. function Output() {
  355. _classCallCheck(this, Output);
  356. var _this = _possibleConstructorReturn(this, (Output.__proto__ || Object.getPrototypeOf(Output)).call(this));
  357. _this.output = '';
  358. return _this;
  359. }
  360. _createClass(Output, [{
  361. key: "space",
  362. value: function space() {
  363. this.add(' ');
  364. }
  365. }, {
  366. key: "add",
  367. value: function add(text) {
  368. this.output += text;
  369. }
  370. }, {
  371. key: "addComment",
  372. value: function addComment(text) {
  373. this.output += text;
  374. }
  375. }, {
  376. key: "indent",
  377. value: function indent() {
  378. this.indentation += this.indentstr;
  379. }
  380. }, {
  381. key: "unindent",
  382. value: function unindent() {
  383. this.indentation = this.indentation.substr(this.indentstr.length);
  384. }
  385. }, {
  386. key: "addln",
  387. value: function addln(ln) {
  388. this.output += '\n' + this.indentation + (ln || '');
  389. }
  390. }, {
  391. key: "addCommentLn",
  392. value: function addCommentLn(ln) {
  393. if (ln && ln.indexOf('//') === 0) {
  394. return;
  395. }
  396. this.addln(ln);
  397. }
  398. }, {
  399. key: "get",
  400. value: function get() {
  401. return this.output;
  402. }
  403. }, {
  404. key: "indentln",
  405. value: function indentln(ln) {
  406. this.addln(ln);
  407. this.indent();
  408. }
  409. }, {
  410. key: "unindentln",
  411. value: function unindentln(ln) {
  412. this.unindent();
  413. this.addln(ln);
  414. }
  415. }, {
  416. key: "reset",
  417. value: function reset() {
  418. this.indentation = '';
  419. this.output = '';
  420. }
  421. }]);
  422. return Output;
  423. }(Base);
  424. Fashion.apply(Output.prototype, {
  425. indentation: '',
  426. output: '',
  427. isCompressed: false,
  428. indentstr: ' ',
  429. splitThreshold: 1000000,
  430. selectorCount: 0
  431. });
  432. module.exports = Output;
  433. }, { "./Base.js": 3 }], 5: [function (require, module, exports) {
  434. "use strict";
  435. var Fashion = require('./Base.js'),
  436. Base = Fashion.Base;
  437. var Type = require('./type/Type.js');
  438. var List = require('./type/List.js');
  439. var Bool = require('./type/Bool.js');
  440. var Color = require('./type/Color.js');
  441. var ColorRGBA = require('./type/ColorRGBA.js');
  442. var Text = require('./type/Text.js');
  443. var Literal = require('./type/Literal.js');
  444. var Statics = require('./type/Statics.js');
  445. var TypeVisitor = require('./type/TypeVisitor.js');
  446. var Types = require('./type/Types.js');
  447. var Scope = function () {
  448. function Scope(prev) {
  449. _classCallCheck(this, Scope);
  450. this.prev = prev;
  451. this.map = {};
  452. this.sourceInfo = null;
  453. }
  454. _createClass(Scope, [{
  455. key: "get",
  456. value: function get(name) {
  457. var map = this.map,
  458. prev = this,
  459. value;
  460. while (map) {
  461. value = map[name];
  462. if (value) {
  463. return value;
  464. }
  465. prev = prev.prev;
  466. map = prev && prev.map;
  467. }
  468. return value;
  469. }
  470. }, {
  471. key: "has",
  472. value: function has(name) {
  473. //return name in this.map;
  474. var map = this.map,
  475. prev = this;
  476. while (map) {
  477. if (name in map) {
  478. return true;
  479. }
  480. prev = prev.prev;
  481. map = prev && prev.map;
  482. }
  483. return false;
  484. }
  485. }, {
  486. key: "put",
  487. value: function put(name, value) {
  488. this.map[name] = value;
  489. return value;
  490. }
  491. }, {
  492. key: "addEntries",
  493. value: function addEntries(names) {
  494. if (this.prev) {
  495. this.prev.addEntries(names);
  496. }
  497. for (var name in this.map) {
  498. names[name] = this.map[name];
  499. }
  500. }
  501. }, {
  502. key: "getEntries",
  503. value: function getEntries(entries) {
  504. entries = entries || {};
  505. this.addEntries(entries);
  506. return entries;
  507. }
  508. }, {
  509. key: "getSourceInfo",
  510. value: function getSourceInfo() {
  511. return this.sourceInfo;
  512. }
  513. }, {
  514. key: "getCallStack",
  515. value: function getCallStack(stack) {
  516. stack = stack || [];
  517. if (this.sourceInfo) {
  518. stack.push(this.sourceInfo);
  519. }
  520. if (this.prev) {
  521. this.prev.getCallStack(stack);
  522. }
  523. return stack;
  524. }
  525. }]);
  526. return Scope;
  527. }();
  528. Fashion.apply(Scope.prototype, {
  529. $isScope: true,
  530. map: undefined,
  531. prev: undefined,
  532. // placeholder used to track what to reset the _currentScope to,
  533. resetScope: undefined
  534. });
  535. var Runtime = function (_Base2) {
  536. _inherits(Runtime, _Base2);
  537. function Runtime(config) {
  538. _classCallCheck(this, Runtime);
  539. var _this2 = _possibleConstructorReturn(this, (Runtime.__proto__ || Object.getPrototypeOf(Runtime)).call(this, config));
  540. var me = _this2;
  541. me.mixins = {};
  542. me.functions = {};
  543. me.processors = [];
  544. me.registered = {
  545. runtime: me,
  546. box: Statics.boxType,
  547. unbox: Statics.unboxType,
  548. isArray: function isArray(array) {
  549. return Array.isArray(array);
  550. },
  551. getRuntime: function getRuntime() {
  552. return this.runtime;
  553. },
  554. handleArgs: function handleArgs(args, keys) {
  555. var scope = {},
  556. index = 0,
  557. key;
  558. for (var a = 0; a < args.length; a++) {
  559. var arg = args[a];
  560. if (arg === undefined) {
  561. continue;
  562. }
  563. // Named arguments
  564. if (arg === true || arg === false) {
  565. scope[keys[index]] = arg;
  566. index++;
  567. } else if (arg.type === undefined) {
  568. for (key in arg) {
  569. scope[key.replace(/^\$/, '')] = arg[key];
  570. }
  571. }
  572. // Required arguments
  573. else {
  574. key = keys[index];
  575. if (key instanceof Array) {
  576. key = key[0];
  577. scope[key] = scope[key] || new List();
  578. scope[key].add(arg);
  579. } else {
  580. scope[key] = arg;
  581. index++;
  582. }
  583. }
  584. }
  585. return scope;
  586. },
  587. sliceArgs: function sliceArgs(args, start, end) {
  588. return this.getRuntime().sliceArgs(args, start, end).items;
  589. },
  590. tailArgs: function tailArgs(start, args) {
  591. var tail = Array.prototype.slice.call(args, start);
  592. if (tail.length == 1 && this.isArray(tail)) {
  593. tail = tail[0];
  594. }
  595. return tail;
  596. }
  597. };
  598. return _this2;
  599. }
  600. _createClass(Runtime, [{
  601. key: "bool",
  602. value: function bool(value) {
  603. return new Bool(value);
  604. }
  605. }, {
  606. key: "color",
  607. value: function color(name) {
  608. var rgb = Color.map[name],
  609. color = new ColorRGBA(rgb[0], rgb[1], rgb[2], rgb[3]);
  610. color.stringified = name;
  611. return color;
  612. }
  613. }, {
  614. key: "quote",
  615. value: function quote(value) {
  616. if (value.type === 'string') {
  617. return value;
  618. }
  619. return new Text(value.toString());
  620. }
  621. }, {
  622. key: "unquote",
  623. value: function unquote(value) {
  624. if (value.$isFashionType) {
  625. return value.unquote();
  626. }
  627. return new Literal(value.toString());
  628. }
  629. }, {
  630. key: "not",
  631. value: function not(expression) {
  632. return this.box(this.unbox(expression) == false);
  633. }
  634. }, {
  635. key: "operate",
  636. value: function operate(operation, left, right) {
  637. if (left == null || left.$isFashionNull) {
  638. if (operation != '==' && operation != '!=') {
  639. return Literal.Null;
  640. }
  641. }
  642. if (right == null || right.$isFashionNull) {
  643. if (operation != '==' && operation != '!=') {
  644. return Literal.Null;
  645. }
  646. }
  647. return left.operate(operation, right);
  648. }
  649. }, {
  650. key: "reset",
  651. value: function reset() {
  652. this._currentScope = null;
  653. this._currentCallStackScope = this.createCallStackScope();
  654. this._globalScope = this.createScope();
  655. this._dynamics = {};
  656. }
  657. }, {
  658. key: "run",
  659. value: function run(code, metadata) {
  660. this.load(code);
  661. this.compile(code);
  662. return this.execute(metadata);
  663. }
  664. }, {
  665. key: "createTypesBlock",
  666. value: function createTypesBlock(types) {
  667. types = types || this.types;
  668. var keys = Object.getOwnPropertyNames(types),
  669. buff = [],
  670. name;
  671. for (var i = 0; i < keys.length; i++) {
  672. name = keys[i];
  673. buff.push(name + ' = Types.' + name);
  674. buff.push("__" + name + ' = ' + name);
  675. }
  676. if (buff.length === 0) {
  677. return '';
  678. }
  679. return 'var ' + buff.join(',\n ') + ';\n';
  680. }
  681. }, {
  682. key: "createMethodBlock",
  683. value: function createMethodBlock(proto) {
  684. proto = proto || this.constructor.prototype;
  685. var buff = [],
  686. keys,
  687. name;
  688. while (proto) {
  689. keys = Object.getOwnPropertyNames(proto);
  690. for (var i = 0; i < keys.length; i++) {
  691. name = keys[i];
  692. if (typeof proto[name] === 'function') {
  693. buff.push("__rt_" + name + ' = __rt.' + name + '.bind(__rt)');
  694. }
  695. }
  696. proto = Object.getPrototypeOf(proto);
  697. }
  698. if (buff.length === 0) {
  699. return '';
  700. }
  701. return 'var ' + buff.join(',\n ') + ';\n';
  702. }
  703. }, {
  704. key: "createPropertyBlock",
  705. value: function createPropertyBlock() {
  706. var keys = Object.getOwnPropertyNames(this),
  707. buff = [],
  708. name;
  709. for (var i = 0; i < keys.length; i++) {
  710. name = keys[i];
  711. buff.push("__rt_" + name + ' = __rt.' + name);
  712. }
  713. if (buff.length === 0) {
  714. return '';
  715. }
  716. return 'var ' + buff.join(',\n ') + ';\n';
  717. }
  718. }, {
  719. key: "createPrefixedFunctionBody",
  720. value: function createPrefixedFunctionBody(code) {
  721. code = this.createTypesBlock() + this.createMethodBlock() + this.createPropertyBlock() + code;
  722. return code;
  723. }
  724. }, {
  725. key: "createWrappedFn",
  726. value: function createWrappedFn(code) {
  727. return new Function('Types', '__rt', '__gs', '__udf', '__dyn', this.createPrefixedFunctionBody(code));
  728. }
  729. }, {
  730. key: "callWrappedFn",
  731. value: function callWrappedFn(fn, dynamics) {
  732. return fn(Fashion, this, this._globalScope, undefined, dynamics || {});
  733. }
  734. }, {
  735. key: "compile",
  736. value: function compile(code) {
  737. var me = this,
  738. theFn;
  739. //code = '"use strict";\n' + code;
  740. this.code = code;
  741. new Function();
  742. theFn = this.createWrappedFn(code);
  743. this.fn = function (rt, overrides, dyn) {
  744. var runtime = rt || me,
  745. dynamics = dyn || {};
  746. runtime.reset();
  747. if (overrides) {
  748. if (overrides.$isScope) {
  749. runtime._globalScope = overrides;
  750. } else {
  751. runtime._globalScope.map = overrides;
  752. }
  753. }
  754. if (dyn) {
  755. runtime._dynamics = dyn;
  756. }
  757. runtime._currentScope = runtime._globalScope;
  758. runtime._scopeStack = [runtime._currentScope];
  759. try {
  760. theFn(me.types, runtime, runtime._globalScope, undefined, dynamics);
  761. } catch (err) {
  762. Fashion.raiseAt(err.message || err, null, runtime.getCallStack());
  763. }
  764. return runtime._globalScope;
  765. };
  766. return this.fn;
  767. }
  768. }, {
  769. key: "execute",
  770. value: function execute(metadata) {
  771. return this.fn(this, metadata);
  772. }
  773. }, {
  774. key: "load",
  775. value: function load(code) {
  776. this.code = code;
  777. return this;
  778. }
  779. }, {
  780. key: "registerProcessor",
  781. value: function registerProcessor(proc) {
  782. this.processors.push(new TypeVisitor(proc));
  783. }
  784. }, {
  785. key: "register",
  786. value: function register(methods) {
  787. if (methods['dynamic']) {
  788. Fashion.error('Cannot register javascript function named "dynamic"');
  789. delete methods['dynamic'];
  790. }
  791. if (methods['require']) {
  792. Fashion.error('Cannot register javascript function named "require"');
  793. delete methods['require'];
  794. }
  795. Fashion.apply(this.registered, methods);
  796. }
  797. }, {
  798. key: "isRegistered",
  799. value: function isRegistered(name) {
  800. name = this.reserved[name] ? '__' + name : name;
  801. return !!this.registered[name];
  802. }
  803. }, {
  804. key: "getGlobalScope",
  805. value: function getGlobalScope() {
  806. return this._globalScope;
  807. }
  808. }, {
  809. key: "getCurrentScope",
  810. value: function getCurrentScope() {
  811. return this._currentScope;
  812. }
  813. }, {
  814. key: "getRegisteredFunctions",
  815. value: function getRegisteredFunctions() {
  816. return this.registered;
  817. }
  818. }, {
  819. key: "getFunctions",
  820. value: function getFunctions() {
  821. return this.functions;
  822. }
  823. }, {
  824. key: "getMixins",
  825. value: function getMixins() {
  826. return this.mixins;
  827. }
  828. }, {
  829. key: "createScope",
  830. value: function createScope(scope) {
  831. var currScope = scope || this._currentScope,
  832. newScope = new Scope(currScope);
  833. return this.pushScope(newScope);
  834. }
  835. }, {
  836. key: "pushScope",
  837. value: function pushScope(scope) {
  838. scope.resetScope = this._currentScope;
  839. this._currentScope = scope;
  840. return scope;
  841. }
  842. }, {
  843. key: "popScope",
  844. value: function popScope() {
  845. this._currentScope = this._currentScope.resetScope;
  846. return this._currentScope;
  847. }
  848. }, {
  849. key: "createCallStackScope",
  850. value: function createCallStackScope(scope) {
  851. var currScope = scope || this._currentCallStackScope,
  852. newScope = new Scope(currScope);
  853. return this.pushCallStackScope(newScope);
  854. }
  855. }, {
  856. key: "pushCallStackScope",
  857. value: function pushCallStackScope(scope) {
  858. scope.resetScope = this._currentCallStackScope;
  859. this._currentCallStackScope = scope;
  860. return scope;
  861. }
  862. }, {
  863. key: "popCallStackScope",
  864. value: function popCallStackScope() {
  865. this._currentCallStackScope = this._currentCallStackScope.resetScope;
  866. return this._currentCallStackScope;
  867. }
  868. }, {
  869. key: "getCallStack",
  870. value: function getCallStack() {
  871. if (this._currentCallStackScope) {
  872. return this._currentCallStackScope.getCallStack();
  873. }
  874. return null;
  875. }
  876. }, {
  877. key: "pushSourceInfo",
  878. value: function pushSourceInfo(info) {
  879. if (this._currentCallStackScope) {
  880. this._currentCallStackScope.sourceInfo = info;
  881. }
  882. return true;
  883. }
  884. }, {
  885. key: "getSourceInfo",
  886. value: function getSourceInfo() {
  887. var stack = this._currentCallStackScope,
  888. info = stack && stack.sourceInfo;
  889. if (info && info.length) {
  890. return {
  891. lineNumber: info[0],
  892. file: info[1]
  893. };
  894. }
  895. return null;
  896. }
  897. }, {
  898. key: "get",
  899. value: function get(name) {
  900. var scope = this.getScopeForName(name),
  901. res = scope.map[name];
  902. if (typeof res === 'undefined') {
  903. if (!(name in scope.map)) {
  904. Fashion.raiseAt('Reference to undeclared variable : ' + name, null, this.getCallStack());
  905. }
  906. }
  907. return this.box(res);
  908. }
  909. }, {
  910. key: "getScopeForName",
  911. value: function getScopeForName(jsName) {
  912. var scope = this._currentScope;
  913. while (scope) {
  914. if (jsName in scope.map) {
  915. return scope;
  916. }
  917. scope = scope.prev;
  918. }
  919. return this._currentScope;
  920. }
  921. }, {
  922. key: "getDefault",
  923. value: function getDefault(val) {
  924. if (val == null || typeof val === 'undefined') {
  925. // === null || undefined
  926. return undefined;
  927. }
  928. if (val.$isFashionNull) {
  929. if (this.constructor.allowNullDefaults) {
  930. return val;
  931. }
  932. return undefined;
  933. }
  934. return this.box(val);
  935. }
  936. }, {
  937. key: "getGlobalDefault",
  938. value: function getGlobalDefault(jsName) {
  939. var obj = this._globalScope.get(jsName);
  940. return this.getDefault(obj);
  941. }
  942. }, {
  943. key: "getLocalDefault",
  944. value: function getLocalDefault(jsName) {
  945. var obj = this._currentScope.get(jsName);
  946. return this.getDefault(obj);
  947. }
  948. }, {
  949. key: "setGlobal",
  950. value: function setGlobal(jsName, value, astNodeId) {
  951. var currScope = this._globalScope;
  952. if (!value || !value.$isFashionLiteral) {
  953. value = this.box(value);
  954. }
  955. value.ast = value.ast || this.getAstNode(astNodeId);
  956. currScope.map[jsName] = value;
  957. return value;
  958. }
  959. }, {
  960. key: "setDynamic",
  961. value: function setDynamic(name, value, astNodeId) {
  962. var jsName = Fashion.getJsName(name),
  963. currScope = this._globalScope,
  964. newValue;
  965. if (!value || !value.$isFashionLiteral) {
  966. value = this.box(value);
  967. }
  968. value.ast = value.ast || this.getAstNode(astNodeId);
  969. if (value.$referenceName || value.$constant) {
  970. newValue = value.clone();
  971. newValue.$previousReference = value;
  972. value = newValue;
  973. value.ast = this.getAstNode(astNodeId);
  974. } else {
  975. value.$referenceName = name;
  976. }
  977. currScope.map[jsName] = value;
  978. return value;
  979. }
  980. }, {
  981. key: "setScoped",
  982. value: function setScoped(jsName, value) {
  983. var currScope = this.getScopeForName(jsName);
  984. if (!value || !value.$isFashionLiteral) {
  985. value = this.box(value);
  986. }
  987. currScope.map[jsName] = value;
  988. return value;
  989. }
  990. }, {
  991. key: "set",
  992. value: function set(jsName, value) {
  993. var currScope = this._currentScope;
  994. if (!value || !value.$isFashionLiteral) {
  995. value = this.box(value);
  996. }
  997. currScope.map[jsName] = value;
  998. return value;
  999. }
  1000. }, {
  1001. key: "getDocs",
  1002. value: function getDocs(id) {
  1003. if (this.docCache) {
  1004. return this.docCache.get(id);
  1005. }
  1006. }
  1007. }, {
  1008. key: "getString",
  1009. value: function getString(id) {
  1010. if (this.stringCache) {
  1011. return this.stringCache.get(id);
  1012. }
  1013. }
  1014. }, {
  1015. key: "getAstNode",
  1016. value: function getAstNode(id) {
  1017. if (this.nodeCache) {
  1018. return this.nodeCache.get(id);
  1019. }
  1020. }
  1021. }, {
  1022. key: "applySpread",
  1023. value: function applySpread(arg) {
  1024. arg.spread = true;
  1025. return arg;
  1026. }
  1027. }, {
  1028. key: "sliceArgs",
  1029. value: function sliceArgs(args, start, end) {
  1030. start = start || 0;
  1031. end = end || args.length;
  1032. var filtered = [],
  1033. newArgs = [],
  1034. separator = ', ',
  1035. spread,
  1036. a,
  1037. arg;
  1038. for (a = start; a < end; a++) {
  1039. arg = args[a];
  1040. if (!arg) {
  1041. if (!spread) {
  1042. filtered.push(arg);
  1043. }
  1044. continue;
  1045. }
  1046. if (arg.spread && arg.$isFashionList) {
  1047. if (spread) {
  1048. filtered.push(spread);
  1049. }
  1050. spread = arg;
  1051. separator = spread.separator || separator;
  1052. } else {
  1053. filtered.push(arg);
  1054. }
  1055. }
  1056. for (a = 0; a < filtered.length; a++) {
  1057. arg = filtered[a];
  1058. separator = arg && arg.splatSeparator || separator;
  1059. newArgs.push(filtered[a]);
  1060. }
  1061. if (spread) {
  1062. newArgs.push.apply(newArgs, spread.items);
  1063. }
  1064. return new List(newArgs, separator);
  1065. }
  1066. }, {
  1067. key: "applySpreadArgs",
  1068. value: function applySpreadArgs(args, name) {
  1069. var newArgs = [],
  1070. hadSpread = false,
  1071. offset = 0,
  1072. arg,
  1073. a,
  1074. item,
  1075. i,
  1076. items,
  1077. key,
  1078. map,
  1079. defaults,
  1080. proc,
  1081. param,
  1082. paramName;
  1083. proc = this.context && this.context.preprocessor;
  1084. if (proc) {
  1085. defaults = proc.mixinDeclarations[name];
  1086. if (defaults) {
  1087. offset = 1;
  1088. } else {
  1089. defaults = proc.functionDeclarations[name];
  1090. }
  1091. defaults = defaults && defaults.parameters;
  1092. }
  1093. for (a = 0; a < args.length; a++) {
  1094. arg = args[a];
  1095. if (arg && arg.spread && arg.$isFashionMap && defaults) {
  1096. items = arg.items;
  1097. map = {};
  1098. for (key in arg.map) {
  1099. map['$' + Fashion.getJsName(key)] = arg.map[key];
  1100. }
  1101. for (var p = 0; p < defaults.length; p++) {
  1102. param = defaults[p];
  1103. paramName = Fashion.getJsName(param.name);
  1104. if (paramName in map) {
  1105. newArgs.push(items[map[paramName]]);
  1106. delete map[paramName];
  1107. } else if (!param.varArgs) {
  1108. newArgs.push(undefined);
  1109. }
  1110. }
  1111. for (key in map) {
  1112. item = items[map[key]];
  1113. newArgs.push(item);
  1114. }
  1115. hadSpread = true;
  1116. } else if (arg && arg.spread && arg.$isFashionList) {
  1117. items = arg.getItems();
  1118. for (i = 0; i < items.length; i++) {
  1119. item = items[i];
  1120. item && (item.splatSeparator = arg.separator);
  1121. newArgs.push(item);
  1122. }
  1123. hadSpread = true;
  1124. } else if (arg || !hadSpread) {
  1125. newArgs.push(arg);
  1126. }
  1127. // clear the flag indicating the spread argument
  1128. // so subsequent calls using this same variable will not
  1129. // be contaminated
  1130. arg && (arg.spread = undefined);
  1131. }
  1132. var misisngParams = this.context && this.context.missingParameters;
  1133. if (misisngParams && misisngParams == 'error') {
  1134. if (defaults) {
  1135. for (var d = 0; d < defaults.length; d++) {
  1136. if (!defaults[d].hasOwnProperty('default') && !defaults[d].varArgs) {
  1137. if (newArgs[d + offset] === undefined) {
  1138. Fashion.raiseAt("No value supplied for argument : " + defaults[d].name, null, this.getCallStack());
  1139. }
  1140. }
  1141. }
  1142. }
  1143. }
  1144. return newArgs;
  1145. }
  1146. }, {
  1147. key: "warn",
  1148. value: function warn(arg) {
  1149. Fashion.warn(arg, this.getSourceInfo());
  1150. }
  1151. }, {
  1152. key: "error",
  1153. value: function error(arg) {
  1154. Fashion.raiseAt(arg, null, this.getCallStack());
  1155. }
  1156. }, {
  1157. key: "debug",
  1158. value: function debug() {
  1159. Fashion.debug.apply(Fashion, arguments);
  1160. }
  1161. }, {
  1162. key: "setCaches",
  1163. value: function setCaches(transpiler) {
  1164. this.docCache = transpiler.docCache;
  1165. this.stringCache = transpiler.stringCache;
  1166. this.nodeCache = transpiler.nodeCache;
  1167. }
  1168. }, {
  1169. key: "copyRuntimeState",
  1170. value: function copyRuntimeState(runtime) {
  1171. this._dynamics = runtime._dynamics;
  1172. this.registered = runtime.registered;
  1173. this.functions = runtime.functions;
  1174. this.mixins = runtime.mixins;
  1175. }
  1176. }, {
  1177. key: "test",
  1178. value: function test(val) {
  1179. val = this.unbox(val);
  1180. if (val == null || val === false) {
  1181. return false;
  1182. }
  1183. return true;
  1184. }
  1185. }, {
  1186. key: "and",
  1187. value: function and(a, b) {
  1188. if (this.test(a)) {
  1189. return b;
  1190. }
  1191. return a;
  1192. }
  1193. }, {
  1194. key: "or",
  1195. value: function or(a, b) {
  1196. if (this.test(a)) {
  1197. return a;
  1198. }
  1199. return b;
  1200. }
  1201. }]);
  1202. return Runtime;
  1203. }(Base);
  1204. Fashion.apply(Runtime.prototype, {
  1205. box: Type.box,
  1206. unbox: Type.unbox,
  1207. Scope: Scope,
  1208. isFashionRuntime: true,
  1209. functions: null,
  1210. code: null,
  1211. fn: null,
  1212. stringCache: null,
  1213. docCache: null,
  1214. types: Types,
  1215. _globalScope: null,
  1216. _currentScope: null,
  1217. _dynamics: null,
  1218. context: null,
  1219. reserved: {
  1220. 'if': true,
  1221. 'else': true
  1222. }
  1223. });
  1224. module.exports = Runtime;
  1225. }, { "./Base.js": 3, "./type/Bool.js": 8, "./type/Color.js": 9, "./type/ColorRGBA.js": 11, "./type/List.js": 15, "./type/Literal.js": 16, "./type/Statics.js": 22, "./type/Text.js": 23, "./type/Type.js": 24, "./type/TypeVisitor.js": 25, "./type/Types.js": 26 }], 6: [function (require, module, exports) {
  1226. "use strict";
  1227. var Fashion = require('../Base.js');
  1228. var Runtime = require('../Runtime.js');
  1229. var ValueParser = require('../parse/ValueParser.js');
  1230. var SourceBuilder = require('../type/SourceBuilder.js');
  1231. var CssVariableManager = function () {
  1232. function CssVariableManager() {
  1233. _classCallCheck(this, CssVariableManager);
  1234. this.reset();
  1235. }
  1236. _createClass(CssVariableManager, [{
  1237. key: "reset",
  1238. value: function reset() {
  1239. this.initFns = [];
  1240. this.calcFns = [];
  1241. this.variableMap = {};
  1242. this.runtime = null;
  1243. }
  1244. }, {
  1245. key: "createRuntime",
  1246. value: function createRuntime() {
  1247. return new Runtime();
  1248. }
  1249. }, {
  1250. key: "getRuntime",
  1251. value: function getRuntime() {
  1252. var me = this,
  1253. rt = me.runtime;
  1254. if (!rt) {
  1255. rt = me.createRuntime();
  1256. for (var i = 0; i < me.initFns.length; i++) {
  1257. me.initFns[i](rt);
  1258. }
  1259. me.runtime = rt;
  1260. }
  1261. return rt;
  1262. }
  1263. }, {
  1264. key: "calculate",
  1265. value: function calculate(vars) {
  1266. var me = this,
  1267. rt = me.getRuntime(),
  1268. globals = {},
  1269. parser = new ValueParser(),
  1270. map = me.variableMap,
  1271. key,
  1272. scope,
  1273. sb,
  1274. name,
  1275. names,
  1276. jsName,
  1277. value,
  1278. wrapper;
  1279. scope = new rt.Scope();
  1280. for (name in vars) {
  1281. key = Fashion.getJsName(name.replace(me.nameRe, ''));
  1282. if (key.indexOf('$') !== 0) {
  1283. key = '$' + key;
  1284. }
  1285. scope.put(key, parser.parse(vars[name]));
  1286. }
  1287. rt._globalScope = scope;
  1288. rt._currentScope = scope;
  1289. for (var i = 0; i < me.calcFns.length; i++) {
  1290. me.calcFns[i](rt);
  1291. }
  1292. sb = new SourceBuilder();
  1293. vars = {};
  1294. for (name in map) {
  1295. names = map[name];
  1296. for (var i = 0; i < names.length; i++) {
  1297. key = names[i];
  1298. jsName = '$' + Fashion.getJsName(key);
  1299. value = scope.get(jsName);
  1300. if (value) {
  1301. if (value.$isWrapper) {
  1302. value = value.value;
  1303. }
  1304. vars[key] = sb.toSource(value);
  1305. }
  1306. }
  1307. }
  1308. return vars;
  1309. }
  1310. }, {
  1311. key: "applyVariables",
  1312. value: function applyVariables(vars) {
  1313. var me = this,
  1314. map = me.variableMap;
  1315. for (var selector in map) {
  1316. var variables = map[selector];
  1317. var els = document.querySelectorAll(selector);
  1318. if (els) {
  1319. for (var i = 0; i < els.length; i++) {
  1320. for (var j = 0; j < variables.length; j++) {
  1321. var varName = variables[j];
  1322. els[i].style.setProperty('--' + varName, vars[varName]);
  1323. }
  1324. }
  1325. }
  1326. }
  1327. }
  1328. }, {
  1329. key: "setVariables",
  1330. value: function setVariables(vars) {
  1331. this.applyVariables(this.calculate(vars));
  1332. }
  1333. }, {
  1334. key: "register",
  1335. value: function register(init, calc, map) {
  1336. if (init) {
  1337. this.initFns.push(init);
  1338. }
  1339. if (calc) {
  1340. this.calcFns.push(calc);
  1341. }
  1342. if (map) {
  1343. var vars = this.variableMap;
  1344. for (var name in map) {
  1345. var curr = vars[name];
  1346. if (!curr) {
  1347. vars[name] = map[name];
  1348. } else {
  1349. curr.push.apply(curr, map[name]);
  1350. }
  1351. }
  1352. }
  1353. }
  1354. }, {
  1355. key: "buildName",
  1356. value: function buildName(name) {
  1357. return name.replace(/^--/, '').replace(/^\$/, '');
  1358. }
  1359. }, {
  1360. key: "buildJsName",
  1361. value: function buildJsName(name) {
  1362. return Fashion.getJsName(name);
  1363. }
  1364. }, {
  1365. key: "buildNames",
  1366. value: function buildNames(names) {
  1367. var out = {},
  1368. name;
  1369. for (name in names) {
  1370. out[name] = this.buildName(names[name]);
  1371. }
  1372. return out;
  1373. }
  1374. }, {
  1375. key: "buildJsNames",
  1376. value: function buildJsNames(names) {
  1377. var out = {},
  1378. name;
  1379. for (name in names) {
  1380. out[name] = this.buildJsName(names[name]);
  1381. }
  1382. return out;
  1383. }
  1384. }, {
  1385. key: "getVariables",
  1386. value: function getVariables() {
  1387. var me = this,
  1388. map = me.variableMap,
  1389. out = {};
  1390. for (var selector in map) {
  1391. var variables = map[selector];
  1392. var els = document.querySelectorAll(selector);
  1393. if (els) {
  1394. for (var i = 0; i < els.length; i++) {
  1395. for (var j = 0; j < variables.length; j++) {
  1396. var varName = variables[j];
  1397. out[varName] = els[i].style.getPropertyValue('--' + varName);
  1398. }
  1399. }
  1400. }
  1401. }
  1402. return out;
  1403. }
  1404. }]);
  1405. return CssVariableManager;
  1406. }();
  1407. Fashion.apply(CssVariableManager.prototype, {
  1408. $isExport: true,
  1409. nameRe: /^--/
  1410. });
  1411. module.exports = CssVariableManager;
  1412. }, { "../Base.js": 3, "../Runtime.js": 5, "../parse/ValueParser.js": 7, "../type/SourceBuilder.js": 21 }], 7: [function (require, module, exports) {
  1413. "use strict";
  1414. var Fashion = require('../Base.js');
  1415. var Type = require('../type/Type.js');
  1416. var Statics = require('../type/Statics.js');
  1417. var Types = require('../type/Types.js'),
  1418. Color = Types.Color,
  1419. Text = Types.Text,
  1420. Numeric = Types.Numeric,
  1421. List = Types.List,
  1422. Bool = Types.Bool,
  1423. Literal = Types.Literal,
  1424. ColorRGBA = Types.ColorRGBA,
  1425. ColorHSLA = Types.ColorHSLA,
  1426. FunctionCall = Types.FunctionCall;
  1427. var Parser = function () {
  1428. function Parser() {
  1429. _classCallCheck(this, Parser);
  1430. this.index = 0;
  1431. }
  1432. _createClass(Parser, [{
  1433. key: "_advance",
  1434. value: function _advance() {
  1435. var me = this,
  1436. buff = '',
  1437. str = me.str,
  1438. len = str.length,
  1439. isString = false,
  1440. escaped = false,
  1441. isParen = 0,
  1442. ch;
  1443. while (me.index < len) {
  1444. ch = str[me.index];
  1445. me.index++;
  1446. // whitespace
  1447. if (ch <= ' ') {
  1448. if (!isString && !isParen) {
  1449. if (buff.length) {
  1450. break;
  1451. }
  1452. continue;
  1453. }
  1454. }
  1455. // terminal char
  1456. if (ch === ';' && !isString && !escaped) {
  1457. break;
  1458. }
  1459. if (ch === '(') {
  1460. isParen++;
  1461. }
  1462. if (ch === ')') {
  1463. isParen && isParen--;
  1464. }
  1465. if (ch === ',' && !isString && !escaped && !isParen) {
  1466. if (buff.length) {
  1467. me.index--;
  1468. break;
  1469. } else {
  1470. return ch;
  1471. }
  1472. }
  1473. if (ch === '\\') {
  1474. if (isString) {
  1475. escaped = 1;
  1476. me.index++;
  1477. continue;
  1478. }
  1479. }
  1480. if (ch === '"' || ch === "'") {
  1481. if (!isString) {
  1482. isString = ch;
  1483. } else if (isString === ch) {
  1484. isString = false;
  1485. }
  1486. }
  1487. escaped = false;
  1488. buff += ch;
  1489. }
  1490. return buff;
  1491. }
  1492. }, {
  1493. key: "parseValue",
  1494. value: function parseValue(token) {
  1495. var rx = {
  1496. number: /^(\d+)(px|pt|pc|cm|mm|in|em|rem|ex)?$/g,
  1497. shortHexColor: /^#([A-Fa-f0-9]{3})$/,
  1498. longHexColor: /^#([A-Fa-f0-9]{6})$/,
  1499. functionCall: /^([A-Za-z0-9_]+)\((.*)\)$/,
  1500. parenList: /^\((.*?)\)$/
  1501. },
  1502. match,
  1503. value;
  1504. if (token[0] === '"' || token[0] === "'") {
  1505. value = token = token.substring(1, token.length - 1);
  1506. return new Text(value, token[0]);
  1507. }
  1508. if (token === 'true') {
  1509. return new Bool(true);
  1510. }
  1511. if (token === 'false') {
  1512. return new Bool(false);
  1513. }
  1514. if (token === 'null') {
  1515. return Literal.Null;
  1516. }
  1517. if (token === 'none') {
  1518. return Literal.None;
  1519. }
  1520. if (Fashion.Color.map[token]) {
  1521. var rgb = Color.map[token],
  1522. color = new ColorRGBA(rgb[0], rgb[1], rgb[2], rgb[3]);
  1523. color.stringified = token;
  1524. return color;
  1525. }
  1526. if (match = rx.number.exec(token)) {
  1527. return new Numeric(parseFloat(match[1]), match[2]);
  1528. }
  1529. if (match = rx.shortHexColor.exec(token)) {
  1530. return ColorRGBA.fromHex(match[1]);
  1531. }
  1532. if (match = rx.longHexColor.exec(token)) {
  1533. return ColorRGBA.fromHex(match[1]);
  1534. }
  1535. if (match = rx.functionCall.exec(token)) {
  1536. var name = match[1],
  1537. args = this.parse(match[2]).items;
  1538. if (name === 'hsla' || name === 'hsl') {
  1539. return new ColorHSLA(Type.unbox(args[0]), Type.unbox(args[1]), Type.unbox(args[2]), Type.unbox(args[3]) || 1);
  1540. } else if (name === 'rgba' || name === 'rgb') {
  1541. return new ColorRGBA(Type.unbox(args[0]), Type.unbox(args[1]), Type.unbox(args[2]), Type.unbox(args[3]) || 1);
  1542. }
  1543. return new FunctionCall(name, args);
  1544. }
  1545. if (match = rx.parenList.exec(token)) {
  1546. return new FunctionCall(this.parse(match[1]));
  1547. }
  1548. return new Fashion.Literal(token);
  1549. }
  1550. }, {
  1551. key: "parse",
  1552. value: function parse(str) {
  1553. var me = this,
  1554. tokens = [],
  1555. values = [],
  1556. csv = null,
  1557. token;
  1558. me.str = str;
  1559. me.index = 0;
  1560. while (token = me._advance()) {
  1561. tokens.push(token);
  1562. }
  1563. for (var i = 0; i < tokens.length; i++) {
  1564. token = tokens[i].trim();
  1565. if (tokens[i + 1] === ',') {
  1566. csv = csv || [];
  1567. csv.push(me.parseValue(token));
  1568. i++;
  1569. } else if (csv) {
  1570. csv.push(me.parseValue(token));
  1571. values.push(new List(csv, ', '));
  1572. csv = null;
  1573. } else {
  1574. values.push(me.parseValue(token));
  1575. }
  1576. }
  1577. if (values.length === 1) {
  1578. return values[0];
  1579. }
  1580. return new List(values, ' ');
  1581. }
  1582. }]);
  1583. return Parser;
  1584. }();
  1585. // Fashion.apply(Parser.prototype, {
  1586. // regex:
  1587. // });
  1588. module.exports = Parser;
  1589. }, { "../Base.js": 3, "../type/Statics.js": 22, "../type/Type.js": 24, "../type/Types.js": 26 }], 8: [function (require, module, exports) {
  1590. /*
  1591. * Copyright (c) 2012-2016. Sencha Inc.
  1592. */
  1593. "use strict";
  1594. var Fashion = require('../Base.js');
  1595. var Type = require('./Type.js');
  1596. var Bool = function (_Type) {
  1597. _inherits(Bool, _Type);
  1598. function Bool(value) {
  1599. _classCallCheck(this, Bool);
  1600. var _this3 = _possibleConstructorReturn(this, (Bool.__proto__ || Object.getPrototypeOf(Bool)).call(this));
  1601. _this3.value = !!value;
  1602. return _this3;
  1603. }
  1604. _createClass(Bool, [{
  1605. key: "doVisit",
  1606. value: function doVisit(visitor) {
  1607. visitor.bool(this);
  1608. }
  1609. }, {
  1610. key: "toString",
  1611. value: function toString() {
  1612. return this.value ? 'true' : 'false';
  1613. }
  1614. }, {
  1615. key: "copy",
  1616. value: function copy() {
  1617. return new Bool(this.value);
  1618. }
  1619. }]);
  1620. return Bool;
  1621. }(Type);
  1622. Fashion.apply(Bool.prototype, {
  1623. type: 'bool',
  1624. $isFashionBool: true,
  1625. value: null
  1626. });
  1627. Bool.True = new Bool(true);
  1628. Bool.True.$constant = true;
  1629. Bool.False = new Bool(false);
  1630. Bool.False.$constant = true;
  1631. module.exports = Bool;
  1632. }, { "../Base.js": 3, "./Type.js": 24 }], 9: [function (require, module, exports) {
  1633. /*
  1634. * Copyright (c) 2012-2016. Sencha Inc.
  1635. */
  1636. "use strict";
  1637. var Fashion = require('../Base.js');
  1638. var Type = require('./Type.js');
  1639. var Bool = require('./Bool.js');
  1640. var Numeric = require('./Numeric.js');
  1641. var Color = function (_Type2) {
  1642. _inherits(Color, _Type2);
  1643. function Color() {
  1644. _classCallCheck(this, Color);
  1645. return _possibleConstructorReturn(this, (Color.__proto__ || Object.getPrototypeOf(Color)).call(this));
  1646. }
  1647. _createClass(Color, [{
  1648. key: "toBoolean",
  1649. value: function toBoolean() {
  1650. return Bool.True;
  1651. }
  1652. // These two references need to be left out of the comment section above
  1653. // so as to prevent ordering issue during builds;
  1654. }, {
  1655. key: "getRGBA",
  1656. value: function getRGBA() {
  1657. return this;
  1658. }
  1659. }, {
  1660. key: "getHSLA",
  1661. value: function getHSLA() {
  1662. return this;
  1663. }
  1664. }], [{
  1665. key: "component",
  1666. value: function component(color, _component) {
  1667. var unit = Color.units[_component],
  1668. type = Color.types[_component],
  1669. prop = Color.comps[_component],
  1670. targetColor;
  1671. if (type == 'hsla') {
  1672. targetColor = color.getHSLA();
  1673. } else {
  1674. targetColor = color.getRGBA();
  1675. }
  1676. return new Numeric(targetColor[prop], unit);
  1677. }
  1678. }, {
  1679. key: "adjust",
  1680. value: function adjust(color, component, amount) {
  1681. var hsl = color.getHSLA().copy(),
  1682. prop = Color.comps[component],
  1683. value = amount.value;
  1684. // if (component === 'saturation' && hsl.s === 0) {
  1685. // return color.clone();
  1686. // }
  1687. //
  1688. hsl[prop] += value;
  1689. hsl.h = Color.constrainDegrees(hsl.h);
  1690. hsl.s = Color.constrainPercentage(hsl.s);
  1691. hsl.l = Color.constrainPercentage(hsl.l);
  1692. return hsl.getRGBA();
  1693. }
  1694. }, {
  1695. key: "constrainChannel",
  1696. value: function constrainChannel(channel) {
  1697. return Math.max(0, Math.min(channel, 255));
  1698. }
  1699. }, {
  1700. key: "constrainPercentage",
  1701. value: function constrainPercentage(per) {
  1702. return Math.max(0, Math.min(per, 100));
  1703. }
  1704. }, {
  1705. key: "constrainDegrees",
  1706. value: function constrainDegrees(deg) {
  1707. deg = deg % 360;
  1708. return deg < 0 ? 360 + deg : deg;
  1709. }
  1710. }, {
  1711. key: "constrainAlpha",
  1712. value: function constrainAlpha(alpha) {
  1713. if (alpha === undefined) {
  1714. return 1;
  1715. }
  1716. return Math.max(0, Math.min(alpha, 1));
  1717. }
  1718. }]);
  1719. return Color;
  1720. }(Type);
  1721. Fashion.apply(Color, {
  1722. units: {
  1723. lightness: '%',
  1724. saturation: '%',
  1725. hue: 'deg'
  1726. },
  1727. types: {
  1728. red: 'rgba',
  1729. blue: 'rgba',
  1730. green: 'rgba',
  1731. alpha: 'rgba',
  1732. hue: 'hsla',
  1733. saturation: 'hsla',
  1734. lightness: 'hsla'
  1735. },
  1736. comps: {
  1737. red: 'r',
  1738. green: 'g',
  1739. blue: 'b',
  1740. alpha: 'a',
  1741. hue: 'h',
  1742. saturation: 's',
  1743. lightness: 'l'
  1744. },
  1745. map: {
  1746. aliceblue: [240, 248, 255],
  1747. antiquewhite: [250, 235, 215],
  1748. aqua: [0, 255, 255],
  1749. aquamarine: [127, 255, 212],
  1750. azure: [240, 255, 255],
  1751. beige: [245, 245, 220],
  1752. bisque: [255, 228, 196],
  1753. black: [0, 0, 0],
  1754. blanchedalmond: [255, 235, 205],
  1755. blue: [0, 0, 255],
  1756. blueviolet: [138, 43, 226],
  1757. brown: [165, 42, 42],
  1758. burlywood: [222, 184, 135],
  1759. cadetblue: [95, 158, 160],
  1760. chartreuse: [127, 255, 0],
  1761. chocolate: [210, 105, 30],
  1762. coral: [255, 127, 80],
  1763. cornflowerblue: [100, 149, 237],
  1764. cornsilk: [255, 248, 220],
  1765. crimson: [220, 20, 60],
  1766. cyan: [0, 255, 255],
  1767. darkblue: [0, 0, 139],
  1768. darkcyan: [0, 139, 139],
  1769. darkgoldenrod: [184, 132, 11],
  1770. darkgray: [169, 169, 169],
  1771. darkgreen: [0, 100, 0],
  1772. darkgrey: [169, 169, 169],
  1773. darkkhaki: [189, 183, 107],
  1774. darkmagenta: [139, 0, 139],
  1775. darkolivegreen: [85, 107, 47],
  1776. darkorange: [255, 140, 0],
  1777. darkorchid: [153, 50, 204],
  1778. darkred: [139, 0, 0],
  1779. darksalmon: [233, 150, 122],
  1780. darkseagreen: [143, 188, 143],
  1781. darkslateblue: [72, 61, 139],
  1782. darkslategray: [47, 79, 79],
  1783. darkslategrey: [47, 79, 79],
  1784. darkturquoise: [0, 206, 209],
  1785. darkviolet: [148, 0, 211],
  1786. deeppink: [255, 20, 147],
  1787. deepskyblue: [0, 191, 255],
  1788. dimgray: [105, 105, 105],
  1789. dimgrey: [105, 105, 105],
  1790. dodgerblue: [30, 144, 255],
  1791. firebrick: [178, 34, 34],
  1792. floralwhite: [255, 255, 240],
  1793. forestgreen: [34, 139, 34],
  1794. fuchsia: [255, 0, 255],
  1795. gainsboro: [220, 220, 220],
  1796. ghostwhite: [248, 248, 255],
  1797. gold: [255, 215, 0],
  1798. goldenrod: [218, 165, 32],
  1799. gray: [128, 128, 128],
  1800. green: [0, 128, 0],
  1801. greenyellow: [173, 255, 47],
  1802. grey: [128, 128, 128],
  1803. honeydew: [240, 255, 240],
  1804. hotpink: [255, 105, 180],
  1805. indianred: [205, 92, 92],
  1806. indigo: [75, 0, 130],
  1807. ivory: [255, 255, 240],
  1808. khaki: [240, 230, 140],
  1809. lavender: [230, 230, 250],
  1810. lavenderblush: [255, 240, 245],
  1811. lawngreen: [124, 252, 0],
  1812. lemonchiffon: [255, 250, 205],
  1813. lightblue: [173, 216, 230],
  1814. lightcoral: [240, 128, 128],
  1815. lightcyan: [224, 255, 255],
  1816. lightgoldenrodyellow: [250, 250, 210],
  1817. lightgray: [211, 211, 211],
  1818. lightgreen: [144, 238, 144],
  1819. lightgrey: [211, 211, 211],
  1820. lightpink: [255, 182, 193],
  1821. lightsalmon: [255, 160, 122],
  1822. lightseagreen: [32, 178, 170],
  1823. lightskyblue: [135, 206, 250],
  1824. lightslategray: [119, 136, 153],
  1825. lightslategrey: [119, 136, 153],
  1826. lightsteelblue: [176, 196, 222],
  1827. lightyellow: [255, 255, 224],
  1828. lime: [0, 255, 0],
  1829. limegreen: [50, 205, 50],
  1830. linen: [250, 240, 230],
  1831. magenta: [255, 0, 255],
  1832. maroon: [128, 0, 0],
  1833. mediumaquamarine: [102, 205, 170],
  1834. mediumblue: [0, 0, 205],
  1835. mediumorchid: [186, 85, 211],
  1836. mediumpurple: [147, 112, 219],
  1837. mediumseagreen: [60, 179, 113],
  1838. mediumslateblue: [123, 104, 238],
  1839. mediumspringgreen: [0, 250, 154],
  1840. mediumturquoise: [72, 209, 204],
  1841. mediumvioletred: [199, 21, 133],
  1842. midnightblue: [25, 25, 112],
  1843. mintcream: [245, 255, 250],
  1844. mistyrose: [255, 228, 225],
  1845. moccasin: [255, 228, 181],
  1846. navajowhite: [255, 222, 173],
  1847. navy: [0, 0, 128],
  1848. oldlace: [253, 245, 230],
  1849. olive: [128, 128, 0],
  1850. olivedrab: [107, 142, 35],
  1851. orange: [255, 165, 0],
  1852. orangered: [255, 69, 0],
  1853. orchid: [218, 112, 214],
  1854. palegoldenrod: [238, 232, 170],
  1855. palegreen: [152, 251, 152],
  1856. paleturquoise: [175, 238, 238],
  1857. palevioletred: [219, 112, 147],
  1858. papayawhip: [255, 239, 213],
  1859. peachpuff: [255, 218, 185],
  1860. peru: [205, 133, 63],
  1861. pink: [255, 192, 203],
  1862. plum: [221, 160, 203],
  1863. powderblue: [176, 224, 230],
  1864. purple: [128, 0, 128],
  1865. red: [255, 0, 0],
  1866. rosybrown: [188, 143, 143],
  1867. royalblue: [65, 105, 225],
  1868. saddlebrown: [139, 69, 19],
  1869. salmon: [250, 128, 114],
  1870. sandybrown: [244, 164, 96],
  1871. seagreen: [46, 139, 87],
  1872. seashell: [255, 245, 238],
  1873. sienna: [160, 82, 45],
  1874. silver: [192, 192, 192],
  1875. skyblue: [135, 206, 235],
  1876. slateblue: [106, 90, 205],
  1877. slategray: [119, 128, 144],
  1878. slategrey: [119, 128, 144],
  1879. snow: [255, 255, 250],
  1880. springgreen: [0, 255, 127],
  1881. steelblue: [70, 130, 180],
  1882. tan: [210, 180, 140],
  1883. teal: [0, 128, 128],
  1884. thistle: [216, 191, 216],
  1885. tomato: [255, 99, 71],
  1886. turquoise: [64, 224, 208],
  1887. violet: [238, 130, 238],
  1888. wheat: [245, 222, 179],
  1889. white: [255, 255, 255],
  1890. whitesmoke: [245, 245, 245],
  1891. yellow: [255, 255, 0],
  1892. yellowgreen: [154, 205, 5],
  1893. transparent: [0, 0, 0, 0]
  1894. }
  1895. });
  1896. Fashion.apply(Color.prototype, {
  1897. type: 'color',
  1898. $isFashionColor: true,
  1899. $isFashionRGBA: false,
  1900. $isFashionHSLA: false,
  1901. $canUnbox: false
  1902. });
  1903. module.exports = Color;
  1904. }, { "../Base.js": 3, "./Bool.js": 8, "./Numeric.js": 18, "./Type.js": 24 }], 10: [function (require, module, exports) {
  1905. /*
  1906. * Copyright (c) 2012-2016. Sencha Inc.
  1907. */
  1908. "use strict";
  1909. var Fashion = require('../Base.js');
  1910. var Color = require('./Color.js');
  1911. var ColorRGBA = require('./ColorRGBA.js');
  1912. var ColorHSLA = function (_Color) {
  1913. _inherits(ColorHSLA, _Color);
  1914. function ColorHSLA(h, s, l, a) {
  1915. _classCallCheck(this, ColorHSLA);
  1916. var _this5 = _possibleConstructorReturn(this, (ColorHSLA.__proto__ || Object.getPrototypeOf(ColorHSLA)).call(this));
  1917. _this5.h = Color.constrainDegrees(h);
  1918. _this5.s = s;
  1919. _this5.l = l;
  1920. if (a !== undefined) {
  1921. _this5.a = a;
  1922. }
  1923. return _this5;
  1924. }
  1925. _createClass(ColorHSLA, [{
  1926. key: "doVisit",
  1927. value: function doVisit(visitor) {
  1928. visitor.hsla(this);
  1929. }
  1930. }, {
  1931. key: "operate",
  1932. value: function operate(operation, right) {
  1933. return this.getRGBA().operate(operation, right);
  1934. }
  1935. }, {
  1936. key: "copy",
  1937. value: function copy() {
  1938. return new ColorHSLA(this.h, this.s, this.l, this.a);
  1939. }
  1940. }, {
  1941. key: "getRGBA",
  1942. value: function getRGBA() {
  1943. return ColorRGBA.fromHSLA(this);
  1944. }
  1945. }, {
  1946. key: "toString",
  1947. value: function toString() {
  1948. return this.getRGBA().toString();
  1949. }
  1950. }, {
  1951. key: "add",
  1952. value: function add(h, s, l, a) {
  1953. return new ColorHSLA(Color.constrainDegrees(this.h + h), Color.constrainPercentage(this.s + s), Color.constrainPercentage(this.l + l), Color.constrainAlpha(this.a * a));
  1954. }
  1955. }, {
  1956. key: "subtract",
  1957. value: function subtract(h, s, l) {
  1958. return this.add(-h, -s, -l);
  1959. }
  1960. }, {
  1961. key: "adjustLightness",
  1962. value: function adjustLightness(percent) {
  1963. this.l = Color.constrainPercentage(this.l + percent);
  1964. return this;
  1965. }
  1966. }, {
  1967. key: "adjustHue",
  1968. value: function adjustHue(deg) {
  1969. this.h = Color.constrainDegrees(this.h + deg);
  1970. return this;
  1971. }
  1972. }], [{
  1973. key: "fromRGBA",
  1974. value: function fromRGBA(rgba) {
  1975. if (rgba.$isFashionHSLA) {
  1976. return rgba.clone();
  1977. }
  1978. var r = rgba.r / 255,
  1979. g = rgba.g / 255,
  1980. b = rgba.b / 255,
  1981. a = rgba.a,
  1982. max = Math.max(r, g, b),
  1983. min = Math.min(r, g, b),
  1984. delta = max - min,
  1985. h = 0,
  1986. s = 0,
  1987. l = 0.5 * (max + min);
  1988. // min==max means achromatic (hue is undefined)
  1989. if (min != max) {
  1990. s = l < 0.5 ? delta / (max + min) : delta / (2 - max - min);
  1991. if (r == max) {
  1992. h = 60 * (g - b) / delta;
  1993. } else if (g == max) {
  1994. h = 120 + 60 * (b - r) / delta;
  1995. } else {
  1996. h = 240 + 60 * (r - g) / delta;
  1997. }
  1998. if (h < 0) {
  1999. h += 360;
  2000. }
  2001. if (h >= 360) {
  2002. h -= 360;
  2003. }
  2004. }
  2005. return new ColorHSLA(Color.constrainDegrees(h), Color.constrainPercentage(s * 100), Color.constrainPercentage(l * 100), a);
  2006. }
  2007. }]);
  2008. return ColorHSLA;
  2009. }(Color);
  2010. ColorRGBA.prototype.getHSLA = function () {
  2011. return ColorHSLA.fromRGBA(this);
  2012. };
  2013. Fashion.apply(ColorHSLA.prototype, {
  2014. type: 'hsla',
  2015. $isFashionHSLA: true,
  2016. h: null,
  2017. s: null,
  2018. l: null,
  2019. a: 1
  2020. });
  2021. module.exports = ColorHSLA;
  2022. }, { "../Base.js": 3, "./Color.js": 9, "./ColorRGBA.js": 11 }], 11: [function (require, module, exports) {
  2023. /*
  2024. * Copyright (c) 2012-2016. Sencha Inc.
  2025. */
  2026. "use strict";
  2027. var Fashion = require('../Base.js');
  2028. var Color = require('./Color.js');
  2029. function hex2(v) {
  2030. var s = v.toString(16);
  2031. if (s.length < 2) {
  2032. s = '0' + s;
  2033. }
  2034. return s;
  2035. }
  2036. var ColorRGBA = function (_Color2) {
  2037. _inherits(ColorRGBA, _Color2);
  2038. function ColorRGBA(r, g, b, a) {
  2039. _classCallCheck(this, ColorRGBA);
  2040. var _this6 = _possibleConstructorReturn(this, (ColorRGBA.__proto__ || Object.getPrototypeOf(ColorRGBA)).call(this));
  2041. _this6.r = Math.min(0xff, Math.max(0, r));
  2042. _this6.g = Math.min(0xff, Math.max(0, g));
  2043. _this6.b = Math.min(0xff, Math.max(0, b));
  2044. if (a !== undefined) {
  2045. _this6.a = Math.min(1.0, Math.max(0.0, a));
  2046. }
  2047. return _this6;
  2048. }
  2049. _createClass(ColorRGBA, [{
  2050. key: "doVisit",
  2051. value: function doVisit(visitor) {
  2052. visitor.rgba(this);
  2053. }
  2054. }, {
  2055. key: "copy",
  2056. value: function copy() {
  2057. return new ColorRGBA(this.r, this.g, this.b, this.a);
  2058. }
  2059. }, {
  2060. key: "getHSLA",
  2061. value: function getHSLA() {
  2062. return null;
  2063. }
  2064. }, {
  2065. key: "stringify",
  2066. value: function stringify() {
  2067. var me = this,
  2068. round = Math.round,
  2069. r = round(me.r),
  2070. g = round(me.g),
  2071. b = round(me.b),
  2072. a = me.a,
  2073. stringified = '';
  2074. // If there is no transparency we will use hex value
  2075. if (a === 1) {
  2076. stringified = '#' + hex2(r) + hex2(g) + hex2(b);
  2077. } else {
  2078. // Else use rgba
  2079. stringified = 'rgba(' + r + ', ' + g + ', ' + b + ', ' + a + ')';
  2080. }
  2081. stringified = stringified.toLowerCase();
  2082. return stringified;
  2083. }
  2084. }, {
  2085. key: "getCompressedValue",
  2086. value: function getCompressedValue(lowerVal) {
  2087. var name = ColorRGBA.stringifiedMap[lowerVal],
  2088. shortName = ColorRGBA.shortFormMap[lowerVal];
  2089. if (name) {
  2090. lowerVal = lowerVal.length > name.length ? name : lowerVal;
  2091. }
  2092. if (ColorRGBA.useShortValues && shortName) {
  2093. lowerVal = lowerVal.length > shortName.length ? shortName : lowerVal;
  2094. }
  2095. return lowerVal;
  2096. }
  2097. }, {
  2098. key: "toString",
  2099. value: function toString() {
  2100. if (!this.stringified) {
  2101. this.stringified = this.getCompressedValue(this.stringify());
  2102. }
  2103. return this.stringified;
  2104. }
  2105. }, {
  2106. key: "toIeHexStr",
  2107. value: function toIeHexStr() {
  2108. var me = this,
  2109. round = Math.round,
  2110. r = round(me.r),
  2111. g = round(me.g),
  2112. b = round(me.b),
  2113. a = round(0xff * me.a);
  2114. return '#' + hex2(a) + hex2(r) + hex2(g) + hex2(b);
  2115. }
  2116. }, {
  2117. key: "add",
  2118. value: function add(r, g, b, a) {
  2119. return new ColorRGBA(this.r + r, this.g + g, this.b + b, this.a * a);
  2120. }
  2121. }, {
  2122. key: "subtract",
  2123. value: function subtract(r, g, b) {
  2124. return new ColorRGBA(this.r - r, this.g - g, this.b - b, this.a);
  2125. }
  2126. }, {
  2127. key: "multiply",
  2128. value: function multiply(number) {
  2129. return new ColorRGBA(this.r * number, this.g * number, this.b * number, this.a);
  2130. }
  2131. }, {
  2132. key: "divide",
  2133. value: function divide(number) {
  2134. return new ColorRGBA(this.r / number, this.g / number, this.b / number, this.a);
  2135. }
  2136. }], [{
  2137. key: "fromHex",
  2138. value: function fromHex(value) {
  2139. if (value.charAt(0) == '#') {
  2140. value = value.substr(1);
  2141. }
  2142. var r, g, b;
  2143. if (value.length === 3) {
  2144. r = parseInt(value.charAt(0), 16);
  2145. g = parseInt(value.charAt(1), 16);
  2146. b = parseInt(value.charAt(2), 16);
  2147. r = (r << 4) + r;
  2148. g = (g << 4) + g;
  2149. b = (b << 4) + b;
  2150. } else {
  2151. r = parseInt(value.substring(0, 2), 16);
  2152. g = parseInt(value.substring(2, 4), 16);
  2153. b = parseInt(value.substring(4, 6), 16);
  2154. }
  2155. var result = new ColorRGBA(r, g, b);
  2156. if (ColorRGBA.preserveInputStrings) {
  2157. result.stringified = "#" + value;
  2158. }
  2159. return result;
  2160. }
  2161. }, {
  2162. key: "fromHSLA",
  2163. value: function fromHSLA(color) {
  2164. if (color.$isFashionRGBA) {
  2165. return color.clone();
  2166. }
  2167. var hsla = color,
  2168. h = hsla.h / 360,
  2169. s = hsla.s / 100,
  2170. l = hsla.l / 100,
  2171. a = hsla.a;
  2172. var m2 = l <= 0.5 ? l * (s + 1) : l + s - l * s,
  2173. m1 = l * 2 - m2;
  2174. function hue(h) {
  2175. if (h < 0) ++h;
  2176. if (h > 1) --h;
  2177. if (h * 6 < 1) return m1 + (m2 - m1) * h * 6;
  2178. if (h * 2 < 1) return m2;
  2179. if (h * 3 < 2) return m1 + (m2 - m1) * (2 / 3 - h) * 6;
  2180. return m1;
  2181. }
  2182. var r = Color.constrainChannel(hue(h + 1 / 3) * 0xff),
  2183. g = Color.constrainChannel(hue(h) * 0xff),
  2184. b = Color.constrainChannel(hue(h - 1 / 3) * 0xff);
  2185. return new ColorRGBA(r, g, b, a);
  2186. }
  2187. }]);
  2188. return ColorRGBA;
  2189. }(Color);
  2190. Fashion.apply(ColorRGBA, {
  2191. stringifiedMap: {
  2192. 'rgba(0, 0, 0, 0)': 'transparent'
  2193. },
  2194. shortFormMap: {},
  2195. useShortValues: true,
  2196. preserveInputStrings: false
  2197. });
  2198. Fashion.apply(ColorRGBA.prototype, {
  2199. type: 'rgba',
  2200. $isFashionRGBA: true,
  2201. r: null,
  2202. g: null,
  2203. b: null,
  2204. a: 1,
  2205. stringified: null,
  2206. "+.number": function number(right) {
  2207. var value = right.value,
  2208. unit = right.unit;
  2209. switch (unit) {
  2210. case '%':
  2211. return this.getHSLA().adjustLightness(value).getRGBA();
  2212. case 'deg':
  2213. return this.getHSLA().adjustHue(value).getRGBA();
  2214. default:
  2215. return this.add(value, value, value, 1);
  2216. }
  2217. },
  2218. "+.rgba": function rgba(right) {
  2219. return this.add(right.r, right.g, right.b, right.a);
  2220. },
  2221. "+.hsla": function hsla(right) {
  2222. return this.getHSLA().add(right.h, right.s, right.l);
  2223. },
  2224. "-.number": function number(right) {
  2225. var value = right.value,
  2226. unit = right.unit;
  2227. switch (unit) {
  2228. case '%':
  2229. return this.getHSLA().adjustLightness(-value).getRGBA();
  2230. case 'deg':
  2231. return this.getHSLA().adjustHue(-value).getRGBA();
  2232. default:
  2233. return this.subtract(value, value, value);
  2234. }
  2235. },
  2236. "-.rgba": function rgba(right) {
  2237. return this.subtract(right.r, right.g, right.b);
  2238. },
  2239. "-.hsla": function hsla(right) {
  2240. return this.getHSLA().subtract(right.h, right.s, right.l);
  2241. },
  2242. "*.number": function number(right) {
  2243. return this.multiply(right.value);
  2244. },
  2245. "/.number": function number(right) {
  2246. return this.divide(right.value);
  2247. },
  2248. "*.rgba": function rgba(right) {
  2249. return new ColorRGBA(this.r * right.r, this.g * right.g, this.b * right.b, this.a * right.a);
  2250. },
  2251. "/.rgba": function rgba(right) {
  2252. return new ColorRGBA(Math.floor(this.r / right.r), Math.floor(this.g / right.g), Math.floor(this.b / right.b), Math.floor(this.a / right.a));
  2253. }
  2254. });
  2255. module.exports = ColorRGBA;
  2256. (function (ColorRGBA, stringifiedMap, colorMap, shortMap) {
  2257. var colorChars = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'],
  2258. names = Object.keys(colorMap),
  2259. i;
  2260. names.sort();
  2261. for (i = 0; i < names.length; i++) {
  2262. var name = names[i],
  2263. val = colorMap[name],
  2264. color = new ColorRGBA(val[0], val[1], val[2], val[3]),
  2265. str = color.stringify();
  2266. stringifiedMap[str] = name;
  2267. }
  2268. colorChars.forEach(function (short1) {
  2269. var long1 = short1 + short1;
  2270. colorChars.forEach(function (short2) {
  2271. var long2 = short2 + short2;
  2272. colorChars.forEach(function (short3) {
  2273. var long3 = short3 + short3,
  2274. shortName = '#' + short1 + short2 + short3,
  2275. longName = '#' + long1 + long2 + long3;
  2276. if (shortMap[longName]) {
  2277. var curr = shortMap[longName];
  2278. shortName = curr.length > shortName.length ? shortName : curr;
  2279. //if(curr.indexOf("#") === 0) {
  2280. // short = (curr.length > short.length) ? short : curr;
  2281. //} else {
  2282. // short = curr;
  2283. //}
  2284. }
  2285. shortMap[longName] = shortName;
  2286. });
  2287. });
  2288. });
  2289. })(ColorRGBA, ColorRGBA.stringifiedMap, Color.map, ColorRGBA.shortFormMap);
  2290. }, { "../Base.js": 3, "./Color.js": 9 }], 12: [function (require, module, exports) {
  2291. /*
  2292. * Copyright (c) 2012-2016. Sencha Inc.
  2293. */
  2294. "use strict";
  2295. var Fashion = require('../Base.js');
  2296. var Type = require('./Type.js');
  2297. var Numeric = require('./Numeric.js');
  2298. var ColorStop = function (_Type3) {
  2299. _inherits(ColorStop, _Type3);
  2300. function ColorStop(color, stop) {
  2301. _classCallCheck(this, ColorStop);
  2302. var _this7 = _possibleConstructorReturn(this, (ColorStop.__proto__ || Object.getPrototypeOf(ColorStop)).call(this));
  2303. _this7.color = color;
  2304. _this7.stop = stop;
  2305. return _this7;
  2306. }
  2307. _createClass(ColorStop, [{
  2308. key: "doVisit",
  2309. value: function doVisit(visitor) {
  2310. visitor.colorstop(this);
  2311. }
  2312. }, {
  2313. key: "descend",
  2314. value: function descend(visitor) {
  2315. visitor.visit(this.color);
  2316. visitor.visit(this.stop);
  2317. }
  2318. }, {
  2319. key: "toString",
  2320. value: function toString() {
  2321. var string = this.color.toString(),
  2322. stop = this.stop;
  2323. if (stop) {
  2324. stop = stop.copy();
  2325. string += ' ';
  2326. if (!stop.unit) {
  2327. stop.value *= 100;
  2328. stop.unit = '%';
  2329. }
  2330. string += stop.toString();
  2331. }
  2332. return string;
  2333. }
  2334. }, {
  2335. key: "toOriginalWebkitString",
  2336. value: function toOriginalWebkitString() {
  2337. var stop = this.stop;
  2338. if (!stop) {
  2339. stop = new Numeric(0, '%');
  2340. }
  2341. stop = stop.copy();
  2342. if (!stop.unit) {
  2343. stop.value *= 100;
  2344. stop.unit = '%';
  2345. }
  2346. return 'color-stop(' + stop.toString() + ', ' + this.color.toString() + ')';
  2347. }
  2348. }, {
  2349. key: "copy",
  2350. value: function copy() {
  2351. return new ColorStop(this.color && this.color.clone(), this.stop && this.stop.clone());
  2352. }
  2353. }]);
  2354. return ColorStop;
  2355. }(Type);
  2356. Fashion.apply(ColorStop.prototype, {
  2357. type: 'colorstop',
  2358. $isFashionColorStop: true,
  2359. $canUnbox: false,
  2360. color: null,
  2361. stop: null
  2362. });
  2363. module.exports = ColorStop;
  2364. }, { "../Base.js": 3, "./Numeric.js": 18, "./Type.js": 24 }], 13: [function (require, module, exports) {
  2365. /*
  2366. * Copyright (c) 2012-2016. Sencha Inc.
  2367. */
  2368. "use strict";
  2369. var Fashion = require('../Base.js');
  2370. var Type = require('./Type.js');
  2371. var List = require('./List.js');
  2372. var FunctionCall = function (_Type4) {
  2373. _inherits(FunctionCall, _Type4);
  2374. function FunctionCall(name, args) {
  2375. _classCallCheck(this, FunctionCall);
  2376. var _this8 = _possibleConstructorReturn(this, (FunctionCall.__proto__ || Object.getPrototypeOf(FunctionCall)).call(this));
  2377. _this8.name = name;
  2378. if (Array.isArray(args)) {
  2379. args = new List(args);
  2380. }
  2381. _this8.args = args;
  2382. return _this8;
  2383. }
  2384. _createClass(FunctionCall, [{
  2385. key: "toString",
  2386. value: function toString() {
  2387. var args = this.args,
  2388. argsStr;
  2389. if (Array.isArray(args)) {
  2390. argsStr = args.join(', ');
  2391. } else {
  2392. argsStr = args.toString();
  2393. }
  2394. return this.name + "(" + argsStr + ')';
  2395. }
  2396. }, {
  2397. key: "doVisit",
  2398. value: function doVisit(visitor) {
  2399. visitor.functioncall(this);
  2400. }
  2401. }, {
  2402. key: "descend",
  2403. value: function descend(visitor) {
  2404. this.args && visitor.visit(this.args);
  2405. }
  2406. }, {
  2407. key: "copy",
  2408. value: function copy() {
  2409. return new FunctionCall(this.name, this.args && this.args.copy());
  2410. }
  2411. }]);
  2412. return FunctionCall;
  2413. }(Type);
  2414. Fashion.apply(FunctionCall.prototype, {
  2415. type: 'functioncall',
  2416. $isFashionFunctionCall: true,
  2417. $canUnbox: false,
  2418. name: null,
  2419. args: null
  2420. });
  2421. module.exports = FunctionCall;
  2422. }, { "../Base.js": 3, "./List.js": 15, "./Type.js": 24 }], 14: [function (require, module, exports) {
  2423. /*
  2424. * Copyright (c) 2012-2016. Sencha Inc.
  2425. */
  2426. "use strict";
  2427. var Fashion = require('../Base.js');
  2428. var Type = require('./Type.js');
  2429. var LinearGradient = function (_Type5) {
  2430. _inherits(LinearGradient, _Type5);
  2431. function LinearGradient(position, stops) {
  2432. _classCallCheck(this, LinearGradient);
  2433. var _this9 = _possibleConstructorReturn(this, (LinearGradient.__proto__ || Object.getPrototypeOf(LinearGradient)).call(this));
  2434. _this9.position = position;
  2435. _this9.stops = stops;
  2436. return _this9;
  2437. }
  2438. _createClass(LinearGradient, [{
  2439. key: "doVisit",
  2440. value: function doVisit(visitor) {
  2441. visitor.lineargradient(this);
  2442. }
  2443. }, {
  2444. key: "descend",
  2445. value: function descend(visitor) {
  2446. visitor.visit(this.position);
  2447. visitor.visit(this.stops);
  2448. }
  2449. }, {
  2450. key: "copy",
  2451. value: function copy() {
  2452. return new LinearGradient(this.position && this.position.clone(), this.stops && this.stops.clone());
  2453. }
  2454. }, {
  2455. key: "gradientPoints",
  2456. value: function gradientPoints(position) {}
  2457. }, {
  2458. key: "operate",
  2459. value: function operate(operation, right) {
  2460. switch (operation) {
  2461. case "!=":
  2462. if (right.type == 'literal' && (right.value == 'null' || right.value == 'none')) {
  2463. return true;
  2464. }
  2465. case "==":
  2466. if (right.type == 'literal' && (right.value == 'null' || right.value == 'none')) {
  2467. return false;
  2468. }
  2469. }
  2470. return _get(LinearGradient.prototype.__proto__ || Object.getPrototypeOf(LinearGradient.prototype), "operate", this).call(this, operation, right);
  2471. }
  2472. }, {
  2473. key: "supports",
  2474. value: function supports(prefix) {
  2475. return !!this.vendorPrefixes[prefix.toLowerCase()];
  2476. }
  2477. }, {
  2478. key: "toString",
  2479. value: function toString() {
  2480. var string = 'linear-gradient(';
  2481. if (this.position) {
  2482. string += this.position + ', ';
  2483. }
  2484. return string + this.stops + ')';
  2485. }
  2486. }, {
  2487. key: "toOriginalWebkitString",
  2488. value: function toOriginalWebkitString() {
  2489. // args = []
  2490. // args << grad_point(position_or_angle || Sass::Script::String.new("top"))
  2491. // args << linear_end_position(position_or_angle, color_stops)
  2492. // args << grad_color_stops(color_stops)
  2493. // args.each{|a| a.options = options}
  2494. // Sass::Script::String.new("-webkit-gradient(linear, #{args.join(', ')})")
  2495. //this.gradientPoints(this.position);
  2496. var args = [],
  2497. stops = this.stops.items,
  2498. ln = stops.length,
  2499. i;
  2500. args.push('top');
  2501. args.push('bottom');
  2502. for (i = 0; i < ln; i++) {
  2503. args.push(stops[i].toOriginalWebkitString());
  2504. }
  2505. return '-webkit-gradient(linear, ' + args.join(', ') + ')';
  2506. }
  2507. }, {
  2508. key: "toPrefixedString",
  2509. value: function toPrefixedString(prefix) {
  2510. if (prefix === 'owg') {
  2511. return this.toOriginalWebkitString();
  2512. }
  2513. return prefix + this.toString();
  2514. }
  2515. }]);
  2516. return LinearGradient;
  2517. }(Type);
  2518. Fashion.apply(LinearGradient.prototype, {
  2519. type: 'lineargradient',
  2520. $isFashionLinearGradient: true,
  2521. $canUnbox: false,
  2522. position: null,
  2523. stops: null,
  2524. vendorPrefixes: {
  2525. webkit: true,
  2526. moz: true,
  2527. svg: true,
  2528. pie: true,
  2529. css2: true,
  2530. o: true,
  2531. owg: true
  2532. }
  2533. });
  2534. module.exports = LinearGradient;
  2535. }, { "../Base.js": 3, "./Type.js": 24 }], 15: [function (require, module, exports) {
  2536. /*
  2537. * Copyright (c) 2012-2016. Sencha Inc.
  2538. */
  2539. "use strict";
  2540. var Fashion = require('../Base.js');
  2541. var Type = require('./Type.js');
  2542. var List = function (_Type6) {
  2543. _inherits(List, _Type6);
  2544. function List(items, separator) {
  2545. _classCallCheck(this, List);
  2546. var _this10 = _possibleConstructorReturn(this, (List.__proto__ || Object.getPrototypeOf(List)).call(this));
  2547. _this10.items = items || [];
  2548. _this10.separator = typeof separator === 'undefined' ? ' ' : separator;
  2549. return _this10;
  2550. }
  2551. _createClass(List, [{
  2552. key: "doVisit",
  2553. value: function doVisit(visitor) {
  2554. visitor.list(this);
  2555. }
  2556. }, {
  2557. key: "descend",
  2558. value: function descend(visitor) {
  2559. for (var i = 0; i < this.items.length; i++) {
  2560. visitor.visit(this.items[i]);
  2561. }
  2562. }
  2563. }, {
  2564. key: "copy",
  2565. value: function copy() {
  2566. var items = this.items,
  2567. len = items.length,
  2568. newItems = [];
  2569. for (var i = 0; i < len; i++) {
  2570. newItems.push(items[i].clone());
  2571. }
  2572. return new List(newItems, this.separator);
  2573. }
  2574. }, {
  2575. key: "clone",
  2576. value: function clone(match, replace) {
  2577. if (replace && this.matches(match)) {
  2578. return replace.clone();
  2579. }
  2580. var items = this.items,
  2581. len = items.length,
  2582. newItems = [];
  2583. for (var i = 0; i < len; i++) {
  2584. var item = items[i];
  2585. if (item) {
  2586. newItems.push(item.clone(match, replace));
  2587. } else {
  2588. newItems.push(item);
  2589. }
  2590. }
  2591. var copy = new List(newItems, this.separator);
  2592. copy.$referenceName = this.$referenceName;
  2593. copy.$referenceBase = this.$referenceBase;
  2594. copy.$previousReference = this.$previousReference;
  2595. return copy;
  2596. }
  2597. }, {
  2598. key: "add",
  2599. value: function add(item) {
  2600. return this.items.push(item);
  2601. }
  2602. }, {
  2603. key: "get",
  2604. value: function get(index) {
  2605. return this.items[index - 1] || null;
  2606. }
  2607. }, {
  2608. key: "operate",
  2609. value: function operate(operation, right) {
  2610. switch (operation) {
  2611. case '!=':
  2612. if (right.$isFashionLiteral) {
  2613. if (right.value === 'null' || right.value === 'none') {
  2614. return true;
  2615. }
  2616. }
  2617. break;
  2618. case '==':
  2619. if (right.$isFashionLiteral) {
  2620. if (right.value === 'null' || right.value === 'none') {
  2621. return false;
  2622. }
  2623. }
  2624. break;
  2625. }
  2626. return _get(List.prototype.__proto__ || Object.getPrototypeOf(List.prototype), "operate", this).call(this, operation, right);
  2627. }
  2628. }, {
  2629. key: "supports",
  2630. value: function supports(prefix) {
  2631. for (var i = 0; i < this.items.length; i++) {
  2632. var item = this.items[i];
  2633. if (item.supports(prefix)) {
  2634. return true;
  2635. }
  2636. }
  2637. return false;
  2638. }
  2639. }, {
  2640. key: "toBoolean",
  2641. value: function toBoolean() {
  2642. return !!this.items.length;
  2643. }
  2644. }, {
  2645. key: "getItems",
  2646. value: function getItems() {
  2647. return this.items;
  2648. // return Fashion.filter(this.items, (item) => {
  2649. // var unboxed = Type.unbox(item);
  2650. // return unboxed !== null && unboxed !== undefined;
  2651. // });
  2652. }
  2653. }, {
  2654. key: "toString",
  2655. value: function toString() {
  2656. return this.items.join(this.separator);
  2657. }
  2658. }, {
  2659. key: "unquote",
  2660. value: function unquote() {
  2661. var items = [],
  2662. item;
  2663. for (var i = 0; i < this.items.length; i++) {
  2664. item = this.items[i];
  2665. if (item) {
  2666. items.push(item.unquote());
  2667. } else {
  2668. items.push(item);
  2669. }
  2670. }
  2671. return new List(items, this.separator);
  2672. }
  2673. }, {
  2674. key: "toPrefixedString",
  2675. value: function toPrefixedString(prefix) {
  2676. var items = [];
  2677. for (var i = 0; i < this.items.length; i++) {
  2678. var item = this.items[i];
  2679. if (item) {
  2680. items.push(item.toPrefixedString(prefix));
  2681. }
  2682. }
  2683. return items.join(this.separator);
  2684. }
  2685. //----------------------------------------------------------------------
  2686. // Operations
  2687. }, {
  2688. key: '==.list',
  2689. value: function list(right) {
  2690. var equals = this.separator == right.separator && this.items.length == right.items.length;
  2691. for (var i = 0; equals && i < this.items.length; ++i) {
  2692. equals = this.items[i].operate("==", right.items[i]);
  2693. }
  2694. return equals;
  2695. }
  2696. }]);
  2697. return List;
  2698. }(Type);
  2699. Fashion.apply(List.prototype, {
  2700. type: 'list',
  2701. $isFashionList: true,
  2702. items: null,
  2703. separator: null
  2704. });
  2705. module.exports = List;
  2706. }, { "../Base.js": 3, "./Type.js": 24 }], 16: [function (require, module, exports) {
  2707. /*
  2708. * Copyright (c) 2012-2016. Sencha Inc.
  2709. */
  2710. "use strict";
  2711. var Fashion = require('../Base.js');
  2712. var Type = require('./Type.js');
  2713. var Numeric = require('./Numeric.js');
  2714. var Literal = function (_Type7) {
  2715. _inherits(Literal, _Type7);
  2716. function Literal(value) {
  2717. _classCallCheck(this, Literal);
  2718. var _this11 = _possibleConstructorReturn(this, (Literal.__proto__ || Object.getPrototypeOf(Literal)).call(this));
  2719. _this11.value = value;
  2720. return _this11;
  2721. }
  2722. _createClass(Literal, [{
  2723. key: "doVisit",
  2724. value: function doVisit(visitor) {
  2725. visitor.literal(this);
  2726. }
  2727. }, {
  2728. key: "_getHash",
  2729. value: function _getHash() {
  2730. return this.value;
  2731. }
  2732. }, {
  2733. key: "toString",
  2734. value: function toString() {
  2735. return this.value || '';
  2736. }
  2737. }, {
  2738. key: "toBoolean",
  2739. value: function toBoolean() {
  2740. return this.value.length;
  2741. }
  2742. }, {
  2743. key: "copy",
  2744. value: function copy() {
  2745. return new Literal(this.value);
  2746. }
  2747. }, {
  2748. key: '+',
  2749. value: function _(right) {
  2750. return new Literal(this.value + right.getHash());
  2751. }
  2752. }, {
  2753. key: '+.number',
  2754. value: function number(right) {
  2755. if (this.value === null) {
  2756. return right;
  2757. }
  2758. return new Literal(this.value + right.toString());
  2759. }
  2760. }, {
  2761. key: '/',
  2762. value: function _(right) {
  2763. return new Literal(this.value + '/' + right.getHash());
  2764. }
  2765. }, {
  2766. key: '-',
  2767. value: function _(right) {
  2768. return new Literal(this.value + '-' + right.getHash());
  2769. }
  2770. }, {
  2771. key: '%',
  2772. value: function _(right) {
  2773. return new Literal(this.value + '%' + right.getHash());
  2774. }
  2775. }, {
  2776. key: "normalizeStart",
  2777. value: function normalizeStart(startVal) {
  2778. var start = Type.unbox(startVal) || 0;
  2779. if (start > 0) {
  2780. start = start - 1;
  2781. }
  2782. if (start < 0) {
  2783. start = this.value.length + start;
  2784. }
  2785. if (start < 0) {
  2786. start = 0;
  2787. }
  2788. return start;
  2789. }
  2790. }, {
  2791. key: "normalizeEnd",
  2792. value: function normalizeEnd(endVal) {
  2793. var end = Type.unbox(endVal) || -1;
  2794. if (end > 0) {
  2795. end = end - 1;
  2796. }
  2797. if (end < 0) {
  2798. end = this.value.length + end;
  2799. }
  2800. if (end < 0) {
  2801. end = 0;
  2802. }
  2803. if (end > 0) {
  2804. end = end + 1;
  2805. }
  2806. return end;
  2807. }
  2808. }, {
  2809. key: "slice",
  2810. value: function slice(start, end) {
  2811. start = this.normalizeStart(start);
  2812. end = this.normalizeEnd(end);
  2813. return new Literal(this.value.slice(start, end));
  2814. }
  2815. }, {
  2816. key: "toUpperCase",
  2817. value: function toUpperCase() {
  2818. return new Literal(this.value.toUpperCase());
  2819. }
  2820. }, {
  2821. key: "toLowerCase",
  2822. value: function toLowerCase() {
  2823. return new Literal(this.value.toLowerCase());
  2824. }
  2825. }, {
  2826. key: "indexOf",
  2827. value: function indexOf(str) {
  2828. var idx = this.value.indexOf(str.value);
  2829. if (idx === -1) {
  2830. return undefined;
  2831. }
  2832. return new Numeric(idx + 1);
  2833. }
  2834. }, {
  2835. key: "insert",
  2836. value: function insert(str, startVal) {
  2837. var start = Type.unbox(startVal) || 0,
  2838. inserted = this.value;
  2839. if (start > 0) {
  2840. start = Math.min(start - 1, inserted.length);
  2841. }
  2842. if (start < 0) {
  2843. start = inserted.length + start + 1;
  2844. start = Math.max(start, 0);
  2845. }
  2846. inserted = inserted.substring(0, start) + str.value + inserted.substring(start);
  2847. return new Literal(Literal.deEscape(inserted));
  2848. }
  2849. }, {
  2850. key: "toDisplayString",
  2851. value: function toDisplayString() {
  2852. var val = this.value;
  2853. if (val === null) {
  2854. return "null";
  2855. }
  2856. return this.toString();
  2857. }
  2858. }], [{
  2859. key: "tryCoerce",
  2860. value: function tryCoerce(obj) {
  2861. if (obj.$isFashionNumber) {
  2862. return undefined;
  2863. }
  2864. if (obj.$isFashionString) {
  2865. return new Literal(obj.value);
  2866. }
  2867. if (obj.$isFashionLiteral) {
  2868. return obj;
  2869. }
  2870. return new Literal(obj.getHash());
  2871. }
  2872. }, {
  2873. key: "deEscape",
  2874. value: function deEscape(str) {
  2875. var buff = '',
  2876. i,
  2877. ch;
  2878. for (i = 0; i < str.length; i++) {
  2879. ch = str.charAt(i);
  2880. if (ch === '\\') {
  2881. i++;
  2882. ch = str.charAt(i);
  2883. }
  2884. buff += ch;
  2885. }
  2886. return buff;
  2887. }
  2888. }]);
  2889. return Literal;
  2890. }(Type);
  2891. Fashion.apply(Literal.prototype, {
  2892. type: 'literal',
  2893. $isFashionLiteral: true,
  2894. value: null
  2895. });
  2896. var FashionNull = function (_Literal) {
  2897. _inherits(FashionNull, _Literal);
  2898. function FashionNull(value) {
  2899. _classCallCheck(this, FashionNull);
  2900. return _possibleConstructorReturn(this, (FashionNull.__proto__ || Object.getPrototypeOf(FashionNull)).call(this, value || null));
  2901. }
  2902. _createClass(FashionNull, [{
  2903. key: "copy",
  2904. value: function copy() {
  2905. return new FashionNull(this.value);
  2906. }
  2907. }]);
  2908. return FashionNull;
  2909. }(Literal);
  2910. Fashion.apply(FashionNull.prototype, {
  2911. $isFashionNull: true,
  2912. $constant: true
  2913. });
  2914. FashionNull.prototype.$isFashionNull = true;
  2915. Literal.Null = new FashionNull(null);
  2916. Literal.None = new Literal('none');
  2917. module.exports = Literal;
  2918. }, { "../Base.js": 3, "./Numeric.js": 18, "./Type.js": 24 }], 17: [function (require, module, exports) {
  2919. /*
  2920. * Copyright (c) 2012-2016. Sencha Inc.
  2921. */
  2922. "use strict";
  2923. var Fashion = require('../Base.js');
  2924. var List = require('./List.js');
  2925. var Type = require('./Type.js');
  2926. var Literal = require('./Literal.js'),
  2927. Null = Literal.Null;
  2928. var Numeric = require('./Numeric.js');
  2929. var Map = function (_List) {
  2930. _inherits(Map, _List);
  2931. function Map(pairs) {
  2932. _classCallCheck(this, Map);
  2933. var _this13 = _possibleConstructorReturn(this, (Map.__proto__ || Object.getPrototypeOf(Map)).call(this, pairs));
  2934. _this13.map = {};
  2935. if (pairs) {
  2936. for (var i = 0; i < pairs.length - 1; i += 2) {
  2937. var key = _this13.toKey(pairs[i]),
  2938. value = pairs[i + 1];
  2939. _this13.map[key] = i + 1;
  2940. }
  2941. }
  2942. return _this13;
  2943. }
  2944. _createClass(Map, [{
  2945. key: "doVisit",
  2946. value: function doVisit(visitor) {
  2947. visitor.map(this);
  2948. }
  2949. }, {
  2950. key: "descend",
  2951. value: function descend(visitor) {
  2952. for (var i = 0; i < this.items.length; i++) {
  2953. visitor.visit(this.items[i]);
  2954. }
  2955. }
  2956. }, {
  2957. key: "get",
  2958. value: function get(key) {
  2959. if (key instanceof Numeric) {
  2960. key = Type.unbox(key);
  2961. }
  2962. if (typeof key === 'number') {
  2963. return new List([this.items[2 * key - 2], this.items[2 * key - 1]], ' ');
  2964. }
  2965. key = this.toKey(key);
  2966. return this.items[this.map[key]] || Null;
  2967. }
  2968. }, {
  2969. key: "getItems",
  2970. value: function getItems() {
  2971. var values = [];
  2972. for (var i = 0; i < this.items.length - 1; i += 2) {
  2973. var key = this.toKey(this.items[i]);
  2974. values.push(this.map[key]);
  2975. }
  2976. return values;
  2977. }
  2978. }, {
  2979. key: "put",
  2980. value: function put(key, value) {
  2981. var keyStr = this.toKey(key);
  2982. if (!this.map.hasOwnProperty(keyStr)) {
  2983. this.items.push(key, value);
  2984. this.map[keyStr] = this.items.length - 1;
  2985. } else {
  2986. this.items[this.map[keyStr]] = value;
  2987. }
  2988. }
  2989. }, {
  2990. key: "toString",
  2991. value: function toString() {
  2992. var str = '',
  2993. count = 0;
  2994. for (var i = 0; i < this.items.length - 1; i += 2) {
  2995. var key = this.toKey(this.items[i]),
  2996. value = this.map[key];
  2997. if (value) {
  2998. if (count > 0) {
  2999. str += ', ';
  3000. }
  3001. str += key + ": " + value.toString();
  3002. count++;
  3003. }
  3004. }
  3005. return str;
  3006. }
  3007. }, {
  3008. key: "toKey",
  3009. value: function toKey(key) {
  3010. return this.unquoteKey(key).toString();
  3011. }
  3012. }, {
  3013. key: "unquoteKey",
  3014. value: function unquoteKey(string) {
  3015. if (string.$isFashionType) {
  3016. return string.unquote();
  3017. }
  3018. return string;
  3019. }
  3020. }, {
  3021. key: "remove",
  3022. value: function remove(key) {
  3023. key = this.toKey(key);
  3024. if (this.map[key]) {
  3025. var idx = this.map[key];
  3026. delete this.items[idx - 1];
  3027. delete this.items[idx];
  3028. delete this.map[key];
  3029. }
  3030. }
  3031. }, {
  3032. key: "getKeys",
  3033. value: function getKeys() {
  3034. var keys = [];
  3035. for (var i = 0; i < this.items.length; i += 2) {
  3036. var k = this.items[i];
  3037. if (k) {
  3038. keys.push(k);
  3039. }
  3040. }
  3041. return keys;
  3042. }
  3043. }, {
  3044. key: "getValues",
  3045. value: function getValues() {
  3046. var values = [];
  3047. for (var i = 1; i < this.items.length; i += 2) {
  3048. var v = this.items[i];
  3049. if (v) {
  3050. values.push(v);
  3051. }
  3052. }
  3053. return values;
  3054. }
  3055. }, {
  3056. key: "hasKey",
  3057. value: function hasKey(key) {
  3058. key = this.toKey(key);
  3059. if (this.map.hasOwnProperty(key)) {
  3060. return true;
  3061. }
  3062. return false;
  3063. }
  3064. }]);
  3065. return Map;
  3066. }(List);
  3067. Fashion.apply(Map.prototype, {
  3068. type: "map",
  3069. $isFashionMap: true,
  3070. $canUnbox: false,
  3071. map: null
  3072. });
  3073. module.exports = Map;
  3074. }, { "../Base.js": 3, "./List.js": 15, "./Literal.js": 16, "./Numeric.js": 18, "./Type.js": 24 }], 18: [function (require, module, exports) {
  3075. /*
  3076. * Copyright (c) 2012-2016. Sencha Inc.
  3077. */
  3078. "use strict";
  3079. var Fashion = require('../Base.js');
  3080. var Type = require('./Type.js');
  3081. var Bool = require('./Bool.js');
  3082. var Literal = require('./Literal.js');
  3083. var Numeric = function (_Type8) {
  3084. _inherits(Numeric, _Type8);
  3085. function Numeric(value, unit, numeratorUnits, denominatorUnits) {
  3086. _classCallCheck(this, Numeric);
  3087. var _this14 = _possibleConstructorReturn(this, (Numeric.__proto__ || Object.getPrototypeOf(Numeric)).call(this));
  3088. _this14.value = value;
  3089. _this14.unit = unit;
  3090. if (unit && !numeratorUnits) {
  3091. _this14.numeratorUnits = [unit];
  3092. } else {
  3093. _this14.numeratorUnits = numeratorUnits || [];
  3094. }
  3095. _this14.denominatorUnits = denominatorUnits || [];
  3096. return _this14;
  3097. }
  3098. _createClass(Numeric, [{
  3099. key: "doVisit",
  3100. value: function doVisit(visitor) {
  3101. visitor.number(this);
  3102. }
  3103. }, {
  3104. key: "unitless",
  3105. value: function unitless() {
  3106. if (this.numeratorUnits && this.numeratorUnits.length) {
  3107. return false;
  3108. }
  3109. if (this.denominatorUnits && this.denominatorUnits.length) {
  3110. return false;
  3111. }
  3112. return true;
  3113. }
  3114. }, {
  3115. key: "getUnitStr",
  3116. value: function getUnitStr() {
  3117. this.normalizeUnits();
  3118. var unitStr = this.numeratorUnits.join('*');
  3119. if (this.denominatorUnits.length) {
  3120. unitStr += '/' + this.denominatorUnits.join('*');
  3121. }
  3122. return unitStr;
  3123. }
  3124. }, {
  3125. key: "_getHash",
  3126. value: function _getHash() {
  3127. return this.value;
  3128. }
  3129. }, {
  3130. key: "stringify",
  3131. value: function stringify() {
  3132. this.normalizeUnits();
  3133. var value = this.value,
  3134. valStr;
  3135. // prevent 0.020000000000000004 type numbers in output
  3136. valStr = Math.round(value * 100000) / 100000 + '';
  3137. //unitStr = valStr === '0' ? '' : this.getUnitStr();
  3138. return valStr + this.getUnitStr();
  3139. }
  3140. }, {
  3141. key: "toString",
  3142. value: function toString() {
  3143. return this.stringify();
  3144. }
  3145. }, {
  3146. key: "toBoolean",
  3147. value: function toBoolean() {
  3148. return this.unit ? true : !!this.value;
  3149. }
  3150. }, {
  3151. key: "copy",
  3152. value: function copy() {
  3153. return new Numeric(this.value, this.unit);
  3154. }
  3155. }, {
  3156. key: '-.literal',
  3157. value: function literal(right) {
  3158. if (this.value === 0 && this.unitless()) {
  3159. return new Literal(['-', right.toString()].join(''));
  3160. }
  3161. return new Literal([this.toString(), '-', right.toString()].join(''));
  3162. }
  3163. }, {
  3164. key: '-.string',
  3165. value: function string(right) {
  3166. if (this.value === 0 && this.unitless()) {
  3167. return new Literal(['-', right.toString()].join(''));
  3168. }
  3169. return new Literal([this.toString(), '-', right.toString()].join(''));
  3170. }
  3171. }, {
  3172. key: '-.number',
  3173. value: function number(right) {
  3174. var value = right.value;
  3175. if (right.unit == '%' && right.unit !== this.unit) {
  3176. value = this.value * (right.value / 100);
  3177. }
  3178. return new Numeric(this.value - value, this.unit || right.unit);
  3179. }
  3180. }, {
  3181. key: '+.literal',
  3182. value: function literal(right) {
  3183. if (right.$isFashionString) {
  3184. return new Literal([this.toString(), right.value].join(''));
  3185. }
  3186. return new Literal([this.toString(), right.toString()].join(''));
  3187. }
  3188. }, {
  3189. key: '+.number',
  3190. value: function number(right) {
  3191. var value = right.value;
  3192. if (right.unit == '%' && right.unit !== this.unit) {
  3193. value = this.value * (right.value / 100);
  3194. }
  3195. return new Numeric(this.value + value, this.unit || right.unit);
  3196. }
  3197. }, {
  3198. key: '/',
  3199. value: function _(right) {
  3200. return new Numeric(this.value / right.value, this.unit == right.unit ? null : this.unit || right.unit);
  3201. }
  3202. }, {
  3203. key: '*',
  3204. value: function _(right) {
  3205. return new Numeric(this.value * right.value, this.unit || right.unit);
  3206. }
  3207. }, {
  3208. key: '%',
  3209. value: function _(right) {
  3210. return new Numeric(this.value % right.value, this.unit || right.unit);
  3211. }
  3212. }, {
  3213. key: '**',
  3214. value: function _(right) {
  3215. return new Numeric(Math.pow(this.value, right.value), this.unit || right.unit);
  3216. }
  3217. }, {
  3218. key: "operate",
  3219. value: function operate(operation, right) {
  3220. var unit = this.unit || right.unit,
  3221. normalized;
  3222. if (right.$isFashionRGBA || right.$isFashionHSLA) {
  3223. return new Literal(this + operation + right);
  3224. }
  3225. if (right.$isFashionNumber) {
  3226. return this.numericOperate(operation, right);
  3227. } else if (right.$isFashionLiteral) {
  3228. normalized = this.tryCoerce(right);
  3229. if (normalized) {
  3230. return this.performOperation(operation, normalized);
  3231. }
  3232. }
  3233. return _get(Numeric.prototype.__proto__ || Object.getPrototypeOf(Numeric.prototype), "operate", this).call(this, operation, right);
  3234. }
  3235. }, {
  3236. key: "tryNormalize",
  3237. value: function tryNormalize(other) {
  3238. var value = other.value,
  3239. unit = other.unit;
  3240. if (other.$isFashionNumber) {
  3241. switch (this.unit) {
  3242. case 'mm':
  3243. switch (unit) {
  3244. case 'in':
  3245. return new Numeric(value * 25.4, 'mm');
  3246. case 'cm':
  3247. return new Numeric(value * 2.54, 'mm');
  3248. }
  3249. break;
  3250. case 'cm':
  3251. switch (unit) {
  3252. case 'in':
  3253. return new Numeric(value * 2.54, 'cm');
  3254. case 'mm':
  3255. return new Numeric(value / 10, 'cm');
  3256. }
  3257. break;
  3258. case 'in':
  3259. switch (unit) {
  3260. case 'mm':
  3261. return new Numeric(value / 25.4, 'in');
  3262. case 'cm':
  3263. return new Numeric(value / 2.54, 'in');
  3264. }
  3265. break;
  3266. case 'ms':
  3267. switch (unit) {
  3268. case 's':
  3269. return new Numeric(value * 1000, 'ms');
  3270. }
  3271. break;
  3272. case 's':
  3273. switch (unit) {
  3274. case 'ms':
  3275. return new Numeric(value / 1000, 's');
  3276. }
  3277. break;
  3278. case 'Hz':
  3279. switch (unit) {
  3280. case 'kHz':
  3281. return new Numeric(value * 1000, 'Hz');
  3282. }
  3283. break;
  3284. case 'kHz':
  3285. switch (unit) {
  3286. case 'Hz':
  3287. return new Numeric(value / 1000, 'kHz');
  3288. }
  3289. break;
  3290. case '%':
  3291. switch (unit) {
  3292. default:
  3293. return new Numeric(value);
  3294. }
  3295. default:
  3296. break;
  3297. }
  3298. }
  3299. return undefined;
  3300. }
  3301. }, {
  3302. key: "normalize",
  3303. value: function normalize(other) {
  3304. var norm = this.tryNormalize(other);
  3305. if (norm === undefined) {
  3306. raise('Could not normalize ' + this + ' with ' + other);
  3307. }
  3308. return norm;
  3309. }
  3310. }, {
  3311. key: "comparable",
  3312. value: function comparable(other) {
  3313. var unit1 = this.unit,
  3314. unit2 = other.unit;
  3315. if (!other.$isFashionNumber) {
  3316. return false;
  3317. }
  3318. return unit1 === unit2 || unit1 === 'mm' && (unit2 === 'in' || unit2 === 'cm') || unit1 === 'cm' && (unit2 === 'in' || unit2 === 'mm') || unit1 === 'in' && (unit2 === 'mm' || unit2 === 'cm') || unit1 === 'ms' && unit2 === 's' || unit1 === 's' && unit2 === 'ms' || unit1 === 'Hz' && unit2 === 'kHz' || unit1 === 'kHz' && unit2 === 'Hz';
  3319. }
  3320. //---------------------------------------------------------------
  3321. }, {
  3322. key: "normalizeUnits",
  3323. value: function normalizeUnits() {
  3324. if (this.normalized) {
  3325. return;
  3326. }
  3327. this.normalized = true;
  3328. if (!this.unitless()) {
  3329. var clean = this.removeCommonUnits(this.numeratorUnits, this.denominatorUnits),
  3330. converted;
  3331. //var num = [],
  3332. // den = [];
  3333. //
  3334. //for(var d = 0; d < clean.den.length; d++) {
  3335. // var dn = clean.den[d];
  3336. // if(this.convertable(dn)) {
  3337. // converted = false;
  3338. // for (var n = 0; n < clean.num.length; n++) {
  3339. // var nm = clean.num[n];
  3340. // if(this.convertable(nm)) {
  3341. // this.value = this.value / this.conversionFactor(dn, nm);
  3342. // converted = true;
  3343. // } else {
  3344. // num.push(nm);
  3345. // }
  3346. // }
  3347. // if(!converted) {
  3348. // den.push(dn);
  3349. // }
  3350. // }
  3351. //}
  3352. //
  3353. //this.numeratorUnits = num;
  3354. //this.denominatorUnits = den;
  3355. clean.num = Fashion.filter(clean.num, function (val) {
  3356. return !!val;
  3357. });
  3358. clean.den = Fashion.filter(clean.den, function (val) {
  3359. return !!val;
  3360. });
  3361. this.numeratorUnits = clean.num;
  3362. this.denominatorUnits = clean.den;
  3363. }
  3364. }
  3365. }, {
  3366. key: "numericOperate",
  3367. value: function numericOperate(operation, right) {
  3368. this.normalizeUnits();
  3369. right.normalizeUnits();
  3370. var me = this,
  3371. other = right,
  3372. ops = Numeric.OPERATIONS,
  3373. moreOps = Numeric.NON_COERCE_OPERATIONS,
  3374. op = ops[operation],
  3375. result;
  3376. if (op) {
  3377. try {
  3378. if (me.unitless()) {
  3379. me = me.coerceUnits(other.numeratorUnits, other.denominatorUnits);
  3380. } else {
  3381. other = other.coerceUnits(me.numeratorUnits, me.denominatorUnits);
  3382. }
  3383. } catch (e) {
  3384. if (operation == '==') {
  3385. return Bool.False;
  3386. }
  3387. if (operation == '!=') {
  3388. return Bool.True;
  3389. }
  3390. throw e;
  3391. }
  3392. } else {
  3393. op = moreOps[operation];
  3394. }
  3395. if (op) {
  3396. result = op(me.value, other.value);
  3397. }
  3398. if (typeof result === 'number') {
  3399. var units = this.computeUnits(me, other, operation);
  3400. return new Numeric(result, units.num.length ? units.num[0] : null, units.num, units.den);
  3401. }
  3402. return new Bool(result);
  3403. }
  3404. }, {
  3405. key: "computeUnits",
  3406. value: function computeUnits(left, right, op) {
  3407. switch (op) {
  3408. case '*':
  3409. return {
  3410. num: left.numeratorUnits.slice().concat(right.numeratorUnits),
  3411. den: left.denominatorUnits.slice().concat(right.denominatorUnits)
  3412. };
  3413. case '/':
  3414. return {
  3415. num: left.numeratorUnits.slice().concat(right.denominatorUnits),
  3416. den: left.denominatorUnits.slice().concat(right.numeratorUnits)
  3417. };
  3418. default:
  3419. return {
  3420. num: left.numeratorUnits,
  3421. den: left.denominatorUnits
  3422. };
  3423. }
  3424. }
  3425. }, {
  3426. key: "coerceUnits",
  3427. value: function coerceUnits(units, denominatorUnits) {
  3428. var value = this.value;
  3429. if (!this.unitless()) {
  3430. value = value * this.coercionFactor(this.numeratorUnits, units) / this.coercionFactor(this.denominatorUnits, denominatorUnits);
  3431. }
  3432. return new Numeric(value, units && units[0], units, denominatorUnits);
  3433. }
  3434. }, {
  3435. key: "coercionFactor",
  3436. value: function coercionFactor(units, otherUnits) {
  3437. var res = this.removeCommonUnits(units, otherUnits),
  3438. fromUnits = res.num,
  3439. toUnits = res.den;
  3440. if (fromUnits.length !== toUnits.length || !this.convertable(fromUnits || toUnits)) {
  3441. Fashion.raise('Incompatible units: ' + fromUnits.join('*') + ' and ' + toUnits.join('*'));
  3442. }
  3443. for (var i = 0; i < fromUnits.length; i++) {
  3444. var fromUnit = fromUnits[i];
  3445. for (var j = 0; j < toUnits.length; j++) {
  3446. var toUnit = toUnits[j],
  3447. factor = this.conversionFactor(fromUnit, toUnit);
  3448. if (factor !== null) {
  3449. return factor;
  3450. }
  3451. }
  3452. }
  3453. return 1;
  3454. }
  3455. }, {
  3456. key: "conversionFactor",
  3457. value: function conversionFactor(fromUnit, toUnit) {
  3458. var cUnits = Numeric.CONVERTABLE_UNITS,
  3459. cTable = Numeric.CONVERSION_TABLE,
  3460. factor = null;
  3461. if (cUnits[fromUnit]) {
  3462. if (cUnits[toUnit]) {
  3463. factor = cTable[cUnits[fromUnit]][cUnits[toUnit]];
  3464. }
  3465. }
  3466. if (factor === null && cUnits[toUnit]) {
  3467. if (cUnits[fromUnit]) {
  3468. factor = 1.0 / cTable[cUnits[toUnit]][cUnits[fromUnit]];
  3469. }
  3470. }
  3471. return factor;
  3472. }
  3473. }, {
  3474. key: "convertable",
  3475. value: function convertable(units) {
  3476. if (units && !Array.isArray(units)) {
  3477. units = [units];
  3478. }
  3479. if (units && units.length) {
  3480. var convertableUnits = Numeric.CONVERTABLE_UNITS;
  3481. for (var i = 0; i < units.length; i++) {
  3482. if (convertableUnits[units[i]] === undefined) {
  3483. return false;
  3484. }
  3485. }
  3486. }
  3487. return true;
  3488. }
  3489. }, {
  3490. key: "removeCommonUnits",
  3491. value: function removeCommonUnits(numUnits, denUnits) {
  3492. var map = {},
  3493. num = [],
  3494. den = [],
  3495. i,
  3496. unit,
  3497. unit;
  3498. for (i = 0; i < numUnits.length; i++) {
  3499. unit = numUnits[i];
  3500. map[unit] = (map[unit] || 0) + 1;
  3501. }
  3502. for (i = 0; i < denUnits.length; i++) {
  3503. unit = denUnits[i];
  3504. map[unit] = (map[unit] || 0) - 1;
  3505. }
  3506. for (i = 0; i < numUnits.length; i++) {
  3507. unit = numUnits[i];
  3508. if (map[unit] > 0) {
  3509. num.push(unit);
  3510. map[unit]--;
  3511. }
  3512. }
  3513. for (i = 0; i < denUnits.length; i++) {
  3514. unit = denUnits[i];
  3515. if (map[unit] < 0) {
  3516. den.push(unit);
  3517. map[unit]++;
  3518. }
  3519. }
  3520. return {
  3521. num: num,
  3522. den: den
  3523. };
  3524. }
  3525. }], [{
  3526. key: "tryGetNumber",
  3527. value: function tryGetNumber(value) {
  3528. if (/^\d*$/.test(value)) {
  3529. value = parseFloat(value);
  3530. }
  3531. if (!isNaN(value)) {
  3532. return new Numeric(value);
  3533. }
  3534. return undefined;
  3535. }
  3536. }, {
  3537. key: "tryCoerce",
  3538. value: function tryCoerce(obj) {
  3539. if (obj.$isFashionNumber) {
  3540. return obj;
  3541. }
  3542. if (obj.$isFashionLiteral) {
  3543. return this.tryGetNumber(obj.value);
  3544. }
  3545. return undefined;
  3546. }
  3547. }]);
  3548. return Numeric;
  3549. }(Type);
  3550. Fashion.apply(Numeric, {
  3551. OPERATIONS: {
  3552. '!=': function _(l, r) {
  3553. return l != r;
  3554. },
  3555. '+': function _(l, r) {
  3556. return l + r;
  3557. },
  3558. '-': function _(l, r) {
  3559. return l - r;
  3560. },
  3561. '<=': function _(l, r) {
  3562. return l <= r;
  3563. },
  3564. '<': function _(l, r) {
  3565. return l < r;
  3566. },
  3567. '>': function _(l, r) {
  3568. return l > r;
  3569. },
  3570. '>=': function _(l, r) {
  3571. return l >= r;
  3572. },
  3573. '==': function _(l, r) {
  3574. return l == r;
  3575. },
  3576. '%': function _(l, r) {
  3577. return Math.abs(l % r);
  3578. }
  3579. },
  3580. NON_COERCE_OPERATIONS: {
  3581. '*': function _(l, r) {
  3582. return l * r;
  3583. },
  3584. '**': function _(l, r) {
  3585. return Math.pow(l, r);
  3586. },
  3587. '/': function _(l, r) {
  3588. return l / r;
  3589. }
  3590. },
  3591. CONVERTABLE_UNITS: {
  3592. 'in': 0,
  3593. 'cm': 1,
  3594. 'pc': 2,
  3595. 'mm': 3,
  3596. 'pt': 4,
  3597. 'px': 5
  3598. },
  3599. CONVERSION_TABLE: [[1, 2.54, 6, 25.4, 72, 96], // in
  3600. [null, 1, 2.36220473, 10, 28.3464567, 37.795276], // cm
  3601. [null, null, 1, 4.23333333, 12, 16], // pc
  3602. [null, null, null, 1, 2.83464567, 3.7795276], // mm
  3603. [null, null, null, null, 1, 1.3333333], // pt
  3604. [null, null, null, null, null, 1] // px
  3605. ]
  3606. });
  3607. Fashion.apply(Numeric.prototype, {
  3608. type: 'number',
  3609. $isFashionNumber: true,
  3610. value: undefined,
  3611. unit: undefined,
  3612. numeratorUnits: undefined,
  3613. denominatorUnits: undefined,
  3614. normalized: false
  3615. });
  3616. module.exports = Numeric;
  3617. }, { "../Base.js": 3, "./Bool.js": 8, "./Literal.js": 16, "./Type.js": 24 }], 19: [function (require, module, exports) {
  3618. /*
  3619. * Copyright (c) 2012-2016. Sencha Inc.
  3620. */
  3621. "use strict";
  3622. var Fashion = require('../Base.js');
  3623. var Type = require('./Type.js');
  3624. var ParentheticalExpression = function (_Type9) {
  3625. _inherits(ParentheticalExpression, _Type9);
  3626. function ParentheticalExpression(value) {
  3627. _classCallCheck(this, ParentheticalExpression);
  3628. var _this15 = _possibleConstructorReturn(this, (ParentheticalExpression.__proto__ || Object.getPrototypeOf(ParentheticalExpression)).call(this));
  3629. _this15.value = value;
  3630. return _this15;
  3631. }
  3632. _createClass(ParentheticalExpression, [{
  3633. key: "toString",
  3634. value: function toString() {
  3635. return '(' + (this.value && this.value.toString()) + ')';
  3636. }
  3637. }, {
  3638. key: "doVisit",
  3639. value: function doVisit(visitor) {
  3640. visitor.parenthetical(this);
  3641. }
  3642. }]);
  3643. return ParentheticalExpression;
  3644. }(Type);
  3645. Fashion.apply(ParentheticalExpression.prototype, {
  3646. value: null,
  3647. type: 'parenthetical'
  3648. });
  3649. module.exports = ParentheticalExpression;
  3650. }, { "../Base.js": 3, "./Type.js": 24 }], 20: [function (require, module, exports) {
  3651. /*
  3652. * Copyright (c) 2012-2016. Sencha Inc.
  3653. */
  3654. "use strict";
  3655. var Fashion = require('../Base.js');
  3656. var Type = require('./Type.js');
  3657. var RadialGradient = function (_Type10) {
  3658. _inherits(RadialGradient, _Type10);
  3659. function RadialGradient(position, shape, stops) {
  3660. _classCallCheck(this, RadialGradient);
  3661. var _this16 = _possibleConstructorReturn(this, (RadialGradient.__proto__ || Object.getPrototypeOf(RadialGradient)).call(this));
  3662. _this16.position = position;
  3663. _this16.stops = stops;
  3664. _this16.shape = shape;
  3665. return _this16;
  3666. }
  3667. _createClass(RadialGradient, [{
  3668. key: "doVisit",
  3669. value: function doVisit(visitor) {
  3670. visitor.radialgradient(this);
  3671. }
  3672. }, {
  3673. key: "descend",
  3674. value: function descend(visitor) {
  3675. visitor.visit(this.position);
  3676. visitor.visit(this.stops);
  3677. visitor.visit(this.shape);
  3678. }
  3679. }, {
  3680. key: "copy",
  3681. value: function copy() {
  3682. return new RadialGradient(this.position, this.shape, this.stops);
  3683. }
  3684. }, {
  3685. key: "toString",
  3686. value: function toString() {
  3687. var string = 'radial-gradient(';
  3688. if (this.position) {
  3689. string += this.position + ', ';
  3690. }
  3691. if (this.shape) {
  3692. string += this.shape + ', ';
  3693. }
  3694. return string + this.stops + ')';
  3695. }
  3696. }, {
  3697. key: "toOriginalWebkitString",
  3698. value: function toOriginalWebkitString() {
  3699. var args = [],
  3700. stops = this.stops.items,
  3701. ln = stops.length,
  3702. i;
  3703. args.push('center 0%');
  3704. args.push('center 100%');
  3705. for (i = 0; i < ln; i++) {
  3706. args.push(stops[i].toOriginalWebkitString());
  3707. }
  3708. return '-webkit-gradient(radial, ' + args.join(', ') + ')';
  3709. }
  3710. }, {
  3711. key: "supports",
  3712. value: function supports(prefix) {
  3713. return ['owg', 'webkit'].indexOf(prefix.toLowerCase()) !== -1;
  3714. }
  3715. }, {
  3716. key: "toPrefixedString",
  3717. value: function toPrefixedString(prefix) {
  3718. if (prefix === 'owg') {
  3719. return this.toOriginalWebkitString();
  3720. }
  3721. return prefix + this.toString();
  3722. }
  3723. }, {
  3724. key: "gradientPoints",
  3725. value: function gradientPoints(position) {
  3726. //position = (position.type === 'list') ? position.clone() : new Fashion.List([position]);
  3727. //console.log('gradientpoints', position);
  3728. }
  3729. }]);
  3730. return RadialGradient;
  3731. }(Type);
  3732. Fashion.apply(RadialGradient.prototype, {
  3733. type: 'radialgradient',
  3734. $isFashionRadialGradient: true,
  3735. $canUnbox: false,
  3736. position: null,
  3737. stops: null,
  3738. shape: null
  3739. });
  3740. module.exports = RadialGradient;
  3741. }, { "../Base.js": 3, "./Type.js": 24 }], 21: [function (require, module, exports) {
  3742. "use strict";
  3743. var Fashion = require('../Base.js');
  3744. var TypeVisitor = require('./TypeVisitor.js');
  3745. var Output = require('../Output.js');
  3746. var SourceBuilder = function (_TypeVisitor) {
  3747. _inherits(SourceBuilder, _TypeVisitor);
  3748. function SourceBuilder(cfg) {
  3749. _classCallCheck(this, SourceBuilder);
  3750. var _this17 = _possibleConstructorReturn(this, (SourceBuilder.__proto__ || Object.getPrototypeOf(SourceBuilder)).call(this, cfg));
  3751. _this17.nullFound = false;
  3752. return _this17;
  3753. }
  3754. _createClass(SourceBuilder, [{
  3755. key: "list",
  3756. value: function list(obj) {
  3757. var output = this.output,
  3758. items = obj.items,
  3759. len = output.output.length,
  3760. sep = obj.separator,
  3761. sepLen = sep && sep.length,
  3762. hasSpace = sep && sep.indexOf(' ') > -1,
  3763. prev = output.output,
  3764. delta;
  3765. for (var i = 0; i < items.length; i++) {
  3766. if (items[i] && !items[i].$isFashionNull) {
  3767. this.visit(items[i]);
  3768. delta = output.output.length - len;
  3769. if (!delta && sepLen && i > 0) {
  3770. output.output = prev;
  3771. }
  3772. prev = output.output;
  3773. if (i < items.length - 1) {
  3774. if (sepLen) {
  3775. output.add(sep);
  3776. if (!hasSpace) {
  3777. output.space();
  3778. }
  3779. }
  3780. }
  3781. len = output.output.length;
  3782. } else {
  3783. this.nullFound = true;
  3784. }
  3785. }
  3786. }
  3787. }, {
  3788. key: "map",
  3789. value: function map(obj) {
  3790. var output = this.output,
  3791. items = obj.items,
  3792. key,
  3793. value;
  3794. if (this.currDeclaration) {
  3795. Fashion.raise('(' + obj.toString() + ") isn't a valid CSS value.");
  3796. }
  3797. for (var i = 0; i < items.length - 1; i += 2) {
  3798. key = items[i];
  3799. value = items[i + 1];
  3800. if (key && value) {
  3801. if (i > 0) {
  3802. output.add(',');
  3803. output.space();
  3804. }
  3805. this.visit(key);
  3806. output.add(': ');
  3807. //output.space();
  3808. this.visit(value);
  3809. }
  3810. }
  3811. }
  3812. }, {
  3813. key: "literal",
  3814. value: function literal(obj) {
  3815. obj.value && this.output.add(obj.value);
  3816. }
  3817. }, {
  3818. key: "string",
  3819. value: function string(obj) {
  3820. var output = this.output;
  3821. output.add(obj.quoteChar);
  3822. output.add(obj.value);
  3823. output.add(obj.quoteChar);
  3824. }
  3825. }, {
  3826. key: "functioncall",
  3827. value: function functioncall(obj) {
  3828. var output = this.output;
  3829. output.add(obj.name);
  3830. output.add('(');
  3831. this.visit(obj.args);
  3832. output.add(')');
  3833. }
  3834. }, {
  3835. key: "parenthetical",
  3836. value: function parenthetical(obj) {
  3837. this.output.add('(');
  3838. this.visit(obj.value);
  3839. this.output.add(')');
  3840. }
  3841. }, {
  3842. key: "number",
  3843. value: function number(obj) {
  3844. var val = obj.stringify();
  3845. if (val.indexOf('.') === '.' && !this.output.isCompressed) {
  3846. val = "0" + val;
  3847. }
  3848. this.output.add(val);
  3849. }
  3850. }, {
  3851. key: "bool",
  3852. value: function bool(obj) {
  3853. this.output.add(obj.value ? 'true' : 'false');
  3854. }
  3855. }, {
  3856. key: "hsla",
  3857. value: function hsla(obj) {
  3858. this.output.add(obj.toString());
  3859. }
  3860. }, {
  3861. key: "rgba",
  3862. value: function rgba(obj) {
  3863. this.output.add(obj.toString());
  3864. }
  3865. }, {
  3866. key: "colorstop",
  3867. value: function colorstop(obj) {
  3868. var output = this.output,
  3869. stop = obj.stop;
  3870. this.visit(obj.color);
  3871. if (stop) {
  3872. stop = stop.clone();
  3873. output.add(' ');
  3874. if (!stop.unit) {
  3875. stop.value *= 100;
  3876. stop.unit = '%';
  3877. }
  3878. this.visit(stop);
  3879. }
  3880. }
  3881. }, {
  3882. key: "lineargradient",
  3883. value: function lineargradient(obj) {
  3884. var output = this.output;
  3885. output.add("linear-gradient(");
  3886. if (obj.position) {
  3887. this.visit(obj.position);
  3888. output.add(',');
  3889. output.space();
  3890. }
  3891. this.visit(obj.stops);
  3892. output.add(')');
  3893. }
  3894. }, {
  3895. key: "radialgradient",
  3896. value: function radialgradient(obj) {
  3897. var output = this.output;
  3898. output.add("radial-gradient(");
  3899. if (obj.position) {
  3900. this.visit(obj.position);
  3901. output.add(',');
  3902. output.space();
  3903. }
  3904. if (obj.shape) {
  3905. this.visit(obj.shape);
  3906. output.add(',');
  3907. output.space();
  3908. }
  3909. this.visit(obj.stops);
  3910. output.add(')');
  3911. }
  3912. }, {
  3913. key: "toSource",
  3914. value: function toSource(obj, output) {
  3915. this.output = output || new Output();
  3916. this.visit(obj);
  3917. return this.output.get();
  3918. }
  3919. }], [{
  3920. key: "toSource",
  3921. value: function toSource(obj, output) {
  3922. var sb = new SourceBuilder();
  3923. return sb.toSource(obj, output);
  3924. }
  3925. }]);
  3926. return SourceBuilder;
  3927. }(TypeVisitor);
  3928. Fashion.apply(SourceBuilder.prototype, {
  3929. output: null
  3930. });
  3931. module.exports = SourceBuilder;
  3932. }, { "../Base.js": 3, "../Output.js": 4, "./TypeVisitor.js": 25 }], 22: [function (require, module, exports) {
  3933. "use strict";
  3934. var Fashion = require('../Base.js');
  3935. var Type = require('./Type.js');
  3936. var Text = require('./Text.js');
  3937. var Numeric = require('./Numeric.js');
  3938. var Bool = require('./Bool.js'),
  3939. True = Bool.True,
  3940. False = Bool.False;
  3941. var Literal = require('./Literal.js'),
  3942. Null = Literal.Null;
  3943. module.exports = {
  3944. unboxType: function unboxType(expression) {
  3945. var val = expression;
  3946. if (val && val.$isFashionType && val.$canUnbox) {
  3947. val = val.value;
  3948. if (expression.$isFashionString || expression.$isFashionLiteral) {
  3949. if (val === 'none' || val === 'null') {
  3950. val = null;
  3951. }
  3952. } else if (expression.$isFashionList) {
  3953. val = expression.items;
  3954. }
  3955. }
  3956. return val;
  3957. },
  3958. boxType: function boxType(expression) {
  3959. if (expression && expression.$isFashionType) {
  3960. return expression;
  3961. }
  3962. if (expression == null) {
  3963. // null || undefined
  3964. return Null;
  3965. }
  3966. if (expression === true) {
  3967. return True;
  3968. }
  3969. if (expression === false) {
  3970. return False;
  3971. }
  3972. var typeOf = typeof expression === "undefined" ? "undefined" : _typeof(expression);
  3973. switch (typeOf) {
  3974. case 'string':
  3975. return new Text(expression);
  3976. case 'number':
  3977. return new Numeric(expression);
  3978. default:
  3979. break;
  3980. }
  3981. return expression;
  3982. }
  3983. };
  3984. Fashion.apply(Type, {
  3985. box: module.exports.boxType,
  3986. unbox: module.exports.unboxType
  3987. });
  3988. }, { "../Base.js": 3, "./Bool.js": 8, "./Literal.js": 16, "./Numeric.js": 18, "./Text.js": 23, "./Type.js": 24 }], 23: [function (require, module, exports) {
  3989. /*
  3990. * Copyright (c) 2012-2016. Sencha Inc.
  3991. */
  3992. "use strict";
  3993. var Fashion = require('../Base.js');
  3994. var Literal = require('./Literal.js');
  3995. var Text = function (_Literal2) {
  3996. _inherits(Text, _Literal2);
  3997. function Text(value, quoteChar) {
  3998. _classCallCheck(this, Text);
  3999. var _this18 = _possibleConstructorReturn(this, (Text.__proto__ || Object.getPrototypeOf(Text)).call(this, value));
  4000. if (quoteChar !== undefined) {
  4001. if (Text.preferDoubleQuotes && quoteChar === '') {
  4002. _this18.quoteChar = '';
  4003. } else {
  4004. _this18.quoteChar = quoteChar;
  4005. }
  4006. }
  4007. return _this18;
  4008. }
  4009. _createClass(Text, [{
  4010. key: "doVisit",
  4011. value: function doVisit(visitor) {
  4012. visitor.string(this);
  4013. }
  4014. }, {
  4015. key: "toString",
  4016. value: function toString() {
  4017. return this.quoteChar + this.value + this.quoteChar;
  4018. }
  4019. }, {
  4020. key: "unquote",
  4021. value: function unquote() {
  4022. return new Literal(this.value);
  4023. }
  4024. }, {
  4025. key: "copy",
  4026. value: function copy() {
  4027. return new Text(this.value, this.quoteChar);
  4028. }
  4029. }, {
  4030. key: "slice",
  4031. value: function slice(start, end) {
  4032. return new Text(_get(Text.prototype.__proto__ || Object.getPrototypeOf(Text.prototype), "slice", this).call(this, start, end).value, this.quoteChar);
  4033. }
  4034. }, {
  4035. key: "toUpperCase",
  4036. value: function toUpperCase() {
  4037. return new Text(this.value.toUpperCase(), this.quoteChar);
  4038. }
  4039. }, {
  4040. key: "toLowerCase",
  4041. value: function toLowerCase() {
  4042. return new Text(this.value.toLowerCase(), this.quoteChar);
  4043. }
  4044. }, {
  4045. key: "insert",
  4046. value: function insert(str, startVal) {
  4047. return new Text(_get(Text.prototype.__proto__ || Object.getPrototypeOf(Text.prototype), "insert", this).call(this, str, startVal).value, this.quoteChar);
  4048. }
  4049. }], [{
  4050. key: "tryCoerce",
  4051. value: function tryCoerce(obj) {
  4052. if (obj.$isFashionNumber) {
  4053. return undefined;
  4054. }
  4055. if (obj.$isFashionLiteral) {
  4056. return new Text(obj.value);
  4057. }
  4058. return new Text(obj.getHash());
  4059. }
  4060. }]);
  4061. return Text;
  4062. }(Literal);
  4063. Text.preferDoubleQuotes = false;
  4064. Fashion.apply(Text.prototype, {
  4065. type: 'string',
  4066. $isFashionString: true,
  4067. value: null,
  4068. quoteChar: '"',
  4069. '+': function _(right) {
  4070. return new Text(this.value + right.getHash());
  4071. },
  4072. '+.number': function number(right) {
  4073. return new Text(this.value + right.toString());
  4074. },
  4075. '/': function _(right) {
  4076. return new Text(this.value + '/' + right.getHash());
  4077. }
  4078. });
  4079. module.exports = Text;
  4080. }, { "../Base.js": 3, "./Literal.js": 16 }], 24: [function (require, module, exports) {
  4081. /*
  4082. * Copyright (c) 2012-2016. Sencha Inc.
  4083. */
  4084. "use strict";
  4085. var Fashion = require('../Base.js');
  4086. var Type = function () {
  4087. function Type() {
  4088. _classCallCheck(this, Type);
  4089. }
  4090. _createClass(Type, [{
  4091. key: "coerce",
  4092. value: function coerce(obj) {
  4093. var converted = this.tryCoerce(obj);
  4094. return converted || obj;
  4095. }
  4096. }, {
  4097. key: "_getHash",
  4098. value: function _getHash() {
  4099. if (this.visitTarget) {
  4100. return this.visitTarget.toString();
  4101. }
  4102. return this.toString();
  4103. }
  4104. }, {
  4105. key: "getHash",
  4106. value: function getHash() {
  4107. if (this._hash == null) {
  4108. this._hash = this._getHash();
  4109. }
  4110. return this._hash;
  4111. }
  4112. }, {
  4113. key: "tryCoerce",
  4114. value: function tryCoerce(obj) {
  4115. var me = this;
  4116. if (me.constructor === obj.constructor) {
  4117. return obj;
  4118. }
  4119. if (me.constructor.tryCoerce) {
  4120. return me.constructor.tryCoerce(obj);
  4121. }
  4122. return undefined;
  4123. }
  4124. }, {
  4125. key: "supports",
  4126. value: function supports(prefix) {
  4127. return false;
  4128. }
  4129. }, {
  4130. key: "operate",
  4131. value: function operate(operation, right) {
  4132. return this.performOperation(operation, this.coerce(right));
  4133. }
  4134. }, {
  4135. key: "performOperation",
  4136. value: function performOperation(operation, right) {
  4137. // check for <op>.<type> name for class-specific impl,
  4138. // eg, ==.color or +.list
  4139. var method = this[operation + "." + right.type] || this[operation];
  4140. if (!method) {
  4141. Fashion.raise("Failed to find method for operation " + operation + " on type " + right.type + " with value " + right + ".");
  4142. }
  4143. var res = method.call(this, right);
  4144. if (!res || !res.$isFashionType) {
  4145. res = Type.box(res);
  4146. }
  4147. return res;
  4148. }
  4149. }, {
  4150. key: '==',
  4151. value: function _(right) {
  4152. return this.getHash() === right.getHash();
  4153. }
  4154. }, {
  4155. key: '!=',
  4156. value: function _(right) {
  4157. return this.getHash() !== right.getHash();
  4158. }
  4159. }, {
  4160. key: '>=',
  4161. value: function _(right) {
  4162. return this.getHash() >= right.getHash();
  4163. }
  4164. }, {
  4165. key: '<=',
  4166. value: function _(right) {
  4167. return this.getHash() <= right.getHash();
  4168. }
  4169. }, {
  4170. key: '>',
  4171. value: function _(right) {
  4172. return this.getHash() > right.getHash();
  4173. }
  4174. }, {
  4175. key: '<',
  4176. value: function _(right) {
  4177. return this.getHash() < right.getHash();
  4178. }
  4179. }, {
  4180. key: '+',
  4181. value: function _(right) {
  4182. return this.getHash() + right.getHash();
  4183. }
  4184. }, {
  4185. key: "copy",
  4186. value: function copy() {
  4187. return this;
  4188. }
  4189. }, {
  4190. key: "matches",
  4191. value: function matches(match) {
  4192. if (match && match == this.toString()) {
  4193. return true;
  4194. }
  4195. return false;
  4196. }
  4197. }, {
  4198. key: "clone",
  4199. value: function clone(match, replace) {
  4200. if (replace && this.matches(match)) {
  4201. return replace.copy();
  4202. }
  4203. var copy = this.copy();
  4204. copy.ast = this.ast;
  4205. copy.$referenceName = this.$referenceName;
  4206. copy.$referenceBase = this.$referenceBase;
  4207. copy.$previousReference = this.$previousReference;
  4208. return copy;
  4209. }
  4210. }, {
  4211. key: "unquote",
  4212. value: function unquote() {
  4213. return this;
  4214. }
  4215. }, {
  4216. key: "toPrefixedString",
  4217. value: function toPrefixedString(prefix) {
  4218. return this.toString();
  4219. }
  4220. }, {
  4221. key: "doVisit",
  4222. value: function doVisit(visitor) {}
  4223. }, {
  4224. key: "descend",
  4225. value: function descend(visitoir) {}
  4226. /**
  4227. * A mechanism that enables searching upwards in the type tree for comments with a
  4228. * particular control tag. The search begins locally first on the specified node,
  4229. * and continues upwards until either an enable or disable tag is specified, or the
  4230. * the root of the tree is reached with no tags specified.
  4231. *
  4232. * By testing for both positive and negative matches locally, features can be enabled
  4233. * or disabled at specific points, potentially overriding state set at a more
  4234. * generic scope. Ex:
  4235. *
  4236. * //# fashion -ingline
  4237. * @font-face {
  4238. * src: url(foo.eot);
  4239. * src: url(foo.svg);
  4240. * //# fashion +inline
  4241. * src: url(foo.ttf);
  4242. * }
  4243. *
  4244. * @param tag The tag to search for.
  4245. * @param prefix An optional prefix, such as 'fashion warn'. Defaults to 'fashion'
  4246. * @param enable A regex indicating a match for the enable state (+tag).
  4247. * @param disable A regex indicating a match for the disable state (-tag)
  4248. * @returns {any} true for enable | false for disable | null for unspecified
  4249. */
  4250. }, {
  4251. key: "hasTag",
  4252. value: function hasTag(tag, prefix, enable, disable) {
  4253. prefix = prefix || "fashion";
  4254. enable = enable || new RegExp('^\\s*//#\\s*' + prefix + '\\s*\\+?' + tag + "\\s*$");
  4255. disable = disable || new RegExp('^\\s*//#\\s*' + prefix + '\\s*\\-' + tag + '\\s*$');
  4256. var docs = this.docs;
  4257. if (docs && docs.length) {
  4258. for (var d = 0; d < this.docs.length; d++) {
  4259. var doc = docs[d];
  4260. if (enable.test(doc)) {
  4261. return true;
  4262. }
  4263. if (disable.test(doc)) {
  4264. return false;
  4265. }
  4266. }
  4267. }
  4268. if (this.parentNode) {
  4269. return this.parentNode.hasTag(tag, prefix, enable, disable);
  4270. }
  4271. return null;
  4272. }
  4273. }, {
  4274. key: "toDisplayString",
  4275. value: function toDisplayString() {
  4276. return '[' + this.constructor.name + ' : ' + this.toString() + ']';
  4277. }
  4278. }]);
  4279. return Type;
  4280. }();
  4281. Fashion.apply(Type.prototype, {
  4282. visitTarget: undefined,
  4283. $isFashionType: true,
  4284. $canUnbox: true,
  4285. $isFashionLiteral: false,
  4286. $isFashionNumber: false,
  4287. $isFashionString: false,
  4288. $isFashionBool: false,
  4289. $constant: false,
  4290. /**
  4291. * if this value is a global variable, this field will store the global
  4292. * variable name by which this value is referenced.
  4293. */
  4294. $referenceName: undefined,
  4295. $referenceBase: undefined,
  4296. $previousReference: undefined,
  4297. value: undefined,
  4298. unit: undefined,
  4299. parentNode: undefined,
  4300. docs: undefined,
  4301. ast: undefined
  4302. });
  4303. module.exports = Type;
  4304. }, { "../Base.js": 3 }], 25: [function (require, module, exports) {
  4305. "use strict";
  4306. var Fashion = require('../Base.js');
  4307. var TypeVisitor = function () {
  4308. function TypeVisitor(cfg) {
  4309. _classCallCheck(this, TypeVisitor);
  4310. if (cfg) {
  4311. Fashion.apply(this, cfg);
  4312. }
  4313. }
  4314. _createClass(TypeVisitor, [{
  4315. key: "literal",
  4316. value: function literal(obj) {
  4317. obj.descend(this);
  4318. }
  4319. }, {
  4320. key: "bool",
  4321. value: function bool(obj) {
  4322. obj.descend(this);
  4323. }
  4324. }, {
  4325. key: "string",
  4326. value: function string(obj) {
  4327. obj.descend(this);
  4328. }
  4329. }, {
  4330. key: "number",
  4331. value: function number(obj) {
  4332. obj.descend(this);
  4333. }
  4334. }, {
  4335. key: "map",
  4336. value: function map(obj) {
  4337. obj.descend(this);
  4338. }
  4339. }, {
  4340. key: "functioncall",
  4341. value: function functioncall(obj) {
  4342. obj.descend(this);
  4343. }
  4344. }, {
  4345. key: "parenthetical",
  4346. value: function parenthetical(obj) {
  4347. obj.descend(this);
  4348. }
  4349. }, {
  4350. key: "list",
  4351. value: function list(obj) {
  4352. obj.descend(this);
  4353. }
  4354. }, {
  4355. key: "hsla",
  4356. value: function hsla(obj) {
  4357. obj.descend(this);
  4358. }
  4359. }, {
  4360. key: "rgba",
  4361. value: function rgba(obj) {
  4362. obj.descend(this);
  4363. }
  4364. }, {
  4365. key: "colorstop",
  4366. value: function colorstop(obj) {
  4367. obj.descend(this);
  4368. }
  4369. }, {
  4370. key: "lineargradient",
  4371. value: function lineargradient(obj) {
  4372. obj.descend(this);
  4373. }
  4374. }, {
  4375. key: "radialgradient",
  4376. value: function radialgradient(obj) {
  4377. obj.descend(this);
  4378. }
  4379. }, {
  4380. key: "visitItem",
  4381. value: function visitItem(obj) {
  4382. obj.doVisit(this);
  4383. }
  4384. }, {
  4385. key: "visit",
  4386. value: function visit(obj) {
  4387. while (obj && obj.visitTarget !== undefined) {
  4388. obj = obj.visitTarget;
  4389. }
  4390. if (obj) {
  4391. if (Array.isArray(obj)) {
  4392. for (var i = 0; i < obj.length; i++) {
  4393. this.visit(obj[i]);
  4394. }
  4395. } else {
  4396. this.visitItem(obj);
  4397. }
  4398. }
  4399. }
  4400. /**
  4401. * this is an extension point for allowing overrides of the entry visit method
  4402. * when called duing the post-processing mechanism in CSS.ts
  4403. * @param obj
  4404. */
  4405. }, {
  4406. key: "execute",
  4407. value: function execute(obj, context) {
  4408. this.visit(obj);
  4409. }
  4410. }]);
  4411. return TypeVisitor;
  4412. }();
  4413. TypeVisitor.prototype.context = null;
  4414. module.exports = TypeVisitor;
  4415. }, { "../Base.js": 3 }], 26: [function (require, module, exports) {
  4416. "use strict";
  4417. var Bool = require('./Bool.js');
  4418. var Literal = require('./Literal.js');
  4419. var Types = {
  4420. Bool: Bool,
  4421. Literal: Literal,
  4422. Text: require('./Text.js'),
  4423. Numeric: require('./Numeric.js'),
  4424. Color: require('./Color.js'),
  4425. ColorRGBA: require('./ColorRGBA.js'),
  4426. ColorHSLA: require('./ColorHSLA.js'),
  4427. ColorStop: require('./ColorStop.js'),
  4428. LinearGradient: require('./LinearGradient.js'),
  4429. RadialGradient: require('./RadialGradient.js'),
  4430. List: require('./List.js'),
  4431. Map: require('./Map.js'),
  4432. ParentheticalExpression: require('./ParentheticalExpression.js'),
  4433. FunctionCall: require('./FunctionCall.js'),
  4434. Null: Literal.Null,
  4435. None: Literal.None,
  4436. True: Bool.True,
  4437. False: Bool.False
  4438. };
  4439. module.exports = Types;
  4440. }, { "./Bool.js": 8, "./Color.js": 9, "./ColorHSLA.js": 10, "./ColorRGBA.js": 11, "./ColorStop.js": 12, "./FunctionCall.js": 13, "./LinearGradient.js": 14, "./List.js": 15, "./Literal.js": 16, "./Map.js": 17, "./Numeric.js": 18, "./ParentheticalExpression.js": 19, "./RadialGradient.js": 20, "./Text.js": 23 }] }, {}, [1])(1);
  4441. });
  4442. (function(Fashion){
  4443. var __udf = undefined,
  4444. Types = Fashion.Types,
  4445. __strings = {
  4446. _: "$color",
  4447. $: "$color_name",
  4448. A: "$colorLookup",
  4449. a: "$color_variant"
  4450. },
  4451. __names = Fashion.css.buildNames(__strings),
  4452. __jsNames = Fashion.css.buildJsNames(__strings);
  4453. var Bool = Types.Bool,
  4454. __Bool = Bool,
  4455. Literal = Types.Literal,
  4456. __Literal = Literal,
  4457. Text = Types.Text,
  4458. __Text = Text,
  4459. Numeric = Types.Numeric,
  4460. __Numeric = Numeric,
  4461. Color = Types.Color,
  4462. __Color = Color,
  4463. ColorRGBA = Types.ColorRGBA,
  4464. __ColorRGBA = ColorRGBA,
  4465. ColorHSLA = Types.ColorHSLA,
  4466. __ColorHSLA = ColorHSLA,
  4467. ColorStop = Types.ColorStop,
  4468. __ColorStop = ColorStop,
  4469. LinearGradient = Types.LinearGradient,
  4470. __LinearGradient = LinearGradient,
  4471. RadialGradient = Types.RadialGradient,
  4472. __RadialGradient = RadialGradient,
  4473. List = Types.List,
  4474. __List = List,
  4475. Map = Types.Map,
  4476. __Map = Map,
  4477. ParentheticalExpression = Types.ParentheticalExpression,
  4478. __ParentheticalExpression = ParentheticalExpression,
  4479. FunctionCall = Types.FunctionCall,
  4480. __FunctionCall = FunctionCall,
  4481. Null = Types.Null,
  4482. __Null = Null,
  4483. None = Types.None,
  4484. __None = None,
  4485. True = Types.True,
  4486. __True = True,
  4487. False = Types.False,
  4488. __False = False,
  4489. Ruleset = Types.Ruleset,
  4490. __Ruleset = Ruleset,
  4491. Declaration = Types.Declaration,
  4492. __Declaration = Declaration,
  4493. SelectorPart = Types.SelectorPart,
  4494. __SelectorPart = SelectorPart,
  4495. CompoundSelector = Types.CompoundSelector,
  4496. __CompoundSelector = CompoundSelector,
  4497. MultiPartSelector = Types.MultiPartSelector,
  4498. __MultiPartSelector = MultiPartSelector,
  4499. SelectorList = Types.SelectorList,
  4500. __SelectorList = SelectorList,
  4501. SelectorProperty = Types.SelectorProperty,
  4502. __SelectorProperty = SelectorProperty;
  4503. Fashion.css.register(function(__rt) {
  4504. __rt.register({
  4505. map_get: function (map, key) {
  4506. return map.get(key);
  4507. },
  4508. lighten: function (color, amount) {
  4509. if (color == null || color.$isFashionNull) {
  4510. return Literal.Null;
  4511. }
  4512. if (color.type !== 'hsla' && color.type !== 'rgba') {
  4513. Fashion.raise(color + ' is not a color for \'lighten\'');
  4514. }
  4515. if (amount.type !== 'number') {
  4516. Fashion.raise(amount + ' is not a number for \'lighten\'');
  4517. }
  4518. if (amount.value !== Color.constrainPercentage(amount.value)) {
  4519. Fashion.raise('Amount ' + amount + ' must be between 0% and 100% for \'lighten\'');
  4520. }
  4521. return Color.adjust(color, 'lightness', amount);
  4522. },
  4523. darken: function (color, amount) {
  4524. if (color == null || color.$isFashionNull) {
  4525. return Literal.Null;
  4526. }
  4527. if (color.type !== 'hsla' && color.type !== 'rgba') {
  4528. Fashion.raise(color + ' is not a color for \'darken\'');
  4529. }
  4530. if (amount.type !== 'number') {
  4531. Fashion.raise(amount + ' is not a number for \'darken\'');
  4532. }
  4533. if (amount.value !== Color.constrainPercentage(amount.value)) {
  4534. Fashion.raise('Amount ' + amount + ' must be between 0% and 100% for \'darken\'');
  4535. }
  4536. amount = amount.clone();
  4537. amount.value *= -1;
  4538. return Color.adjust(color, 'lightness', amount);
  4539. },
  4540. rgba: function (red, green, blue, alpha, color) {
  4541. var colorInst;
  4542. if (!!red && !!color) {
  4543. Fashion.raise("Unsupported arguments to RGBA");
  4544. }
  4545. if (color && !red) {
  4546. if (color.$isFashionColor) {
  4547. colorInst = color;
  4548. } else {
  4549. Fashion.raise("Unsupported arguments to RGBA");
  4550. }
  4551. } else if (red && red.$isFashionColor) {
  4552. colorInst = red;
  4553. }
  4554. if (colorInst) {
  4555. alpha = green || alpha;
  4556. colorInst = colorInst.getRGBA();
  4557. red = new Numeric(colorInst.r);
  4558. green = new Numeric(colorInst.g);
  4559. blue = new Numeric(colorInst.b);
  4560. }
  4561. if (!red || !red.$isFashionNumber) {
  4562. if (red == null || red.$isFashionNull) {
  4563. return Literal.Null;
  4564. }
  4565. Fashion.raise(red + ' is not a number for \'rgba\' red');
  4566. }
  4567. if (!green || !green.$isFashionNumber) {
  4568. if (green == null || green.$isFashionNull) {
  4569. return Literal.Null;
  4570. }
  4571. Fashion.raise(green + ' is not a number for \'rgba\' green');
  4572. }
  4573. if (!blue || !blue.$isFashionNumber) {
  4574. if (blue == null || blue.$isFashionNull) {
  4575. return Literal.Null;
  4576. }
  4577. Fashion.raise(blue + ' is not a number for \'rgba\' blue');
  4578. }
  4579. if (!alpha || !alpha.$isFashionNumber) {
  4580. if (alpha == null || alpha.$isFashionNull) {
  4581. return Literal.Null;
  4582. }
  4583. Fashion.raise(alpha + ' is not a number for \'rgba\' alpha');
  4584. }
  4585. if (red.unit == '%') {
  4586. red = new Numeric(Color.constrainPercentage(red.value) / 100 * 255);
  4587. } else if (red.value !== Color.constrainChannel(red.value)) {
  4588. Fashion.raise('Color value ' + red + ' must be between 0 and 255 inclusive for \'rgba\'');
  4589. }
  4590. if (green.unit == '%') {
  4591. green = new Numeric(Color.constrainPercentage(green.value) / 100 * 255);
  4592. } else if (green.value !== Color.constrainChannel(green.value)) {
  4593. Fashion.raise('Color value ' + green + ' must be between 0 and 255 inclusive for \'rgba\'');
  4594. }
  4595. if (blue.unit == '%') {
  4596. blue = new Numeric(Color.constrainPercentage(blue.value) / 100 * 255);
  4597. } else if (blue.value !== Color.constrainChannel(blue.value)) {
  4598. Fashion.raise('Color value ' + blue + ' must be between 0 and 255 inclusive for \'rgba\'');
  4599. }
  4600. if (alpha.unit == '%') {
  4601. alpha = new Numeric(Color.constrainPercentage(alpha.value) / 100);
  4602. } else if (alpha.value !== Color.constrainAlpha(alpha.value)) {
  4603. Fashion.raise('Alpha channel ' + alpha + ' must be between 0 and 1 inclusive for \'rgba\'');
  4604. }
  4605. return new ColorRGBA(red.value, green.value, blue.value, alpha.value);
  4606. },
  4607. mix: function (color_1, color_2, weight) {
  4608. if (color_1 == null || color_1.$isFashionNull) {
  4609. return Literal.Null;
  4610. }
  4611. if (color_2 == null || color_2.$isFashionNull) {
  4612. return Literal.Null;
  4613. }
  4614. weight = (weight !== undefined) ? weight : new Numeric(50, '%');
  4615. if (color_1.type !== 'hsla' && color_1.type !== 'rgba') {
  4616. Fashion.raise('arg 1 ' + color_1 + ' is not a color for \'mix\'');
  4617. }
  4618. if (color_2.type !== 'hsla' && color_2.type !== 'rgba') {
  4619. Fashion.raise('arg 2 ' + color_2 + ' is not a color for \'mix\'');
  4620. }
  4621. if (weight.type !== 'number') {
  4622. Fashion.raise('arg 3 ' + weight + ' is not a number for \'mix\'');
  4623. }
  4624. if (weight.value !== Color.constrainPercentage(weight.value)) {
  4625. Fashion.raise('Weight ' + weight + ' must be between 0% and 100% for \'mix\'');
  4626. }
  4627. color_1 = color_1.getRGBA();
  4628. color_2 = color_2.getRGBA();
  4629. weight = weight.value / 100;
  4630. var factor = (weight * 2) - 1,
  4631. alpha = color_1.a - color_2.a,
  4632. weight1 = (((factor * alpha == -1) ? factor : (factor + alpha) / (1 + factor * alpha)) + 1) / 2,
  4633. weight2 = 1 - weight1;
  4634. return new ColorRGBA(
  4635. (weight1 * color_1.r) + (weight2 * color_2.r),
  4636. (weight1 * color_1.g) + (weight2 * color_2.g),
  4637. (weight1 * color_1.b) + (weight2 * color_2.b),
  4638. (weight * color_1.a) + ((1 - weight) * color_2.a)
  4639. );
  4640. }
  4641. });
  4642. var __rt_constructor = __rt.constructor.bind(__rt),
  4643. __rt_bool = __rt.bool.bind(__rt),
  4644. __rt_color = __rt.color.bind(__rt),
  4645. __rt_quote = __rt.quote.bind(__rt),
  4646. __rt_unquote = __rt.unquote.bind(__rt),
  4647. __rt_not = __rt.not.bind(__rt),
  4648. __rt_operate = __rt.operate.bind(__rt),
  4649. __rt_reset = __rt.reset.bind(__rt),
  4650. __rt_run = __rt.run.bind(__rt),
  4651. __rt_createTypesBlock = __rt.createTypesBlock.bind(__rt),
  4652. __rt_createMethodBlock = __rt.createMethodBlock.bind(__rt),
  4653. __rt_createPropertyBlock = __rt.createPropertyBlock.bind(__rt),
  4654. __rt_createPrefixedFunctionBody = __rt.createPrefixedFunctionBody.bind(__rt),
  4655. __rt_createWrappedFn = __rt.createWrappedFn.bind(__rt),
  4656. __rt_callWrappedFn = __rt.callWrappedFn.bind(__rt),
  4657. __rt_compile = __rt.compile.bind(__rt),
  4658. __rt_execute = __rt.execute.bind(__rt),
  4659. __rt_load = __rt.load.bind(__rt),
  4660. __rt_registerProcessor = __rt.registerProcessor.bind(__rt),
  4661. __rt_register = __rt.register.bind(__rt),
  4662. __rt_isRegistered = __rt.isRegistered.bind(__rt),
  4663. __rt_getGlobalScope = __rt.getGlobalScope.bind(__rt),
  4664. __rt_getCurrentScope = __rt.getCurrentScope.bind(__rt),
  4665. __rt_getRegisteredFunctions = __rt.getRegisteredFunctions.bind(__rt),
  4666. __rt_getFunctions = __rt.getFunctions.bind(__rt),
  4667. __rt_getMixins = __rt.getMixins.bind(__rt),
  4668. __rt_createScope = __rt.createScope.bind(__rt),
  4669. __rt_pushScope = __rt.pushScope.bind(__rt),
  4670. __rt_popScope = __rt.popScope.bind(__rt),
  4671. __rt_createCallStackScope = __rt.createCallStackScope.bind(__rt),
  4672. __rt_pushCallStackScope = __rt.pushCallStackScope.bind(__rt),
  4673. __rt_popCallStackScope = __rt.popCallStackScope.bind(__rt),
  4674. __rt_getCallStack = __rt.getCallStack.bind(__rt),
  4675. __rt_pushSourceInfo = __rt.pushSourceInfo.bind(__rt),
  4676. __rt_getSourceInfo = __rt.getSourceInfo.bind(__rt),
  4677. __rt_get = __rt.get.bind(__rt),
  4678. __rt_getScopeForName = __rt.getScopeForName.bind(__rt),
  4679. __rt_getDefault = __rt.getDefault.bind(__rt),
  4680. __rt_getGlobalDefault = __rt.getGlobalDefault.bind(__rt),
  4681. __rt_getLocalDefault = __rt.getLocalDefault.bind(__rt),
  4682. __rt_setGlobal = __rt.setGlobal.bind(__rt),
  4683. __rt_setDynamic = __rt.setDynamic.bind(__rt),
  4684. __rt_setScoped = __rt.setScoped.bind(__rt),
  4685. __rt_set = __rt.set.bind(__rt),
  4686. __rt_getDocs = __rt.getDocs.bind(__rt),
  4687. __rt_getString = __rt.getString.bind(__rt),
  4688. __rt_getAstNode = __rt.getAstNode.bind(__rt),
  4689. __rt_applySpread = __rt.applySpread.bind(__rt),
  4690. __rt_sliceArgs = __rt.sliceArgs.bind(__rt),
  4691. __rt_applySpreadArgs = __rt.applySpreadArgs.bind(__rt),
  4692. __rt_warn = __rt.warn.bind(__rt),
  4693. __rt_error = __rt.error.bind(__rt),
  4694. __rt_debug = __rt.debug.bind(__rt),
  4695. __rt_setCaches = __rt.setCaches.bind(__rt),
  4696. __rt_copyRuntimeState = __rt.copyRuntimeState.bind(__rt),
  4697. __rt_test = __rt.test.bind(__rt),
  4698. __rt_and = __rt.and.bind(__rt),
  4699. __rt_or = __rt.or.bind(__rt),
  4700. __rt_box = __rt.box.bind(__rt),
  4701. __rt_unbox = __rt.unbox.bind(__rt),
  4702. __rt_Scope = __rt.Scope.bind(__rt),
  4703. __rt_constructor = __rt.constructor.bind(__rt),
  4704. __rt___defineGetter__ = __rt.__defineGetter__.bind(__rt),
  4705. __rt___defineSetter__ = __rt.__defineSetter__.bind(__rt),
  4706. __rt_hasOwnProperty = __rt.hasOwnProperty.bind(__rt),
  4707. __rt___lookupGetter__ = __rt.__lookupGetter__.bind(__rt),
  4708. __rt___lookupSetter__ = __rt.__lookupSetter__.bind(__rt),
  4709. __rt_propertyIsEnumerable = __rt.propertyIsEnumerable.bind(__rt),
  4710. __rt_constructor = __rt.constructor.bind(__rt),
  4711. __rt_toString = __rt.toString.bind(__rt),
  4712. __rt_toLocaleString = __rt.toLocaleString.bind(__rt),
  4713. __rt_valueOf = __rt.valueOf.bind(__rt),
  4714. __rt_isPrototypeOf = __rt.isPrototypeOf.bind(__rt);
  4715. var __rt_context = __rt.context,
  4716. __rt_mixins = __rt.mixins,
  4717. __rt_functions = __rt.functions,
  4718. __rt_processors = __rt.processors,
  4719. __rt_registered = __rt.registered,
  4720. __rt_deferredContent = __rt.deferredContent,
  4721. __rt_registerSelectorHooks = __rt.registerSelectorHooks,
  4722. __rt_registerAtRuleHook = __rt.registerAtRuleHook,
  4723. __rt_registerStyleHooks = __rt.registerStyleHooks,
  4724. __rt_registerFunctionCallHooks = __rt.registerFunctionCallHooks,
  4725. __rt_docCache = __rt.docCache,
  4726. __rt_stringCache = __rt.stringCache,
  4727. __rt_nodeCache = __rt.nodeCache,
  4728. __rt_code = __rt.code,
  4729. __rt_fn = __rt.fn,
  4730. __rt__currentScope = __rt._currentScope,
  4731. __rt__currentCallStackScope = __rt._currentCallStackScope,
  4732. __rt__globalScope = __rt._globalScope,
  4733. __rt__dynamics = __rt._dynamics,
  4734. __rt_css = __rt.css,
  4735. __rt_rulesets = __rt.rulesets,
  4736. __rt_extenders = __rt.extenders,
  4737. __rt__scopeStack = __rt._scopeStack;
  4738. Fashion.apply(__rt.functions, {
  4739. material_color: function ($color_name, $color_variant) {
  4740. __rt_createScope(__rt_functions.material_color && __rt_functions.material_color.createdScope);
  4741. var $color_name = $color_name || __Null;
  4742. __rt_set(__strings.$, $color_name, true);
  4743. var $color_variant = $color_variant || new __Text("500", "'");
  4744. __rt_set(__strings.a, $color_variant, true);
  4745. __rt_set(__strings.A, __rt_box(__rt_registered.map_get.apply(__rt.registered, __rt_applySpreadArgs([
  4746. __rt_get("$material_colors"),
  4747. __rt_get(__strings.$)]))));
  4748. if(__rt_unbox(__rt_get(__strings.A))) {
  4749. __rt_set(__strings._, __rt_box(__rt.registered.map_get.apply(__rt.registered, __rt_applySpreadArgs([
  4750. __rt_get(__strings.A),
  4751. __rt_get(__strings.a)]))));
  4752. if(__rt_unbox(__rt_get(__strings._))) {
  4753. var $$$r = __rt_get(__strings._);
  4754. __rt_popScope();
  4755. return $$$r;
  4756. }
  4757. else {
  4758. __rt_warn(__rt_unbox(__rt.operate("+",__rt.operate("+",__rt.operate("+",__rt.operate("+",new __Text("=> ERROR: COLOR NOT FOUND! <= | ", "\""), __rt_get(__strings.$)), new __Text(",", "\"")), __rt_get(__strings.a)), new __Text(" combination did not match any of the material design colors.", "\""))));
  4759. }
  4760. }
  4761. else {
  4762. __rt_warn(__rt_unbox(__rt.operate("+",__rt.operate("+",new __Text("=> ERROR: COLOR NOT FOUND! <= | ", "\""), __rt_get(__strings.$)), new __Text(" did not match any of the material design colors.", "\""))));
  4763. }
  4764. var $$$r = __ColorRGBA.fromHex("#ff0000");
  4765. __rt_popScope();
  4766. return $$$r;
  4767. },
  4768. material_foreground_color: function ($color_name) {
  4769. __rt_createScope(__rt_functions.material_foreground_color && __rt_functions.material_foreground_color.createdScope);
  4770. var $color_name = $color_name || __Null;
  4771. __rt_set(__strings.$, $color_name, true);
  4772. __rt_set(__strings._, __rt_box(__rt.registered.map_get.apply(__rt.registered, __rt_applySpreadArgs([
  4773. __rt_get("$material_foreground_colors"),
  4774. __rt_get(__strings.$)]))));
  4775. if(__rt_unbox(__rt_get(__strings._))) {
  4776. var $$$r = __rt_get(__strings._);
  4777. __rt_popScope();
  4778. return $$$r;
  4779. }
  4780. else {
  4781. __rt_warn(__rt_unbox(__rt.operate("+",__rt.operate("+",new __Text("=> ERROR: COLOR NOT FOUND! <= | ", "\""), __rt_get(__strings.$)), new __Text(" did not match any of the material design colors.", "\""))));
  4782. }
  4783. var $$$r = __ColorRGBA.fromHex("#ff0000");
  4784. __rt_popScope();
  4785. return $$$r;
  4786. }
  4787. });
  4788. },
  4789. function(__rt) {
  4790. var __rt_constructor = __rt.constructor.bind(__rt),
  4791. __rt_bool = __rt.bool.bind(__rt),
  4792. __rt_color = __rt.color.bind(__rt),
  4793. __rt_quote = __rt.quote.bind(__rt),
  4794. __rt_unquote = __rt.unquote.bind(__rt),
  4795. __rt_not = __rt.not.bind(__rt),
  4796. __rt_operate = __rt.operate.bind(__rt),
  4797. __rt_reset = __rt.reset.bind(__rt),
  4798. __rt_run = __rt.run.bind(__rt),
  4799. __rt_createTypesBlock = __rt.createTypesBlock.bind(__rt),
  4800. __rt_createMethodBlock = __rt.createMethodBlock.bind(__rt),
  4801. __rt_createPropertyBlock = __rt.createPropertyBlock.bind(__rt),
  4802. __rt_createPrefixedFunctionBody = __rt.createPrefixedFunctionBody.bind(__rt),
  4803. __rt_createWrappedFn = __rt.createWrappedFn.bind(__rt),
  4804. __rt_callWrappedFn = __rt.callWrappedFn.bind(__rt),
  4805. __rt_compile = __rt.compile.bind(__rt),
  4806. __rt_execute = __rt.execute.bind(__rt),
  4807. __rt_load = __rt.load.bind(__rt),
  4808. __rt_registerProcessor = __rt.registerProcessor.bind(__rt),
  4809. __rt_register = __rt.register.bind(__rt),
  4810. __rt_isRegistered = __rt.isRegistered.bind(__rt),
  4811. __rt_getGlobalScope = __rt.getGlobalScope.bind(__rt),
  4812. __rt_getCurrentScope = __rt.getCurrentScope.bind(__rt),
  4813. __rt_getRegisteredFunctions = __rt.getRegisteredFunctions.bind(__rt),
  4814. __rt_getFunctions = __rt.getFunctions.bind(__rt),
  4815. __rt_getMixins = __rt.getMixins.bind(__rt),
  4816. __rt_createScope = __rt.createScope.bind(__rt),
  4817. __rt_pushScope = __rt.pushScope.bind(__rt),
  4818. __rt_popScope = __rt.popScope.bind(__rt),
  4819. __rt_createCallStackScope = __rt.createCallStackScope.bind(__rt),
  4820. __rt_pushCallStackScope = __rt.pushCallStackScope.bind(__rt),
  4821. __rt_popCallStackScope = __rt.popCallStackScope.bind(__rt),
  4822. __rt_getCallStack = __rt.getCallStack.bind(__rt),
  4823. __rt_pushSourceInfo = __rt.pushSourceInfo.bind(__rt),
  4824. __rt_getSourceInfo = __rt.getSourceInfo.bind(__rt),
  4825. __rt_get = __rt.get.bind(__rt),
  4826. __rt_getScopeForName = __rt.getScopeForName.bind(__rt),
  4827. __rt_getDefault = __rt.getDefault.bind(__rt),
  4828. __rt_getGlobalDefault = __rt.getGlobalDefault.bind(__rt),
  4829. __rt_getLocalDefault = __rt.getLocalDefault.bind(__rt),
  4830. __rt_setGlobal = __rt.setGlobal.bind(__rt),
  4831. __rt_setDynamic = __rt.setDynamic.bind(__rt),
  4832. __rt_setScoped = __rt.setScoped.bind(__rt),
  4833. __rt_set = __rt.set.bind(__rt),
  4834. __rt_getDocs = __rt.getDocs.bind(__rt),
  4835. __rt_getString = __rt.getString.bind(__rt),
  4836. __rt_getAstNode = __rt.getAstNode.bind(__rt),
  4837. __rt_applySpread = __rt.applySpread.bind(__rt),
  4838. __rt_sliceArgs = __rt.sliceArgs.bind(__rt),
  4839. __rt_applySpreadArgs = __rt.applySpreadArgs.bind(__rt),
  4840. __rt_warn = __rt.warn.bind(__rt),
  4841. __rt_error = __rt.error.bind(__rt),
  4842. __rt_debug = __rt.debug.bind(__rt),
  4843. __rt_setCaches = __rt.setCaches.bind(__rt),
  4844. __rt_copyRuntimeState = __rt.copyRuntimeState.bind(__rt),
  4845. __rt_test = __rt.test.bind(__rt),
  4846. __rt_and = __rt.and.bind(__rt),
  4847. __rt_or = __rt.or.bind(__rt),
  4848. __rt_box = __rt.box.bind(__rt),
  4849. __rt_unbox = __rt.unbox.bind(__rt),
  4850. __rt_Scope = __rt.Scope.bind(__rt),
  4851. __rt_constructor = __rt.constructor.bind(__rt),
  4852. __rt___defineGetter__ = __rt.__defineGetter__.bind(__rt),
  4853. __rt___defineSetter__ = __rt.__defineSetter__.bind(__rt),
  4854. __rt_hasOwnProperty = __rt.hasOwnProperty.bind(__rt),
  4855. __rt___lookupGetter__ = __rt.__lookupGetter__.bind(__rt),
  4856. __rt___lookupSetter__ = __rt.__lookupSetter__.bind(__rt),
  4857. __rt_propertyIsEnumerable = __rt.propertyIsEnumerable.bind(__rt),
  4858. __rt_constructor = __rt.constructor.bind(__rt),
  4859. __rt_toString = __rt.toString.bind(__rt),
  4860. __rt_toLocaleString = __rt.toLocaleString.bind(__rt),
  4861. __rt_valueOf = __rt.valueOf.bind(__rt),
  4862. __rt_isPrototypeOf = __rt.isPrototypeOf.bind(__rt);
  4863. var __rt_context = __rt.context,
  4864. __rt_mixins = __rt.mixins,
  4865. __rt_functions = __rt.functions,
  4866. __rt_processors = __rt.processors,
  4867. __rt_registered = __rt.registered,
  4868. __rt_deferredContent = __rt.deferredContent,
  4869. __rt_registerSelectorHooks = __rt.registerSelectorHooks,
  4870. __rt_registerAtRuleHook = __rt.registerAtRuleHook,
  4871. __rt_registerStyleHooks = __rt.registerStyleHooks,
  4872. __rt_registerFunctionCallHooks = __rt.registerFunctionCallHooks,
  4873. __rt_docCache = __rt.docCache,
  4874. __rt_stringCache = __rt.stringCache,
  4875. __rt_nodeCache = __rt.nodeCache,
  4876. __rt_code = __rt.code,
  4877. __rt_fn = __rt.fn,
  4878. __rt__currentScope = __rt._currentScope,
  4879. __rt__currentCallStackScope = __rt._currentCallStackScope,
  4880. __rt__globalScope = __rt._globalScope,
  4881. __rt__dynamics = __rt._dynamics,
  4882. __rt_css = __rt.css,
  4883. __rt_rulesets = __rt.rulesets,
  4884. __rt_extenders = __rt.extenders,
  4885. __rt__scopeStack = __rt._scopeStack;
  4886. __rt_setDynamic("$dark-mode", __rt_getGlobalDefault("$dark_mode") || __False, 0);
  4887. __rt_setDynamic("$base_color_name", __rt_getGlobalDefault("$base_color_name") || new __Text("blue", "'"), 1);
  4888. __rt_setDynamic("$material-colors", __rt_getGlobalDefault("$material_colors") || new __Map([new __Text("red", "'"), new __Map([new __Text("50", "'"), __ColorRGBA.fromHex("#ffebee"), new __Text("100", "'"), __ColorRGBA.fromHex("#ffcdd2"), new __Text("200", "'"), __ColorRGBA.fromHex("#ef9a9a"), new __Text("300", "'"), __ColorRGBA.fromHex("#e57373"), new __Text("400", "'"), __ColorRGBA.fromHex("#ef5350"), new __Text("500", "'"), __ColorRGBA.fromHex("#f44336"), new __Text("600", "'"), __ColorRGBA.fromHex("#e53935"), new __Text("700", "'"), __ColorRGBA.fromHex("#d32f2f"), new __Text("800", "'"), __ColorRGBA.fromHex("#c62828"), new __Text("900", "'"), __ColorRGBA.fromHex("#b71c1c"), new __Text("a100", "'"), __ColorRGBA.fromHex("#ff8a80"), new __Text("a200", "'"), __ColorRGBA.fromHex("#ff5252"), new __Text("a400", "'"), __ColorRGBA.fromHex("#ff1744"), new __Text("a700", "'"), __ColorRGBA.fromHex("#d50000")]), new __Text("pink", "'"), new __Map([new __Text("50", "'"), __ColorRGBA.fromHex("#fce4ec"), new __Text("100", "'"), __ColorRGBA.fromHex("#f8bbd0"), new __Text("200", "'"), __ColorRGBA.fromHex("#f48fb1"), new __Text("300", "'"), __ColorRGBA.fromHex("#f06292"), new __Text("400", "'"), __ColorRGBA.fromHex("#ec407a"), new __Text("500", "'"), __ColorRGBA.fromHex("#e91e63"), new __Text("600", "'"), __ColorRGBA.fromHex("#d81b60"), new __Text("700", "'"), __ColorRGBA.fromHex("#c2185b"), new __Text("800", "'"), __ColorRGBA.fromHex("#ad1457"), new __Text("900", "'"), __ColorRGBA.fromHex("#880e4f"), new __Text("a100", "'"), __ColorRGBA.fromHex("#ff80ab"), new __Text("a200", "'"), __ColorRGBA.fromHex("#ff4081"), new __Text("a400", "'"), __ColorRGBA.fromHex("#f50057"), new __Text("a700", "'"), __ColorRGBA.fromHex("#c51162")]), new __Text("purple", "'"), new __Map([new __Text("50", "'"), __ColorRGBA.fromHex("#f3e5f5"), new __Text("100", "'"), __ColorRGBA.fromHex("#e1bee7"), new __Text("200", "'"), __ColorRGBA.fromHex("#ce93d8"), new __Text("300", "'"), __ColorRGBA.fromHex("#ba68c8"), new __Text("400", "'"), __ColorRGBA.fromHex("#ab47bc"), new __Text("500", "'"), __ColorRGBA.fromHex("#9c27b0"), new __Text("600", "'"), __ColorRGBA.fromHex("#8e24aa"), new __Text("700", "'"), __ColorRGBA.fromHex("#7b1fa2"), new __Text("800", "'"), __ColorRGBA.fromHex("#6a1b9a"), new __Text("900", "'"), __ColorRGBA.fromHex("#4a148c"), new __Text("a100", "'"), __ColorRGBA.fromHex("#ea80fc"), new __Text("a200", "'"), __ColorRGBA.fromHex("#e040fb"), new __Text("a400", "'"), __ColorRGBA.fromHex("#d500f9"), new __Text("a700", "'"), __ColorRGBA.fromHex("#aa00ff")]), new __Text("deep-purple", "'"), new __Map([new __Text("50", "'"), __ColorRGBA.fromHex("#ede7f6"), new __Text("100", "'"), __ColorRGBA.fromHex("#d1c4e9"), new __Text("200", "'"), __ColorRGBA.fromHex("#b39ddb"), new __Text("300", "'"), __ColorRGBA.fromHex("#9575cd"), new __Text("400", "'"), __ColorRGBA.fromHex("#7e57c2"), new __Text("500", "'"), __ColorRGBA.fromHex("#673ab7"), new __Text("600", "'"), __ColorRGBA.fromHex("#5e35b1"), new __Text("700", "'"), __ColorRGBA.fromHex("#512da8"), new __Text("800", "'"), __ColorRGBA.fromHex("#4527a0"), new __Text("900", "'"), __ColorRGBA.fromHex("#311b92"), new __Text("a100", "'"), __ColorRGBA.fromHex("#b388ff"), new __Text("a200", "'"), __ColorRGBA.fromHex("#7c4dff"), new __Text("a400", "'"), __ColorRGBA.fromHex("#651fff"), new __Text("a700", "'"), __ColorRGBA.fromHex("#6200ea")]), new __Text("indigo", "'"), new __Map([new __Text("50", "'"), __ColorRGBA.fromHex("#e8eaf6"), new __Text("100", "'"), __ColorRGBA.fromHex("#c5cae9"), new __Text("200", "'"), __ColorRGBA.fromHex("#9fa8da"), new __Text("300", "'"), __ColorRGBA.fromHex("#7986cb"), new __Text("400", "'"), __ColorRGBA.fromHex("#5c6bc0"), new __Text("500", "'"), __ColorRGBA.fromHex("#3f51b5"), new __Text("600", "'"), __ColorRGBA.fromHex("#3949ab"), new __Text("700", "'"), __ColorRGBA.fromHex("#303f9f"), new __Text("800", "'"), __ColorRGBA.fromHex("#283593"), new __Text("900", "'"), __ColorRGBA.fromHex("#1a237e"), new __Text("a100", "'"), __ColorRGBA.fromHex("#8c9eff"), new __Text("a200", "'"), __ColorRGBA.fromHex("#536dfe"), new __Text("a400", "'"), __ColorRGBA.fromHex("#3d5afe"), new __Text("a700", "'"), __ColorRGBA.fromHex("#304ffe")]), new __Text("blue", "'"), new __Map([new __Text("50", "'"), __ColorRGBA.fromHex("#e3f2fd"), new __Text("100", "'"), __ColorRGBA.fromHex("#bbdefb"), new __Text("200", "'"), __ColorRGBA.fromHex("#90caf9"), new __Text("300", "'"), __ColorRGBA.fromHex("#64b5f6"), new __Text("400", "'"), __ColorRGBA.fromHex("#42a5f5"), new __Text("500", "'"), __ColorRGBA.fromHex("#2196f3"), new __Text("600", "'"), __ColorRGBA.fromHex("#1e88e5"), new __Text("700", "'"), __ColorRGBA.fromHex("#1976d2"), new __Text("800", "'"), __ColorRGBA.fromHex("#1565c0"), new __Text("900", "'"), __ColorRGBA.fromHex("#0d47a1"), new __Text("a100", "'"), __ColorRGBA.fromHex("#82b1ff"), new __Text("a200", "'"), __ColorRGBA.fromHex("#448aff"), new __Text("a400", "'"), __ColorRGBA.fromHex("#2979ff"), new __Text("a700", "'"), __ColorRGBA.fromHex("#2962ff")]), new __Text("light-blue", "'"), new __Map([new __Text("50", "'"), __ColorRGBA.fromHex("#e1f5fe"), new __Text("100", "'"), __ColorRGBA.fromHex("#b3e5fc"), new __Text("200", "'"), __ColorRGBA.fromHex("#81d4fa"), new __Text("300", "'"), __ColorRGBA.fromHex("#4fc3f7"), new __Text("400", "'"), __ColorRGBA.fromHex("#29b6f6"), new __Text("500", "'"), __ColorRGBA.fromHex("#03a9f4"), new __Text("600", "'"), __ColorRGBA.fromHex("#039be5"), new __Text("700", "'"), __ColorRGBA.fromHex("#0288d1"), new __Text("800", "'"), __ColorRGBA.fromHex("#0277bd"), new __Text("900", "'"), __ColorRGBA.fromHex("#01579b"), new __Text("a100", "'"), __ColorRGBA.fromHex("#80d8ff"), new __Text("a200", "'"), __ColorRGBA.fromHex("#40c4ff"), new __Text("a400", "'"), __ColorRGBA.fromHex("#00b0ff"), new __Text("a700", "'"), __ColorRGBA.fromHex("#0091ea")]), new __Text("cyan", "'"), new __Map([new __Text("50", "'"), __ColorRGBA.fromHex("#e0f7fa"), new __Text("100", "'"), __ColorRGBA.fromHex("#b2ebf2"), new __Text("200", "'"), __ColorRGBA.fromHex("#80deea"), new __Text("300", "'"), __ColorRGBA.fromHex("#4dd0e1"), new __Text("400", "'"), __ColorRGBA.fromHex("#26c6da"), new __Text("500", "'"), __ColorRGBA.fromHex("#00bcd4"), new __Text("600", "'"), __ColorRGBA.fromHex("#00acc1"), new __Text("700", "'"), __ColorRGBA.fromHex("#0097a7"), new __Text("800", "'"), __ColorRGBA.fromHex("#00838f"), new __Text("900", "'"), __ColorRGBA.fromHex("#006064"), new __Text("a100", "'"), __ColorRGBA.fromHex("#84ffff"), new __Text("a200", "'"), __ColorRGBA.fromHex("#18ffff"), new __Text("a400", "'"), __ColorRGBA.fromHex("#00e5ff"), new __Text("a700", "'"), __ColorRGBA.fromHex("#00b8d4")]), new __Text("teal", "'"), new __Map([new __Text("50", "'"), __ColorRGBA.fromHex("#e0f2f1"), new __Text("100", "'"), __ColorRGBA.fromHex("#b2dfdb"), new __Text("200", "'"), __ColorRGBA.fromHex("#80cbc4"), new __Text("300", "'"), __ColorRGBA.fromHex("#4db6ac"), new __Text("400", "'"), __ColorRGBA.fromHex("#26a69a"), new __Text("500", "'"), __ColorRGBA.fromHex("#009688"), new __Text("600", "'"), __ColorRGBA.fromHex("#00897b"), new __Text("700", "'"), __ColorRGBA.fromHex("#00796b"), new __Text("800", "'"), __ColorRGBA.fromHex("#00695c"), new __Text("900", "'"), __ColorRGBA.fromHex("#004d40"), new __Text("a100", "'"), __ColorRGBA.fromHex("#a7ffeb"), new __Text("a200", "'"), __ColorRGBA.fromHex("#64ffda"), new __Text("a400", "'"), __ColorRGBA.fromHex("#1de9b6"), new __Text("a700", "'"), __ColorRGBA.fromHex("#00bfa5")]), new __Text("green", "'"), new __Map([new __Text("50", "'"), __ColorRGBA.fromHex("#e8f5e9"), new __Text("100", "'"), __ColorRGBA.fromHex("#c8e6c9"), new __Text("200", "'"), __ColorRGBA.fromHex("#a5d6a7"), new __Text("300", "'"), __ColorRGBA.fromHex("#81c784"), new __Text("400", "'"), __ColorRGBA.fromHex("#66bb6a"), new __Text("500", "'"), __ColorRGBA.fromHex("#4caf50"), new __Text("600", "'"), __ColorRGBA.fromHex("#43a047"), new __Text("700", "'"), __ColorRGBA.fromHex("#388e3c"), new __Text("800", "'"), __ColorRGBA.fromHex("#2e7d32"), new __Text("900", "'"), __ColorRGBA.fromHex("#1b5e20"), new __Text("a100", "'"), __ColorRGBA.fromHex("#b9f6ca"), new __Text("a200", "'"), __ColorRGBA.fromHex("#69f0ae"), new __Text("a400", "'"), __ColorRGBA.fromHex("#00e676"), new __Text("a700", "'"), __ColorRGBA.fromHex("#00c853")]), new __Text("light-green", "'"), new __Map([new __Text("50", "'"), __ColorRGBA.fromHex("#f1f8e9"), new __Text("100", "'"), __ColorRGBA.fromHex("#dcedc8"), new __Text("200", "'"), __ColorRGBA.fromHex("#c5e1a5"), new __Text("300", "'"), __ColorRGBA.fromHex("#aed581"), new __Text("400", "'"), __ColorRGBA.fromHex("#9ccc65"), new __Text("500", "'"), __ColorRGBA.fromHex("#8bc34a"), new __Text("600", "'"), __ColorRGBA.fromHex("#7cb342"), new __Text("700", "'"), __ColorRGBA.fromHex("#689f38"), new __Text("800", "'"), __ColorRGBA.fromHex("#558b2f"), new __Text("900", "'"), __ColorRGBA.fromHex("#33691e"), new __Text("a100", "'"), __ColorRGBA.fromHex("#ccff90"), new __Text("a200", "'"), __ColorRGBA.fromHex("#b2ff59"), new __Text("a400", "'"), __ColorRGBA.fromHex("#76ff03"), new __Text("a700", "'"), __ColorRGBA.fromHex("#64dd17")]), new __Text("lime", "'"), new __Map([new __Text("50", "'"), __ColorRGBA.fromHex("#f9fbe7"), new __Text("100", "'"), __ColorRGBA.fromHex("#f0f4c3"), new __Text("200", "'"), __ColorRGBA.fromHex("#e6ee9c"), new __Text("300", "'"), __ColorRGBA.fromHex("#dce775"), new __Text("400", "'"), __ColorRGBA.fromHex("#d4e157"), new __Text("500", "'"), __ColorRGBA.fromHex("#cddc39"), new __Text("600", "'"), __ColorRGBA.fromHex("#c0ca33"), new __Text("700", "'"), __ColorRGBA.fromHex("#afb42b"), new __Text("800", "'"), __ColorRGBA.fromHex("#9e9d24"), new __Text("900", "'"), __ColorRGBA.fromHex("#827717"), new __Text("a100", "'"), __ColorRGBA.fromHex("#f4ff81"), new __Text("a200", "'"), __ColorRGBA.fromHex("#eeff41"), new __Text("a400", "'"), __ColorRGBA.fromHex("#c6ff00"), new __Text("a700", "'"), __ColorRGBA.fromHex("#aeea00")]), new __Text("yellow", "'"), new __Map([new __Text("50", "'"), __ColorRGBA.fromHex("#fffde7"), new __Text("100", "'"), __ColorRGBA.fromHex("#fff9c4"), new __Text("200", "'"), __ColorRGBA.fromHex("#fff59d"), new __Text("300", "'"), __ColorRGBA.fromHex("#fff176"), new __Text("400", "'"), __ColorRGBA.fromHex("#ffee58"), new __Text("500", "'"), __ColorRGBA.fromHex("#ffeb3b"), new __Text("600", "'"), __ColorRGBA.fromHex("#fdd835"), new __Text("700", "'"), __ColorRGBA.fromHex("#fbc02d"), new __Text("800", "'"), __ColorRGBA.fromHex("#f9a825"), new __Text("900", "'"), __ColorRGBA.fromHex("#f57f17"), new __Text("a100", "'"), __ColorRGBA.fromHex("#ffff8d"), new __Text("a200", "'"), __ColorRGBA.fromHex("#ffff00"), new __Text("a400", "'"), __ColorRGBA.fromHex("#ffea00"), new __Text("a700", "'"), __ColorRGBA.fromHex("#ffd600")]), new __Text("amber", "'"), new __Map([new __Text("50", "'"), __ColorRGBA.fromHex("#fff8e1"), new __Text("100", "'"), __ColorRGBA.fromHex("#ffecb3"), new __Text("200", "'"), __ColorRGBA.fromHex("#ffe082"), new __Text("300", "'"), __ColorRGBA.fromHex("#ffd54f"), new __Text("400", "'"), __ColorRGBA.fromHex("#ffca28"), new __Text("500", "'"), __ColorRGBA.fromHex("#ffc107"), new __Text("600", "'"), __ColorRGBA.fromHex("#ffb300"), new __Text("700", "'"), __ColorRGBA.fromHex("#ffa000"), new __Text("800", "'"), __ColorRGBA.fromHex("#ff8f00"), new __Text("900", "'"), __ColorRGBA.fromHex("#ff6f00"), new __Text("a100", "'"), __ColorRGBA.fromHex("#ffe57f"), new __Text("a200", "'"), __ColorRGBA.fromHex("#ffd740"), new __Text("a400", "'"), __ColorRGBA.fromHex("#ffc400"), new __Text("a700", "'"), __ColorRGBA.fromHex("#ffab00")]), new __Text("orange", "'"), new __Map([new __Text("50", "'"), __ColorRGBA.fromHex("#fff3e0"), new __Text("100", "'"), __ColorRGBA.fromHex("#ffe0b2"), new __Text("200", "'"), __ColorRGBA.fromHex("#ffcc80"), new __Text("300", "'"), __ColorRGBA.fromHex("#ffb74d"), new __Text("400", "'"), __ColorRGBA.fromHex("#ffa726"), new __Text("500", "'"), __ColorRGBA.fromHex("#ff9800"), new __Text("600", "'"), __ColorRGBA.fromHex("#fb8c00"), new __Text("700", "'"), __ColorRGBA.fromHex("#f57c00"), new __Text("800", "'"), __ColorRGBA.fromHex("#ef6c00"), new __Text("900", "'"), __ColorRGBA.fromHex("#e65100"), new __Text("a100", "'"), __ColorRGBA.fromHex("#ffd180"), new __Text("a200", "'"), __ColorRGBA.fromHex("#ffab40"), new __Text("a400", "'"), __ColorRGBA.fromHex("#ff9100"), new __Text("a700", "'"), __ColorRGBA.fromHex("#ff6d00")]), new __Text("deep-orange", "'"), new __Map([new __Text("50", "'"), __ColorRGBA.fromHex("#fbe9e7"), new __Text("100", "'"), __ColorRGBA.fromHex("#ffccbc"), new __Text("200", "'"), __ColorRGBA.fromHex("#ffab91"), new __Text("300", "'"), __ColorRGBA.fromHex("#ff8a65"), new __Text("400", "'"), __ColorRGBA.fromHex("#ff7043"), new __Text("500", "'"), __ColorRGBA.fromHex("#ff5722"), new __Text("600", "'"), __ColorRGBA.fromHex("#f4511e"), new __Text("700", "'"), __ColorRGBA.fromHex("#e64a19"), new __Text("800", "'"), __ColorRGBA.fromHex("#d84315"), new __Text("900", "'"), __ColorRGBA.fromHex("#bf360c"), new __Text("a100", "'"), __ColorRGBA.fromHex("#ff9e80"), new __Text("a200", "'"), __ColorRGBA.fromHex("#ff6e40"), new __Text("a400", "'"), __ColorRGBA.fromHex("#ff3d00"), new __Text("a700", "'"), __ColorRGBA.fromHex("#dd2c00")]), new __Text("brown", "'"), new __Map([new __Text("50", "'"), __ColorRGBA.fromHex("#efebe9"), new __Text("100", "'"), __ColorRGBA.fromHex("#d7ccc8"), new __Text("200", "'"), __ColorRGBA.fromHex("#bcaaa4"), new __Text("300", "'"), __ColorRGBA.fromHex("#a1887f"), new __Text("400", "'"), __ColorRGBA.fromHex("#8d6e63"), new __Text("500", "'"), __ColorRGBA.fromHex("#795548"), new __Text("600", "'"), __ColorRGBA.fromHex("#6d4c41"), new __Text("700", "'"), __ColorRGBA.fromHex("#5d4037"), new __Text("800", "'"), __ColorRGBA.fromHex("#4e342e"), new __Text("900", "'"), __ColorRGBA.fromHex("#3e2723")]), new __Text("grey", "'"), new __Map([new __Text("50", "'"), __ColorRGBA.fromHex("#fafafa"), new __Text("100", "'"), __ColorRGBA.fromHex("#f5f5f5"), new __Text("200", "'"), __ColorRGBA.fromHex("#eeeeee"), new __Text("300", "'"), __ColorRGBA.fromHex("#e0e0e0"), new __Text("400", "'"), __ColorRGBA.fromHex("#bdbdbd"), new __Text("500", "'"), __ColorRGBA.fromHex("#9e9e9e"), new __Text("600", "'"), __ColorRGBA.fromHex("#757575"), new __Text("700", "'"), __ColorRGBA.fromHex("#616161"), new __Text("800", "'"), __ColorRGBA.fromHex("#424242"), new __Text("900", "'"), __ColorRGBA.fromHex("#212121")]), new __Text("blue-grey", "'"), new __Map([new __Text("50", "'"), __ColorRGBA.fromHex("#eceff1"), new __Text("100", "'"), __ColorRGBA.fromHex("#cfd8dc"), new __Text("200", "'"), __ColorRGBA.fromHex("#b0bec5"), new __Text("300", "'"), __ColorRGBA.fromHex("#90a4ae"), new __Text("400", "'"), __ColorRGBA.fromHex("#78909c"), new __Text("500", "'"), __ColorRGBA.fromHex("#607d8b"), new __Text("600", "'"), __ColorRGBA.fromHex("#546e7a"), new __Text("700", "'"), __ColorRGBA.fromHex("#455a64"), new __Text("800", "'"), __ColorRGBA.fromHex("#37474f"), new __Text("900", "'"), __ColorRGBA.fromHex("#263238"), new __Text("1000", "'"), __ColorRGBA.fromHex("#11171a")])]), 2);
  4889. __rt_setDynamic("$base-color", __rt_getGlobalDefault("$base_color") || __rt_box((__rt_functions.material_color || material_color__fn).apply(__rt.functions, __rt_applySpreadArgs([
  4890. __rt_get("$base_color_name"),
  4891. new __Text("500", "'")]))), 3);
  4892. __rt_setDynamic("$base-highlight-color", __rt_getGlobalDefault("$base_highlight_color") || __rt_box((__rt.functions.material_color || material_color__fn).apply(__rt.functions, __rt_applySpreadArgs([
  4893. __rt_get("$base_color_name"),
  4894. new __Text("300", "'")]))), 4);
  4895. __rt_setDynamic("$base-light-color", __rt_getGlobalDefault("$base_light_color") || __rt_box((__rt.functions.material_color || material_color__fn).apply(__rt.functions, __rt_applySpreadArgs([
  4896. __rt_get("$base_color_name"),
  4897. new __Text("100", "'")]))), 5);
  4898. __rt_setDynamic("$base-dark-color", __rt_getGlobalDefault("$base_dark_color") || __rt_box((__rt.functions.material_color || material_color__fn).apply(__rt.functions, __rt_applySpreadArgs([
  4899. __rt_get("$base_color_name"),
  4900. new __Text("700", "'")]))), 6);
  4901. __rt_setDynamic("$base-pressed-color", __rt_getGlobalDefault("$base_pressed_color") || __rt_box(__rt_registered.darken.apply(__rt.registered, __rt_applySpreadArgs([
  4902. (__rt_test(__rt_get("$dark_mode")) ? __rt_box(__rt.registered.darken.apply(__rt.registered, __rt_applySpreadArgs([
  4903. __rt_get("$base_color"),
  4904. new __Numeric(15, "%")]))) : __rt_box(__rt.registered.lighten.apply(__rt.registered, __rt_applySpreadArgs([
  4905. __rt_get("$base_color"),
  4906. new __Numeric(15, "%")])))),
  4907. new __Numeric(0, "%")]))), 7);
  4908. __rt_setDynamic("$base-focused-color", __rt_getGlobalDefault("$base_focused_color") || __rt_box((__rt.functions.material_color || material_color__fn).apply(__rt.functions, __rt_applySpreadArgs([
  4909. __rt_get("$base_color_name"),
  4910. new __Text("400", "'")]))), 8);
  4911. __rt_setDynamic("$base-invisible-color", __rt_getGlobalDefault("$base_invisible_color") || __rt_box(__rt.registered.rgba.apply(__rt.registered, __rt_applySpreadArgs([
  4912. __rt_get("$base_color"),
  4913. new __Numeric(0),
  4914. __udf,
  4915. __udf,
  4916. __udf]))), 9);
  4917. __rt_setDynamic("$material-foreground-colors", __rt_getGlobalDefault("$material_foreground_colors") || new __Map([new __Text("red", "'"), __ColorRGBA.fromHex("#fff"), new __Text("pink", "'"), __ColorRGBA.fromHex("#fff"), new __Text("purple", "'"), __ColorRGBA.fromHex("#fff"), new __Text("deep-purple", "'"), __ColorRGBA.fromHex("#fff"), new __Text("indigo", "'"), __ColorRGBA.fromHex("#fff"), new __Text("blue", "'"), __ColorRGBA.fromHex("#fff"), new __Text("light-blue", "'"), __ColorRGBA.fromHex("#fff"), new __Text("cyan", "'"), __ColorRGBA.fromHex("#fff"), new __Text("teal", "'"), __ColorRGBA.fromHex("#fff"), new __Text("green", "'"), __ColorRGBA.fromHex("#fff"), new __Text("light-green", "'"), __ColorRGBA.fromHex("#222"), new __Text("lime", "'"), __ColorRGBA.fromHex("#222"), new __Text("yellow", "'"), __ColorRGBA.fromHex("#222"), new __Text("amber", "'"), __ColorRGBA.fromHex("#222"), new __Text("orange", "'"), __ColorRGBA.fromHex("#222"), new __Text("deep-orange", "'"), __ColorRGBA.fromHex("#fff"), new __Text("brown", "'"), __ColorRGBA.fromHex("#fff"), new __Text("grey", "'"), __ColorRGBA.fromHex("#222"), new __Text("blue-grey", "'"), __ColorRGBA.fromHex("#fff")]), 10);
  4918. __rt_setDynamic("$base-foreground-color", __rt_getGlobalDefault("$base_foreground_color") || __rt_box((__rt.functions.material_foreground_color || material_foreground_color__fn).apply(__rt.functions, __rt_applySpreadArgs([
  4919. __rt_get("$base_color_name")]))), 11);
  4920. __rt_setDynamic("$accent_color_name", __rt_getGlobalDefault("$accent_color_name") || new __Text("orange", "'"), 12);
  4921. __rt_setDynamic("$accent-color", __rt_getGlobalDefault("$accent_color") || __rt_box((__rt.functions.material_color || material_color__fn).apply(__rt.functions, __rt_applySpreadArgs([
  4922. __rt_get("$accent_color_name"),
  4923. new __Text("500", "'")]))), 13);
  4924. __rt_setDynamic("$accent-light-color", __rt_getGlobalDefault("$accent_light_color") || __rt_box((__rt.functions.material_color || material_color__fn).apply(__rt.functions, __rt_applySpreadArgs([
  4925. __rt_get("$accent_color_name"),
  4926. new __Text("100", "'")]))), 14);
  4927. __rt_setDynamic("$accent-dark-color", __rt_getGlobalDefault("$accent_dark_color") || __rt_box((__rt.functions.material_color || material_color__fn).apply(__rt.functions, __rt_applySpreadArgs([
  4928. __rt_get("$accent_color_name"),
  4929. new __Text("700", "'")]))), 15);
  4930. __rt_setDynamic("$accent-pressed-color", __rt_getGlobalDefault("$accent_pressed_color") || (__rt_test(__rt_get("$dark_mode")) ? __rt_box(__rt.registered.darken.apply(__rt.registered, __rt_applySpreadArgs([
  4931. __rt_get("$accent_color"),
  4932. new __Numeric(15, "%")]))) : __rt_box(__rt.registered.lighten.apply(__rt.registered, __rt_applySpreadArgs([
  4933. __rt_get("$accent_color"),
  4934. new __Numeric(15, "%")])))), 16);
  4935. __rt_setDynamic("$accent-invisible-color", __rt_getGlobalDefault("$accent_invisible_color") || __rt_box(__rt.registered.rgba.apply(__rt.registered, __rt_applySpreadArgs([
  4936. __rt_get("$accent_color"),
  4937. new __Numeric(0),
  4938. __udf,
  4939. __udf,
  4940. __udf]))), 17);
  4941. __rt_setDynamic("$accent-foreground-color", __rt_getGlobalDefault("$accent_foreground_color") || __rt_box((__rt.functions.material_foreground_color || material_foreground_color__fn).apply(__rt.functions, __rt_applySpreadArgs([
  4942. __rt_get("$accent_color_name")]))), 18);
  4943. __rt_setDynamic("$confirm-color", __rt_getGlobalDefault("$confirm_color") || __rt_box((__rt.functions.material_color || material_color__fn).apply(__rt.functions, __rt_applySpreadArgs([
  4944. new __Text("light-green", "'"),
  4945. new __Text("600", "'")]))), 19);
  4946. __rt_setDynamic("$confirm-pressed-color", __rt_getGlobalDefault("$confirm_pressed_color") || (__rt_test(__rt_get("$dark_mode")) ? __rt_box(__rt.registered.darken.apply(__rt.registered, __rt_applySpreadArgs([
  4947. __rt_get("$confirm_color"),
  4948. new __Numeric(15, "%")]))) : __rt_box(__rt.registered.lighten.apply(__rt.registered, __rt_applySpreadArgs([
  4949. __rt_get("$confirm_color"),
  4950. new __Numeric(15, "%")])))), 20);
  4951. __rt_setDynamic("$alert-color", __rt_getGlobalDefault("$alert_color") || __rt_box((__rt.functions.material_color || material_color__fn).apply(__rt.functions, __rt_applySpreadArgs([
  4952. new __Text("red", "'"),
  4953. new __Text("800", "'")]))), 21);
  4954. __rt_setDynamic("$alert-pressed-color", __rt_getGlobalDefault("$alert_pressed_color") || (__rt_test(__rt_get("$dark_mode")) ? __rt_box(__rt.registered.darken.apply(__rt.registered, __rt_applySpreadArgs([
  4955. __rt_get("$alert_color"),
  4956. new __Numeric(15, "%")]))) : __rt_box(__rt.registered.lighten.apply(__rt.registered, __rt_applySpreadArgs([
  4957. __rt_get("$alert_color"),
  4958. new __Numeric(15, "%")])))), 22);
  4959. __rt_setDynamic(__strings._, __rt_getGlobalDefault(__strings._) || (__rt_test(__rt_get("$dark_mode")) ? __ColorRGBA.fromHex("#fff") : __ColorRGBA.fromHex("#111111")), 23);
  4960. __rt_setDynamic("$reverse-color", __rt_getGlobalDefault("$reverse_color") || (__rt_test(__rt_get("$dark_mode")) ? __ColorRGBA.fromHex("#222") : __ColorRGBA.fromHex("#fff")), 24);
  4961. __rt_setDynamic("$highlight-color", __rt_getGlobalDefault("$highlight_color") || __rt_box(__rt.registered.rgba.apply(__rt.registered, __rt_applySpreadArgs([
  4962. __rt_get(__strings._),
  4963. new __Numeric(0.54),
  4964. __udf,
  4965. __udf,
  4966. __udf]))), 25);
  4967. __rt_setDynamic("$disabled-color", __rt_getGlobalDefault("$disabled_color") || __rt_box(__rt.registered.rgba.apply(__rt.registered, __rt_applySpreadArgs([
  4968. __rt_get(__strings._),
  4969. new __Numeric(0.38),
  4970. __udf,
  4971. __udf,
  4972. __udf]))), 26);
  4973. __rt_setDynamic("$reverse-disabled-color", __rt_getGlobalDefault("$reverse_disabled_color") || __rt_box(__rt.registered.rgba.apply(__rt.registered, __rt_applySpreadArgs([
  4974. __rt_get("$reverse_color"),
  4975. new __Numeric(0.38),
  4976. __udf,
  4977. __udf,
  4978. __udf]))), 27);
  4979. __rt_setDynamic("$divider-color", __rt_getGlobalDefault("$divider_color") || __rt_box(__rt.registered.mix.apply(__rt.registered, __rt_applySpreadArgs([
  4980. __rt_get(__strings._),
  4981. __rt_get("$reverse_color"),
  4982. new __Numeric(12, "%")]))), 28);
  4983. __rt_setDynamic("$selected-background-color", __rt_getGlobalDefault("$selected_background_color") || (__rt_test(__rt_get("$dark_mode")) ? __rt_get("$base_dark_color") : __rt_box((__rt.functions.material_color || material_color__fn).apply(__rt.functions, __rt_applySpreadArgs([
  4984. new __Text("grey", "'"),
  4985. new __Text("300", "'")])))), 29);
  4986. __rt_setDynamic("$hovered-background-color", __rt_getGlobalDefault("$hovered_background_color") || (__rt_test(__rt_get("$dark_mode")) ? __ColorRGBA.fromHex("#4d4d4d") : __rt_box((__rt.functions.material_color || material_color__fn).apply(__rt.functions, __rt_applySpreadArgs([
  4987. new __Text("grey", "'"),
  4988. new __Text("200", "'")])))), 30);
  4989. __rt_setDynamic("$header-background-color", __rt_getGlobalDefault("$header_background_color") || (__rt_test(__rt_get("$dark_mode")) ? __rt_box((__rt.functions.material_color || material_color__fn).apply(__rt.functions, __rt_applySpreadArgs([
  4990. new __Text("grey", "'"),
  4991. new __Text("800", "'")]))) : __rt_box((__rt.functions.material_color || material_color__fn).apply(__rt.functions, __rt_applySpreadArgs([
  4992. new __Text("grey", "'"),
  4993. new __Text("100", "'")])))), 31);
  4994. __rt_setDynamic("$faded-color", __rt_getGlobalDefault("$faded_color") || (__rt_test(__rt_get("$dark_mode")) ? __ColorRGBA.fromHex("#4d4d4d") : __ColorRGBA.fromHex("#e1e1e1")), 32);
  4995. __rt_setDynamic("$background-color", __rt_getGlobalDefault("$background_color") || (__rt_test(__rt_get("$dark_mode")) ? __ColorRGBA.fromHex("#303030") : __ColorRGBA.fromHex("#fafafa")), 33);
  4996. __rt_setDynamic("$alt-background-color", __rt_getGlobalDefault("$alt_background_color") || (__rt_test(__rt_get("$dark_mode")) ? __ColorRGBA.fromHex("#3a3a3a") : __ColorRGBA.fromHex("#f5f5f5")), 34);
  4997. __rt_setDynamic("$reverse-background-color", __rt_getGlobalDefault("$reverse_background_color") || (__rt_test(__rt_get("$dark_mode")) ? __ColorRGBA.fromHex("#fafafa") : __ColorRGBA.fromHex("#303030")), 35);
  4998. __rt_setDynamic("$reverse-alt-background-color", __rt_getGlobalDefault("$reverse_alt_background_color") || (__rt_test(__rt_get("$dark_mode")) ? __ColorRGBA.fromHex("#f5f5f5") : __ColorRGBA.fromHex("#3a3a3a")), 36);
  4999. __rt_setDynamic("$overlay-color", __rt_getGlobalDefault("$overlay_color") || (__rt_test(__rt_get("$dark_mode")) ? __rt_box(__rt.registered.rgba.apply(__rt.registered, __rt_applySpreadArgs([
  5000. __ColorRGBA.fromHex("#fff"),
  5001. new __Numeric(0.03),
  5002. __udf,
  5003. __udf,
  5004. __udf]))) : __rt_box(__rt.registered.rgba.apply(__rt.registered, __rt_applySpreadArgs([
  5005. __ColorRGBA.fromHex("#000"),
  5006. new __Numeric(0.03),
  5007. __udf,
  5008. __udf,
  5009. __udf])))), 37);
  5010. __rt_setDynamic("$content-padding", __rt_getGlobalDefault("$content_padding") || new __Numeric(16, "px"), 38);
  5011. __rt_setDynamic("$dataview_item_selected_background_color", __rt_getGlobalDefault("$dataview_item_selected_background_color") || __rt_get("$selected_background_color"), 39);
  5012. __rt_setDynamic("$dataitem_selected_background_color", __rt_getGlobalDefault("$dataitem_selected_background_color") || __rt_get("$dataview_item_selected_background_color"), 40);
  5013. __rt_setDynamic("$listitem-selected-background-color", __rt_getGlobalDefault("$listitem_selected_background_color") || __rt_get("$dataitem_selected_background_color"), 41);
  5014. __rt_setDynamic("$reverse-border-color", __rt_getGlobalDefault("$reverse_border_color") || (__rt_test(__rt_get("$dark_mode")) ? __ColorRGBA.fromHex("#212121") : __ColorRGBA.fromHex("#e0e0e0")), 42);
  5015. __rt_setDynamic("$reverse-alt-border-color", __rt_getGlobalDefault("$reverse_alt_border_color") || (__rt_test(__rt_get("$dark_mode")) ? __ColorRGBA.fromHex("#3a3a3a") : __ColorRGBA.fromHex("#e0e0e0")), 43);
  5016. },
  5017. {
  5018. ":root": [
  5019. "dark-mode",
  5020. "base-color",
  5021. "base-highlight-color",
  5022. "base-light-color",
  5023. "base-dark-color",
  5024. "base-pressed-color",
  5025. "base-focused-color",
  5026. "base-invisible-color",
  5027. "base-foreground-color",
  5028. "accent-color",
  5029. "accent-light-color",
  5030. "accent-dark-color",
  5031. "accent-pressed-color",
  5032. "accent-invisible-color",
  5033. "accent-foreground-color",
  5034. "confirm-color",
  5035. "confirm-pressed-color",
  5036. "alert-color",
  5037. "alert-pressed-color",
  5038. __names._,
  5039. "reverse-color",
  5040. "highlight-color",
  5041. "disabled-color",
  5042. "reverse-disabled-color",
  5043. "divider-color",
  5044. "selected-background-color",
  5045. "hovered-background-color",
  5046. "header-background-color",
  5047. "faded-color",
  5048. "background-color",
  5049. "alt-background-color",
  5050. "reverse-background-color",
  5051. "reverse-alt-background-color",
  5052. "overlay-color",
  5053. "content-padding",
  5054. "listitem-selected-background-color",
  5055. "reverse-border-color",
  5056. "reverse-alt-border-color"
  5057. ],
  5058. "html": [
  5059. "base_color_name",
  5060. "accent_color_name",
  5061. "dataview_item_selected_background_color",
  5062. "dataitem_selected_background_color"
  5063. ]});
  5064. })(Fashion);