@kayr/umbika-web-renderer 0.0.0-stage → 0.1.0
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 +21 -0
- package/README.md +46 -2
- package/THIRD_PARTY_LICENSES.txt +20 -0
- package/dist/browser/umbika.min.css +23 -0
- package/dist/browser/umbika.min.d.mts +437 -0
- package/dist/browser/umbika.min.d.ts +437 -0
- package/dist/browser/umbika.min.js +60 -0
- package/dist/browser/umbika.min.mjs +60 -0
- package/dist/casconda.d.ts +2 -0
- package/dist/casconda.d.ts.map +1 -0
- package/dist/contracts.d.ts +165 -0
- package/dist/contracts.d.ts.map +1 -0
- package/dist/dom-identity.d.ts +17 -0
- package/dist/dom-identity.d.ts.map +1 -0
- package/dist/field-presentation.d.ts +26 -0
- package/dist/field-presentation.d.ts.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/layout.d.ts +25 -0
- package/dist/layout.d.ts.map +1 -0
- package/dist/mount.d.ts +14 -0
- package/dist/mount.d.ts.map +1 -0
- package/dist/render-nodes.d.ts +18 -0
- package/dist/render-nodes.d.ts.map +1 -0
- package/dist/renderers/multi-select.d.ts +18 -0
- package/dist/renderers/multi-select.d.ts.map +1 -0
- package/dist/renderers/object.d.ts +6 -0
- package/dist/renderers/object.d.ts.map +1 -0
- package/dist/renderers/output.d.ts +6 -0
- package/dist/renderers/output.d.ts.map +1 -0
- package/dist/renderers/select.d.ts +6 -0
- package/dist/renderers/select.d.ts.map +1 -0
- package/dist/renderers/table.d.ts +6 -0
- package/dist/renderers/table.d.ts.map +1 -0
- package/dist/renderers/text.d.ts +8 -0
- package/dist/renderers/text.d.ts.map +1 -0
- package/dist/row-details.d.ts +89 -0
- package/dist/row-details.d.ts.map +1 -0
- package/dist/standalone/contracts.d.ts +77 -0
- package/dist/standalone/contracts.d.ts.map +1 -0
- package/dist/standalone/index.d.ts +7 -0
- package/dist/standalone/index.d.ts.map +1 -0
- package/dist/standalone/mount.d.ts +9 -0
- package/dist/standalone/mount.d.ts.map +1 -0
- package/dist/summary.d.ts +29 -0
- package/dist/summary.d.ts.map +1 -0
- package/dist/tags.d.ts +32 -0
- package/dist/tags.d.ts.map +1 -0
- package/package.json +78 -4
- package/src/casconda.js +10 -0
- package/src/contracts.js +79 -0
- package/src/dom-identity.js +31 -0
- package/src/field-presentation.js +71 -0
- package/src/index.js +9 -0
- package/src/layout.js +176 -0
- package/src/mount.js +569 -0
- package/src/render-nodes.js +77 -0
- package/src/renderers/multi-select.js +211 -0
- package/src/renderers/object.js +43 -0
- package/src/renderers/output.js +87 -0
- package/src/renderers/select.js +104 -0
- package/src/renderers/table.js +344 -0
- package/src/renderers/text.js +82 -0
- package/src/row-details.js +305 -0
- package/src/standalone/contracts.js +22 -0
- package/src/standalone/index.js +5 -0
- package/src/standalone/mount.js +128 -0
- package/src/summary.js +135 -0
- package/src/tags.js +69 -0
- package/styles/base.css +432 -0
- package/styles/standalone.css +2 -0
- package/styles/themes/default.css +99 -0
- package/vendor/LICENSE +21 -0
- package/vendor/README.md +33 -0
- package/vendor/casconda.min.d.mts +340 -0
- package/vendor/casconda.min.d.ts +340 -0
- package/vendor/casconda.min.mjs +1 -0
package/dist/mount.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type FieldPlan = Readonly<{
|
|
2
|
+
node: import("@kayr/umbika-core").ActiveFieldNode;
|
|
3
|
+
frames: readonly import("./contracts.js").WorkspaceFrame[];
|
|
4
|
+
}>;
|
|
5
|
+
/** @typedef {Readonly<{node: import("@kayr/umbika-core").ActiveFieldNode, frames: readonly import("./contracts.js").WorkspaceFrame[]}>} FieldPlan */
|
|
6
|
+
/**
|
|
7
|
+
* Mount the production complete-form browser renderer.
|
|
8
|
+
*
|
|
9
|
+
* @param {Element} target
|
|
10
|
+
* @param {import("./contracts.js").MountWebFormOptions} options
|
|
11
|
+
* @returns {import("./contracts.js").MountedWebForm}
|
|
12
|
+
*/
|
|
13
|
+
export declare function mountWebForm(target: Element, options: import("./contracts.js").MountWebFormOptions): import("./contracts.js").MountedWebForm;
|
|
14
|
+
//# sourceMappingURL=mount.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mount.d.ts","sourceRoot":"","sources":["../src/mount.js"],"names":[],"mappings":"AAaI,YAAqI,SAAS,GAApI,QAAQ,CAAC;IAAC,IAAI,EAAE,OAAO,mBAAmB,EAAE,eAAe,CAAC;IAAC,MAAM,EAAE,SAAS,OAAO,gBAAgB,EAAE,cAAc,EAAE,CAAA;CAAC,CAAC,CAAW;AAAlJ,qJAAqJ;AAErJ;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAJxB,OAIwB,EAAE,OAAO,EAHjC,OAAO,gBAAgB,EAAE,mBAGQ,GAF/B,OAAO,gBAAgB,EAAE,cAAc,CAkanD"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keep each path's presentation resource while its control kind stays the
|
|
3
|
+
* same. Switching between an input and an output retires the old resource.
|
|
4
|
+
*
|
|
5
|
+
* @param {import("./contracts.js").ResourceListSource<import("@kayr/umbika-core").ActiveFieldNode>} nodes
|
|
6
|
+
* @param {import("./contracts.js").NodeRendererContext} context
|
|
7
|
+
* @param {readonly string[]} [definitionPath]
|
|
8
|
+
*/
|
|
9
|
+
export declare function _renderNodeResources(nodes: import("./contracts.js").ResourceListSource<import("@kayr/umbika-core").ActiveFieldNode>, context: import("./contracts.js").NodeRendererContext, definitionPath?: readonly string[]): any[];
|
|
10
|
+
/**
|
|
11
|
+
* Explicitly dispatch one public engine node without a renderer registry or
|
|
12
|
+
* transformed view type.
|
|
13
|
+
*
|
|
14
|
+
* @param {import("./contracts.js").KeyedItemResource<import("@kayr/umbika-core").ActiveFieldNode>} resource
|
|
15
|
+
* @param {import("./contracts.js").NodeRendererContext} context
|
|
16
|
+
*/
|
|
17
|
+
export declare function _renderNode(resource: import("./contracts.js").KeyedItemResource<import("@kayr/umbika-core").ActiveFieldNode>, context: import("./contracts.js").NodeRendererContext): void | "" | any[];
|
|
18
|
+
//# sourceMappingURL=render-nodes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-nodes.d.ts","sourceRoot":"","sources":["../src/render-nodes.js"],"names":[],"mappings":"AASA;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAJ/B,OAAO,gBAAgB,EAAE,kBAAkB,CAAC,OAAO,mBAAmB,EAAE,eAAe,CAIxD,EAAE,OAAO,EAHxC,OAAO,gBAAgB,EAAE,mBAGe,EAAE,cAAc,AAFhE,CAA2C,EAAnC,SAAS,MAAM,EAE8C,SAoBvE;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAHzB,OAAO,gBAAgB,EAAE,iBAAiB,CAAC,OAAO,mBAAmB,EAAE,eAAe,CAG7D,EAAE,OAAO,EAFlC,OAAO,gBAAgB,EAAE,mBAES,qBAqB5C"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type MultiSelectChoice = Readonly<{
|
|
2
|
+
value: string;
|
|
3
|
+
label: string;
|
|
4
|
+
unavailable: boolean;
|
|
5
|
+
}>;
|
|
6
|
+
/**
|
|
7
|
+
* @typedef {Readonly<{
|
|
8
|
+
* value: string;
|
|
9
|
+
* label: string;
|
|
10
|
+
* unavailable: boolean;
|
|
11
|
+
* }>} MultiSelectChoice
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* @param {import("../contracts.js").KeyedItemResource<import("@kayr/umbika-core").ActiveFieldNode>} resource
|
|
15
|
+
* @param {import("../contracts.js").NodeRendererContext} context
|
|
16
|
+
*/
|
|
17
|
+
export declare function _renderMultiSelectField(resource: import("../contracts.js").KeyedItemResource<import("@kayr/umbika-core").ActiveFieldNode>, context: import("../contracts.js").NodeRendererContext): "" | any[];
|
|
18
|
+
//# sourceMappingURL=multi-select.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multi-select.d.ts","sourceRoot":"","sources":["../../src/renderers/multi-select.js"],"names":[],"mappings":"AASG,YAII,iBAAiB,GAJX,QAAQ,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,OAAO,CAAC;CACtB,CAAC,CAAmB;AALxB;;;;;;GAMG;AAEH;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAHrC,OAAO,iBAAiB,EAAE,iBAAiB,CAAC,OAAO,mBAAmB,EAAE,eAAe,CAGlD,EAAE,OAAO,EAF9C,OAAO,iBAAiB,EAAE,mBAEoB,cA0FxD"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {import("../contracts.js").KeyedItemResource<import("@kayr/umbika-core").ActiveFieldNode>} resource
|
|
3
|
+
* @param {import("../contracts.js").NodeRendererContext} context
|
|
4
|
+
*/
|
|
5
|
+
export declare function _renderObjectField(resource: import("../contracts.js").KeyedItemResource<import("@kayr/umbika-core").ActiveFieldNode>, context: import("../contracts.js").NodeRendererContext): "" | any[];
|
|
6
|
+
//# sourceMappingURL=object.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"object.d.ts","sourceRoot":"","sources":["../../src/renderers/object.js"],"names":[],"mappings":"AAKA;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAHhC,OAAO,iBAAiB,EAAE,iBAAiB,CAAC,OAAO,mBAAmB,EAAE,eAAe,CAGvD,EAAE,OAAO,EAFzC,OAAO,iBAAiB,EAAE,mBAEe,cAiCnD"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {import("../contracts.js").KeyedItemResource<import("@kayr/umbika-core").ActiveFieldNode>} resource
|
|
3
|
+
* @param {import("../contracts.js").NodeRendererContext} context
|
|
4
|
+
*/
|
|
5
|
+
export declare function _renderFieldOutput(resource: import("../contracts.js").KeyedItemResource<import("@kayr/umbika-core").ActiveFieldNode>, context: import("../contracts.js").NodeRendererContext): "" | any[];
|
|
6
|
+
//# sourceMappingURL=output.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/renderers/output.js"],"names":[],"mappings":"AAQA;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAHhC,OAAO,iBAAiB,EAAE,iBAAiB,CAAC,OAAO,mBAAmB,EAAE,eAAe,CAGvD,EAAE,OAAO,EAFzC,OAAO,iBAAiB,EAAE,mBAEe,cA8CnD"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {import("../contracts.js").KeyedItemResource<import("@kayr/umbika-core").ActiveFieldNode>} resource
|
|
3
|
+
* @param {import("../contracts.js").NodeRendererContext} context
|
|
4
|
+
*/
|
|
5
|
+
export declare function _renderSelectField(resource: import("../contracts.js").KeyedItemResource<import("@kayr/umbika-core").ActiveFieldNode>, context: import("../contracts.js").NodeRendererContext): "" | any[];
|
|
6
|
+
//# sourceMappingURL=select.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../src/renderers/select.js"],"names":[],"mappings":"AAOA;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAHhC,OAAO,iBAAiB,EAAE,iBAAiB,CAAC,OAAO,mBAAmB,EAAE,eAAe,CAGvD,EAAE,OAAO,EAFzC,OAAO,iBAAiB,EAAE,mBAEe,cAuFnD"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {import("../contracts.js").KeyedItemResource<import("@kayr/umbika-core").ActiveFieldNode>} resource
|
|
3
|
+
* @param {import("../contracts.js").NodeRendererContext} context
|
|
4
|
+
*/
|
|
5
|
+
export declare function _renderTableField(resource: import("../contracts.js").KeyedItemResource<import("@kayr/umbika-core").ActiveFieldNode>, context: import("../contracts.js").NodeRendererContext): "" | any[];
|
|
6
|
+
//# sourceMappingURL=table.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../src/renderers/table.js"],"names":[],"mappings":"AA2BA;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAH/B,OAAO,iBAAiB,EAAE,iBAAiB,CAAC,OAAO,mBAAmB,EAAE,eAAe,CAGxD,EAAE,OAAO,EAFxC,OAAO,iBAAiB,EAAE,mBAEc,cA2FlD"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {import("../contracts.js").KeyedItemResource<import("@kayr/umbika-core").ActiveFieldNode>} resource
|
|
3
|
+
* @param {import("../contracts.js").NodeRendererContext} context
|
|
4
|
+
*/
|
|
5
|
+
export declare function _renderTextField(resource: import("../contracts.js").KeyedItemResource<import("@kayr/umbika-core").ActiveFieldNode>, context: import("../contracts.js").NodeRendererContext): "" | any[];
|
|
6
|
+
/** @param {unknown} value */
|
|
7
|
+
export declare function _textDisplayValue(value: unknown): string;
|
|
8
|
+
//# sourceMappingURL=text.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../src/renderers/text.js"],"names":[],"mappings":"AAOA;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAH9B,OAAO,iBAAiB,EAAE,iBAAiB,CAAC,OAAO,mBAAmB,EAAE,eAAe,CAGzD,EAAE,OAAO,EAFvC,OAAO,iBAAiB,EAAE,mBAEa,cAiEjD;AAED,6BAA6B;AAC7B,wBAAgB,iBAAiB,CAAC,KAAK,EAD3B,OAC2B,UAEtC"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
export type ResolvedRowDetail = Readonly<{
|
|
2
|
+
row: import("@kayr/umbika-core").ActiveTableRow;
|
|
3
|
+
definitionPath: readonly string[];
|
|
4
|
+
parentRowPath: import("@kayr/umbika-core").FieldPath | undefined;
|
|
5
|
+
table: import("@kayr/umbika-core").ActiveTableField;
|
|
6
|
+
tableName: string;
|
|
7
|
+
}>;
|
|
8
|
+
export type WorkspaceDetail = Readonly<{
|
|
9
|
+
detail: ResolvedRowDetail;
|
|
10
|
+
frame: import("./contracts.js").WorkspaceFrame;
|
|
11
|
+
depth: number;
|
|
12
|
+
}>;
|
|
13
|
+
/**
|
|
14
|
+
* @typedef {Readonly<{
|
|
15
|
+
* row: import("@kayr/umbika-core").ActiveTableRow;
|
|
16
|
+
* definitionPath: readonly string[];
|
|
17
|
+
* parentRowPath: import("@kayr/umbika-core").FieldPath | undefined;
|
|
18
|
+
* table: import("@kayr/umbika-core").ActiveTableField;
|
|
19
|
+
* tableName: string;
|
|
20
|
+
* }>} ResolvedRowDetail
|
|
21
|
+
*/
|
|
22
|
+
/** @typedef {Readonly<{detail: ResolvedRowDetail, frame: import("./contracts.js").WorkspaceFrame, depth: number}>} WorkspaceDetail */
|
|
23
|
+
/**
|
|
24
|
+
* @param {readonly import("@kayr/umbika-core").ActiveFieldNode[]} nodes
|
|
25
|
+
* @param {readonly string[]} rowPath
|
|
26
|
+
* @returns {ResolvedRowDetail | undefined}
|
|
27
|
+
*/
|
|
28
|
+
export declare function _resolveRowDetail(nodes: readonly import("@kayr/umbika-core").ActiveFieldNode[], rowPath: readonly string[]): ResolvedRowDetail | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* @param {readonly import("@kayr/umbika-core").ActiveFieldNode[]} nodes
|
|
31
|
+
* @param {import("./contracts.js").WorkspaceState | null} workspace
|
|
32
|
+
*/
|
|
33
|
+
export declare function _reconcileWorkspace(nodes: readonly import("@kayr/umbika-core").ActiveFieldNode[], workspace: import("./contracts.js").WorkspaceState | null): Readonly<{
|
|
34
|
+
frames: readonly Readonly<{
|
|
35
|
+
rowPath: import("@kayr/umbika-core").FieldPath;
|
|
36
|
+
definitionPath: readonly string[];
|
|
37
|
+
openedBy: string;
|
|
38
|
+
origin: "new" | "existing";
|
|
39
|
+
}>[];
|
|
40
|
+
}> | null;
|
|
41
|
+
/**
|
|
42
|
+
* Derive workspace language from the current active tree. Frames remain paths
|
|
43
|
+
* and origins only, so refresh always observes current labels and summaries.
|
|
44
|
+
*
|
|
45
|
+
* @param {readonly import("@kayr/umbika-core").ActiveFieldNode[]} nodes
|
|
46
|
+
* @param {import("./contracts.js").WorkspaceState | null} workspace
|
|
47
|
+
* @param {import("./contracts.js").OwnedWebFormLayout} layout
|
|
48
|
+
*/
|
|
49
|
+
export declare function _workspacePresentation(nodes: readonly import("@kayr/umbika-core").ActiveFieldNode[], workspace: import("./contracts.js").WorkspaceState | null, layout: import("./contracts.js").OwnedWebFormLayout): Readonly<{
|
|
50
|
+
current: Readonly<{
|
|
51
|
+
detail: Readonly<{
|
|
52
|
+
row: import("@kayr/umbika-core").ActiveTableRow;
|
|
53
|
+
definitionPath: readonly string[];
|
|
54
|
+
parentRowPath: import("@kayr/umbika-core").FieldPath | undefined;
|
|
55
|
+
table: import("@kayr/umbika-core").ActiveTableField;
|
|
56
|
+
tableName: string;
|
|
57
|
+
}>;
|
|
58
|
+
frame: Readonly<{
|
|
59
|
+
rowPath: import("@kayr/umbika-core").FieldPath;
|
|
60
|
+
definitionPath: readonly string[];
|
|
61
|
+
openedBy: string;
|
|
62
|
+
origin: "new" | "existing";
|
|
63
|
+
}>;
|
|
64
|
+
primary: {
|
|
65
|
+
available: boolean;
|
|
66
|
+
display: string;
|
|
67
|
+
};
|
|
68
|
+
name: string;
|
|
69
|
+
}>;
|
|
70
|
+
depth: number;
|
|
71
|
+
title: `Add row to ${string}` | `Edit ${string}`;
|
|
72
|
+
trail: readonly string[];
|
|
73
|
+
secondary: "back" | "cancel" | "close";
|
|
74
|
+
}> | null;
|
|
75
|
+
/**
|
|
76
|
+
* @param {ReturnType<typeof import("./casconda.js").ref>} workspace
|
|
77
|
+
* @param {ReturnType<typeof import("./casconda.js").ref>} activeFields
|
|
78
|
+
* @param {import("./contracts.js").NodeRendererContext} context
|
|
79
|
+
* @param {Readonly<{close: () => void, back: () => void, add: () => void, cancel: () => void, remove: () => void, escape: () => void}>} actions
|
|
80
|
+
*/
|
|
81
|
+
export declare function _renderRowDetails(workspace: ReturnType<typeof import("./casconda.js").ref>, activeFields: ReturnType<typeof import("./casconda.js").ref>, context: import("./contracts.js").NodeRendererContext, actions: Readonly<{
|
|
82
|
+
close: () => void;
|
|
83
|
+
back: () => void;
|
|
84
|
+
add: () => void;
|
|
85
|
+
cancel: () => void;
|
|
86
|
+
remove: () => void;
|
|
87
|
+
escape: () => void;
|
|
88
|
+
}>): any[];
|
|
89
|
+
//# sourceMappingURL=row-details.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"row-details.d.ts","sourceRoot":"","sources":["../src/row-details.js"],"names":[],"mappings":"AAOG,YAMI,iBAAiB,GANX,QAAQ,CAAC;IACjB,GAAG,EAAE,OAAO,mBAAmB,EAAE,cAAc,CAAC;IAChD,cAAc,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,aAAa,EAAE,OAAO,mBAAmB,EAAE,SAAS,GAAG,SAAS,CAAC;IACjE,KAAK,EAAE,OAAO,mBAAmB,EAAE,gBAAgB,CAAC;IACpD,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC,CAAmB;AAEpB,YAAgH,eAAe,GAArH,QAAQ,CAAC;IAAC,MAAM,EAAE,iBAAiB,CAAC;IAAC,KAAK,EAAE,OAAO,gBAAgB,EAAE,cAAc,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAC,CAAC,CAAiB;AATnI;;;;;;;;GAQG;AACH,sIAAsI;AAEtI;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAJ5B,SAAS,OAAO,mBAAmB,EAAE,eAAe,EAIxB,EAAE,OAAO,EAHrC,SAAS,MAAM,EAGsB,GAFnC,iBAAiB,GAAG,SAAS,CAIzC;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAH9B,SAAS,OAAO,mBAAmB,EAAE,eAAe,EAGtB,EAAE,SAAS,EAFzC,OAAO,gBAAgB,EAAE,cAAc,GAAG,IAED;;;;;;;UAUnD;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAJjC,SAAS,OAAO,mBAAmB,EAAE,eAAe,EAInB,EAAE,SAAS,EAH5C,OAAO,gBAAgB,EAAE,cAAc,GAAG,IAGE,EAAE,MAAM,EAFpD,OAAO,gBAAgB,EAAE,kBAE2B;;;iBA1CrD,OAAO,mBAAmB,EAAE,cAAc;4BAC/B,SAAS,MAAM,EAAE;2BAClB,OAAO,mBAAmB,EAAE,SAAS,GAAG,SAAS;mBACzD,OAAO,mBAAmB,EAAE,gBAAgB;uBACxC,MAAM;;;;;;;;;;;;;;;;;;UA0ErB;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EALhC,UAAU,CAAC,cAAc,eAAe,EAAE,GAAG,CAKb,EAAE,YAAY,EAJ9C,UAAU,CAAC,cAAc,eAAe,EAAE,GAAG,CAIC,EAAE,OAAO,EAHvD,OAAO,gBAAgB,EAAE,mBAG8B,EAAE,OAAO,EAFhE,QAAQ,CAAC;IAAC,KAAK,EAAE,MAAM,IAAI,CAAC;IAAC,IAAI,EAAE,MAAM,IAAI,CAAC;IAAC,GAAG,EAAE,MAAM,IAAI,CAAC;IAAC,MAAM,EAAE,MAAM,IAAI,CAAC;IAAC,MAAM,EAAE,MAAM,IAAI,CAAC;IAAC,MAAM,EAAE,MAAM,IAAI,CAAA;CAAC,CAE3D,SAyJ1E"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {object} StandaloneMountOptions
|
|
3
|
+
* @property {string} source Authored version-1 form source.
|
|
4
|
+
* @property {import("@kayr/umbika-core").FormVars} [vars] Immutable supporting values.
|
|
5
|
+
* @property {import("@kayr/umbika-core").FormValues} [data] Initial answer data.
|
|
6
|
+
* @property {string} [instanceId] Host-supplied renderer identity prefix.
|
|
7
|
+
* @property {import("../index.js").WebFormLayout} [layout] Renderer-owned repeat presentation.
|
|
8
|
+
* @property {string} [theme] Renderer-owned root theme name.
|
|
9
|
+
* @property {(submission: Record<string, unknown>) => void} [onSubmit] Receives valid projected submission data.
|
|
10
|
+
* @property {string} [submitLabel] Non-empty native submit-button label.
|
|
11
|
+
*/
|
|
12
|
+
export type StandaloneMountOptions = {
|
|
13
|
+
/**
|
|
14
|
+
* Authored version-1 form source.
|
|
15
|
+
*/
|
|
16
|
+
source: string;
|
|
17
|
+
/**
|
|
18
|
+
* Immutable supporting values.
|
|
19
|
+
*/
|
|
20
|
+
vars?: import("@kayr/umbika-core").FormVars;
|
|
21
|
+
/**
|
|
22
|
+
* Initial answer data.
|
|
23
|
+
*/
|
|
24
|
+
data?: import("@kayr/umbika-core").FormValues;
|
|
25
|
+
/**
|
|
26
|
+
* Host-supplied renderer identity prefix.
|
|
27
|
+
*/
|
|
28
|
+
instanceId?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Renderer-owned repeat presentation.
|
|
31
|
+
*/
|
|
32
|
+
layout?: import("../index.js").WebFormLayout;
|
|
33
|
+
/**
|
|
34
|
+
* Renderer-owned root theme name.
|
|
35
|
+
*/
|
|
36
|
+
theme?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Receives valid projected submission data.
|
|
39
|
+
*/
|
|
40
|
+
onSubmit?: (submission: Record<string, unknown>) => void;
|
|
41
|
+
/**
|
|
42
|
+
* Non-empty native submit-button label.
|
|
43
|
+
*/
|
|
44
|
+
submitLabel?: string;
|
|
45
|
+
};
|
|
46
|
+
export type MountedStandaloneWebForm = {
|
|
47
|
+
/**
|
|
48
|
+
* Ordinary form-engine instance.
|
|
49
|
+
*/
|
|
50
|
+
form: import("@kayr/umbika-core").Form;
|
|
51
|
+
/**
|
|
52
|
+
* Renderer-owned form root.
|
|
53
|
+
*/
|
|
54
|
+
root: HTMLFormElement;
|
|
55
|
+
/**
|
|
56
|
+
* Publish current engine state to the renderer.
|
|
57
|
+
*/
|
|
58
|
+
refresh: () => void;
|
|
59
|
+
/**
|
|
60
|
+
* Focus an active editable field.
|
|
61
|
+
*/
|
|
62
|
+
focus: (path: import("@kayr/umbika-core").FieldPath) => boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Release presentation resources. Repeated calls do nothing.
|
|
65
|
+
*/
|
|
66
|
+
dispose: () => void;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* @typedef {object} MountedStandaloneWebForm
|
|
70
|
+
* @property {import("@kayr/umbika-core").Form} form Ordinary form-engine instance.
|
|
71
|
+
* @property {HTMLFormElement} root Renderer-owned form root.
|
|
72
|
+
* @property {() => void} refresh Publish current engine state to the renderer.
|
|
73
|
+
* @property {(path: import("@kayr/umbika-core").FieldPath) => boolean} focus Focus an active editable field.
|
|
74
|
+
* @property {() => void} dispose Release presentation resources. Repeated calls do nothing.
|
|
75
|
+
*/
|
|
76
|
+
export {};
|
|
77
|
+
//# sourceMappingURL=contracts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../src/standalone/contracts.js"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AATA,YAAkB,sBAAsB,GACxC;;;;IAAmB,MAAM,EAAd,MAAM,CACjB;;;;IAAkD,IAAI,AAAtD,CACA,EADW,OAAO,mBAAmB,EAAE,QAAQ,CAC/C;;;;IAAoD,IAAI,AAAxD,CACA,EADW,OAAO,mBAAmB,EAAE,UAAU,CACjD;;;;IAAoB,UAAU,AAA9B,CACA,EADW,MAAM,CACjB;;;;IAAiD,MAAM,AAAvD,CACA,EADW,OAAO,aAAa,EAAE,aAAa,CAC9C;;;;IAAoB,KAAK,AAAzB,CACA,EADW,MAAM,CACjB;;;;IAA2D,QAAQ,AAAnE,CACA,EADW,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CACxD;;;;IAAoB,WAAW,AAA/B,CACF,EADa,MAAM,CACnB;CAAA,CAAA;AAGE,YAAkB,wBAAwB,GAC1C;;;;IAA6C,IAAI,EAAtC,OAAO,mBAAmB,EAAE,IAAI,CAC3C;;;;IAA4B,IAAI,EAArB,eAAe,CAC1B;;;;IAAuB,OAAO,EAAnB,MAAM,IAAI,CACrB;;;;IAAqE,KAAK,EAA/D,CAAC,IAAI,EAAE,OAAO,mBAAmB,EAAE,SAAS,KAAK,OAAO,CACnE;;;;IAAuB,OAAO,EAAnB,MAAM,IAAI,CACvB;CAAA,CAAA;AAPD;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { FormLanguageError } from "@kayr/umbika-core/language";
|
|
2
|
+
export { mount } from "./mount.js";
|
|
3
|
+
export type MountedStandaloneWebForm = import("./contracts.js").MountedStandaloneWebForm;
|
|
4
|
+
export type StandaloneMountOptions = import("./contracts.js").StandaloneMountOptions;
|
|
5
|
+
/** @typedef {import("./contracts.js").MountedStandaloneWebForm} MountedStandaloneWebForm */
|
|
6
|
+
/** @typedef {import("./contracts.js").StandaloneMountOptions} StandaloneMountOptions */
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/standalone/index.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAE/B,YAA6D,wBAAwB,GAA3E,OAAO,gBAAgB,EAAE,wBAAwB,CAA0B;AACrF,YAA2D,sBAAsB,GAAvE,OAAO,gBAAgB,EAAE,sBAAsB,CAAwB;AADrF,4FAA4F;AAC5F,wFAAwF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compile authored source and mount the complete browser form.
|
|
3
|
+
*
|
|
4
|
+
* @param {string | HTMLElement} target
|
|
5
|
+
* @param {import("./contracts.js").StandaloneMountOptions} options
|
|
6
|
+
* @returns {import("./contracts.js").MountedStandaloneWebForm}
|
|
7
|
+
*/
|
|
8
|
+
export declare function mount(target: string | HTMLElement, options: import("./contracts.js").StandaloneMountOptions): import("./contracts.js").MountedStandaloneWebForm;
|
|
9
|
+
//# sourceMappingURL=mount.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mount.d.ts","sourceRoot":"","sources":["../../src/standalone/mount.js"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,wBAAgB,KAAK,CAAC,MAAM,EAJjB,MAAM,GAAG,WAIQ,EAAE,OAAO,EAH1B,OAAO,gBAAgB,EAAE,sBAGC,GAFxB,OAAO,gBAAgB,EAAE,wBAAwB,CAgD7D"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** @param {readonly import("@kayr/umbika-core").ActiveFieldNode[]} nodes */
|
|
2
|
+
export declare function _visibleErrorCount(nodes: readonly import("@kayr/umbika-core").ActiveFieldNode[]): number;
|
|
3
|
+
/**
|
|
4
|
+
* @param {readonly import("@kayr/umbika-core").ActiveTableRow[]} rows
|
|
5
|
+
* @param {readonly import("./contracts.js").OwnedWebTableColumnLayout[] | undefined} configured
|
|
6
|
+
*/
|
|
7
|
+
export declare function _summaryColumns(rows: readonly import("@kayr/umbika-core").ActiveTableRow[], configured: readonly import("./contracts.js").OwnedWebTableColumnLayout[] | undefined): readonly Readonly<{
|
|
8
|
+
key: string;
|
|
9
|
+
path: readonly string[];
|
|
10
|
+
label: string;
|
|
11
|
+
align: import("./contracts.js").WebTableColumnAlignment;
|
|
12
|
+
}>[];
|
|
13
|
+
/**
|
|
14
|
+
* @param {import("@kayr/umbika-core").ActiveTableRow} row
|
|
15
|
+
* @param {readonly string[]} relativePath
|
|
16
|
+
*/
|
|
17
|
+
export declare function _summaryValueAt(row: import("@kayr/umbika-core").ActiveTableRow, relativePath: readonly string[]): {
|
|
18
|
+
available: boolean;
|
|
19
|
+
display: string;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* @param {import("@kayr/umbika-core").ActiveTableRow} row
|
|
23
|
+
* @param {readonly import("./contracts.js").OwnedWebTableColumnLayout[]} columns
|
|
24
|
+
*/
|
|
25
|
+
export declare function _primarySummaryValue(row: import("@kayr/umbika-core").ActiveTableRow, columns: readonly import("./contracts.js").OwnedWebTableColumnLayout[]): {
|
|
26
|
+
available: boolean;
|
|
27
|
+
display: string;
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=summary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"summary.d.ts","sourceRoot":"","sources":["../src/summary.js"],"names":[],"mappings":"AAEA,4EAA4E;AAC5E,wBAAgB,kBAAkB,CAAC,KAAK,EAD5B,SAAS,OAAO,mBAAmB,EAAE,eAAe,EACxB,UAWvC;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAHzB,SAAS,OAAO,mBAAmB,EAAE,cAAc,EAG1B,EAAE,UAAU,EAFrC,SAAS,OAAO,gBAAgB,EAAE,yBAAyB,EAAE,GAAG,SAE3B;;;;;KAW/C;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAHxB,OAAO,mBAAmB,EAAE,cAGJ,EAAE,YAAY,EAFtC,SAAS,MAAM,EAEuB;;;EAMhD;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAH7B,OAAO,mBAAmB,EAAE,cAGC,EAAE,OAAO,EAFtC,SAAS,OAAO,gBAAgB,EAAE,yBAAyB,EAErB;;;EAMhD"}
|
package/dist/tags.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export type TagFactory = (...children: any[]) => any[];
|
|
2
|
+
export type DirectRendererTags = {
|
|
3
|
+
article: TagFactory;
|
|
4
|
+
button: TagFactory;
|
|
5
|
+
caption: TagFactory;
|
|
6
|
+
dialog: TagFactory;
|
|
7
|
+
div: TagFactory;
|
|
8
|
+
fieldset: TagFactory;
|
|
9
|
+
foreach: TagFactory;
|
|
10
|
+
form: TagFactory;
|
|
11
|
+
frag: TagFactory;
|
|
12
|
+
h2: TagFactory;
|
|
13
|
+
h3: TagFactory;
|
|
14
|
+
input: TagFactory;
|
|
15
|
+
label: TagFactory;
|
|
16
|
+
legend: TagFactory;
|
|
17
|
+
li: TagFactory;
|
|
18
|
+
option: TagFactory;
|
|
19
|
+
output: TagFactory;
|
|
20
|
+
p: TagFactory;
|
|
21
|
+
section: TagFactory;
|
|
22
|
+
select: TagFactory;
|
|
23
|
+
ul: TagFactory;
|
|
24
|
+
table: TagFactory;
|
|
25
|
+
tbody: TagFactory;
|
|
26
|
+
td: TagFactory;
|
|
27
|
+
th: TagFactory;
|
|
28
|
+
thead: TagFactory;
|
|
29
|
+
tr: TagFactory;
|
|
30
|
+
};
|
|
31
|
+
export declare const article: TagFactory, button: TagFactory, caption: TagFactory, dialog: TagFactory, div: TagFactory, fieldset: TagFactory, foreach: TagFactory, form: TagFactory, frag: TagFactory, h2: TagFactory, h3: TagFactory, input: TagFactory, label: TagFactory, legend: TagFactory, li: TagFactory, option: TagFactory, output: TagFactory, p: TagFactory, section: TagFactory, select: TagFactory, ul: TagFactory, table: TagFactory, tbody: TagFactory, td: TagFactory, th: TagFactory, thead: TagFactory, tr: TagFactory;
|
|
32
|
+
//# sourceMappingURL=tags.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tags.d.ts","sourceRoot":"","sources":["../src/tags.js"],"names":[],"mappings":"AAEI,YAAyC,UAAU,GAAzC,CAAC,GAAG,QAAQ,EAAE,GAAG,EAAE,KAAK,GAAG,EAAE,CAAY;AAKpD,YAAkB,kBAAkB,GACpC;IAAuB,OAAO,EAAnB,UAAU,CACrB;IAAuB,MAAM,EAAlB,UAAU,CACrB;IAAuB,OAAO,EAAnB,UAAU,CACrB;IAAuB,MAAM,EAAlB,UAAU,CACrB;IAAuB,GAAG,EAAf,UAAU,CACrB;IAAuB,QAAQ,EAApB,UAAU,CACrB;IAAuB,OAAO,EAAnB,UAAU,CACrB;IAAuB,IAAI,EAAhB,UAAU,CACrB;IAAuB,IAAI,EAAhB,UAAU,CACrB;IAAuB,EAAE,EAAd,UAAU,CACrB;IAAuB,EAAE,EAAd,UAAU,CACrB;IAAuB,KAAK,EAAjB,UAAU,CACrB;IAAuB,KAAK,EAAjB,UAAU,CACrB;IAAuB,MAAM,EAAlB,UAAU,CACrB;IAAuB,EAAE,EAAd,UAAU,CACrB;IAAuB,MAAM,EAAlB,UAAU,CACrB;IAAuB,MAAM,EAAlB,UAAU,CACrB;IAAuB,CAAC,EAAb,UAAU,CACrB;IAAuB,OAAO,EAAnB,UAAU,CACrB;IAAuB,MAAM,EAAlB,UAAU,CACrB;IAAuB,EAAE,EAAd,UAAU,CACrB;IAAuB,KAAK,EAAjB,UAAU,CACrB;IAAuB,KAAK,EAAjB,UAAU,CACrB;IAAuB,EAAE,EAAd,UAAU,CACrB;IAAuB,EAAE,EAAd,UAAU,CACrB;IAAuB,KAAK,EAAjB,UAAU,CACrB;IAAuB,EAAE,EAAd,UAAU,CACvB;CAAA,CAAA;AAKD,eAAO,MACL,OAAO,cACP,MAAM,cACN,OAAO,cACP,MAAM,cACN,GAAG,cACH,QAAQ,cACR,OAAO,cACP,IAAI,cACJ,IAAI,cACJ,EAAE,cACF,EAAE,cACF,KAAK,cACL,KAAK,cACL,MAAM,cACN,EAAE,cACF,MAAM,cACN,MAAM,cACN,CAAC,cACD,OAAO,cACP,MAAM,cACN,EAAE,cACF,KAAK,cACL,KAAK,cACL,EAAE,cACF,EAAE,cACF,KAAK,cACL,EAAE,YACK,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,80 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kayr/umbika-web-renderer",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Complete-form browser renderer for @kayr/umbika-core.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"publishConfig": {
|
|
7
|
+
"access": "public"
|
|
8
|
+
},
|
|
9
|
+
"type": "module",
|
|
10
|
+
"main": "./src/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"import": "./src/index.js"
|
|
16
|
+
},
|
|
17
|
+
"./standalone": {
|
|
18
|
+
"types": "./dist/standalone/index.d.ts",
|
|
19
|
+
"import": "./src/standalone/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./base.css": "./styles/base.css",
|
|
22
|
+
"./themes/default.css": "./styles/themes/default.css",
|
|
23
|
+
"./browser/umbika.min.js": "./dist/browser/umbika.min.js",
|
|
24
|
+
"./browser/umbika.min.mjs": {
|
|
25
|
+
"types": "./dist/browser/umbika.min.d.mts",
|
|
26
|
+
"import": "./dist/browser/umbika.min.mjs"
|
|
27
|
+
},
|
|
28
|
+
"./browser/umbika.min.css": "./dist/browser/umbika.min.css",
|
|
29
|
+
"./browser/umbika.min.d.ts": "./dist/browser/umbika.min.d.ts",
|
|
30
|
+
"./browser/umbika.min.d.mts": "./dist/browser/umbika.min.d.mts"
|
|
31
|
+
},
|
|
32
|
+
"files": [
|
|
33
|
+
"README.md",
|
|
34
|
+
"LICENSE",
|
|
35
|
+
"THIRD_PARTY_LICENSES.txt",
|
|
36
|
+
"src",
|
|
37
|
+
"dist",
|
|
38
|
+
"styles",
|
|
39
|
+
"vendor"
|
|
40
|
+
],
|
|
41
|
+
"scripts": {
|
|
42
|
+
"prebuild": "npm run build -w @kayr/umbika-core",
|
|
43
|
+
"build": "tsc -p tsconfig.json && npm run build:browser",
|
|
44
|
+
"prepack": "npm run build && npm run verify:distribution",
|
|
45
|
+
"pretest": "npm run build",
|
|
46
|
+
"pretypecheck": "npm run build",
|
|
47
|
+
"typecheck": "tsc -p tsconfig.json --noEmit && tsc -p tsconfig.test.json",
|
|
48
|
+
"test": "vitest run --config vitest.config.js",
|
|
49
|
+
"test:browser": "playwright test --config test/browser/renderer/playwright.config.js --project=chromium --project=firefox",
|
|
50
|
+
"test:browser:required": "npm run test:browser",
|
|
51
|
+
"test:browser:webkit": "playwright test --config test/browser/renderer/playwright.config.js --project=webkit",
|
|
52
|
+
"test:accessibility": "playwright test --config test/browser/renderer/playwright.config.js --project=chromium-accessibility",
|
|
53
|
+
"test:visual": "playwright test --config test/browser/renderer/playwright.config.js --project=chromium-wide --project=chromium-narrow test/browser/renderer/browser-visual.test.js",
|
|
54
|
+
"test:visual:update": "npm run test:visual -- --update-snapshots",
|
|
55
|
+
"test:presentation": "playwright test --config test/browser/renderer/playwright.config.js --project=chromium-wide --project=chromium-narrow test/browser/renderer/browser-presentation.test.js",
|
|
56
|
+
"test:reduced-motion": "playwright test --config test/browser/renderer/playwright.config.js --project=chromium-wide test/browser/renderer/browser-presentation.test.js --grep reduced",
|
|
57
|
+
"test:styles": "vitest run --config vitest.config.js test/unit/css-contract.test.js",
|
|
58
|
+
"test:base-style": "npm run test:styles",
|
|
59
|
+
"test:theme": "npm run test:styles && playwright test --config test/browser/renderer/playwright.config.js --project=chromium-wide test/browser/renderer/browser-presentation.test.js --grep theme",
|
|
60
|
+
"showcase": "vite --config showcase/vite.config.js",
|
|
61
|
+
"showcase:build": "vite build --config showcase/vite.config.js",
|
|
62
|
+
"build:browser": "node scripts/clean-browser-output.mjs && tsup --config tsup.config.js && node scripts/build-declarations.mjs && node scripts/finalize-distribution.mjs",
|
|
63
|
+
"verify:distribution": "node scripts/check-distribution.mjs && node scripts/check-packed-files.mjs",
|
|
64
|
+
"pretest:standalone": "npm run build",
|
|
65
|
+
"test:standalone": "vitest run --config vitest.config.js test/unit/standalone",
|
|
66
|
+
"test:standalone:distribution": "npm run build && npm run verify:distribution",
|
|
67
|
+
"test:standalone:browser:required": "npm run build && playwright test --config test/browser/standalone/playwright.config.js --project=chromium --project=firefox",
|
|
68
|
+
"test:standalone:browser:webkit": "npm run build && playwright test --config test/browser/standalone/playwright.config.js --project=webkit",
|
|
69
|
+
"test:standalone:accessibility": "npm run build && playwright test --config test/browser/standalone/playwright.config.js --project=chromium-accessibility"
|
|
70
|
+
},
|
|
71
|
+
"dependencies": {
|
|
72
|
+
"@kayr/umbika-core": "^0.1.0"
|
|
73
|
+
},
|
|
74
|
+
"devDependencies": {
|
|
75
|
+
"@playwright/test": "1.58.1",
|
|
76
|
+
"axe-core": "4.12.1",
|
|
77
|
+
"jsdom": "^20.0.3",
|
|
78
|
+
"vite": "5.4.21"
|
|
79
|
+
}
|
|
80
|
+
}
|
package/src/casconda.js
ADDED
package/src/contracts.js
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {object} MountWebFormOptions
|
|
3
|
+
* @property {import("@kayr/umbika-core").Form} form Replacement-engine form instance.
|
|
4
|
+
* @property {string} [instanceId] Host-supplied DOM identity prefix.
|
|
5
|
+
* @property {WebFormLayout} [layout] Renderer-owned repeat presentation.
|
|
6
|
+
* @property {string} [theme] Root-scoped theme name. Changing it requires remounting.
|
|
7
|
+
* @property {WebFormSubmitCallback} [onSubmit] Receives validation; persistence remains host-owned.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/** @typedef {{validation: import("@kayr/umbika-core").ValidationResult}} WebFormSubmitEvent */
|
|
11
|
+
/** @typedef {(event: WebFormSubmitEvent) => void} WebFormSubmitCallback */
|
|
12
|
+
/** @typedef {"cards" | "table"} WebTableMode */
|
|
13
|
+
/** @typedef {"start" | "center" | "end"} WebTableColumnAlignment */
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @typedef {object} WebTableColumnLayout
|
|
17
|
+
* @property {import("@kayr/umbika-core").FieldPath} path
|
|
18
|
+
* @property {string} [label]
|
|
19
|
+
* @property {WebTableColumnAlignment} [align]
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* @typedef {object} WebTableLayout
|
|
23
|
+
* @property {import("@kayr/umbika-core").FieldPath} path
|
|
24
|
+
* @property {WebTableMode} mode
|
|
25
|
+
* @property {readonly WebTableColumnLayout[]} [columns]
|
|
26
|
+
*/
|
|
27
|
+
/** @typedef {{tables?: readonly WebTableLayout[]}} WebFormLayout */
|
|
28
|
+
/** @typedef {Readonly<{key: string, path: readonly string[], label: string, align: WebTableColumnAlignment}>} OwnedWebTableColumnLayout */
|
|
29
|
+
/** @typedef {Readonly<{path: readonly string[], mode: WebTableMode, columns: readonly OwnedWebTableColumnLayout[] | undefined}>} OwnedWebTableLayout */
|
|
30
|
+
/** @typedef {Readonly<{tables: readonly OwnedWebTableLayout[]}>} OwnedWebFormLayout */
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @typedef {Readonly<{
|
|
34
|
+
* rowPath: import("@kayr/umbika-core").FieldPath;
|
|
35
|
+
* definitionPath: readonly string[];
|
|
36
|
+
* openedBy: string;
|
|
37
|
+
* origin: "new" | "existing";
|
|
38
|
+
* }>} WorkspaceFrame
|
|
39
|
+
*/
|
|
40
|
+
/** @typedef {Readonly<{frames: readonly WorkspaceFrame[]}>} WorkspaceState */
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* @typedef {object} MountedWebForm
|
|
44
|
+
* @property {HTMLFormElement} root
|
|
45
|
+
* @property {() => void} refresh
|
|
46
|
+
* @property {(path: import("@kayr/umbika-core").FieldPath) => boolean} focus
|
|
47
|
+
* @property {() => void} dispose
|
|
48
|
+
*/
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* @template TValue
|
|
52
|
+
* @typedef {Readonly<{
|
|
53
|
+
* _listeners: unknown[];
|
|
54
|
+
* _notify: (value: unknown) => void;
|
|
55
|
+
* get: () => TValue;
|
|
56
|
+
* notify: () => void;
|
|
57
|
+
* subscribe: (listener: (value: any) => void) => () => void;
|
|
58
|
+
* }>} ReactiveSource
|
|
59
|
+
*/
|
|
60
|
+
/** @template TValue @typedef {ReactiveSource<TValue | undefined>} KeyedItemResource */
|
|
61
|
+
/** @template TValue @typedef {ReactiveSource<readonly TValue[]>} ResourceListSource */
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* @typedef {Readonly<{
|
|
65
|
+
* instanceId: string;
|
|
66
|
+
* definitionPath: readonly string[];
|
|
67
|
+
* layout: OwnedWebFormLayout;
|
|
68
|
+
* renderNodes: (nodes: ResourceListSource<import("@kayr/umbika-core").ActiveFieldNode>, definitionPath?: readonly string[]) => unknown;
|
|
69
|
+
* setText?: (path: import("@kayr/umbika-core").FieldPath, value: string) => void;
|
|
70
|
+
* touchText?: (path: import("@kayr/umbika-core").FieldPath) => void;
|
|
71
|
+
* commitSelect?: (path: import("@kayr/umbika-core").FieldPath, value: import("@kayr/umbika-core").SelectOption | undefined) => void;
|
|
72
|
+
* commitMultiSelect?: (path: import("@kayr/umbika-core").FieldPath, value: readonly string[]) => void;
|
|
73
|
+
* appendRow?: (tablePath: import("@kayr/umbika-core").FieldPath, openDetail: boolean, openerId: string, definitionPath: readonly string[]) => void;
|
|
74
|
+
* removeRow?: (rowPath: import("@kayr/umbika-core").FieldPath) => void;
|
|
75
|
+
* openRow?: (rowPath: import("@kayr/umbika-core").FieldPath, openerId: string, definitionPath: readonly string[]) => void;
|
|
76
|
+
* }>} NodeRendererContext
|
|
77
|
+
*/
|
|
78
|
+
|
|
79
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {string} instanceId
|
|
3
|
+
* @param {string} role
|
|
4
|
+
* @param {import("@kayr/umbika-core").FieldPath} path
|
|
5
|
+
*/
|
|
6
|
+
export function _fieldDomId(instanceId, role, path) {
|
|
7
|
+
const instance = _domToken(instanceId);
|
|
8
|
+
const concretePath = path.map(_domToken).join(".");
|
|
9
|
+
return `umbika-${instance}-${role}-${concretePath}`;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @param {string} instanceId
|
|
14
|
+
* @param {string} role
|
|
15
|
+
* @param {readonly string[]} path
|
|
16
|
+
*/
|
|
17
|
+
export function _structuralDomId(instanceId, role, path) {
|
|
18
|
+
const instance = _domToken(instanceId);
|
|
19
|
+
const concretePath = path.map(_domToken).join(".");
|
|
20
|
+
return `umbika-${instance}-${role}-${concretePath}`;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** @param {{path: readonly string[]}} value */
|
|
24
|
+
export function _resourcePathKey(value) {
|
|
25
|
+
return value.path.map((segment) => `${segment.length}:${segment}`).join("|");
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** @param {string} value */
|
|
29
|
+
function _domToken(value) {
|
|
30
|
+
return encodeURIComponent(value).replaceAll(".", "%2E");
|
|
31
|
+
}
|