@astryxdesign/cli 0.1.6-canary.1a0fef5 → 0.1.6-canary.1b61ba6
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/docs/integration-authoring.md +105 -0
- package/docs/internationalization.doc.mjs +243 -0
- package/package.json +13 -9
- package/src/api/integration-block-exports.test.mjs +240 -0
- package/src/api/template-suffix.test.mjs +246 -0
- package/src/api/template.mjs +104 -28
- package/src/api/validate-integration.mjs +0 -8
- package/src/codemods/__tests__/registry.test.mjs +1 -0
- package/src/codemods/registry.mjs +1 -0
- package/src/codemods/transforms/v0.1.7/__tests__/migrate-table-tableprops-to-direct-props.test.mjs +120 -0
- package/src/codemods/transforms/v0.1.7/index.mjs +19 -0
- package/src/codemods/transforms/v0.1.7/migrate-table-tableprops-to-direct-props.mjs +188 -0
- package/src/config.mjs +5 -14
- package/src/doc.mjs +27 -0
- package/src/doc.test.mjs +383 -0
- package/src/integration.mjs +4 -15
- package/src/lib/component-discovery.importpath.test.mjs +59 -0
- package/src/lib/component-discovery.mjs +15 -5
- package/src/lib/component-format.mjs +45 -13
- package/src/lib/component-format.test.mjs +95 -1
- package/src/lib/component-loader.mjs +104 -2
- package/src/lib/componentDocOverlay.test.mjs +111 -0
- package/src/lib/config-schema.mjs +0 -30
- package/src/lib/hook-format.mjs +8 -3
- package/src/lib/xle/registry.mjs +0 -5
- package/src/schemas/doc-schema.mjs +226 -0
- package/src/schemas/template-schema.mjs +47 -0
- package/src/template.mjs +9 -67
- package/src/types/config.d.ts +11 -66
- package/src/types/doc.d.ts +23 -0
- package/src/types/integration.d.ts +7 -18
- package/src/types/template-api.d.ts +14 -50
- package/templates/blocks/components/Avatar/AvatarGroup.tsx +5 -7
- package/templates/blocks/components/Avatar/AvatarShowcase.tsx +4 -6
- package/templates/blocks/components/Avatar/AvatarUserCard.tsx +3 -5
- package/templates/blocks/components/Avatar/AvatarWithImage.tsx +8 -6
- package/templates/blocks/components/Avatar/AvatarWithStatus.tsx +3 -5
- package/templates/blocks/components/ChatComposerInput/ChatComposerInputControlledInput.tsx +1 -1
- package/templates/blocks/components/ChatComposerInput/ChatComposerInputDisabled.tsx +1 -1
- package/templates/blocks/components/ChatComposerInput/ChatComposerInputMentionTrigger.tsx +1 -1
- package/templates/blocks/components/ChatComposerInput/ChatComposerInputMultipleTriggers.tsx +1 -1
- package/templates/blocks/components/ChatComposerInput/ChatComposerInputShowcase.tsx +1 -1
- package/templates/blocks/components/ChatComposerInput/ChatComposerInputSlashCommands.tsx +1 -1
- package/templates/blocks/components/VisuallyHidden/VisuallyHiddenLiveRegion.doc.mjs +14 -0
- package/templates/blocks/components/VisuallyHidden/VisuallyHiddenLiveRegion.tsx +41 -0
- package/templates/blocks/components/VisuallyHidden/VisuallyHiddenShowcase.doc.mjs +13 -0
- package/templates/blocks/components/VisuallyHidden/VisuallyHiddenShowcase.tsx +78 -0
- package/templates/blocks/components/VisuallyHidden/VisuallyHiddenStructuralHeading.doc.mjs +14 -0
- package/templates/blocks/components/VisuallyHidden/VisuallyHiddenStructuralHeading.tsx +38 -0
- package/templates/blocks/components/VisuallyHidden/VisuallyHiddenSupplementaryContext.doc.mjs +14 -0
- package/templates/blocks/components/VisuallyHidden/VisuallyHiddenSupplementaryContext.tsx +47 -0
- package/templates/pages/theme-showcase/page.tsx +7 -7
- package/templates/themes/neutral/neutralTheme.ts +63 -32
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file Doc load-boundary schemas.
|
|
5
|
+
*
|
|
6
|
+
* The Zod schemas doc discovery runs a loaded doc value through (see
|
|
7
|
+
* `loadComponentDoc`). {@link ComponentDocSchema} accepts BOTH the new stamped
|
|
8
|
+
* formats and the legacy loose `export const docs = {...}` shape, so existing
|
|
9
|
+
* docs keep loading unchanged. Kept free of any `@astryxdesign/core` import so
|
|
10
|
+
* the hot path that loads them (doc discovery, `astryx init`) does not require
|
|
11
|
+
* core's built `dist/`. The authoring factories live in
|
|
12
|
+
* `@astryxdesign/core/authoring` and are re-exported from `../doc.mjs` for the
|
|
13
|
+
* public `@astryxdesign/cli/doc` surface.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import {z} from 'zod';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* A single documented prop. Mirrors `PropDoc` from
|
|
20
|
+
* `@astryxdesign/core/docs-types`. Only `name`, `type`, and `description` are
|
|
21
|
+
* required; everything else is optional. Extra fields (e.g. `slotElements`)
|
|
22
|
+
* pass through so the schema does not have to track every evolution of the
|
|
23
|
+
* rich playground/element surface.
|
|
24
|
+
*/
|
|
25
|
+
const PropSchema = z
|
|
26
|
+
.object({
|
|
27
|
+
name: z.string().min(1, 'prop name is required'),
|
|
28
|
+
type: z.string().min(1, 'prop type is required'),
|
|
29
|
+
description: z.string(),
|
|
30
|
+
default: z.string().optional(),
|
|
31
|
+
required: z.boolean().optional(),
|
|
32
|
+
})
|
|
33
|
+
.passthrough();
|
|
34
|
+
|
|
35
|
+
/** A single documented function/hook parameter (mirrors `HookParamDoc`). */
|
|
36
|
+
const ParamSchema = z
|
|
37
|
+
.object({
|
|
38
|
+
name: z.string().min(1, 'param name is required'),
|
|
39
|
+
type: z.string().min(1, 'param type is required'),
|
|
40
|
+
description: z.string(),
|
|
41
|
+
default: z.string().optional(),
|
|
42
|
+
required: z.boolean().optional(),
|
|
43
|
+
})
|
|
44
|
+
.passthrough();
|
|
45
|
+
|
|
46
|
+
/** A single documented function/hook return field (mirrors `HookReturnDoc`). */
|
|
47
|
+
const ReturnSchema = z
|
|
48
|
+
.object({
|
|
49
|
+
name: z.string().min(1, 'return name is required'),
|
|
50
|
+
type: z.string().min(1, 'return type is required'),
|
|
51
|
+
description: z.string(),
|
|
52
|
+
})
|
|
53
|
+
.passthrough();
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Fields shared by every doc kind. Deliberately permissive on the rich blobs
|
|
57
|
+
* (usage/theming/playground) — those are large and still evolving, so they are
|
|
58
|
+
* `z.unknown()` passthrough rather than enumerated.
|
|
59
|
+
*
|
|
60
|
+
* `group` vs `parent` are distinct concepts and intentionally separate fields:
|
|
61
|
+
* - `group` is a FLAT sidebar bucket label. Many docs can share a group; it
|
|
62
|
+
* is not an inheritance key.
|
|
63
|
+
* - `parent` is a DIRECTED inheritance/composition pointer — a doc naming the
|
|
64
|
+
* doc it belongs to (e.g. a sub-component naming its parent component). The
|
|
65
|
+
* legacy `subComponentOf` field is a synonym; both map to the same concept.
|
|
66
|
+
*
|
|
67
|
+
* `relatedDocs` is a single flat curated cross-reference list. It replaces the
|
|
68
|
+
* legacy split `relatedComponents` + `relatedHooks`; a downstream reader can
|
|
69
|
+
* merge the legacy pair into it.
|
|
70
|
+
*/
|
|
71
|
+
const BaseDocFields = {
|
|
72
|
+
/** Name of the documented unit, without any prefix. Required. */
|
|
73
|
+
name: z.string().min(1, 'name is required'),
|
|
74
|
+
/** Human-readable display name for gallery/sidebar. */
|
|
75
|
+
displayName: z.string().optional(),
|
|
76
|
+
/** One-line/short description. */
|
|
77
|
+
description: z.string().optional(),
|
|
78
|
+
/** Usage documentation (description, best practices, anatomy, slotElements). */
|
|
79
|
+
usage: z.unknown().optional(),
|
|
80
|
+
/** Flat sidebar grouping label (not an inheritance key). */
|
|
81
|
+
group: z.string().optional(),
|
|
82
|
+
/** Overview-page functional category. */
|
|
83
|
+
category: z.string().optional(),
|
|
84
|
+
/** CLI fuzzy-search keywords. */
|
|
85
|
+
keywords: z.array(z.string()).optional(),
|
|
86
|
+
/** Directed inheritance/composition pointer to the doc this belongs to. */
|
|
87
|
+
parent: z.string().optional(),
|
|
88
|
+
/** Flat curated cross-reference list of related doc names. */
|
|
89
|
+
relatedDocs: z.array(z.string()).optional(),
|
|
90
|
+
/** Hide the whole doc from human-facing UI (stays importable/discoverable). */
|
|
91
|
+
hidden: z.boolean().optional(),
|
|
92
|
+
/** Exclude from the categorized overview page (kept in sidebar/CLI). */
|
|
93
|
+
isHiddenFromOverview: z.boolean().optional(),
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* New-format schema for a stamped component doc (`type: 'component'`). The
|
|
98
|
+
* top-level component keys are enumerated, but nested blobs stay loose so real
|
|
99
|
+
* docs are not rejected. `.passthrough()` keeps unknown top-level fields
|
|
100
|
+
* (translations, element descriptors, ...) flowing through.
|
|
101
|
+
*/
|
|
102
|
+
export const ComponentDocKindSchema = z
|
|
103
|
+
.object({
|
|
104
|
+
...BaseDocFields,
|
|
105
|
+
type: z.literal('component'),
|
|
106
|
+
props: z.array(PropSchema),
|
|
107
|
+
theming: z.unknown().optional(),
|
|
108
|
+
playground: z.unknown().optional(),
|
|
109
|
+
examples: z.array(z.unknown()).optional(),
|
|
110
|
+
})
|
|
111
|
+
.passthrough();
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* New-format schema for a stamped function doc (`type: 'function'`). Covers any
|
|
115
|
+
* function, including hooks: an inputs (`params`) + outputs (`returns`) surface.
|
|
116
|
+
*/
|
|
117
|
+
export const FunctionDocKindSchema = z
|
|
118
|
+
.object({
|
|
119
|
+
...BaseDocFields,
|
|
120
|
+
type: z.literal('function'),
|
|
121
|
+
params: z.array(ParamSchema),
|
|
122
|
+
returns: z.array(ReturnSchema),
|
|
123
|
+
})
|
|
124
|
+
.passthrough();
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* New-format schema for a stamped generic doc (`type: 'generic'`) — reference
|
|
128
|
+
* and topic docs. Just the shared base plus the discriminant.
|
|
129
|
+
*/
|
|
130
|
+
export const GenericDocKindSchema = z
|
|
131
|
+
.object({
|
|
132
|
+
...BaseDocFields,
|
|
133
|
+
type: z.literal('generic'),
|
|
134
|
+
})
|
|
135
|
+
.passthrough();
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* The stamped-doc contract: one of the three new per-kind schemas, discriminated
|
|
139
|
+
* by the injected `type`. Used when a loaded doc carries a `type` field.
|
|
140
|
+
*/
|
|
141
|
+
export const StampedDocSchema = z.discriminatedUnion('type', [
|
|
142
|
+
ComponentDocKindSchema,
|
|
143
|
+
FunctionDocKindSchema,
|
|
144
|
+
GenericDocKindSchema,
|
|
145
|
+
]);
|
|
146
|
+
|
|
147
|
+
// ── Legacy loose format (unchanged, kept for back-compat) ─────────────
|
|
148
|
+
//
|
|
149
|
+
// The pre-factory docs are authored as a loose, untyped object with no `type`
|
|
150
|
+
// discriminant and validated by shape. Enumerated top-level fields observed
|
|
151
|
+
// across the existing loose docs:
|
|
152
|
+
// name, displayName, description, group, category, keywords,
|
|
153
|
+
// isHiddenFromOverview, hidden, hiddenComponents, usage, props, components,
|
|
154
|
+
// subComponentOf, playground, theming, examples, params, returns,
|
|
155
|
+
// relatedComponents, relatedHooks, relatedDocs, parent, importPath.
|
|
156
|
+
|
|
157
|
+
const LegacyBaseDocSchema = z.object({
|
|
158
|
+
name: z.string().min(1, 'name is required'),
|
|
159
|
+
displayName: z.string().optional(),
|
|
160
|
+
description: z.string().optional(),
|
|
161
|
+
group: z.string().optional(),
|
|
162
|
+
category: z.string().optional(),
|
|
163
|
+
keywords: z.array(z.string()).optional(),
|
|
164
|
+
isHiddenFromOverview: z.boolean().optional(),
|
|
165
|
+
hidden: z.boolean().optional(),
|
|
166
|
+
hiddenComponents: z.array(z.string()).optional(),
|
|
167
|
+
usage: z.unknown().optional(),
|
|
168
|
+
playground: z.unknown().optional(),
|
|
169
|
+
theming: z.unknown().optional(),
|
|
170
|
+
examples: z.array(z.unknown()).optional(),
|
|
171
|
+
showcase: z.unknown().optional(),
|
|
172
|
+
// `parent` and legacy `subComponentOf` are synonyms; both accepted here so a
|
|
173
|
+
// parent-based doc that omits a stamped `type` still validates.
|
|
174
|
+
parent: z.string().optional(),
|
|
175
|
+
relatedDocs: z.array(z.string()).optional(),
|
|
176
|
+
relatedComponents: z.array(z.string()).optional(),
|
|
177
|
+
relatedHooks: z.array(z.string()).optional(),
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
/** Legacy: directory exporting a single primary component (props inline). */
|
|
181
|
+
const LegacySingleComponentDocSchema = LegacyBaseDocSchema.extend({
|
|
182
|
+
props: z.array(PropSchema),
|
|
183
|
+
}).passthrough();
|
|
184
|
+
|
|
185
|
+
/** Legacy: directory exporting multiple components (props on each entry). */
|
|
186
|
+
const LegacyMultiComponentDocSchema = LegacyBaseDocSchema.extend({
|
|
187
|
+
components: z.array(z.unknown()),
|
|
188
|
+
}).passthrough();
|
|
189
|
+
|
|
190
|
+
/** Legacy: a standalone hook doc — inputs (`params`) + outputs (`returns`). */
|
|
191
|
+
const LegacyHookDocSchema = LegacyBaseDocSchema.extend({
|
|
192
|
+
params: z.array(ParamSchema),
|
|
193
|
+
returns: z.array(ReturnSchema),
|
|
194
|
+
}).passthrough();
|
|
195
|
+
|
|
196
|
+
/** Legacy: a sub-component doc parented via `subComponentOf`. */
|
|
197
|
+
const LegacySubComponentDocSchema = LegacyBaseDocSchema.extend({
|
|
198
|
+
subComponentOf: z.string().min(1, 'subComponentOf is required'),
|
|
199
|
+
description: z.string(),
|
|
200
|
+
props: z.array(PropSchema),
|
|
201
|
+
}).passthrough();
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* The permissive legacy union. `subComponentOf` is listed first so a doc that
|
|
205
|
+
* carries both `subComponentOf` and `props` is validated as a sub-component
|
|
206
|
+
* (the more specific shape); hook (`params`/`returns`) before multi/single.
|
|
207
|
+
*/
|
|
208
|
+
export const LegacyDocSchema = z.union([
|
|
209
|
+
LegacySubComponentDocSchema,
|
|
210
|
+
LegacyHookDocSchema,
|
|
211
|
+
LegacyMultiComponentDocSchema,
|
|
212
|
+
LegacySingleComponentDocSchema,
|
|
213
|
+
]);
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* The LOAD-boundary contract for a doc. Handles BOTH formats:
|
|
217
|
+
* - NEW: a stamped doc (`type: 'component' | 'function' | 'generic'`,
|
|
218
|
+
* produced by the factories) is validated against the matching per-kind
|
|
219
|
+
* schema in {@link StampedDocSchema}.
|
|
220
|
+
* - OLD: a loose, unstamped doc is validated against the permissive
|
|
221
|
+
* {@link LegacyDocSchema} union (the three legacy shapes + standalone hook).
|
|
222
|
+
*
|
|
223
|
+
* Discovery validates the SHAPE, not "was it made by the factory". Both formats
|
|
224
|
+
* normalize into the same internal shape consumers already expect.
|
|
225
|
+
*/
|
|
226
|
+
export const ComponentDocSchema = z.union([StampedDocSchema, LegacyDocSchema]);
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file Template load-boundary schemas.
|
|
5
|
+
*
|
|
6
|
+
* The Zod schemas that integration template discovery runs a module's default
|
|
7
|
+
* export through (see `loadModuleWithSchema`). Kept free of any
|
|
8
|
+
* `@astryxdesign/core` import so the hot path that loads them (template
|
|
9
|
+
* discovery, `astryx init`) does not require core's built `dist/`. The
|
|
10
|
+
* authoring factories live in `@astryxdesign/core/authoring` and are re-exported
|
|
11
|
+
* from `../template.mjs` for the public `@astryxdesign/cli/template` surface.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import {z} from 'zod';
|
|
15
|
+
|
|
16
|
+
const PreviewSchema = z
|
|
17
|
+
.object({
|
|
18
|
+
image: z.string().optional(),
|
|
19
|
+
aspectRatio: z.string().optional(),
|
|
20
|
+
})
|
|
21
|
+
.strict();
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Shared authored-template shape. `type` is injected by the create* helpers,
|
|
25
|
+
* so authors never write it. Inline source/sourceFile are intentionally NOT
|
|
26
|
+
* part of v1 — a template's source is the required same-stem sibling file.
|
|
27
|
+
* Exported so integration template discovery can validate the stamped result.
|
|
28
|
+
*/
|
|
29
|
+
export const BaseTemplateSchema = z
|
|
30
|
+
.object({
|
|
31
|
+
name: z.string().min(1, 'name is required'),
|
|
32
|
+
description: z.string().min(1, 'description is required'),
|
|
33
|
+
category: z.string().optional(),
|
|
34
|
+
componentsUsed: z.array(z.string()).optional(),
|
|
35
|
+
preview: PreviewSchema.optional(),
|
|
36
|
+
})
|
|
37
|
+
.strict();
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* The metadata envelope integration template discovery validates: a stamped
|
|
41
|
+
* template doc. This is the LOAD-boundary contract — a hand-written plain
|
|
42
|
+
* object that matches this shape is accepted (discovery does not check "was it
|
|
43
|
+
* made by the factory", only the shape).
|
|
44
|
+
*/
|
|
45
|
+
export const TemplateEnvelopeSchema = BaseTemplateSchema.extend({
|
|
46
|
+
type: z.enum(['page', 'block']),
|
|
47
|
+
});
|
package/src/template.mjs
CHANGED
|
@@ -1,73 +1,15 @@
|
|
|
1
1
|
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* @file Static template authoring API.
|
|
4
|
+
* @file Static template authoring API (public `@astryxdesign/cli/template`).
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
* `
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* template discovery runs the module's default export through
|
|
13
|
-
* {@link TemplateEnvelopeSchema} (see `loadModuleWithSchema`).
|
|
6
|
+
* The `createPageTemplate`/`createBlockTemplate` authoring helpers now live in
|
|
7
|
+
* `@astryxdesign/core/authoring` and are re-exported here so existing
|
|
8
|
+
* `@astryxdesign/cli/template` imports keep working. The Zod load-boundary
|
|
9
|
+
* schemas live in `./schemas/template-schema.mjs` (core-free) and are
|
|
10
|
+
* re-exported here for back-compat; internal hot-path code imports them from
|
|
11
|
+
* the schema module directly so it never depends on core's built `dist/`.
|
|
14
12
|
*/
|
|
15
13
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const PreviewSchema = z
|
|
19
|
-
.object({
|
|
20
|
-
image: z.string().optional(),
|
|
21
|
-
aspectRatio: z.string().optional(),
|
|
22
|
-
})
|
|
23
|
-
.strict();
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Shared authored-template shape. `type` is injected by the create* helpers,
|
|
27
|
-
* so authors never write it. Inline source/sourceFile are intentionally NOT
|
|
28
|
-
* part of v1 — a template's source is the required same-stem sibling file.
|
|
29
|
-
* Exported so integration template discovery can validate the stamped result.
|
|
30
|
-
*/
|
|
31
|
-
export const BaseTemplateSchema = z
|
|
32
|
-
.object({
|
|
33
|
-
name: z.string().min(1, 'name is required'),
|
|
34
|
-
description: z.string().min(1, 'description is required'),
|
|
35
|
-
category: z.string().optional(),
|
|
36
|
-
componentsUsed: z.array(z.string()).optional(),
|
|
37
|
-
preview: PreviewSchema.optional(),
|
|
38
|
-
})
|
|
39
|
-
.strict();
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* The metadata envelope integration template discovery validates: a stamped
|
|
43
|
-
* template doc. This is the LOAD-boundary contract — a hand-written plain
|
|
44
|
-
* object that matches this shape is accepted (discovery does not check "was it
|
|
45
|
-
* made by the factory", only the shape).
|
|
46
|
-
*/
|
|
47
|
-
export const TemplateEnvelopeSchema = BaseTemplateSchema.extend({
|
|
48
|
-
type: z.enum(['page', 'block']),
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Author an Astryx page template doc. Stamp-only: returns the def with
|
|
53
|
-
* `type: 'page'` injected. Validation happens at the load boundary.
|
|
54
|
-
*
|
|
55
|
-
* @template {import('./types/template-api').AstryxPageTemplateInput} T
|
|
56
|
-
* @param {T} def
|
|
57
|
-
* @returns {T & {type: 'page'}}
|
|
58
|
-
*/
|
|
59
|
-
export function createPageTemplate(def) {
|
|
60
|
-
return /** @type {T & {type: 'page'}} */ ({...def, type: 'page'});
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Author an Astryx block template doc. Stamp-only: returns the def with
|
|
65
|
-
* `type: 'block'` injected. Validation happens at the load boundary.
|
|
66
|
-
*
|
|
67
|
-
* @template {import('./types/template-api').AstryxBlockTemplateInput} T
|
|
68
|
-
* @param {T} def
|
|
69
|
-
* @returns {T & {type: 'block'}}
|
|
70
|
-
*/
|
|
71
|
-
export function createBlockTemplate(def) {
|
|
72
|
-
return /** @type {T & {type: 'block'}} */ ({...def, type: 'block'});
|
|
73
|
-
}
|
|
14
|
+
export {createPageTemplate, createBlockTemplate} from '@astryxdesign/core/authoring';
|
|
15
|
+
export {BaseTemplateSchema, TemplateEnvelopeSchema} from './schemas/template-schema.mjs';
|
package/src/types/config.d.ts
CHANGED
|
@@ -1,70 +1,15 @@
|
|
|
1
1
|
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* The config-authoring surface moved to `@astryxdesign/core/config` so an app's
|
|
5
|
+
* config file gets type feedback without depending on the CLI. Re-exported here
|
|
6
|
+
* so existing `@astryxdesign/cli/config` type imports keep resolving.
|
|
6
7
|
*/
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* A post-codemod hook. `buildCommand` receives the package directory and the
|
|
19
|
-
* list of files changed by codemods, and returns the command to run (or a
|
|
20
|
-
* nullish value to skip).
|
|
21
|
-
*/
|
|
22
|
-
export type PostCodemodHook = {
|
|
23
|
-
name?: string;
|
|
24
|
-
buildCommand: (ctx: {
|
|
25
|
-
packageDir: string;
|
|
26
|
-
files: string[];
|
|
27
|
-
}) =>
|
|
28
|
-
| PostCodemodCommand
|
|
29
|
-
| null
|
|
30
|
-
| undefined
|
|
31
|
-
| Promise<PostCodemodCommand | null | undefined>;
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
/** A component XLE layout expressions can reference by name via `{hint}`. */
|
|
35
|
-
export interface XleComponent {
|
|
36
|
-
/** Import specifier the component is imported from, e.g. '@/components/KpiCard'. */
|
|
37
|
-
from: string;
|
|
38
|
-
/** Optional human description shown in tooling. */
|
|
39
|
-
description?: string;
|
|
40
|
-
/** Import as the module's default export instead of a named export. Defaults to false. */
|
|
41
|
-
default?: boolean;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/** User config exported from astryx.config.{ts,mjs,js}. */
|
|
45
|
-
export interface AstryxConfig {
|
|
46
|
-
/** Integration package names to load. */
|
|
47
|
-
integrations?: string[];
|
|
48
|
-
/** Where to file issues/feedback for this project. */
|
|
49
|
-
issuesUrl?: string;
|
|
50
|
-
/** Lifecycle hooks. */
|
|
51
|
-
hooks?: {
|
|
52
|
-
postCodemod?: PostCodemodHook[];
|
|
53
|
-
};
|
|
54
|
-
/**
|
|
55
|
-
* EXPERIMENTAL — shape may change and is not part of the stable config
|
|
56
|
-
* contract. Provisional home for features still being proven out.
|
|
57
|
-
*/
|
|
58
|
-
experimental?: {
|
|
59
|
-
/** Experimental XLE (layout expression) configuration. */
|
|
60
|
-
xle?: {
|
|
61
|
-
/**
|
|
62
|
-
* Register app-local components so XLE layout expressions can
|
|
63
|
-
* reference them by name via {hint}. Keyed by component name.
|
|
64
|
-
*/
|
|
65
|
-
components?: Record<string, XleComponent>;
|
|
66
|
-
};
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export declare function createConfig<T extends AstryxConfig>(config: T): T;
|
|
8
|
+
export type {
|
|
9
|
+
PostCodemodCommand,
|
|
10
|
+
PostCodemodHook,
|
|
11
|
+
XleComponent,
|
|
12
|
+
AstryxConfig,
|
|
13
|
+
} from '@astryxdesign/core/config';
|
|
14
|
+
|
|
15
|
+
export {createConfig} from '@astryxdesign/core/config';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The doc-authoring surface moved to `@astryxdesign/core/authoring`. Re-exported
|
|
5
|
+
* here so existing `@astryxdesign/cli/doc` type imports keep resolving. The Zod
|
|
6
|
+
* load-boundary schemas remain in the CLI (see `src/doc.mjs`).
|
|
7
|
+
*/
|
|
8
|
+
export type {
|
|
9
|
+
AstryxBaseDocInput,
|
|
10
|
+
AstryxPropInput,
|
|
11
|
+
AstryxParamInput,
|
|
12
|
+
AstryxReturnInput,
|
|
13
|
+
AstryxComponentDocInput,
|
|
14
|
+
AstryxFunctionDocInput,
|
|
15
|
+
AstryxGenericDocInput,
|
|
16
|
+
AstryxComponentDoc,
|
|
17
|
+
} from '@astryxdesign/core/authoring';
|
|
18
|
+
|
|
19
|
+
export {
|
|
20
|
+
createComponentDoc,
|
|
21
|
+
createFunctionDoc,
|
|
22
|
+
createDoc,
|
|
23
|
+
} from '@astryxdesign/core/authoring';
|
|
@@ -1,21 +1,14 @@
|
|
|
1
1
|
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* The integration-manifest authoring surface moved to
|
|
5
|
+
* `@astryxdesign/core/authoring`. `AstryxIntegration` and `createIntegration`
|
|
6
|
+
* are re-exported here so existing `@astryxdesign/cli/integration` type imports
|
|
7
|
+
* keep resolving. `AstryxIntegrationIssue` stays in the CLI — it is an internal
|
|
8
|
+
* validation type, not part of the authoring surface.
|
|
8
9
|
*/
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
components?: string;
|
|
12
|
-
/** Relative path to the templates root (resolved to absolute). */
|
|
13
|
-
templates?: string;
|
|
14
|
-
/** Relative path to the codemods root (resolved to absolute). */
|
|
15
|
-
codemods?: string;
|
|
16
|
-
/** Where to file issues/feedback for this integration. */
|
|
17
|
-
issuesUrl?: string;
|
|
18
|
-
}
|
|
10
|
+
export type {AstryxIntegration} from '@astryxdesign/core/authoring';
|
|
11
|
+
export {createIntegration} from '@astryxdesign/core/authoring';
|
|
19
12
|
|
|
20
13
|
/** An issue surfaced by an integration. */
|
|
21
14
|
export interface AstryxIntegrationIssue {
|
|
@@ -23,7 +16,3 @@ export interface AstryxIntegrationIssue {
|
|
|
23
16
|
severity: 'warning' | 'error';
|
|
24
17
|
message: string;
|
|
25
18
|
}
|
|
26
|
-
|
|
27
|
-
export declare function createIntegration<T extends AstryxIntegration>(
|
|
28
|
-
integration: T,
|
|
29
|
-
): T;
|
|
@@ -1,54 +1,18 @@
|
|
|
1
1
|
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
* `@astryxdesign/cli/template
|
|
6
|
-
*
|
|
7
|
-
* A template doc lives in a `<id>.doc.{ts,mjs,js}` file with a required
|
|
8
|
-
* same-stem sibling source file (`<id>.tsx`). The doc's `type` (page or
|
|
9
|
-
* block) — injected by the create* helpers — decides how the template is
|
|
10
|
-
* scaffolded; there is no `/pages` vs `/blocks` directory requirement.
|
|
4
|
+
* The template-authoring surface moved to `@astryxdesign/core/authoring`.
|
|
5
|
+
* Re-exported here so existing `@astryxdesign/cli/template` type imports keep
|
|
6
|
+
* resolving.
|
|
11
7
|
*/
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
export
|
|
23
|
-
/** Human-readable template name. Required. */
|
|
24
|
-
name: string;
|
|
25
|
-
/** One-line description of what the template provides. Required. */
|
|
26
|
-
description: string;
|
|
27
|
-
/** Optional grouping/category label. */
|
|
28
|
-
category?: string;
|
|
29
|
-
/** Component display names the template composes. */
|
|
30
|
-
componentsUsed?: string[];
|
|
31
|
-
/** Optional preview metadata. */
|
|
32
|
-
preview?: AstryxTemplatePreview;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/** Input accepted by {@link createPageTemplate} (no `type` field). */
|
|
36
|
-
export type AstryxPageTemplateInput = AstryxTemplateInput;
|
|
37
|
-
/** Input accepted by {@link createBlockTemplate} (no `type` field). */
|
|
38
|
-
export type AstryxBlockTemplateInput = AstryxTemplateInput;
|
|
39
|
-
|
|
40
|
-
/** A validated page template doc. */
|
|
41
|
-
export type AstryxPageTemplate = AstryxTemplateInput & {type: 'page'};
|
|
42
|
-
/** A validated block template doc. */
|
|
43
|
-
export type AstryxBlockTemplate = AstryxTemplateInput & {type: 'block'};
|
|
44
|
-
|
|
45
|
-
/** A validated template doc (page or block). */
|
|
46
|
-
export type AstryxTemplate = AstryxPageTemplate | AstryxBlockTemplate;
|
|
47
|
-
|
|
48
|
-
export declare function createPageTemplate<T extends AstryxPageTemplateInput>(
|
|
49
|
-
def: T,
|
|
50
|
-
): T & {type: 'page'};
|
|
51
|
-
|
|
52
|
-
export declare function createBlockTemplate<T extends AstryxBlockTemplateInput>(
|
|
53
|
-
def: T,
|
|
54
|
-
): T & {type: 'block'};
|
|
8
|
+
export type {
|
|
9
|
+
AstryxTemplatePreview,
|
|
10
|
+
AstryxTemplateInput,
|
|
11
|
+
AstryxPageTemplateInput,
|
|
12
|
+
AstryxBlockTemplateInput,
|
|
13
|
+
AstryxPageTemplate,
|
|
14
|
+
AstryxBlockTemplate,
|
|
15
|
+
AstryxTemplate,
|
|
16
|
+
} from '@astryxdesign/core/authoring';
|
|
17
|
+
|
|
18
|
+
export {createPageTemplate, createBlockTemplate} from '@astryxdesign/core/authoring';
|
|
@@ -7,28 +7,26 @@ import {AvatarGroup, AvatarGroupOverflow} from '@astryxdesign/core/AvatarGroup';
|
|
|
7
7
|
import {Stack} from '@astryxdesign/core/Layout';
|
|
8
8
|
import {Text} from '@astryxdesign/core/Text';
|
|
9
9
|
|
|
10
|
-
const CDN = 'https://lookaside.facebook.com/assets/astryx';
|
|
11
|
-
|
|
12
10
|
const USERS = [
|
|
13
11
|
{
|
|
14
12
|
name: 'Ami Pena',
|
|
15
|
-
src:
|
|
13
|
+
src: 'https://lookaside.facebook.com/assets/astryx/DATA-Ami-Pena.png',
|
|
16
14
|
},
|
|
17
15
|
{
|
|
18
16
|
name: 'Drew Young',
|
|
19
|
-
src:
|
|
17
|
+
src: 'https://lookaside.facebook.com/assets/astryx/DATA-Drew-Young.png',
|
|
20
18
|
},
|
|
21
19
|
{
|
|
22
20
|
name: 'Gabriela Fernandez',
|
|
23
|
-
src:
|
|
21
|
+
src: 'https://lookaside.facebook.com/assets/astryx/DATA-Gabriela-Fernandez.png',
|
|
24
22
|
},
|
|
25
23
|
{
|
|
26
24
|
name: 'Jihoo Song',
|
|
27
|
-
src:
|
|
25
|
+
src: 'https://lookaside.facebook.com/assets/astryx/DATA-Jihoo-Song.png',
|
|
28
26
|
},
|
|
29
27
|
{
|
|
30
28
|
name: 'Nam Tran',
|
|
31
|
-
src:
|
|
29
|
+
src: 'https://lookaside.facebook.com/assets/astryx/DATA-Nam-Tran.png',
|
|
32
30
|
},
|
|
33
31
|
];
|
|
34
32
|
|
|
@@ -5,29 +5,27 @@
|
|
|
5
5
|
import {Avatar, AvatarStatusDot} from '@astryxdesign/core/Avatar';
|
|
6
6
|
import {Stack} from '@astryxdesign/core/Layout';
|
|
7
7
|
|
|
8
|
-
const CDN = 'https://lookaside.facebook.com/assets/astryx';
|
|
9
|
-
|
|
10
8
|
export default function AvatarShowcase() {
|
|
11
9
|
return (
|
|
12
10
|
<Stack direction="horizontal" gap={4} vAlign="center">
|
|
13
11
|
<Avatar
|
|
14
|
-
src=
|
|
12
|
+
src="https://lookaside.facebook.com/assets/astryx/DATA-Ana-Thomas.png"
|
|
15
13
|
name="Ana Thomas"
|
|
16
14
|
size="large"
|
|
17
15
|
status={<AvatarStatusDot variant="success" label="Online" />}
|
|
18
16
|
/>
|
|
19
17
|
<Avatar
|
|
20
|
-
src=
|
|
18
|
+
src="https://lookaside.facebook.com/assets/astryx/DATA-Drew-Young.png"
|
|
21
19
|
name="Drew Young"
|
|
22
20
|
size="large"
|
|
23
21
|
/>
|
|
24
22
|
<Avatar
|
|
25
|
-
src=
|
|
23
|
+
src="https://lookaside.facebook.com/assets/astryx/DATA-Jihoo-Song.png"
|
|
26
24
|
name="Jihoo Song"
|
|
27
25
|
size="large"
|
|
28
26
|
/>
|
|
29
27
|
<Avatar
|
|
30
|
-
src=
|
|
28
|
+
src="https://lookaside.facebook.com/assets/astryx/DATA-Nam-Tran.png"
|
|
31
29
|
name="Nam Tran"
|
|
32
30
|
size="large"
|
|
33
31
|
status={<AvatarStatusDot variant="error" label="Online" />}
|
|
@@ -6,24 +6,22 @@ import {Avatar, AvatarStatusDot} from '@astryxdesign/core/Avatar';
|
|
|
6
6
|
import {Stack} from '@astryxdesign/core/Layout';
|
|
7
7
|
import {Text} from '@astryxdesign/core/Text';
|
|
8
8
|
|
|
9
|
-
const CDN = 'https://lookaside.facebook.com/assets/astryx';
|
|
10
|
-
|
|
11
9
|
const USERS = [
|
|
12
10
|
{
|
|
13
11
|
name: 'Itai Jordaan',
|
|
14
|
-
src:
|
|
12
|
+
src: 'https://lookaside.facebook.com/assets/astryx/DATA-Itai-Jordaan.png',
|
|
15
13
|
role: 'Engineering Lead',
|
|
16
14
|
variant: 'success' as const,
|
|
17
15
|
},
|
|
18
16
|
{
|
|
19
17
|
name: 'Margot Schroder',
|
|
20
|
-
src:
|
|
18
|
+
src: 'https://lookaside.facebook.com/assets/astryx/DATA-Margot-Schroder.png',
|
|
21
19
|
role: 'Product Designer',
|
|
22
20
|
variant: 'neutral' as const,
|
|
23
21
|
},
|
|
24
22
|
{
|
|
25
23
|
name: 'Daniela Gimenez',
|
|
26
|
-
src:
|
|
24
|
+
src: 'https://lookaside.facebook.com/assets/astryx/DATA-Daniela-Gimenez.png',
|
|
27
25
|
role: 'Engineering Manager',
|
|
28
26
|
variant: 'error' as const,
|
|
29
27
|
},
|