@astryxdesign/cli 0.7.2-canary.c9f2659 → 0.7.2-canary.cbb7fa3

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 (72) hide show
  1. package/api/component/_adapter.d.mts +41 -1
  2. package/api/component/_adapter.mjs +93 -7
  3. package/api/component/component.mjs +22 -5
  4. package/api/component/component.test.mjs +420 -167
  5. package/api/component/integration-export-name.test.mjs +644 -0
  6. package/api/component/list/list.mjs +42 -4
  7. package/api/gap-report/gap-report.mjs +67 -4
  8. package/api/integration/add-contribution.component-names.test.mjs +66 -0
  9. package/api/integration/add-contribution.mjs +7 -3
  10. package/api/integration/pack-check.mjs +61 -107
  11. package/api/integration/pack-check.test.mjs +359 -0
  12. package/api/search/search.d.mts +9 -0
  13. package/api/search/search.mjs +108 -16
  14. package/api/search/search.test.mjs +36 -0
  15. package/api/swizzle/copy/copy.mjs +28 -14
  16. package/api/template/template.test.mjs +120 -3
  17. package/api/theme/build/build.family.test.mjs +16 -0
  18. package/api/theme/build/build.mjs +77 -18
  19. package/api/theme/themeBuild.doc.mjs +3 -3
  20. package/assets/codemods/transforms/next/__tests__/migrate-list-edge-compensation-to-edge.test.mjs +120 -0
  21. package/assets/codemods/transforms/next/index.mjs +11 -1
  22. package/assets/codemods/transforms/next/migrate-list-edge-compensation-to-edge.mjs +198 -0
  23. package/assets/docs/tree/add-a-component.doc.mjs +10 -0
  24. package/assets/docs/tree/checks.doc.mjs +1 -1
  25. package/assets/docs/tree/component-family.doc.mjs +5 -1
  26. package/assets/docs/tree/component-imports.doc.mjs +8 -0
  27. package/assets/docs/tree/single-component.doc.mjs +1 -1
  28. package/assets/docs/tree/troubleshooting.doc.mjs +9 -1
  29. package/assets/docs/tree/versioning.doc.mjs +1 -0
  30. package/assets/docs/working-with-ai.doc.mjs +43 -4
  31. package/assets/templates/blocks/components/Drawer/DrawerForm.doc.mjs +24 -0
  32. package/assets/templates/blocks/components/Drawer/DrawerForm.tsx +62 -0
  33. package/assets/templates/blocks/components/Drawer/DrawerScrim.doc.mjs +22 -0
  34. package/assets/templates/blocks/components/Drawer/DrawerScrim.tsx +68 -0
  35. package/assets/templates/blocks/components/Drawer/DrawerShowcase.doc.mjs +22 -0
  36. package/assets/templates/blocks/components/Drawer/DrawerShowcase.tsx +41 -0
  37. package/assets/templates/blocks/components/Drawer/DrawerStart.doc.mjs +21 -0
  38. package/assets/templates/blocks/components/Drawer/DrawerStart.tsx +41 -0
  39. package/assets/templates/blocks/components/Drawer/DrawerWidths.doc.mjs +22 -0
  40. package/assets/templates/blocks/components/Drawer/DrawerWidths.tsx +54 -0
  41. package/assets/templates/blocks/components/DrawerHeader/DrawerHeaderShowcase.doc.mjs +15 -0
  42. package/assets/templates/blocks/components/DrawerHeader/DrawerHeaderShowcase.tsx +73 -0
  43. package/assets/templates/blocks/components/DrawerHeader/DrawerHeaderSubtitleEndContent.doc.mjs +22 -0
  44. package/assets/templates/blocks/components/DrawerHeader/DrawerHeaderSubtitleEndContent.tsx +49 -0
  45. package/assets/templates/blocks/components/DrawerHeader/DrawerHeaderWithCloseButton.doc.mjs +21 -0
  46. package/assets/templates/blocks/components/DrawerHeader/DrawerHeaderWithCloseButton.tsx +42 -0
  47. package/assets/templates/pages/detail-page/page.tsx +3 -3
  48. package/assets/templates/pages/table-inbox/page.tsx +10 -8
  49. package/authoring/doctypes/base/type.ts +6 -0
  50. package/authoring/doctypes/component/component.doc.mjs +4 -4
  51. package/authoring/doctypes/component/type.ts +6 -3
  52. package/clients/cli/commands/build-theme.path-safety.test.mjs +84 -0
  53. package/clients/cli/commands/build-theme.registry.test.mjs +5 -2
  54. package/clients/cli/commands/theme-build.doc.mjs +2 -2
  55. package/clients/cli/lib/component-format.mjs +5 -1
  56. package/foundation/discovery/component-discovery.d.mts +172 -10
  57. package/foundation/discovery/component-discovery.export-names.test.mjs +760 -0
  58. package/foundation/discovery/component-discovery.mjs +863 -55
  59. package/foundation/discovery/component-discovery.test.mjs +96 -0
  60. package/foundation/discovery/component-replacement.mjs +18 -0
  61. package/foundation/discovery/component-replacement.test.mjs +40 -0
  62. package/foundation/discovery/module-exports.d.mts +27 -0
  63. package/foundation/discovery/module-exports.mjs +356 -31
  64. package/foundation/discovery/module-exports.test.mjs +172 -0
  65. package/foundation/discovery/template-adapter.mjs +74 -5
  66. package/foundation/doc-compiler/doc-loads.test.mjs +5 -1
  67. package/foundation/doc-compiler/inputs.mjs +23 -0
  68. package/foundation/doc-compiler/inputs.test.mjs +0 -1
  69. package/foundation/integrations/contribution-inventory.mjs +6 -1
  70. package/foundation/xle/registry.mjs +4 -0
  71. package/foundation/xle/registry.test.mjs +28 -0
  72. package/package.json +10 -10
