@keemakr/ui-sdk 1.1.0 → 1.2.0-dev-20260825073005

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/dist/index.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  export { UI_SCHEMA_VERSION, pressSchema, buttonSchema, cellSchema, nodeSchema, screenTreeSchema, actionResultSchema, screenLoadRequestSchema, screenLoadResponseSchema, screenActionRequestSchema, interfaceFamilySchema, surfaceDefinitionSchema, surfaceSchema, screenRegistrationSchema, uiManifestSchema, } from './schema.js';
2
2
  export type { Press, ScreenNode, ScreenRootNode, ScreenTree, ActionResult, InterfaceFamily, SurfaceDefinition, Surface, ScreenRegistration, UiManifest, ScreenTreeInput, ActionResultInput, } from './schema.js';
3
+ export { childNodesOf, KNOWN_CONTAINERS, KNOWN_NODE_TYPES } from './nodes.js';
4
+ export type { ContainerChild, ContainerNodeType, KnownNodeType } from './nodes.js';
3
5
  export { defineScreen, defineSurface } from './define.js';
4
6
  export type { ScreenDefinition, ScreenParams, LoadHandler, ActionHandler } from './define.js';
package/dist/index.js CHANGED
@@ -7,4 +7,5 @@
7
7
  //
8
8
  // Module code never ships to the browser. UI is data, not code.
9
9
  export { UI_SCHEMA_VERSION, pressSchema, buttonSchema, cellSchema, nodeSchema, screenTreeSchema, actionResultSchema, screenLoadRequestSchema, screenLoadResponseSchema, screenActionRequestSchema, interfaceFamilySchema, surfaceDefinitionSchema, surfaceSchema, screenRegistrationSchema, uiManifestSchema, } from './schema.js';
10
+ export { childNodesOf, KNOWN_CONTAINERS, KNOWN_NODE_TYPES } from './nodes.js';
10
11
  export { defineScreen, defineSurface } from './define.js';
@@ -0,0 +1,24 @@
1
+ import type { ScreenRootNode } from './schema.js';
2
+ /** Every node type the root union admits (KEE-574 item 3). */
3
+ export declare const KNOWN_NODE_TYPES: readonly ["heading", "text", "markdown", "stat", "button", "form", "table", "timeline", "pending_request", "pending_requests", "choice_cards", "progress", "chart", "section", "tabs"];
4
+ export type KnownNodeType = (typeof KNOWN_NODE_TYPES)[number];
5
+ /**
6
+ * The node types that hold child nodes. `section` mounts its children
7
+ * unconditionally; `tabs` (per-tab children) and `table` (per-row
8
+ * `expand.children`) mount them only under renderer state a pre-render scan
9
+ * cannot see — an open tab, an expanded row.
10
+ */
11
+ export declare const KNOWN_CONTAINERS: readonly ["section", "tabs", "table"];
12
+ export type ContainerNodeType = (typeof KNOWN_CONTAINERS)[number];
13
+ export interface ContainerChild {
14
+ node: ScreenRootNode;
15
+ /**
16
+ * True when the child mounts only under renderer state the pre-render scans
17
+ * cannot know (tab selection, row expansion) — the surface KEE-573 exists
18
+ * for. A `section` child inherits its parent's conditionality; this flag is
19
+ * only the edge's own contribution, so walkers OR it with the inherited one.
20
+ */
21
+ conditional: boolean;
22
+ }
23
+ /** The child nodes a container renders, in document order; empty for leaves. */
24
+ export declare function childNodesOf(node: ScreenRootNode): ContainerChild[];
package/dist/nodes.js ADDED
@@ -0,0 +1,48 @@
1
+ // The node registry: every type the screen-tree union admits, which of them
2
+ // are containers, and one accessor that reaches their children. Shared by
3
+ // core's server slot walk (collectPendingSlots), the client placement walk
4
+ // (pendingPlacements), and KEE-574's normalizer, so container knowledge lives
5
+ // in exactly one place and cannot drift per call site (KEE-573 §5.2).
6
+ //
7
+ // KEE-563's modal branch is added HERE when it lands — every consumer then
8
+ // inherits it. Both lists are lockstep-tested against the schema union
9
+ // (tests/sdk/ui-node-registry.test.ts in keemakr-core): a node type added to
10
+ // the schema fails that test until it is registered and classified here.
11
+ /** Every node type the root union admits (KEE-574 item 3). */
12
+ export const KNOWN_NODE_TYPES = [
13
+ 'heading',
14
+ 'text',
15
+ 'markdown',
16
+ 'stat',
17
+ 'button',
18
+ 'form',
19
+ 'table',
20
+ 'timeline',
21
+ 'pending_request',
22
+ 'pending_requests',
23
+ 'choice_cards',
24
+ 'progress',
25
+ 'chart',
26
+ 'section',
27
+ 'tabs',
28
+ ];
29
+ /**
30
+ * The node types that hold child nodes. `section` mounts its children
31
+ * unconditionally; `tabs` (per-tab children) and `table` (per-row
32
+ * `expand.children`) mount them only under renderer state a pre-render scan
33
+ * cannot see — an open tab, an expanded row.
34
+ */
35
+ export const KNOWN_CONTAINERS = ['section', 'tabs', 'table'];
36
+ /** The child nodes a container renders, in document order; empty for leaves. */
37
+ export function childNodesOf(node) {
38
+ switch (node.type) {
39
+ case 'section':
40
+ return node.children.map((child) => ({ node: child, conditional: false }));
41
+ case 'tabs':
42
+ return node.tabs.flatMap((tab) => tab.children.map((child) => ({ node: child, conditional: true })));
43
+ case 'table':
44
+ return node.rows.flatMap((row) => (row.expand?.children ?? []).map((child) => ({ node: child, conditional: true })));
45
+ default:
46
+ return [];
47
+ }
48
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@keemakr/ui-sdk",
3
- "version": "1.1.0",
3
+ "version": "1.2.0-dev-20260825073005",
4
4
  "description": "Product screens for keemakr marketplace modules: a versioned, server-driven UI tree schema plus defineScreen() handlers. Module code never ships to the browser — keemakr-core validates the tree and renders it with platform components.",
5
5
  "license": "MIT",
6
6
  "type": "module",