@astryxdesign/cli 0.1.3-canary.73bcac9 → 0.1.3-canary.a18ca6b

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astryxdesign/cli",
3
- "version": "0.1.3-canary.73bcac9",
3
+ "version": "0.1.3-canary.a18ca6b",
4
4
  "displayName": "CLI",
5
5
  "description": "Scaffold projects, browse templates, generate themes, and get agent-ready docs from the command line.",
6
6
  "author": "Meta Open Source",
@@ -75,9 +75,9 @@
75
75
  "zod": "^4.4.3"
76
76
  },
77
77
  "peerDependencies": {
78
- "@astryxdesign/core": "0.1.3-canary.73bcac9",
79
- "@astryxdesign/lab": "0.1.3-canary.73bcac9",
80
- "@astryxdesign/theme-neutral": "0.1.3-canary.73bcac9",
78
+ "@astryxdesign/core": "0.1.3-canary.a18ca6b",
79
+ "@astryxdesign/lab": "0.1.3-canary.a18ca6b",
80
+ "@astryxdesign/theme-neutral": "0.1.3-canary.a18ca6b",
81
81
  "gpt-tokenizer": "^2.0.0"
82
82
  },
83
83
  "peerDependenciesMeta": {
@@ -92,9 +92,9 @@
92
92
  }
93
93
  },
94
94
  "devDependencies": {
95
- "@astryxdesign/core": "0.1.3-canary.73bcac9",
96
- "@astryxdesign/lab": "0.1.3-canary.73bcac9",
97
- "@astryxdesign/theme-neutral": "0.1.3-canary.73bcac9",
95
+ "@astryxdesign/core": "0.1.3-canary.a18ca6b",
96
+ "@astryxdesign/lab": "0.1.3-canary.a18ca6b",
97
+ "@astryxdesign/theme-neutral": "0.1.3-canary.a18ca6b",
98
98
  "gpt-tokenizer": "^2.0.0"
99
99
  },
100
100
  "scripts": {
@@ -7,9 +7,20 @@
7
7
  import {discoverComponents, findComponentReadme, resolveImportPath} from './component-discovery.mjs';
8
8
  import {loadDocs} from './component-loader.mjs';
9
9
 
10
- /** Derive the theme component key from a theming target (strips 'xds-' prefix). */
10
+ /**
11
+ * Derive the `defineTheme` component-override key from a theming target.
12
+ *
13
+ * Override keys are the component's stable class name with the `astryx-`
14
+ * namespace prefix stripped — `generateThemeRules` re-adds the prefix when it
15
+ * builds the `.astryx-*` selector. So `astryx-base-table` → key `base-table`
16
+ * (→ `.astryx-base-table`), and `astryx-button` → key `button`.
17
+ *
18
+ * Keep the `astryx-` literal in sync with packages/core/src/naming.ts
19
+ * (NAMESPACE / classPrefix), the same way build-theme.mjs mirrors it.
20
+ * <!-- SYNC: packages/core/src/naming.ts (namespace prefix source of truth) -->
21
+ */
11
22
  function targetKey(target) {
12
- return target.className.replace(/^xds-/, '');
23
+ return target.className.replace(/^astryx-/, '');
13
24
  }
14
25
 
15
26
  function dataAttrForName(name) {
@@ -51,3 +51,45 @@ describe('formatFull sub-component rendering', () => {
51
51
  expect(out).not.toContain('astryx component XDSButtonGroup');
52
52
  });
53
53
  });
54
+
55
+ describe('formatFull theming override keys', () => {
56
+ // Regression guard: the `defineTheme` component-override key is the stable
57
+ // class name with the `astryx-` prefix stripped — `generateThemeRules`
58
+ // re-adds the prefix to build the `.astryx-*` selector. targetKey() used to
59
+ // strip a dead `xds-` prefix (from before the astryx rename), so the printed
60
+ // example advertised `astryx-*` keys. Those double-prefix to
61
+ // `.astryx-astryx-*` at runtime and silently match nothing. See issue #3458.
62
+ it('prints override keys without the astryx- prefix (single-word component)', () => {
63
+ const docs = {
64
+ name: 'Button',
65
+ description: 'A button.',
66
+ theming: {targets: [{className: 'astryx-button', visualProps: ['variant']}]},
67
+ };
68
+ const out = formatFull(docs);
69
+
70
+ expect(out).toContain("'button': {");
71
+ // The full DOM class must not appear as an override key.
72
+ expect(out).not.toContain("'astryx-button': {");
73
+ });
74
+
75
+ it('prints override keys without the astryx- prefix (compound Table classes)', () => {
76
+ const docs = {
77
+ name: 'Table',
78
+ description: 'A table.',
79
+ theming: {
80
+ targets: [
81
+ {className: 'astryx-base-table'},
82
+ {className: 'astryx-table-cell'},
83
+ ],
84
+ },
85
+ };
86
+ const out = formatFull(docs);
87
+
88
+ // Correct keys: class name minus the astryx- prefix.
89
+ expect(out).toContain("'base-table': {");
90
+ expect(out).toContain("'table-cell': {");
91
+ // The verbatim DOM class names must not be advertised as override keys.
92
+ expect(out).not.toContain("'astryx-base-table': {");
93
+ expect(out).not.toContain("'astryx-table-cell': {");
94
+ });
95
+ });