@@ -0,0 +1,41 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ 'use client';
4
+
5
+ /**
6
+ * @input Controlled open state and the logical start edge
7
+ * @output A Drawer that opens from the start side of the viewport
8
+ * @position Copyable Drawer example
9
+ */
10
+
11
+ import {useState} from 'react';
12
+ import {Drawer, DrawerHeader} from '@astryxdesign/core/Drawer';
13
+ import {Button} from '@astryxdesign/core/Button';
14
+ import {Layout, LayoutContent} from '@astryxdesign/core/Layout';
15
+ import {Text} from '@astryxdesign/core/Text';
16
+
17
+ export default function DrawerStart() {
18
+ const [isOpen, setIsOpen] = useState(false);
19
+
20
+ return (
21
+ <>
22
+ <Button label="Open start drawer" onClick={() => setIsOpen(true)} />
23
+ <Drawer
24
+ isOpen={isOpen}
25
+ onOpenChange={setIsOpen}
26
+ label="Navigation"
27
+ side="start">
28
+ <Layout
29
+ header={<DrawerHeader title="Navigation" onOpenChange={setIsOpen} />}
30
+ content={
31
+ <LayoutContent>
32
+ <Text type="body">
33
+ The start edge follows the page's writing direction.
34
+ </Text>
35
+ </LayoutContent>
36
+ }
37
+ />
38
+ </Drawer>
39
+ </>
40
+ );
41
+ }
@@ -0,0 +1,22 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /** @type {import('@astryxdesign/cli/authoring').TemplateDoc} */
4
+ export const doc = {
5
+ type: 'block',
6
+ name: 'Width budget: pixels or any CSS length',
7
+ displayName: 'Width budget: pixels or any CSS length',
8
+ description:
9
+ 'Compare a numeric pixel width with rem and percentage lengths. The width budget also caps the drawer on mobile.',
10
+ exampleFor: 'Drawer',
11
+ isReady: true,
12
+ aspectRatio: 16 / 9,
13
+ componentsUsed: [
14
+ 'Drawer',
15
+ 'Button',
16
+ 'Layout',
17
+ 'LayoutContent',
18
+ 'HStack',
19
+ 'DrawerHeader',
20
+ 'Text',
21
+ ],
22
+ };
@@ -0,0 +1,54 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ 'use client';
4
+
5
+ /**
6
+ * @input A pixel, rem, or percentage width and controlled open state
7
+ * @output A Drawer demonstrating the selected width budget
8
+ * @position Copyable Drawer example
9
+ */
10
+
11
+ import {useState} from 'react';
12
+ import {Drawer, DrawerHeader} from '@astryxdesign/core/Drawer';
13
+ import {Button} from '@astryxdesign/core/Button';
14
+ import {Layout, LayoutContent} from '@astryxdesign/core/Layout';
15
+ import {HStack} from '@astryxdesign/core/Stack';
16
+ import {Text} from '@astryxdesign/core/Text';
17
+
18
+ export default function DrawerWidths() {
19
+ const [isOpen, setIsOpen] = useState(false);
20
+ const [width, setWidth] = useState<number | string>(320);
21
+
22
+ function openAtWidth(value: number | string) {
23
+ setWidth(value);
24
+ setIsOpen(true);
25
+ }
26
+
27
+ return (
28
+ <>
29
+ <HStack gap={2}>
30
+ <Button label="320px" onClick={() => openAtWidth(320)} />
31
+ <Button label="32rem" onClick={() => openAtWidth('32rem')} />
32
+ <Button label="50%" onClick={() => openAtWidth('50%')} />
33
+ </HStack>
34
+ <Drawer
35
+ isOpen={isOpen}
36
+ onOpenChange={setIsOpen}
37
+ label="Width budget"
38
+ width={width}>
39
+ <Layout
40
+ header={
41
+ <DrawerHeader title="Width budget" onOpenChange={setIsOpen} />
42
+ }
43
+ content={
44
+ <LayoutContent>
45
+ <Text type="body">
46
+ Width: {typeof width === 'number' ? `${width}px` : width}
47
+ </Text>
48
+ </LayoutContent>
49
+ }
50
+ />
51
+ </Drawer>
52
+ </>
53
+ );
54
+ }
@@ -0,0 +1,15 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /** @type {import('@astryxdesign/cli/authoring').TemplateDoc} */
4
+ export const doc = {
5
+ type: 'block',
6
+ name: 'DrawerHeader',
7
+ displayName: 'Drawer Header',
8
+ description:
9
+ 'DrawerHeader provides a structured header for drawers with slots for title, subtitle, close button, and optional start or end content.',
10
+ exampleFor: 'DrawerHeader',
11
+ isReady: true,
12
+ isShowcase: true,
13
+ aspectRatio: 16 / 9,
14
+ componentsUsed: ['DrawerHeader', 'Layout', 'LayoutContent', 'Text'],
15
+ };
@@ -0,0 +1,73 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ 'use client';
4
+
5
+ /**
6
+ * @input Static header content: title, subtitle, a no-op close handler, and a divider
7
+ * @output The DrawerHeader row at the top of a square-cornered, drawer-width panel, visible without opening an overlay
8
+ * @position DrawerHeader's docsite showcase. Drawer has no inline mode
9
+ * like Dialog's isInline, so a plain panel stands in for the drawer; in an
10
+ * app, compose DrawerHeader in a Layout header slot inside a Drawer.
11
+ */
12
+
13
+ import * as stylex from '@stylexjs/stylex';
14
+ import {DrawerHeader} from '@astryxdesign/core/Drawer';
15
+ import {
16
+ Layout,
17
+ LayoutContent,
18
+ overlayPaddingReset,
19
+ } from '@astryxdesign/core/Layout';
20
+ import {Text} from '@astryxdesign/core/Text';
21
+ import {
22
+ borderVars,
23
+ colorVars,
24
+ spacingVars,
25
+ } from '@astryxdesign/core/theme/tokens.stylex';
26
+
27
+ const styles = stylex.create({
28
+ // A card-like panel with square corners, matching the drawer's own corners.
29
+ panel: {
30
+ width: 360,
31
+ maxWidth: '100%',
32
+ boxSizing: 'border-box',
33
+ backgroundColor: colorVars['--color-background-card'],
34
+ borderWidth: borderVars['--border-width'],
35
+ borderStyle: 'solid',
36
+ borderColor: colorVars['--color-border'],
37
+ borderRadius: 0,
38
+ },
39
+ body: {
40
+ padding: spacingVars['--spacing-4'],
41
+ backgroundColor: colorVars['--color-background-muted'],
42
+ borderRadius: 0,
43
+ },
44
+ });
45
+
46
+ export default function DrawerHeaderShowcase() {
47
+ return (
48
+ // Like the Drawer root, the panel is a padding boundary, so the Layout
49
+ // regions inset by their own --spacing-4 default: the drawer's inset.
50
+ <div {...stylex.props(styles.panel, overlayPaddingReset.reset)}>
51
+ <Layout
52
+ height="auto"
53
+ header={
54
+ <DrawerHeader
55
+ title="Host details"
56
+ subtitle="web-prod-04"
57
+ onOpenChange={() => {}}
58
+ hasDivider
59
+ />
60
+ }
61
+ content={
62
+ <LayoutContent>
63
+ <div {...stylex.props(styles.body)}>
64
+ <Text type="body" color="secondary">
65
+ Drawer body content goes here.
66
+ </Text>
67
+ </div>
68
+ </LayoutContent>
69
+ }
70
+ />
71
+ </div>
72
+ );
73
+ }
@@ -0,0 +1,22 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /** @type {import('@astryxdesign/cli/authoring').TemplateDoc} */
4
+ export const doc = {
5
+ type: 'block',
6
+ name: 'With subtitle and end content',
7
+ displayName: 'With subtitle and end content',
8
+ description:
9
+ 'Add a subtitle under the title and put a status, such as a Badge, in endContent. The close button stays at the end of the row.',
10
+ exampleFor: 'DrawerHeader',
11
+ isReady: true,
12
+ aspectRatio: 16 / 9,
13
+ componentsUsed: [
14
+ 'Drawer',
15
+ 'DrawerHeader',
16
+ 'Badge',
17
+ 'Button',
18
+ 'Layout',
19
+ 'LayoutContent',
20
+ 'Text',
21
+ ],
22
+ };
@@ -0,0 +1,49 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ 'use client';
4
+
5
+ /**
6
+ * @input Controlled open state for a modal Drawer
7
+ * @output A DrawerHeader with a subtitle, a status badge in its end slot, and a close button
8
+ * @position Copyable DrawerHeader example
9
+ */
10
+
11
+ import {useState} from 'react';
12
+ import {Drawer, DrawerHeader} from '@astryxdesign/core/Drawer';
13
+ import {Badge} from '@astryxdesign/core/Badge';
14
+ import {Button} from '@astryxdesign/core/Button';
15
+ import {Layout, LayoutContent} from '@astryxdesign/core/Layout';
16
+ import {Text} from '@astryxdesign/core/Text';
17
+
18
+ export default function DrawerHeaderSubtitleEndContent() {
19
+ const [isOpen, setIsOpen] = useState(false);
20
+
21
+ return (
22
+ <>
23
+ <Button label="Open host details" onClick={() => setIsOpen(true)} />
24
+ <Drawer
25
+ isOpen={isOpen}
26
+ onOpenChange={setIsOpen}
27
+ label="web-prod-04"
28
+ width={360}>
29
+ <Layout
30
+ header={
31
+ <DrawerHeader
32
+ title="web-prod-04"
33
+ subtitle="us-east-1"
34
+ endContent={<Badge label="Healthy" variant="success" />}
35
+ onOpenChange={setIsOpen}
36
+ />
37
+ }
38
+ content={
39
+ <LayoutContent>
40
+ <Text type="body">
41
+ All 6 instances are passing readiness checks.
42
+ </Text>
43
+ </LayoutContent>
44
+ }
45
+ />
46
+ </Drawer>
47
+ </>
48
+ );
49
+ }
@@ -0,0 +1,21 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /** @type {import('@astryxdesign/cli/authoring').TemplateDoc} */
4
+ export const doc = {
5
+ type: 'block',
6
+ name: 'With close button',
7
+ displayName: 'With close button',
8
+ description:
9
+ 'Pass onOpenChange to render a close button that calls it with false. Drawer renders no close button of its own, so this is the usual visible way to close.',
10
+ exampleFor: 'DrawerHeader',
11
+ isReady: true,
12
+ aspectRatio: 16 / 9,
13
+ componentsUsed: [
14
+ 'Drawer',
15
+ 'DrawerHeader',
16
+ 'Button',
17
+ 'Layout',
18
+ 'LayoutContent',
19
+ 'Text',
20
+ ],
21
+ };
@@ -0,0 +1,42 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ 'use client';
4
+
5
+ /**
6
+ * @input Controlled open state for a modal Drawer
7
+ * @output A Drawer whose DrawerHeader renders a close button because it receives onOpenChange
8
+ * @position Copyable DrawerHeader example
9
+ */
10
+
11
+ import {useState} from 'react';
12
+ import {Drawer, DrawerHeader} from '@astryxdesign/core/Drawer';
13
+ import {Button} from '@astryxdesign/core/Button';
14
+ import {Layout, LayoutContent} from '@astryxdesign/core/Layout';
15
+ import {Text} from '@astryxdesign/core/Text';
16
+
17
+ export default function DrawerHeaderWithCloseButton() {
18
+ const [isOpen, setIsOpen] = useState(false);
19
+
20
+ return (
21
+ <>
22
+ <Button label="Open drawer" onClick={() => setIsOpen(true)} />
23
+ <Drawer
24
+ isOpen={isOpen}
25
+ onOpenChange={setIsOpen}
26
+ label="Details"
27
+ width={360}>
28
+ <Layout
29
+ header={<DrawerHeader title="Details" onOpenChange={setIsOpen} />}
30
+ content={
31
+ <LayoutContent>
32
+ <Text type="body">
33
+ Passing onOpenChange renders the close button, which calls it
34
+ with false.
35
+ </Text>
36
+ </LayoutContent>
37
+ }
38
+ />
39
+ </Drawer>
40
+ </>
41
+ );
42
+ }
@@ -600,9 +600,9 @@ export default function DetailPage2Template() {
600
600
  }
