@keemakr/ui-sdk 1.4.0-dev-20261012081643 → 1.4.0-dev-20261012082811
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/README.md +44 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/schema.d.ts +42 -0
- package/dist/schema.js +45 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -54,7 +54,50 @@ export default defineScreen({
|
|
|
54
54
|
Folder names are screen identities. For example, `ui/campaigns/campaign/screen.ts` is the
|
|
55
55
|
`campaign` screen. Screen folder names must be unique across the module.
|
|
56
56
|
|
|
57
|
-
## 4.
|
|
57
|
+
## 4. Optional workspace presentation
|
|
58
|
+
|
|
59
|
+
Screens use the document layout unless they opt into a platform-owned workspace. A workspace can
|
|
60
|
+
place page actions in a pinned footer and promote one keyed root section into a responsive right
|
|
61
|
+
rail. The module declares meaning; each Keemakr client owns widths, breakpoints and styling.
|
|
62
|
+
|
|
63
|
+
```ts
|
|
64
|
+
load: async () => ({
|
|
65
|
+
version: 1,
|
|
66
|
+
title: 'Account review',
|
|
67
|
+
actions: [
|
|
68
|
+
{
|
|
69
|
+
type: 'button',
|
|
70
|
+
label: 'Save review',
|
|
71
|
+
onPress: { kind: 'action', action: 'save_review' },
|
|
72
|
+
},
|
|
73
|
+
],
|
|
74
|
+
presentation: {
|
|
75
|
+
layout: 'workspace',
|
|
76
|
+
actionPlacement: 'footer',
|
|
77
|
+
rightRail: {
|
|
78
|
+
sectionKey: 'history',
|
|
79
|
+
label: 'Review history',
|
|
80
|
+
collapsible: true,
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
children: [
|
|
84
|
+
{ type: 'text', value: 'Current review' },
|
|
85
|
+
{
|
|
86
|
+
type: 'section',
|
|
87
|
+
key: 'history',
|
|
88
|
+
title: 'History',
|
|
89
|
+
layout: 'stack',
|
|
90
|
+
columns: 1,
|
|
91
|
+
children: [{ type: 'text', value: 'Version 1' }],
|
|
92
|
+
},
|
|
93
|
+
],
|
|
94
|
+
}),
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
`rightRail.sectionKey` must identify exactly one keyed section in the screen's root `children`.
|
|
98
|
+
Older screens require no changes and keep header actions plus the normal document flow.
|
|
99
|
+
|
|
100
|
+
## 5. Generate before Eve runs
|
|
58
101
|
|
|
59
102
|
Use the SDK wrapper in the module scripts:
|
|
60
103
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { UI_SCHEMA_VERSION, pressSchema, buttonSchema, cellSchema, nodeSchema, screenTreeSchema, actionResultSchema, screenLoadRequestSchema, screenLoadResponseSchema, screenActionRequestSchema, interfaceFamilySchema, surfaceDefinitionSchema, surfaceSchema, screenRegistrationSchema, uiManifestSchema, } from './schema.js';
|
|
2
|
-
export type { Press, ScreenNode, ScreenRootNode, ScreenTree, ActionResult, InterfaceFamily, SurfaceDefinition, Surface, ScreenRegistration, UiManifest, ScreenTreeInput, ActionResultInput, } from './schema.js';
|
|
1
|
+
export { UI_SCHEMA_VERSION, pressSchema, buttonSchema, cellSchema, nodeSchema, screenPresentationSchema, screenTreeSchema, actionResultSchema, screenLoadRequestSchema, screenLoadResponseSchema, screenActionRequestSchema, interfaceFamilySchema, surfaceDefinitionSchema, surfaceSchema, screenRegistrationSchema, uiManifestSchema, } from './schema.js';
|
|
2
|
+
export type { Press, ScreenPresentation, ScreenNode, ScreenRootNode, ScreenTree, ActionResult, InterfaceFamily, SurfaceDefinition, Surface, ScreenRegistration, UiManifest, ScreenTreeInput, ActionResultInput, } from './schema.js';
|
|
3
3
|
export { childNodesOf, KNOWN_CONTAINERS, KNOWN_NODE_TYPES } from './nodes.js';
|
|
4
4
|
export type { ContainerChild, ContainerNodeType, KnownNodeType } from './nodes.js';
|
|
5
5
|
export { pageRangeLabel, pageWindow, pressWithValue } from './pager.js';
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
// platform components, proxies load/action with a grant
|
|
7
7
|
//
|
|
8
8
|
// Module code never ships to the browser. UI is data, not code.
|
|
9
|
-
export { UI_SCHEMA_VERSION, pressSchema, buttonSchema, cellSchema, nodeSchema, screenTreeSchema, actionResultSchema, screenLoadRequestSchema, screenLoadResponseSchema, screenActionRequestSchema, interfaceFamilySchema, surfaceDefinitionSchema, surfaceSchema, screenRegistrationSchema, uiManifestSchema, } from './schema.js';
|
|
9
|
+
export { UI_SCHEMA_VERSION, pressSchema, buttonSchema, cellSchema, nodeSchema, screenPresentationSchema, screenTreeSchema, actionResultSchema, screenLoadRequestSchema, screenLoadResponseSchema, screenActionRequestSchema, interfaceFamilySchema, surfaceDefinitionSchema, surfaceSchema, screenRegistrationSchema, uiManifestSchema, } from './schema.js';
|
|
10
10
|
export { childNodesOf, KNOWN_CONTAINERS, KNOWN_NODE_TYPES } from './nodes.js';
|
|
11
11
|
export { pageRangeLabel, pageWindow, pressWithValue } from './pager.js';
|
|
12
12
|
export { defineScreen, defineSurface } from './define.js';
|
package/dist/schema.d.ts
CHANGED
|
@@ -414,6 +414,7 @@ type LeafScreenNode = z.infer<typeof leafNodeSchema>;
|
|
|
414
414
|
type LeafScreenNodeInput = z.input<typeof leafNodeSchema>;
|
|
415
415
|
export type ScreenNode = LeafScreenNode | {
|
|
416
416
|
type: 'section';
|
|
417
|
+
key?: string;
|
|
417
418
|
title?: string;
|
|
418
419
|
description?: string;
|
|
419
420
|
layout: 'stack' | 'grid' | 'row';
|
|
@@ -423,6 +424,7 @@ export type ScreenNode = LeafScreenNode | {
|
|
|
423
424
|
};
|
|
424
425
|
type ScreenNodeInput = LeafScreenNodeInput | {
|
|
425
426
|
type: 'section';
|
|
427
|
+
key?: string;
|
|
426
428
|
title?: string;
|
|
427
429
|
description?: string;
|
|
428
430
|
layout: 'stack' | 'grid' | 'row';
|
|
@@ -468,6 +470,19 @@ type ScreenRootNodeInput = ScreenNodeInput | TabsScreenNodeInput;
|
|
|
468
470
|
* MAX_SECTION_DEPTH exactly as it was before `tabs` existed.
|
|
469
471
|
*/
|
|
470
472
|
export declare const nodeSchema: z.ZodType<ScreenRootNode, ScreenRootNodeInput>;
|
|
473
|
+
export declare const screenPresentationSchema: z.ZodObject<{
|
|
474
|
+
layout: z.ZodLiteral<"workspace">;
|
|
475
|
+
actionPlacement: z.ZodDefault<z.ZodEnum<{
|
|
476
|
+
header: "header";
|
|
477
|
+
footer: "footer";
|
|
478
|
+
}>>;
|
|
479
|
+
rightRail: z.ZodOptional<z.ZodObject<{
|
|
480
|
+
sectionKey: z.ZodString;
|
|
481
|
+
label: z.ZodString;
|
|
482
|
+
collapsible: z.ZodDefault<z.ZodBoolean>;
|
|
483
|
+
defaultCollapsed: z.ZodDefault<z.ZodBoolean>;
|
|
484
|
+
}, z.core.$strip>>;
|
|
485
|
+
}, z.core.$strip>;
|
|
471
486
|
export declare const screenTreeSchema: z.ZodObject<{
|
|
472
487
|
version: z.ZodLiteral<1>;
|
|
473
488
|
title: z.ZodString;
|
|
@@ -503,6 +518,19 @@ export declare const screenTreeSchema: z.ZodObject<{
|
|
|
503
518
|
disabledReason: z.ZodOptional<z.ZodString>;
|
|
504
519
|
}, z.core.$strip>>>;
|
|
505
520
|
children: z.ZodArray<z.ZodType<ScreenRootNode, ScreenRootNodeInput, z.core.$ZodTypeInternals<ScreenRootNode, ScreenRootNodeInput>>>;
|
|
521
|
+
presentation: z.ZodOptional<z.ZodObject<{
|
|
522
|
+
layout: z.ZodLiteral<"workspace">;
|
|
523
|
+
actionPlacement: z.ZodDefault<z.ZodEnum<{
|
|
524
|
+
header: "header";
|
|
525
|
+
footer: "footer";
|
|
526
|
+
}>>;
|
|
527
|
+
rightRail: z.ZodOptional<z.ZodObject<{
|
|
528
|
+
sectionKey: z.ZodString;
|
|
529
|
+
label: z.ZodString;
|
|
530
|
+
collapsible: z.ZodDefault<z.ZodBoolean>;
|
|
531
|
+
defaultCollapsed: z.ZodDefault<z.ZodBoolean>;
|
|
532
|
+
}, z.core.$strip>>;
|
|
533
|
+
}, z.core.$strip>>;
|
|
506
534
|
refreshSeconds: z.ZodOptional<z.ZodNumber>;
|
|
507
535
|
}, z.core.$strip>;
|
|
508
536
|
/** What an action handler returns. `refresh` re-runs `load` after the action. */
|
|
@@ -553,6 +581,19 @@ export declare const screenLoadResponseSchema: z.ZodObject<{
|
|
|
553
581
|
disabledReason: z.ZodOptional<z.ZodString>;
|
|
554
582
|
}, z.core.$strip>>>;
|
|
555
583
|
children: z.ZodArray<z.ZodType<ScreenRootNode, ScreenRootNodeInput, z.core.$ZodTypeInternals<ScreenRootNode, ScreenRootNodeInput>>>;
|
|
584
|
+
presentation: z.ZodOptional<z.ZodObject<{
|
|
585
|
+
layout: z.ZodLiteral<"workspace">;
|
|
586
|
+
actionPlacement: z.ZodDefault<z.ZodEnum<{
|
|
587
|
+
header: "header";
|
|
588
|
+
footer: "footer";
|
|
589
|
+
}>>;
|
|
590
|
+
rightRail: z.ZodOptional<z.ZodObject<{
|
|
591
|
+
sectionKey: z.ZodString;
|
|
592
|
+
label: z.ZodString;
|
|
593
|
+
collapsible: z.ZodDefault<z.ZodBoolean>;
|
|
594
|
+
defaultCollapsed: z.ZodDefault<z.ZodBoolean>;
|
|
595
|
+
}, z.core.$strip>>;
|
|
596
|
+
}, z.core.$strip>>;
|
|
556
597
|
refreshSeconds: z.ZodOptional<z.ZodNumber>;
|
|
557
598
|
}, z.core.$strip>;
|
|
558
599
|
}, z.core.$strip>;
|
|
@@ -613,6 +654,7 @@ export declare const uiManifestSchema: z.ZodObject<{
|
|
|
613
654
|
}, z.core.$strip>>;
|
|
614
655
|
}, z.core.$strip>;
|
|
615
656
|
export type Press = z.infer<typeof pressSchema>;
|
|
657
|
+
export type ScreenPresentation = z.infer<typeof screenPresentationSchema>;
|
|
616
658
|
export type ScreenTree = z.infer<typeof screenTreeSchema>;
|
|
617
659
|
export type ActionResult = z.infer<typeof actionResultSchema>;
|
|
618
660
|
export type InterfaceFamily = z.infer<typeof interfaceFamilySchema>;
|
package/dist/schema.js
CHANGED
|
@@ -434,6 +434,8 @@ const nodeSchemas = new Map();
|
|
|
434
434
|
/** Shared by the chain and by the root union, so the two cannot drift apart. */
|
|
435
435
|
const sectionBranch = (children) => z.object({
|
|
436
436
|
type: z.literal('section'),
|
|
437
|
+
/** Stable identity for presentation regions that reference this root section. */
|
|
438
|
+
key: slug.optional(),
|
|
437
439
|
title: z.string().max(120).optional(),
|
|
438
440
|
description: z.string().max(300).optional(),
|
|
439
441
|
/**
|
|
@@ -514,7 +516,26 @@ export const nodeSchema = z.discriminatedUnion('type', [
|
|
|
514
516
|
sectionBranch(z.lazy(() => nodeSchemaAtDepth(1))),
|
|
515
517
|
tabsBranch(z.lazy(() => nodeSchemaAtDepth(1))),
|
|
516
518
|
]);
|
|
517
|
-
export const
|
|
519
|
+
export const screenPresentationSchema = z.object({
|
|
520
|
+
/** A full-height working surface whose chrome stays outside its content scroller. */
|
|
521
|
+
layout: z.literal('workspace'),
|
|
522
|
+
/** Where the renderer places the screen's page-level actions. */
|
|
523
|
+
actionPlacement: z.enum(['header', 'footer']).default('header'),
|
|
524
|
+
/**
|
|
525
|
+
* Promote one keyed root section into a supporting right rail. Renderers own
|
|
526
|
+
* its responsive width and visual treatment; modules only declare meaning.
|
|
527
|
+
*/
|
|
528
|
+
rightRail: z
|
|
529
|
+
.object({
|
|
530
|
+
sectionKey: slug,
|
|
531
|
+
label: z.string().min(1).max(80),
|
|
532
|
+
collapsible: z.boolean().default(false),
|
|
533
|
+
defaultCollapsed: z.boolean().default(false),
|
|
534
|
+
})
|
|
535
|
+
.optional(),
|
|
536
|
+
});
|
|
537
|
+
export const screenTreeSchema = z
|
|
538
|
+
.object({
|
|
518
539
|
version: z.literal(UI_SCHEMA_VERSION),
|
|
519
540
|
title: z.string().max(120),
|
|
520
541
|
description: z.string().max(300).optional(),
|
|
@@ -537,12 +558,34 @@ export const screenTreeSchema = z.object({
|
|
|
537
558
|
.min(1)
|
|
538
559
|
.max(5)
|
|
539
560
|
.optional(),
|
|
540
|
-
/** Page-level actions
|
|
561
|
+
/** Page-level actions. Presentation chooses header or pinned workspace footer. */
|
|
541
562
|
actions: z.array(buttonSchema).max(4).optional(),
|
|
542
563
|
children: z.array(nodeSchema).max(100),
|
|
564
|
+
/** Optional platform-owned layout semantics. Absence preserves the document layout. */
|
|
565
|
+
presentation: screenPresentationSchema.optional(),
|
|
543
566
|
// ponytail: polling keeps live views (agent activity) simple; switch to the
|
|
544
567
|
// existing run-event NDJSON stream when polling measurably falls short.
|
|
545
568
|
refreshSeconds: z.number().int().min(2).max(300).optional(),
|
|
569
|
+
})
|
|
570
|
+
.superRefine((tree, ctx) => {
|
|
571
|
+
const rail = tree.presentation?.rightRail;
|
|
572
|
+
if (!rail)
|
|
573
|
+
return;
|
|
574
|
+
if (rail.defaultCollapsed && !rail.collapsible) {
|
|
575
|
+
ctx.addIssue({
|
|
576
|
+
code: 'custom',
|
|
577
|
+
path: ['presentation', 'rightRail', 'defaultCollapsed'],
|
|
578
|
+
message: 'requires collapsible to be true',
|
|
579
|
+
});
|
|
580
|
+
}
|
|
581
|
+
const matches = tree.children.filter((node) => node.type === 'section' && node.key === rail.sectionKey);
|
|
582
|
+
if (matches.length !== 1) {
|
|
583
|
+
ctx.addIssue({
|
|
584
|
+
code: 'custom',
|
|
585
|
+
path: ['presentation', 'rightRail', 'sectionKey'],
|
|
586
|
+
message: 'must identify exactly one keyed root section',
|
|
587
|
+
});
|
|
588
|
+
}
|
|
546
589
|
});
|
|
547
590
|
/** What an action handler returns. `refresh` re-runs `load` after the action. */
|
|
548
591
|
export const actionResultSchema = z.object({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@keemakr/ui-sdk",
|
|
3
|
-
"version": "1.4.0-dev-
|
|
3
|
+
"version": "1.4.0-dev-20261012082811",
|
|
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",
|