@wordpress/theme 0.8.1-next.v.202603161435.0 → 0.9.0

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.
Files changed (49) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +25 -2
  3. package/build/esbuild-plugins/esbuild-ds-token-fallbacks.cjs +1 -1
  4. package/build/esbuild-plugins/esbuild-ds-token-fallbacks.cjs.map +2 -2
  5. package/build/postcss-plugins/add-fallback-to-var.cjs +9 -3
  6. package/build/postcss-plugins/add-fallback-to-var.cjs.map +2 -2
  7. package/build/postcss-plugins/ds-token-fallbacks.cjs +9 -3
  8. package/build/postcss-plugins/ds-token-fallbacks.cjs.map +2 -2
  9. package/build/stylelint-plugins/no-token-fallback-values.cjs +73 -0
  10. package/build/stylelint-plugins/no-token-fallback-values.cjs.map +7 -0
  11. package/build/vite-plugins/vite-ds-token-fallbacks.cjs +4 -1
  12. package/build/vite-plugins/vite-ds-token-fallbacks.cjs.map +2 -2
  13. package/build-module/esbuild-plugins/esbuild-ds-token-fallbacks.mjs +1 -1
  14. package/build-module/esbuild-plugins/esbuild-ds-token-fallbacks.mjs.map +2 -2
  15. package/build-module/postcss-plugins/add-fallback-to-var.mjs +9 -3
  16. package/build-module/postcss-plugins/add-fallback-to-var.mjs.map +2 -2
  17. package/build-module/postcss-plugins/ds-token-fallbacks.mjs +9 -3
  18. package/build-module/postcss-plugins/ds-token-fallbacks.mjs.map +2 -2
  19. package/build-module/stylelint-plugins/no-token-fallback-values.mjs +43 -0
  20. package/build-module/stylelint-plugins/no-token-fallback-values.mjs.map +7 -0
  21. package/build-module/vite-plugins/vite-ds-token-fallbacks.mjs +4 -1
  22. package/build-module/vite-plugins/vite-ds-token-fallbacks.mjs.map +2 -2
  23. package/build-types/color-ramps/stories/index.story.d.ts.map +1 -1
  24. package/build-types/postcss-plugins/add-fallback-to-var.d.ts +10 -4
  25. package/build-types/postcss-plugins/add-fallback-to-var.d.ts.map +1 -1
  26. package/build-types/postcss-plugins/ds-token-fallbacks.d.mts +13 -3
  27. package/build-types/postcss-plugins/ds-token-fallbacks.d.mts.map +1 -1
  28. package/build-types/stylelint-plugins/no-token-fallback-values.d.mts +4 -0
  29. package/build-types/stylelint-plugins/no-token-fallback-values.d.mts.map +1 -0
  30. package/package.json +11 -6
  31. package/src/color-ramps/stories/index.story.tsx +0 -1
  32. package/src/esbuild-plugins/esbuild-ds-token-fallbacks.mjs +1 -1
  33. package/src/postcss-plugins/add-fallback-to-var.ts +19 -8
  34. package/src/postcss-plugins/ds-token-fallbacks.mjs +21 -7
  35. package/src/postcss-plugins/test/add-fallback-to-var.test.ts +52 -0
  36. package/src/stories/index.story.tsx +1 -1
  37. package/src/stylelint-plugins/no-token-fallback-values.mjs +55 -0
  38. package/src/stylelint-plugins/test/.stylelintrc.no-setting-wpds-custom-properties.json +6 -0
  39. package/src/stylelint-plugins/test/.stylelintrc.no-token-fallback-values.json +6 -0
  40. package/src/stylelint-plugins/test/.stylelintrc.no-unknown-ds-tokens.json +6 -0
  41. package/src/stylelint-plugins/test/__snapshots__/no-token-fallback-values.test.ts.snap +60 -0
  42. package/src/stylelint-plugins/test/fixtures/no-token-fallback-values-invalid.css +16 -0
  43. package/src/stylelint-plugins/test/fixtures/no-token-fallback-values-valid.css +18 -0
  44. package/src/stylelint-plugins/test/no-setting-wpds-custom-properties.test.ts +6 -2
  45. package/src/stylelint-plugins/test/no-token-fallback-values.test.ts +51 -0
  46. package/src/stylelint-plugins/test/no-unknown-ds-tokens.test.ts +6 -2
  47. package/src/stylelint-plugins/test/utils/index.ts +7 -4
  48. package/src/vite-plugins/vite-ds-token-fallbacks.mjs +4 -1
  49. package/src/stylelint-plugins/test/.stylelintrc.json +0 -10
