@cynodia/axiom-ui 0.7.0-alpha.1

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 AskTech AS
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,83 @@
1
+ # @cynodia/axiom-ui
2
+
3
+ Semantic UI authoring for [Axiom](https://github.com/cynodia/axiom). Pre-release
4
+ (`0.7.0-alpha.1`); the API may change.
5
+
6
+ A pattern compresses a recurring UX concept into a declaration and expands it, **at authoring
7
+ time**, into ordinary Axiom UI nodes. It has no runtime existence, renders nothing and owns
8
+ no state. After expansion the application is a canonical Axiom application that validates,
9
+ compiles, executes and renders with this package uninstalled.
10
+
11
+ ```bash
12
+ npm install @cynodia/axiom @cynodia/axiom-ui
13
+ ```
14
+
15
+ ```ts
16
+ import { axiomUi } from '@cynodia/axiom-ui';
17
+
18
+ axiomUi.expand(graph, {
19
+ pattern: 'page',
20
+ instance: 'products',
21
+ title: 'Products',
22
+ content: [
23
+ { pattern: 'entity-list', instance: 'product_list', source: STATE_PRODUCTS },
24
+ { pattern: 'entity-form', instance: 'new_product', draft: STATE_DRAFT, submit: ACTION_ADD },
25
+ ],
26
+ });
27
+ ```
28
+
29
+ That declaration produces the containers, the heading levels, the landmark roles, the field
30
+ labels, the value formats implied by each field's type, the empty state, the responsive
31
+ stacking, the required markers and the diagnostic region. None of it was ever specific to
32
+ this application, which is what makes it the pattern's business rather than the author's.
33
+
34
+ ## Five patterns
35
+
36
+ | | |
37
+ | --- | --- |
38
+ | `page` | A titled page: header region, page-level actions, content region. `title` accepts an expression. |
39
+ | `metric-grid` | A reflowing grid of named measures. Labels are inferred from the state each value reads. |
40
+ | `entity-list` | One row per member of a collection, with per-row actions and an empty state. |
41
+ | `entity-form` | Creates a record in a draft state, **or edits an existing one** addressed by expression. Fields can offer a choice drawn from application data. |
42
+ | `action-bar` | A group of controls whose emphasis comes from what the actions *are*. |
43
+
44
+ Five, deliberately. A new pattern needs evidence that the intent recurs, that its inference is
45
+ meaningful, and that canonical primitives alone are repetitive — not that a composition was
46
+ missing. See [`docs/TOOLKIT_AGENT_REFERENCE.md`](docs/TOOLKIT_AGENT_REFERENCE.md#when-not-to-add-a-pattern).
47
+
48
+ ## When not to use a pattern
49
+
50
+ ```
51
+ pattern ordinary recurring application UX
52
+
53
+ canonical nodes custom composition that is already expressible
54
+
55
+ renderer escape genuinely unsupported presentation (a class name, and nothing more)
56
+ ```
57
+
58
+ A dialog, a focus trap or a keyboard scheme is **not** a pattern: a pattern can only emit
59
+ nodes that already exist, and interaction behaviour is not a node. Those are canonical
60
+ semantics in `@cynodia/axiom-core` — see `docs/UI.md` in the facade package.
61
+
62
+ ## Ownership
63
+
64
+ The declaration is the source of truth by default. A generated node is a build artifact:
65
+ re-expansion is authoritative, and editing one is **drift**, which `detectDrift` reports per
66
+ node and per property rather than silently overwriting. `materializePattern` is the explicit
67
+ alternative — it hands the nodes to the graph, after which the declaration is history and
68
+ edits are legitimate. Details in [`docs/OWNERSHIP.md`](docs/OWNERSHIP.md).
69
+
70
+ ## Documentation
71
+
72
+ | | |
73
+ | --- | --- |
74
+ | [`docs/TOOLKIT_AGENT_REFERENCE.md`](docs/TOOLKIT_AGENT_REFERENCE.md) | Start here. The whole contract. |
75
+ | [`docs/PATTERN_CATALOG.json`](docs/PATTERN_CATALOG.json) | Machine-readable: inputs, inferred values, **and the generated tree**. Generated from the definitions. |
76
+ | [`docs/OWNERSHIP.md`](docs/OWNERSHIP.md) | Who owns a generated node after expansion, and how drift is resolved. |
77
+ | [`docs/PROVENANCE.md`](docs/PROVENANCE.md) | What a node remembers about how it was authored, and why it never ships. |
78
+ | [`docs/PATTERN_AUTHORING.md`](docs/PATTERN_AUTHORING.md) | Defining a pattern outside this package: 0 core, compiler, runtime or renderer changes. |
79
+
80
+ The catalogue is addressable from outside the package as `@cynodia/axiom-ui/catalog`, and a
81
+ worked reference application as `@cynodia/axiom-ui/example`.
82
+
83
+ MIT © AskTech AS
@@ -0,0 +1,32 @@
1
+ import type { PatternInput } from './pattern.js';
2
+ import type { Toolkit } from './expand.js';
3
+ /**
4
+ * The machine-readable catalogue.
5
+ *
6
+ * The thesis under test (§48): for an agent, a queryable schema is worth more than prose. An
7
+ * agent that can ask what a pattern requires does not have to read the implementation, guess
8
+ * from an example, or discover a required input by causing a failure.
9
+ */
10
+ export interface PatternDescription {
11
+ name: string;
12
+ purpose: string;
13
+ required: string[];
14
+ optional: string[];
15
+ inputs: Record<string, PatternInput>;
16
+ slots: readonly string[];
17
+ produces: readonly string[];
18
+ /** The generated tree, part by part. Ids are `ui_<instance>_<part>`. */
19
+ expansion: readonly {
20
+ part: string;
21
+ kind: string;
22
+ role: string;
23
+ }[];
24
+ /** How a generated id is built, so an author can reference one before it exists. */
25
+ generatedIdFormat: string;
26
+ /** What the pattern works out for itself, and from what. */
27
+ inferred: Record<string, string>;
28
+ }
29
+ export declare function listPatterns(toolkit: Toolkit): string[];
30
+ export declare function describePattern(toolkit: Toolkit, name: string): PatternDescription | undefined;
31
+ export declare function describeToolkit(toolkit: Toolkit): PatternDescription[];
32
+ //# sourceMappingURL=catalog.d.ts.map
@@ -0,0 +1,29 @@
1
+ export function listPatterns(toolkit) {
2
+ return [...toolkit.patterns.keys()].sort();
3
+ }
4
+ export function describePattern(toolkit, name) {
5
+ const definition = toolkit.patterns.get(name);
6
+ if (!definition) {
7
+ return undefined;
8
+ }
9
+ const entries = Object.entries(definition.inputs);
10
+ return {
11
+ name: definition.name,
12
+ purpose: definition.purpose,
13
+ required: entries.filter(([, input]) => input.required).map(([key]) => key),
14
+ optional: entries.filter(([, input]) => !input.required).map(([key]) => key),
15
+ inputs: definition.inputs,
16
+ slots: definition.slots,
17
+ produces: definition.produces,
18
+ expansion: definition.expansion,
19
+ generatedIdFormat: 'ui_<instance>_<part>, or ui_<instance>_<part>_<index> for a repeated part',
20
+ inferred: Object.fromEntries(entries
21
+ .filter(([, input]) => input.inferredWhenAbsent !== undefined)
22
+ .map(([key, input]) => [key, input.inferredWhenAbsent])),
23
+ };
24
+ }
25
+ export function describeToolkit(toolkit) {
26
+ return listPatterns(toolkit)
27
+ .map((name) => describePattern(toolkit, name))
28
+ .filter((entry) => entry !== undefined);
29
+ }
@@ -0,0 +1,6 @@
1
+ import type { ApplicationGraph, NodeId } from '@cynodia/axiom-core';
2
+ import type { ExpansionModel } from '../pattern.js';
3
+ export declare function createToolkitApplication(model?: ExpansionModel): ApplicationGraph;
4
+ /** The route parameter a product detail page is addressed by. */
5
+ export declare const PARAM_ROUTE_CODE: NodeId;
6
+ //# sourceMappingURL=app.d.ts.map
@@ -0,0 +1,365 @@
1
+ import { binary, call, field, find, groupItems, groupKey, literal, nodeId, ref } from '@cynodia/axiom-core';
2
+ import { axiomUi } from '../toolkit.js';
3
+ import { rowField } from '../patterns/entity-list.js';
4
+ import { ACTION_ADD_PRODUCT, ACTION_ADD_CUSTOMER, ACTION_ASK_CANCEL, ACTION_CANCEL_ORDER, ACTION_CONFIRM_ORDER, ACTION_DELETE_PRODUCT, ACTION_DISMISS_CANCEL, ACTION_PLACE_ORDER, ACTION_RESTOCK_ALL, F_CUSTOMER_ID, F_CUSTOMER_NAME, F_ORDER_CUSTOMER, F_ORDER_ID, F_ORDER_PRODUCT, F_PRODUCT_ID, F_PRODUCT_NAME, F_PRODUCT_PRICE, F_PRODUCT_STOCK, PARAM_AMOUNT, PARAM_ORDER, PARAM_PRODUCT, STATE_CANCELLING, STATE_CUSTOMERS, STATE_DRAFT_CUSTOMER, STATE_DRAFT_ORDER, STATE_DRAFT_PRODUCT, STATE_LOW_STOCK, STATE_LOW_STOCK_PRODUCTS, STATE_ORDERS, STATE_ORDERS_BY_STATUS, STATE_ORDER_COUNT, STATE_PRODUCTS, STATE_REVENUE, createOrderDomain, } from './domain.js';
5
+ /**
6
+ * The reference application, declared through toolkit patterns.
7
+ *
8
+ * Read the two side by side: everything the baseline spells out — the header containers, the
9
+ * heading levels, the empty states, the labels, the formats a type already implies, the
10
+ * responsive stacking, the action-group wrappers, the diagnostic regions — is absent here,
11
+ * not because it is missing from the result but because nothing about it was ever specific
12
+ * to this application.
13
+ */
14
+ const NAV = nodeId('ui_nav');
15
+ export function createToolkitApplication(model = 'provenance') {
16
+ const graph = createOrderDomain();
17
+ const expand = (declaration) => axiomUi.expand(graph, declaration, { model });
18
+ // readme-toolkit:start
19
+ const dashboard = expand({
20
+ pattern: 'page',
21
+ instance: 'dashboard',
22
+ title: 'Dashboard',
23
+ description: 'Today across the desk.',
24
+ content: [
25
+ {
26
+ pattern: 'metric-grid',
27
+ instance: 'dash_metrics',
28
+ // No labels: each of these states is already named in the graph, and prose
29
+ // duplicated is prose that can disagree.
30
+ metrics: [
31
+ { value: ref(STATE_ORDER_COUNT) },
32
+ { value: ref(STATE_REVENUE), format: { kind: 'currency', currency: 'NOK' } },
33
+ { value: ref(STATE_LOW_STOCK), emphasis: 'strong' },
34
+ ],
35
+ },
36
+ ],
37
+ });
38
+ const products = expand({
39
+ pattern: 'page',
40
+ instance: 'products',
41
+ title: 'Products',
42
+ content: [
43
+ {
44
+ pattern: 'entity-list',
45
+ instance: 'product_list',
46
+ source: STATE_PRODUCTS,
47
+ fields: [F_PRODUCT_NAME, F_PRODUCT_PRICE, F_PRODUCT_STOCK],
48
+ formats: { [F_PRODUCT_PRICE]: { kind: 'currency', currency: 'NOK' } },
49
+ rowActions: [ACTION_DELETE_PRODUCT],
50
+ rowArguments: { [ACTION_DELETE_PRODUCT]: { [PARAM_PRODUCT]: rowField('product_list', F_PRODUCT_ID) } },
51
+ emptyMessage: 'No products yet.',
52
+ emptyAction: ACTION_ADD_PRODUCT,
53
+ },
54
+ {
55
+ pattern: 'entity-form',
56
+ instance: 'new_product',
57
+ draft: STATE_DRAFT_PRODUCT,
58
+ submit: ACTION_ADD_PRODUCT,
59
+ title: 'New product',
60
+ },
61
+ ],
62
+ });
63
+ const customers = expand({
64
+ pattern: 'page',
65
+ instance: 'customers',
66
+ title: 'Customers',
67
+ content: [
68
+ {
69
+ pattern: 'entity-list',
70
+ instance: 'customer_list',
71
+ source: STATE_CUSTOMERS,
72
+ emptyMessage: 'No customers yet.',
73
+ emptyAction: ACTION_ADD_CUSTOMER,
74
+ },
75
+ {
76
+ pattern: 'entity-form',
77
+ instance: 'new_customer',
78
+ draft: STATE_DRAFT_CUSTOMER,
79
+ submit: ACTION_ADD_CUSTOMER,
80
+ title: 'New customer',
81
+ },
82
+ ],
83
+ });
84
+ const orders = expand({
85
+ pattern: 'page',
86
+ instance: 'orders',
87
+ title: 'Orders',
88
+ description: 'Everything placed, newest first.',
89
+ content: [
90
+ {
91
+ pattern: 'entity-list',
92
+ instance: 'order_list',
93
+ source: STATE_ORDERS,
94
+ formats: { [nodeId('field_order_total')]: { kind: 'currency', currency: 'NOK' } },
95
+ rowActions: [ACTION_CONFIRM_ORDER, ACTION_ASK_CANCEL],
96
+ rowArguments: {
97
+ [ACTION_CONFIRM_ORDER]: { [PARAM_ORDER]: rowField('order_list', F_ORDER_ID) },
98
+ [ACTION_ASK_CANCEL]: { [PARAM_ORDER]: rowField('order_list', F_ORDER_ID) },
99
+ },
100
+ emptyMessage: 'No orders yet.',
101
+ emptyAction: ACTION_PLACE_ORDER,
102
+ },
103
+ ],
104
+ });
105
+ const editor = expand({
106
+ pattern: 'page',
107
+ instance: 'editor',
108
+ title: 'New order',
109
+ content: [
110
+ {
111
+ pattern: 'entity-form',
112
+ instance: 'new_order',
113
+ draft: STATE_DRAFT_ORDER,
114
+ submit: ACTION_PLACE_ORDER,
115
+ // A customer and a product are chosen from application data, not typed. This is the
116
+ // form Phase 2 had to hand-build, because no pattern input could carry a choice.
117
+ options: {
118
+ [F_ORDER_CUSTOMER]: {
119
+ source: ref(STATE_CUSTOMERS),
120
+ scopeId: nodeId('scope_customer_option'),
121
+ valueFieldId: F_CUSTOMER_ID,
122
+ labelFieldId: F_CUSTOMER_NAME,
123
+ },
124
+ [F_ORDER_PRODUCT]: {
125
+ source: ref(STATE_PRODUCTS),
126
+ scopeId: nodeId('scope_product_option'),
127
+ valueFieldId: F_PRODUCT_ID,
128
+ labelFieldId: F_PRODUCT_NAME,
129
+ },
130
+ },
131
+ },
132
+ ],
133
+ });
134
+ // readme-toolkit:end
135
+ /**
136
+ * Everything below exercises capabilities the hand-built baseline does not attempt, so it
137
+ * sits outside the measured region: the comparison in `test/baseline.ts` stays like for
138
+ * like, and the compression figure keeps meaning what it says.
139
+ */
140
+ const detail = expand({
141
+ pattern: 'page',
142
+ // A detail page titled by the record it is about, which needs `title` to be an
143
+ // expression. It was the most visible compromise Phase 2 found.
144
+ instance: 'product_detail',
145
+ title: field(productInRoute(), F_PRODUCT_NAME),
146
+ description: field(productInRoute(), F_PRODUCT_ID),
147
+ actions: [
148
+ {
149
+ pattern: 'action-bar',
150
+ instance: 'detail_actions',
151
+ actions: [ACTION_DELETE_PRODUCT],
152
+ arguments: { [ACTION_DELETE_PRODUCT]: { [PARAM_PRODUCT]: ref(PARAM_ROUTE_CODE) } },
153
+ },
154
+ ],
155
+ content: [
156
+ {
157
+ pattern: 'entity-form',
158
+ instance: 'edit_product',
159
+ // Edit, not create: the controls write into the addressed member of the collection.
160
+ target: { state: STATE_PRODUCTS, identity: ref(PARAM_ROUTE_CODE) },
161
+ submit: ACTION_ADD_PRODUCT,
162
+ submitLabel: 'Done',
163
+ title: 'Details',
164
+ },
165
+ ],
166
+ });
167
+ const restock = expand({
168
+ pattern: 'page',
169
+ instance: 'restock',
170
+ title: 'Restock',
171
+ description: 'Everything at or below the reorder threshold.',
172
+ actions: [
173
+ {
174
+ pattern: 'action-bar',
175
+ instance: 'restock_actions',
176
+ actions: [ACTION_RESTOCK_ALL],
177
+ arguments: { [ACTION_RESTOCK_ALL]: { [PARAM_AMOUNT]: literal(25) } },
178
+ },
179
+ ],
180
+ content: [
181
+ {
182
+ pattern: 'entity-list',
183
+ instance: 'low_stock_list',
184
+ // The derived collection, which is the named calculation again.
185
+ source: STATE_LOW_STOCK_PRODUCTS,
186
+ fields: [F_PRODUCT_NAME, F_PRODUCT_STOCK],
187
+ emptyMessage: 'Nothing needs restocking.',
188
+ emptyAction: ACTION_ADD_PRODUCT,
189
+ },
190
+ groupedOrders(graph),
191
+ ],
192
+ });
193
+ addCancellationDialog(graph);
194
+ // reference-extras:end
195
+ addNavigation(graph);
196
+ addViews(graph, { dashboard, products, customers, orders, editor, detail, restock });
197
+ return graph;
198
+ }
199
+ /** The route parameter a product detail page is addressed by. */
200
+ export const PARAM_ROUTE_CODE = nodeId('route_param_code');
201
+ const DIALOG = nodeId('ui_cancel_dialog');
202
+ const SCOPE_ROUTE_PRODUCT = nodeId('scope_route_product');
203
+ const SCOPE_STATUS_GROUP = nodeId('scope_status_group');
204
+ const SCOPE_STATUS_MEMBER = nodeId('scope_status_member');
205
+ /** The product the route names. Ordinary semantics: a find over the collection. */
206
+ function productInRoute() {
207
+ return find(ref(STATE_PRODUCTS), SCOPE_ROUTE_PRODUCT, binary('eq', field(ref(SCOPE_ROUTE_PRODUCT), F_PRODUCT_ID), ref(PARAM_ROUTE_CODE)));
208
+ }
209
+ /**
210
+ * Orders grouped by status: patterns for the ordinary parts, canonical nodes for this.
211
+ *
212
+ * No pattern produces it and none should — this is a `group` expression rendered by a
213
+ * `repeat`, which is exactly the composition the escape hierarchy exists for. It is also
214
+ * what the absence of `group` made expensive in Phase 2: a loop over the statuses known at
215
+ * authoring time, three near-identical filters per status.
216
+ */
217
+ function groupedOrders(graph) {
218
+ graph.addNode({
219
+ id: nodeId('ui_status_heading'),
220
+ kind: 'text',
221
+ value: call('concat', groupKey(ref(nodeId('ui_status_rows'))), literal(' — '), call('to-string', call('count', groupItems(ref(nodeId('ui_status_rows')))))),
222
+ presentation: { textRole: 'heading', headingLevel: 3 },
223
+ });
224
+ graph.addNode({
225
+ id: nodeId('ui_status_rows'),
226
+ kind: 'repeat',
227
+ source: ref(STATE_ORDERS_BY_STATUS),
228
+ templateId: nodeId('ui_status_heading'),
229
+ presentation: { layout: { kind: 'vertical', gap: 'small' } },
230
+ });
231
+ // A section heading, so the outline goes 1 → 2 → 3 rather than skipping a level. The
232
+ // framework catches that omission as INVALID_HEADING_STRUCTURE; it caught this one.
233
+ graph.addNode({
234
+ id: nodeId('ui_status_title'),
235
+ kind: 'text',
236
+ value: 'Orders by status',
237
+ presentation: { textRole: 'heading', headingLevel: 2 },
238
+ });
239
+ graph.addNode({
240
+ id: nodeId('ui_status_section'),
241
+ kind: 'container',
242
+ name: 'Orders by status',
243
+ children: [nodeId('ui_status_title'), nodeId('ui_status_rows')],
244
+ presentation: { surface: 'inset', padding: 'medium', layout: { kind: 'vertical', gap: 'small' } },
245
+ });
246
+ return nodeId('ui_status_section');
247
+ }
248
+ /**
249
+ * A modal confirmation before a destructive action.
250
+ *
251
+ * The graph says what is open, what it is called, what it contains and what closes it. Focus
252
+ * entry, containment, `Escape`, focus return and the ARIA relationships are the runtime's,
253
+ * and no application writes a line of them.
254
+ *
255
+ * The dialog does not *authorize* anything: `cancelOrder` is guarded on the same state that
256
+ * opens the dialog, so invoking it without confirming is refused whatever is on screen.
257
+ */
258
+ function addCancellationDialog(graph) {
259
+ graph.addNode({
260
+ id: nodeId('ui_cancel_question'),
261
+ kind: 'text',
262
+ value: call('concat', literal('Cancel order '), ref(STATE_CANCELLING), literal('? This cannot be undone.')),
263
+ });
264
+ graph.addNode({
265
+ id: nodeId('ui_cancel_confirm'),
266
+ kind: 'button',
267
+ label: 'Cancel order',
268
+ actionId: ACTION_CANCEL_ORDER,
269
+ arguments: { [PARAM_ORDER]: ref(STATE_CANCELLING) },
270
+ });
271
+ graph.addNode({
272
+ id: nodeId('ui_cancel_dismiss'),
273
+ kind: 'button',
274
+ label: 'Keep order',
275
+ actionId: ACTION_DISMISS_CANCEL,
276
+ });
277
+ graph.addNode({
278
+ id: DIALOG,
279
+ kind: 'dialog',
280
+ openWhen: call('non-empty', ref(STATE_CANCELLING)),
281
+ title: 'Cancel this order?',
282
+ description: 'The order is removed. Nothing else changes.',
283
+ children: [nodeId('ui_cancel_question'), nodeId('ui_cancel_confirm'), nodeId('ui_cancel_dismiss')],
284
+ closeActionId: ACTION_DISMISS_CANCEL,
285
+ modal: true,
286
+ initialFocusId: nodeId('ui_cancel_dismiss'),
287
+ });
288
+ }
289
+ /**
290
+ * Navigation is deliberately *not* a pattern.
291
+ *
292
+ * It was a candidate, and leaving it out is a finding: a navigation shell is bound to an
293
+ * application's route table, which the toolkit has no business knowing. Compressing it would
294
+ * have meant a pattern that reads routes and generates actions — hidden action generation,
295
+ * which the anti-pattern catalogue rejects.
296
+ */
297
+ function addNavigation(graph) {
298
+ const navAction = nodeId('action_navigate');
299
+ graph.addNode({
300
+ id: navAction,
301
+ kind: 'action',
302
+ name: 'Go',
303
+ parameters: [{ id: nodeId('param_path'), valueType: { kind: 'primitive', primitive: 'string' } }],
304
+ operations: [{ kind: 'navigate', path: '/' }],
305
+ });
306
+ const entries = [
307
+ ['ui_nav_dashboard', 'Dashboard', '/'],
308
+ ['ui_nav_products', 'Products', '/products'],
309
+ ['ui_nav_customers', 'Customers', '/customers'],
310
+ ['ui_nav_orders', 'Orders', '/orders'],
311
+ ];
312
+ const children = entries.map(([id, label, path]) => {
313
+ graph.addNode({
314
+ id: nodeId(id),
315
+ kind: 'button',
316
+ label,
317
+ actionId: navAction,
318
+ arguments: { [nodeId('param_path')]: literal(path) },
319
+ presentation: { uxRole: 'navigation-action' },
320
+ });
321
+ return nodeId(id);
322
+ });
323
+ graph.addNode({
324
+ id: NAV,
325
+ kind: 'container',
326
+ children,
327
+ presentation: { uxRole: 'navigation-group', layout: { kind: 'horizontal', gap: 'small', wrap: true } },
328
+ });
329
+ }
330
+ function addViews(graph, pages) {
331
+ const screens = [
332
+ ['dashboard', 'Dashboard', pages.dashboard, '/'],
333
+ ['products', 'Products', pages.products, '/products'],
334
+ ['customers', 'Customers', pages.customers, '/customers'],
335
+ ['orders', 'Orders', pages.orders, '/orders'],
336
+ ['editor', 'New order', pages.editor, '/orders/new'],
337
+ ['restock', 'Restock', pages.restock, '/restock'],
338
+ ];
339
+ for (const [key, name, pageId, path] of screens) {
340
+ const viewId = nodeId(`ui_view_${key}`);
341
+ graph.addNode({
342
+ id: viewId,
343
+ kind: 'view',
344
+ name,
345
+ // The dialog lives on the view whose rows open it. A closed dialog renders nothing.
346
+ children: key === 'orders' ? [NAV, pageId, DIALOG] : [NAV, pageId],
347
+ });
348
+ graph.addNode({ id: nodeId(`route_${key}`), kind: 'route', path, viewId });
349
+ }
350
+ // A route with a parameter, which is what the detail page's title and form address.
351
+ graph.addNode({
352
+ id: nodeId('ui_view_detail'),
353
+ kind: 'view',
354
+ name: 'Product',
355
+ children: [NAV, pages.detail],
356
+ });
357
+ graph.addNode({
358
+ id: nodeId('route_detail'),
359
+ kind: 'route',
360
+ path: '/products/:code',
361
+ viewId: nodeId('ui_view_detail'),
362
+ parameters: [{ id: PARAM_ROUTE_CODE, name: 'code', valueType: { kind: 'primitive', primitive: 'string' } }],
363
+ });
364
+ }
365
+ void field;
@@ -0,0 +1,71 @@
1
+ import { ApplicationGraph } from '@cynodia/axiom-core';
2
+ import type { Expression } from '@cynodia/axiom-core';
3
+ /**
4
+ * The order-management domain used by both research applications.
5
+ *
6
+ * **Business semantics only** — entities, state, actions, constraints. No UI, no
7
+ * presentation, no routes. Both the baseline application and the toolkit application build
8
+ * their UI on top of this identical graph, which is what makes the comparison a comparison of
9
+ * UI authoring rather than of two different applications.
10
+ */
11
+ export declare const ENTITY_PRODUCT: import("@cynodia/axiom-core").NodeId;
12
+ export declare const F_PRODUCT_ID: import("@cynodia/axiom-core").FieldId;
13
+ export declare const F_PRODUCT_NAME: import("@cynodia/axiom-core").FieldId;
14
+ export declare const F_PRODUCT_PRICE: import("@cynodia/axiom-core").FieldId;
15
+ export declare const F_PRODUCT_STOCK: import("@cynodia/axiom-core").FieldId;
16
+ export declare const F_PRODUCT_ACTIVE: import("@cynodia/axiom-core").FieldId;
17
+ export declare const ENTITY_CUSTOMER: import("@cynodia/axiom-core").NodeId;
18
+ export declare const F_CUSTOMER_ID: import("@cynodia/axiom-core").FieldId;
19
+ export declare const F_CUSTOMER_NAME: import("@cynodia/axiom-core").FieldId;
20
+ export declare const F_CUSTOMER_EMAIL: import("@cynodia/axiom-core").FieldId;
21
+ export declare const F_CUSTOMER_SINCE: import("@cynodia/axiom-core").FieldId;
22
+ export declare const ENTITY_ORDER: import("@cynodia/axiom-core").NodeId;
23
+ export declare const F_ORDER_ID: import("@cynodia/axiom-core").FieldId;
24
+ export declare const F_ORDER_CUSTOMER: import("@cynodia/axiom-core").FieldId;
25
+ export declare const F_ORDER_PRODUCT: import("@cynodia/axiom-core").FieldId;
26
+ export declare const F_ORDER_QUANTITY: import("@cynodia/axiom-core").FieldId;
27
+ export declare const F_ORDER_TOTAL: import("@cynodia/axiom-core").FieldId;
28
+ export declare const F_ORDER_STATUS: import("@cynodia/axiom-core").FieldId;
29
+ export declare const STATE_PRODUCTS: import("@cynodia/axiom-core").NodeId;
30
+ export declare const STATE_CUSTOMERS: import("@cynodia/axiom-core").NodeId;
31
+ export declare const STATE_ORDERS: import("@cynodia/axiom-core").NodeId;
32
+ export declare const STATE_DRAFT_PRODUCT: import("@cynodia/axiom-core").NodeId;
33
+ export declare const STATE_DRAFT_ORDER: import("@cynodia/axiom-core").NodeId;
34
+ export declare const STATE_DRAFT_CUSTOMER: import("@cynodia/axiom-core").NodeId;
35
+ export declare const STATE_ORDER_COUNT: import("@cynodia/axiom-core").NodeId;
36
+ export declare const STATE_REVENUE: import("@cynodia/axiom-core").NodeId;
37
+ export declare const STATE_LOW_STOCK: import("@cynodia/axiom-core").NodeId;
38
+ export declare const STATE_LOW_STOCK_PRODUCTS: import("@cynodia/axiom-core").NodeId;
39
+ /** Orders partitioned by status: a `group` expression, not four filters. */
40
+ export declare const STATE_ORDERS_BY_STATUS: import("@cynodia/axiom-core").NodeId;
41
+ /** Which order the person has asked to cancel. Ephemeral: a UI fact, not a domain one. */
42
+ export declare const STATE_CANCELLING: import("@cynodia/axiom-core").NodeId;
43
+ /** The reorder threshold, so the rule below reads it rather than hard-coding it. */
44
+ export declare const STATE_THRESHOLD: import("@cynodia/axiom-core").NodeId;
45
+ /**
46
+ * "the products at or below the reorder threshold", named once.
47
+ *
48
+ * Three consumers read it: the dashboard figure, the restock warning's visibility, and the
49
+ * guard on the bulk-restock action. Written out, that is the same filter three times with
50
+ * three scope ids — which is where the Phase 2 agent collided with itself.
51
+ */
52
+ export declare const EXPRESSION_LOW_STOCK: import("@cynodia/axiom-core").NodeId;
53
+ export declare const PARAM_STOCK_SOURCE: import("@cynodia/axiom-core").NodeId;
54
+ export declare const ACTION_ADD_PRODUCT: import("@cynodia/axiom-core").NodeId;
55
+ export declare const ACTION_DELETE_PRODUCT: import("@cynodia/axiom-core").NodeId;
56
+ export declare const ACTION_RESTOCK: import("@cynodia/axiom-core").NodeId;
57
+ export declare const ACTION_ADD_CUSTOMER: import("@cynodia/axiom-core").NodeId;
58
+ export declare const ACTION_PLACE_ORDER: import("@cynodia/axiom-core").NodeId;
59
+ export declare const ACTION_CONFIRM_ORDER: import("@cynodia/axiom-core").NodeId;
60
+ export declare const ACTION_CANCEL_ORDER: import("@cynodia/axiom-core").NodeId;
61
+ export declare const ACTION_ASK_CANCEL: import("@cynodia/axiom-core").NodeId;
62
+ export declare const ACTION_DISMISS_CANCEL: import("@cynodia/axiom-core").NodeId;
63
+ export declare const ACTION_RESTOCK_ALL: import("@cynodia/axiom-core").NodeId;
64
+ export declare const PARAM_PRODUCT: import("@cynodia/axiom-core").NodeId;
65
+ export declare const PARAM_ORDER: import("@cynodia/axiom-core").NodeId;
66
+ export declare const PARAM_AMOUNT: import("@cynodia/axiom-core").NodeId;
67
+ /** The one calculation, referenced. Every consumer says this and nothing more. */
68
+ export declare const lowStock: () => Expression;
69
+ /** Entities, state, behaviour and rules. Nothing here knows a UI exists. */
70
+ export declare function createOrderDomain(): ApplicationGraph;
71
+ //# sourceMappingURL=domain.d.ts.map