@astryxdesign/cli 0.1.6-canary.fec872b → 0.1.6

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 (54) hide show
  1. package/package.json +9 -13
  2. package/src/api/template.mjs +28 -104
  3. package/src/api/validate-integration.mjs +8 -0
  4. package/src/codemods/__tests__/registry.test.mjs +0 -1
  5. package/src/codemods/registry.mjs +0 -1
  6. package/src/config.mjs +14 -5
  7. package/src/integration.mjs +15 -4
  8. package/src/lib/component-discovery.mjs +5 -15
  9. package/src/lib/component-format.mjs +13 -45
  10. package/src/lib/component-format.test.mjs +1 -95
  11. package/src/lib/component-loader.mjs +2 -104
  12. package/src/lib/config-schema.mjs +30 -0
  13. package/src/lib/hook-format.mjs +3 -8
  14. package/src/lib/xle/registry.mjs +5 -0
  15. package/src/template.mjs +67 -9
  16. package/src/types/config.d.ts +66 -11
  17. package/src/types/integration.d.ts +18 -7
  18. package/src/types/template-api.d.ts +50 -14
  19. package/templates/blocks/components/Avatar/AvatarGroup.tsx +7 -5
  20. package/templates/blocks/components/Avatar/AvatarShowcase.tsx +6 -4
  21. package/templates/blocks/components/Avatar/AvatarUserCard.tsx +5 -3
  22. package/templates/blocks/components/Avatar/AvatarWithImage.tsx +6 -8
  23. package/templates/blocks/components/Avatar/AvatarWithStatus.tsx +5 -3
  24. package/templates/blocks/components/ChatComposerInput/ChatComposerInputControlledInput.tsx +1 -1
  25. package/templates/blocks/components/ChatComposerInput/ChatComposerInputDisabled.tsx +1 -1
  26. package/templates/blocks/components/ChatComposerInput/ChatComposerInputMentionTrigger.tsx +1 -1
  27. package/templates/blocks/components/ChatComposerInput/ChatComposerInputMultipleTriggers.tsx +1 -1
  28. package/templates/blocks/components/ChatComposerInput/ChatComposerInputShowcase.tsx +1 -1
  29. package/templates/blocks/components/ChatComposerInput/ChatComposerInputSlashCommands.tsx +1 -1
  30. package/templates/pages/ide/page.tsx +41 -35
  31. package/templates/pages/theme-showcase/page.tsx +7 -7
  32. package/templates/themes/neutral/neutralTheme.ts +32 -63
  33. package/docs/integration-authoring.md +0 -105
  34. package/docs/internationalization.doc.mjs +0 -243
  35. package/src/api/integration-block-exports.test.mjs +0 -240
  36. package/src/api/template-suffix.test.mjs +0 -246
  37. package/src/codemods/transforms/v0.1.7/__tests__/migrate-table-tableprops-to-direct-props.test.mjs +0 -120
  38. package/src/codemods/transforms/v0.1.7/index.mjs +0 -19
  39. package/src/codemods/transforms/v0.1.7/migrate-table-tableprops-to-direct-props.mjs +0 -188
  40. package/src/doc.mjs +0 -27
  41. package/src/doc.test.mjs +0 -383
  42. package/src/lib/component-discovery.importpath.test.mjs +0 -59
  43. package/src/lib/componentDocOverlay.test.mjs +0 -111
  44. package/src/schemas/doc-schema.mjs +0 -226
  45. package/src/schemas/template-schema.mjs +0 -47
  46. package/src/types/doc.d.ts +0 -23
  47. package/templates/blocks/components/VisuallyHidden/VisuallyHiddenLiveRegion.doc.mjs +0 -14
  48. package/templates/blocks/components/VisuallyHidden/VisuallyHiddenLiveRegion.tsx +0 -41
  49. package/templates/blocks/components/VisuallyHidden/VisuallyHiddenShowcase.doc.mjs +0 -13
  50. package/templates/blocks/components/VisuallyHidden/VisuallyHiddenShowcase.tsx +0 -78
  51. package/templates/blocks/components/VisuallyHidden/VisuallyHiddenStructuralHeading.doc.mjs +0 -14
  52. package/templates/blocks/components/VisuallyHidden/VisuallyHiddenStructuralHeading.tsx +0 -38
  53. package/templates/blocks/components/VisuallyHidden/VisuallyHiddenSupplementaryContext.doc.mjs +0 -14
  54. package/templates/blocks/components/VisuallyHidden/VisuallyHiddenSupplementaryContext.tsx +0 -47