601
601
  end={!isNarrow && showSidePanel ? <RightPanel /> : undefined}
602
602
  />
603
- {/* Mobile: the side panel content opens as a full-screen dialog. (A
604
- side drawer/sheet would be more idiomatic, but Astryx has no Drawer
605
- component yet — #2575 — so we use the fullscreen Dialog variant.) */}
603
+ {/* Mobile: the side-panel content uses the full viewport so order details
604
+ are not squeezed beside narrow page chrome. Drawer remains available
605
+ for side-overlay flows that intentionally preserve page context. */}
606
606
  <Dialog
607
607
  variant="fullscreen"
608
608
  isOpen={isNarrow && isPanelDialogOpen}
@@ -1652,8 +1652,8 @@ const COMPOSER_TOOLS: {
1652
1652
  /**
1653
1653
  * The compose sheet.
1654
1654
  *
1655
- * **`BottomSheet hasScrim={false}`, which is the only non-modal surface in
1656
- * core.** With the scrim off the sheet opens with `show()` rather than
1655
+ * **`BottomSheet hasScrim={false}` keeps this bottom-edge composer non-modal.**
1656
+ * With the scrim off the sheet opens with `show()` rather than
1657
1657
  * `showModal()`, so it never enters the top layer, never makes the page inert
1658
1658
  * and never locks body scroll: the inbox behind it stays live. That matters
1659
1659
  * more here than anywhere else in this template, because writing a message is
@@ -1661,12 +1661,14 @@ const COMPOSER_TOOLS: {
1661
1661
  * actually said, copy an order number out of a thread. A modal composer
1662
1662
  * answers that with "close me first".
1663
1663
  *
1664
- * The trade is position, and it is worth naming. A sheet rises from the bottom
1665
- * edge, centred: its positioner is `inset-inline: 0` with
1666
- * `justify-content: center`, and there is no anchor, side or width prop. So
1667
- * this cannot be docked to the inline-end corner the way a `Dialog` can be.
1668
- * `Dialog` takes a static `position` and would put the window in that corner —
1669
- * but `Dialog` is always modal, so buying the corner costs the live inbox.
1664
+ * The trade is bottom-edge geometry, and it is worth naming. A non-modal
1665
+ * `Drawer` keeps page context live from an inline edge, but it is a full-height
1666
+ * side panel; this composer intentionally rises from the bottom. A sheet's
1667
+ * positioner is `inset-inline: 0` with `justify-content: center`, and there is
1668
+ * no anchor, side or width prop. So this cannot be docked to the inline-end
1669
+ * corner the way a `Dialog` can be. `Dialog` takes a static `position` and would
1670
+ * put the window in that corner — but `Dialog` is always modal, so buying the
1671
+ * corner costs the live inbox.
1670
1672
  * `ChatComposerDrawer` is a false friend: despite the name it is an in-flow
1671
1673
  * disclosure tray for a ChatComposer's attachments, with no positioning of its
1672
1674
  * own.
@@ -383,6 +383,12 @@ export interface ComponentPropDoc {
383
383
  * ```
384
384
  */
385
385
  slotElements?: ComponentSlotElement[];
386
+ /** Lifecycle marker for a prop outside the stable compatibility promise
387
+ * (spec:AST-017 FR21). Set `'experimental'` on a stable component's
388
+ * optional `experimental` prop object, and say in `description` that its
389
+ * contents may change or be removed in a patch release. Omit for stable
390
+ * props. */
391
+ stability?: 'experimental';
386
392
  }
