@sentropic/design-system-elements 0.0.0-stage → 0.1.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.
Files changed (79) hide show
  1. package/LICENSE +21 -0
  2. package/LICENSE.THIRD-PARTY.md +4734 -0
  3. package/README.md +146 -2
  4. package/catalog.json +1234 -0
  5. package/dist/browser/assets/bpmn-CZlEAdL6.ttf +0 -0
  6. package/dist/browser/assets/bpmn-DaGVGZ7K.woff +0 -0
  7. package/dist/browser/assets/bpmn-DaJ2be00.woff2 +0 -0
  8. package/dist/browser/chunks/BpmnRenderUtil-WMCgqGDs.js +1 -0
  9. package/dist/browser/chunks/BpmnUpdater-C-UNbzXl.js +1 -0
  10. package/dist/browser/chunks/LabelUtil-7QpE43Ed.js +1 -0
  11. package/dist/browser/chunks/LayoutUtil-hAMJmJFU.js +1 -0
  12. package/dist/browser/chunks/ModelUtil-CMh7LuN4.js +1 -0
  13. package/dist/browser/chunks/Modeler-BfAmwsmK.js +389 -0
  14. package/dist/browser/chunks/Viewer-eYLzc3fD.js +4 -0
  15. package/dist/browser/chunks/bpmn-canvas-DeAWdJFy.js +2207 -0
  16. package/dist/browser/chunks/colored-CSIQaGsQ.js +1 -0
  17. package/dist/browser/chunks/dist-Co2MgHWm.js +1 -0
  18. package/dist/browser/chunks/dist-O6_2ByYB.js +1 -0
  19. package/dist/browser/chunks/dist-kvAYI1vo.js +1 -0
  20. package/dist/browser/chunks/entropic-CM5BHERN.js +2173 -0
  21. package/dist/browser/chunks/focus-renderer-BgsZGo7n.js +8 -0
  22. package/dist/browser/chunks/forge-B8hrW4lA.js +2173 -0
  23. package/dist/browser/chunks/layout-q0TR9-aY.js +1 -0
  24. package/dist/browser/chunks/legend-CXdfCBh6.js +1 -0
  25. package/dist/browser/chunks/textMetrics-BrMS6-sA.js +2 -0
  26. package/dist/browser/chunks/tokens-DFPpCvf1.js +1 -0
  27. package/dist/browser/elements.js +2221 -0
  28. package/dist/browser/sri.json +166 -0
  29. package/dist/contracts/bar-chart.d.ts +158 -0
  30. package/dist/contracts/bar-chart.js +117 -0
  31. package/dist/contracts/bpmn-canvas.d.ts +39 -0
  32. package/dist/contracts/bpmn-canvas.js +77 -0
  33. package/dist/contracts/decision-dossier.d.ts +43 -0
  34. package/dist/contracts/decision-dossier.js +133 -0
  35. package/dist/contracts/index.d.ts +28 -0
  36. package/dist/contracts/index.js +35 -0
  37. package/dist/contracts/types.d.ts +129 -0
  38. package/dist/contracts/types.js +16 -0
  39. package/dist/element/f1/f1-to-xml.d.ts +51 -0
  40. package/dist/element/f1/f1-to-xml.js +220 -0
  41. package/dist/element/markdown/minimal-markdown.d.ts +31 -0
  42. package/dist/element/markdown/minimal-markdown.js +98 -0
  43. package/dist/element/theme/theme-scoping.d.ts +27 -0
  44. package/dist/element/theme/theme-scoping.js +39 -0
  45. package/dist/generated/a2ui-common-types.d.ts +25 -0
  46. package/dist/generated/a2ui-common-types.js +367 -0
  47. package/dist/generator/canonical.d.ts +21 -0
  48. package/dist/generator/canonical.js +36 -0
  49. package/dist/generator/emit.d.ts +48 -0
  50. package/dist/generator/emit.js +400 -0
  51. package/dist/generator/main.d.ts +19 -0
  52. package/dist/generator/main.js +67 -0
  53. package/dist/generator/parity.d.ts +55 -0
  54. package/dist/generator/parity.js +223 -0
  55. package/dist/index.d.ts +11 -0
  56. package/dist/index.js +10 -0
  57. package/dist/ports/bpmn-canvas.d.ts +34 -0
  58. package/dist/ports/bpmn-canvas.js +36 -0
  59. package/dist/ports/focus.d.ts +40 -0
  60. package/dist/ports/focus.js +49 -0
  61. package/dist/ports/types.d.ts +36 -0
  62. package/dist/ports/types.js +12 -0
  63. package/dist/structure/ajv.d.ts +41 -0
  64. package/dist/structure/ajv.js +108 -0
  65. package/dist/structure/interpreter.d.ts +47 -0
  66. package/dist/structure/interpreter.js +576 -0
  67. package/dist/validate/diagnostics.d.ts +63 -0
  68. package/dist/validate/diagnostics.js +56 -0
  69. package/dist/validate/envelope.d.ts +92 -0
  70. package/dist/validate/envelope.js +306 -0
  71. package/dist/validate/index.d.ts +22 -0
  72. package/dist/validate/index.js +24 -0
  73. package/dist/validate/structure.d.ts +32 -0
  74. package/dist/validate/structure.js +13 -0
  75. package/envelope.json +43 -0
  76. package/package.json +54 -4
  77. package/schemas/BarChart.v1.json +556 -0
  78. package/schemas/BpmnCanvas.v1.json +139 -0
  79. package/schemas/DecisionDossier.v1.json +635 -0