@@ -5,59 +5,6 @@
5
5
  */
6
6
 
7
7
  import {pathToFileURL} from 'node:url';
8
- import {importUserModule} from './module-loader.mjs';
9
- import {formatZodError} from './config-schema.mjs';
10
- import {ComponentDocSchema} from '../schemas/doc-schema.mjs';
11
-
12
- /**
13
- * Load a component doc through the shared load/validation boundary.
14
- *
15
- * This is the typed counterpart to {@link loadDocs}: it loads `.doc.ts` via
16
- * jiti (and `.doc.mjs`/`.doc.js` via native import) and validates against
17
- * {@link ComponentDocSchema}. That schema accepts BOTH formats, so this loader
18
- * reads whichever the file uses:
19
- * - NEW: the factory default export
20
- * (`export default createComponentDoc({...})` / `createFunctionDoc` /
21
- * `createDoc`) — the same single-export convention
22
- * {@link loadModuleWithSchema} uses for config/integration/template. These
23
- * carry a stamped `type` and validate against the matching per-kind schema.
24
- * - OLD: the legacy loose `export const docs = {...}` (no `type`), validated
25
- * against the permissive legacy union.
26
- * The default export wins when both are present. Throws a readable
27
- * `formatZodError`-style message on failure. Translations (`docsZh`/
28
- * `docsDense`) are merged exactly as {@link loadDocs} does so callers see
29
- * identical output.
30
- *
31
- * @param {string} docPath absolute path to a `.doc.{ts,mjs,js}` file
32
- * @param {{zh?: boolean, dense?: boolean, lang?: string}} [opts]
33
- * @returns {Promise<object>} the validated (and optionally translated) doc
34
- */
35
- export async function loadComponentDoc(
36
- docPath,
37
- {zh = false, dense = false, lang} = {},
38
- ) {
39
- const mod = await importUserModule(docPath);
40
- const authored = mod?.default ?? mod?.docs;
41
-
42
- const result = ComponentDocSchema.safeParse(authored);
43
- if (!result.success) {
44
- throw new Error(formatZodError(docPath, result.error));
45
- }
46
- const docs = authored;
47
-
48
- const locale = lang || (dense ? 'dense' : zh ? 'zh' : null);
49
- if (!locale) return docs;
50
-
51
- const translationKey =
52
- locale === 'zh' ? 'docsZh' : locale === 'dense' ? 'docsDense' : null;
53
- if (!translationKey || !mod[translationKey]) return docs;
54
-
55
- const translation = mod[translationKey];
56
- if (translation.props || translation.components?.some(c => c.props)) {
57
- return translation;
58
- }
59
- return mergeTranslation(docs, translation);
60
- }
61
8
 