387
393
 
388
394
  /**
@@ -30,7 +30,7 @@ export const doc = {
30
30
  name: 'name',
31
31
  type: 'string',
32
32
  description:
33
- "Stable machine identity and directory name without the Astryx prefix, PascalCase. e.g. 'Button', 'TextInput', 'AppShell'. Change `displayName`, not `name`, to edit the visible label; registry URLs derive from this identity by default.",
33
+ "Stable machine identity and directory name without the Astryx prefix, PascalCase. e.g. 'Button', 'TextInput', 'AppShell'. For an integration component it is the export apps import: the doc sits beside the file that exports it, and when that file exports nothing under its own name, `name` may name the export it does have. Change `displayName`, not `name`, to edit the visible label; registry URLs derive from this identity by default.",
34
34
  required: true,
35
35
  },
36
36
  {
@@ -56,7 +56,7 @@ export const doc = {
56
56
  name: 'replaces',
57
57
  type: 'string',
58
58
  description:
59
- "Integration components only: the exact `name` of the Core ComponentDoc this component takes over for unqualified lookup, so every app that loads the integration gets it from component detail, component lists, search, `swizzle <Name>`, and issue routing; `swizzle --list` keeps listing Core names. The Core original stays reachable with `--package @astryxdesign/core`. It takes effect only when the package's peer range starts at the release that applies it, `\"@astryxdesign/cli\": \">=0.6.7\"` or later; without such a range the component keeps its own name and `doctor integration components` warns. Set it only to intentionally own a Core identity; give an alternative or variant its own name instead.",
59
+ 'Integration components only: the exact `name` of the Core ComponentDoc this component takes over for unqualified lookup, so every app that loads the integration gets it from component detail, component lists, search, `swizzle <Name>`, and issue routing; `swizzle --list` keeps listing Core names. The Core original stays reachable with `--package @astryxdesign/core`. It takes effect only when the package\'s peer range starts at the release that applies it, `"@astryxdesign/cli": ">=0.6.7"` or later; without such a range the component keeps its own name and `doctor integration components` warns. Set it only to intentionally own a Core identity; give an alternative or variant its own name instead.',
60
60
  },
61
61
  {
62
62
  name: 'keywords',
@@ -181,13 +181,13 @@ export const doc = {
181
181
  name: 'props',
182
182
  type: 'ComponentPropDoc[]',
183
183
  description:
184
- 'SingleComponentDoc variant (required there): all public props for the one primary component. Each prop is {name, type, description, default?, required?, slotElements?}. Skip styling props like xstyle/className/style. Also present on SubComponentDoc.',
184
+ 'SingleComponentDoc variant (required there): all public props for the one primary component. Each prop is {name, type, description, default?, required?, slotElements?, stability?}. Skip styling props like xstyle/className/style. Also present on SubComponentDoc.',
185
185
  },
186
186
  {
187
187
  name: 'components',
188
188
  type: '(ComponentEntry | ComponentRef)[]',
189
189
  description:
190
- 'MultiComponentDoc variant (required there): one entry per public component/hook exported from the directory. Each entry is a full ComponentEntry (inline: name, displayName, description, props | params+returns) or a name-only ComponentRef pointing at a sibling {Name}.doc.mjs.',
190
+ 'MultiComponentDoc variant (required there): one entry per public component/hook exported from the directory. Each entry is a full ComponentEntry (inline: name, displayName, description, props | params+returns) or a name-only ComponentRef pointing at a sibling {Name}.doc.mjs. In an integration, each full entry the module named by `import` exports is a component under its own name.',
191
191
  },
192
192
  {
193
193
  name: 'subComponentOf',
@@ -33,9 +33,12 @@ export interface ComponentBaseDoc extends AuthoredDocGraphFields {
33
33
  type?: 'component';
34
34
  /**
35
35
  * Stable machine identity and directory name without the Astryx prefix,
36
- * PascalCase (for example `Button`, `Table`, or `AppShell`). Do not change
37
- * this to edit the visible label; use `displayName` for that. Registry URLs
38
- * derive from this value by default.
36
+ * PascalCase (for example `Button`, `Table`, or `AppShell`). For an
37
+ * integration component it is the export apps import: the doc sits beside
38
+ * the file that exports it, and when that file exports nothing under its own
39
+ * name, `name` may name the export it does have. Do not change this to edit
40
+ * the visible label; use `displayName` for that. Registry URLs derive from
41
+ * this value by default.
39
42
  */
