@assistant-ui/react-generative-ui 0.0.18 → 0.0.19
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/JSONGenerativeUI.client.d.ts +1 -2
- package/dist/JSONGenerativeUI.client.d.ts.map +1 -1
- package/dist/JSONGenerativeUI.server.d.ts +1 -2
- package/dist/JSONGenerativeUI.server.d.ts.map +1 -1
- package/dist/JSONGenerativeUI.shared.d.ts +8 -9
- package/dist/JSONGenerativeUI.shared.d.ts.map +1 -1
- package/dist/a2ui/convert.d.ts +1 -2
- package/dist/a2ui/convert.d.ts.map +1 -1
- package/dist/a2ui/reducer.d.ts +1 -2
- package/dist/a2ui/reducer.d.ts.map +1 -1
- package/dist/a2ui/types.d.ts +17 -18
- package/dist/a2ui/types.d.ts.map +1 -1
- package/dist/actionRegistry.d.ts +5 -6
- package/dist/actionRegistry.d.ts.map +1 -1
- package/dist/buildPresentParameters.d.ts +2 -3
- package/dist/buildPresentParameters.d.ts.map +1 -1
- package/dist/constants.d.ts +2 -2
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +2 -1
- package/dist/constants.js.map +1 -1
- package/dist/convert/boundSpec.d.ts +7 -8
- package/dist/convert/boundSpec.d.ts.map +1 -1
- package/dist/convert/copyBounded.d.ts +1 -2
- package/dist/convert/copyBounded.d.ts.map +1 -1
- package/dist/convert/isElement.d.ts +1 -2
- package/dist/convert/isElement.d.ts.map +1 -1
- package/dist/convert/takeRun.d.ts +1 -2
- package/dist/convert/takeRun.d.ts.map +1 -1
- package/dist/defineGenerativeComponents.d.ts +1 -2
- package/dist/defineGenerativeComponents.d.ts.map +1 -1
- package/dist/generativeUIToJSX.d.ts +2 -3
- package/dist/generativeUIToJSX.d.ts.map +1 -1
- package/dist/ir.d.ts +28 -29
- package/dist/ir.d.ts.map +1 -1
- package/dist/renderGenerativeUI.d.ts +1 -2
- package/dist/renderGenerativeUI.d.ts.map +1 -1
- package/dist/slack/constants.d.ts +35 -36
- package/dist/slack/constants.d.ts.map +1 -1
- package/dist/slack/decodeBlockAction.d.ts +1 -2
- package/dist/slack/decodeBlockAction.d.ts.map +1 -1
- package/dist/slack/fromSlackBlocks.d.ts +1 -2
- package/dist/slack/fromSlackBlocks.d.ts.map +1 -1
- package/dist/slack/toSlackBlocks.d.ts +1 -2
- package/dist/slack/toSlackBlocks.d.ts.map +1 -1
- package/dist/slack/types.d.ts +32 -33
- package/dist/slack/types.d.ts.map +1 -1
- package/dist/teams/constants.d.ts +14 -15
- package/dist/teams/constants.d.ts.map +1 -1
- package/dist/teams/decodeSubmitData.d.ts +1 -2
- package/dist/teams/decodeSubmitData.d.ts.map +1 -1
- package/dist/teams/toAdaptiveCard.d.ts +6 -7
- package/dist/teams/toAdaptiveCard.d.ts.map +1 -1
- package/dist/teams/toTeamsAttachments.d.ts +1 -2
- package/dist/teams/toTeamsAttachments.d.ts.map +1 -1
- package/dist/teams/types.d.ts +29 -30
- package/dist/teams/types.d.ts.map +1 -1
- package/dist/types.d.ts +9 -10
- package/dist/types.d.ts.map +1 -1
- package/dist/vocabulary/alert.d.ts +1 -2
- package/dist/vocabulary/alert.d.ts.map +1 -1
- package/dist/vocabulary/collectFormValues.d.ts +6 -5
- package/dist/vocabulary/collectFormValues.d.ts.map +1 -1
- package/dist/vocabulary/collectFormValues.js +3 -2
- package/dist/vocabulary/collectFormValues.js.map +1 -1
- package/dist/vocabulary/data.d.ts +1 -2
- package/dist/vocabulary/data.d.ts.map +1 -1
- package/dist/vocabulary/dispatch.d.ts +2 -3
- package/dist/vocabulary/dispatch.d.ts.map +1 -1
- package/dist/vocabulary/fact.d.ts +1 -2
- package/dist/vocabulary/fact.d.ts.map +1 -1
- package/dist/vocabulary/form.d.ts +1 -2
- package/dist/vocabulary/form.d.ts.map +1 -1
- package/dist/vocabulary/icon.d.ts +1 -2
- package/dist/vocabulary/icon.d.ts.map +1 -1
- package/dist/vocabulary/index.d.ts +1 -2
- package/dist/vocabulary/index.d.ts.map +1 -1
- package/dist/vocabulary/interactive.d.ts +4 -4
- package/dist/vocabulary/interactive.d.ts.map +1 -1
- package/dist/vocabulary/interactive.js +2 -0
- package/dist/vocabulary/interactive.js.map +1 -1
- package/dist/vocabulary/layout.d.ts +1 -2
- package/dist/vocabulary/layout.d.ts.map +1 -1
- package/dist/vocabulary/list.d.ts +1 -2
- package/dist/vocabulary/list.d.ts.map +1 -1
- package/dist/vocabulary/media.d.ts +1 -2
- package/dist/vocabulary/media.d.ts.map +1 -1
- package/dist/vocabulary/text.d.ts +2 -3
- package/dist/vocabulary/text.d.ts.map +1 -1
- package/dist/vocabulary/toTextContent.d.ts +1 -2
- package/dist/vocabulary/toTextContent.d.ts.map +1 -1
- package/package.json +12 -10
- package/src/constants.ts +2 -0
- package/src/slack/fromSlackBlocks.test.ts +4 -1
- package/src/slack/toSlackBlocks.test.ts +8 -4
- package/src/teams/toAdaptiveCard.test.ts +5 -3
- package/src/vocabulary/collectFormValues.test.ts +38 -0
- package/src/vocabulary/collectFormValues.ts +11 -2
- package/src/vocabulary/form.test.tsx +1 -0
- package/src/vocabulary/interactive.test.tsx +14 -1
- package/src/vocabulary/interactive.tsx +8 -1
- package/src/vocabulary/layout.test.tsx +1 -0
- package/src/vocabulary/list.test.tsx +5 -4
- package/dist/node_modules/.pnpm/@types_json-schema@7.0.15/node_modules/@types/json-schema/index.d.ts +0 -141
- package/dist/node_modules/.pnpm/@types_json-schema@7.0.15/node_modules/@types/json-schema/index.d.ts.map +0 -1
|
@@ -11,7 +11,7 @@ import { JSONGenerativeUIOptions, PresentTool, PresentToolOptions, PromptUserToo
|
|
|
11
11
|
* `actions` registry (if provided) is threaded into the render context so
|
|
12
12
|
* interactive components can fire `$action` through `$dispatch`.
|
|
13
13
|
*/
|
|
14
|
-
declare class JSONGenerativeUI {
|
|
14
|
+
export declare class JSONGenerativeUI {
|
|
15
15
|
private readonly library;
|
|
16
16
|
private readonly parameters;
|
|
17
17
|
private readonly actions;
|
|
@@ -26,5 +26,4 @@ declare class JSONGenerativeUI {
|
|
|
26
26
|
promptUser(): PromptUserTool;
|
|
27
27
|
}
|
|
28
28
|
//#endregion
|
|
29
|
-
export { JSONGenerativeUI };
|
|
30
29
|
//# sourceMappingURL=JSONGenerativeUI.client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JSONGenerativeUI.client.d.ts","names":[],"sources":["../src/JSONGenerativeUI.client.tsx"],"mappings":";;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"JSONGenerativeUI.client.d.ts","names":[],"sources":["../src/JSONGenerativeUI.client.tsx"],"mappings":";;;;;;;;;;;;;qBAkCa;mBACM;mBACA;mBACA;EAEL,YAAA,SAAS;;;;;;mBAWJ;EAejB,QAAQ,UAAU,qBAAqB;EASvC,cAAc"}
|
|
@@ -13,12 +13,11 @@ import { JSONGenerativeUIOptions, PresentTool, PresentToolOptions, PromptUserToo
|
|
|
13
13
|
* `as` casts here because the tool types require a `render` for frontend/human
|
|
14
14
|
* tools; on the server it is structurally absent and never read.
|
|
15
15
|
*/
|
|
16
|
-
declare class JSONGenerativeUI {
|
|
16
|
+
export declare class JSONGenerativeUI {
|
|
17
17
|
private readonly parameters;
|
|
18
18
|
constructor(options: JSONGenerativeUIOptions);
|
|
19
19
|
present(options?: PresentToolOptions): PresentTool;
|
|
20
20
|
promptUser(): PromptUserTool;
|
|
21
21
|
}
|
|
22
22
|
//#endregion
|
|
23
|
-
export { JSONGenerativeUI };
|
|
24
23
|
//# sourceMappingURL=JSONGenerativeUI.server.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JSONGenerativeUI.server.d.ts","names":[],"sources":["../src/JSONGenerativeUI.server.tsx"],"mappings":";;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"JSONGenerativeUI.server.d.ts","names":[],"sources":["../src/JSONGenerativeUI.server.tsx"],"mappings":";;;;;;;;;;;;;;;qBAwBa;mBACM;EAEL,YAAA,SAAS;EAIrB,QAAQ,UAAU,qBAAqB;EAIvC,cAAc"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { JSONSchema7 } from "./node_modules/.pnpm/@types_json-schema@7.0.15/node_modules/@types/json-schema/index.js";
|
|
2
1
|
import { ActionRegistry } from "./actionRegistry.js";
|
|
3
2
|
import { GenerativeUILibrary } from "./types.js";
|
|
4
3
|
import { ToolDefinition } from "@assistant-ui/react";
|
|
4
|
+
import { JSONSchema7 } from "json-schema";
|
|
5
5
|
//#region src/JSONGenerativeUI.shared.d.ts
|
|
6
6
|
/** Options for {@link JSONGenerativeUI}. */
|
|
7
|
-
type JSONGenerativeUIOptions = {
|
|
7
|
+
export type JSONGenerativeUIOptions = {
|
|
8
8
|
/**
|
|
9
9
|
* The components the model is allowed to render, keyed by the `$type` it
|
|
10
10
|
* selects them with. Author it with `defineGenerativeComponents({ ... })` so a
|
|
@@ -20,7 +20,7 @@ type JSONGenerativeUIOptions = {
|
|
|
20
20
|
actions?: ActionRegistry;
|
|
21
21
|
};
|
|
22
22
|
/** Options for {@link JSONGenerativeUI.present}. */
|
|
23
|
-
type PresentToolOptions = {
|
|
23
|
+
export type PresentToolOptions = {
|
|
24
24
|
/**
|
|
25
25
|
* Set `"standalone"` to render the component on its own surface (outside the
|
|
26
26
|
* chain-of-thought trace), e.g. a full-bleed artifact like a card. Omit it for
|
|
@@ -35,17 +35,17 @@ type BackendDefaultMetadata = {
|
|
|
35
35
|
};
|
|
36
36
|
};
|
|
37
37
|
/** The `present` tool, as the model sees it (no client `render`/`execute`). */
|
|
38
|
-
type PresentTool = ToolDefinition<Record<string, unknown>, Record<string, never>> & BackendDefaultMetadata;
|
|
38
|
+
export type PresentTool = ToolDefinition<Record<string, unknown>, Record<string, never>> & BackendDefaultMetadata;
|
|
39
39
|
/** The `prompt_user` tool, as the model sees it (no client `render`). */
|
|
40
|
-
type PromptUserTool = ToolDefinition<Record<string, unknown>, unknown> & BackendDefaultMetadata;
|
|
40
|
+
export type PromptUserTool = ToolDefinition<Record<string, unknown>, unknown> & BackendDefaultMetadata;
|
|
41
41
|
/** The tool `parameters` schema, built once per instance (see `buildPresentParameters`). */
|
|
42
|
-
type PresentParameters = JSONSchema7;
|
|
42
|
+
export type PresentParameters = JSONSchema7;
|
|
43
43
|
/**
|
|
44
44
|
* The schema-only half of the `present` tool, shared by both builds. The server
|
|
45
45
|
* build returns exactly this; the client build adds `execute` and `render`.
|
|
46
46
|
* Takes the already-built `parameters` so it isn't recomputed per tool.
|
|
47
47
|
*/
|
|
48
|
-
declare function presentToolBase(parameters: PresentParameters, options?: PresentToolOptions): {
|
|
48
|
+
export declare function presentToolBase(parameters: PresentParameters, options?: PresentToolOptions): {
|
|
49
49
|
display?: "standalone";
|
|
50
50
|
type: "frontend";
|
|
51
51
|
description: string;
|
|
@@ -55,11 +55,10 @@ declare function presentToolBase(parameters: PresentParameters, options?: Presen
|
|
|
55
55
|
* The schema-only half of the `prompt_user` tool, shared by both builds. The
|
|
56
56
|
* server build returns exactly this; the client build adds `render`.
|
|
57
57
|
*/
|
|
58
|
-
declare function promptUserToolBase(parameters: PresentParameters): {
|
|
58
|
+
export declare function promptUserToolBase(parameters: PresentParameters): {
|
|
59
59
|
type: "human";
|
|
60
60
|
description: string;
|
|
61
61
|
parameters: JSONSchema7;
|
|
62
62
|
};
|
|
63
63
|
//#endregion
|
|
64
|
-
export { JSONGenerativeUIOptions, PresentParameters, PresentTool, PresentToolOptions, PromptUserTool, presentToolBase, promptUserToolBase };
|
|
65
64
|
//# sourceMappingURL=JSONGenerativeUI.shared.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JSONGenerativeUI.shared.d.ts","names":[],"sources":["../src/JSONGenerativeUI.shared.ts"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"JSONGenerativeUI.shared.d.ts","names":[],"sources":["../src/JSONGenerativeUI.shared.ts"],"mappings":";;;;;;YAMY;;;;;;EAMV,SAAS;;;;;;;EAOT,UAAU;;;YAIA;;;;;;;EAOV;;KAGG;EACH;IACE;;;;YAKQ,cAAc,eACxB,yBACA,yBAEA;;YAGU,iBAAiB,eAAe,oCAC1C;;YAYU,oBAAoB;;;;;;wBAOhB,gBACd,YAAY,mBACZ,UAAU;;;;;;;;;;wBAcI,mBAAmB,YAAY;;;cAAA"}
|
package/dist/a2ui/convert.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { UIElement } from "../ir.js";
|
|
2
2
|
import { A2uiSurfaceState } from "./types.js";
|
|
3
3
|
//#region src/a2ui/convert.d.ts
|
|
4
|
-
declare function convertSurfaceToUISpec(surface: A2uiSurfaceState): {
|
|
4
|
+
export declare function convertSurfaceToUISpec(surface: A2uiSurfaceState): {
|
|
5
5
|
spec: UIElement | null;
|
|
6
6
|
warnings: string[];
|
|
7
7
|
};
|
|
8
8
|
//#endregion
|
|
9
|
-
export { convertSurfaceToUISpec };
|
|
10
9
|
//# sourceMappingURL=convert.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convert.d.ts","names":[],"sources":["../../src/a2ui/convert.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"convert.d.ts","names":[],"sources":["../../src/a2ui/convert.ts"],"mappings":";;;wBAscgB,uBAAuB,SAAS;EAC9C,MAAM;EACN"}
|
package/dist/a2ui/reducer.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { A2uiOperationResult, A2uiState } from "./types.js";
|
|
2
2
|
//#region src/a2ui/reducer.d.ts
|
|
3
|
-
declare function applyA2uiOperations(state: A2uiState, operations: unknown): A2uiOperationResult;
|
|
3
|
+
export declare function applyA2uiOperations(state: A2uiState, operations: unknown): A2uiOperationResult;
|
|
4
4
|
//#endregion
|
|
5
|
-
export { applyA2uiOperations };
|
|
6
5
|
//# sourceMappingURL=reducer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reducer.d.ts","names":[],"sources":["../../src/a2ui/reducer.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"reducer.d.ts","names":[],"sources":["../../src/a2ui/reducer.ts"],"mappings":";;wBAuNgB,oBACd,OAAO,WACP,sBACC"}
|
package/dist/a2ui/types.d.ts
CHANGED
|
@@ -1,73 +1,72 @@
|
|
|
1
1
|
//#region src/a2ui/types.d.ts
|
|
2
|
-
declare const A2UI_SURFACE_ID: unique symbol;
|
|
3
|
-
type A2uiVersion = "v0.9" | "v1.0";
|
|
4
|
-
interface A2uiTemplateChildren {
|
|
2
|
+
export declare const A2UI_SURFACE_ID: unique symbol;
|
|
3
|
+
export type A2uiVersion = "v0.9" | "v1.0";
|
|
4
|
+
export interface A2uiTemplateChildren {
|
|
5
5
|
readonly template: {
|
|
6
6
|
readonly componentId: string;
|
|
7
7
|
readonly path: string;
|
|
8
8
|
};
|
|
9
9
|
}
|
|
10
|
-
interface ComponentNode extends Record<string, unknown> {
|
|
10
|
+
export interface ComponentNode extends Record<string, unknown> {
|
|
11
11
|
readonly id: string;
|
|
12
12
|
readonly component: string;
|
|
13
13
|
readonly children?: readonly string[] | A2uiTemplateChildren;
|
|
14
14
|
}
|
|
15
|
-
interface A2uiCreateSurfaceV09Payload {
|
|
15
|
+
export interface A2uiCreateSurfaceV09Payload {
|
|
16
16
|
readonly surfaceId: string;
|
|
17
17
|
readonly catalogId?: string;
|
|
18
18
|
readonly theme?: unknown;
|
|
19
19
|
readonly attachDataModel?: unknown;
|
|
20
20
|
}
|
|
21
|
-
interface A2uiCreateSurfaceV10Payload {
|
|
21
|
+
export interface A2uiCreateSurfaceV10Payload {
|
|
22
22
|
readonly surfaceId: string;
|
|
23
23
|
readonly surfaceProperties?: unknown;
|
|
24
24
|
readonly sendDataModel?: unknown;
|
|
25
25
|
readonly components?: readonly ComponentNode[];
|
|
26
26
|
readonly dataModel?: unknown;
|
|
27
27
|
}
|
|
28
|
-
interface A2uiUpdateComponentsPayload {
|
|
28
|
+
export interface A2uiUpdateComponentsPayload {
|
|
29
29
|
readonly surfaceId: string;
|
|
30
30
|
readonly components: readonly ComponentNode[];
|
|
31
31
|
}
|
|
32
|
-
interface A2uiUpdateDataModelPayload {
|
|
32
|
+
export interface A2uiUpdateDataModelPayload {
|
|
33
33
|
readonly surfaceId: string;
|
|
34
34
|
readonly path?: string;
|
|
35
35
|
readonly contents?: unknown;
|
|
36
36
|
readonly value?: unknown;
|
|
37
37
|
readonly data?: unknown;
|
|
38
38
|
}
|
|
39
|
-
interface A2uiDeleteSurfacePayload {
|
|
39
|
+
export interface A2uiDeleteSurfacePayload {
|
|
40
40
|
readonly surfaceId: string;
|
|
41
41
|
}
|
|
42
|
-
type A2uiCreateSurfaceOperation = {
|
|
42
|
+
export type A2uiCreateSurfaceOperation = {
|
|
43
43
|
readonly version: "v0.9";
|
|
44
44
|
readonly createSurface: A2uiCreateSurfaceV09Payload;
|
|
45
45
|
} | {
|
|
46
46
|
readonly version: "v1.0";
|
|
47
47
|
readonly createSurface: A2uiCreateSurfaceV10Payload;
|
|
48
48
|
};
|
|
49
|
-
interface A2uiUpdateComponentsOperation {
|
|
49
|
+
export interface A2uiUpdateComponentsOperation {
|
|
50
50
|
readonly version: A2uiVersion;
|
|
51
51
|
readonly updateComponents: A2uiUpdateComponentsPayload;
|
|
52
52
|
}
|
|
53
|
-
interface A2uiUpdateDataModelOperation {
|
|
53
|
+
export interface A2uiUpdateDataModelOperation {
|
|
54
54
|
readonly version: A2uiVersion;
|
|
55
55
|
readonly updateDataModel: A2uiUpdateDataModelPayload;
|
|
56
56
|
}
|
|
57
|
-
interface A2uiDeleteSurfaceOperation {
|
|
57
|
+
export interface A2uiDeleteSurfaceOperation {
|
|
58
58
|
readonly version: A2uiVersion;
|
|
59
59
|
readonly deleteSurface: A2uiDeleteSurfacePayload;
|
|
60
60
|
}
|
|
61
|
-
type A2uiOperation = A2uiCreateSurfaceOperation | A2uiUpdateComponentsOperation | A2uiUpdateDataModelOperation | A2uiDeleteSurfaceOperation;
|
|
62
|
-
type A2uiSurfaceState = {
|
|
61
|
+
export type A2uiOperation = A2uiCreateSurfaceOperation | A2uiUpdateComponentsOperation | A2uiUpdateDataModelOperation | A2uiDeleteSurfaceOperation;
|
|
62
|
+
export type A2uiSurfaceState = {
|
|
63
63
|
components: Map<string, Record<string, unknown>>;
|
|
64
64
|
dataModel: unknown;
|
|
65
65
|
};
|
|
66
|
-
type A2uiState = ReadonlyMap<string, A2uiSurfaceState>;
|
|
67
|
-
interface A2uiOperationResult {
|
|
66
|
+
export type A2uiState = ReadonlyMap<string, A2uiSurfaceState>;
|
|
67
|
+
export interface A2uiOperationResult {
|
|
68
68
|
readonly state: A2uiState;
|
|
69
69
|
readonly warnings: string[];
|
|
70
70
|
}
|
|
71
71
|
//#endregion
|
|
72
|
-
export { A2UI_SURFACE_ID, A2uiCreateSurfaceOperation, A2uiCreateSurfaceV09Payload, A2uiCreateSurfaceV10Payload, A2uiDeleteSurfaceOperation, A2uiDeleteSurfacePayload, A2uiOperation, A2uiOperationResult, A2uiState, A2uiSurfaceState, A2uiTemplateChildren, A2uiUpdateComponentsOperation, A2uiUpdateComponentsPayload, A2uiUpdateDataModelOperation, A2uiUpdateDataModelPayload, A2uiVersion, ComponentNode };
|
|
73
72
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/a2ui/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","names":[],"sources":["../../src/a2ui/types.ts"],"mappings":";
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":[],"sources":["../../src/a2ui/types.ts"],"mappings":";qBAAa;YAED;iBAEK;WACN;aACE;aACA;;;iBAII,sBAAsB;WAC5B;WACA;WACA,+BAA+B;;iBAGzB;WACN;WACA;WACA;WACA;;iBAGM;WACN;WACA;WACA;WACA,sBAAsB;WACtB;;iBAGM;WACN;WACA,qBAAqB;;iBAGf;WACN;WACA;WACA;WACA;WACA;;iBAGM;WACN;;YAGC;WAEG;WACA,eAAe;;WAGf;WACA,eAAe;;iBAGb;WACN,SAAS;WACT,kBAAkB;;iBAGZ;WACN,SAAS;WACT,iBAAiB;;iBAGX;WACN,SAAS;WACT,eAAe;;YAGd,gBACR,6BACA,gCACA,+BACA;YAEQ;EACV,YAAY,YAAY;EACxB;;YAGU,YAAY,oBAAoB;iBAE3B;WACN,OAAO;WACP"}
|
package/dist/actionRegistry.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Action } from "./ir.js";
|
|
2
2
|
//#region src/actionRegistry.d.ts
|
|
3
3
|
/** Context handed to an {@link ActionHandler} when an `$action` fires. */
|
|
4
|
-
type ActionDispatchContext = {
|
|
4
|
+
export type ActionDispatchContext = {
|
|
5
5
|
/**
|
|
6
6
|
* The action payload. For fire-and-forget actions this is the `$action` as the model emitted it. For an interactive component the user's runtime input is merged in under the reserved `$input` key: a single value for a standalone control's dispatch, or an object keyed by each field's `name` for a `Form` or a `Card` with `asForm` set. A model-supplied `value` field is never clobbered.
|
|
7
7
|
*/
|
|
@@ -14,19 +14,18 @@ type ActionDispatchContext = {
|
|
|
14
14
|
* value is left as `unknown` and documented per-action). The return value is
|
|
15
15
|
* handed back to `dispatch`'s caller as `unknown`.
|
|
16
16
|
*/
|
|
17
|
-
type ActionHandler = (ctx: ActionDispatchContext) => unknown | Promise<unknown>;
|
|
17
|
+
export type ActionHandler = (ctx: ActionDispatchContext) => unknown | Promise<unknown>;
|
|
18
18
|
/**
|
|
19
19
|
* The host-provided map from `$action.type` to {@link ActionHandler}. This is the single dispatch target for rendered generative UI: every interactive component fires its `$action` here through the injected `$dispatch` (a submit Button defers to its ancestor form's dispatch instead). The payload's `$input` takes one of two shapes: a single value for a standalone control's dispatch (`Select`, `Input`, `DatePicker`, `Checkbox`, `RadioGroup`), or an object keyed by field `name` for a `Form` or a `Card` with `asForm` set. Construct it with {@link createActionRegistry} and pass it to `JSONGenerativeUI`.
|
|
20
20
|
*/
|
|
21
|
-
type ActionRegistry = {
|
|
21
|
+
export type ActionRegistry = {
|
|
22
22
|
dispatch(action: Action): unknown;
|
|
23
23
|
has(type: string): boolean;
|
|
24
24
|
};
|
|
25
|
-
declare function createActionRegistry(handlers: Readonly<Record<string, ActionHandler>>): ActionRegistry;
|
|
25
|
+
export declare function createActionRegistry(handlers: Readonly<Record<string, ActionHandler>>): ActionRegistry;
|
|
26
26
|
/** A no-op registry used when no handlers are provided. Dispatch resolves to
|
|
27
27
|
* `undefined` and logs a warning in dev for unknown types, so a model-emitted
|
|
28
28
|
* action with no handler degrades to "does nothing" rather than throwing. */
|
|
29
|
-
declare const emptyActionRegistry: ActionRegistry;
|
|
29
|
+
export declare const emptyActionRegistry: ActionRegistry;
|
|
30
30
|
//#endregion
|
|
31
|
-
export { ActionDispatchContext, ActionHandler, ActionRegistry, createActionRegistry, emptyActionRegistry };
|
|
32
31
|
//# sourceMappingURL=actionRegistry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actionRegistry.d.ts","names":[],"sources":["../src/actionRegistry.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"actionRegistry.d.ts","names":[],"sources":["../src/actionRegistry.ts"],"mappings":";;;YAGY;;;;WAID,SAAS;;;;;;;;;YAUR,iBACV,KAAK,oCACQ;;;;YAKH;EACV,SAAS,QAAQ;EACjB,IAAI;;wBAGU,qBACd,UAAU,SAAS,eAAe,kBACjC;;;;qBA0CU,qBAAqB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { JSONSchema7 } from "./node_modules/.pnpm/@types_json-schema@7.0.15/node_modules/@types/json-schema/index.js";
|
|
2
1
|
import { GenerativeUILibrary } from "./types.js";
|
|
2
|
+
import { JSONSchema7 } from "json-schema";
|
|
3
3
|
//#region src/buildPresentParameters.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Builds the JSON schema for the `present` tool from a {@link GenerativeUILibrary}.
|
|
@@ -18,7 +18,6 @@ import { GenerativeUILibrary } from "./types.js";
|
|
|
18
18
|
* renderer validates nothing here — an unknown `$type` or stray prop is handled
|
|
19
19
|
* at render time — so a looser schema only costs the model a hint, not safety.
|
|
20
20
|
*/
|
|
21
|
-
declare function buildPresentParameters(library: GenerativeUILibrary): JSONSchema7;
|
|
21
|
+
export declare function buildPresentParameters(library: GenerativeUILibrary): JSONSchema7;
|
|
22
22
|
//#endregion
|
|
23
|
-
export { buildPresentParameters };
|
|
24
23
|
//# sourceMappingURL=buildPresentParameters.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildPresentParameters.d.ts","names":[],"sources":["../src/buildPresentParameters.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"buildPresentParameters.d.ts","names":[],"sources":["../src/buildPresentParameters.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;wBAsBgB,uBACd,SAAS,sBACR"}
|
package/dist/constants.d.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* colliding with the discriminator. It mirrors the `$type` discriminator
|
|
9
9
|
* convention used by JSON polymorphism elsewhere.
|
|
10
10
|
*/
|
|
11
|
-
declare const TYPE_KEY = "$type";
|
|
11
|
+
export declare const TYPE_KEY = "$type";
|
|
12
|
+
export declare const GENERATED_NAME_ATTR = "data-aui-generated-name";
|
|
12
13
|
//#endregion
|
|
13
|
-
export { TYPE_KEY };
|
|
14
14
|
//# sourceMappingURL=constants.d.ts.map
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","names":[],"sources":["../src/constants.ts"],"mappings":";;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"constants.d.ts","names":[],"sources":["../src/constants.ts"],"mappings":";;;;;;;;;;qBASa;qBAEA"}
|
package/dist/constants.js
CHANGED
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
* convention used by JSON polymorphism elsewhere.
|
|
10
10
|
*/
|
|
11
11
|
const TYPE_KEY = "$type";
|
|
12
|
+
const GENERATED_NAME_ATTR = "data-aui-generated-name";
|
|
12
13
|
//#endregion
|
|
13
|
-
export { TYPE_KEY };
|
|
14
|
+
export { GENERATED_NAME_ATTR, TYPE_KEY };
|
|
14
15
|
|
|
15
16
|
//# sourceMappingURL=constants.js.map
|
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","names":[],"sources":["../src/constants.ts"],"sourcesContent":["/**\n * The wire key naming the component to render.\n *\n * The model emits nodes as flat objects `{ [TYPE_KEY]: name, ...props }`. We\n * use `$type` rather than `type` so a component's own `type` prop (e.g. a\n * button's `type=\"submit\"`) flows through as an ordinary prop without\n * colliding with the discriminator. It mirrors the `$type` discriminator\n * convention used by JSON polymorphism elsewhere.\n */\nexport const TYPE_KEY = \"$type\";\n"],"mappings":";;;;;;;;;;AASA,MAAa,WAAW"}
|
|
1
|
+
{"version":3,"file":"constants.js","names":[],"sources":["../src/constants.ts"],"sourcesContent":["/**\n * The wire key naming the component to render.\n *\n * The model emits nodes as flat objects `{ [TYPE_KEY]: name, ...props }`. We\n * use `$type` rather than `type` so a component's own `type` prop (e.g. a\n * button's `type=\"submit\"`) flows through as an ordinary prop without\n * colliding with the discriminator. It mirrors the `$type` discriminator\n * convention used by JSON polymorphism elsewhere.\n */\nexport const TYPE_KEY = \"$type\";\n\nexport const GENERATED_NAME_ATTR = \"data-aui-generated-name\";\n"],"mappings":";;;;;;;;;;AASA,MAAa,WAAW;AAExB,MAAa,sBAAsB"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
//#region src/convert/boundSpec.d.ts
|
|
2
2
|
/** The maximum traversal depth, counted in visited values, not tree levels. */
|
|
3
|
-
declare const MAX_TRAVERSAL_DEPTH = 64;
|
|
3
|
+
export declare const MAX_TRAVERSAL_DEPTH = 64;
|
|
4
4
|
/**
|
|
5
5
|
* The element-nesting ceiling a caller observes. `boundNode` visits an element
|
|
6
6
|
* and its `children` array separately, so one level of nesting spends two of
|
|
7
7
|
* {@link MAX_TRAVERSAL_DEPTH}; it runs before the conversion walk and is never
|
|
8
8
|
* the looser of the two. A root array costs one more level than a root object.
|
|
9
9
|
*/
|
|
10
|
-
declare const MAX_ELEMENT_DEPTH: number;
|
|
10
|
+
export declare const MAX_ELEMENT_DEPTH: number;
|
|
11
11
|
/**
|
|
12
12
|
* The maximum number of entries kept at any single level (root, or a
|
|
13
13
|
* `children` array at any depth) of the raw spec, before it ever reaches
|
|
@@ -15,7 +15,7 @@ declare const MAX_ELEMENT_DEPTH: number;
|
|
|
15
15
|
* can never be made to walk further than this regardless of what the array
|
|
16
16
|
* claims about itself.
|
|
17
17
|
*/
|
|
18
|
-
declare const CHILDREN_CAP = 200;
|
|
18
|
+
export declare const CHILDREN_CAP = 200;
|
|
19
19
|
/**
|
|
20
20
|
* The total number of nodes {@link boundSpec} will visit across one walk,
|
|
21
21
|
* regardless of how many times a shared reference recurs. Bounds the
|
|
@@ -23,10 +23,10 @@ declare const CHILDREN_CAP = 200;
|
|
|
23
23
|
* otherwise force even though each individual array stays within
|
|
24
24
|
* {@link CHILDREN_CAP}.
|
|
25
25
|
*/
|
|
26
|
-
declare const NODE_BUDGET = 5000;
|
|
27
|
-
type ClampReason = "children" | "budget" | "cycle" | "depth";
|
|
26
|
+
export declare const NODE_BUDGET = 5000;
|
|
27
|
+
export type ClampReason = "children" | "budget" | "cycle" | "depth";
|
|
28
28
|
/** Renders the warning detail a protocol reports for one {@link ClampReason}. */
|
|
29
|
-
declare function clampReasonDetail(reason: ClampReason): string;
|
|
29
|
+
export declare function clampReasonDetail(reason: ClampReason): string;
|
|
30
30
|
/**
|
|
31
31
|
* Produces a bounded plain copy of a raw generative-ui spec before it
|
|
32
32
|
* reaches `normalizeSpec`, whose own traversal of the root array or any
|
|
@@ -45,7 +45,6 @@ declare function clampReasonDetail(reason: ClampReason): string;
|
|
|
45
45
|
* {@link NODE_BUDGET} nodes, so shared references cannot multiply work
|
|
46
46
|
* exponentially, and a node that is its own ancestor is cut to `null`.
|
|
47
47
|
*/
|
|
48
|
-
declare function boundSpec(spec: unknown, onClamp: (reason: ClampReason) => void): unknown;
|
|
48
|
+
export declare function boundSpec(spec: unknown, onClamp: (reason: ClampReason) => void): unknown;
|
|
49
49
|
//#endregion
|
|
50
|
-
export { CHILDREN_CAP, ClampReason, MAX_ELEMENT_DEPTH, MAX_TRAVERSAL_DEPTH, NODE_BUDGET, boundSpec, clampReasonDetail };
|
|
51
50
|
//# sourceMappingURL=boundSpec.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boundSpec.d.ts","names":[],"sources":["../../src/convert/boundSpec.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"boundSpec.d.ts","names":[],"sources":["../../src/convert/boundSpec.ts"],"mappings":";;qBAGa;;;;;;;qBAQA;;;;;;;;qBASA;;;;;;;;qBASA;YAED;;wBAGI,kBAAkB,QAAQ;;;;;;;;;;;;;;;;;;;wBAwF1B,UACd,eACA,UAAU,QAAQ"}
|
|
@@ -19,10 +19,9 @@
|
|
|
19
19
|
* that same normalized figure, so a `length` whose `valueOf` answers differently
|
|
20
20
|
* on a second conversion cannot separate the warning from the bound.
|
|
21
21
|
*/
|
|
22
|
-
declare const copyBounded: <T>(value: readonly T[], cap: number) => {
|
|
22
|
+
export declare const copyBounded: <T>(value: readonly T[], cap: number) => {
|
|
23
23
|
readonly items: T[];
|
|
24
24
|
readonly truncated: boolean;
|
|
25
25
|
};
|
|
26
26
|
//#endregion
|
|
27
|
-
export { copyBounded };
|
|
28
27
|
//# sourceMappingURL=copyBounded.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copyBounded.d.ts","names":[],"sources":["../../src/convert/copyBounded.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"copyBounded.d.ts","names":[],"sources":["../../src/convert/copyBounded.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;qBAoBa,cAAe,GAC1B,gBAAgB,KAChB;WACY,OAAO;WAAc"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { NormalizedUIElement, NormalizedUINode } from "../ir.js";
|
|
2
2
|
//#region src/convert/isElement.d.ts
|
|
3
|
-
declare const isElement: (node: NormalizedUINode) => node is NormalizedUIElement;
|
|
3
|
+
export declare const isElement: (node: NormalizedUINode) => node is NormalizedUIElement;
|
|
4
4
|
//#endregion
|
|
5
|
-
export { isElement };
|
|
6
5
|
//# sourceMappingURL=isElement.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isElement.d.ts","names":[],"sources":["../../src/convert/isElement.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"isElement.d.ts","names":[],"sources":["../../src/convert/isElement.ts"],"mappings":";;qBAEa,YACX,MAAM,qBACL,QAAQ"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { NormalizedUIElement, NormalizedUINode } from "../ir.js";
|
|
2
2
|
//#region src/convert/takeRun.d.ts
|
|
3
|
-
declare function takeRun(nodes: readonly (NormalizedUINode | undefined)[], index: number, matches: (element: NormalizedUIElement) => boolean): {
|
|
3
|
+
export declare function takeRun(nodes: readonly (NormalizedUINode | undefined)[], index: number, matches: (element: NormalizedUIElement) => boolean): {
|
|
4
4
|
run: NormalizedUIElement[];
|
|
5
5
|
next: number;
|
|
6
6
|
};
|
|
7
7
|
//#endregion
|
|
8
|
-
export { takeRun };
|
|
9
8
|
//# sourceMappingURL=takeRun.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"takeRun.d.ts","names":[],"sources":["../../src/convert/takeRun.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"takeRun.d.ts","names":[],"sources":["../../src/convert/takeRun.ts"],"mappings":";;wBAGgB,QACd,iBAAiB,iCACjB,eACA,UAAU,SAAS;EAChB,KAAK;EAAuB"}
|
|
@@ -26,7 +26,6 @@ import { GenerativeUILibrary } from "./types.js";
|
|
|
26
26
|
* is missing, or it was used outside a `"use generative"` file), so it throws
|
|
27
27
|
* rather than shipping client `render` code to the server.
|
|
28
28
|
*/
|
|
29
|
-
declare function defineGenerativeComponents(_library: GenerativeUILibrary): GenerativeUILibrary;
|
|
29
|
+
export declare function defineGenerativeComponents(_library: GenerativeUILibrary): GenerativeUILibrary;
|
|
30
30
|
//#endregion
|
|
31
|
-
export { defineGenerativeComponents };
|
|
32
31
|
//# sourceMappingURL=defineGenerativeComponents.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defineGenerativeComponents.d.ts","names":[],"sources":["../src/defineGenerativeComponents.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"defineGenerativeComponents.d.ts","names":[],"sources":["../src/defineGenerativeComponents.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA4BgB,2BACd,UAAU,sBACT"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//#region src/generativeUIToJSX.d.ts
|
|
2
2
|
/** Options for {@link generativeUIToJSX}. */
|
|
3
|
-
interface GenerativeUIToJSXOptions {
|
|
3
|
+
export interface GenerativeUIToJSXOptions {
|
|
4
4
|
/** Escape string children so the output is safe to paste back into a JSX file. Defaults to `false`. */
|
|
5
5
|
escape?: boolean;
|
|
6
6
|
/** Pretty-print nested element trees with two-space indentation. Defaults to `false`. */
|
|
@@ -15,7 +15,6 @@ interface GenerativeUIToJSXOptions {
|
|
|
15
15
|
*
|
|
16
16
|
* Pass `{ pretty: true }` to pretty-print nested element trees with two-space indentation, while pure text children stay on one line.
|
|
17
17
|
*/
|
|
18
|
-
declare function generativeUIToJSX(node: unknown, options?: GenerativeUIToJSXOptions): string;
|
|
18
|
+
export declare function generativeUIToJSX(node: unknown, options?: GenerativeUIToJSXOptions): string;
|
|
19
19
|
//#endregion
|
|
20
|
-
export { GenerativeUIToJSXOptions, generativeUIToJSX };
|
|
21
20
|
//# sourceMappingURL=generativeUIToJSX.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generativeUIToJSX.d.ts","names":[],"sources":["../src/generativeUIToJSX.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"generativeUIToJSX.d.ts","names":[],"sources":["../src/generativeUIToJSX.ts"],"mappings":";;iBAGiB;;EAEf;;EAEA;;;;;;;;;;;wBAYc,kBACd,eACA,UAAU"}
|
package/dist/ir.d.ts
CHANGED
|
@@ -15,30 +15,30 @@
|
|
|
15
15
|
* - `children` is additionally reserved (the JSX convention).
|
|
16
16
|
* - every other key is an inline prop passed straight to the component.
|
|
17
17
|
*/
|
|
18
|
-
declare const TEXT_SIZES: readonly ["sm", "md", "lg", "xl", "2xl", "3xl"];
|
|
19
|
-
type TextSize = (typeof TEXT_SIZES)[number];
|
|
20
|
-
declare const IMAGE_SIZE_TOKENS: readonly ["sm", "md", "lg"];
|
|
21
|
-
type ImageSize = (typeof IMAGE_SIZE_TOKENS)[number] | number;
|
|
22
|
-
declare const WEIGHTS: readonly ["normal", "medium", "semibold", "bold"];
|
|
23
|
-
type Weight = (typeof WEIGHTS)[number];
|
|
24
|
-
declare const COLORS: readonly ["emphasis", "secondary", "alpha-70", "white", "white-70", "white-50"];
|
|
25
|
-
type Color = (typeof COLORS)[number];
|
|
26
|
-
declare const ALIGNS: readonly ["start", "center", "end"];
|
|
27
|
-
type Align = (typeof ALIGNS)[number];
|
|
28
|
-
declare const JUSTIFIES: readonly ["start", "center", "end", "between"];
|
|
29
|
-
type Justify = (typeof JUSTIFIES)[number];
|
|
30
|
-
declare const BUTTON_STYLES: readonly ["primary", "secondary", "outline", "ghost", "danger"];
|
|
31
|
-
type ButtonStyle = (typeof BUTTON_STYLES)[number];
|
|
32
|
-
declare const ALERT_TONES: readonly ["info", "success", "warning", "danger"];
|
|
18
|
+
export declare const TEXT_SIZES: readonly ["sm", "md", "lg", "xl", "2xl", "3xl"];
|
|
19
|
+
export type TextSize = (typeof TEXT_SIZES)[number];
|
|
20
|
+
export declare const IMAGE_SIZE_TOKENS: readonly ["sm", "md", "lg"];
|
|
21
|
+
export type ImageSize = (typeof IMAGE_SIZE_TOKENS)[number] | number;
|
|
22
|
+
export declare const WEIGHTS: readonly ["normal", "medium", "semibold", "bold"];
|
|
23
|
+
export type Weight = (typeof WEIGHTS)[number];
|
|
24
|
+
export declare const COLORS: readonly ["emphasis", "secondary", "alpha-70", "white", "white-70", "white-50"];
|
|
25
|
+
export type Color = (typeof COLORS)[number];
|
|
26
|
+
export declare const ALIGNS: readonly ["start", "center", "end"];
|
|
27
|
+
export type Align = (typeof ALIGNS)[number];
|
|
28
|
+
export declare const JUSTIFIES: readonly ["start", "center", "end", "between"];
|
|
29
|
+
export type Justify = (typeof JUSTIFIES)[number];
|
|
30
|
+
export declare const BUTTON_STYLES: readonly ["primary", "secondary", "outline", "ghost", "danger"];
|
|
31
|
+
export type ButtonStyle = (typeof BUTTON_STYLES)[number];
|
|
32
|
+
export declare const ALERT_TONES: readonly ["info", "success", "warning", "danger"];
|
|
33
33
|
/** A severity level, from informational to destructive. */
|
|
34
|
-
type AlertTone = (typeof ALERT_TONES)[number];
|
|
35
|
-
declare const ICON_NAMES: readonly ["sun", "moon", "cloud", "rain", "snow", "wind", "play", "pause", "check", "x", "star", "heart", "arrow-right", "arrow-up-right", "chevron-right", "calendar", "clock", "map-pin", "plane", "truck", "credit-card", "user", "search", "bell"];
|
|
34
|
+
export type AlertTone = (typeof ALERT_TONES)[number];
|
|
35
|
+
export declare const ICON_NAMES: readonly ["sun", "moon", "cloud", "rain", "snow", "wind", "play", "pause", "check", "x", "star", "heart", "arrow-right", "arrow-up-right", "chevron-right", "calendar", "clock", "map-pin", "plane", "truck", "credit-card", "user", "search", "bell"];
|
|
36
36
|
/** A name from the built-in icon set; the closed enum lets the model see exactly which icons exist. */
|
|
37
|
-
type IconName = (typeof ICON_NAMES)[number];
|
|
37
|
+
export type IconName = (typeof ICON_NAMES)[number];
|
|
38
38
|
/**
|
|
39
39
|
* Behavior payload carried by an interactive node. `type` is resolved by the host's action registry, not the renderer; keeping behavior as data keeps the tree serializable, so the same node renders on web while converters may bind the type to a native action id on other platforms.
|
|
40
40
|
*/
|
|
41
|
-
interface Action {
|
|
41
|
+
export interface Action {
|
|
42
42
|
readonly type: string;
|
|
43
43
|
readonly [payload: string]: unknown;
|
|
44
44
|
}
|
|
@@ -48,12 +48,12 @@ interface Action {
|
|
|
48
48
|
* input boundary (numbers render as text, falsy/boolean as nothing, arrays as
|
|
49
49
|
* lists); {@link normalizeUINode} accepts that full range.
|
|
50
50
|
*/
|
|
51
|
-
type UINode = string | number | UIElement | LegacyComponentNode;
|
|
52
|
-
type UIChildren = UINode | readonly UINode[];
|
|
51
|
+
export type UINode = string | number | UIElement | LegacyComponentNode;
|
|
52
|
+
export type UIChildren = UINode | readonly UINode[];
|
|
53
53
|
/** The flat node shape: inline props keep the tree compact and natural for a
|
|
54
54
|
* model to emit, instead of a nested `{ type, props }` bag. Reserved keys are
|
|
55
55
|
* stripped before props reach the component (see the module header). */
|
|
56
|
-
interface UIElement {
|
|
56
|
+
export interface UIElement {
|
|
57
57
|
readonly $type: string;
|
|
58
58
|
readonly $key?: string | number;
|
|
59
59
|
readonly children?: UIChildren;
|
|
@@ -65,13 +65,13 @@ interface UIElement {
|
|
|
65
65
|
* for backward compatibility. New code authors the flat {@link UIElement}
|
|
66
66
|
* shape instead.
|
|
67
67
|
*/
|
|
68
|
-
interface LegacyComponentNode {
|
|
68
|
+
export interface LegacyComponentNode {
|
|
69
69
|
readonly component: string;
|
|
70
70
|
readonly props?: Record<string, unknown>;
|
|
71
71
|
readonly children?: UIChildren;
|
|
72
72
|
readonly key?: string;
|
|
73
73
|
}
|
|
74
|
-
type UISpec = UINode | readonly UINode[];
|
|
74
|
+
export type UISpec = UINode | readonly UINode[];
|
|
75
75
|
/**
|
|
76
76
|
* A node normalized to a single canonical shape: a `type` string, an inline
|
|
77
77
|
* `props` bag, recursive `children`, an optional `key`, and an optional
|
|
@@ -80,14 +80,14 @@ type UISpec = UINode | readonly UINode[];
|
|
|
80
80
|
* `component` shape, and they never see the reserved `$`-prefixed keys leak
|
|
81
81
|
* into component props.
|
|
82
82
|
*/
|
|
83
|
-
interface NormalizedUIElement {
|
|
83
|
+
export interface NormalizedUIElement {
|
|
84
84
|
readonly type: string;
|
|
85
85
|
readonly props: Readonly<Record<string, unknown>>;
|
|
86
86
|
readonly children?: NormalizedUINode | undefined;
|
|
87
87
|
readonly key?: string | number | undefined;
|
|
88
88
|
readonly action?: Action | undefined;
|
|
89
89
|
}
|
|
90
|
-
type NormalizedUINode = string | number | readonly NormalizedUINode[] | NormalizedUIElement | null;
|
|
90
|
+
export type NormalizedUINode = string | number | readonly NormalizedUINode[] | NormalizedUIElement | null;
|
|
91
91
|
/**
|
|
92
92
|
* Normalizes a generative-ui input to {@link NormalizedUINode}. The flat
|
|
93
93
|
* `$type` shape and the legacy `component` shape both map to the same canonical
|
|
@@ -102,14 +102,13 @@ type NormalizedUINode = string | number | readonly NormalizedUINode[] | Normaliz
|
|
|
102
102
|
* node is held back while completed siblings render. Omit it for a
|
|
103
103
|
* non-streaming (converter) normalize.
|
|
104
104
|
*/
|
|
105
|
-
declare function normalizeUINode(node: unknown, partialPath?: readonly string[] | undefined, depth?: number): NormalizedUINode;
|
|
105
|
+
export declare function normalizeUINode(node: unknown, partialPath?: readonly string[] | undefined, depth?: number): NormalizedUINode;
|
|
106
106
|
/**
|
|
107
107
|
* Normalizes the root of a {@link UISpec}, preserving whether the root was a
|
|
108
108
|
* single node or a list.
|
|
109
109
|
*/
|
|
110
|
-
declare function normalizeSpec(spec: UISpec): {
|
|
110
|
+
export declare function normalizeSpec(spec: UISpec): {
|
|
111
111
|
readonly root: NormalizedUINode | readonly NormalizedUINode[];
|
|
112
112
|
};
|
|
113
113
|
//#endregion
|
|
114
|
-
export { ALERT_TONES, ALIGNS, Action, AlertTone, Align, BUTTON_STYLES, ButtonStyle, COLORS, Color, ICON_NAMES, IMAGE_SIZE_TOKENS, IconName, ImageSize, JUSTIFIES, Justify, LegacyComponentNode, NormalizedUIElement, NormalizedUINode, TEXT_SIZES, TextSize, UIChildren, UIElement, UINode, UISpec, WEIGHTS, Weight, normalizeSpec, normalizeUINode };
|
|
115
114
|
//# sourceMappingURL=ir.d.ts.map
|
package/dist/ir.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ir.d.ts","names":[],"sources":["../src/ir.ts"],"mappings":";;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"ir.d.ts","names":[],"sources":["../src/ir.ts"],"mappings":";;;;;;;;;;;;;;;;;qBAmBa;YACD,mBAAmB;qBAElB;YACD,oBAAoB;qBAEnB;YACD,iBAAiB;qBAEhB;YAQD,gBAAgB;qBAEf;YACD,gBAAgB;qBAEf;YACD,kBAAkB;qBAEjB;YAOD,sBAAsB;qBAErB;;YAED,oBAAoB;qBAEnB;;YA2BD,mBAAmB;;;;iBAKd;WACN;YACC;;;;;;;;YASA,2BAA2B,YAAY;YAEvC,aAAa,kBAAkB;;;;iBAK1B;WACN;WACA;WACA,WAAW;WACX,UAAU;YACT;;;;;;;iBAQK;WACN;WACA,QAAQ;WACR,WAAW;WACX;;YAGC,SAAS,kBAAkB;;;;;;;;;iBAUtB;WACN;WACA,OAAO,SAAS;WAChB,WAAW;WACX;WACA,SAAS;;YAGR,8CAGC,qBACT;;;;;;;;;;;;;;;wBA6CY,gBACd,eACA,6CACA,iBACC;;;;;wBAuEa,cAAc,MAAM;WACzB,MAAM,4BAA4B"}
|
|
@@ -11,7 +11,6 @@ import { ReactNode } from "react";
|
|
|
11
11
|
* `render(props, context)`, with `children` rendered recursively so components
|
|
12
12
|
* can nest.
|
|
13
13
|
*/
|
|
14
|
-
declare function renderGenerativeUI(node: unknown, library: GenerativeUILibrary, context?: GenerativeUIRenderContext): ReactNode;
|
|
14
|
+
export declare function renderGenerativeUI(node: unknown, library: GenerativeUILibrary, context?: GenerativeUIRenderContext): ReactNode;
|
|
15
15
|
//#endregion
|
|
16
|
-
export { renderGenerativeUI };
|
|
17
16
|
//# sourceMappingURL=renderGenerativeUI.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderGenerativeUI.d.ts","names":[],"sources":["../src/renderGenerativeUI.tsx"],"mappings":";;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"renderGenerativeUI.d.ts","names":[],"sources":["../src/renderGenerativeUI.tsx"],"mappings":";;;;;;;;;;;;;wBAwBgB,mBACd,eACA,SAAS,qBACT,UAAS,4BACR"}
|