62
9
  export function mergeTranslation(docs, translation) {
63
10
  if (!translation) return docs;
@@ -144,64 +91,15 @@ export async function loadDocs(readmePath, {zh = false, dense = false, lang} = {
144
91
 
145
92
  const translation = mod[translationKey];
146
93
 
147
- // A full ComponentDoc-shaped translation (legacy docsZh shape) used to be
148
- // returned wholesale. That made it a REPLACEMENT, not an overlay: any prop
149
- // the translation had not caught up with simply ceased to exist —
150
- // `component Button --zh` silently omitted `isInterruptible` and
151
- // `isIconOnly`. A reader of the translated docs cannot discover a prop that
152
- // is not there. Overlay it instead, so an untranslated prop falls back to
153
- // its English entry. (Same principle as the reference-doc overlays, #2182.)
94
+ // If the translation is a full ComponentDoc (legacy docsZh shape), return it directly
154
95
  if (translation.props || translation.components?.some(c => c.props)) {
155
- return overlayComponentDoc(docs, translation);
96
+ return translation;
156
97
  }
157
98
 
158
99
  // Otherwise it's a TranslationDoc — merge it onto docs
159
100
  return mergeTranslation(docs, translation);
160
101
  }
161
102
 
162
- /**
163
- * Overlay a full-ComponentDoc-shaped translation onto the English doc.
164
- *
165
- * Base order and completeness win; the translation supplies text for the
166
- * entries it covers. Props are matched by name, never by position, so a
167
- * translation that is missing entries (or lists them in another order) can no
168
- * longer drop or misattribute one.
169
- *
170
- * @param {any} docs Base (English) component doc.
171
- * @param {any} translation Translated doc, possibly covering only some props.
172
- * @returns {any} Merged doc with every base prop present.
173
- */
174
- function overlayComponentDoc(docs, translation) {
175
- /** Merge one prop list: keep base entries and order, translate what's covered. */
176
- const overlayProps = (baseProps, tProps) => {
177
- if (!baseProps) return baseProps;
178
- const byName = new Map((tProps ?? []).map(p => [p.name, p]));
179
- return baseProps.map(prop => {
180
- const t = byName.get(prop.name);
181
- // Take the translated text, but never let it drop the prop's contract
182
- // (type/default/required stay authoritative from the English doc).
183
- return t ? {...prop, ...t, name: prop.name, type: prop.type} : prop;
184
- });
185
- };
186
-
187
- const merged = {...docs, ...translation};
188
-
189
- merged.props = overlayProps(docs.props, translation.props);
190
-
191
- if (docs.components) {
192
- const tByName = new Map(
193
- (translation.components ?? []).map(c => [c.name, c]),
194
- );
195
- merged.components = docs.components.map(base => {
196
- const t = tByName.get(base.name);
197
- if (!t) return base;
198
- return {...base, ...t, props: overlayProps(base.props, t.props)};
199
- });
200
- }
201
-
202
- return merged;
203
- }
204
-
205
103
  /**
206
104
  * Find the doc file for a component, checking both top-level
207
105
  * and nested directories. Prefers {Name}.doc.mjs, then README.md
@@ -73,3 +73,33 @@ export function formatZodError(label, error) {
73
73
  .join('; ');
74
74
  return `${label} is invalid: ${issues}`;
75
75
  }
76
+
77
+ /**
78
+ * @param {unknown} config
79
+ * @returns {import('../types/config').AstryxConfig}
80
+ */
81
+ export function validateConfig(config) {
82
+ const result = AstryxConfigSchema.safeParse(config);
83
+ if (!result.success) {
84
+ throw new Error(
85
+ formatZodError('astryx.config default export', result.error),
86
+ );
87
+ }
88
+ return result.data;
89
+ }
90
+
91
+ /**
92
+ * @param {unknown} integration
93
+ * @param {string} [label]
94
+ * @returns {import('../types/integration').AstryxIntegration}
95
+ */
96
+ export function validateIntegration(
97
+ integration,
98
+ label = 'integration manifest',
99
+ ) {
100
+ const result = AstryxIntegrationSchema.safeParse(integration);
101
+ if (!result.success) {
102
+ throw new Error(formatZodError(label, result.error));
103
+ }
104
+ return result.data;
105
+ }
@@ -11,7 +11,6 @@
11
11
 
12
12
  import {discoverHooks, findHookDoc} from './hook-discovery.mjs';
13
13
  import {loadDocs} from './component-loader.mjs';
14
- import {mdCell} from './component-format.mjs';
15
14
 
16
15
  /**
17
16
  * Build a signature string from hook docs.
@@ -52,11 +51,9 @@ function formatParamsTable(params) {
52
51
  lines.push('| Param | Type | Default | Description |');
53
52
  lines.push('|-------|------|---------|-------------|');
54
53
  for (const p of params) {
55
- const def = p.default ? `\`${mdCell(p.default)}\`` : '\u2014';
54
+ const def = p.default ? `\`${p.default}\`` : '\u2014';
56
55
  const req = p.required ? ' **(required)**' : '';
57
- lines.push(
58
- `| \`${mdCell(p.name)}\` | \`${mdCell(p.type)}\` | ${def} | ${mdCell(p.description)}${req} |`,
59
- );
56
+ lines.push(`| \`${p.name}\` | \`${p.type}\` | ${def} | ${p.description}${req} |`);
60
57
  }
61
58
  return lines.join('\n');
62
59
  }
@@ -70,9 +67,7 @@ function formatReturnsTable(returns) {
70
67
  lines.push('| Field | Type | Description |');
71
68
  lines.push('|-------|------|-------------|');
72
69
  for (const r of returns) {
73
- lines.push(
74
- `| \`${mdCell(r.name)}\` | \`${mdCell(r.type)}\` | ${mdCell(r.description)} |`,
75
- );
70
+ lines.push(`| \`${r.name}\` | \`${r.type}\` | ${r.description} |`);
76
71
  }
77
72
  return lines.join('\n');
78
73
  }
@@ -230,3 +230,8 @@ export async function buildRegistry({cwd = process.cwd()} = {}) {
230
230
  };
231
231
  return cachedRegistry;
232
232
  }
233
+
234
+ /** Test seam — drop the module-level cache. */
235
+ export function resetRegistryCache() {
236
+ cachedRegistry = null;
237
+ }
package/src/template.mjs CHANGED
@@ -1,15 +1,73 @@
1
1
  // Copyright (c) Meta Platforms, Inc. and affiliates.
2
2
 
3
3
  /**
4
- * @file Static template authoring API (public `@astryxdesign/cli/template`).
4
+ * @file Static template authoring API.
5
5
  *
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/`.
6
+ * Helpers for authoring Astryx page/block template docs. Like
7
+ * `createConfig`/`createIntegration`, these are tiny runtime identity helpers
8
+ * whose real value is the exported TypeScript surface from
9
+ * `@astryxdesign/cli/template`. They inject the discriminant `type` so a
10
+ * discovered doc always knows whether it is a page or a block. They do NOT
11
+ * validate validation happens at the load boundary, where integration
12
+ * template discovery runs the module's default export through
13
+ * {@link TemplateEnvelopeSchema} (see `loadModuleWithSchema`).
12
14
  */
13
15
 
14
- export {createPageTemplate, createBlockTemplate} from '@astryxdesign/core/authoring';
15
- export {BaseTemplateSchema, TemplateEnvelopeSchema} from './schemas/template-schema.mjs';
16
+ import {z} from 'zod';
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
+ }
@@ -1,15 +1,70 @@
1
1
  // Copyright (c) Meta Platforms, Inc. and affiliates.
2
2
 
3
3
  /**
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.
4
+ * A command to run as part of a post-codemod hook. Returned by a hook's
5
+ * `buildCommand` and executed via `execFile` after codemods write files.
7
6
  */
8
- export type {
9
- PostCodemodCommand,
10
- PostCodemodHook,
11
- XleComponent,
12
- AstryxConfig,
13
- } from '@astryxdesign/core/config';
14
-
15
- export {createConfig} from '@astryxdesign/core/config';
7
+ export interface PostCodemodCommand {
8
+ command: string;
9
+ args?: string[];
10
+ options?: {
11
+ cwd?: string;
12
+ env?: NodeJS.ProcessEnv;
13
+ timeout?: number;
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;
@@ -1,14 +1,21 @@
1
1
  // Copyright (c) Meta Platforms, Inc. and affiliates.
2
2
 
3
3
  /**
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.
4
+ * Integration manifest exported from a conventional root manifest file
5
+ * (astryx.integration.{ts,mjs,js}) sibling to the integration package's
6
+ * package.json. Identity (name/version) comes from the package's
7
+ * package.json, not from the manifest.
9
8
  */
10
- export type {AstryxIntegration} from '@astryxdesign/core/authoring';
11
- export {createIntegration} from '@astryxdesign/core/authoring';
9
+ export interface AstryxIntegration {
10
+ /** Relative path to the components/docs root (resolved to absolute). */
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
+ }
12
19
 
13
20
  /** An issue surfaced by an integration. */
14
21
  export interface AstryxIntegrationIssue {
@@ -16,3 +23,7 @@ export interface AstryxIntegrationIssue {
16
23
  severity: 'warning' | 'error';
17
24
  message: string;
18
25
  }
26
+
27
+ export declare function createIntegration<T extends AstryxIntegration>(
28
+ integration: T,
29
+ ): T;
@@ -1,18 +1,54 @@
1
1
  // Copyright (c) Meta Platforms, Inc. and affiliates.
2
2
 
3
3
  /**
4
- * The template-authoring surface moved to `@astryxdesign/core/authoring`.
5
- * Re-exported here so existing `@astryxdesign/cli/template` type imports keep
6
- * resolving.
4
+ * Authoring surface for Astryx static templates, exported from
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.
7
11
  */
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';
12
+
13
+ /** Optional preview metadata for a template (used by docs surfaces). */
14
+ export interface AstryxTemplatePreview {
15
+ /** Path or URL to a preview image. */
16
+ image?: string;
17
+ /** CSS aspect-ratio hint for the preview, e.g. "16 / 9". */
18
+ aspectRatio?: string;
19
+ }
20
+
21
+ /** Fields common to page and block template docs (without the `type` tag). */
22
+ export interface AstryxTemplateInput {
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'};
@@ -7,26 +7,28 @@ 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
+
10
12
  const USERS = [
11
13
  {
12
14
  name: 'Ami Pena',
13
- src: 'https://lookaside.facebook.com/assets/astryx/DATA-Ami-Pena.png',
15
+ src: `${CDN}/DATA-Ami-Pena.png`,
14
16
  },
15
17
  {
16
18
  name: 'Drew Young',
17
- src: 'https://lookaside.facebook.com/assets/astryx/DATA-Drew-Young.png',
19
+ src: `${CDN}/DATA-Drew-Young.png`,
18
20
  },
19
21
  {
20
22
  name: 'Gabriela Fernandez',
21
- src: 'https://lookaside.facebook.com/assets/astryx/DATA-Gabriela-Fernandez.png',
23
+ src: `${CDN}/DATA-Gabriela-Fernandez.png`,
22
24
  },
23
25
  {
24
26
  name: 'Jihoo Song',
25
- src: 'https://lookaside.facebook.com/assets/astryx/DATA-Jihoo-Song.png',
27
+ src: `${CDN}/DATA-Jihoo-Song.png`,
26
28
  },
27
29
  {
28
30
  name: 'Nam Tran',
29
- src: 'https://lookaside.facebook.com/assets/astryx/DATA-Nam-Tran.png',
31
+ src: `${CDN}/DATA-Nam-Tran.png`,
30
32
  },
31
33
  ];
32
34
 
@@ -5,27 +5,29 @@
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
+
8
10
  export default function AvatarShowcase() {
9
11
  return (
10
12
  <Stack direction="horizontal" gap={4} vAlign="center">
11
13
  <Avatar
12
- src="https://lookaside.facebook.com/assets/astryx/DATA-Ana-Thomas.png"
14
+ src={`${CDN}/DATA-Ana-Thomas.png`}
13
15
  name="Ana Thomas"
14
16
  size="large"
15
17
  status={<AvatarStatusDot variant="success" label="Online" />}
16
18
  />
17
19
  <Avatar
18
- src="https://lookaside.facebook.com/assets/astryx/DATA-Drew-Young.png"
20
+ src={`${CDN}/DATA-Drew-Young.png`}
19
21
  name="Drew Young"
20
22
  size="large"
21
23
  />
22
24
  <Avatar
23
- src="https://lookaside.facebook.com/assets/astryx/DATA-Jihoo-Song.png"
25
+ src={`${CDN}/DATA-Jihoo-Song.png`}
24
26
  name="Jihoo Song"
25
27
  size="large"
26
28
  />
27
29
  <Avatar
28
- src="https://lookaside.facebook.com/assets/astryx/DATA-Nam-Tran.png"
30
+ src={`${CDN}/DATA-Nam-Tran.png`}
29
31
  name="Nam Tran"
30
32
  size="large"
31
33
  status={<AvatarStatusDot variant="error" label="Online" />}
@@ -6,22 +6,24 @@ 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
+
9
11
  const USERS = [
10
12
  {
11
13
  name: 'Itai Jordaan',
12
- src: 'https://lookaside.facebook.com/assets/astryx/DATA-Itai-Jordaan.png',
14
+ src: `${CDN}/DATA-Itai-Jordaan.png`,
13
15
  role: 'Engineering Lead',
14
16
  variant: 'success' as const,
15
17
  },
16
18
  {
17
19
  name: 'Margot Schroder',
18
- src: 'https://lookaside.facebook.com/assets/astryx/DATA-Margot-Schroder.png',
20
+ src: `${CDN}/DATA-Margot-Schroder.png`,
19
21
  role: 'Product Designer',
20
22
  variant: 'neutral' as const,
21
23
  },
22
24
  {
23
25
  name: 'Daniela Gimenez',
24
- src: 'https://lookaside.facebook.com/assets/astryx/DATA-Daniela-Gimenez.png',
26
+ src: `${CDN}/DATA-Daniela-Gimenez.png`,
25
27
  role: 'Engineering Manager',
26
28
  variant: 'error' as const,
27
29
  },
@@ -5,26 +5,24 @@
5
5
  import {Avatar} from '@astryxdesign/core/Avatar';
6
6
  import {Stack} from '@astryxdesign/core/Layout';
7
7
 
8
+ const CDN = 'https://lookaside.facebook.com/assets/astryx';
9
+
8
10
  export default function AvatarWithImage() {
9
11
  return (
10
12
  <Stack direction="horizontal" gap={4} vAlign="center">
13
+ <Avatar src={`${CDN}/DATA-Ami-Pena.png`} name="Ami Pena" size="tiny" />
11
14
  <Avatar
12
- src="https://lookaside.facebook.com/assets/astryx/DATA-Ami-Pena.png"
13
- name="Ami Pena"
14
- size="tiny"
15
- />
16
- <Avatar
17
- src="https://lookaside.facebook.com/assets/astryx/DATA-Ana-Thomas.png"
15
+ src={`${CDN}/DATA-Ana-Thomas.png`}
18
16
  name="Ana Thomas"
19
17
  size="small"
20
18
  />
21
19
  <Avatar
22
- src="https://lookaside.facebook.com/assets/astryx/DATA-Daniela-Gimenez.png"
20
+ src={`${CDN}/DATA-Daniela-Gimenez.png`}
23
21
  name="Daniela Gimenez"
24
22
  size="medium"
25
23
  />
26
24
  <Avatar
27
- src="https://lookaside.facebook.com/assets/astryx/DATA-Gabriela-Fernandez.png"
25
+ src={`${CDN}/DATA-Gabriela-Fernandez.png`}
28
26
  name="Gabriela Fernandez"
29
27
  size="large"
30
28
  />
@@ -5,23 +5,25 @@
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
+
8
10
  export default function AvatarWithStatus() {
9
11
  return (
10
12
  <Stack direction="horizontal" gap={4} vAlign="center">
11
13
  <Avatar
12
- src="https://lookaside.facebook.com/assets/astryx/DATA-Itai-Jordaan.png"
14
+ src={`${CDN}/DATA-Itai-Jordaan.png`}
13
15
  name="Itai Jordaan"
14
16
  size="large"
15
17
  status={<AvatarStatusDot variant="success" label="Online" />}
16
18
  />
17
19
  <Avatar
18
- src="https://lookaside.facebook.com/assets/astryx/DATA-Margot-Schroder.png"
20
+ src={`${CDN}/DATA-Margot-Schroder.png`}
19
21
  name="Margot Schroder"
20
22
  size="large"
21
23
  status={<AvatarStatusDot variant="neutral" label="Offline" />}
22
24
  />
23
25
  <Avatar
24
- src="https://lookaside.facebook.com/assets/astryx/DATA-Pablo-Morales.png"
26
+ src={`${CDN}/DATA-Pablo-Morales.png`}
25
27
  name="Pablo Morales"
26
28
  size="large"
27
29
  status={<AvatarStatusDot variant="error" label="Busy" />}
@@ -10,7 +10,7 @@ import {Text} from '@astryxdesign/core/Text';
10
10
  export default function ChatComposerInputControlledInput() {
11
11
  const [value, setValue] = useState('');
12
12
  return (
13
- <Stack direction="vertical" gap={3} style={{width: 450, maxWidth: '100%'}}>
13
+ <Stack direction="vertical" gap={3} style={{width: '100%', maxWidth: 450}}>
14
14
  <ChatComposer
15
15
  onSubmit={() => setValue('')}
16
16
  value={value}
@@ -7,7 +7,7 @@ import {Stack} from '@astryxdesign/core/Layout';
7
7
 
8
8
  export default function ChatComposerInputDisabled() {
9
9
  return (
10
- <Stack direction="vertical" style={{width: 450, maxWidth: '100%'}}>
10
+ <Stack direction="vertical" style={{width: '100%', maxWidth: 450}}>
11
11
  <ChatComposer
12
12
  onSubmit={() => {}}
13
13
  isDisabled