40
43
  name: string;
41
44
  /** Human-readable display name with spaces between words, used by the
@@ -9,6 +9,9 @@
9
9
  * - Multi-file write is atomic: if one file fails, none are left behind.
10
10
  * - An `--out` escape, or an output directory that cannot be created, fails
11
11
  * with a registered error code.
12
+ * - Every output stays inside the working directory: an absolute `--out`
13
+ * path or a theme file outside it fails before anything is written, while
14
+ * absolute paths inside it build, also through a symlinked spelling.
12
15
  *
13
16
  * Runs the CLI in-process (shared runCli harness) against a tiny synthetic theme file.
14
17
  */
@@ -129,6 +132,68 @@ describe('theme build output-path failures carry registered codes', () => {
129
132
  expect(fs.existsSync(path.join(tmpDir, 'escaped.css'))).toBe(false);
130
133
  });
131
134
 
135
+ it('reports an absolute --out path outside the project as ERR_PATH_TRAVERSAL, with --check too', async () => {
136
+ const project = path.join(tmpDir, 'project');
137
+ const outside = path.join(tmpDir, 'outside');
138
+ fs.mkdirSync(outside, {recursive: true});
139
+ const themeFile = writeTheme(path.join(project, 'themes'), 'ocean');
140
+ const out = path.join(outside, 'ocean.css');
141
+
142
+ for (const extra of [[], ['--check']]) {
143
+ const {result, envelope} = await buildJson(
144
+ [path.relative(project, themeFile), '--out', out, ...extra],
145
+ project,
146
+ );
147
+
148
+ expect(result.code).toBe(1);
149
+ expect(envelope.code).toBe(ERROR_CODES.ERR_PATH_TRAVERSAL);
150
+ }
151
+ expect(fs.readdirSync(outside)).toEqual([]);
152
+ });
153
+
154
+ it('reports a theme file outside the project as ERR_PATH_TRAVERSAL, because its outputs go beside it', async () => {
155
+ const project = path.join(tmpDir, 'project');
156
+ fs.mkdirSync(project, {recursive: true});
157
+ const shared = path.join(tmpDir, 'shared');
158
+ const themeFile = writeTheme(shared, 'ocean');
159
+
160
+ for (const file of [themeFile, path.relative(project, themeFile)]) {
161
+ const {result, envelope} = await buildJson([file], project);
162
+
163
+ expect(result.code).toBe(1);
164
+ expect(envelope.code).toBe(ERROR_CODES.ERR_PATH_TRAVERSAL);
165
+ }
166
+ expect(fs.readdirSync(shared)).toEqual(['theme.mjs']);
167
+ });
168
+
169
+ it('builds absolute paths inside the project, also when they reach it through a symlink', async () => {
170
+ const project = path.join(tmpDir, 'project');
171
+ const themeFile = writeTheme(path.join(project, 'themes'), 'ocean');
172
+ const alias = path.join(tmpDir, 'alias');
173
+ fs.symlinkSync(project, alias, 'dir');
174
+
175
+ for (const [args, written] of [
176
+ [
177
+ [themeFile, '--out', path.join(project, 'dist', 'direct.css')],
178
+ path.join(project, 'dist', 'direct.css'),
179
+ ],
180
+ [
181
+ [themeFile, '--out', path.join(alias, 'dist', 'aliased.css')],
182
+ path.join(project, 'dist', 'aliased.css'),
183
+ ],
184
+ [
185
+ [path.join(alias, 'themes', 'theme.mjs')],
186
+ path.join(project, 'themes', 'ocean.css'),
187
+ ],
188
+ ]) {
189
+ const {result, envelope} = await buildJson(args, project);
190
+
191
+ expect(result.code).toBe(0);
192
+ expect(envelope.type).toBe('theme.build');
193
+ expect(fs.existsSync(written)).toBe(true);
194
+ }
195
+ });
196
+
132
197
  it('reports an --out path that escapes through a symlink as ERR_PATH_TRAVERSAL', async () => {
133
198
  const project = path.join(tmpDir, 'project');
134
199
  const outside = path.join(tmpDir, 'outside');
@@ -177,4 +242,23 @@ describe('theme build output-path failures carry registered codes', () => {
177
242
  code: ERROR_CODES.ERR_PATH_TRAVERSAL,
178
243
  });
179
244
  });
