@ankhorage/zora 2.9.1 → 2.9.2
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/CHANGELOG.md +6 -0
- package/README.md +1 -1
- package/dist/components/button/meta.d.ts +15 -0
- package/dist/components/button/meta.d.ts.map +1 -1
- package/dist/components/button/meta.js +4 -0
- package/dist/components/button/meta.js.map +1 -1
- package/dist/components/button/themeRecipeMeta.d.ts +33 -0
- package/dist/components/button/themeRecipeMeta.d.ts.map +1 -0
- package/dist/components/button/themeRecipeMeta.js +33 -0
- package/dist/components/button/themeRecipeMeta.js.map +1 -0
- package/dist/components/card/meta.d.ts +17 -0
- package/dist/components/card/meta.d.ts.map +1 -1
- package/dist/components/card/meta.js +5 -0
- package/dist/components/card/meta.js.map +1 -1
- package/dist/components/card/themeRecipeMeta.d.ts +31 -0
- package/dist/components/card/themeRecipeMeta.d.ts.map +1 -0
- package/dist/components/card/themeRecipeMeta.js +31 -0
- package/dist/components/card/themeRecipeMeta.js.map +1 -0
- package/dist/components/text/meta.d.ts +33 -0
- package/dist/components/text/meta.d.ts.map +1 -1
- package/dist/components/text/meta.js +9 -0
- package/dist/components/text/meta.js.map +1 -1
- package/dist/components/text/themeRecipeMeta.d.ts +32 -0
- package/dist/components/text/themeRecipeMeta.d.ts.map +1 -0
- package/dist/components/text/themeRecipeMeta.js +32 -0
- package/dist/components/text/themeRecipeMeta.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/metadata/index.d.ts +4 -1
- package/dist/metadata/index.d.ts.map +1 -1
- package/dist/metadata/index.js +2 -0
- package/dist/metadata/index.js.map +1 -1
- package/dist/metadata/themeRecipeMeta.d.ts +3 -0
- package/dist/metadata/themeRecipeMeta.d.ts.map +1 -0
- package/dist/metadata/themeRecipeMeta.js +11 -0
- package/dist/metadata/themeRecipeMeta.js.map +1 -0
- package/dist/metadata/themeRecipeTypes.d.ts +31 -0
- package/dist/metadata/themeRecipeTypes.d.ts.map +1 -0
- package/dist/metadata/themeRecipeTypes.js +8 -0
- package/dist/metadata/themeRecipeTypes.js.map +1 -0
- package/dist/metadata/types.d.ts +7 -0
- package/dist/metadata/types.d.ts.map +1 -1
- package/dist/metadata/types.js.map +1 -1
- package/dist/patterns/panel/meta.d.ts +17 -0
- package/dist/patterns/panel/meta.d.ts.map +1 -1
- package/dist/patterns/panel/meta.js +5 -0
- package/dist/patterns/panel/meta.js.map +1 -1
- package/dist/patterns/panel/themeRecipeMeta.d.ts +31 -0
- package/dist/patterns/panel/themeRecipeMeta.d.ts.map +1 -0
- package/dist/patterns/panel/themeRecipeMeta.js +31 -0
- package/dist/patterns/panel/themeRecipeMeta.js.map +1 -0
- package/package.json +1 -1
- package/src/components/button/meta.ts +4 -0
- package/src/components/button/themeRecipeMeta.ts +34 -0
- package/src/components/card/meta.ts +5 -0
- package/src/components/card/themeRecipeMeta.ts +32 -0
- package/src/components/text/meta.ts +9 -0
- package/src/components/text/themeRecipeMeta.ts +33 -0
- package/src/index.ts +15 -1
- package/src/metadata/authoringMeta.test.ts +59 -0
- package/src/metadata/index.ts +13 -0
- package/src/metadata/themeRecipeMeta.test.ts +70 -0
- package/src/metadata/themeRecipeMeta.ts +12 -0
- package/src/metadata/themeRecipeTypes.ts +47 -0
- package/src/metadata/types.ts +8 -0
- package/src/patterns/panel/meta.ts +5 -0
- package/src/patterns/panel/themeRecipeMeta.ts +32 -0
|
@@ -18,16 +18,19 @@ export const cardMeta = {
|
|
|
18
18
|
type: 'string',
|
|
19
19
|
category: 'Content',
|
|
20
20
|
label: 'Title',
|
|
21
|
+
authoring: { authority: 'instance' },
|
|
21
22
|
},
|
|
22
23
|
description: {
|
|
23
24
|
type: 'string',
|
|
24
25
|
category: 'Content',
|
|
25
26
|
label: 'Description',
|
|
27
|
+
authoring: { authority: 'instance' },
|
|
26
28
|
},
|
|
27
29
|
eyebrow: {
|
|
28
30
|
type: 'string',
|
|
29
31
|
category: 'Content',
|
|
30
32
|
label: 'Eyebrow',
|
|
33
|
+
authoring: { authority: 'instance' },
|
|
31
34
|
},
|
|
32
35
|
tone: {
|
|
33
36
|
type: 'enum',
|
|
@@ -35,12 +38,14 @@ export const cardMeta = {
|
|
|
35
38
|
label: 'Tone',
|
|
36
39
|
enum: ['default', 'subtle', 'outline'],
|
|
37
40
|
default: 'default',
|
|
41
|
+
authoring: { authority: 'theme', scope: 'component' },
|
|
38
42
|
},
|
|
39
43
|
compact: {
|
|
40
44
|
type: 'boolean',
|
|
41
45
|
category: 'Layout',
|
|
42
46
|
label: 'Compact',
|
|
43
47
|
default: false,
|
|
48
|
+
authoring: { authority: 'theme', scope: 'component' },
|
|
44
49
|
},
|
|
45
50
|
},
|
|
46
51
|
} as const satisfies ZoraComponentMeta;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { ZoraThemeRecipeMeta } from '../../metadata/themeRecipeTypes';
|
|
2
|
+
|
|
3
|
+
export const cardThemeRecipeMeta = {
|
|
4
|
+
name: 'Card',
|
|
5
|
+
kind: 'component',
|
|
6
|
+
description: 'Maps global rhythm and surface tokens into Card presentation.',
|
|
7
|
+
fields: {
|
|
8
|
+
tone: {
|
|
9
|
+
type: 'choice',
|
|
10
|
+
label: 'Tone',
|
|
11
|
+
options: ['default', 'subtle', 'outline'],
|
|
12
|
+
default: 'default',
|
|
13
|
+
},
|
|
14
|
+
padding: {
|
|
15
|
+
type: 'token',
|
|
16
|
+
tokenFamily: 'spacing',
|
|
17
|
+
label: 'Padding',
|
|
18
|
+
default: 'l',
|
|
19
|
+
},
|
|
20
|
+
radius: {
|
|
21
|
+
type: 'token',
|
|
22
|
+
tokenFamily: 'radii',
|
|
23
|
+
label: 'Corner radius',
|
|
24
|
+
default: 'l',
|
|
25
|
+
},
|
|
26
|
+
compact: {
|
|
27
|
+
type: 'boolean',
|
|
28
|
+
label: 'Compact',
|
|
29
|
+
default: false,
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
} as const satisfies ZoraThemeRecipeMeta;
|
|
@@ -23,11 +23,13 @@ export const textMeta = {
|
|
|
23
23
|
category: 'Content',
|
|
24
24
|
label: 'Text',
|
|
25
25
|
default: 'Text',
|
|
26
|
+
authoring: { authority: 'instance' },
|
|
26
27
|
},
|
|
27
28
|
i18nKey: {
|
|
28
29
|
type: 'string',
|
|
29
30
|
category: 'Content',
|
|
30
31
|
label: 'i18n key',
|
|
32
|
+
authoring: { authority: 'instance' },
|
|
31
33
|
},
|
|
32
34
|
variant: {
|
|
33
35
|
type: 'enum',
|
|
@@ -35,12 +37,14 @@ export const textMeta = {
|
|
|
35
37
|
label: 'Variant',
|
|
36
38
|
enum: ['body', 'lead', 'bodySmall', 'caption', 'label', 'eyebrow', 'code'],
|
|
37
39
|
default: 'body',
|
|
40
|
+
authoring: { authority: 'theme', scope: 'component' },
|
|
38
41
|
},
|
|
39
42
|
color: {
|
|
40
43
|
type: 'enum',
|
|
41
44
|
category: 'Style',
|
|
42
45
|
label: 'Color',
|
|
43
46
|
enum: ZORA_COLORS,
|
|
47
|
+
authoring: { authority: 'theme', scope: 'component' },
|
|
44
48
|
},
|
|
45
49
|
emphasis: {
|
|
46
50
|
type: 'enum',
|
|
@@ -48,29 +52,34 @@ export const textMeta = {
|
|
|
48
52
|
label: 'Emphasis',
|
|
49
53
|
enum: ZORA_EMPHASES,
|
|
50
54
|
default: 'default',
|
|
55
|
+
authoring: { authority: 'theme', scope: 'component' },
|
|
51
56
|
},
|
|
52
57
|
align: {
|
|
53
58
|
type: 'enum',
|
|
54
59
|
category: 'Layout',
|
|
55
60
|
label: 'Align',
|
|
56
61
|
enum: ['auto', 'left', 'right', 'center', 'justify'],
|
|
62
|
+
authoring: { authority: 'theme', scope: 'component' },
|
|
57
63
|
},
|
|
58
64
|
weight: {
|
|
59
65
|
type: 'enum',
|
|
60
66
|
category: 'Typography',
|
|
61
67
|
label: 'Weight',
|
|
62
68
|
enum: ['regular', 'medium', 'semiBold', 'bold'],
|
|
69
|
+
authoring: { authority: 'theme', scope: 'component' },
|
|
63
70
|
},
|
|
64
71
|
italic: {
|
|
65
72
|
type: 'boolean',
|
|
66
73
|
category: 'Typography',
|
|
67
74
|
label: 'Italic',
|
|
68
75
|
default: false,
|
|
76
|
+
authoring: { authority: 'theme', scope: 'component' },
|
|
69
77
|
},
|
|
70
78
|
numberOfLines: {
|
|
71
79
|
type: 'number',
|
|
72
80
|
category: 'Layout',
|
|
73
81
|
label: 'Line clamp',
|
|
82
|
+
authoring: { authority: 'instance' },
|
|
74
83
|
},
|
|
75
84
|
},
|
|
76
85
|
} as const satisfies ZoraComponentMeta;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { ZoraThemeRecipeMeta } from '../../metadata/themeRecipeTypes';
|
|
2
|
+
|
|
3
|
+
export const textThemeRecipeMeta = {
|
|
4
|
+
name: 'Text',
|
|
5
|
+
kind: 'component',
|
|
6
|
+
description: 'Maps shared typography and color tokens into Text presentation.',
|
|
7
|
+
fields: {
|
|
8
|
+
variant: {
|
|
9
|
+
type: 'token',
|
|
10
|
+
tokenFamily: 'typography',
|
|
11
|
+
label: 'Typography variant',
|
|
12
|
+
default: 'body',
|
|
13
|
+
},
|
|
14
|
+
color: {
|
|
15
|
+
type: 'token',
|
|
16
|
+
tokenFamily: 'colors',
|
|
17
|
+
label: 'Color',
|
|
18
|
+
default: 'text',
|
|
19
|
+
},
|
|
20
|
+
emphasis: {
|
|
21
|
+
type: 'choice',
|
|
22
|
+
label: 'Emphasis',
|
|
23
|
+
options: ['default', 'muted', 'subtle', 'inverse'],
|
|
24
|
+
default: 'default',
|
|
25
|
+
},
|
|
26
|
+
weight: {
|
|
27
|
+
type: 'choice',
|
|
28
|
+
label: 'Weight',
|
|
29
|
+
options: ['regular', 'medium', 'semiBold', 'bold'],
|
|
30
|
+
default: 'regular',
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
} as const satisfies ZoraThemeRecipeMeta;
|
package/src/index.ts
CHANGED
|
@@ -214,12 +214,26 @@ export type {
|
|
|
214
214
|
ZoraComponentMeta,
|
|
215
215
|
ZoraComponentMetaRegistry,
|
|
216
216
|
ZoraComponentPropArrayItemSchema,
|
|
217
|
+
ZoraComponentPropAuthoring,
|
|
217
218
|
ZoraComponentPropSchema,
|
|
218
219
|
ZoraComponentPropType,
|
|
219
220
|
ZoraComponentPropValue,
|
|
220
221
|
ZoraComponentSlotMeta,
|
|
222
|
+
ZoraThemeRecipeBooleanFieldMeta,
|
|
223
|
+
ZoraThemeRecipeChoiceFieldMeta,
|
|
224
|
+
ZoraThemeRecipeFieldMeta,
|
|
225
|
+
ZoraThemeRecipeKind,
|
|
226
|
+
ZoraThemeRecipeMeta,
|
|
227
|
+
ZoraThemeRecipeMetaRegistry,
|
|
228
|
+
ZoraThemeRecipeTokenFieldMeta,
|
|
229
|
+
ZoraThemeTokenFamily,
|
|
230
|
+
} from './metadata';
|
|
231
|
+
export {
|
|
232
|
+
ZORA_BINDABLE_COMPONENT_META,
|
|
233
|
+
ZORA_COMPONENT_META,
|
|
234
|
+
ZORA_THEME_RECIPE_META,
|
|
235
|
+
ZORA_THEME_TOKEN_FAMILIES,
|
|
221
236
|
} from './metadata';
|
|
222
|
-
export { ZORA_BINDABLE_COMPONENT_META, ZORA_COMPONENT_META } from './metadata';
|
|
223
237
|
export type {
|
|
224
238
|
AuthFormBaseProps,
|
|
225
239
|
AuthIdentifierKind,
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { describe, expect, test } from 'bun:test';
|
|
2
|
+
|
|
3
|
+
import { ZORA_COMPONENT_META, type ZoraComponentPropAuthoring } from './index';
|
|
4
|
+
|
|
5
|
+
describe('ZORA component prop authoring authority', () => {
|
|
6
|
+
test('supports the canonical instance and theme scope combinations', () => {
|
|
7
|
+
const values: readonly ZoraComponentPropAuthoring[] = [
|
|
8
|
+
{ authority: 'instance' },
|
|
9
|
+
{ authority: 'theme', scope: 'global' },
|
|
10
|
+
{ authority: 'theme', scope: 'component' },
|
|
11
|
+
{ authority: 'theme', scope: 'pattern' },
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
expect(values).toEqual([
|
|
15
|
+
{ authority: 'instance' },
|
|
16
|
+
{ authority: 'theme', scope: 'global' },
|
|
17
|
+
{ authority: 'theme', scope: 'component' },
|
|
18
|
+
{ authority: 'theme', scope: 'pattern' },
|
|
19
|
+
]);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
test('classifies representative instance content without exposing arbitrary styling', () => {
|
|
23
|
+
expect(ZORA_COMPONENT_META.Button.props.children?.authoring).toEqual({
|
|
24
|
+
authority: 'instance',
|
|
25
|
+
});
|
|
26
|
+
expect(ZORA_COMPONENT_META.Card.props.title?.authoring).toEqual({ authority: 'instance' });
|
|
27
|
+
expect(ZORA_COMPONENT_META.Text.props.text?.authoring).toEqual({ authority: 'instance' });
|
|
28
|
+
expect(ZORA_COMPONENT_META.Panel.props.description?.authoring).toEqual({
|
|
29
|
+
authority: 'instance',
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
test('classifies component and pattern styling as theme authority', () => {
|
|
34
|
+
expect(ZORA_COMPONENT_META.Button.props.size?.authoring).toEqual({
|
|
35
|
+
authority: 'theme',
|
|
36
|
+
scope: 'component',
|
|
37
|
+
});
|
|
38
|
+
expect(ZORA_COMPONENT_META.Card.props.tone?.authoring).toEqual({
|
|
39
|
+
authority: 'theme',
|
|
40
|
+
scope: 'component',
|
|
41
|
+
});
|
|
42
|
+
expect(ZORA_COMPONENT_META.Text.props.variant?.authoring).toEqual({
|
|
43
|
+
authority: 'theme',
|
|
44
|
+
scope: 'component',
|
|
45
|
+
});
|
|
46
|
+
expect(ZORA_COMPONENT_META.Panel.props.compact?.authoring).toEqual({
|
|
47
|
+
authority: 'theme',
|
|
48
|
+
scope: 'pattern',
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
test('treats absent authoring metadata as not authorable', () => {
|
|
53
|
+
expect(ZORA_COMPONENT_META.Progress.props.value?.authoring).toBeUndefined();
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
test('does not introduce a system authority', () => {
|
|
57
|
+
expect(JSON.stringify(ZORA_COMPONENT_META)).not.toContain('"authority":"system"');
|
|
58
|
+
});
|
|
59
|
+
});
|
package/src/metadata/index.ts
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
export type { ZoraBindableComponentType } from './bindableComponentMeta';
|
|
2
2
|
export { ZORA_BINDABLE_COMPONENT_META } from './bindableComponentMeta';
|
|
3
3
|
export { ZORA_COMPONENT_META } from './componentMeta';
|
|
4
|
+
export { ZORA_THEME_RECIPE_META } from './themeRecipeMeta';
|
|
5
|
+
export type {
|
|
6
|
+
ZoraThemeRecipeBooleanFieldMeta,
|
|
7
|
+
ZoraThemeRecipeChoiceFieldMeta,
|
|
8
|
+
ZoraThemeRecipeFieldMeta,
|
|
9
|
+
ZoraThemeRecipeKind,
|
|
10
|
+
ZoraThemeRecipeMeta,
|
|
11
|
+
ZoraThemeRecipeMetaRegistry,
|
|
12
|
+
ZoraThemeRecipeTokenFieldMeta,
|
|
13
|
+
ZoraThemeTokenFamily,
|
|
14
|
+
} from './themeRecipeTypes';
|
|
15
|
+
export { ZORA_THEME_TOKEN_FAMILIES } from './themeRecipeTypes';
|
|
4
16
|
export type {
|
|
5
17
|
ZoraComponentBlueprint,
|
|
6
18
|
ZoraComponentCategory,
|
|
@@ -12,6 +24,7 @@ export type {
|
|
|
12
24
|
ZoraComponentMeta,
|
|
13
25
|
ZoraComponentMetaRegistry,
|
|
14
26
|
ZoraComponentPropArrayItemSchema,
|
|
27
|
+
ZoraComponentPropAuthoring,
|
|
15
28
|
ZoraComponentPropSchema,
|
|
16
29
|
ZoraComponentPropType,
|
|
17
30
|
ZoraComponentPropValue,
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { describe, expect, test } from 'bun:test';
|
|
2
|
+
|
|
3
|
+
import { ZORA_COMPONENT_META, ZORA_THEME_RECIPE_META, ZORA_THEME_TOKEN_FAMILIES } from './index';
|
|
4
|
+
|
|
5
|
+
const tokenFamilies = new Set<string>(ZORA_THEME_TOKEN_FAMILIES);
|
|
6
|
+
const expectedKinds = new Map<string, 'component' | 'pattern'>([
|
|
7
|
+
['Button', 'component'],
|
|
8
|
+
['Card', 'component'],
|
|
9
|
+
['Text', 'component'],
|
|
10
|
+
['Panel', 'pattern'],
|
|
11
|
+
]);
|
|
12
|
+
|
|
13
|
+
describe('ZORA_THEME_RECIPE_META', () => {
|
|
14
|
+
test('exports representative component and pattern recipes', () => {
|
|
15
|
+
expect(Object.keys(ZORA_THEME_RECIPE_META)).toEqual(['Button', 'Card', 'Text', 'Panel']);
|
|
16
|
+
expect(ZORA_THEME_RECIPE_META.Button?.kind).toBe('component');
|
|
17
|
+
expect(ZORA_THEME_RECIPE_META.Panel?.kind).toBe('pattern');
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
test('keeps registry names unique and aligned with component metadata', () => {
|
|
21
|
+
const names = Object.values(ZORA_THEME_RECIPE_META).map((meta) => meta.name);
|
|
22
|
+
expect(new Set(names).size).toBe(names.length);
|
|
23
|
+
|
|
24
|
+
for (const [key, meta] of Object.entries(ZORA_THEME_RECIPE_META)) {
|
|
25
|
+
expect(meta.name).toBe(key);
|
|
26
|
+
expect(meta.kind).toBe(expectedKinds.get(key));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
expect(ZORA_COMPONENT_META.Button.category).toBe('component');
|
|
30
|
+
expect(ZORA_COMPONENT_META.Card.category).toBe('component');
|
|
31
|
+
expect(ZORA_COMPONENT_META.Text.category).toBe('component');
|
|
32
|
+
expect(ZORA_COMPONENT_META.Panel.category).toBe('pattern');
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
test('references only canonical token families and valid choice defaults', () => {
|
|
36
|
+
for (const meta of Object.values(ZORA_THEME_RECIPE_META)) {
|
|
37
|
+
for (const field of Object.values(meta.fields)) {
|
|
38
|
+
if (field.type === 'token') {
|
|
39
|
+
expect(tokenFamilies.has(field.tokenFamily), `${meta.name}.${field.label}`).toBe(true);
|
|
40
|
+
}
|
|
41
|
+
if (field.type === 'choice') {
|
|
42
|
+
expect(field.options).toContain(field.default);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
test('describes component-specific semantic scales instead of universal geometry', () => {
|
|
49
|
+
expect(ZORA_THEME_RECIPE_META.Button?.fields.size).toMatchObject({
|
|
50
|
+
type: 'choice',
|
|
51
|
+
options: ['s', 'm', 'l'],
|
|
52
|
+
default: 'm',
|
|
53
|
+
});
|
|
54
|
+
expect(ZORA_THEME_RECIPE_META.Card?.fields.padding).toMatchObject({
|
|
55
|
+
type: 'token',
|
|
56
|
+
tokenFamily: 'spacing',
|
|
57
|
+
default: 'l',
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
test('stays distinct from component metadata', () => {
|
|
62
|
+
expect(ZORA_THEME_RECIPE_META).not.toBe(ZORA_COMPONENT_META);
|
|
63
|
+
expect(ZORA_COMPONENT_META.Button.props.size?.type).toBe('enum');
|
|
64
|
+
expect(ZORA_THEME_RECIPE_META.Button?.fields.size?.type).toBe('choice');
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
test('is serializable for downstream authoring consumers', () => {
|
|
68
|
+
expect(() => JSON.stringify(ZORA_THEME_RECIPE_META)).not.toThrow();
|
|
69
|
+
});
|
|
70
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { buttonThemeRecipeMeta } from '../components/button/themeRecipeMeta';
|
|
2
|
+
import { cardThemeRecipeMeta } from '../components/card/themeRecipeMeta';
|
|
3
|
+
import { textThemeRecipeMeta } from '../components/text/themeRecipeMeta';
|
|
4
|
+
import { panelThemeRecipeMeta } from '../patterns/panel/themeRecipeMeta';
|
|
5
|
+
import type { ZoraThemeRecipeMetaRegistry } from './themeRecipeTypes';
|
|
6
|
+
|
|
7
|
+
export const ZORA_THEME_RECIPE_META: ZoraThemeRecipeMetaRegistry = {
|
|
8
|
+
Button: buttonThemeRecipeMeta,
|
|
9
|
+
Card: cardThemeRecipeMeta,
|
|
10
|
+
Text: textThemeRecipeMeta,
|
|
11
|
+
Panel: panelThemeRecipeMeta,
|
|
12
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export const ZORA_THEME_TOKEN_FAMILIES = [
|
|
2
|
+
'colors',
|
|
3
|
+
'spacing',
|
|
4
|
+
'radii',
|
|
5
|
+
'typography',
|
|
6
|
+
'shadows',
|
|
7
|
+
] as const;
|
|
8
|
+
|
|
9
|
+
export type ZoraThemeTokenFamily = (typeof ZORA_THEME_TOKEN_FAMILIES)[number];
|
|
10
|
+
|
|
11
|
+
export type ZoraThemeRecipeKind = 'component' | 'pattern';
|
|
12
|
+
|
|
13
|
+
interface ZoraThemeRecipeFieldBase {
|
|
14
|
+
readonly label: string;
|
|
15
|
+
readonly description?: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface ZoraThemeRecipeTokenFieldMeta extends ZoraThemeRecipeFieldBase {
|
|
19
|
+
readonly type: 'token';
|
|
20
|
+
readonly tokenFamily: ZoraThemeTokenFamily;
|
|
21
|
+
readonly default: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface ZoraThemeRecipeChoiceFieldMeta extends ZoraThemeRecipeFieldBase {
|
|
25
|
+
readonly type: 'choice';
|
|
26
|
+
readonly options: readonly string[];
|
|
27
|
+
readonly default: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface ZoraThemeRecipeBooleanFieldMeta extends ZoraThemeRecipeFieldBase {
|
|
31
|
+
readonly type: 'boolean';
|
|
32
|
+
readonly default: boolean;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export type ZoraThemeRecipeFieldMeta =
|
|
36
|
+
| ZoraThemeRecipeTokenFieldMeta
|
|
37
|
+
| ZoraThemeRecipeChoiceFieldMeta
|
|
38
|
+
| ZoraThemeRecipeBooleanFieldMeta;
|
|
39
|
+
|
|
40
|
+
export interface ZoraThemeRecipeMeta {
|
|
41
|
+
readonly name: string;
|
|
42
|
+
readonly kind: ZoraThemeRecipeKind;
|
|
43
|
+
readonly description?: string;
|
|
44
|
+
readonly fields: Readonly<Record<string, ZoraThemeRecipeFieldMeta>>;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export type ZoraThemeRecipeMetaRegistry = Readonly<Record<string, ZoraThemeRecipeMeta>>;
|
package/src/metadata/types.ts
CHANGED
|
@@ -25,6 +25,13 @@ export type ZoraComponentPropValue =
|
|
|
25
25
|
| readonly ZoraComponentPropValue[]
|
|
26
26
|
| { readonly [key: string]: ZoraComponentPropValue };
|
|
27
27
|
|
|
28
|
+
export type ZoraComponentPropAuthoring =
|
|
29
|
+
| { readonly authority: 'instance' }
|
|
30
|
+
| {
|
|
31
|
+
readonly authority: 'theme';
|
|
32
|
+
readonly scope: 'global' | 'component' | 'pattern';
|
|
33
|
+
};
|
|
34
|
+
|
|
28
35
|
export interface ZoraComponentPropArrayItemSchema {
|
|
29
36
|
key: string;
|
|
30
37
|
schema: ZoraComponentPropSchema;
|
|
@@ -37,6 +44,7 @@ export interface ZoraComponentPropSchema {
|
|
|
37
44
|
enum?: readonly (string | number)[];
|
|
38
45
|
default?: ZoraComponentPropValue;
|
|
39
46
|
itemSchema?: readonly ZoraComponentPropArrayItemSchema[];
|
|
47
|
+
authoring?: ZoraComponentPropAuthoring;
|
|
40
48
|
}
|
|
41
49
|
|
|
42
50
|
export interface ZoraComponentBlueprint {
|
|
@@ -18,16 +18,19 @@ export const panelMeta = {
|
|
|
18
18
|
type: 'string',
|
|
19
19
|
category: 'Content',
|
|
20
20
|
label: 'Title',
|
|
21
|
+
authoring: { authority: 'instance' },
|
|
21
22
|
},
|
|
22
23
|
description: {
|
|
23
24
|
type: 'string',
|
|
24
25
|
category: 'Content',
|
|
25
26
|
label: 'Description',
|
|
27
|
+
authoring: { authority: 'instance' },
|
|
26
28
|
},
|
|
27
29
|
eyebrow: {
|
|
28
30
|
type: 'string',
|
|
29
31
|
category: 'Content',
|
|
30
32
|
label: 'Eyebrow',
|
|
33
|
+
authoring: { authority: 'instance' },
|
|
31
34
|
},
|
|
32
35
|
tone: {
|
|
33
36
|
type: 'enum',
|
|
@@ -35,12 +38,14 @@ export const panelMeta = {
|
|
|
35
38
|
label: 'Tone',
|
|
36
39
|
enum: ['default', 'subtle', 'outline'],
|
|
37
40
|
default: 'default',
|
|
41
|
+
authoring: { authority: 'theme', scope: 'pattern' },
|
|
38
42
|
},
|
|
39
43
|
compact: {
|
|
40
44
|
type: 'boolean',
|
|
41
45
|
category: 'Layout',
|
|
42
46
|
label: 'Compact',
|
|
43
47
|
default: false,
|
|
48
|
+
authoring: { authority: 'theme', scope: 'pattern' },
|
|
44
49
|
},
|
|
45
50
|
},
|
|
46
51
|
} as const satisfies ZoraComponentMeta;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { ZoraThemeRecipeMeta } from '../../metadata/themeRecipeTypes';
|
|
2
|
+
|
|
3
|
+
export const panelThemeRecipeMeta = {
|
|
4
|
+
name: 'Panel',
|
|
5
|
+
kind: 'pattern',
|
|
6
|
+
description: 'Maps global rhythm and surface tokens into Panel presentation.',
|
|
7
|
+
fields: {
|
|
8
|
+
tone: {
|
|
9
|
+
type: 'choice',
|
|
10
|
+
label: 'Tone',
|
|
11
|
+
options: ['default', 'subtle', 'outline'],
|
|
12
|
+
default: 'default',
|
|
13
|
+
},
|
|
14
|
+
padding: {
|
|
15
|
+
type: 'token',
|
|
16
|
+
tokenFamily: 'spacing',
|
|
17
|
+
label: 'Padding',
|
|
18
|
+
default: 'l',
|
|
19
|
+
},
|
|
20
|
+
radius: {
|
|
21
|
+
type: 'token',
|
|
22
|
+
tokenFamily: 'radii',
|
|
23
|
+
label: 'Corner radius',
|
|
24
|
+
default: 'l',
|
|
25
|
+
},
|
|
26
|
+
compact: {
|
|
27
|
+
type: 'boolean',
|
|
28
|
+
label: 'Compact',
|
|
29
|
+
default: false,
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
} as const satisfies ZoraThemeRecipeMeta;
|