@homebound/truss 2.29.1 → 2.29.3

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/index.js CHANGED
@@ -69,7 +69,7 @@ function newAliasesMethods(aliases) {
69
69
  }
70
70
  function newSetCssVariablesMethod(abbr, defs) {
71
71
  collect({ kind: "cssvar", abbr, defs: { ...defs } });
72
- return `get ${abbr}() { return this${Object.entries(defs).map(([prop, value]) => `.add("${prop}" as any, "${value}")`).join("")}; }`;
72
+ return `get ${abbr}() { return this${Object.entries(defs).map(([prop, value]) => `.add("${prop}" as any, ${JSON.stringify(value)})`).join("")}; }`;
73
73
  }
74
74
  function newIncrementMethods(config, abbr, prop, opts = {}) {
75
75
  const props = typeof prop === "string" ? [prop] : prop;
@@ -115,7 +115,7 @@ function newPxMethods(abbr, props) {
115
115
  }
116
116
  var zeroTo = (n) => [...Array(n + 1).keys()];
117
117
  function maybeWrap(value) {
118
- return typeof value === "number" ? String(value) : `"${value}"`;
118
+ return typeof value === "number" ? String(value) : JSON.stringify(String(value));
119
119
  }
120
120
  function comment(defs) {
121
121
  const paramNames = ["value", "px", "inc"];
@@ -584,7 +584,7 @@ function lowerCaseFirst(s) {
584
584
  return s.charAt(0).toLowerCase() + s.substr(1);
585
585
  }
586
586
  function quote(s) {
587
- return `"${s}"`;
587
+ return JSON.stringify(s);
588
588
  }
589
589
 
590
590
  // src/sections/tachyons/skins.ts
@@ -592,25 +592,16 @@ var skins = (config) => {
592
592
  const { palette } = config;
593
593
  const colors = newMethodsForProp(
594
594
  "color",
595
- Object.fromEntries(
596
- Object.entries(palette).map(([key, value]) => [
597
- lowerCaseFirst(key),
598
- value
599
- ])
600
- )
595
+ Object.fromEntries(Object.entries(palette).map(([key, value]) => [lowerCaseFirst(key), value]))
601
596
  );
602
597
  const backgroundColors = newMethodsForProp(
603
598
  "backgroundColor",
604
- Object.fromEntries(
605
- Object.entries(palette).map(([key, value]) => [`bg${key}`, value])
606
- ),
599
+ Object.fromEntries(Object.entries(palette).map(([key, value]) => [`bg${key}`, value])),
607
600
  "bgColor"
608
601
  );
609
602
  const fillColors = newMethodsForProp(
610
603
  "fill",
611
- Object.fromEntries(
612
- Object.entries(palette).map(([key, value]) => [`f${key}`, value])
613
- )
604
+ Object.fromEntries(Object.entries(palette).map(([key, value]) => [`f${key}`, value]))
614
605
  );
615
606
  return [...colors, ...backgroundColors, ...fillColors];
616
607
  };
@@ -1023,7 +1014,7 @@ var TRUSS_PSEUDO_METHODS = {
1023
1014
  };
1024
1015
 
1025
1016
  // src/generate.ts
1026
- var CssProperties = imp("Properties@csstype");
1017
+ var CssProperties = imp("t:Properties@csstype");
1027
1018
  var defaultTypeAliases = {
1028
1019
  Margin: ["margin", "marginTop", "marginRight", "marginBottom", "marginLeft"],
1029
1020
  Padding: ["padding", "paddingTop", "paddingRight", "paddingBottom", "paddingLeft"]
@@ -1333,7 +1324,7 @@ function omitUndefinedValues<T extends object>(value: T): T {
1333
1324
 
1334
1325
  export enum Palette {
1335
1326
  ${Object.entries(palette).map(([name, value]) => {
1336
- return `${name} = "${value}",`;
1327
+ return `${name} = ${JSON.stringify(value)},`;
1337
1328
  })}
1338
1329
  }
1339
1330
 
@@ -1395,7 +1386,7 @@ function generateWebCssBuilder(config, sections) {
1395
1386
  const breakpointCode = [
1396
1387
  `export type Breakpoint = ${Object.keys(genBreakpointsMap).map(quote).join(" | ")};`,
1397
1388
  `export enum Breakpoints {`,
1398
- ...Object.entries(genBreakpointsMap).map(([name, value]) => ` ${name} = "${value}",`),
1389
+ ...Object.entries(genBreakpointsMap).map(([name, value]) => ` ${name} = ${JSON.stringify(value)},`),
1399
1390
  `}`
1400
1391
  ];
1401
1392
  const pseudoGetterCode = Object.entries(TRUSS_PSEUDO_METHODS).map(([name, selector]) => {
@@ -1694,7 +1685,7 @@ function omitUndefinedValues<T extends object>(value: T): T {
1694
1685
 
1695
1686
  export enum Palette {
1696
1687
  ${Object.entries(palette).map(([name, value]) => {
1697
- return `${name} = "${value}",`;
1688
+ return `${name} = ${JSON.stringify(value)},`;
1698
1689
  })}
1699
1690
  }
1700
1691