245
+
246
+ it('themeBuild() rejects an output outside cwd: an absolute out path, or the default beside a theme file outside cwd', async () => {
247
+ const project = path.join(tmpDir, 'project');
248
+ const inside = writeTheme(path.join(project, 'themes'), 'ocean');
249
+ const shared = path.join(tmpDir, 'shared');
250
+ const outsideTheme = writeTheme(shared, 'ocean');
251
+ const outDir = path.join(tmpDir, 'out');
252
+
253
+ for (const [file, options] of [
254
+ [path.relative(project, inside), {out: path.join(outDir, 'ocean.css')}],
255
+ [outsideTheme, {}],
256
+ ]) {
257
+ await expect(
258
+ themeBuild(file, options, {cwd: project}),
259
+ ).rejects.toMatchObject({code: ERROR_CODES.ERR_PATH_TRAVERSAL});
260
+ }
261
+ expect(fs.existsSync(outDir)).toBe(false);
262
+ expect(fs.readdirSync(shared)).toEqual(['theme.mjs']);
263
+ });
180
264
  });
@@ -126,7 +126,10 @@ describe('theme build emits a live TextInput selector (#4109)', () => {
126
126
  `};\n`,
127
127
  );
128
128
 
129
- const result = await runCli(['theme', 'build', themeFile, '-o', outFile]);
129
+ const result = await runCli(
130
+ ['theme', 'build', themeFile, '-o', outFile],
131
+ tmpDir,
132
+ );
130
133
  const css = fs.readFileSync(outFile, 'utf8');
131
134
 
132
135
  expect(result.status).toBe(0);
@@ -148,7 +151,7 @@ describe('theme build emits a live TextInput selector (#4109)', () => {
148
151
  `};\n`,
149
152
  );
150
153
 
151
- await runCli(['theme', 'build', themeFile, '-o', outFile]);
154
+ await runCli(['theme', 'build', themeFile, '-o', outFile], tmpDir);
152
155
  const css = fs.readFileSync(outFile, 'utf8');
153
156
 
154
157
  expect(css).toContain('.astryx-text-input');
@@ -30,7 +30,7 @@ export const doc = {
30
30
  {
31
31
  flag: '--family',
32
32
  description:
33
- 'Build the selected extension family into one keyed CSS, JS, and declaration set. Requires --family-key; refused with --out or --watch (ERR_THEME_INVALID)',
33
+ 'Build the selected extension family into one keyed CSS, JS, and declaration set, written beside the family root theme file, which must be inside the working directory (ERR_PATH_TRAVERSAL). Requires --family-key; refused with --out or --watch (ERR_THEME_INVALID)',
34
34
  },
35
35
  {
36
36
  flag: '--family-key <key>',
@@ -41,7 +41,7 @@ export const doc = {
41
41
  flag: '-o, --out <path>',
42
42
  param: 'options.out',
43
43
  description:
44
- 'Output CSS file path; the .js and .d.ts are written beside it (default: <theme name>.css next to the source). A relative path must stay inside the working directory. Single theme only: refused with more than one file or with --family (ERR_THEME_INVALID)',
44
+ 'Output CSS file path, relative or absolute; the .js and .d.ts are written beside it (default: <theme name>.css next to the source). Every output must resolve inside the working directory, the defaults beside the source too (ERR_PATH_TRAVERSAL). Single theme only: refused with more than one file or with --family (ERR_THEME_INVALID)',
45
45
  },
46
46
  {
47
47
  flag: '--icons-specifier <specifier>',
@@ -68,8 +68,12 @@ function formatPropsTable(props) {
68
68
  for (const p of props) {
69
69
  const def = p.default ? `\`${mdCell(p.default)}\`` : '-';
70
70
  const req = p.required ? ' **(required)**' : '';
71
+ // The text projection of the prop doc's `stability` field: an
72
+ // experimental prop is outside the stable compatibility promise.
73
+ const stability =
74
+ p.stability === 'experimental' ? ' **(experimental)**' : '';
71
75
  lines.push(
72
- `| \`${mdCell(p.name)}\` | \`${mdCell(p.type)}\` | ${def} | ${mdCell(p.description)}${req} |`,
76
+ `| \`${mdCell(p.name)}\` | \`${mdCell(p.type)}\` | ${def} | ${mdCell(p.description)}${req}${stability} |`,
73
77
  );
74
78
  }
75
79
  return lines.join('\n');