@keemakr/ui-sdk 1.3.0-dev-20261006115752 → 1.3.0-dev-20261006120756
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/nodes.d.ts +1 -1
- package/dist/nodes.js +3 -0
- package/dist/schema.d.ts +78 -0
- package/dist/schema.js +62 -0
- package/package.json +1 -1
package/dist/nodes.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ScreenRootNode } from './schema.js';
|
|
2
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", "pagination", "select", "section", "tabs"];
|
|
3
|
+
export declare const KNOWN_NODE_TYPES: readonly ["heading", "text", "markdown", "stat", "button", "form", "table", "timeline", "pending_request", "pending_requests", "choice_cards", "progress", "chart", "pagination", "select", "alert", "details", "timestamp", "section", "tabs"];
|
|
4
4
|
export type KnownNodeType = (typeof KNOWN_NODE_TYPES)[number];
|
|
5
5
|
/**
|
|
6
6
|
* The node types that hold child nodes. `section` mounts its children
|
package/dist/nodes.js
CHANGED
package/dist/schema.d.ts
CHANGED
|
@@ -287,6 +287,68 @@ declare const leafNodeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
287
287
|
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
288
288
|
}, z.core.$strip>], "kind">;
|
|
289
289
|
disabled: z.ZodDefault<z.ZodBoolean>;
|
|
290
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
291
|
+
type: z.ZodLiteral<"alert">;
|
|
292
|
+
tone: z.ZodDefault<z.ZodEnum<{
|
|
293
|
+
success: "success";
|
|
294
|
+
warning: "warning";
|
|
295
|
+
destructive: "destructive";
|
|
296
|
+
info: "info";
|
|
297
|
+
}>>;
|
|
298
|
+
title: z.ZodOptional<z.ZodString>;
|
|
299
|
+
text: z.ZodString;
|
|
300
|
+
action: z.ZodOptional<z.ZodObject<{
|
|
301
|
+
type: z.ZodLiteral<"button">;
|
|
302
|
+
label: z.ZodString;
|
|
303
|
+
onPress: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
304
|
+
kind: z.ZodLiteral<"action">;
|
|
305
|
+
action: z.ZodString;
|
|
306
|
+
input: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
307
|
+
confirm: z.ZodOptional<z.ZodString>;
|
|
308
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
309
|
+
kind: z.ZodLiteral<"navigate">;
|
|
310
|
+
screen: z.ZodString;
|
|
311
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
312
|
+
}, z.core.$strip>], "kind">;
|
|
313
|
+
variant: z.ZodDefault<z.ZodEnum<{
|
|
314
|
+
destructive: "destructive";
|
|
315
|
+
primary: "primary";
|
|
316
|
+
secondary: "secondary";
|
|
317
|
+
}>>;
|
|
318
|
+
disabled: z.ZodDefault<z.ZodBoolean>;
|
|
319
|
+
}, z.core.$strip>>;
|
|
320
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
321
|
+
type: z.ZodLiteral<"details">;
|
|
322
|
+
title: z.ZodOptional<z.ZodString>;
|
|
323
|
+
columns: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>]>>;
|
|
324
|
+
items: z.ZodArray<z.ZodObject<{
|
|
325
|
+
label: z.ZodString;
|
|
326
|
+
value: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
327
|
+
kind: z.ZodLiteral<"text">;
|
|
328
|
+
value: z.ZodString;
|
|
329
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
330
|
+
kind: z.ZodLiteral<"badge">;
|
|
331
|
+
value: z.ZodString;
|
|
332
|
+
tone: z.ZodDefault<z.ZodEnum<{
|
|
333
|
+
success: "success";
|
|
334
|
+
default: "default";
|
|
335
|
+
warning: "warning";
|
|
336
|
+
destructive: "destructive";
|
|
337
|
+
}>>;
|
|
338
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
339
|
+
kind: z.ZodLiteral<"date">;
|
|
340
|
+
value: z.ZodISODateTime;
|
|
341
|
+
}, z.core.$strip>], "kind">;
|
|
342
|
+
}, z.core.$strip>>;
|
|
343
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
344
|
+
type: z.ZodLiteral<"timestamp">;
|
|
345
|
+
value: z.ZodISODateTime;
|
|
346
|
+
style: z.ZodDefault<z.ZodEnum<{
|
|
347
|
+
date: "date";
|
|
348
|
+
datetime: "datetime";
|
|
349
|
+
relative: "relative";
|
|
350
|
+
}>>;
|
|
351
|
+
label: z.ZodOptional<z.ZodString>;
|
|
290
352
|
}, z.core.$strip>], "type">;
|
|
291
353
|
type LeafScreenNode = z.infer<typeof leafNodeSchema>;
|
|
292
354
|
type LeafScreenNodeInput = z.input<typeof leafNodeSchema>;
|
|
@@ -348,6 +410,14 @@ export declare const screenTreeSchema: z.ZodObject<{
|
|
|
348
410
|
version: z.ZodLiteral<1>;
|
|
349
411
|
title: z.ZodString;
|
|
350
412
|
description: z.ZodOptional<z.ZodString>;
|
|
413
|
+
breadcrumbs: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
414
|
+
label: z.ZodString;
|
|
415
|
+
onPress: z.ZodOptional<z.ZodObject<{
|
|
416
|
+
kind: z.ZodLiteral<"navigate">;
|
|
417
|
+
screen: z.ZodString;
|
|
418
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
419
|
+
}, z.core.$strip>>;
|
|
420
|
+
}, z.core.$strip>>>;
|
|
351
421
|
actions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
352
422
|
type: z.ZodLiteral<"button">;
|
|
353
423
|
label: z.ZodString;
|
|
@@ -388,6 +458,14 @@ export declare const screenLoadResponseSchema: z.ZodObject<{
|
|
|
388
458
|
version: z.ZodLiteral<1>;
|
|
389
459
|
title: z.ZodString;
|
|
390
460
|
description: z.ZodOptional<z.ZodString>;
|
|
461
|
+
breadcrumbs: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
462
|
+
label: z.ZodString;
|
|
463
|
+
onPress: z.ZodOptional<z.ZodObject<{
|
|
464
|
+
kind: z.ZodLiteral<"navigate">;
|
|
465
|
+
screen: z.ZodString;
|
|
466
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
467
|
+
}, z.core.$strip>>;
|
|
468
|
+
}, z.core.$strip>>>;
|
|
391
469
|
actions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
392
470
|
type: z.ZodLiteral<"button">;
|
|
393
471
|
label: z.ZodString;
|
package/dist/schema.js
CHANGED
|
@@ -174,6 +174,46 @@ const selectSchema = z
|
|
|
174
174
|
});
|
|
175
175
|
}
|
|
176
176
|
});
|
|
177
|
+
/**
|
|
178
|
+
* A callout for something the reader must notice: a warning, a failure, a success,
|
|
179
|
+
* or neutral information. Use it instead of a text node with a warning sign in
|
|
180
|
+
* front — screen readers and themes then know what it is.
|
|
181
|
+
*/
|
|
182
|
+
const alertSchema = z.object({
|
|
183
|
+
type: z.literal('alert'),
|
|
184
|
+
tone: z.enum(['info', 'success', 'warning', 'destructive']).default('info'),
|
|
185
|
+
title: z.string().max(120).optional(),
|
|
186
|
+
text: z.string().max(1000),
|
|
187
|
+
/** One follow-up press, drawn inside the alert ("Reconnect", "Review"). */
|
|
188
|
+
action: buttonSchema.optional(),
|
|
189
|
+
});
|
|
190
|
+
/**
|
|
191
|
+
* Label–value pairs for one record: a lead's contact details, a campaign's
|
|
192
|
+
* settings. Values reuse the table cell kinds, so a `date` value is shown in the
|
|
193
|
+
* viewer's locale and time zone and a `badge` value keeps its tone.
|
|
194
|
+
*/
|
|
195
|
+
const detailsSchema = z.object({
|
|
196
|
+
type: z.literal('details'),
|
|
197
|
+
title: z.string().max(120).optional(),
|
|
198
|
+
/** Two columns on a wide screen; always one on a narrow one. */
|
|
199
|
+
columns: z.union([z.literal(1), z.literal(2)]).default(1),
|
|
200
|
+
items: z
|
|
201
|
+
.array(z.object({ label: z.string().min(1).max(80), value: cellSchema }))
|
|
202
|
+
.min(1)
|
|
203
|
+
.max(50),
|
|
204
|
+
});
|
|
205
|
+
/**
|
|
206
|
+
* One moment in time, shown in the viewer's locale and time zone: a date, a date
|
|
207
|
+
* and time, or "3 days ago". The module sends ISO 8601 and never formats it — a
|
|
208
|
+
* server-formatted string is in the server's zone, not the reader's.
|
|
209
|
+
*/
|
|
210
|
+
const timestampSchema = z.object({
|
|
211
|
+
type: z.literal('timestamp'),
|
|
212
|
+
value: z.iso.datetime(),
|
|
213
|
+
style: z.enum(['date', 'datetime', 'relative']).default('datetime'),
|
|
214
|
+
/** Shown before the time, muted: "Last contacted". */
|
|
215
|
+
label: z.string().max(80).optional(),
|
|
216
|
+
});
|
|
177
217
|
const headingSchema = z.object({ type: z.literal('heading'), text: z.string().max(120) });
|
|
178
218
|
const textSchema = z.object({
|
|
179
219
|
type: z.literal('text'),
|
|
@@ -294,6 +334,9 @@ const leafNodeSchema = z.discriminatedUnion('type', [
|
|
|
294
334
|
chartSchema,
|
|
295
335
|
paginationSchema,
|
|
296
336
|
selectSchema,
|
|
337
|
+
alertSchema,
|
|
338
|
+
detailsSchema,
|
|
339
|
+
timestampSchema,
|
|
297
340
|
]);
|
|
298
341
|
const MAX_SECTION_DEPTH = 8;
|
|
299
342
|
const nodeSchemas = new Map();
|
|
@@ -372,6 +415,25 @@ export const screenTreeSchema = z.object({
|
|
|
372
415
|
version: z.literal(UI_SCHEMA_VERSION),
|
|
373
416
|
title: z.string().max(120),
|
|
374
417
|
description: z.string().max(300).optional(),
|
|
418
|
+
/**
|
|
419
|
+
* Where this screen sits, drawn above the title: "Leads / Ada Lovelace". Each
|
|
420
|
+
* crumb but the last opens another screen of the module; the last is this
|
|
421
|
+
* screen and takes no press. One crumb is a back link.
|
|
422
|
+
*/
|
|
423
|
+
breadcrumbs: z
|
|
424
|
+
.array(z.object({
|
|
425
|
+
label: z.string().min(1).max(80),
|
|
426
|
+
onPress: z
|
|
427
|
+
.object({
|
|
428
|
+
kind: z.literal('navigate'),
|
|
429
|
+
screen: slug,
|
|
430
|
+
params: z.record(z.string(), z.string()).optional(),
|
|
431
|
+
})
|
|
432
|
+
.optional(),
|
|
433
|
+
}))
|
|
434
|
+
.min(1)
|
|
435
|
+
.max(5)
|
|
436
|
+
.optional(),
|
|
375
437
|
/** Page-level actions, rendered in the header (e.g. "New draft"). */
|
|
376
438
|
actions: z.array(buttonSchema).max(4).optional(),
|
|
377
439
|
children: z.array(nodeSchema).max(100),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@keemakr/ui-sdk",
|
|
3
|
-
"version": "1.3.0-dev-
|
|
3
|
+
"version": "1.3.0-dev-20261006120756",
|
|
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",
|