@@ -0,0 +1,98 @@
1
+ /**
2
+ * The minimal Markdown subset of the `<st-decision-dossier>` element's lazy
3
+ * renderer (§6.2, §6.4, U-14; conductor's L2 scope: the Focus renderer
4
+ * defaults F-R0–F-R7 are lot L6, and L2 renders the document through a
5
+ * minimal lazy renderer so the pilot works end to end).
6
+ *
7
+ * The subset is deliberately small and REPLACED by L6's choice (§6.4: « the
8
+ * Markdown parser and the allowed subset are chosen with the Focus pilot »):
9
+ * paragraphs split on blank lines, `**bold**`, `*italic*`, `` `code` ``,
10
+ * `[text](https://…)` links and `- ` bullet lists. Everything else is TEXT.
11
+ *
12
+ * Emitted markup, exactly (the DOMPurify allowlist in
13
+ * `src/element/dom/engines/focus-renderer.ts` mirrors this subset, U-14):
14
+ * tags `p`, `ul`, `li`, `code`, `a`, `strong`, `em` only; attribute `href`
15
+ * on anchors only, `https:` URLs only; no data attributes, no event
16
+ * handlers, no `style`, no other tags.
17
+ *
18
+ * Pure half: raw HTML in the source is ESCAPED here, and the DOM half
19
+ * (`src/element/dom`) passes this module's output through DOMPurify before
20
+ * insertion anyway (§6.4 defense in depth; U-14: DOMPurify 3.4.15 is the
21
+ * chosen sanitizer, pinned, its license recorded by `licensing:check`).
22
+ * Only `https:` links become anchors; every other scheme — `javascript:`,
23
+ * `data:`, relative — stays literal text.
24
+ */
25
+ /** Escape one text run for element content and attribute positions. */
26
+ function escapeHtml(text) {
27
+ return text
28
+ .replace(/&/g, "&amp;")
29
+ .replace(/</g, "&lt;")
30
+ .replace(/>/g, "&gt;")
31
+ .replace(/"/g, "&quot;")
32
+ .replace(/'/g, "&#39;");
33
+ }
34
+ /** One inline pass: code spans first (their content is never re-parsed). */
35
+ function renderInline(text) {
36
+ const escapes = [];
37
+ const stash = (html) => {
38
+ escapes.push(html);
39
+ return `\u0000${escapes.length - 1}\u0000`;
40
+ };
41
+ let out = escapeHtml(text);
42
+ // `code` — content stays escaped, no nested inline.
43
+ out = out.replace(/`([^`]+)`/g, (_match, code) => stash(`<code>${code}</code>`));
44
+ // [text](https://…) — only the https scheme becomes an anchor.
45
+ out = out.replace(/\[([^\]]*)\]\((https:\/\/[^)\s]+)\)/g, (_match, label, href) => {
46
+ const safeHref = href.replace(/"/g, "%22");
47
+ return stash(`<a href="${safeHref}">${label}</a>`);
48
+ });
49
+ // **bold**, then *italic*.
50
+ out = out.replace(/\*\*([^*]+)\*\*/g, "<strong>$1</strong>");
51
+ out = out.replace(/\*([^*]+)\*/g, "<em>$1</em>");
52
+ return out.replace(/\u0000(\d+)\u0000/g, (_match, index) => escapes[Number(index)] ?? "");
53
+ }
54
+ /** One line by index, empty past the end (the callers bound-check first). */
55
+ function lineAt(lines, index) {
56
+ return lines[index] ?? "";
57
+ }
58
+ /** Does one line look like a bullet item (`- text`)? */
59
+ function isBullet(line) {
60
+ return /^- /.test(line);
61
+ }
62
+ /**
63
+ * Render one Markdown source in the minimal subset. Pure: no DOM, no
64
+ * sanitizer — the caller sanitizes (the DOM half routes this through
65
+ * DOMPurify before insertion, §6.4).
66
+ */
67
+ export function renderMarkdown(source) {
68
+ const lines = source.replace(/\r\n?/g, "\n").split("\n");
69
+ const blocks = [];
70
+ let index = 0;
71
+ while (index < lines.length) {
72
+ const line = lineAt(lines, index);
73
+ if (line.trim() === "") {
74
+ index += 1;
75
+ continue;
76
+ }
77
+ if (isBullet(line)) {
78
+ const items = [];
79
+ while (index < lines.length && isBullet(lineAt(lines, index))) {
80
+ items.push(`<li>${renderInline(lineAt(lines, index).slice(2))}</li>`);
81
+ index += 1;
82
+ }
83
+ blocks.push(`<ul>\n${items.join("\n")}\n</ul>`);
84
+ continue;
85
+ }
86
+ const paragraph = [];
87
+ while (index < lines.length) {
88
+ const current = lineAt(lines, index);
89
+ if (current.trim() === "" || isBullet(current))
90
+ break;
91
+ paragraph.push(renderInline(current));
92
+ index += 1;
93
+ }
94
+ blocks.push(`<p>${paragraph.join("\n")}</p>`);
95
+ }
96
+ return blocks.join("\n");
97
+ }
98
+ //# sourceMappingURL=minimal-markdown.js.map
@@ -0,0 +1,27 @@
1
+ /**
2
+ * The theme stylesheet scoping of the elements package (§6.3, §6.4, §15
3
+ * AC-L2). The committed theme stylesheets of
4
+ * `@sentropic/design-system-themes` address their DARK blocks to `:root`
5
+ * (`packages/themes/src/compile.ts`: blocks 2 and 3 « always target
6
+ * `:root` »), and `:root` never matches inside a shadow root — a shadow tree
7
+ * has no document root element. The element therefore adopts a SCOPED
8
+ * rewrite of the theme stylesheet in its shadow root:
9
+ *
10
+ * - the light block keeps its `[data-st-theme="<id>"]` selector (it
11
+ * already matches the element's internal root);
12
+ * - `:root:not([data-color-mode="light"])` (the `prefers-color-scheme`
13
+ * auto-dark block) becomes `[data-st-theme="<id>"]:not(...)`;
14
+ * - `:root[data-color-mode="dark"]` (the explicit dark block) becomes
15
+ * `[data-st-theme="<id>"][data-color-mode="dark"]`.
16
+ *
17
+ * Pure text rewrite, idempotent (a second pass changes nothing), applied
18
+ * before the sheet is constructed and adopted in the shadow root — the
19
+ * `--st-*` custom properties then inherit into the mounted Svelte component
20
+ * exactly as on a themed page.
21
+ */
22
+ /**
23
+ * Re-scope one theme stylesheet to the element's shadow root. Only the two
24
+ * `:root` forms are rewritten; every other selector is preserved untouched.
25
+ */
26
+ export declare function scopeThemeCss(css: string, themeId: string): string;
27
+ //# sourceMappingURL=theme-scoping.d.ts.map
@@ -0,0 +1,39 @@
1
+ /**
2
+ * The theme stylesheet scoping of the elements package (§6.3, §6.4, §15
3
+ * AC-L2). The committed theme stylesheets of
4
+ * `@sentropic/design-system-themes` address their DARK blocks to `:root`
5
+ * (`packages/themes/src/compile.ts`: blocks 2 and 3 « always target
6
+ * `:root` »), and `:root` never matches inside a shadow root — a shadow tree
7
+ * has no document root element. The element therefore adopts a SCOPED
8
+ * rewrite of the theme stylesheet in its shadow root:
9
+ *
10
+ * - the light block keeps its `[data-st-theme="<id>"]` selector (it
11
+ * already matches the element's internal root);
12
+ * - `:root:not([data-color-mode="light"])` (the `prefers-color-scheme`
13
+ * auto-dark block) becomes `[data-st-theme="<id>"]:not(...)`;
14
+ * - `:root[data-color-mode="dark"]` (the explicit dark block) becomes
15
+ * `[data-st-theme="<id>"][data-color-mode="dark"]`.
16
+ *
17
+ * Pure text rewrite, idempotent (a second pass changes nothing), applied
18
+ * before the sheet is constructed and adopted in the shadow root — the
19
+ * `--st-*` custom properties then inherit into the mounted Svelte component
20
+ * exactly as on a themed page.
21
+ */
22
+ /** The scope selector the dark blocks are re-addressed to. */
23
+ function scopeSelector(themeId) {
24
+ return `[data-st-theme="${themeId}"]`;
25
+ }
26
+ /**
27
+ * Re-scope one theme stylesheet to the element's shadow root. Only the two
28
+ * `:root` forms are rewritten; every other selector is preserved untouched.
29
+ */
30
+ export function scopeThemeCss(css, themeId) {
31
+ return css
32
+ // :root[data-color-mode="dark"] (and any :root[qualifier…] form).
33
+ .replace(new RegExp(`(^|[\\s,>+~])\\:root(?=\\[data-color-mode=)`, "g"), `$1${scopeSelector(themeId)}`)
34
+ // :root:not([data-color-mode="light"]).
35
+ .replace(new RegExp(`(^|[\\s,>+~])\\:root(?=\\:not\\()`, "g"), `$1${scopeSelector(themeId)}`)
36
+ // A bare :root (theme sheets keep none, but keep the rewrite total).
37
+ .replace(new RegExp(`(^|[\\s,>+~])\\:root(?=[\\s,{])`, "g"), `$1${scopeSelector(themeId)}`);
38
+ }
39
+ //# sourceMappingURL=theme-scoping.js.map
@@ -0,0 +1,25 @@
1
+ /**
2
+ * GENERATED FILE — do not edit. Regenerate with `npm run catalog:generate` in
3
+ * packages/elements (the generator is the single source, §5.1).
4
+ *
5
+ * 1. common_types.json, vendored from @a2ui/web_core@0.14.0
6
+ * (src/v0_9/schemas — the installed SDK ships no v0_9_1 schema set; only
7
+ * v0_8, v0_9 and v1_0 exist, measured). Original $id https://a2ui.org/specification/v0_9/common_types.json,
8
+ * sha256 a7a349b1e9abda9dbdf2342ac9ac671d8da7a8576c7b29a9786331faf70b9900; $id rewritten to
9
+ * https://a2ui.org/specification/v0_9_1/common_types.json — the URI the catalogue's entries
10
+ * reference ComponentCommon by (§5.2).
11
+ *
12
+ * 2. catalog.json, BUILT (not vendored): the sibling URI common_types
13
+ * references anyFunction by (https://a2ui.org/specification/v0_9_1/catalog.json), carrying
14
+ * the single anyFunction definition of an EMPTY function set (§5.2
15
+ * `functions: {}`): the empty union `{ "not": {} }`, exactly as the
16
+ * SDK serialises one (schema_serializer.js EMPTY_UNION). The A2UI
17
+ * basic catalogue is deliberately NOT vendored — no A2UI function or
18
+ * basic component may validate inside an envelope (§4.1, §4.2).
19
+ *
20
+ * The validator registers both documents under their $ids so every entry
21
+ * reference resolves without network or file access.
22
+ */
23
+ export declare const a2uiCommonTypes: Record<string, unknown>;
24
+ export declare const a2uiSdkCatalogSchema: Record<string, unknown>;
25
+ //# sourceMappingURL=a2ui-common-types.d.ts.map
@@ -0,0 +1,367 @@
1
+ /**
2
+ * GENERATED FILE — do not edit. Regenerate with `npm run catalog:generate` in
3
+ * packages/elements (the generator is the single source, §5.1).
4
+ *
5
+ * 1. common_types.json, vendored from @a2ui/web_core@0.14.0
6
+ * (src/v0_9/schemas — the installed SDK ships no v0_9_1 schema set; only
7
+ * v0_8, v0_9 and v1_0 exist, measured). Original $id https://a2ui.org/specification/v0_9/common_types.json,
8
+ * sha256 a7a349b1e9abda9dbdf2342ac9ac671d8da7a8576c7b29a9786331faf70b9900; $id rewritten to
9
+ * https://a2ui.org/specification/v0_9_1/common_types.json — the URI the catalogue's entries
10
+ * reference ComponentCommon by (§5.2).
11
+ *
12
+ * 2. catalog.json, BUILT (not vendored): the sibling URI common_types
13
+ * references anyFunction by (https://a2ui.org/specification/v0_9_1/catalog.json), carrying
14
+ * the single anyFunction definition of an EMPTY function set (§5.2
15
+ * `functions: {}`): the empty union `{ "not": {} }`, exactly as the
16
+ * SDK serialises one (schema_serializer.js EMPTY_UNION). The A2UI
17
+ * basic catalogue is deliberately NOT vendored — no A2UI function or
18
+ * basic component may validate inside an envelope (§4.1, §4.2).
19
+ *
20
+ * The validator registers both documents under their $ids so every entry
21
+ * reference resolves without network or file access.
22
+ */
23
+ export const a2uiCommonTypes = {
24
+ "$defs": {
25
+ "AccessibilityAttributes": {
26
+ "description": "Attributes to enhance accessibility when using assistive technologies like screen readers.",
27
+ "properties": {
28
+ "description": {
29
+ "$ref": "#/$defs/DynamicString",
30
+ "description": "Additional information provided by assistive technologies about an element such as instructions, format requirements, or result of an action. For example, a mute button might have a label of 'Mute' and a description of 'Silences notifications about this conversation'."
31
+ },
32
+ "label": {
33
+ "$ref": "#/$defs/DynamicString",
34
+ "description": "A short string, typically 1 to 3 words, used by assistive technologies to convey the purpose or intent of an element. For example, an input field might have an accessible label of 'User ID' or a button might be labeled 'Submit'."
35
+ }
36
+ },
37
+ "type": "object"
38
+ },
39
+ "Action": {
40
+ "description": "Defines an interaction handler that can either trigger a server-side event or execute a local client-side function.",
41
+ "oneOf": [
42
+ {
43
+ "additionalProperties": false,
44
+ "description": "Triggers a server-side event.",
45
+ "properties": {
46
+ "event": {
47
+ "additionalProperties": false,
48
+ "description": "The event to dispatch to the server.",
49
+ "properties": {
50
+ "context": {
51
+ "additionalProperties": {
52
+ "$ref": "#/$defs/DynamicValue"
53
+ },
54
+ "description": "A JSON object containing the key-value pairs for the action context. Values can be literals or paths. Use literal values unless the value must be dynamically bound to the data model. Do NOT use paths for static IDs.",
55
+ "type": "object"
56
+ },
57
+ "name": {
58
+ "description": "The name of the action to be dispatched to the server.",
59
+ "type": "string"
60
+ }
61
+ },
62
+ "required": [
63
+ "name"
64
+ ],
65
+ "type": "object"
66
+ }
67
+ },
68
+ "required": [
69
+ "event"
70
+ ],
71
+ "type": "object"
72
+ },
73
+ {
74
+ "additionalProperties": false,
75
+ "description": "Executes a local client-side function.",
76
+ "properties": {
77
+ "functionCall": {
78
+ "$ref": "#/$defs/FunctionCall"
79
+ }
80
+ },
81
+ "required": [
82
+ "functionCall"
83
+ ],
84
+ "type": "object"
85
+ }
86
+ ]
87
+ },
88
+ "CheckRule": {
89
+ "additionalProperties": false,
90
+ "description": "A single validation rule applied to an input component.",
91
+ "properties": {
92
+ "condition": {
93
+ "$ref": "#/$defs/DynamicBoolean"
94
+ },
95
+ "message": {
96
+ "description": "The error message to display if the check fails.",
97
+ "type": "string"
98
+ }
99
+ },
100
+ "required": [
101
+ "condition",
102
+ "message"
103
+ ],
104
+ "type": "object"
105
+ },
106
+ "Checkable": {
107
+ "description": "Properties for components that support client-side checks.",
108
+ "properties": {
109
+ "checks": {
110
+ "description": "A list of checks to perform. These are function calls that must return a boolean indicating validity.",
111
+ "items": {
112
+ "$ref": "#/$defs/CheckRule"
113
+ },
114
+ "type": "array"
115
+ }
116
+ },
117
+ "type": "object"
118
+ },
119
+ "ChildList": {
120
+ "oneOf": [
121
+ {
122
+ "description": "A static list of child component IDs.",
123
+ "items": {
124
+ "$ref": "#/$defs/ComponentId"
125
+ },
126
+ "type": "array"
127
+ },
128
+ {
129
+ "additionalProperties": false,
130
+ "description": "A template for generating a dynamic list of children from a data model list. The `componentId` is the component to use as a template.",
131
+ "properties": {
132
+ "componentId": {
133
+ "$ref": "#/$defs/ComponentId"
134
+ },
135
+ "path": {
136
+ "description": "The path to the list of component property objects in the data model.",
137
+ "type": "string"
138
+ }
139
+ },
140
+ "required": [
141
+ "componentId",
142
+ "path"
143
+ ],
144
+ "type": "object"
145
+ }
146
+ ]
147
+ },
148
+ "ComponentCommon": {
149
+ "properties": {
150
+ "accessibility": {
151
+ "$ref": "#/$defs/AccessibilityAttributes"
152
+ },
153
+ "id": {
154
+ "$ref": "#/$defs/ComponentId"
155
+ }
156
+ },
157
+ "required": [
158
+ "id"
159
+ ],
160
+ "type": "object"
161
+ },
162
+ "ComponentId": {
163
+ "description": "The unique identifier for a component, used for both definitions and references within the same surface.",
164
+ "type": "string"
165
+ },
166
+ "DataBinding": {
167
+ "additionalProperties": false,
168
+ "properties": {
169
+ "path": {
170
+ "description": "A JSON Pointer path to a value in the data model.",
171
+ "type": "string"
172
+ }
173
+ },
174
+ "required": [
175
+ "path"
176
+ ],
177
+ "type": "object"
178
+ },
179
+ "DynamicBoolean": {
180
+ "description": "A boolean value that can be a literal, a path, or a function call returning a boolean.",
181
+ "oneOf": [
182
+ {
183
+ "type": "boolean"
184
+ },
185
+ {
186
+ "$ref": "#/$defs/DataBinding"
187
+ },
188
+ {
189
+ "allOf": [
190
+ {
191
+ "$ref": "#/$defs/FunctionCall"
192
+ },
193
+ {
194
+ "properties": {
195
+ "returnType": {
196
+ "const": "boolean"
197
+ }
198
+ }
199
+ }
200
+ ]
201
+ }
202
+ ]
203
+ },
204
+ "DynamicNumber": {
205
+ "description": "Represents a value that can be either a literal number, a path to a number in the data model, or a function call returning a number.",
206
+ "oneOf": [
207
+ {
208
+ "type": "number"
209
+ },
210
+ {
211
+ "$ref": "#/$defs/DataBinding"
212
+ },
213
+ {
214
+ "allOf": [
215
+ {
216
+ "$ref": "#/$defs/FunctionCall"
217
+ },
218
+ {
219
+ "properties": {
220
+ "returnType": {
221
+ "const": "number"
222
+ }
223
+ }
224
+ }
225
+ ]
226
+ }
227
+ ]
228
+ },
229
+ "DynamicString": {
230
+ "description": "Represents a string",
231
+ "oneOf": [
232
+ {
233
+ "type": "string"
234
+ },
235
+ {
236
+ "$ref": "#/$defs/DataBinding"
237
+ },
238
+ {
239
+ "allOf": [
240
+ {
241
+ "$ref": "#/$defs/FunctionCall"
242
+ },
243
+ {
244
+ "properties": {
245
+ "returnType": {
246
+ "const": "string"
247
+ }
248
+ }
249
+ }
250
+ ]
251
+ }
252
+ ]
253
+ },
254
+ "DynamicStringList": {
255
+ "description": "Represents a value that can be either a literal array of strings, a path to a string array in the data model, or a function call returning a string array.",
256
+ "oneOf": [
257
+ {
258
+ "items": {
259
+ "type": "string"
260
+ },
261
+ "type": "array"
262
+ },
263
+ {
264
+ "$ref": "#/$defs/DataBinding"
265
+ },
266
+ {
267
+ "allOf": [
268
+ {
269
+ "$ref": "#/$defs/FunctionCall"
270
+ },
271
+ {
272
+ "properties": {
273
+ "returnType": {
274
+ "const": "array"
275
+ }
276
+ }
277
+ }
278
+ ]
279
+ }
280
+ ]
281
+ },
282
+ "DynamicValue": {
283
+ "description": "A value that can be a literal, a path, or a function call returning any type.",
284
+ "oneOf": [
285
+ {
286
+ "type": "string"
287
+ },
288
+ {
289
+ "type": "number"
290
+ },
291
+ {
292
+ "type": "boolean"
293
+ },
294
+ {
295
+ "type": "array"
296
+ },
297
+ {
298
+ "$ref": "#/$defs/DataBinding"
299
+ },
300
+ {
301
+ "$ref": "#/$defs/FunctionCall"
302
+ }
303
+ ]
304
+ },
305
+ "FunctionCall": {
306
+ "description": "Invokes a named function on the client.",
307
+ "oneOf": [
308
+ {
309
+ "$ref": "catalog.json#/$defs/anyFunction"
310
+ }
311
+ ],
312
+ "properties": {
313
+ "args": {
314
+ "additionalProperties": {
315
+ "anyOf": [
316
+ {
317
+ "$ref": "#/$defs/DynamicValue"
318
+ },
319
+ {
320
+ "description": "A literal object argument (e.g. configuration).",
321
+ "type": "object"
322
+ }
323
+ ]
324
+ },
325
+ "description": "Arguments passed to the function.",
326
+ "type": "object"
327
+ },
328
+ "call": {
329
+ "description": "The name of the function to call.",
330
+ "type": "string"
331
+ },
332
+ "returnType": {
333
+ "default": "boolean",
334
+ "description": "The expected return type of the function call.",
335
+ "enum": [
336
+ "any",
337
+ "array",
338
+ "boolean",
339
+ "number",
340
+ "object",
341
+ "string",
342
+ "void"
343
+ ],
344
+ "type": "string"
345
+ }
346
+ },
347
+ "required": [
348
+ "call"
349
+ ],
350
+ "type": "object"
351
+ }
352
+ },
353
+ "$id": "https://a2ui.org/specification/v0_9_1/common_types.json",
354
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
355
+ "description": "Common type definitions used across A2UI schemas.",
356
+ "title": "A2UI Common Types"
357
+ };
358
+ export const a2uiSdkCatalogSchema = {
359
+ "$defs": {
360
+ "anyFunction": {
361
+ "not": {}
362
+ }
363
+ },
364
+ "$id": "https://a2ui.org/specification/v0_9_1/catalog.json",
365
+ "$schema": "https://json-schema.org/draft/2020-12/schema"
366
+ };
367
+ //# sourceMappingURL=a2ui-common-types.js.map
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Canonical ordering for the committed artifacts (§5.1): keys and `$defs`
3
+ * sorted, so a regeneration without a type change produces no diff.
4
+ *
5
+ * The rule is deliberately simple and total:
6
+ * - object keys are sorted (recursively);
7
+ * - arrays whose every element is a string are sorted — they are SETS in
8
+ * these schemas (`required`, `enum`), never sequences;
9
+ * - every other array keeps its order — `allOf`/`oneOf` are ordered
10
+ * compositions and a tuple's item schemas are positional.
11
+ */
12
+ export type Json = null | boolean | number | string | Json[] | {
13
+ [key: string]: Json;
14
+ };
15
+ export declare function canonicalize(value: Json): Json;
16
+ /**
17
+ * The committed-artifact format: canonical order, 2-space indent, a trailing
18
+ * newline — byte-stable for unchanged types.
19
+ */
20
+ export declare function stableStringify(value: Json): string;
21
+ //# sourceMappingURL=canonical.d.ts.map
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Canonical ordering for the committed artifacts (§5.1): keys and `$defs`
3
+ * sorted, so a regeneration without a type change produces no diff.
4
+ *
5
+ * The rule is deliberately simple and total:
6
+ * - object keys are sorted (recursively);
7
+ * - arrays whose every element is a string are sorted — they are SETS in
8
+ * these schemas (`required`, `enum`), never sequences;
9
+ * - every other array keeps its order — `allOf`/`oneOf` are ordered
10
+ * compositions and a tuple's item schemas are positional.
11
+ */
12
+ function isStringArray(value) {
13
+ return value.every((element) => typeof element === "string");
14
+ }
15
+ export function canonicalize(value) {
16
+ if (Array.isArray(value)) {
17
+ const mapped = value.map((element) => canonicalize(element));
18
+ return isStringArray(value) ? [...mapped].sort() : mapped;
19
+ }
20
+ if (value !== null && typeof value === "object") {
21
+ const sorted = {};
22
+ for (const key of Object.keys(value).sort()) {
23
+ sorted[key] = canonicalize(value[key]);
24
+ }
25
+ return sorted;
26
+ }
27
+ return value;
28
+ }
29
+ /**
30
+ * The committed-artifact format: canonical order, 2-space indent, a trailing
31
+ * newline — byte-stable for unchanged types.
32
+ */
33
+ export function stableStringify(value) {
34
+ return `${JSON.stringify(canonicalize(value), null, 2)}\n`;
35
+ }
36
+ //# sourceMappingURL=canonical.js.map
@@ -0,0 +1,48 @@
1
+ /**
2
+ * The catalogue emitter (§5.1, §5.2): generates every committed artifact in
3
+ * memory from the contract modules.
4
+ *
5
+ * Pipeline per component: ts-json-schema-generator turns the contract's
6
+ * props interface into an inlined fragment (functions "fail" — no function
7
+ * type may slip through, §4.1); the fragment is reduced to the A2UI basic
8
+ * catalogue entry form (`allOf` the two references, `unevaluatedProperties:
9
+ * false`, the local object with the `component` const); the parity guard
10
+ * compares the result against React, Vue and Angular; the `x-sentropic`
11
+ * block is assembled. The catalogue, the envelope schema and the standalone
12
+ * schemas are then assembled and canonically ordered (§5.1), so a
13
+ * regeneration without a type change produces no diff.
14
+ *
15
+ * The A2UI v0.9.1 common-types document is vendored as a generated
16
+ * TypeScript module (src/generated), beside a BUILT sibling `catalog.json`
17
+ * stub whose `anyFunction` is the empty-function-set union (`{ "not": {} }`,
18
+ * §5.2 `functions: {}`) — the installed SDK ships no v0_9_1 schema set, the
19
+ * validator needs the `ComponentCommon` graph registered under the v0.9.1
20
+ * URI without reading files, and no A2UI basic-catalogue function or
21
+ * component may validate inside an envelope (§4.1, §4.2).
22
+ */
23
+ import { type ContractModule } from "../contracts/index.js";
24
+ import { type Json } from "./canonical.js";
25
+ /** ts-json-schema-generator on one contract module (functions "fail": §4.1 enforced mechanically). */
26
+ export declare function generateFragment(packageDir: string, contract: ContractModule): Json;
27
+ export interface VendoredA2uiSchemas {
28
+ /** The vendored common-types document, `$id` rewritten to the v0.9.1 URI. */
29
+ readonly commonTypes: Json;
30
+ /**
31
+ * The BUILT sibling `catalog.json` document common_types references
32
+ * `anyFunction` by: an EMPTY function set (§5.2 `functions: {}`),
33
+ * serialised exactly as the SDK serialises one (`{ "not": {} }`,
34
+ * schema_serializer.js `EMPTY_UNION`) — every `FunctionCall` refuses.
35
+ */
36
+ readonly sdkCatalog: Json;
37
+ readonly moduleText: string;
38
+ }
39
+ export interface Artifacts {
40
+ /** Committed file path (relative to the package) → canonical text. */
41
+ readonly files: readonly {
42
+ readonly path: string;
43
+ readonly text: string;
44
+ }[];
45
+ }
46
+ /** Generate every artifact in memory (the `--check` mode diffs these against the committed files). */
47
+ export declare function buildArtifacts(repoRoot: string, packageDir: string): Artifacts;
48
+ //# sourceMappingURL=emit.d.ts.map