package/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.9.0 (2026-03-18)
6
+
7
+ ### New Features
8
+
9
+ - Added `no-token-fallback-values` stylelint rule that disallows manual fallback values for `--wpds-*` design tokens. Available as `@wordpress/theme/stylelint-plugins/no-token-fallback-values` ([#76415](https://github.com/WordPress/gutenberg/pull/76415)).
10
+
5
11
  ## 0.8.0 (2026-03-04)
6
12
 
7
13
  ### New Features
package/README.md CHANGED
@@ -204,11 +204,13 @@ This package provides Stylelint plugins to help enforce consistent usage of desi
204
204
  {
205
205
  "plugins": [
206
206
  "@wordpress/theme/stylelint-plugins/no-unknown-ds-tokens",
207
- "@wordpress/theme/stylelint-plugins/no-setting-wpds-custom-properties"
207
+ "@wordpress/theme/stylelint-plugins/no-setting-wpds-custom-properties",
208
+ "@wordpress/theme/stylelint-plugins/no-token-fallback-values"
208
209
  ],
209
210
  "rules": {
210
211
  "plugin-wpds/no-unknown-ds-tokens": true,
211
- "plugin-wpds/no-setting-wpds-custom-properties": true
212
+ "plugin-wpds/no-setting-wpds-custom-properties": true,
213
+ "plugin-wpds/no-token-fallback-values": true
212
214
  }
213
215
  }
214
216
  ```
@@ -250,6 +252,27 @@ This rule reports an error when a CSS declaration sets (defines) a custom proper
250
252
  }
251
253
  ```
252
254
 
255
+ ### `plugin-wpds/no-token-fallback-values`
256
+
257
+ This rule reports an error when a `var()` call for a `--wpds-*` token includes a manual fallback value. Fallback values for design tokens are injected automatically at build time by the [build plugins](#build-plugins), so manual fallbacks in source are redundant and can drift out of sync with the token definitions.
258
+
259
+ ```css
260
+ /* ✗ Error: Do not add a fallback value for Design System token '--wpds-color-fg-content-neutral' */
261
+ .example {
262
+ color: var(--wpds-color-fg-content-neutral, #1e1e1e);
263
+ }
264
+
265
+ /* ✓ OK */
266
+ .example {
267
+ color: var(--wpds-color-fg-content-neutral);
268
+ }
269
+
270
+ /* ✓ OK: Non-wpds custom properties are not checked */
271
+ .example {
272
+ color: var(--my-custom-color, red);
273
+ }
274
+ ```
275
+
253
276
  ## Build Plugins
254
277
 
255
278
  This package provides build plugins that inject fallback values into bare `var(--wpds-*)` references at build time. This ensures components render correctly even when a `ThemeProvider` or design tokens stylesheet is not present — for example, `var(--wpds-color-fg-content-neutral)` becomes `var(--wpds-color-fg-content-neutral, #1e1e1e)`.
@@ -47,7 +47,7 @@ var plugin = {
47
47
  }
48
48
  const ext = args.path.match(/(\.[^.]+)$/)?.[1] || ".js";
49
49
  return {
50
- contents: (0, import_ds_token_fallbacks.addFallbackToVar)(source),
50
+ contents: (0, import_ds_token_fallbacks.addFallbackToVar)(source, { escapeQuotes: true }),
51
51
  loader: LOADER_MAP[ext] || "jsx"
52
52
  };
53
53
  });
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/esbuild-plugins/esbuild-ds-token-fallbacks.mjs"],
4
- "sourcesContent": ["import { readFile } from 'fs/promises';\nimport { addFallbackToVar } from '../postcss-plugins/ds-token-fallbacks.mjs';\n\nconst LOADER_MAP = {\n\t'.js': 'jsx',\n\t'.jsx': 'jsx',\n\t'.ts': 'tsx',\n\t'.tsx': 'tsx',\n\t'.mjs': 'jsx',\n\t'.mts': 'tsx',\n\t'.cjs': 'jsx',\n\t'.cts': 'tsx',\n};\n\n/**\n * esbuild plugin that injects design-system token fallbacks into JS/TS files.\n *\n * Replaces bare `var(--wpds-*)` references in string literals with\n * `var(--wpds-*, <fallback>)` so components render correctly without\n * a ThemeProvider.\n */\nconst plugin = {\n\tname: 'ds-token-fallbacks-js',\n\tsetup( build ) {\n\t\tbuild.onLoad( { filter: /\\.[mc]?[jt]sx?$/ }, async ( args ) => {\n\t\t\t// Skip node_modules.\n\t\t\tif ( args.path.includes( 'node_modules' ) ) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst source = await readFile( args.path, 'utf8' );\n\n\t\t\tif ( ! source.includes( '--wpds-' ) ) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst ext = args.path.match( /(\\.[^.]+)$/ )?.[ 1 ] || '.js';\n\n\t\t\treturn {\n\t\t\t\tcontents: addFallbackToVar( source ),\n\t\t\t\tloader: LOADER_MAP[ ext ] || 'jsx',\n\t\t\t};\n\t\t} );\n\t},\n};\n\nexport default plugin;\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAyB;AACzB,gCAAiC;AAEjC,IAAM,aAAa;AAAA,EAClB,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,QAAQ;AACT;AASA,IAAM,SAAS;AAAA,EACd,MAAM;AAAA,EACN,MAAO,OAAQ;AACd,UAAM,OAAQ,EAAE,QAAQ,kBAAkB,GAAG,OAAQ,SAAU;AAE9D,UAAK,KAAK,KAAK,SAAU,cAAe,GAAI;AAC3C,eAAO;AAAA,MACR;AAEA,YAAM,SAAS,UAAM,0BAAU,KAAK,MAAM,MAAO;AAEjD,UAAK,CAAE,OAAO,SAAU,SAAU,GAAI;AACrC,eAAO;AAAA,MACR;AAEA,YAAM,MAAM,KAAK,KAAK,MAAO,YAAa,IAAK,CAAE,KAAK;AAEtD,aAAO;AAAA,QACN,cAAU,4CAAkB,MAAO;AAAA,QACnC,QAAQ,WAAY,GAAI,KAAK;AAAA,MAC9B;AAAA,IACD,CAAE;AAAA,EACH;AACD;AAEA,IAAO,qCAAQ;",
4
+ "sourcesContent": ["import { readFile } from 'fs/promises';\nimport { addFallbackToVar } from '../postcss-plugins/ds-token-fallbacks.mjs';\n\nconst LOADER_MAP = {\n\t'.js': 'jsx',\n\t'.jsx': 'jsx',\n\t'.ts': 'tsx',\n\t'.tsx': 'tsx',\n\t'.mjs': 'jsx',\n\t'.mts': 'tsx',\n\t'.cjs': 'jsx',\n\t'.cts': 'tsx',\n};\n\n/**\n * esbuild plugin that injects design-system token fallbacks into JS/TS files.\n *\n * Replaces bare `var(--wpds-*)` references in string literals with\n * `var(--wpds-*, <fallback>)` so components render correctly without\n * a ThemeProvider.\n */\nconst plugin = {\n\tname: 'ds-token-fallbacks-js',\n\tsetup( build ) {\n\t\tbuild.onLoad( { filter: /\\.[mc]?[jt]sx?$/ }, async ( args ) => {\n\t\t\t// Skip node_modules.\n\t\t\tif ( args.path.includes( 'node_modules' ) ) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst source = await readFile( args.path, 'utf8' );\n\n\t\t\tif ( ! source.includes( '--wpds-' ) ) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst ext = args.path.match( /(\\.[^.]+)$/ )?.[ 1 ] || '.js';\n\n\t\t\treturn {\n\t\t\t\tcontents: addFallbackToVar( source, { escapeQuotes: true } ),\n\t\t\t\tloader: LOADER_MAP[ ext ] || 'jsx',\n\t\t\t};\n\t\t} );\n\t},\n};\n\nexport default plugin;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAyB;AACzB,gCAAiC;AAEjC,IAAM,aAAa;AAAA,EAClB,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,QAAQ;AACT;AASA,IAAM,SAAS;AAAA,EACd,MAAM;AAAA,EACN,MAAO,OAAQ;AACd,UAAM,OAAQ,EAAE,QAAQ,kBAAkB,GAAG,OAAQ,SAAU;AAE9D,UAAK,KAAK,KAAK,SAAU,cAAe,GAAI;AAC3C,eAAO;AAAA,MACR;AAEA,YAAM,SAAS,UAAM,0BAAU,KAAK,MAAM,MAAO;AAEjD,UAAK,CAAE,OAAO,SAAU,SAAU,GAAI;AACrC,eAAO;AAAA,MACR;AAEA,YAAM,MAAM,KAAK,KAAK,MAAO,YAAa,IAAK,CAAE,KAAK;AAEtD,aAAO;AAAA,QACN,cAAU,4CAAkB,QAAQ,EAAE,cAAc,KAAK,CAAE;AAAA,QAC3D,QAAQ,WAAY,GAAI,KAAK;AAAA,MAC9B;AAAA,IACD,CAAE;AAAA,EACH;AACD;AAEA,IAAO,qCAAQ;",
6
6
  "names": []
7
7
  }
@@ -22,12 +22,18 @@ __export(add_fallback_to_var_exports, {
22
22
  addFallbackToVar: () => addFallbackToVar
23
23
  });
24
24
  module.exports = __toCommonJS(add_fallback_to_var_exports);
25
- function addFallbackToVar(cssValue, tokenFallbacks) {
25
+ function addFallbackToVar(cssValue, tokenFallbacks, { escapeQuotes = false } = {}) {
26
26
  return cssValue.replace(
27
27
  /var\(\s*(--wpds-[\w-]+)\s*\)/g,
28
28
  (match, tokenName) => {
29
- const fallback = tokenFallbacks[tokenName];
30
- return fallback !== void 0 ? `var(${tokenName}, ${fallback})` : match;
29
+ let fallback = tokenFallbacks[tokenName];
30
+ if (fallback === void 0) {
31
+ return match;
32
+ }
33
+ if (escapeQuotes) {
34
+ fallback = fallback.replaceAll('"', '\\"').replaceAll("'", "\\'");
35
+ }
36
+ return `var(${tokenName}, ${fallback})`;
31
37
  }
32
38
  );
33
39
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/postcss-plugins/add-fallback-to-var.ts"],
4
- "sourcesContent": ["/**\n * Replace bare `var(--wpds-*)` references in a CSS value string with\n * `var(--wpds-*, <fallback>)` using the provided token fallback map.\n *\n * Existing fallbacks (i.e. `var()` calls that already contain a comma)\n * are left untouched, making the function safe to run multiple times\n * (idempotent).\n *\n * NOTE: The regex and replacement logic here is mirrored in\n * `ds-token-fallbacks.mjs`. If you update one, update the other to match.\n *\n * @param cssValue A CSS declaration value.\n * @param tokenFallbacks Map of CSS variable names to their fallback expressions.\n * @return The value with fallbacks injected.\n */\nexport function addFallbackToVar(\n\tcssValue: string,\n\ttokenFallbacks: Record< string, string >\n): string {\n\treturn cssValue.replace(\n\t\t/var\\(\\s*(--wpds-[\\w-]+)\\s*\\)/g,\n\t\t( match, tokenName: string ) => {\n\t\t\tconst fallback = tokenFallbacks[ tokenName ];\n\t\t\treturn fallback !== undefined\n\t\t\t\t? `var(${ tokenName }, ${ fallback })`\n\t\t\t\t: match;\n\t\t}\n\t);\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAeO,SAAS,iBACf,UACA,gBACS;AACT,SAAO,SAAS;AAAA,IACf;AAAA,IACA,CAAE,OAAO,cAAuB;AAC/B,YAAM,WAAW,eAAgB,SAAU;AAC3C,aAAO,aAAa,SACjB,OAAQ,SAAU,KAAM,QAAS,MACjC;AAAA,IACJ;AAAA,EACD;AACD;",
4
+ "sourcesContent": ["/**\n * Replace bare `var(--wpds-*)` references in a CSS value string with\n * `var(--wpds-*, <fallback>)` using the provided token fallback map.\n *\n * Existing fallbacks (i.e. `var()` calls that already contain a comma)\n * are left untouched, making the function safe to run multiple times\n * (idempotent).\n *\n * NOTE: The regex and replacement logic here is mirrored in\n * `ds-token-fallbacks.mjs`. If you update one, update the other to match.\n *\n * @param cssValue A CSS declaration value.\n * @param tokenFallbacks Map of CSS variable names to their fallback expressions.\n * @param options Options.\n * @param options.escapeQuotes When true, escape `\"` and `'` in fallback values.\n * Use this when the input is JS/TS source so that\n * injected quotes don't break string literals.\n * @return The value with fallbacks injected.\n */\nexport function addFallbackToVar(\n\tcssValue: string,\n\ttokenFallbacks: Record< string, string >,\n\t{ escapeQuotes = false }: { escapeQuotes?: boolean } = {}\n): string {\n\treturn cssValue.replace(\n\t\t/var\\(\\s*(--wpds-[\\w-]+)\\s*\\)/g,\n\t\t( match, tokenName: string ) => {\n\t\t\tlet fallback = tokenFallbacks[ tokenName ];\n\t\t\tif ( fallback === undefined ) {\n\t\t\t\treturn match;\n\t\t\t}\n\t\t\tif ( escapeQuotes ) {\n\t\t\t\tfallback = fallback\n\t\t\t\t\t.replaceAll( '\"', '\\\\\"' )\n\t\t\t\t\t.replaceAll( \"'\", \"\\\\'\" );\n\t\t\t}\n\t\t\treturn `var(${ tokenName }, ${ fallback })`;\n\t\t}\n\t);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAmBO,SAAS,iBACf,UACA,gBACA,EAAE,eAAe,MAAM,IAAgC,CAAC,GAC/C;AACT,SAAO,SAAS;AAAA,IACf;AAAA,IACA,CAAE,OAAO,cAAuB;AAC/B,UAAI,WAAW,eAAgB,SAAU;AACzC,UAAK,aAAa,QAAY;AAC7B,eAAO;AAAA,MACR;AACA,UAAK,cAAe;AACnB,mBAAW,SACT,WAAY,KAAK,KAAM,EACvB,WAAY,KAAK,KAAM;AAAA,MAC1B;AACA,aAAO,OAAQ,SAAU,KAAM,QAAS;AAAA,IACzC;AAAA,EACD;AACD;",
6
6
  "names": []
7
7
  }
@@ -34,12 +34,18 @@ __export(ds_token_fallbacks_exports, {
34
34
  module.exports = __toCommonJS(ds_token_fallbacks_exports);
35
35
  var import_design_token_fallbacks = __toESM(require("../prebuilt/js/design-token-fallbacks.mjs"), 1);
36
36
  var tokenFallbacks = import_design_token_fallbacks.default;
37
- function addFallbackToVar(cssValue) {
37
+ function addFallbackToVar(cssValue, { escapeQuotes = false } = {}) {
38
38
  return cssValue.replace(
39
39
  /var\(\s*(--wpds-[\w-]+)\s*\)/g,
40
40
  (match, tokenName) => {
41
- const fallback = tokenFallbacks[tokenName];
42
- return fallback !== void 0 ? `var(${tokenName}, ${fallback})` : match;
41
+ let fallback = tokenFallbacks[tokenName];
42
+ if (fallback === void 0) {
43
+ return match;
44
+ }
45
+ if (escapeQuotes) {
46
+ fallback = fallback.replaceAll('"', '\\"').replaceAll("'", "\\'");
47
+ }
48
+ return `var(${tokenName}, ${fallback})`;
43
49
  }
44
50
  );
45
51
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/postcss-plugins/ds-token-fallbacks.mjs"],
4
- "sourcesContent": ["import _tokenFallbacks from '../prebuilt/js/design-token-fallbacks.mjs';\n\n/** @type {Record<string, string>} */\nconst tokenFallbacks = _tokenFallbacks;\n\n/**\n * Replace bare `var(--wpds-*)` references in a CSS value string with\n * `var(--wpds-*, <fallback>)` using the generated token fallback map.\n *\n * Existing fallbacks (i.e. var() calls that already contain a comma) are\n * left untouched, making the function safe to run multiple times.\n *\n * NOTE: The regex and replacement logic here mirrors `add-fallback-to-var.ts`.\n * If you update one, update the other to match.\n *\n * @param {string} cssValue A CSS declaration value.\n * @return {string} The value with fallbacks injected.\n */\nexport function addFallbackToVar( cssValue ) {\n\treturn cssValue.replace(\n\t\t/var\\(\\s*(--wpds-[\\w-]+)\\s*\\)/g,\n\t\t( match, tokenName ) => {\n\t\t\tconst fallback = tokenFallbacks[ tokenName ];\n\t\t\treturn fallback !== undefined\n\t\t\t\t? `var(${ tokenName }, ${ fallback })`\n\t\t\t\t: match;\n\t\t}\n\t);\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oCAA4B;AAG5B,IAAM,iBAAiB,8BAAAA;AAehB,SAAS,iBAAkB,UAAW;AAC5C,SAAO,SAAS;AAAA,IACf;AAAA,IACA,CAAE,OAAO,cAAe;AACvB,YAAM,WAAW,eAAgB,SAAU;AAC3C,aAAO,aAAa,SACjB,OAAQ,SAAU,KAAM,QAAS,MACjC;AAAA,IACJ;AAAA,EACD;AACD;",
4
+ "sourcesContent": ["import _tokenFallbacks from '../prebuilt/js/design-token-fallbacks.mjs';\n\n/** @type {Record<string, string>} */\nconst tokenFallbacks = _tokenFallbacks;\n\n/**\n * Replace bare `var(--wpds-*)` references in a CSS value string with\n * `var(--wpds-*, <fallback>)` using the generated token fallback map.\n *\n * Existing fallbacks (i.e. var() calls that already contain a comma) are\n * left untouched, making the function safe to run multiple times.\n *\n * NOTE: The regex and replacement logic here mirrors `add-fallback-to-var.ts`.\n * If you update one, update the other to match.\n *\n * @param {string} cssValue A CSS declaration value.\n * @param {Object} [options] Options.\n * @param {boolean} [options.escapeQuotes] When true, escape `\"` and `'` in\n * fallback values. Use this when the\n * input is JS/TS source so that\n * injected quotes don't break string\n * literals. JS will unescape them at\n * parse time, so the browser's CSS\n * engine still sees the correct value.\n * @return {string} The value with fallbacks injected.\n */\nexport function addFallbackToVar( cssValue, { escapeQuotes = false } = {} ) {\n\treturn cssValue.replace(\n\t\t/var\\(\\s*(--wpds-[\\w-]+)\\s*\\)/g,\n\t\t( match, tokenName ) => {\n\t\t\tlet fallback = tokenFallbacks[ tokenName ];\n\t\t\tif ( fallback === undefined ) {\n\t\t\t\treturn match;\n\t\t\t}\n\t\t\tif ( escapeQuotes ) {\n\t\t\t\tfallback = fallback\n\t\t\t\t\t.replaceAll( '\"', '\\\\\"' )\n\t\t\t\t\t.replaceAll( \"'\", \"\\\\'\" );\n\t\t\t}\n\t\t\treturn `var(${ tokenName }, ${ fallback })`;\n\t\t}\n\t);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oCAA4B;AAG5B,IAAM,iBAAiB,8BAAAA;AAuBhB,SAAS,iBAAkB,UAAU,EAAE,eAAe,MAAM,IAAI,CAAC,GAAI;AAC3E,SAAO,SAAS;AAAA,IACf;AAAA,IACA,CAAE,OAAO,cAAe;AACvB,UAAI,WAAW,eAAgB,SAAU;AACzC,UAAK,aAAa,QAAY;AAC7B,eAAO;AAAA,MACR;AACA,UAAK,cAAe;AACnB,mBAAW,SACT,WAAY,KAAK,KAAM,EACvB,WAAY,KAAK,KAAM;AAAA,MAC1B;AACA,aAAO,OAAQ,SAAU,KAAM,QAAS;AAAA,IACzC;AAAA,EACD;AACD;",
6
6
  "names": ["_tokenFallbacks"]
7
7
  }
@@ -0,0 +1,73 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // packages/theme/src/stylelint-plugins/no-token-fallback-values.mjs
30
+ var no_token_fallback_values_exports = {};
31
+ __export(no_token_fallback_values_exports, {
32
+ default: () => no_token_fallback_values_default
33
+ });
34
+ module.exports = __toCommonJS(no_token_fallback_values_exports);
35
+ var import_stylelint = __toESM(require("stylelint"), 1);
36
+ var {
37
+ createPlugin,
38
+ utils: { report, ruleMessages, validateOptions }
39
+ } = import_stylelint.default;
40
+ var ruleName = "plugin-wpds/no-token-fallback-values";
41
+ var varWithFallbackRegex = /var\(\s*(--wpds-[\w-]+)\s*,/g;
42
+ var messages = ruleMessages(ruleName, {
43
+ rejected: (tokenName) => `Do not add a fallback value for Design System token '${tokenName}'. Fallbacks are injected automatically at build time.`
44
+ });
45
+ var ruleFunction = (primary) => {
46
+ return (root, result) => {
47
+ const validOptions = validateOptions(result, ruleName, {
48
+ actual: primary,
49
+ possible: [true]
50
+ });
51
+ if (!validOptions) {
52
+ return;
53
+ }
54
+ root.walkDecls((ruleNode) => {
55
+ const { value } = ruleNode;
56
+ let match;
57
+ varWithFallbackRegex.lastIndex = 0;
58
+ while ((match = varWithFallbackRegex.exec(value)) !== null) {
59
+ report({
60
+ message: messages.rejected(match[1]),
61
+ node: ruleNode,
62
+ word: match[0],
63
+ result,
64
+ ruleName
65
+ });
66
+ }
67
+ });
68
+ };
69
+ };
70
+ ruleFunction.ruleName = ruleName;
71
+ ruleFunction.messages = messages;
72
+ var no_token_fallback_values_default = createPlugin(ruleName, ruleFunction);
73
+ //# sourceMappingURL=no-token-fallback-values.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/stylelint-plugins/no-token-fallback-values.mjs"],
4
+ "sourcesContent": ["import stylelint from 'stylelint';\n\nconst {\n\tcreatePlugin,\n\tutils: { report, ruleMessages, validateOptions },\n} = stylelint;\n\nconst ruleName = 'plugin-wpds/no-token-fallback-values';\n\n/**\n * Matches `var(--wpds-<name>,` \u2014 the comma signals a fallback value.\n * Captures the token name (e.g. `--wpds-color-fg-content-neutral`).\n */\nconst varWithFallbackRegex = /var\\(\\s*(--wpds-[\\w-]+)\\s*,/g;\n\nconst messages = ruleMessages( ruleName, {\n\trejected: ( tokenName ) =>\n\t\t`Do not add a fallback value for Design System token '${ tokenName }'. Fallbacks are injected automatically at build time.`,\n} );\n\n/** @type {import('stylelint').Rule} */\nconst ruleFunction = ( primary ) => {\n\treturn ( root, result ) => {\n\t\tconst validOptions = validateOptions( result, ruleName, {\n\t\t\tactual: primary,\n\t\t\tpossible: [ true ],\n\t\t} );\n\n\t\tif ( ! validOptions ) {\n\t\t\treturn;\n\t\t}\n\n\t\troot.walkDecls( ( ruleNode ) => {\n\t\t\tconst { value } = ruleNode;\n\n\t\t\tlet match;\n\t\t\tvarWithFallbackRegex.lastIndex = 0;\n\t\t\twhile ( ( match = varWithFallbackRegex.exec( value ) ) !== null ) {\n\t\t\t\treport( {\n\t\t\t\t\tmessage: messages.rejected( match[ 1 ] ),\n\t\t\t\t\tnode: ruleNode,\n\t\t\t\t\tword: match[ 0 ],\n\t\t\t\t\tresult,\n\t\t\t\t\truleName,\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\t};\n};\n\nruleFunction.ruleName = ruleName;\nruleFunction.messages = messages;\n\n/** @type {import('stylelint').Plugin} */\nexport default createPlugin( ruleName, ruleFunction );\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAsB;AAEtB,IAAM;AAAA,EACL;AAAA,EACA,OAAO,EAAE,QAAQ,cAAc,gBAAgB;AAChD,IAAI,iBAAAA;AAEJ,IAAM,WAAW;AAMjB,IAAM,uBAAuB;AAE7B,IAAM,WAAW,aAAc,UAAU;AAAA,EACxC,UAAU,CAAE,cACX,wDAAyD,SAAU;AACrE,CAAE;AAGF,IAAM,eAAe,CAAE,YAAa;AACnC,SAAO,CAAE,MAAM,WAAY;AAC1B,UAAM,eAAe,gBAAiB,QAAQ,UAAU;AAAA,MACvD,QAAQ;AAAA,MACR,UAAU,CAAE,IAAK;AAAA,IAClB,CAAE;AAEF,QAAK,CAAE,cAAe;AACrB;AAAA,IACD;AAEA,SAAK,UAAW,CAAE,aAAc;AAC/B,YAAM,EAAE,MAAM,IAAI;AAElB,UAAI;AACJ,2BAAqB,YAAY;AACjC,cAAU,QAAQ,qBAAqB,KAAM,KAAM,OAAQ,MAAO;AACjE,eAAQ;AAAA,UACP,SAAS,SAAS,SAAU,MAAO,CAAE,CAAE;AAAA,UACvC,MAAM;AAAA,UACN,MAAM,MAAO,CAAE;AAAA,UACf;AAAA,UACA;AAAA,QACD,CAAE;AAAA,MACH;AAAA,IACD,CAAE;AAAA,EACH;AACD;AAEA,aAAa,WAAW;AACxB,aAAa,WAAW;AAGxB,IAAO,mCAAQ,aAAc,UAAU,YAAa;",
6
+ "names": ["stylelint"]
7
+ }
@@ -35,7 +35,10 @@ var plugin = () => ({
35
35
  if (!code.includes("--wpds-")) {
36
36
  return null;
37
37
  }
38
- return { code: (0, import_ds_token_fallbacks.addFallbackToVar)(code), map: null };
38
+ return {
39
+ code: (0, import_ds_token_fallbacks.addFallbackToVar)(code, { escapeQuotes: true }),
40
+ map: null
41
+ };
39
42
  }
40
43
  });
41
44
  var vite_ds_token_fallbacks_default = plugin;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/vite-plugins/vite-ds-token-fallbacks.mjs"],
4
- "sourcesContent": ["import { addFallbackToVar } from '../postcss-plugins/ds-token-fallbacks.mjs';\n\n/**\n * Vite plugin that injects design-system token fallbacks into JS/TS files.\n *\n * Replaces bare `var(--wpds-*)` references in string literals with\n * `var(--wpds-*, <fallback>)` so components render correctly without\n * a ThemeProvider.\n */\nconst plugin = () => ( {\n\tname: 'ds-token-fallbacks-js',\n\ttransform( code, id ) {\n\t\tif ( ! /\\.[mc]?[jt]sx?$/.test( id ) ) {\n\t\t\treturn null;\n\t\t}\n\t\tif ( id.includes( 'node_modules' ) ) {\n\t\t\treturn null;\n\t\t}\n\t\tif ( ! code.includes( '--wpds-' ) ) {\n\t\t\treturn null;\n\t\t}\n\t\t// Sourcemap omitted: replacements are small, inline substitutions\n\t\t// that preserve line structure, so the debugging impact is negligible.\n\t\treturn { code: addFallbackToVar( code ), map: null };\n\t},\n} );\n\nexport default plugin;\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gCAAiC;AASjC,IAAM,SAAS,OAAQ;AAAA,EACtB,MAAM;AAAA,EACN,UAAW,MAAM,IAAK;AACrB,QAAK,CAAE,kBAAkB,KAAM,EAAG,GAAI;AACrC,aAAO;AAAA,IACR;AACA,QAAK,GAAG,SAAU,cAAe,GAAI;AACpC,aAAO;AAAA,IACR;AACA,QAAK,CAAE,KAAK,SAAU,SAAU,GAAI;AACnC,aAAO;AAAA,IACR;AAGA,WAAO,EAAE,UAAM,4CAAkB,IAAK,GAAG,KAAK,KAAK;AAAA,EACpD;AACD;AAEA,IAAO,kCAAQ;",
4
+ "sourcesContent": ["import { addFallbackToVar } from '../postcss-plugins/ds-token-fallbacks.mjs';\n\n/**\n * Vite plugin that injects design-system token fallbacks into JS/TS files.\n *\n * Replaces bare `var(--wpds-*)` references in string literals with\n * `var(--wpds-*, <fallback>)` so components render correctly without\n * a ThemeProvider.\n */\nconst plugin = () => ( {\n\tname: 'ds-token-fallbacks-js',\n\ttransform( code, id ) {\n\t\tif ( ! /\\.[mc]?[jt]sx?$/.test( id ) ) {\n\t\t\treturn null;\n\t\t}\n\t\tif ( id.includes( 'node_modules' ) ) {\n\t\t\treturn null;\n\t\t}\n\t\tif ( ! code.includes( '--wpds-' ) ) {\n\t\t\treturn null;\n\t\t}\n\t\t// Sourcemap omitted: replacements are small, inline substitutions\n\t\t// that preserve line structure, so the debugging impact is negligible.\n\t\treturn {\n\t\t\tcode: addFallbackToVar( code, { escapeQuotes: true } ),\n\t\t\tmap: null,\n\t\t};\n\t},\n} );\n\nexport default plugin;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gCAAiC;AASjC,IAAM,SAAS,OAAQ;AAAA,EACtB,MAAM;AAAA,EACN,UAAW,MAAM,IAAK;AACrB,QAAK,CAAE,kBAAkB,KAAM,EAAG,GAAI;AACrC,aAAO;AAAA,IACR;AACA,QAAK,GAAG,SAAU,cAAe,GAAI;AACpC,aAAO;AAAA,IACR;AACA,QAAK,CAAE,KAAK,SAAU,SAAU,GAAI;AACnC,aAAO;AAAA,IACR;AAGA,WAAO;AAAA,MACN,UAAM,4CAAkB,MAAM,EAAE,cAAc,KAAK,CAAE;AAAA,MACrD,KAAK;AAAA,IACN;AAAA,EACD;AACD;AAEA,IAAO,kCAAQ;",
6
6
  "names": []
7
7
  }
@@ -24,7 +24,7 @@ var plugin = {
24
24
  }
25
25
  const ext = args.path.match(/(\.[^.]+)$/)?.[1] || ".js";
26
26
  return {
27
- contents: addFallbackToVar(source),
27
+ contents: addFallbackToVar(source, { escapeQuotes: true }),
28
28
  loader: LOADER_MAP[ext] || "jsx"
29
29
  };
30
30
  });
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/esbuild-plugins/esbuild-ds-token-fallbacks.mjs"],
4
- "sourcesContent": ["import { readFile } from 'fs/promises';\nimport { addFallbackToVar } from '../postcss-plugins/ds-token-fallbacks.mjs';\n\nconst LOADER_MAP = {\n\t'.js': 'jsx',\n\t'.jsx': 'jsx',\n\t'.ts': 'tsx',\n\t'.tsx': 'tsx',\n\t'.mjs': 'jsx',\n\t'.mts': 'tsx',\n\t'.cjs': 'jsx',\n\t'.cts': 'tsx',\n};\n\n/**\n * esbuild plugin that injects design-system token fallbacks into JS/TS files.\n *\n * Replaces bare `var(--wpds-*)` references in string literals with\n * `var(--wpds-*, <fallback>)` so components render correctly without\n * a ThemeProvider.\n */\nconst plugin = {\n\tname: 'ds-token-fallbacks-js',\n\tsetup( build ) {\n\t\tbuild.onLoad( { filter: /\\.[mc]?[jt]sx?$/ }, async ( args ) => {\n\t\t\t// Skip node_modules.\n\t\t\tif ( args.path.includes( 'node_modules' ) ) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst source = await readFile( args.path, 'utf8' );\n\n\t\t\tif ( ! source.includes( '--wpds-' ) ) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst ext = args.path.match( /(\\.[^.]+)$/ )?.[ 1 ] || '.js';\n\n\t\t\treturn {\n\t\t\t\tcontents: addFallbackToVar( source ),\n\t\t\t\tloader: LOADER_MAP[ ext ] || 'jsx',\n\t\t\t};\n\t\t} );\n\t},\n};\n\nexport default plugin;\n"],
5
- "mappings": ";AAAA,SAAS,gBAAgB;AACzB,SAAS,wBAAwB;AAEjC,IAAM,aAAa;AAAA,EAClB,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,QAAQ;AACT;AASA,IAAM,SAAS;AAAA,EACd,MAAM;AAAA,EACN,MAAO,OAAQ;AACd,UAAM,OAAQ,EAAE,QAAQ,kBAAkB,GAAG,OAAQ,SAAU;AAE9D,UAAK,KAAK,KAAK,SAAU,cAAe,GAAI;AAC3C,eAAO;AAAA,MACR;AAEA,YAAM,SAAS,MAAM,SAAU,KAAK,MAAM,MAAO;AAEjD,UAAK,CAAE,OAAO,SAAU,SAAU,GAAI;AACrC,eAAO;AAAA,MACR;AAEA,YAAM,MAAM,KAAK,KAAK,MAAO,YAAa,IAAK,CAAE,KAAK;AAEtD,aAAO;AAAA,QACN,UAAU,iBAAkB,MAAO;AAAA,QACnC,QAAQ,WAAY,GAAI,KAAK;AAAA,MAC9B;AAAA,IACD,CAAE;AAAA,EACH;AACD;AAEA,IAAO,qCAAQ;",
4
+ "sourcesContent": ["import { readFile } from 'fs/promises';\nimport { addFallbackToVar } from '../postcss-plugins/ds-token-fallbacks.mjs';\n\nconst LOADER_MAP = {\n\t'.js': 'jsx',\n\t'.jsx': 'jsx',\n\t'.ts': 'tsx',\n\t'.tsx': 'tsx',\n\t'.mjs': 'jsx',\n\t'.mts': 'tsx',\n\t'.cjs': 'jsx',\n\t'.cts': 'tsx',\n};\n\n/**\n * esbuild plugin that injects design-system token fallbacks into JS/TS files.\n *\n * Replaces bare `var(--wpds-*)` references in string literals with\n * `var(--wpds-*, <fallback>)` so components render correctly without\n * a ThemeProvider.\n */\nconst plugin = {\n\tname: 'ds-token-fallbacks-js',\n\tsetup( build ) {\n\t\tbuild.onLoad( { filter: /\\.[mc]?[jt]sx?$/ }, async ( args ) => {\n\t\t\t// Skip node_modules.\n\t\t\tif ( args.path.includes( 'node_modules' ) ) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst source = await readFile( args.path, 'utf8' );\n\n\t\t\tif ( ! source.includes( '--wpds-' ) ) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst ext = args.path.match( /(\\.[^.]+)$/ )?.[ 1 ] || '.js';\n\n\t\t\treturn {\n\t\t\t\tcontents: addFallbackToVar( source, { escapeQuotes: true } ),\n\t\t\t\tloader: LOADER_MAP[ ext ] || 'jsx',\n\t\t\t};\n\t\t} );\n\t},\n};\n\nexport default plugin;\n"],
5
+ "mappings": ";AAAA,SAAS,gBAAgB;AACzB,SAAS,wBAAwB;AAEjC,IAAM,aAAa;AAAA,EAClB,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,QAAQ;AACT;AASA,IAAM,SAAS;AAAA,EACd,MAAM;AAAA,EACN,MAAO,OAAQ;AACd,UAAM,OAAQ,EAAE,QAAQ,kBAAkB,GAAG,OAAQ,SAAU;AAE9D,UAAK,KAAK,KAAK,SAAU,cAAe,GAAI;AAC3C,eAAO;AAAA,MACR;AAEA,YAAM,SAAS,MAAM,SAAU,KAAK,MAAM,MAAO;AAEjD,UAAK,CAAE,OAAO,SAAU,SAAU,GAAI;AACrC,eAAO;AAAA,MACR;AAEA,YAAM,MAAM,KAAK,KAAK,MAAO,YAAa,IAAK,CAAE,KAAK;AAEtD,aAAO;AAAA,QACN,UAAU,iBAAkB,QAAQ,EAAE,cAAc,KAAK,CAAE;AAAA,QAC3D,QAAQ,WAAY,GAAI,KAAK;AAAA,MAC9B;AAAA,IACD,CAAE;AAAA,EACH;AACD;AAEA,IAAO,qCAAQ;",
6
6
  "names": []
7
7
  }
@@ -1,10 +1,16 @@
1
1
  // packages/theme/src/postcss-plugins/add-fallback-to-var.ts
2
- function addFallbackToVar(cssValue, tokenFallbacks) {
2
+ function addFallbackToVar(cssValue, tokenFallbacks, { escapeQuotes = false } = {}) {
3
3
  return cssValue.replace(
4
4
  /var\(\s*(--wpds-[\w-]+)\s*\)/g,
5
5
  (match, tokenName) => {
6
- const fallback = tokenFallbacks[tokenName];
7
- return fallback !== void 0 ? `var(${tokenName}, ${fallback})` : match;
6
+ let fallback = tokenFallbacks[tokenName];
7
+ if (fallback === void 0) {
8
+ return match;
9
+ }
10
+ if (escapeQuotes) {
11
+ fallback = fallback.replaceAll('"', '\\"').replaceAll("'", "\\'");
12
+ }
13
+ return `var(${tokenName}, ${fallback})`;
8
14
  }
9
15
  );
10
16
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/postcss-plugins/add-fallback-to-var.ts"],
4
- "sourcesContent": ["/**\n * Replace bare `var(--wpds-*)` references in a CSS value string with\n * `var(--wpds-*, <fallback>)` using the provided token fallback map.\n *\n * Existing fallbacks (i.e. `var()` calls that already contain a comma)\n * are left untouched, making the function safe to run multiple times\n * (idempotent).\n *\n * NOTE: The regex and replacement logic here is mirrored in\n * `ds-token-fallbacks.mjs`. If you update one, update the other to match.\n *\n * @param cssValue A CSS declaration value.\n * @param tokenFallbacks Map of CSS variable names to their fallback expressions.\n * @return The value with fallbacks injected.\n */\nexport function addFallbackToVar(\n\tcssValue: string,\n\ttokenFallbacks: Record< string, string >\n): string {\n\treturn cssValue.replace(\n\t\t/var\\(\\s*(--wpds-[\\w-]+)\\s*\\)/g,\n\t\t( match, tokenName: string ) => {\n\t\t\tconst fallback = tokenFallbacks[ tokenName ];\n\t\t\treturn fallback !== undefined\n\t\t\t\t? `var(${ tokenName }, ${ fallback })`\n\t\t\t\t: match;\n\t\t}\n\t);\n}\n"],
5
- "mappings": ";AAeO,SAAS,iBACf,UACA,gBACS;AACT,SAAO,SAAS;AAAA,IACf;AAAA,IACA,CAAE,OAAO,cAAuB;AAC/B,YAAM,WAAW,eAAgB,SAAU;AAC3C,aAAO,aAAa,SACjB,OAAQ,SAAU,KAAM,QAAS,MACjC;AAAA,IACJ;AAAA,EACD;AACD;",
4
+ "sourcesContent": ["/**\n * Replace bare `var(--wpds-*)` references in a CSS value string with\n * `var(--wpds-*, <fallback>)` using the provided token fallback map.\n *\n * Existing fallbacks (i.e. `var()` calls that already contain a comma)\n * are left untouched, making the function safe to run multiple times\n * (idempotent).\n *\n * NOTE: The regex and replacement logic here is mirrored in\n * `ds-token-fallbacks.mjs`. If you update one, update the other to match.\n *\n * @param cssValue A CSS declaration value.\n * @param tokenFallbacks Map of CSS variable names to their fallback expressions.\n * @param options Options.\n * @param options.escapeQuotes When true, escape `\"` and `'` in fallback values.\n * Use this when the input is JS/TS source so that\n * injected quotes don't break string literals.\n * @return The value with fallbacks injected.\n */\nexport function addFallbackToVar(\n\tcssValue: string,\n\ttokenFallbacks: Record< string, string >,\n\t{ escapeQuotes = false }: { escapeQuotes?: boolean } = {}\n): string {\n\treturn cssValue.replace(\n\t\t/var\\(\\s*(--wpds-[\\w-]+)\\s*\\)/g,\n\t\t( match, tokenName: string ) => {\n\t\t\tlet fallback = tokenFallbacks[ tokenName ];\n\t\t\tif ( fallback === undefined ) {\n\t\t\t\treturn match;\n\t\t\t}\n\t\t\tif ( escapeQuotes ) {\n\t\t\t\tfallback = fallback\n\t\t\t\t\t.replaceAll( '\"', '\\\\\"' )\n\t\t\t\t\t.replaceAll( \"'\", \"\\\\'\" );\n\t\t\t}\n\t\t\treturn `var(${ tokenName }, ${ fallback })`;\n\t\t}\n\t);\n}\n"],
5
+ "mappings": ";AAmBO,SAAS,iBACf,UACA,gBACA,EAAE,eAAe,MAAM,IAAgC,CAAC,GAC/C;AACT,SAAO,SAAS;AAAA,IACf;AAAA,IACA,CAAE,OAAO,cAAuB;AAC/B,UAAI,WAAW,eAAgB,SAAU;AACzC,UAAK,aAAa,QAAY;AAC7B,eAAO;AAAA,MACR;AACA,UAAK,cAAe;AACnB,mBAAW,SACT,WAAY,KAAK,KAAM,EACvB,WAAY,KAAK,KAAM;AAAA,MAC1B;AACA,aAAO,OAAQ,SAAU,KAAM,QAAS;AAAA,IACzC;AAAA,EACD;AACD;",
6
6
  "names": []
7
7
  }
@@ -1,12 +1,18 @@
1
1
  // packages/theme/src/postcss-plugins/ds-token-fallbacks.mjs
2
2
  import _tokenFallbacks from "../prebuilt/js/design-token-fallbacks.mjs";
3
3
  var tokenFallbacks = _tokenFallbacks;
4
- function addFallbackToVar(cssValue) {
4
+ function addFallbackToVar(cssValue, { escapeQuotes = false } = {}) {
5
5
  return cssValue.replace(
6
6
  /var\(\s*(--wpds-[\w-]+)\s*\)/g,
7
7
  (match, tokenName) => {
8
- const fallback = tokenFallbacks[tokenName];
9
- return fallback !== void 0 ? `var(${tokenName}, ${fallback})` : match;
8
+ let fallback = tokenFallbacks[tokenName];
9
+ if (fallback === void 0) {
10
+ return match;
11
+ }
12
+ if (escapeQuotes) {
13
+ fallback = fallback.replaceAll('"', '\\"').replaceAll("'", "\\'");
14
+ }
15
+ return `var(${tokenName}, ${fallback})`;
10
16
  }
11
17
  );
12
18
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/postcss-plugins/ds-token-fallbacks.mjs"],
4
- "sourcesContent": ["import _tokenFallbacks from '../prebuilt/js/design-token-fallbacks.mjs';\n\n/** @type {Record<string, string>} */\nconst tokenFallbacks = _tokenFallbacks;\n\n/**\n * Replace bare `var(--wpds-*)` references in a CSS value string with\n * `var(--wpds-*, <fallback>)` using the generated token fallback map.\n *\n * Existing fallbacks (i.e. var() calls that already contain a comma) are\n * left untouched, making the function safe to run multiple times.\n *\n * NOTE: The regex and replacement logic here mirrors `add-fallback-to-var.ts`.\n * If you update one, update the other to match.\n *\n * @param {string} cssValue A CSS declaration value.\n * @return {string} The value with fallbacks injected.\n */\nexport function addFallbackToVar( cssValue ) {\n\treturn cssValue.replace(\n\t\t/var\\(\\s*(--wpds-[\\w-]+)\\s*\\)/g,\n\t\t( match, tokenName ) => {\n\t\t\tconst fallback = tokenFallbacks[ tokenName ];\n\t\t\treturn fallback !== undefined\n\t\t\t\t? `var(${ tokenName }, ${ fallback })`\n\t\t\t\t: match;\n\t\t}\n\t);\n}\n"],
5
- "mappings": ";AAAA,OAAO,qBAAqB;AAG5B,IAAM,iBAAiB;AAehB,SAAS,iBAAkB,UAAW;AAC5C,SAAO,SAAS;AAAA,IACf;AAAA,IACA,CAAE,OAAO,cAAe;AACvB,YAAM,WAAW,eAAgB,SAAU;AAC3C,aAAO,aAAa,SACjB,OAAQ,SAAU,KAAM,QAAS,MACjC;AAAA,IACJ;AAAA,EACD;AACD;",
4
+ "sourcesContent": ["import _tokenFallbacks from '../prebuilt/js/design-token-fallbacks.mjs';\n\n/** @type {Record<string, string>} */\nconst tokenFallbacks = _tokenFallbacks;\n\n/**\n * Replace bare `var(--wpds-*)` references in a CSS value string with\n * `var(--wpds-*, <fallback>)` using the generated token fallback map.\n *\n * Existing fallbacks (i.e. var() calls that already contain a comma) are\n * left untouched, making the function safe to run multiple times.\n *\n * NOTE: The regex and replacement logic here mirrors `add-fallback-to-var.ts`.\n * If you update one, update the other to match.\n *\n * @param {string} cssValue A CSS declaration value.\n * @param {Object} [options] Options.\n * @param {boolean} [options.escapeQuotes] When true, escape `\"` and `'` in\n * fallback values. Use this when the\n * input is JS/TS source so that\n * injected quotes don't break string\n * literals. JS will unescape them at\n * parse time, so the browser's CSS\n * engine still sees the correct value.\n * @return {string} The value with fallbacks injected.\n */\nexport function addFallbackToVar( cssValue, { escapeQuotes = false } = {} ) {\n\treturn cssValue.replace(\n\t\t/var\\(\\s*(--wpds-[\\w-]+)\\s*\\)/g,\n\t\t( match, tokenName ) => {\n\t\t\tlet fallback = tokenFallbacks[ tokenName ];\n\t\t\tif ( fallback === undefined ) {\n\t\t\t\treturn match;\n\t\t\t}\n\t\t\tif ( escapeQuotes ) {\n\t\t\t\tfallback = fallback\n\t\t\t\t\t.replaceAll( '\"', '\\\\\"' )\n\t\t\t\t\t.replaceAll( \"'\", \"\\\\'\" );\n\t\t\t}\n\t\t\treturn `var(${ tokenName }, ${ fallback })`;\n\t\t}\n\t);\n}\n"],
5
+ "mappings": ";AAAA,OAAO,qBAAqB;AAG5B,IAAM,iBAAiB;AAuBhB,SAAS,iBAAkB,UAAU,EAAE,eAAe,MAAM,IAAI,CAAC,GAAI;AAC3E,SAAO,SAAS;AAAA,IACf;AAAA,IACA,CAAE,OAAO,cAAe;AACvB,UAAI,WAAW,eAAgB,SAAU;AACzC,UAAK,aAAa,QAAY;AAC7B,eAAO;AAAA,MACR;AACA,UAAK,cAAe;AACnB,mBAAW,SACT,WAAY,KAAK,KAAM,EACvB,WAAY,KAAK,KAAM;AAAA,MAC1B;AACA,aAAO,OAAQ,SAAU,KAAM,QAAS;AAAA,IACzC;AAAA,EACD;AACD;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,43 @@
1
+ // packages/theme/src/stylelint-plugins/no-token-fallback-values.mjs
2
+ import stylelint from "stylelint";
3
+ var {
4
+ createPlugin,
5
+ utils: { report, ruleMessages, validateOptions }
6
+ } = stylelint;
7
+ var ruleName = "plugin-wpds/no-token-fallback-values";
8
+ var varWithFallbackRegex = /var\(\s*(--wpds-[\w-]+)\s*,/g;
9
+ var messages = ruleMessages(ruleName, {
10
+ rejected: (tokenName) => `Do not add a fallback value for Design System token '${tokenName}'. Fallbacks are injected automatically at build time.`
11
+ });
12
+ var ruleFunction = (primary) => {
13
+ return (root, result) => {
14
+ const validOptions = validateOptions(result, ruleName, {
15
+ actual: primary,
16
+ possible: [true]
17
+ });
18
+ if (!validOptions) {
19
+ return;
20
+ }
21
+ root.walkDecls((ruleNode) => {
22
+ const { value } = ruleNode;
23
+ let match;
24
+ varWithFallbackRegex.lastIndex = 0;
25
+ while ((match = varWithFallbackRegex.exec(value)) !== null) {
26
+ report({
27
+ message: messages.rejected(match[1]),
28
+ node: ruleNode,
29
+ word: match[0],
30
+ result,
31
+ ruleName
32
+ });
33
+ }
34
+ });
35
+ };
36
+ };
37
+ ruleFunction.ruleName = ruleName;
38
+ ruleFunction.messages = messages;
39
+ var no_token_fallback_values_default = createPlugin(ruleName, ruleFunction);
40
+ export {
41
+ no_token_fallback_values_default as default
42
+ };
43
+ //# sourceMappingURL=no-token-fallback-values.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/stylelint-plugins/no-token-fallback-values.mjs"],
4
+ "sourcesContent": ["import stylelint from 'stylelint';\n\nconst {\n\tcreatePlugin,\n\tutils: { report, ruleMessages, validateOptions },\n} = stylelint;\n\nconst ruleName = 'plugin-wpds/no-token-fallback-values';\n\n/**\n * Matches `var(--wpds-<name>,` \u2014 the comma signals a fallback value.\n * Captures the token name (e.g. `--wpds-color-fg-content-neutral`).\n */\nconst varWithFallbackRegex = /var\\(\\s*(--wpds-[\\w-]+)\\s*,/g;\n\nconst messages = ruleMessages( ruleName, {\n\trejected: ( tokenName ) =>\n\t\t`Do not add a fallback value for Design System token '${ tokenName }'. Fallbacks are injected automatically at build time.`,\n} );\n\n/** @type {import('stylelint').Rule} */\nconst ruleFunction = ( primary ) => {\n\treturn ( root, result ) => {\n\t\tconst validOptions = validateOptions( result, ruleName, {\n\t\t\tactual: primary,\n\t\t\tpossible: [ true ],\n\t\t} );\n\n\t\tif ( ! validOptions ) {\n\t\t\treturn;\n\t\t}\n\n\t\troot.walkDecls( ( ruleNode ) => {\n\t\t\tconst { value } = ruleNode;\n\n\t\t\tlet match;\n\t\t\tvarWithFallbackRegex.lastIndex = 0;\n\t\t\twhile ( ( match = varWithFallbackRegex.exec( value ) ) !== null ) {\n\t\t\t\treport( {\n\t\t\t\t\tmessage: messages.rejected( match[ 1 ] ),\n\t\t\t\t\tnode: ruleNode,\n\t\t\t\t\tword: match[ 0 ],\n\t\t\t\t\tresult,\n\t\t\t\t\truleName,\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\t};\n};\n\nruleFunction.ruleName = ruleName;\nruleFunction.messages = messages;\n\n/** @type {import('stylelint').Plugin} */\nexport default createPlugin( ruleName, ruleFunction );\n"],
5
+ "mappings": ";AAAA,OAAO,eAAe;AAEtB,IAAM;AAAA,EACL;AAAA,EACA,OAAO,EAAE,QAAQ,cAAc,gBAAgB;AAChD,IAAI;AAEJ,IAAM,WAAW;AAMjB,IAAM,uBAAuB;AAE7B,IAAM,WAAW,aAAc,UAAU;AAAA,EACxC,UAAU,CAAE,cACX,wDAAyD,SAAU;AACrE,CAAE;AAGF,IAAM,eAAe,CAAE,YAAa;AACnC,SAAO,CAAE,MAAM,WAAY;AAC1B,UAAM,eAAe,gBAAiB,QAAQ,UAAU;AAAA,MACvD,QAAQ;AAAA,MACR,UAAU,CAAE,IAAK;AAAA,IAClB,CAAE;AAEF,QAAK,CAAE,cAAe;AACrB;AAAA,IACD;AAEA,SAAK,UAAW,CAAE,aAAc;AAC/B,YAAM,EAAE,MAAM,IAAI;AAElB,UAAI;AACJ,2BAAqB,YAAY;AACjC,cAAU,QAAQ,qBAAqB,KAAM,KAAM,OAAQ,MAAO;AACjE,eAAQ;AAAA,UACP,SAAS,SAAS,SAAU,MAAO,CAAE,CAAE;AAAA,UACvC,MAAM;AAAA,UACN,MAAM,MAAO,CAAE;AAAA,UACf;AAAA,UACA;AAAA,QACD,CAAE;AAAA,MACH;AAAA,IACD,CAAE;AAAA,EACH;AACD;AAEA,aAAa,WAAW;AACxB,aAAa,WAAW;AAGxB,IAAO,mCAAQ,aAAc,UAAU,YAAa;",
6
+ "names": []
7
+ }
@@ -12,7 +12,10 @@ var plugin = () => ({
12
12
  if (!code.includes("--wpds-")) {
13
13
  return null;
14
14
  }
15
- return { code: addFallbackToVar(code), map: null };
15
+ return {
16
+ code: addFallbackToVar(code, { escapeQuotes: true }),
17
+ map: null
18
+ };
16
19
  }
17
20
  });
18
21
  var vite_ds_token_fallbacks_default = plugin;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/vite-plugins/vite-ds-token-fallbacks.mjs"],
4
- "sourcesContent": ["import { addFallbackToVar } from '../postcss-plugins/ds-token-fallbacks.mjs';\n\n/**\n * Vite plugin that injects design-system token fallbacks into JS/TS files.\n *\n * Replaces bare `var(--wpds-*)` references in string literals with\n * `var(--wpds-*, <fallback>)` so components render correctly without\n * a ThemeProvider.\n */\nconst plugin = () => ( {\n\tname: 'ds-token-fallbacks-js',\n\ttransform( code, id ) {\n\t\tif ( ! /\\.[mc]?[jt]sx?$/.test( id ) ) {\n\t\t\treturn null;\n\t\t}\n\t\tif ( id.includes( 'node_modules' ) ) {\n\t\t\treturn null;\n\t\t}\n\t\tif ( ! code.includes( '--wpds-' ) ) {\n\t\t\treturn null;\n\t\t}\n\t\t// Sourcemap omitted: replacements are small, inline substitutions\n\t\t// that preserve line structure, so the debugging impact is negligible.\n\t\treturn { code: addFallbackToVar( code ), map: null };\n\t},\n} );\n\nexport default plugin;\n"],
5
- "mappings": ";AAAA,SAAS,wBAAwB;AASjC,IAAM,SAAS,OAAQ;AAAA,EACtB,MAAM;AAAA,EACN,UAAW,MAAM,IAAK;AACrB,QAAK,CAAE,kBAAkB,KAAM,EAAG,GAAI;AACrC,aAAO;AAAA,IACR;AACA,QAAK,GAAG,SAAU,cAAe,GAAI;AACpC,aAAO;AAAA,IACR;AACA,QAAK,CAAE,KAAK,SAAU,SAAU,GAAI;AACnC,aAAO;AAAA,IACR;AAGA,WAAO,EAAE,MAAM,iBAAkB,IAAK,GAAG,KAAK,KAAK;AAAA,EACpD;AACD;AAEA,IAAO,kCAAQ;",
4
+ "sourcesContent": ["import { addFallbackToVar } from '../postcss-plugins/ds-token-fallbacks.mjs';\n\n/**\n * Vite plugin that injects design-system token fallbacks into JS/TS files.\n *\n * Replaces bare `var(--wpds-*)` references in string literals with\n * `var(--wpds-*, <fallback>)` so components render correctly without\n * a ThemeProvider.\n */\nconst plugin = () => ( {\n\tname: 'ds-token-fallbacks-js',\n\ttransform( code, id ) {\n\t\tif ( ! /\\.[mc]?[jt]sx?$/.test( id ) ) {\n\t\t\treturn null;\n\t\t}\n\t\tif ( id.includes( 'node_modules' ) ) {\n\t\t\treturn null;\n\t\t}\n\t\tif ( ! code.includes( '--wpds-' ) ) {\n\t\t\treturn null;\n\t\t}\n\t\t// Sourcemap omitted: replacements are small, inline substitutions\n\t\t// that preserve line structure, so the debugging impact is negligible.\n\t\treturn {\n\t\t\tcode: addFallbackToVar( code, { escapeQuotes: true } ),\n\t\t\tmap: null,\n\t\t};\n\t},\n} );\n\nexport default plugin;\n"],
5
+ "mappings": ";AAAA,SAAS,wBAAwB;AASjC,IAAM,SAAS,OAAQ;AAAA,EACtB,MAAM;AAAA,EACN,UAAW,MAAM,IAAK;AACrB,QAAK,CAAE,kBAAkB,KAAM,EAAG,GAAI;AACrC,aAAO;AAAA,IACR;AACA,QAAK,GAAG,SAAU,cAAe,GAAI;AACpC,aAAO;AAAA,IACR;AACA,QAAK,CAAE,KAAK,SAAU,SAAU,GAAI;AACnC,aAAO;AAAA,IACR;AAGA,WAAO;AAAA,MACN,MAAM,iBAAkB,MAAM,EAAE,cAAc,KAAK,CAAE;AAAA,MACrD,KAAK;AAAA,IACN;AAAA,EACD;AACD;AAEA,IAAO,kCAAQ;",
6
6
  "names": []
7
7
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/color-ramps/stories/index.story.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAS5D,QAAA,MAAM,QAAQ,GAAK,OAAO;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC1B,gCAEA,CAAC;AAEF,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,QAAQ,CAmBhC,CAAC;AACF,eAAe,IAAI,CAAC;AAEpB,eAAO,MAAM,OAAO,EAAE,QAAQ,CAAE,OAAO,QAAQ,CA+H9C,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAE,OAAO,QAAQ,CA4FzD,CAAC"}
1
+ {"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/color-ramps/stories/index.story.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAS5D,QAAA,MAAM,QAAQ,GAAK,OAAO;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC1B,gCAEA,CAAC;AAEF,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,QAAQ,CAkBhC,CAAC;AACF,eAAe,IAAI,CAAC;AAEpB,eAAO,MAAM,OAAO,EAAE,QAAQ,CAAE,OAAO,QAAQ,CA+H9C,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAE,OAAO,QAAQ,CA4FzD,CAAC"}
@@ -9,9 +9,15 @@
9
9
  * NOTE: The regex and replacement logic here is mirrored in
10
10
  * `ds-token-fallbacks.mjs`. If you update one, update the other to match.
11
11
  *
12
- * @param cssValue A CSS declaration value.
13
- * @param tokenFallbacks Map of CSS variable names to their fallback expressions.
14
- * @return The value with fallbacks injected.
12
+ * @param cssValue A CSS declaration value.
13
+ * @param tokenFallbacks Map of CSS variable names to their fallback expressions.
14
+ * @param options Options.
15
+ * @param options.escapeQuotes When true, escape `"` and `'` in fallback values.
16
+ * Use this when the input is JS/TS source so that
17
+ * injected quotes don't break string literals.
18
+ * @return The value with fallbacks injected.
15
19
  */
16
- export declare function addFallbackToVar(cssValue: string, tokenFallbacks: Record<string, string>): string;
20
+ export declare function addFallbackToVar(cssValue: string, tokenFallbacks: Record<string, string>, { escapeQuotes }?: {
21
+ escapeQuotes?: boolean;
22
+ }): string;
17
23
  //# sourceMappingURL=add-fallback-to-var.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"add-fallback-to-var.d.ts","sourceRoot":"","sources":["../../src/postcss-plugins/add-fallback-to-var.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAC/B,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,MAAM,CAAE,MAAM,EAAE,MAAM,CAAE,GACtC,MAAM,CAUR"}
1
+ {"version":3,"file":"add-fallback-to-var.d.ts","sourceRoot":"","sources":["../../src/postcss-plugins/add-fallback-to-var.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,gBAAgB,CAC/B,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,MAAM,CAAE,MAAM,EAAE,MAAM,CAAE,EACxC,EAAE,YAAoB,EAAE,GAAE;IAAE,YAAY,CAAC,EAAE,OAAO,CAAA;CAAO,GACvD,MAAM,CAgBR"}
@@ -8,8 +8,18 @@
8
8
  * NOTE: The regex and replacement logic here mirrors `add-fallback-to-var.ts`.
9
9
  * If you update one, update the other to match.
10
10
  *
11
- * @param {string} cssValue A CSS declaration value.
12
- * @return {string} The value with fallbacks injected.
11
+ * @param {string} cssValue A CSS declaration value.
12
+ * @param {Object} [options] Options.
13
+ * @param {boolean} [options.escapeQuotes] When true, escape `"` and `'` in
14
+ * fallback values. Use this when the
15
+ * input is JS/TS source so that
16
+ * injected quotes don't break string
17
+ * literals. JS will unescape them at
18
+ * parse time, so the browser's CSS
19
+ * engine still sees the correct value.
20
+ * @return {string} The value with fallbacks injected.
13
21
  */
14
- export function addFallbackToVar(cssValue: string): string;
22
+ export function addFallbackToVar(cssValue: string, { escapeQuotes }?: {
23
+ escapeQuotes?: boolean | undefined;
24
+ }): string;
15
25
  //# sourceMappingURL=ds-token-fallbacks.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ds-token-fallbacks.d.mts","sourceRoot":"","sources":["../../src/postcss-plugins/ds-token-fallbacks.mjs"],"names":[],"mappings":"AAKA;;;;;;;;;;;;GAYG;AACH,2CAHW,MAAM,GACL,MAAM,CAYjB"}
1
+ {"version":3,"file":"ds-token-fallbacks.d.mts","sourceRoot":"","sources":["../../src/postcss-plugins/ds-token-fallbacks.mjs"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,2CAXW,MAAM,qBAEd;IAA0B,YAAY;CAOtC,GAAS,MAAM,CAkBjB"}
@@ -0,0 +1,4 @@
1
+ declare const _default: stylelint.Plugin;
2
+ export default _default;
3
+ import stylelint from 'stylelint';
4
+ //# sourceMappingURL=no-token-fallback-values.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-token-fallback-values.d.mts","sourceRoot":"","sources":["../../src/stylelint-plugins/no-token-fallback-values.mjs"],"names":[],"mappings":";;sBAAsB,WAAW"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/theme",
3
- "version": "0.8.1-next.v.202603161435.0+ab4981c4f",
3
+ "version": "0.9.0",
4
4
  "description": "Theme and context provider for the WordPress Design System.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -68,6 +68,11 @@
68
68
  "import": "./src/stylelint-plugins/no-setting-wpds-custom-properties.mjs",
69
69
  "default": "./build/stylelint-plugins/no-setting-wpds-custom-properties.cjs"
70
70
  },
71
+ "./stylelint-plugins/no-token-fallback-values": {
72
+ "types": "./build-types/stylelint-plugins/no-token-fallback-values.d.ts",
73
+ "import": "./src/stylelint-plugins/no-token-fallback-values.mjs",
74
+ "default": "./build/stylelint-plugins/no-token-fallback-values.cjs"
75
+ },
71
76
  "./package.json": "./package.json"
72
77
  },
73
78
  "react-native": "src/index",
@@ -79,13 +84,13 @@
79
84
  "build-module/color-ramps/lib/register-color-spaces.mjs"
80
85
  ],
81
86
  "dependencies": {
82
- "@wordpress/element": "^6.41.1-next.v.202603161435.0+ab4981c4f",
83
- "@wordpress/private-apis": "^1.41.1-next.v.202603161435.0+ab4981c4f",
87
+ "@wordpress/element": "^6.42.0",
88
+ "@wordpress/private-apis": "^1.42.0",
84
89
  "colorjs.io": "^0.6.0",
85
90
  "memize": "^2.1.0"
86
91
  },
87
92
  "devDependencies": {
88
- "@storybook/react-vite": "^10.1.11",
93
+ "@storybook/react-vite": "^10.2.8",
89
94
  "@terrazzo/cli": "^0.10.2",
90
95
  "@terrazzo/plugin-css": "^0.10.2",
91
96
  "@terrazzo/token-tools": "^0.10.2",
@@ -94,7 +99,7 @@
94
99
  "@types/node": "^20.17.10",
95
100
  "esbuild": "^0.27.2",
96
101
  "esbuild-esm-loader": "^0.3.3",
97
- "storybook": "^10.1.11"
102
+ "storybook": "^10.2.8"
98
103
  },
99
104
  "peerDependencies": {
100
105
  "react": "^18.0.0",
@@ -116,5 +121,5 @@
116
121
  "build": "npm run build:tokens && npm run build:default-ramps && npm run prelint:js",
117
122
  "postbuild": "prettier --write tokens/color.json tokens/modes src/prebuilt src/color-ramps/lib/default-ramps.ts docs"
118
123
  },
119
- "gitHead": "748f4e4564fcc0e6ae90200d90bb993a3cef5828"
124
+ "gitHead": "c20787b1778ae64c2db65643b1c236309d68e6ba"
120
125
  }
@@ -36,7 +36,6 @@ const meta: Meta< typeof ColorGen > = {
36
36
  controls: { expanded: true },
37
37
  docs: { canvas: { sourceState: 'shown' } },
38
38
  },
39
- tags: [ 'status-experimental' ],
40
39
  };
41
40
  export default meta;
42
41
 
@@ -37,7 +37,7 @@ const plugin = {
37
37
  const ext = args.path.match( /(\.[^.]+)$/ )?.[ 1 ] || '.js';
38
38
 
39
39
  return {
40
- contents: addFallbackToVar( source ),
40
+ contents: addFallbackToVar( source, { escapeQuotes: true } ),
41
41
  loader: LOADER_MAP[ ext ] || 'jsx',
42
42
  };
43
43
  } );
@@ -9,21 +9,32 @@
9
9
  * NOTE: The regex and replacement logic here is mirrored in
10
10
  * `ds-token-fallbacks.mjs`. If you update one, update the other to match.
11
11
  *
12
- * @param cssValue A CSS declaration value.
13
- * @param tokenFallbacks Map of CSS variable names to their fallback expressions.
14
- * @return The value with fallbacks injected.
12
+ * @param cssValue A CSS declaration value.
13
+ * @param tokenFallbacks Map of CSS variable names to their fallback expressions.
14
+ * @param options Options.
15
+ * @param options.escapeQuotes When true, escape `"` and `'` in fallback values.
16
+ * Use this when the input is JS/TS source so that
17
+ * injected quotes don't break string literals.
18
+ * @return The value with fallbacks injected.
15
19
  */
16
20
  export function addFallbackToVar(
17
21
  cssValue: string,
18
- tokenFallbacks: Record< string, string >
22
+ tokenFallbacks: Record< string, string >,
23
+ { escapeQuotes = false }: { escapeQuotes?: boolean } = {}
19
24
  ): string {
20
25
  return cssValue.replace(
21
26
  /var\(\s*(--wpds-[\w-]+)\s*\)/g,
22
27
  ( match, tokenName: string ) => {
23
- const fallback = tokenFallbacks[ tokenName ];
24
- return fallback !== undefined
25
- ? `var(${ tokenName }, ${ fallback })`
26
- : match;
28
+ let fallback = tokenFallbacks[ tokenName ];
29
+ if ( fallback === undefined ) {
30
+ return match;
31
+ }
32
+ if ( escapeQuotes ) {
33
+ fallback = fallback
34
+ .replaceAll( '"', '\\"' )
35
+ .replaceAll( "'", "\\'" );
36
+ }
37
+ return `var(${ tokenName }, ${ fallback })`;
27
38
  }
28
39
  );
29
40
  }
@@ -13,17 +13,31 @@ const tokenFallbacks = _tokenFallbacks;
13
13
  * NOTE: The regex and replacement logic here mirrors `add-fallback-to-var.ts`.
14
14
  * If you update one, update the other to match.
15
15
  *
16
- * @param {string} cssValue A CSS declaration value.
17
- * @return {string} The value with fallbacks injected.
16
+ * @param {string} cssValue A CSS declaration value.
17
+ * @param {Object} [options] Options.
18
+ * @param {boolean} [options.escapeQuotes] When true, escape `"` and `'` in
19
+ * fallback values. Use this when the
20
+ * input is JS/TS source so that
21
+ * injected quotes don't break string
22
+ * literals. JS will unescape them at
23
+ * parse time, so the browser's CSS
24
+ * engine still sees the correct value.
25
+ * @return {string} The value with fallbacks injected.
18
26
  */
19
- export function addFallbackToVar( cssValue ) {
27
+ export function addFallbackToVar( cssValue, { escapeQuotes = false } = {} ) {
20
28
  return cssValue.replace(
21
29
  /var\(\s*(--wpds-[\w-]+)\s*\)/g,
22
30
  ( match, tokenName ) => {
23
- const fallback = tokenFallbacks[ tokenName ];
24
- return fallback !== undefined
25
- ? `var(${ tokenName }, ${ fallback })`
26
- : match;
31
+ let fallback = tokenFallbacks[ tokenName ];
32
+ if ( fallback === undefined ) {
33
+ return match;
34
+ }
35
+ if ( escapeQuotes ) {
36
+ fallback = fallback
37
+ .replaceAll( '"', '\\"' )
38
+ .replaceAll( "'", "\\'" );
39
+ }
40
+ return `var(${ tokenName }, ${ fallback })`;
27
41
  }
28
42
  );
29
43
  }
@@ -8,6 +8,9 @@ const mockFallbacks: Record< string, string > = {
8
8
  'var(--wp-admin-theme-color, #3858e9)',
9
9
  '--wpds-color-bg-interactive-brand-strong-active':
10
10
  'color-mix(in oklch, var(--wp-admin-theme-color, #3858e9) 92%, black)',
11
+ '--wpds-font-family-body':
12
+ '-apple-system, system-ui, "Segoe UI", "Roboto", "Oxygen-Sans", "Ubuntu", "Cantarell", "Helvetica Neue", sans-serif',
13
+ '--wpds-font-family-mono': '"Menlo", "Consolas", monaco, monospace',
11
14
  };
12
15
 
13
16
  describe( 'addFallbackToVar', () => {
@@ -88,4 +91,53 @@ describe( 'addFallbackToVar', () => {
88
91
  const second = addFallbackToVar( first, mockFallbacks );
89
92
  expect( second ).toBe( first );
90
93
  } );
94
+
95
+ describe( 'escapeQuotes', () => {
96
+ it( 'does not escape quotes by default', () => {
97
+ expect(
98
+ addFallbackToVar(
99
+ 'var(--wpds-font-family-body)',
100
+ mockFallbacks
101
+ )
102
+ ).toBe(
103
+ 'var(--wpds-font-family-body, -apple-system, system-ui, "Segoe UI", "Roboto", "Oxygen-Sans", "Ubuntu", "Cantarell", "Helvetica Neue", sans-serif)'
104
+ );
105
+ } );
106
+
107
+ it( 'escapes double quotes when enabled', () => {
108
+ expect(
109
+ addFallbackToVar(
110
+ 'var(--wpds-font-family-mono)',
111
+ mockFallbacks,
112
+ { escapeQuotes: true }
113
+ )
114
+ ).toBe(
115
+ 'var(--wpds-font-family-mono, \\"Menlo\\", \\"Consolas\\", monaco, monospace)'
116
+ );
117
+ } );
118
+
119
+ it( 'escapes both double and single quotes in the same value', () => {
120
+ const fallbacks: Record< string, string > = {
121
+ '--wpds-test-token': `"double" and 'single'`,
122
+ };
123
+ const result = addFallbackToVar(
124
+ 'var(--wpds-test-token)',
125
+ fallbacks,
126
+ { escapeQuotes: true }
127
+ );
128
+ expect( result ).toBe(
129
+ `var(--wpds-test-token, \\"double\\" and \\'single\\')`
130
+ );
131
+ } );
132
+
133
+ it( 'leaves values without quotes unchanged when enabled', () => {
134
+ expect(
135
+ addFallbackToVar(
136
+ 'var(--wpds-border-radius-sm)',
137
+ mockFallbacks,
138
+ { escapeQuotes: true }
139
+ )
140
+ ).toBe( 'var(--wpds-border-radius-sm, 2px)' );
141
+ } );
142
+ } );
91
143
  } );
@@ -34,7 +34,7 @@ const meta: Meta< typeof ThemeProvider > = {
34
34
  controls: { expanded: true },
35
35
  docs: { canvas: { sourceState: 'shown' } },
36
36
  },
37
- tags: [ 'status-experimental' ],
37
+ tags: [ 'status-private' ],
38
38
  };
39
39
  export default meta;
40
40
 
@@ -0,0 +1,55 @@
1
+ import stylelint from 'stylelint';
2
+
3
+ const {
4
+ createPlugin,
5
+ utils: { report, ruleMessages, validateOptions },
6
+ } = stylelint;
7
+
8
+ const ruleName = 'plugin-wpds/no-token-fallback-values';
9
+
10
+ /**
11
+ * Matches `var(--wpds-<name>,` — the comma signals a fallback value.
12
+ * Captures the token name (e.g. `--wpds-color-fg-content-neutral`).
13
+ */
14
+ const varWithFallbackRegex = /var\(\s*(--wpds-[\w-]+)\s*,/g;
15
+
16
+ const messages = ruleMessages( ruleName, {
17
+ rejected: ( tokenName ) =>
18
+ `Do not add a fallback value for Design System token '${ tokenName }'. Fallbacks are injected automatically at build time.`,
19
+ } );
20
+
21
+ /** @type {import('stylelint').Rule} */
22
+ const ruleFunction = ( primary ) => {
23
+ return ( root, result ) => {
24
+ const validOptions = validateOptions( result, ruleName, {
25
+ actual: primary,
26
+ possible: [ true ],
27
+ } );
28
+
29
+ if ( ! validOptions ) {
30
+ return;
31
+ }
32
+
33
+ root.walkDecls( ( ruleNode ) => {
34
+ const { value } = ruleNode;
35
+
36
+ let match;
37
+ varWithFallbackRegex.lastIndex = 0;
38
+ while ( ( match = varWithFallbackRegex.exec( value ) ) !== null ) {
39
+ report( {
40
+ message: messages.rejected( match[ 1 ] ),
41
+ node: ruleNode,
42
+ word: match[ 0 ],
43
+ result,
44
+ ruleName,
45
+ } );
46
+ }
47
+ } );
48
+ };
49
+ };
50
+
51
+ ruleFunction.ruleName = ruleName;
52
+ ruleFunction.messages = messages;
53
+
54
+ /** @type {import('stylelint').Plugin} */
55
+ export default createPlugin( ruleName, ruleFunction );
@@ -0,0 +1,6 @@
1
+ {
2
+ "plugins": [ "../no-setting-wpds-custom-properties.mjs" ],
3
+ "rules": {
4
+ "plugin-wpds/no-setting-wpds-custom-properties": true
5
+ }
6
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "plugins": [ "../no-token-fallback-values.mjs" ],
3
+ "rules": {
4
+ "plugin-wpds/no-token-fallback-values": true
5
+ }
6
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "plugins": [ "../no-unknown-ds-tokens.mjs" ],
3
+ "rules": {
4
+ "plugin-wpds/no-unknown-ds-tokens": true
5
+ }
6
+ }
@@ -0,0 +1,60 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`flags warnings with invalid css (wpds fallbacks) snapshot matches warnings 1`] = `
4
+ [
5
+ {
6
+ "column": 9,
7
+ "endColumn": 45,
8
+ "endLine": 3,
9
+ "line": 3,
10
+ "rule": "plugin-wpds/no-token-fallback-values",
11
+ "severity": "error",
12
+ "text": "Do not add a fallback value for Design System token '--wpds-color-fg-content-neutral'. Fallbacks are injected automatically at build time. (plugin-wpds/no-token-fallback-values)",
13
+ },
14
+ {
15
+ "column": 20,
16
+ "endColumn": 61,
17
+ "endLine": 4,
18
+ "line": 4,
19
+ "rule": "plugin-wpds/no-token-fallback-values",
20
+ "severity": "error",
21
+ "text": "Do not add a fallback value for Design System token '--wpds-color-bg-surface-neutral-weak'. Fallbacks are injected automatically at build time. (plugin-wpds/no-token-fallback-values)",
22
+ },
23
+ {
24
+ "column": 17,
25
+ "endColumn": 45,
26
+ "endLine": 5,
27
+ "line": 5,
28
+ "rule": "plugin-wpds/no-token-fallback-values",
29
+ "severity": "error",
30
+ "text": "Do not add a fallback value for Design System token '--wpds-border-radius-sm'. Fallbacks are injected automatically at build time. (plugin-wpds/no-token-fallback-values)",
31
+ },
32
+ {
33
+ "column": 11,
34
+ "endColumn": 41,
35
+ "endLine": 10,
36
+ "line": 10,
37
+ "rule": "plugin-wpds/no-token-fallback-values",
38
+ "severity": "error",
39
+ "text": "Do not add a fallback value for Design System token '--wpds-border-width-focus'. Fallbacks are injected automatically at build time. (plugin-wpds/no-token-fallback-values)",
40
+ },
41
+ {
42
+ "column": 53,
43
+ "endColumn": 89,
44
+ "endLine": 10,
45
+ "line": 10,
46
+ "rule": "plugin-wpds/no-token-fallback-values",
47
+ "severity": "error",
48
+ "text": "Do not add a fallback value for Design System token '--wpds-color-stroke-focus-brand'. Fallbacks are injected automatically at build time. (plugin-wpds/no-token-fallback-values)",
49
+ },
50
+ {
51
+ "column": 32,
52
+ "endColumn": 68,
53
+ "endLine": 15,
54
+ "line": 15,
55
+ "rule": "plugin-wpds/no-token-fallback-values",
56
+ "severity": "error",
57
+ "text": "Do not add a fallback value for Design System token '--wpds-color-fg-content-neutral'. Fallbacks are injected automatically at build time. (plugin-wpds/no-token-fallback-values)",
58
+ },
59
+ ]
60
+ `;
@@ -0,0 +1,16 @@
1
+ /* Invalid: Using wpds tokens with fallbacks */
2
+ .with-fallback {
3
+ color: var(--wpds-color-fg-content-neutral, #1e1e1e);
4
+ background-color: var(--wpds-color-bg-surface-neutral-weak, #f0f0f0);
5
+ border-radius: var(--wpds-border-radius-sm, 2px);
6
+ }
7
+
8
+ /* Invalid: Fallbacks in complex values */
9
+ .complex {
10
+ outline: var(--wpds-border-width-focus, 2px) solid var(--wpds-color-stroke-focus-brand, #0073aa);
11
+ }
12
+
13
+ /* Invalid: A wpds token with a fallback, even when nested inside another var() */
14
+ .nested-with-fallback {
15
+ color: var(--my-custom-color, var(--wpds-color-fg-content-neutral, #1e1e1e));
16
+ }
@@ -0,0 +1,18 @@
1
+ /* Valid: Using wpds tokens without fallbacks */
2
+ .example {
3
+ color: var(--wpds-color-fg-content-neutral);
4
+ background-color: var(--wpds-color-bg-surface-neutral);
5
+ border-radius: var(--wpds-border-radius-sm);
6
+ padding: var(--wpds-dimension-padding-md);
7
+ }
8
+
9
+ /* Valid: Non-wpds custom properties with fallbacks are fine */
10
+ .other-vars {
11
+ color: var(--my-custom-color, red);
12
+ background: var(--some-other-var, #fff);
13
+ }
14
+
15
+ /* Valid: A wpds token used as a fallback of a non-wpds var, with no comma after the wpds token */
16
+ .nested-no-fallback {
17
+ color: var(--my-custom-color, var(--wpds-color-fg-content-neutral));
18
+ }
@@ -1,11 +1,14 @@
1
1
  import { getStylelintResult } from './utils';
2
2
 
3
+ const CONFIG = './.stylelintrc.no-setting-wpds-custom-properties.json';
4
+
3
5
  describe( 'flags no warnings with valid wpds custom properties css', () => {
4
6
  let result: ReturnType< typeof getStylelintResult >;
5
7
 
6
8
  beforeEach( () => {
7
9
  result = getStylelintResult(
8
- './fixtures/no-setting-wpds-custom-properties-valid.css'
10
+ './fixtures/no-setting-wpds-custom-properties-valid.css',
11
+ CONFIG
9
12
  );
10
13
  } );
11
14
 
@@ -25,7 +28,8 @@ describe( 'flags warnings with invalid wpds custom properties css', () => {
25
28
 
26
29
  beforeEach( () => {
27
30
  result = getStylelintResult(
28
- './fixtures/no-setting-wpds-custom-properties-invalid.css'
31
+ './fixtures/no-setting-wpds-custom-properties-invalid.css',
32
+ CONFIG
29
33
  );
30
34
  } );
31
35
 
@@ -0,0 +1,51 @@
1
+ import { getStylelintResult } from './utils';
2
+
3
+ const CONFIG = './.stylelintrc.no-token-fallback-values.json';
4
+
5
+ describe( 'flags no warnings with valid css (no wpds fallbacks)', () => {
6
+ let result: ReturnType< typeof getStylelintResult >;
7
+
8
+ beforeEach( () => {
9
+ result = getStylelintResult(
10
+ './fixtures/no-token-fallback-values-valid.css',
11
+ CONFIG
12
+ );
13
+ } );
14
+
15
+ it( 'did not error', () => {
16
+ return result.then( ( data ) => expect( data.errored ).toBeFalsy() );
17
+ } );
18
+
19
+ it( 'flags no warnings', () => {
20
+ return result.then( ( data ) =>
21
+ expect( data.results[ 0 ].warnings ).toHaveLength( 0 )
22
+ );
23
+ } );
24
+ } );
25
+
26
+ describe( 'flags warnings with invalid css (wpds fallbacks)', () => {
27
+ let result: ReturnType< typeof getStylelintResult >;
28
+
29
+ beforeEach( () => {
30
+ result = getStylelintResult(
31
+ './fixtures/no-token-fallback-values-invalid.css',
32
+ CONFIG
33
+ );
34
+ } );
35
+
36
+ it( 'did error', () => {
37
+ return result.then( ( data ) => expect( data.errored ).toBeTruthy() );
38
+ } );
39
+
40
+ it( 'flags correct number of warnings', () => {
41
+ return result.then( ( data ) =>
42
+ expect( data.results[ 0 ].warnings ).toHaveLength( 6 )
43
+ );
44
+ } );
45
+
46
+ it( 'snapshot matches warnings', () => {
47
+ return result.then( ( data ) =>
48
+ expect( data.results[ 0 ].warnings ).toMatchSnapshot()
49
+ );
50
+ } );
51
+ } );
@@ -1,11 +1,14 @@
1
1
  import { getStylelintResult } from './utils';
2
2
 
3
+ const CONFIG = './.stylelintrc.no-unknown-ds-tokens.json';
4
+
3
5
  describe( 'flags no warnings with valid wpds tokens css', () => {
4
6
  let result: ReturnType< typeof getStylelintResult >;
5
7
 
6
8
  beforeEach( () => {
7
9
  result = getStylelintResult(
8
- './fixtures/no-unknown-ds-tokens-valid.css'
10
+ './fixtures/no-unknown-ds-tokens-valid.css',
11
+ CONFIG
9
12
  );
10
13
  } );
11
14
 
@@ -25,7 +28,8 @@ describe( 'flags warnings with invalid wpds tokens css', () => {
25
28
 
26
29
  beforeEach( () => {
27
30
  result = getStylelintResult(
28
- './fixtures/no-unknown-ds-tokens-invalid.css'
31
+ './fixtures/no-unknown-ds-tokens-invalid.css',
32
+ CONFIG
29
33
  );
30
34
  } );
31
35
 
@@ -4,17 +4,20 @@ import childProcess from 'node:child_process';
4
4
 
5
5
  const execute = util.promisify( childProcess.exec );
6
6
 
7
- const generateStylelintCommand = ( filename: string ): string =>
7
+ const generateStylelintCommand = (
8
+ filename: string,
9
+ configFile: string
10
+ ): string =>
8
11
  'npx stylelint ' +
9
12
  path.resolve( __dirname, '../', filename ) +
10
13
  ' -c ' +
11
- path.resolve( __dirname, '../', './.stylelintrc.json' ) +
14
+ path.resolve( __dirname, '../', configFile ) +
12
15
  ' --formatter json' +
13
16
  ' --ignore-path ' +
14
17
  path.resolve( __dirname, '../', './.stylelintignore' );
15
18
 
16
- export const getStylelintResult = ( filename: string ) =>
17
- execute( generateStylelintCommand( filename ) )
19
+ export const getStylelintResult = ( filename: string, configFile: string ) =>
20
+ execute( generateStylelintCommand( filename, configFile ) )
18
21
  .then( ( { stderr } ) => {
19
22
  return {
20
23
  errored: false,
@@ -21,7 +21,10 @@ const plugin = () => ( {
21
21
  }
22
22
  // Sourcemap omitted: replacements are small, inline substitutions
23
23
  // that preserve line structure, so the debugging impact is negligible.
24
- return { code: addFallbackToVar( code ), map: null };
24
+ return {
25
+ code: addFallbackToVar( code, { escapeQuotes: true } ),
26
+ map: null,
27
+ };
25
28
  },
26
29
  } );
27
30
 
@@ -1,10 +0,0 @@
1
- {
2
- "plugins": [
3
- "../no-unknown-ds-tokens.mjs",
4
- "../no-setting-wpds-custom-properties.mjs"
5
- ],
6
- "rules": {
7
- "plugin-wpds/no-unknown-ds-tokens": true,
8
- "plugin-wpds/no-setting-wpds-custom-properties": true
9
- }
10
- }