2 lines
4.0 KiB
JavaScript
2 lines
4.0 KiB
JavaScript
/*! This file is auto-generated */
|
|
!function(){"use strict";var e={d:function(t,n){for(var o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{compileCSS:function(){return p},getCSSRules:function(){return m}});var n=window.lodash;const o="var:",r="|",a="--";function i(e,t,o,r){const a=(0,n.get)(e,o);return a?[{selector:t?.selector,key:r,value:u(a)}]:[]}function g(e,t,o,r,a=["top","right","bottom","left"]){const i=(0,n.get)(e,o);if(!i)return[];const g=[];if("string"==typeof i)g.push({selector:t?.selector,key:r.default,value:i});else{const e=a.reduce(((e,o)=>{const a=u((0,n.get)(i,[o]));return a&&e.push({selector:t?.selector,key:r?.individual.replace("%s",l(o)),value:a}),e}),[]);g.push(...e)}return g}function u(e){if("string"==typeof e&&e.startsWith(o)){return`var(--wp--${e.slice(o.length).split(r).map((e=>(0,n.kebabCase)(e))).join(a)})`}return e}function l(e){const[t,...n]=e;return t.toUpperCase()+n.join("")}function s(e){return(t,n)=>i(t,n,e,function(e){const[t,...n]=e;return t.toLowerCase()+n.map(l).join("")}(e))}function c(e){return(t,n)=>["color","style","width"].flatMap((o=>s(["border",e,o])(t,n)))}const d={name:"radius",generate:(e,t)=>g(e,t,["border","radius"],{default:"borderRadius",individual:"border%sRadius"},["topLeft","topRight","bottomLeft","bottomRight"])};const f=[...[{name:"color",generate:s(["border","color"])},{name:"style",generate:s(["border","style"])},{name:"width",generate:s(["border","width"])},d,{name:"borderTop",generate:c("top")},{name:"borderRight",generate:c("right")},{name:"borderBottom",generate:c("bottom")},{name:"borderLeft",generate:c("left")}],...[{name:"text",generate:(e,t)=>i(e,t,["color","text"],"color")},{name:"gradient",generate:(e,t)=>i(e,t,["color","gradient"],"background")},{name:"background",generate:(e,t)=>i(e,t,["color","background"],"backgroundColor")}],...[{name:"minHeight",generate:(e,t)=>i(e,t,["dimensions","minHeight"],"minHeight")}],...[{name:"color",generate:(e,t,n=["outline","color"],o="outlineColor")=>i(e,t,n,o)},{name:"style",generate:(e,t,n=["outline","style"],o="outlineStyle")=>i(e,t,n,o)},{name:"offset",generate:(e,t,n=["outline","offset"],o="outlineOffset")=>i(e,t,n,o)},{name:"width",generate:(e,t,n=["outline","width"],o="outlineWidth")=>i(e,t,n,o)}],...[{name:"margin",generate:(e,t)=>g(e,t,["spacing","margin"],{default:"margin",individual:"margin%s"})},{name:"padding",generate:(e,t)=>g(e,t,["spacing","padding"],{default:"padding",individual:"padding%s"})}],...[{name:"fontFamily",generate:(e,t)=>i(e,t,["typography","fontFamily"],"fontFamily")},{name:"fontSize",generate:(e,t)=>i(e,t,["typography","fontSize"],"fontSize")},{name:"fontStyle",generate:(e,t)=>i(e,t,["typography","fontStyle"],"fontStyle")},{name:"fontWeight",generate:(e,t)=>i(e,t,["typography","fontWeight"],"fontWeight")},{name:"letterSpacing",generate:(e,t)=>i(e,t,["typography","letterSpacing"],"letterSpacing")},{name:"lineHeight",generate:(e,t)=>i(e,t,["typography","lineHeight"],"lineHeight")},{name:"textColumns",generate:(e,t)=>i(e,t,["typography","textColumns"],"columnCount")},{name:"textDecoration",generate:(e,t)=>i(e,t,["typography","textDecoration"],"textDecoration")},{name:"textTransform",generate:(e,t)=>i(e,t,["typography","textTransform"],"textTransform")}],...[{name:"shadow",generate:(e,t)=>i(e,t,["shadow"],"boxShadow")}]];function p(e,t={}){const o=m(e,t);if(!t?.selector){const e=[];return o.forEach((t=>{e.push(`${(0,n.kebabCase)(t.key)}: ${t.value};`)})),e.join(" ")}const r=o.reduce(((e,t)=>{const{selector:n}=t;return n?(e[n]||(e[n]=[]),e[n].push(t),e):e}),{});return Object.keys(r).reduce(((e,t)=>(e.push(`${t} { ${r[t].map((e=>`${(0,n.kebabCase)(e.key)}: ${e.value};`)).join(" ")} }`),e)),[]).join("\n")}function m(e,t={}){const n=[];return f.forEach((o=>{"function"==typeof o.generate&&n.push(...o.generate(e,t))})),n}(window.wp=window.wp||{}).styleEngine=t}(); |