@a2ui-sdk/types 0.0.2 → 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/README.md ADDED
@@ -0,0 +1,195 @@
1
+ # @a2ui-sdk/types
2
+
3
+ TypeScript type definitions for the A2UI protocol. This package provides all the type definitions needed to work with A2UI messages, components, and data models.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @a2ui-sdk/types
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ### v0.9 (Latest)
14
+
15
+ ```tsx
16
+ import type {
17
+ // Message types
18
+ A2UIMessage,
19
+ CreateSurfacePayload,
20
+ UpdateComponentsPayload,
21
+ UpdateDataModelPayload,
22
+ DeleteSurfacePayload,
23
+
24
+ // Component types
25
+ Component,
26
+ TextComponent,
27
+ ImageComponent,
28
+ IconComponent,
29
+ VideoComponent,
30
+ AudioPlayerComponent,
31
+ DividerComponent,
32
+ RowComponent,
33
+ ColumnComponent,
34
+ ListComponent,
35
+ CardComponent,
36
+ TabsComponent,
37
+ ModalComponent,
38
+ ButtonComponent,
39
+ TextFieldComponent,
40
+ CheckBoxComponent,
41
+ ChoicePickerComponent,
42
+ SliderComponent,
43
+ DateTimeInputComponent,
44
+
45
+ // Value types
46
+ DynamicValue,
47
+ DynamicString,
48
+ DynamicNumber,
49
+ DynamicBoolean,
50
+ DynamicStringList,
51
+ ChildList,
52
+ TemplateBinding,
53
+
54
+ // Action types
55
+ Action,
56
+ ActionPayload,
57
+ ActionHandler,
58
+
59
+ // Validation types
60
+ CheckRule,
61
+ Checkable,
62
+ ValidationResult,
63
+
64
+ // State types
65
+ ScopeValue,
66
+ DataModel,
67
+ } from '@a2ui-sdk/types/0.9'
68
+ ```
69
+
70
+ ### v0.8
71
+
72
+ ```tsx
73
+ import type {
74
+ // Message types
75
+ A2UIMessage,
76
+ BeginRenderingPayload,
77
+ SurfaceUpdatePayload,
78
+ DataModelUpdatePayload,
79
+ DeleteSurfacePayload,
80
+
81
+ // Core types
82
+ Surface,
83
+ SurfaceStyles,
84
+ ComponentDefinition,
85
+ ComponentProps,
86
+ ValueSource,
87
+ DataModel,
88
+ DataModelValue,
89
+ DataEntry,
90
+
91
+ // Children types
92
+ ChildrenDefinition,
93
+ TemplateBinding,
94
+
95
+ // Action types
96
+ Action,
97
+ ActionPayload,
98
+ ActionHandler,
99
+ ActionContextItem,
100
+
101
+ // Component props
102
+ BaseComponentProps,
103
+ TextComponentProps,
104
+ ImageComponentProps,
105
+ IconComponentProps,
106
+ VideoComponentProps,
107
+ AudioPlayerComponentProps,
108
+ DividerComponentProps,
109
+ RowComponentProps,
110
+ ColumnComponentProps,
111
+ ListComponentProps,
112
+ CardComponentProps,
113
+ TabsComponentProps,
114
+ ModalComponentProps,
115
+ ButtonComponentProps,
116
+ CheckBoxComponentProps,
117
+ TextFieldComponentProps,
118
+ DateTimeInputComponentProps,
119
+ MultipleChoiceComponentProps,
120
+ SliderComponentProps,
121
+
122
+ // Layout types
123
+ Distribution,
124
+ Alignment,
125
+ } from '@a2ui-sdk/types/0.8'
126
+ ```
127
+
128
+ ### Namespace Import
129
+
130
+ ```tsx
131
+ import { v0_8, v0_9 } from '@a2ui-sdk/types'
132
+
133
+ // Use v0.9 types
134
+ type Message = v0_9.A2UIMessage
135
+ ```
136
+
137
+ ## Key Types
138
+
139
+ ### A2UIMessage (v0.9)
140
+
141
+ Messages sent from server to client:
142
+
143
+ ```tsx
144
+ type A2UIMessage =
145
+ | { createSurface: CreateSurfacePayload }
146
+ | { updateComponents: UpdateComponentsPayload }
147
+ | { updateDataModel: UpdateDataModelPayload }
148
+ | { deleteSurface: DeleteSurfacePayload }
149
+ ```
150
+
151
+ ### Dynamic Values (v0.9)
152
+
153
+ Values that can be static or data-bound:
154
+
155
+ ```tsx
156
+ // Static string or path reference
157
+ type DynamicString = string | { path: string } | FunctionCall
158
+
159
+ // Static number or path reference
160
+ type DynamicNumber = number | { path: string } | FunctionCall
161
+
162
+ // Static boolean or logic expression
163
+ type DynamicBoolean = boolean | { path: string } | LogicExpression
164
+ ```
165
+
166
+ ### ValueSource (v0.8)
167
+
168
+ Legacy value binding:
169
+
170
+ ```tsx
171
+ type ValueSource =
172
+ | { literalString: string }
173
+ | { literalNumber: number }
174
+ | { literalBoolean: boolean }
175
+ | { literalArray: string[] }
176
+ | { path: string }
177
+ ```
178
+
179
+ ### ActionPayload
180
+
181
+ Action dispatched from client to server:
182
+
183
+ ```tsx
184
+ interface ActionPayload {
185
+ name: string
186
+ surfaceId: string
187
+ sourceComponentId: string
188
+ timestamp: string // ISO 8601
189
+ context: Record<string, unknown>
190
+ }
191
+ ```
192
+
193
+ ## License
194
+
195
+ Apache-2.0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@a2ui-sdk/types",
3
- "version": "0.0.2",
3
+ "version": "0.1.0",
4
4
  "description": "A2UI types",
5
5
  "homepage": "https://easyops-cn.github.io/a2ui-sdk/",
6
6
  "repository": {
@@ -1 +0,0 @@
1
- {"root":["../src/index.ts","../src/0.8/index.ts","../src/0.9/index.ts"],"version":"5.9.3"}