@astryxdesign/cli 0.7.9-canary.97b1bb0 → 0.7.9-canary.98efdf1
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/README.md +1 -1
- package/api/component/__fixtures__/resolutions/modules.txt +1 -1
- package/api/swizzle/copy/copy.d.mts +17 -1
- package/api/swizzle/copy/copy.mjs +240 -5
- package/api/swizzle/swizzle.doc.mjs +1 -1
- package/api/swizzle/swizzle.type.mjs +1 -1
- package/api/theme/build/build.mjs +29 -1
- package/assets/docs/author-a-theme.doc.mjs +3 -1
- package/assets/docs/icons.doc.mjs +29 -0
- package/assets/docs/motion.doc.mjs +1 -1
- package/assets/templates/blocks/components/Hooks/useMergedRefsHookUsage.doc.mjs +14 -0
- package/assets/templates/blocks/components/Hooks/useMergedRefsHookUsage.tsx +78 -0
- package/assets/templates/blocks/components/Hooks/useScrollOverflowHookUsage.doc.mjs +14 -0
- package/assets/templates/blocks/components/Hooks/useScrollOverflowHookUsage.tsx +94 -0
- package/assets/templates/blocks/components/Link/useLinkComponentHookUsage.doc.mjs +14 -0
- package/assets/templates/blocks/components/Link/useLinkComponentHookUsage.tsx +89 -0
- package/assets/templates/blocks/components/usePanGesture/PanDraggableBox.doc.mjs +15 -0
- package/assets/templates/blocks/components/usePanGesture/PanDraggableBox.tsx +98 -0
- package/assets/templates/blocks/components/usePanGesture/PanPlayingCard.doc.mjs +14 -0
- package/assets/templates/blocks/components/usePanGesture/PanPlayingCard.tsx +147 -0
- package/assets/theme.template.ts +11 -2
- package/authoring/doctypes/base/type.ts +41 -0
- package/authoring/doctypes/component/component.doc.mjs +7 -1
- package/authoring/doctypes/component/type.ts +5 -0
- package/authoring/index.d.ts +2 -0
- package/clients/cli/commands/swizzle.mjs +10 -0
- package/clients/cli/lib/component-format.mjs +49 -0
- package/foundation/response/response-types.doc.mjs +1 -1
- package/package.json +9 -9
|
@@ -10,6 +10,7 @@ import type {
|
|
|
10
10
|
ComponentAnatomyElement,
|
|
11
11
|
ComponentBestPractice,
|
|
12
12
|
ComponentExampleDoc,
|
|
13
|
+
ComponentIconSlotDoc,
|
|
13
14
|
ComponentPlaygroundConfig,
|
|
14
15
|
ComponentPropDoc,
|
|
15
16
|
ComponentThemingDerivedVar,
|
|
@@ -162,6 +163,10 @@ export interface ComponentBaseDoc extends AuthoredDocGraphFields {
|
|
|
162
163
|
* on this component, also emit the internal var.
|
|
163
164
|
* @see ComponentThemingDerivedVar */
|
|
164
165
|
derived?: ComponentThemingDerivedVar[];
|
|
166
|
+
/** Component icon slots this component resolves through the theme's
|
|
167
|
+
* `componentIcons`. Each entry corresponds to a slot in
|
|
168
|
+
* `ComponentIconSlotMap`. */
|
|
169
|
+
componentIcons?: ComponentIconSlotDoc[];
|
|
165
170
|
};
|
|
166
171
|
/** Component usage documentation — concise summary, best practices,
|
|
167
172
|
* and optional visual anatomy. */
|
package/authoring/index.d.ts
CHANGED
|
@@ -90,6 +90,16 @@ export function registerSwizzle(program) {
|
|
|
90
90
|
].join('\n'),
|
|
91
91
|
),
|
|
92
92
|
];
|
|
93
|
+
// Files the copy wrote outside the component folder: the owner modules
|
|
94
|
+
// and their unexported style modules (spec:AST-110 FR4).
|
|
95
|
+
const shared = (result.data.files ?? []).filter(f => f.startsWith('../'));
|
|
96
|
+
if (shared.length > 0) {
|
|
97
|
+
out.push(
|
|
98
|
+
text(
|
|
99
|
+
`Shared modules: ${shared.join(', ')} (copied whole; their imports between each other stay relative)`,
|
|
100
|
+
),
|
|
101
|
+
);
|
|
102
|
+
}
|
|
93
103
|
|
|
94
104
|
// StyleX build requirement — swizzled StyleX source throws on import
|
|
95
105
|
// ("Unexpected 'stylex.create' call at runtime") unless the consumer's
|
|
@@ -163,6 +163,34 @@ function getTargetStates(target) {
|
|
|
163
163
|
return target.states || [];
|
|
164
164
|
}
|
|
165
165
|
|
|
166
|
+
/**
|
|
167
|
+
* Format a component's icon slots: the `componentIcons` keys a theme sets,
|
|
168
|
+
* with each slot's state, fallback, and what `null` does.
|
|
169
|
+
* @param {any[]} slots - `theming.componentIcons` entries.
|
|
170
|
+
* @returns {string}
|
|
171
|
+
*/
|
|
172
|
+
function formatComponentIconSlots(slots) {
|
|
173
|
+
const lines = [
|
|
174
|
+
'**Component icon slots** - set in `defineTheme({componentIcons})` to a shared icon name, `null`, a partial `{icon, variant, size}` request, or a function of the slot state.\n',
|
|
175
|
+
'| Slot | State | Fallback | Role | `null` |',
|
|
176
|
+
'|------|-------|----------|------|--------|',
|
|
177
|
+
];
|
|
178
|
+
for (const slot of slots) {
|
|
179
|
+
const state = slot.state?.length
|
|
180
|
+
? slot.state
|
|
181
|
+
.map(
|
|
182
|
+
(/** @type {any} */ field) =>
|
|
183
|
+
`\`${mdCell(field.name)}: ${mdCell(field.type)}\` ${mdCell(field.description)}`,
|
|
184
|
+
)
|
|
185
|
+
.join('<br>')
|
|
186
|
+
: 'none';
|
|
187
|
+
lines.push(
|
|
188
|
+
`| \`${mdCell(slot.slot)}\` | ${state} | ${mdCell(slot.fallback)} | ${mdCell(slot.description)} | ${mdCell(slot.whenNull)} |`,
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
return lines.join('\n') + '\n';
|
|
192
|
+
}
|
|
193
|
+
|
|
166
194
|
/**
|
|
167
195
|
* Format the theming targets table, merging in theme variants if available.
|
|
168
196
|
*
|
|
@@ -351,6 +379,10 @@ export function formatFull(docs, options = {}) {
|
|
|
351
379
|
}
|
|
352
380
|
}
|
|
353
381
|
|
|
382
|
+
if (docs.theming.componentIcons?.length) {
|
|
383
|
+
sections.push(formatComponentIconSlots(docs.theming.componentIcons));
|
|
384
|
+
}
|
|
385
|
+
|
|
354
386
|
// Legacy componentKey (for backward compatibility)
|
|
355
387
|
if (docs.theming.componentKey) {
|
|
356
388
|
sections.push(`Component key: \`${docs.theming.componentKey}\`\n`);
|
|
@@ -507,6 +539,11 @@ export function formatCompact(docs, componentName, importHint) {
|
|
|
507
539
|
sections.push(propLines.join('\n') + '\n');
|
|
508
540
|
}
|
|
509
541
|
|
|
542
|
+
if (docs.theming?.componentIcons?.length) {
|
|
543
|
+
sections.push('## Component Icon Slots\n');
|
|
544
|
+
sections.push(formatComponentIconSlots(docs.theming.componentIcons));
|
|
545
|
+
}
|
|
546
|
+
|
|
510
547
|
return sections.join('\n');
|
|
511
548
|
}
|
|
512
549
|
|
|
@@ -626,6 +663,18 @@ export function formatBrief(docs, componentName, importHint, options = {}) {
|
|
|
626
663
|
output.push(` Derived: ${derivedNames}`);
|
|
627
664
|
}
|
|
628
665
|
|
|
666
|
+
// Component icon slots, with the state each slot function receives
|
|
667
|
+
if (docs.theming?.componentIcons?.length) {
|
|
668
|
+
const slots = docs.theming.componentIcons
|
|
669
|
+
.map((/** @type {any} */ slot) =>
|
|
670
|
+
slot.state?.length
|
|
671
|
+
? `${slot.slot} {${slot.state.map((/** @type {any} */ field) => `${field.name}: ${field.type}`).join(', ')}}`
|
|
672
|
+
: slot.slot,
|
|
673
|
+
)
|
|
674
|
+
.join('; ');
|
|
675
|
+
output.push(` Icon slots: ${slots}`);
|
|
676
|
+
}
|
|
677
|
+
|
|
629
678
|
// Theme targets (component class, preferred data attrs, props, states) with theme variant merging
|
|
630
679
|
if (docs.theming?.targets?.length) {
|
|
631
680
|
const {themeData = null} = options;
|
|
@@ -262,7 +262,7 @@ export const doc = {
|
|
|
262
262
|
{
|
|
263
263
|
value: 'swizzle.copy',
|
|
264
264
|
description:
|
|
265
|
-
"An eject receipt: component name, owning package, output directory, files-copied count, the
|
|
265
|
+
"An eject receipt: component name, owning package, output directory, files-copied count, the copied file names (relative to the component folder; owner modules copied beside it start with ../), whether any file uses StyleX, and, when the owner has an issues URL, feedback ({issuesUrl, ghCommand?}): where to report the gap that led to swizzling. The envelope's package names the same owning package.",
|
|
266
266
|
},
|
|
267
267
|
|
|
268
268
|
// gap reports
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astryxdesign/cli",
|
|
3
|
-
"version": "0.7.9-canary.
|
|
3
|
+
"version": "0.7.9-canary.98efdf1",
|
|
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",
|
|
@@ -124,10 +124,10 @@
|
|
|
124
124
|
"zod": "^4.4.3"
|
|
125
125
|
},
|
|
126
126
|
"peerDependencies": {
|
|
127
|
-
"@astryxdesign/charts": "0.7.9-canary.
|
|
128
|
-
"@astryxdesign/core": "0.7.9-canary.
|
|
129
|
-
"@astryxdesign/lab": "0.7.9-canary.
|
|
130
|
-
"@astryxdesign/theme-neutral": "0.7.9-canary.
|
|
127
|
+
"@astryxdesign/charts": "0.7.9-canary.98efdf1",
|
|
128
|
+
"@astryxdesign/core": "0.7.9-canary.98efdf1",
|
|
129
|
+
"@astryxdesign/lab": "0.7.9-canary.98efdf1",
|
|
130
|
+
"@astryxdesign/theme-neutral": "0.7.9-canary.98efdf1"
|
|
131
131
|
},
|
|
132
132
|
"peerDependenciesMeta": {
|
|
133
133
|
"@astryxdesign/charts": {
|
|
@@ -144,10 +144,10 @@
|
|
|
144
144
|
}
|
|
145
145
|
},
|
|
146
146
|
"devDependencies": {
|
|
147
|
-
"@astryxdesign/charts": "0.7.9-canary.
|
|
148
|
-
"@astryxdesign/core": "0.7.9-canary.
|
|
149
|
-
"@astryxdesign/lab": "0.7.9-canary.
|
|
150
|
-
"@astryxdesign/theme-neutral": "0.7.9-canary.
|
|
147
|
+
"@astryxdesign/charts": "0.7.9-canary.98efdf1",
|
|
148
|
+
"@astryxdesign/core": "0.7.9-canary.98efdf1",
|
|
149
|
+
"@astryxdesign/lab": "0.7.9-canary.98efdf1",
|
|
150
|
+
"@astryxdesign/theme-neutral": "0.7.9-canary.98efdf1",
|
|
151
151
|
"@heroicons/react": "^2.2.0",
|
|
152
152
|
"@stylexjs/stylex": "^0.19.0",
|
|
153
153
|
"@types/babel__core": "^7.20.5",
|