@homebound/truss 2.2.0 → 2.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/plugin/index.js +25 -23
- package/build/plugin/index.js.map +1 -1
- package/package.json +1 -1
package/build/plugin/index.js
CHANGED
|
@@ -688,17 +688,28 @@ function computeStaticBaseName(seg, cssProp, cssValue, isMultiProp, mapping) {
|
|
|
688
688
|
function collectAtomicRules(chains, mapping) {
|
|
689
689
|
const rules = /* @__PURE__ */ new Map();
|
|
690
690
|
let needsMaybeInc = false;
|
|
691
|
+
function collectSegment(seg) {
|
|
692
|
+
if (seg.error || seg.styleArrayArg) return;
|
|
693
|
+
if (seg.typographyLookup) {
|
|
694
|
+
for (const segments of Object.values(seg.typographyLookup.segmentsByName)) {
|
|
695
|
+
for (const nestedSeg of segments) {
|
|
696
|
+
collectSegment(nestedSeg);
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
return;
|
|
700
|
+
}
|
|
701
|
+
if (seg.incremented) needsMaybeInc = true;
|
|
702
|
+
if (seg.variableProps) {
|
|
703
|
+
collectVariableRules(rules, seg, mapping);
|
|
704
|
+
} else {
|
|
705
|
+
collectStaticRules(rules, seg, mapping);
|
|
706
|
+
}
|
|
707
|
+
}
|
|
691
708
|
for (const chain of chains) {
|
|
692
709
|
for (const part of chain.parts) {
|
|
693
710
|
const segs = part.type === "unconditional" ? part.segments : [...part.thenSegments, ...part.elseSegments];
|
|
694
711
|
for (const seg of segs) {
|
|
695
|
-
|
|
696
|
-
if (seg.incremented) needsMaybeInc = true;
|
|
697
|
-
if (seg.variableProps) {
|
|
698
|
-
collectVariableRules(rules, seg, mapping);
|
|
699
|
-
} else {
|
|
700
|
-
collectStaticRules(rules, seg, mapping);
|
|
701
|
-
}
|
|
712
|
+
collectSegment(seg);
|
|
702
713
|
}
|
|
703
714
|
}
|
|
704
715
|
}
|
|
@@ -801,10 +812,7 @@ function generateCssText(rules) {
|
|
|
801
812
|
for (const rule of allRules) {
|
|
802
813
|
for (const declaration of getRuleDeclarations(rule)) {
|
|
803
814
|
if (declaration.cssVarName) {
|
|
804
|
-
lines.push(`@property ${declaration.cssVarName} {
|
|
805
|
-
syntax: "*";
|
|
806
|
-
inherits: false;
|
|
807
|
-
}`);
|
|
815
|
+
lines.push(`@property ${declaration.cssVarName} { syntax: "*"; inherits: false; }`);
|
|
808
816
|
}
|
|
809
817
|
}
|
|
810
818
|
}
|
|
@@ -869,21 +877,15 @@ function getRuleDeclarations(rule) {
|
|
|
869
877
|
}
|
|
870
878
|
function formatRuleBlock(selector, rule) {
|
|
871
879
|
const body = getRuleDeclarations(rule).map(function(declaration) {
|
|
872
|
-
return
|
|
873
|
-
}).join("
|
|
874
|
-
return `${selector} {
|
|
875
|
-
${body}
|
|
876
|
-
}`;
|
|
880
|
+
return `${declaration.cssProperty}: ${declaration.cssValue};`;
|
|
881
|
+
}).join(" ");
|
|
882
|
+
return `${selector} { ${body} }`;
|
|
877
883
|
}
|
|
878
884
|
function formatNestedRuleBlock(wrapper, selector, rule) {
|
|
879
885
|
const body = getRuleDeclarations(rule).map(function(declaration) {
|
|
880
|
-
return
|
|
881
|
-
}).join("
|
|
882
|
-
return `${wrapper} {
|
|
883
|
-
${selector} {
|
|
884
|
-
${body}
|
|
885
|
-
}
|
|
886
|
-
}`;
|
|
886
|
+
return `${declaration.cssProperty}: ${declaration.cssValue};`;
|
|
887
|
+
}).join(" ");
|
|
888
|
+
return `${wrapper} { ${selector} { ${body} } }`;
|
|
887
889
|
}
|
|
888
890
|
function buildStyleHashProperties(segments, mapping, maybeIncHelperName) {
|
|
889
891
|
const propGroups = /* @__PURE__ */ new Map();
|