@a2ui-vue3-elementplus/protocol-v09 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/dist/index.cjs +66 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +80 -0
- package/dist/index.d.ts +80 -0
- package/dist/index.js +36 -0
- package/dist/index.js.map +1 -0
- package/package.json +35 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
A2UI_PROTOCOL_V09: () => A2UI_PROTOCOL_V09,
|
|
24
|
+
A2UI_PROTOCOL_V091: () => A2UI_PROTOCOL_V091,
|
|
25
|
+
createSurface: () => createSurface,
|
|
26
|
+
deleteSurface: () => deleteSurface,
|
|
27
|
+
updateComponents: () => updateComponents,
|
|
28
|
+
updateDataModel: () => updateDataModel
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(index_exports);
|
|
31
|
+
var A2UI_PROTOCOL_V09 = "v0.9";
|
|
32
|
+
var A2UI_PROTOCOL_V091 = "v0.9.1";
|
|
33
|
+
function createSurface(payload, version = A2UI_PROTOCOL_V09) {
|
|
34
|
+
return {
|
|
35
|
+
version,
|
|
36
|
+
createSurface: payload
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function updateComponents(payload, version = A2UI_PROTOCOL_V09) {
|
|
40
|
+
return {
|
|
41
|
+
version,
|
|
42
|
+
updateComponents: payload
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
function updateDataModel(payload, version = A2UI_PROTOCOL_V09) {
|
|
46
|
+
return {
|
|
47
|
+
version,
|
|
48
|
+
updateDataModel: payload
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
function deleteSurface(payload, version = A2UI_PROTOCOL_V09) {
|
|
52
|
+
return {
|
|
53
|
+
version,
|
|
54
|
+
deleteSurface: payload
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
58
|
+
0 && (module.exports = {
|
|
59
|
+
A2UI_PROTOCOL_V09,
|
|
60
|
+
A2UI_PROTOCOL_V091,
|
|
61
|
+
createSurface,
|
|
62
|
+
deleteSurface,
|
|
63
|
+
updateComponents,
|
|
64
|
+
updateDataModel
|
|
65
|
+
});
|
|
66
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export const A2UI_PROTOCOL_V09 = 'v0.9' as const;\nexport const A2UI_PROTOCOL_V091 = 'v0.9.1' as const;\n\nexport type A2UIProtocolVersion = typeof A2UI_PROTOCOL_V09 | typeof A2UI_PROTOCOL_V091 | '0.9' | '0.9.1';\n\nexport type A2Primitive = string | number | boolean | null;\nexport type A2JsonValue = A2Primitive | A2JsonValue[] | { [key: string]: A2JsonValue };\nexport type A2Record = Record<string, A2JsonValue>;\n\nexport type A2ComponentId = string;\nexport type A2SurfaceId = string;\nexport type A2CatalogId = string;\n\nexport interface A2DataBinding {\n path: string;\n}\n\nexport interface A2ActionEvent {\n name: string;\n context?: Record<string, unknown>;\n}\n\nexport interface A2Action {\n event?: A2ActionEvent;\n [key: string]: unknown;\n}\n\nexport type A2BasicComponentType =\n | 'Text'\n | 'Image'\n | 'Icon'\n | 'Video'\n | 'AudioPlayer'\n | 'Row'\n | 'Column'\n | 'List'\n | 'Card'\n | 'Tabs'\n | 'Divider'\n | 'Modal'\n | 'Button'\n | 'CheckBox'\n | 'TextField'\n | 'DateTimeInput'\n | 'ChoicePicker'\n | 'Slider';\n\nexport type A2ComponentType = A2BasicComponentType | (string & {});\n\nexport interface A2ChildTemplate {\n path?: string;\n componentId?: string;\n [key: string]: unknown;\n}\n\nexport interface A2ComponentNode {\n id: A2ComponentId;\n component: A2ComponentType;\n child?: A2ComponentId;\n children?: A2ComponentId[] | A2ChildTemplate;\n action?: A2Action;\n [key: string]: unknown;\n}\n\nexport interface A2CreateSurfacePayload {\n surfaceId: A2SurfaceId;\n catalogId?: A2CatalogId;\n theme?: Record<string, unknown>;\n sendDataModel?: boolean;\n rootId?: A2ComponentId;\n}\n\nexport interface A2UpdateComponentsPayload {\n surfaceId: A2SurfaceId;\n components: A2ComponentNode[];\n replace?: boolean;\n}\n\nexport interface A2UpdateDataModelPayload {\n surfaceId: A2SurfaceId;\n path?: string;\n value: unknown;\n}\n\nexport interface A2DeleteSurfacePayload {\n surfaceId: A2SurfaceId;\n}\n\nexport interface A2MessageBase {\n version?: A2UIProtocolVersion;\n a2ui?: A2UIProtocolVersion;\n}\n\nexport interface CreateSurfaceMessage extends A2MessageBase {\n createSurface: A2CreateSurfacePayload;\n}\n\nexport interface UpdateComponentsMessage extends A2MessageBase {\n updateComponents: A2UpdateComponentsPayload;\n}\n\nexport interface UpdateDataModelMessage extends A2MessageBase {\n updateDataModel: A2UpdateDataModelPayload;\n}\n\nexport interface DeleteSurfaceMessage extends A2MessageBase {\n deleteSurface: A2DeleteSurfacePayload;\n}\n\nexport type A2UIMessage =\n | CreateSurfaceMessage\n | UpdateComponentsMessage\n | UpdateDataModelMessage\n | DeleteSurfaceMessage;\n\nexport function createSurface(payload: A2CreateSurfacePayload, version: A2UIProtocolVersion = A2UI_PROTOCOL_V09): CreateSurfaceMessage {\n return {\n version,\n createSurface: payload\n };\n}\n\nexport function updateComponents(\n payload: A2UpdateComponentsPayload,\n version: A2UIProtocolVersion = A2UI_PROTOCOL_V09\n): UpdateComponentsMessage {\n return {\n version,\n updateComponents: payload\n };\n}\n\nexport function updateDataModel(\n payload: A2UpdateDataModelPayload,\n version: A2UIProtocolVersion = A2UI_PROTOCOL_V09\n): UpdateDataModelMessage {\n return {\n version,\n updateDataModel: payload\n };\n}\n\nexport function deleteSurface(payload: A2DeleteSurfacePayload, version: A2UIProtocolVersion = A2UI_PROTOCOL_V09): DeleteSurfaceMessage {\n return {\n version,\n deleteSurface: payload\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,IAAM,oBAAoB;AAC1B,IAAM,qBAAqB;AAkH3B,SAAS,cAAc,SAAiC,UAA+B,mBAAyC;AACrI,SAAO;AAAA,IACL;AAAA,IACA,eAAe;AAAA,EACjB;AACF;AAEO,SAAS,iBACd,SACA,UAA+B,mBACN;AACzB,SAAO;AAAA,IACL;AAAA,IACA,kBAAkB;AAAA,EACpB;AACF;AAEO,SAAS,gBACd,SACA,UAA+B,mBACP;AACxB,SAAO;AAAA,IACL;AAAA,IACA,iBAAiB;AAAA,EACnB;AACF;AAEO,SAAS,cAAc,SAAiC,UAA+B,mBAAyC;AACrI,SAAO;AAAA,IACL;AAAA,IACA,eAAe;AAAA,EACjB;AACF;","names":[]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
declare const A2UI_PROTOCOL_V09: "v0.9";
|
|
2
|
+
declare const A2UI_PROTOCOL_V091: "v0.9.1";
|
|
3
|
+
type A2UIProtocolVersion = typeof A2UI_PROTOCOL_V09 | typeof A2UI_PROTOCOL_V091 | '0.9' | '0.9.1';
|
|
4
|
+
type A2Primitive = string | number | boolean | null;
|
|
5
|
+
type A2JsonValue = A2Primitive | A2JsonValue[] | {
|
|
6
|
+
[key: string]: A2JsonValue;
|
|
7
|
+
};
|
|
8
|
+
type A2Record = Record<string, A2JsonValue>;
|
|
9
|
+
type A2ComponentId = string;
|
|
10
|
+
type A2SurfaceId = string;
|
|
11
|
+
type A2CatalogId = string;
|
|
12
|
+
interface A2DataBinding {
|
|
13
|
+
path: string;
|
|
14
|
+
}
|
|
15
|
+
interface A2ActionEvent {
|
|
16
|
+
name: string;
|
|
17
|
+
context?: Record<string, unknown>;
|
|
18
|
+
}
|
|
19
|
+
interface A2Action {
|
|
20
|
+
event?: A2ActionEvent;
|
|
21
|
+
[key: string]: unknown;
|
|
22
|
+
}
|
|
23
|
+
type A2BasicComponentType = 'Text' | 'Image' | 'Icon' | 'Video' | 'AudioPlayer' | 'Row' | 'Column' | 'List' | 'Card' | 'Tabs' | 'Divider' | 'Modal' | 'Button' | 'CheckBox' | 'TextField' | 'DateTimeInput' | 'ChoicePicker' | 'Slider';
|
|
24
|
+
type A2ComponentType = A2BasicComponentType | (string & {});
|
|
25
|
+
interface A2ChildTemplate {
|
|
26
|
+
path?: string;
|
|
27
|
+
componentId?: string;
|
|
28
|
+
[key: string]: unknown;
|
|
29
|
+
}
|
|
30
|
+
interface A2ComponentNode {
|
|
31
|
+
id: A2ComponentId;
|
|
32
|
+
component: A2ComponentType;
|
|
33
|
+
child?: A2ComponentId;
|
|
34
|
+
children?: A2ComponentId[] | A2ChildTemplate;
|
|
35
|
+
action?: A2Action;
|
|
36
|
+
[key: string]: unknown;
|
|
37
|
+
}
|
|
38
|
+
interface A2CreateSurfacePayload {
|
|
39
|
+
surfaceId: A2SurfaceId;
|
|
40
|
+
catalogId?: A2CatalogId;
|
|
41
|
+
theme?: Record<string, unknown>;
|
|
42
|
+
sendDataModel?: boolean;
|
|
43
|
+
rootId?: A2ComponentId;
|
|
44
|
+
}
|
|
45
|
+
interface A2UpdateComponentsPayload {
|
|
46
|
+
surfaceId: A2SurfaceId;
|
|
47
|
+
components: A2ComponentNode[];
|
|
48
|
+
replace?: boolean;
|
|
49
|
+
}
|
|
50
|
+
interface A2UpdateDataModelPayload {
|
|
51
|
+
surfaceId: A2SurfaceId;
|
|
52
|
+
path?: string;
|
|
53
|
+
value: unknown;
|
|
54
|
+
}
|
|
55
|
+
interface A2DeleteSurfacePayload {
|
|
56
|
+
surfaceId: A2SurfaceId;
|
|
57
|
+
}
|
|
58
|
+
interface A2MessageBase {
|
|
59
|
+
version?: A2UIProtocolVersion;
|
|
60
|
+
a2ui?: A2UIProtocolVersion;
|
|
61
|
+
}
|
|
62
|
+
interface CreateSurfaceMessage extends A2MessageBase {
|
|
63
|
+
createSurface: A2CreateSurfacePayload;
|
|
64
|
+
}
|
|
65
|
+
interface UpdateComponentsMessage extends A2MessageBase {
|
|
66
|
+
updateComponents: A2UpdateComponentsPayload;
|
|
67
|
+
}
|
|
68
|
+
interface UpdateDataModelMessage extends A2MessageBase {
|
|
69
|
+
updateDataModel: A2UpdateDataModelPayload;
|
|
70
|
+
}
|
|
71
|
+
interface DeleteSurfaceMessage extends A2MessageBase {
|
|
72
|
+
deleteSurface: A2DeleteSurfacePayload;
|
|
73
|
+
}
|
|
74
|
+
type A2UIMessage = CreateSurfaceMessage | UpdateComponentsMessage | UpdateDataModelMessage | DeleteSurfaceMessage;
|
|
75
|
+
declare function createSurface(payload: A2CreateSurfacePayload, version?: A2UIProtocolVersion): CreateSurfaceMessage;
|
|
76
|
+
declare function updateComponents(payload: A2UpdateComponentsPayload, version?: A2UIProtocolVersion): UpdateComponentsMessage;
|
|
77
|
+
declare function updateDataModel(payload: A2UpdateDataModelPayload, version?: A2UIProtocolVersion): UpdateDataModelMessage;
|
|
78
|
+
declare function deleteSurface(payload: A2DeleteSurfacePayload, version?: A2UIProtocolVersion): DeleteSurfaceMessage;
|
|
79
|
+
|
|
80
|
+
export { type A2Action, type A2ActionEvent, type A2BasicComponentType, type A2CatalogId, type A2ChildTemplate, type A2ComponentId, type A2ComponentNode, type A2ComponentType, type A2CreateSurfacePayload, type A2DataBinding, type A2DeleteSurfacePayload, type A2JsonValue, type A2MessageBase, type A2Primitive, type A2Record, type A2SurfaceId, type A2UIMessage, type A2UIProtocolVersion, A2UI_PROTOCOL_V09, A2UI_PROTOCOL_V091, type A2UpdateComponentsPayload, type A2UpdateDataModelPayload, type CreateSurfaceMessage, type DeleteSurfaceMessage, type UpdateComponentsMessage, type UpdateDataModelMessage, createSurface, deleteSurface, updateComponents, updateDataModel };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
declare const A2UI_PROTOCOL_V09: "v0.9";
|
|
2
|
+
declare const A2UI_PROTOCOL_V091: "v0.9.1";
|
|
3
|
+
type A2UIProtocolVersion = typeof A2UI_PROTOCOL_V09 | typeof A2UI_PROTOCOL_V091 | '0.9' | '0.9.1';
|
|
4
|
+
type A2Primitive = string | number | boolean | null;
|
|
5
|
+
type A2JsonValue = A2Primitive | A2JsonValue[] | {
|
|
6
|
+
[key: string]: A2JsonValue;
|
|
7
|
+
};
|
|
8
|
+
type A2Record = Record<string, A2JsonValue>;
|
|
9
|
+
type A2ComponentId = string;
|
|
10
|
+
type A2SurfaceId = string;
|
|
11
|
+
type A2CatalogId = string;
|
|
12
|
+
interface A2DataBinding {
|
|
13
|
+
path: string;
|
|
14
|
+
}
|
|
15
|
+
interface A2ActionEvent {
|
|
16
|
+
name: string;
|
|
17
|
+
context?: Record<string, unknown>;
|
|
18
|
+
}
|
|
19
|
+
interface A2Action {
|
|
20
|
+
event?: A2ActionEvent;
|
|
21
|
+
[key: string]: unknown;
|
|
22
|
+
}
|
|
23
|
+
type A2BasicComponentType = 'Text' | 'Image' | 'Icon' | 'Video' | 'AudioPlayer' | 'Row' | 'Column' | 'List' | 'Card' | 'Tabs' | 'Divider' | 'Modal' | 'Button' | 'CheckBox' | 'TextField' | 'DateTimeInput' | 'ChoicePicker' | 'Slider';
|
|
24
|
+
type A2ComponentType = A2BasicComponentType | (string & {});
|
|
25
|
+
interface A2ChildTemplate {
|
|
26
|
+
path?: string;
|
|
27
|
+
componentId?: string;
|
|
28
|
+
[key: string]: unknown;
|
|
29
|
+
}
|
|
30
|
+
interface A2ComponentNode {
|
|
31
|
+
id: A2ComponentId;
|
|
32
|
+
component: A2ComponentType;
|
|
33
|
+
child?: A2ComponentId;
|
|
34
|
+
children?: A2ComponentId[] | A2ChildTemplate;
|
|
35
|
+
action?: A2Action;
|
|
36
|
+
[key: string]: unknown;
|
|
37
|
+
}
|
|
38
|
+
interface A2CreateSurfacePayload {
|
|
39
|
+
surfaceId: A2SurfaceId;
|
|
40
|
+
catalogId?: A2CatalogId;
|
|
41
|
+
theme?: Record<string, unknown>;
|
|
42
|
+
sendDataModel?: boolean;
|
|
43
|
+
rootId?: A2ComponentId;
|
|
44
|
+
}
|
|
45
|
+
interface A2UpdateComponentsPayload {
|
|
46
|
+
surfaceId: A2SurfaceId;
|
|
47
|
+
components: A2ComponentNode[];
|
|
48
|
+
replace?: boolean;
|
|
49
|
+
}
|
|
50
|
+
interface A2UpdateDataModelPayload {
|
|
51
|
+
surfaceId: A2SurfaceId;
|
|
52
|
+
path?: string;
|
|
53
|
+
value: unknown;
|
|
54
|
+
}
|
|
55
|
+
interface A2DeleteSurfacePayload {
|
|
56
|
+
surfaceId: A2SurfaceId;
|
|
57
|
+
}
|
|
58
|
+
interface A2MessageBase {
|
|
59
|
+
version?: A2UIProtocolVersion;
|
|
60
|
+
a2ui?: A2UIProtocolVersion;
|
|
61
|
+
}
|
|
62
|
+
interface CreateSurfaceMessage extends A2MessageBase {
|
|
63
|
+
createSurface: A2CreateSurfacePayload;
|
|
64
|
+
}
|
|
65
|
+
interface UpdateComponentsMessage extends A2MessageBase {
|
|
66
|
+
updateComponents: A2UpdateComponentsPayload;
|
|
67
|
+
}
|
|
68
|
+
interface UpdateDataModelMessage extends A2MessageBase {
|
|
69
|
+
updateDataModel: A2UpdateDataModelPayload;
|
|
70
|
+
}
|
|
71
|
+
interface DeleteSurfaceMessage extends A2MessageBase {
|
|
72
|
+
deleteSurface: A2DeleteSurfacePayload;
|
|
73
|
+
}
|
|
74
|
+
type A2UIMessage = CreateSurfaceMessage | UpdateComponentsMessage | UpdateDataModelMessage | DeleteSurfaceMessage;
|
|
75
|
+
declare function createSurface(payload: A2CreateSurfacePayload, version?: A2UIProtocolVersion): CreateSurfaceMessage;
|
|
76
|
+
declare function updateComponents(payload: A2UpdateComponentsPayload, version?: A2UIProtocolVersion): UpdateComponentsMessage;
|
|
77
|
+
declare function updateDataModel(payload: A2UpdateDataModelPayload, version?: A2UIProtocolVersion): UpdateDataModelMessage;
|
|
78
|
+
declare function deleteSurface(payload: A2DeleteSurfacePayload, version?: A2UIProtocolVersion): DeleteSurfaceMessage;
|
|
79
|
+
|
|
80
|
+
export { type A2Action, type A2ActionEvent, type A2BasicComponentType, type A2CatalogId, type A2ChildTemplate, type A2ComponentId, type A2ComponentNode, type A2ComponentType, type A2CreateSurfacePayload, type A2DataBinding, type A2DeleteSurfacePayload, type A2JsonValue, type A2MessageBase, type A2Primitive, type A2Record, type A2SurfaceId, type A2UIMessage, type A2UIProtocolVersion, A2UI_PROTOCOL_V09, A2UI_PROTOCOL_V091, type A2UpdateComponentsPayload, type A2UpdateDataModelPayload, type CreateSurfaceMessage, type DeleteSurfaceMessage, type UpdateComponentsMessage, type UpdateDataModelMessage, createSurface, deleteSurface, updateComponents, updateDataModel };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// src/index.ts
|
|
2
|
+
var A2UI_PROTOCOL_V09 = "v0.9";
|
|
3
|
+
var A2UI_PROTOCOL_V091 = "v0.9.1";
|
|
4
|
+
function createSurface(payload, version = A2UI_PROTOCOL_V09) {
|
|
5
|
+
return {
|
|
6
|
+
version,
|
|
7
|
+
createSurface: payload
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
function updateComponents(payload, version = A2UI_PROTOCOL_V09) {
|
|
11
|
+
return {
|
|
12
|
+
version,
|
|
13
|
+
updateComponents: payload
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function updateDataModel(payload, version = A2UI_PROTOCOL_V09) {
|
|
17
|
+
return {
|
|
18
|
+
version,
|
|
19
|
+
updateDataModel: payload
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
function deleteSurface(payload, version = A2UI_PROTOCOL_V09) {
|
|
23
|
+
return {
|
|
24
|
+
version,
|
|
25
|
+
deleteSurface: payload
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
A2UI_PROTOCOL_V09,
|
|
30
|
+
A2UI_PROTOCOL_V091,
|
|
31
|
+
createSurface,
|
|
32
|
+
deleteSurface,
|
|
33
|
+
updateComponents,
|
|
34
|
+
updateDataModel
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export const A2UI_PROTOCOL_V09 = 'v0.9' as const;\nexport const A2UI_PROTOCOL_V091 = 'v0.9.1' as const;\n\nexport type A2UIProtocolVersion = typeof A2UI_PROTOCOL_V09 | typeof A2UI_PROTOCOL_V091 | '0.9' | '0.9.1';\n\nexport type A2Primitive = string | number | boolean | null;\nexport type A2JsonValue = A2Primitive | A2JsonValue[] | { [key: string]: A2JsonValue };\nexport type A2Record = Record<string, A2JsonValue>;\n\nexport type A2ComponentId = string;\nexport type A2SurfaceId = string;\nexport type A2CatalogId = string;\n\nexport interface A2DataBinding {\n path: string;\n}\n\nexport interface A2ActionEvent {\n name: string;\n context?: Record<string, unknown>;\n}\n\nexport interface A2Action {\n event?: A2ActionEvent;\n [key: string]: unknown;\n}\n\nexport type A2BasicComponentType =\n | 'Text'\n | 'Image'\n | 'Icon'\n | 'Video'\n | 'AudioPlayer'\n | 'Row'\n | 'Column'\n | 'List'\n | 'Card'\n | 'Tabs'\n | 'Divider'\n | 'Modal'\n | 'Button'\n | 'CheckBox'\n | 'TextField'\n | 'DateTimeInput'\n | 'ChoicePicker'\n | 'Slider';\n\nexport type A2ComponentType = A2BasicComponentType | (string & {});\n\nexport interface A2ChildTemplate {\n path?: string;\n componentId?: string;\n [key: string]: unknown;\n}\n\nexport interface A2ComponentNode {\n id: A2ComponentId;\n component: A2ComponentType;\n child?: A2ComponentId;\n children?: A2ComponentId[] | A2ChildTemplate;\n action?: A2Action;\n [key: string]: unknown;\n}\n\nexport interface A2CreateSurfacePayload {\n surfaceId: A2SurfaceId;\n catalogId?: A2CatalogId;\n theme?: Record<string, unknown>;\n sendDataModel?: boolean;\n rootId?: A2ComponentId;\n}\n\nexport interface A2UpdateComponentsPayload {\n surfaceId: A2SurfaceId;\n components: A2ComponentNode[];\n replace?: boolean;\n}\n\nexport interface A2UpdateDataModelPayload {\n surfaceId: A2SurfaceId;\n path?: string;\n value: unknown;\n}\n\nexport interface A2DeleteSurfacePayload {\n surfaceId: A2SurfaceId;\n}\n\nexport interface A2MessageBase {\n version?: A2UIProtocolVersion;\n a2ui?: A2UIProtocolVersion;\n}\n\nexport interface CreateSurfaceMessage extends A2MessageBase {\n createSurface: A2CreateSurfacePayload;\n}\n\nexport interface UpdateComponentsMessage extends A2MessageBase {\n updateComponents: A2UpdateComponentsPayload;\n}\n\nexport interface UpdateDataModelMessage extends A2MessageBase {\n updateDataModel: A2UpdateDataModelPayload;\n}\n\nexport interface DeleteSurfaceMessage extends A2MessageBase {\n deleteSurface: A2DeleteSurfacePayload;\n}\n\nexport type A2UIMessage =\n | CreateSurfaceMessage\n | UpdateComponentsMessage\n | UpdateDataModelMessage\n | DeleteSurfaceMessage;\n\nexport function createSurface(payload: A2CreateSurfacePayload, version: A2UIProtocolVersion = A2UI_PROTOCOL_V09): CreateSurfaceMessage {\n return {\n version,\n createSurface: payload\n };\n}\n\nexport function updateComponents(\n payload: A2UpdateComponentsPayload,\n version: A2UIProtocolVersion = A2UI_PROTOCOL_V09\n): UpdateComponentsMessage {\n return {\n version,\n updateComponents: payload\n };\n}\n\nexport function updateDataModel(\n payload: A2UpdateDataModelPayload,\n version: A2UIProtocolVersion = A2UI_PROTOCOL_V09\n): UpdateDataModelMessage {\n return {\n version,\n updateDataModel: payload\n };\n}\n\nexport function deleteSurface(payload: A2DeleteSurfacePayload, version: A2UIProtocolVersion = A2UI_PROTOCOL_V09): DeleteSurfaceMessage {\n return {\n version,\n deleteSurface: payload\n };\n}\n"],"mappings":";AAAO,IAAM,oBAAoB;AAC1B,IAAM,qBAAqB;AAkH3B,SAAS,cAAc,SAAiC,UAA+B,mBAAyC;AACrI,SAAO;AAAA,IACL;AAAA,IACA,eAAe;AAAA,EACjB;AACF;AAEO,SAAS,iBACd,SACA,UAA+B,mBACN;AACzB,SAAO;AAAA,IACL;AAAA,IACA,kBAAkB;AAAA,EACpB;AACF;AAEO,SAAS,gBACd,SACA,UAA+B,mBACP;AACxB,SAAO;AAAA,IACL;AAAA,IACA,iBAAiB;AAAA,EACnB;AACF;AAEO,SAAS,cAAc,SAAiC,UAA+B,mBAAyC;AACrI,SAAO;AAAA,IACL;AAAA,IACA,eAAe;AAAA,EACjB;AACF;","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@a2ui-vue3-elementplus/protocol-v09",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "A2UI v0.9 protocol types.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/EricLee823/a2ui-vue3-elementplus.git",
|
|
9
|
+
"directory": "packages/protocol-v09"
|
|
10
|
+
},
|
|
11
|
+
"main": "./dist/index.cjs",
|
|
12
|
+
"module": "./dist/index.js",
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"import": "./dist/index.js",
|
|
18
|
+
"require": "./dist/index.cjs"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"dist"
|
|
23
|
+
],
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"access": "public",
|
|
26
|
+
"registry": "https://registry.npmjs.org/"
|
|
27
|
+
},
|
|
28
|
+
"sideEffects": false,
|
|
29
|
+
"scripts": {
|
|
30
|
+
"build": "tsup",
|
|
31
|
+
"test": "vitest run",
|
|
32
|
+
"typecheck": "tsc --noEmit",
|
|
33
|
+
"lint": "tsc --noEmit"
|
|
34
|
+
}
|
|
35
|
+
}
|