@ankhorage/contracts 1.9.0 → 1.10.0

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @ankhorage/contracts
2
2
 
3
+ ## 1.10.0
4
+
5
+ ### Minor Changes
6
+
7
+ - d637fdc: Add provider-neutral UI component metadata contracts for component registries and extension package manifests.
8
+
3
9
  ## 1.9.0
4
10
 
5
11
  ### Minor Changes
package/dist/index.d.ts CHANGED
@@ -5,4 +5,5 @@ export * from './db';
5
5
  export * from './state';
6
6
  export * from './storage';
7
7
  export * from './types';
8
+ export * from './ui';
8
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,MAAM,CAAC;AACrB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,MAAM,CAAC;AACrB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,MAAM,CAAC"}
package/dist/index.js CHANGED
@@ -5,4 +5,5 @@ export * from './db';
5
5
  export * from './state';
6
6
  export * from './storage';
7
7
  export * from './types';
8
+ export * from './ui';
8
9
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,MAAM,CAAC;AACrB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC","sourcesContent":["export * from './auth';\nexport * from './bindings';\nexport * from './data';\nexport * from './db';\nexport * from './state';\nexport * from './storage';\nexport * from './types';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,MAAM,CAAC;AACrB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,MAAM,CAAC","sourcesContent":["export * from './auth';\nexport * from './bindings';\nexport * from './data';\nexport * from './db';\nexport * from './state';\nexport * from './storage';\nexport * from './types';\nexport * from './ui';\n"]}
package/dist/ui.d.ts ADDED
@@ -0,0 +1,72 @@
1
+ import type { ComponentEventDtoKind } from './types';
2
+ export type UiComponentCategory = 'component' | 'foundation' | 'layout' | 'pattern';
3
+ export type UiComponentPropType = 'action' | 'array' | 'boolean' | 'color' | 'enum' | 'imageAsset' | 'number' | 'radius' | 'shadow' | 'spacing' | 'string' | 'typographySize' | 'typographyWeight';
4
+ export type UiComponentPropValue = string | number | boolean | null | readonly UiComponentPropValue[] | {
5
+ readonly [key: string]: UiComponentPropValue;
6
+ };
7
+ export interface UiComponentPropArrayItemSchema {
8
+ readonly key: string;
9
+ readonly schema: UiComponentPropSchema;
10
+ }
11
+ export interface UiComponentPropSchema {
12
+ readonly type: UiComponentPropType;
13
+ readonly category: string;
14
+ readonly label?: string;
15
+ readonly enum?: readonly (number | string)[];
16
+ readonly default?: UiComponentPropValue;
17
+ readonly itemSchema?: readonly UiComponentPropArrayItemSchema[];
18
+ }
19
+ export interface UiComponentBlueprintIcon {
20
+ readonly name: string;
21
+ readonly provider?: string;
22
+ }
23
+ export interface UiComponentBlueprint {
24
+ readonly label: string;
25
+ readonly icon?: UiComponentBlueprintIcon;
26
+ readonly defaultProps?: Readonly<Record<string, UiComponentPropValue>>;
27
+ }
28
+ export interface UiComponentI18nFieldMeta {
29
+ readonly keyProp: string;
30
+ readonly defaultTextProp: string;
31
+ }
32
+ export interface UiComponentI18nMeta {
33
+ readonly fields: readonly UiComponentI18nFieldMeta[];
34
+ }
35
+ export type UiComponentEventPayloadKind = ComponentEventDtoKind | (string & {});
36
+ export type UiComponentEventPayloadFieldType = 'boolean' | 'number' | 'object' | 'record' | 'string' | 'unknown';
37
+ export interface UiComponentEventPayloadFieldMeta {
38
+ readonly path: string;
39
+ readonly type: UiComponentEventPayloadFieldType;
40
+ readonly label?: string;
41
+ readonly description?: string;
42
+ }
43
+ export interface UiComponentEventMeta {
44
+ readonly label: string;
45
+ readonly eventType: UiComponentEventPayloadKind;
46
+ readonly description?: string;
47
+ readonly payloadFields?: readonly UiComponentEventPayloadFieldMeta[];
48
+ }
49
+ export interface UiComponentSlotMeta {
50
+ readonly label?: string;
51
+ readonly allowedChildren?: readonly string[];
52
+ }
53
+ export interface UiComponentMeta {
54
+ readonly name: string;
55
+ readonly category: UiComponentCategory;
56
+ readonly description?: string;
57
+ readonly directManifestNode: boolean;
58
+ readonly allowedChildren: readonly string[];
59
+ readonly blueprint?: UiComponentBlueprint;
60
+ readonly events?: Readonly<Record<string, UiComponentEventMeta>>;
61
+ readonly i18n?: UiComponentI18nMeta;
62
+ readonly slots?: Readonly<Record<string, UiComponentSlotMeta>>;
63
+ readonly note?: string;
64
+ readonly props: Readonly<Record<string, UiComponentPropSchema>>;
65
+ }
66
+ export type UiComponentMetaRegistry = Readonly<Record<string, UiComponentMeta>>;
67
+ export interface UiComponentPackageManifest {
68
+ readonly packageName: string;
69
+ readonly displayName?: string;
70
+ readonly components: UiComponentMetaRegistry;
71
+ }
72
+ //# sourceMappingURL=ui.d.ts.map
@@ -0,0 +1 @@
1
+ {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E,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,mBAAmB,CAAC;IACvC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,kBAAkB,EAAE,OAAO,CAAC;IACrC,QAAQ,CAAC,eAAe,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5C,QAAQ,CAAC,SAAS,CAAC,EAAE,oBAAoB,CAAC;IAC1C,QAAQ,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC,CAAC;IACjE,QAAQ,CAAC,IAAI,CAAC,EAAE,mBAAmB,CAAC;IACpC,QAAQ,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC,CAAC;IAC/D,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAC,CAAC;CACjE;AAED,MAAM,MAAM,uBAAuB,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC,CAAC;AAEhF,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,UAAU,EAAE,uBAAuB,CAAC;CAC9C"}
package/dist/ui.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ui.js.map
package/dist/ui.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ui.js","sourceRoot":"","sources":["../src/ui.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentEventDtoKind } from './types';\n\nexport type UiComponentCategory = 'component' | 'foundation' | 'layout' | 'pattern';\n\nexport type UiComponentPropType =\n | 'action'\n | 'array'\n | 'boolean'\n | 'color'\n | 'enum'\n | 'imageAsset'\n | 'number'\n | 'radius'\n | 'shadow'\n | 'spacing'\n | 'string'\n | 'typographySize'\n | 'typographyWeight';\n\nexport type UiComponentPropValue =\n | string\n | number\n | boolean\n | null\n | readonly UiComponentPropValue[]\n | {\n readonly [key: string]: UiComponentPropValue;\n };\n\nexport interface UiComponentPropArrayItemSchema {\n readonly key: string;\n readonly schema: UiComponentPropSchema;\n}\n\nexport interface UiComponentPropSchema {\n readonly type: UiComponentPropType;\n readonly category: string;\n readonly label?: string;\n readonly enum?: readonly (number | string)[];\n readonly default?: UiComponentPropValue;\n readonly itemSchema?: readonly UiComponentPropArrayItemSchema[];\n}\n\nexport interface UiComponentBlueprintIcon {\n readonly name: string;\n readonly provider?: string;\n}\n\nexport interface UiComponentBlueprint {\n readonly label: string;\n readonly icon?: UiComponentBlueprintIcon;\n readonly defaultProps?: Readonly<Record<string, UiComponentPropValue>>;\n}\n\nexport interface UiComponentI18nFieldMeta {\n readonly keyProp: string;\n readonly defaultTextProp: string;\n}\n\nexport interface UiComponentI18nMeta {\n readonly fields: readonly UiComponentI18nFieldMeta[];\n}\n\nexport type UiComponentEventPayloadKind = ComponentEventDtoKind | (string & {});\n\nexport type UiComponentEventPayloadFieldType =\n | 'boolean'\n | 'number'\n | 'object'\n | 'record'\n | 'string'\n | 'unknown';\n\nexport interface UiComponentEventPayloadFieldMeta {\n readonly path: string;\n readonly type: UiComponentEventPayloadFieldType;\n readonly label?: string;\n readonly description?: string;\n}\n\nexport interface UiComponentEventMeta {\n readonly label: string;\n readonly eventType: UiComponentEventPayloadKind;\n readonly description?: string;\n readonly payloadFields?: readonly UiComponentEventPayloadFieldMeta[];\n}\n\nexport interface UiComponentSlotMeta {\n readonly label?: string;\n readonly allowedChildren?: readonly string[];\n}\n\nexport interface UiComponentMeta {\n readonly name: string;\n readonly category: UiComponentCategory;\n readonly description?: string;\n readonly directManifestNode: boolean;\n readonly allowedChildren: readonly string[];\n readonly blueprint?: UiComponentBlueprint;\n readonly events?: Readonly<Record<string, UiComponentEventMeta>>;\n readonly i18n?: UiComponentI18nMeta;\n readonly slots?: Readonly<Record<string, UiComponentSlotMeta>>;\n readonly note?: string;\n readonly props: Readonly<Record<string, UiComponentPropSchema>>;\n}\n\nexport type UiComponentMetaRegistry = Readonly<Record<string, UiComponentMeta>>;\n\nexport interface UiComponentPackageManifest {\n readonly packageName: string;\n readonly displayName?: string;\n readonly components: UiComponentMetaRegistry;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ankhorage/contracts",
3
- "version": "1.9.0",
3
+ "version": "1.10.0",
4
4
  "main": "./dist/index.js",
5
5
  "dependencies": {
6
6
  "@ankhorage/color-theory": "^0.0.7"
@@ -40,6 +40,10 @@
40
40
  "./storage": {
41
41
  "types": "./dist/storage.d.ts",
42
42
  "default": "./dist/storage.js"
43
+ },
44
+ "./ui": {
45
+ "types": "./dist/ui.d.ts",
46
+ "default": "./dist/ui.js"
43
47
  }
44
48
  },
45
49
  "description": "Serializable app, action, and theme config contracts for Ankhorage.",
package/src/index.ts CHANGED
@@ -5,3 +5,4 @@ export * from './db';
5
5
  export * from './state';
6
6
  export * from './storage';
7
7
  export * from './types';
8
+ export * from './ui';
package/src/ui.test.ts ADDED
@@ -0,0 +1,193 @@
1
+ import { describe, expect, it } from 'bun:test';
2
+
3
+ import type { UiComponentMeta, UiComponentMetaRegistry, UiComponentPackageManifest } from './index';
4
+
5
+ function assertSerializable<TValue>(value: TValue): void {
6
+ expect(JSON.parse(JSON.stringify(value))).toEqual(value);
7
+ }
8
+
9
+ describe('ui component metadata contracts', () => {
10
+ it('serializes component metadata with props, events, slots, i18n, and blueprint defaults', () => {
11
+ const meta: UiComponentMeta = {
12
+ name: 'Button',
13
+ category: 'component',
14
+ description: 'Action component used to trigger an interaction.',
15
+ directManifestNode: true,
16
+ allowedChildren: [],
17
+ blueprint: {
18
+ label: 'Button',
19
+ icon: {
20
+ name: 'cursor-default-click',
21
+ provider: 'material-community',
22
+ },
23
+ defaultProps: {
24
+ children: 'Continue',
25
+ disabled: false,
26
+ size: 'm',
27
+ },
28
+ },
29
+ events: {
30
+ press: {
31
+ label: 'Press',
32
+ eventType: 'button.press',
33
+ description: 'Emitted when the button is pressed.',
34
+ payloadFields: [],
35
+ },
36
+ },
37
+ i18n: {
38
+ fields: [
39
+ {
40
+ keyProp: 'i18nKey',
41
+ defaultTextProp: 'children',
42
+ },
43
+ ],
44
+ },
45
+ slots: {
46
+ icon: {
47
+ label: 'Icon',
48
+ allowedChildren: ['Icon'],
49
+ },
50
+ },
51
+ props: {
52
+ children: {
53
+ type: 'string',
54
+ category: 'Content',
55
+ label: 'Label',
56
+ default: 'Continue',
57
+ },
58
+ disabled: {
59
+ type: 'boolean',
60
+ category: 'State',
61
+ label: 'Disabled',
62
+ default: false,
63
+ },
64
+ size: {
65
+ type: 'enum',
66
+ category: 'Style',
67
+ label: 'Size',
68
+ enum: ['s', 'm', 'l'],
69
+ default: 'm',
70
+ },
71
+ },
72
+ };
73
+
74
+ assertSerializable(meta);
75
+ expect(meta.events?.press?.eventType).toBe('button.press');
76
+ expect(meta.props.size?.enum).toEqual(['s', 'm', 'l']);
77
+ });
78
+
79
+ it('serializes component metadata with array item schemas', () => {
80
+ const meta: UiComponentMeta = {
81
+ name: 'DataTable',
82
+ category: 'component',
83
+ directManifestNode: true,
84
+ allowedChildren: [],
85
+ props: {
86
+ columns: {
87
+ type: 'array',
88
+ category: 'Data',
89
+ label: 'Columns',
90
+ itemSchema: [
91
+ {
92
+ key: 'id',
93
+ schema: {
94
+ type: 'string',
95
+ category: 'Data',
96
+ label: 'Column id',
97
+ },
98
+ },
99
+ {
100
+ key: 'label',
101
+ schema: {
102
+ type: 'string',
103
+ category: 'Data',
104
+ label: 'Column label',
105
+ },
106
+ },
107
+ ],
108
+ },
109
+ },
110
+ };
111
+
112
+ assertSerializable(meta);
113
+ expect(meta.props.columns?.itemSchema?.map((item) => item.key)).toEqual(['id', 'label']);
114
+ });
115
+
116
+ it('serializes a component metadata registry', () => {
117
+ const registry: UiComponentMetaRegistry = {
118
+ Text: {
119
+ name: 'Text',
120
+ category: 'component',
121
+ directManifestNode: true,
122
+ allowedChildren: [],
123
+ props: {
124
+ children: {
125
+ type: 'string',
126
+ category: 'Content',
127
+ label: 'Text',
128
+ },
129
+ },
130
+ },
131
+ Screen: {
132
+ name: 'Screen',
133
+ category: 'layout',
134
+ directManifestNode: true,
135
+ allowedChildren: ['Text'],
136
+ props: {},
137
+ },
138
+ };
139
+
140
+ assertSerializable(registry);
141
+ expect(registry.Screen?.allowedChildren).toEqual(['Text']);
142
+ });
143
+
144
+ it('serializes a component package manifest for extension packages', () => {
145
+ const manifest: UiComponentPackageManifest = {
146
+ packageName: '@ankhorage/zora-chessboard',
147
+ displayName: 'ZORA Chessboard',
148
+ components: {
149
+ Chessboard: {
150
+ name: 'Chessboard',
151
+ category: 'component',
152
+ directManifestNode: true,
153
+ allowedChildren: [],
154
+ events: {
155
+ move: {
156
+ label: 'Move',
157
+ eventType: 'chess.move',
158
+ payloadFields: [
159
+ {
160
+ path: 'payload.from',
161
+ type: 'string',
162
+ label: 'From square',
163
+ },
164
+ {
165
+ path: 'payload.to',
166
+ type: 'string',
167
+ label: 'To square',
168
+ },
169
+ ],
170
+ },
171
+ },
172
+ props: {
173
+ fen: {
174
+ type: 'string',
175
+ category: 'Chess',
176
+ label: 'FEN',
177
+ },
178
+ orientation: {
179
+ type: 'enum',
180
+ category: 'Chess',
181
+ label: 'Orientation',
182
+ enum: ['white', 'black'],
183
+ default: 'white',
184
+ },
185
+ },
186
+ },
187
+ },
188
+ };
189
+
190
+ assertSerializable(manifest);
191
+ expect(manifest.components.Chessboard?.events?.move?.eventType).toBe('chess.move');
192
+ });
193
+ });
package/src/ui.ts ADDED
@@ -0,0 +1,113 @@
1
+ import type { ComponentEventDtoKind } from './types';
2
+
3
+ export type UiComponentCategory = 'component' | 'foundation' | 'layout' | 'pattern';
4
+
5
+ export type UiComponentPropType =
6
+ | 'action'
7
+ | 'array'
8
+ | 'boolean'
9
+ | 'color'
10
+ | 'enum'
11
+ | 'imageAsset'
12
+ | 'number'
13
+ | 'radius'
14
+ | 'shadow'
15
+ | 'spacing'
16
+ | 'string'
17
+ | 'typographySize'
18
+ | 'typographyWeight';
19
+
20
+ export type UiComponentPropValue =
21
+ | string
22
+ | number
23
+ | boolean
24
+ | null
25
+ | readonly UiComponentPropValue[]
26
+ | {
27
+ readonly [key: string]: UiComponentPropValue;
28
+ };
29
+
30
+ export interface UiComponentPropArrayItemSchema {
31
+ readonly key: string;
32
+ readonly schema: UiComponentPropSchema;
33
+ }
34
+
35
+ export interface UiComponentPropSchema {
36
+ readonly type: UiComponentPropType;
37
+ readonly category: string;
38
+ readonly label?: string;
39
+ readonly enum?: readonly (number | string)[];
40
+ readonly default?: UiComponentPropValue;
41
+ readonly itemSchema?: readonly UiComponentPropArrayItemSchema[];
42
+ }
43
+
44
+ export interface UiComponentBlueprintIcon {
45
+ readonly name: string;
46
+ readonly provider?: string;
47
+ }
48
+
49
+ export interface UiComponentBlueprint {
50
+ readonly label: string;
51
+ readonly icon?: UiComponentBlueprintIcon;
52
+ readonly defaultProps?: Readonly<Record<string, UiComponentPropValue>>;
53
+ }
54
+
55
+ export interface UiComponentI18nFieldMeta {
56
+ readonly keyProp: string;
57
+ readonly defaultTextProp: string;
58
+ }
59
+
60
+ export interface UiComponentI18nMeta {
61
+ readonly fields: readonly UiComponentI18nFieldMeta[];
62
+ }
63
+
64
+ export type UiComponentEventPayloadKind = ComponentEventDtoKind | (string & {});
65
+
66
+ export type UiComponentEventPayloadFieldType =
67
+ | 'boolean'
68
+ | 'number'
69
+ | 'object'
70
+ | 'record'
71
+ | 'string'
72
+ | 'unknown';
73
+
74
+ export interface UiComponentEventPayloadFieldMeta {
75
+ readonly path: string;
76
+ readonly type: UiComponentEventPayloadFieldType;
77
+ readonly label?: string;
78
+ readonly description?: string;
79
+ }
80
+
81
+ export interface UiComponentEventMeta {
82
+ readonly label: string;
83
+ readonly eventType: UiComponentEventPayloadKind;
84
+ readonly description?: string;
85
+ readonly payloadFields?: readonly UiComponentEventPayloadFieldMeta[];
86
+ }
87
+
88
+ export interface UiComponentSlotMeta {
89
+ readonly label?: string;
90
+ readonly allowedChildren?: readonly string[];
91
+ }
92
+
93
+ export interface UiComponentMeta {
94
+ readonly name: string;
95
+ readonly category: UiComponentCategory;
96
+ readonly description?: string;
97
+ readonly directManifestNode: boolean;
98
+ readonly allowedChildren: readonly string[];
99
+ readonly blueprint?: UiComponentBlueprint;
100
+ readonly events?: Readonly<Record<string, UiComponentEventMeta>>;
101
+ readonly i18n?: UiComponentI18nMeta;
102
+ readonly slots?: Readonly<Record<string, UiComponentSlotMeta>>;
103
+ readonly note?: string;
104
+ readonly props: Readonly<Record<string, UiComponentPropSchema>>;
105
+ }
106
+
107
+ export type UiComponentMetaRegistry = Readonly<Record<string, UiComponentMeta>>;
108
+
109
+ export interface UiComponentPackageManifest {
110
+ readonly packageName: string;
111
+ readonly displayName?: string;
112
+ readonly components: UiComponentMetaRegistry;
113
+ }