You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2 lines
13 KiB
2 lines
13 KiB
2 years ago
|
"use strict";function r(r){return r&&"object"==typeof r&&"default"in r?r:{default:r}}var e=r(require("postcss")),t=(r,t)=>{const o="rule"===Object(r.parent).type?r.parent.cloneBefore({raws:{}}).removeAll():e.default.rule({selector:"&"});return o.selectors=o.selectors.map((r=>`${r}:dir(${t})`)),o};const o=/^border-(block|block-start|block-end|inline|inline-start|inline-end)(-(width|style|color))?$/i;var l=(r,e,t,l)=>{r.cloneBefore({prop:`border-top${r.prop.replace(o,"$2")}`,value:e[0]}),r.cloneBefore({prop:`border-bottom${r.prop.replace(o,"$2")}`,value:e[1]||e[0]}),b(r,l)},n=(r,e,t,l)=>{r.cloneBefore({prop:`border-top${r.prop.replace(o,"$2")}`}),b(r,l)},i=(r,e,t,l)=>{r.cloneBefore({prop:`border-bottom${r.prop.replace(o,"$2")}`}),b(r,l)},d=(r,e,l,n)=>{const i=()=>[r.cloneBefore({prop:`border-left${r.prop.replace(o,"$2")}`,value:e[0]}),r.cloneBefore({prop:`border-right${r.prop.replace(o,"$2")}`,value:e[1]||e[0]})],d=()=>[r.clone({prop:`border-right${r.prop.replace(o,"$2")}`,value:e[0]}),r.clone({prop:`border-left${r.prop.replace(o,"$2")}`,value:e[1]||e[0]})];return 1===e.length||2===e.length&&e[0]===e[1]||"ltr"===l?(i(),void b(r,n)):"rtl"===l?(d(),void b(r,n)):(t(r,"ltr").append(i()),t(r,"rtl").append(d()),void b(r,n))},p=(r,e,l,n)=>{const i=()=>r.cloneBefore({prop:`border-left${r.prop.replace(o,"$2")}`}),d=()=>r.cloneBefore({prop:`border-right${r.prop.replace(o,"$2")}`});return"ltr"===l?(i(),void b(r,n)):"rtl"===l?(d(),void b(r,n)):(t(r,"ltr").append(i()),t(r,"rtl").append(d()),void b(r,n))},a=(r,e,l,n)=>{const i=()=>r.cloneBefore({prop:`border-right${r.prop.replace(o,"$2")}`}),d=()=>r.cloneBefore({prop:`border-left${r.prop.replace(o,"$2")}`});return"ltr"===l?(i(),void b(r,n)):"rtl"===l?(d(),void b(r,n)):(t(r,"ltr").append(i()),t(r,"rtl").append(d()),void b(r,n))};function b(r,e){e||r.remove()}const c=/^(border-)(end-end|end-start|start-end|start-start)(-radius)$/i,s={"end-end":"bottom-right","end-start":"bottom-left","start-end":"top-right","start-start":"top-left"},g={"end-end":"bottom-left","end-start":"bottom-right","start-end":"top-left","start-start":"top-right"};var f=(r,e,o,l)=>"ltr"===o?(u(r),void v(r,l)):"rtl"===o?(h(r),void v(r,l)):(t(r,"ltr").append(u(r)),t(r,"rtl").append(h(r)),void v(r,l));function u(r){return r.cloneBefore({prop:r.prop.replace(c,((r,e,t,o)=>`${e}${s[t]}${o}`))})}function h(r){return r.cloneBefore({prop:r.prop.replace(c,((r,e,t,o)=>`${e}${g[t]}${o}`))})}function v(r,e){e||r.remove()}var m=r=>{const e=r.slice();return 4===e.length&&e[3]===e[1]&&e.pop(),3===e.length&&e[2]===e[0]&&e.pop(),2===e.length&&e[1]===e[0]&&e.pop(),e},k=(r,e,o,l)=>{if("logical"!==e[0])return null;const[,n,i,d,p]=e,a=m([n,p||i||n,d||n,i||n]),b=()=>r.cloneBefore({value:a.join(" ")});if(a.length<4||"ltr"===o)return b(),void $(r,l);const c=m([n,i||n,d||n,p||i||n]),s=()=>r.cloneBefore({value:c.join(" ")});if("rtl"===o)return s(),void $(r,l);t(r,"ltr").append(b()),t(r,"rtl").append(s()),$(r,l)};function $(r,e){e||r.remove()}var B=(r,e,o,l)=>/^inline-start$/i.test(r.value)?"ltr"===o?(y(r),void j(r,l)):"rtl"===o?(w(r),void j(r,l)):(t(r,"ltr").append(y(r)),t(r,"rtl").append(w(r)),void j(r,l)):/^inline-end$/i.test(r.value)?"ltr"===o?(w(r),void j(r,l)):"rtl"===o?(y(r),void j(r,l)):(t(r,"ltr").append(w(r)),t(r,"rtl").append(y(r)),void j(r,l)):void 0;function y(r){return r.cloneBefore({value:"left"})}function w(r){return r.cloneBefore({value:"right"})}function j(r,e){e||r.remove()}var z=(r,e,o,l)=>{if("logical"!==e[0])return r.cloneBefore({prop:"top",value:e[0]}),r.cloneBefore({prop:"right",value:e[1]||e[0]}),r.cloneBefore({prop:"bottom",value:e[2]||e[0]}),r.cloneBefore({prop:"left",value:e[3]||e[1]||e[0]}),void O(r,l);return!e[4]||e[4]===e[2]||"ltr"===o?(x(r,e),void O(r,l)):"rtl"===o?(E(r,e),void O(r,l)):(t(r,"ltr").append(x(r,e)),t(r,"rtl").append(E(r,e)),void O(r,l))};function x(r,e){return[r.cloneBefore({prop:"top",value:e[1]}),r.cloneBefore({prop:"left",value:e[2]||e[1]}),r.cloneBefore({prop:"bottom",value:e[3]||e[1]}),r.cloneBefore({prop:"right",value:e[4]||e[2]||e[1]})]}function E(r,e){return[r.cloneBefore({prop:"top",value:e
|