@object-ui/types 0.3.0 → 0.5.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 +19 -11
- package/dist/api-types.d.ts +7 -0
- package/dist/api-types.d.ts.map +1 -1
- package/dist/api-types.js +4 -6
- package/dist/app.d.ts +17 -0
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +4 -3
- package/dist/base.d.ts +7 -0
- package/dist/base.d.ts.map +1 -1
- package/dist/base.js +4 -6
- package/dist/blocks.d.ts +332 -0
- package/dist/blocks.d.ts.map +1 -0
- package/dist/blocks.js +8 -0
- package/dist/complex.d.ts +68 -1
- package/dist/complex.d.ts.map +1 -1
- package/dist/complex.js +4 -5
- package/dist/crud.d.ts +181 -3
- package/dist/crud.d.ts.map +1 -1
- package/dist/crud.js +4 -6
- package/dist/data-display.d.ts +54 -2
- package/dist/data-display.d.ts.map +1 -1
- package/dist/data-display.js +4 -5
- package/dist/data-protocol.d.ts +1268 -0
- package/dist/data-protocol.d.ts.map +1 -0
- package/dist/data-protocol.js +8 -0
- package/dist/data.d.ts +22 -1
- package/dist/data.d.ts.map +1 -1
- package/dist/data.js +4 -6
- package/dist/disclosure.d.ts +70 -1
- package/dist/disclosure.d.ts.map +1 -1
- package/dist/disclosure.js +4 -5
- package/dist/feedback.d.ts +68 -1
- package/dist/feedback.d.ts.map +1 -1
- package/dist/feedback.js +4 -5
- package/dist/field-types.d.ts +728 -0
- package/dist/field-types.d.ts.map +1 -0
- package/dist/field-types.js +8 -0
- package/dist/form.d.ts +123 -1
- package/dist/form.d.ts.map +1 -1
- package/dist/form.js +4 -5
- package/dist/index.d.ts +48 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -37
- package/dist/layout.d.ts +66 -16
- package/dist/layout.d.ts.map +1 -1
- package/dist/layout.js +4 -6
- package/dist/navigation.d.ts +102 -2
- package/dist/navigation.d.ts.map +1 -1
- package/dist/navigation.js +4 -5
- package/dist/objectql.d.ts +491 -54
- package/dist/objectql.d.ts.map +1 -1
- package/dist/objectql.js +4 -6
- package/dist/overlay.d.ts +31 -1
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +4 -5
- package/dist/plugin-scope.d.ts +194 -0
- package/dist/plugin-scope.d.ts.map +1 -0
- package/dist/plugin-scope.js +8 -0
- package/dist/registry.d.ts +7 -0
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +7 -0
- package/dist/reports.d.ts +336 -0
- package/dist/reports.d.ts.map +1 -0
- package/dist/reports.js +8 -0
- package/dist/theme.d.ts +289 -0
- package/dist/theme.d.ts.map +1 -0
- package/dist/theme.js +8 -0
- package/dist/ui-action.d.ts +175 -0
- package/dist/ui-action.d.ts.map +1 -0
- package/dist/ui-action.js +8 -0
- package/dist/views.d.ts +417 -0
- package/dist/views.d.ts.map +1 -0
- package/dist/views.js +8 -0
- package/dist/zod/app.zod.d.ts +120 -0
- package/dist/zod/app.zod.d.ts.map +1 -0
- package/dist/zod/app.zod.js +60 -0
- package/dist/zod/base.zod.d.ts +202 -0
- package/dist/zod/base.zod.d.ts.map +1 -0
- package/dist/zod/base.zod.js +198 -0
- package/dist/zod/blocks.zod.d.ts +834 -0
- package/dist/zod/blocks.zod.d.ts.map +1 -0
- package/dist/zod/blocks.zod.js +145 -0
- package/dist/zod/complex.zod.d.ts +742 -0
- package/dist/zod/complex.zod.d.ts.map +1 -0
- package/dist/zod/complex.zod.js +233 -0
- package/dist/zod/crud.zod.d.ts +598 -0
- package/dist/zod/crud.zod.d.ts.map +1 -0
- package/dist/zod/crud.zod.js +230 -0
- package/dist/zod/data-display.zod.d.ts +996 -0
- package/dist/zod/data-display.zod.d.ts.map +1 -0
- package/dist/zod/data-display.zod.js +266 -0
- package/dist/zod/disclosure.zod.d.ts +267 -0
- package/dist/zod/disclosure.zod.d.ts.map +1 -0
- package/dist/zod/disclosure.zod.js +84 -0
- package/dist/zod/feedback.zod.d.ts +538 -0
- package/dist/zod/feedback.zod.d.ts.map +1 -0
- package/dist/zod/feedback.zod.js +127 -0
- package/dist/zod/form.zod.d.ts +1308 -0
- package/dist/zod/form.zod.d.ts.map +1 -0
- package/dist/zod/form.zod.js +406 -0
- package/dist/zod/index.zod.d.ts +4985 -0
- package/dist/zod/index.zod.d.ts.map +1 -0
- package/dist/zod/index.zod.js +183 -0
- package/dist/zod/layout.zod.d.ts +1048 -0
- package/dist/zod/layout.zod.d.ts.map +1 -0
- package/dist/zod/layout.zod.js +241 -0
- package/dist/zod/navigation.zod.d.ts +486 -0
- package/dist/zod/navigation.zod.d.ts.map +1 -0
- package/dist/zod/navigation.zod.js +142 -0
- package/dist/zod/objectql.zod.d.ts +1261 -0
- package/dist/zod/objectql.zod.d.ts.map +1 -0
- package/dist/zod/objectql.zod.js +248 -0
- package/dist/zod/overlay.zod.d.ts +691 -0
- package/dist/zod/overlay.zod.d.ts.map +1 -0
- package/dist/zod/overlay.zod.js +179 -0
- package/dist/zod/reports.zod.d.ts +1628 -0
- package/dist/zod/reports.zod.d.ts.map +1 -0
- package/dist/zod/reports.zod.js +152 -0
- package/dist/zod/theme.zod.d.ts +611 -0
- package/dist/zod/theme.zod.d.ts.map +1 -0
- package/dist/zod/theme.zod.js +130 -0
- package/dist/zod/views.zod.d.ts +675 -0
- package/dist/zod/views.zod.d.ts.map +1 -0
- package/dist/zod/views.zod.js +159 -0
- package/package.json +9 -1
- package/src/__tests__/namespace-exports.test.ts +80 -0
- package/src/__tests__/phase2-schemas.test.ts +639 -0
- package/src/api-types.ts +8 -0
- package/src/app.ts +20 -0
- package/src/base.ts +8 -0
- package/src/blocks.ts +405 -0
- package/src/complex.ts +69 -1
- package/src/crud.ts +185 -3
- package/src/data-display.ts +60 -2
- package/src/data-protocol.ts +1679 -0
- package/src/data.ts +21 -1
- package/src/disclosure.ts +74 -1
- package/src/feedback.ts +76 -2
- package/src/field-types.ts +846 -0
- package/src/form.ts +131 -1
- package/src/index.ts +305 -8
- package/src/layout.ts +70 -15
- package/src/navigation.ts +109 -2
- package/src/objectql.ts +563 -59
- package/src/overlay.ts +35 -1
- package/src/plugin-scope.ts +210 -0
- package/src/registry.ts +8 -0
- package/src/reports.ts +408 -0
- package/src/theme.ts +351 -0
- package/src/ui-action.ts +276 -0
- package/src/views.ts +429 -0
- package/src/zod/README.md +329 -0
- package/src/zod/app.zod.ts +72 -0
- package/src/zod/base.zod.ts +229 -0
- package/src/zod/blocks.zod.ts +170 -0
- package/src/zod/complex.zod.ts +258 -0
- package/src/zod/crud.zod.ts +259 -0
- package/src/zod/data-display.zod.ts +290 -0
- package/src/zod/disclosure.zod.ts +92 -0
- package/src/zod/feedback.zod.ts +138 -0
- package/src/zod/form.zod.ts +434 -0
- package/src/zod/index.zod.ts +425 -0
- package/src/zod/layout.zod.ts +262 -0
- package/src/zod/navigation.zod.ts +159 -0
- package/src/zod/objectql.zod.ts +268 -0
- package/src/zod/overlay.zod.ts +196 -0
- package/src/zod/reports.zod.ts +183 -0
- package/src/zod/theme.zod.ts +155 -0
- package/src/zod/views.zod.ts +182 -0
package/src/theme.ts
ADDED
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ObjectUI
|
|
3
|
+
* Copyright (c) 2024-present ObjectStack Inc.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @object-ui/types - Theme Schema
|
|
11
|
+
*
|
|
12
|
+
* Defines theme configuration for dynamic theme switching and customization.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import type { BaseSchema } from './base';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Color Palette Definition
|
|
19
|
+
*/
|
|
20
|
+
export interface ColorPalette {
|
|
21
|
+
/**
|
|
22
|
+
* Primary brand color
|
|
23
|
+
*/
|
|
24
|
+
primary?: string;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Secondary color
|
|
28
|
+
*/
|
|
29
|
+
secondary?: string;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Accent color
|
|
33
|
+
*/
|
|
34
|
+
accent?: string;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Background color
|
|
38
|
+
*/
|
|
39
|
+
background?: string;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Foreground/text color
|
|
43
|
+
*/
|
|
44
|
+
foreground?: string;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Muted color (for less prominent elements)
|
|
48
|
+
*/
|
|
49
|
+
muted?: string;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Muted foreground color
|
|
53
|
+
*/
|
|
54
|
+
mutedForeground?: string;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Border color
|
|
58
|
+
*/
|
|
59
|
+
border?: string;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Input border color
|
|
63
|
+
*/
|
|
64
|
+
input?: string;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Ring/focus color
|
|
68
|
+
*/
|
|
69
|
+
ring?: string;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Success color
|
|
73
|
+
*/
|
|
74
|
+
success?: string;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Warning color
|
|
78
|
+
*/
|
|
79
|
+
warning?: string;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Error/destructive color
|
|
83
|
+
*/
|
|
84
|
+
destructive?: string;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Info color
|
|
88
|
+
*/
|
|
89
|
+
info?: string;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Card background color
|
|
93
|
+
*/
|
|
94
|
+
card?: string;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Card foreground color
|
|
98
|
+
*/
|
|
99
|
+
cardForeground?: string;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Popover background color
|
|
103
|
+
*/
|
|
104
|
+
popover?: string;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Popover foreground color
|
|
108
|
+
*/
|
|
109
|
+
popoverForeground?: string;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Typography Configuration
|
|
114
|
+
*/
|
|
115
|
+
export interface Typography {
|
|
116
|
+
/**
|
|
117
|
+
* Font family for sans-serif text
|
|
118
|
+
*/
|
|
119
|
+
fontSans?: string[];
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Font family for serif text
|
|
123
|
+
*/
|
|
124
|
+
fontSerif?: string[];
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Font family for monospace text
|
|
128
|
+
*/
|
|
129
|
+
fontMono?: string[];
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Base font size (in rem)
|
|
133
|
+
*/
|
|
134
|
+
fontSize?: number;
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Line height
|
|
138
|
+
*/
|
|
139
|
+
lineHeight?: number;
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Font weight for headings
|
|
143
|
+
*/
|
|
144
|
+
headingWeight?: number;
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Font weight for body text
|
|
148
|
+
*/
|
|
149
|
+
bodyWeight?: number;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Spacing Scale Configuration
|
|
154
|
+
*/
|
|
155
|
+
export interface SpacingScale {
|
|
156
|
+
/**
|
|
157
|
+
* Base spacing unit (in rem)
|
|
158
|
+
*/
|
|
159
|
+
base?: number;
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Custom spacing values
|
|
163
|
+
*/
|
|
164
|
+
scale?: Record<string, string>;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Border Radius Configuration
|
|
169
|
+
*/
|
|
170
|
+
export interface BorderRadius {
|
|
171
|
+
/**
|
|
172
|
+
* Small radius
|
|
173
|
+
*/
|
|
174
|
+
sm?: string;
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Default radius
|
|
178
|
+
*/
|
|
179
|
+
default?: string;
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Medium radius
|
|
183
|
+
*/
|
|
184
|
+
md?: string;
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Large radius
|
|
188
|
+
*/
|
|
189
|
+
lg?: string;
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Extra large radius
|
|
193
|
+
*/
|
|
194
|
+
xl?: string;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Theme Mode
|
|
199
|
+
*/
|
|
200
|
+
export type ThemeMode = 'light' | 'dark' | 'system';
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Complete Theme Definition
|
|
204
|
+
*/
|
|
205
|
+
export interface ThemeDefinition {
|
|
206
|
+
/**
|
|
207
|
+
* Theme name/identifier
|
|
208
|
+
*/
|
|
209
|
+
name: string;
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Theme display label
|
|
213
|
+
*/
|
|
214
|
+
label?: string;
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Light mode color palette
|
|
218
|
+
*/
|
|
219
|
+
light?: ColorPalette;
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Dark mode color palette
|
|
223
|
+
*/
|
|
224
|
+
dark?: ColorPalette;
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Typography configuration
|
|
228
|
+
*/
|
|
229
|
+
typography?: Typography;
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Spacing scale configuration
|
|
233
|
+
*/
|
|
234
|
+
spacing?: SpacingScale;
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Border radius configuration
|
|
238
|
+
*/
|
|
239
|
+
radius?: BorderRadius;
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Custom CSS variables
|
|
243
|
+
*/
|
|
244
|
+
cssVariables?: Record<string, string>;
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Tailwind configuration overrides
|
|
248
|
+
*/
|
|
249
|
+
tailwind?: Record<string, any>;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Theme Schema - Theme configuration and switching
|
|
254
|
+
*/
|
|
255
|
+
export interface ThemeSchema extends BaseSchema {
|
|
256
|
+
type: 'theme';
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Current theme mode
|
|
260
|
+
*/
|
|
261
|
+
mode?: ThemeMode;
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Available themes
|
|
265
|
+
*/
|
|
266
|
+
themes?: ThemeDefinition[];
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Active theme name
|
|
270
|
+
*/
|
|
271
|
+
activeTheme?: string;
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* Allow user theme switching
|
|
275
|
+
*/
|
|
276
|
+
allowSwitching?: boolean;
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Persist theme preference
|
|
280
|
+
*/
|
|
281
|
+
persistPreference?: boolean;
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* Storage key for persisting theme
|
|
285
|
+
*/
|
|
286
|
+
storageKey?: string;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* Theme Switcher Component Schema
|
|
291
|
+
*/
|
|
292
|
+
export interface ThemeSwitcherSchema extends BaseSchema {
|
|
293
|
+
type: 'theme-switcher';
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* Switcher variant
|
|
297
|
+
*/
|
|
298
|
+
variant?: 'dropdown' | 'toggle' | 'buttons';
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* Show mode selector (light/dark)
|
|
302
|
+
*/
|
|
303
|
+
showMode?: boolean;
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* Show theme selector
|
|
307
|
+
*/
|
|
308
|
+
showThemes?: boolean;
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Icon for light mode
|
|
312
|
+
*/
|
|
313
|
+
lightIcon?: string;
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* Icon for dark mode
|
|
317
|
+
*/
|
|
318
|
+
darkIcon?: string;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* Theme Preview Component Schema
|
|
323
|
+
*/
|
|
324
|
+
export interface ThemePreviewSchema extends BaseSchema {
|
|
325
|
+
type: 'theme-preview';
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* Theme to preview
|
|
329
|
+
*/
|
|
330
|
+
theme?: ThemeDefinition;
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* Preview mode
|
|
334
|
+
*/
|
|
335
|
+
mode?: ThemeMode;
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* Show color palette
|
|
339
|
+
*/
|
|
340
|
+
showColors?: boolean;
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* Show typography samples
|
|
344
|
+
*/
|
|
345
|
+
showTypography?: boolean;
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* Show component samples
|
|
349
|
+
*/
|
|
350
|
+
showComponents?: boolean;
|
|
351
|
+
}
|
package/src/ui-action.ts
ADDED
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ObjectUI
|
|
3
|
+
* Copyright (c) 2024-present ObjectStack Inc.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @object-ui/types - UI Action Schema
|
|
11
|
+
*
|
|
12
|
+
* ObjectStack Spec v0.7.1 compliant action schema with enhanced capabilities:
|
|
13
|
+
* - Location-based action placement
|
|
14
|
+
* - Parameter collection
|
|
15
|
+
* - Conditional visibility and enablement
|
|
16
|
+
* - Rich feedback mechanisms
|
|
17
|
+
*
|
|
18
|
+
* @module ui-action
|
|
19
|
+
* @packageDocumentation
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Field type for action parameters
|
|
24
|
+
* Simplified type definition for parameter inputs
|
|
25
|
+
*/
|
|
26
|
+
export type ActionParamFieldType =
|
|
27
|
+
| 'text'
|
|
28
|
+
| 'textarea'
|
|
29
|
+
| 'number'
|
|
30
|
+
| 'boolean'
|
|
31
|
+
| 'date'
|
|
32
|
+
| 'datetime'
|
|
33
|
+
| 'time'
|
|
34
|
+
| 'select'
|
|
35
|
+
| 'email'
|
|
36
|
+
| 'phone'
|
|
37
|
+
| 'url'
|
|
38
|
+
| 'password'
|
|
39
|
+
| 'file'
|
|
40
|
+
| 'color'
|
|
41
|
+
| 'slider'
|
|
42
|
+
| 'rating';
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Action placement locations (ObjectStack Spec v0.7.1)
|
|
46
|
+
*/
|
|
47
|
+
export type ActionLocation =
|
|
48
|
+
| 'list_toolbar' // Top toolbar in list views
|
|
49
|
+
| 'list_item' // Per-item actions in list
|
|
50
|
+
| 'record_header' // Header area of record detail
|
|
51
|
+
| 'record_more' // More menu in record detail
|
|
52
|
+
| 'record_related' // Related lists section
|
|
53
|
+
| 'global_nav'; // Global navigation bar
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Visual component type for actions (ObjectStack Spec v0.7.1)
|
|
57
|
+
*/
|
|
58
|
+
export type ActionComponent =
|
|
59
|
+
| 'action:button' // Standard button
|
|
60
|
+
| 'action:icon' // Icon-only button
|
|
61
|
+
| 'action:menu' // Menu item
|
|
62
|
+
| 'action:group'; // Action group/dropdown
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Action execution type (ObjectStack Spec v0.7.1)
|
|
66
|
+
*/
|
|
67
|
+
export type ActionType =
|
|
68
|
+
| 'script' // Execute JavaScript/expression
|
|
69
|
+
| 'url' // Navigate to URL
|
|
70
|
+
| 'modal' // Open modal dialog
|
|
71
|
+
| 'flow' // Start workflow/automation
|
|
72
|
+
| 'api'; // Call API endpoint
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Action parameter definition (ObjectStack Spec v0.7.1)
|
|
76
|
+
*/
|
|
77
|
+
export interface ActionParam {
|
|
78
|
+
/** Parameter name (snake_case) */
|
|
79
|
+
name: string;
|
|
80
|
+
|
|
81
|
+
/** Display label */
|
|
82
|
+
label: string;
|
|
83
|
+
|
|
84
|
+
/** Field type for input */
|
|
85
|
+
type: ActionParamFieldType;
|
|
86
|
+
|
|
87
|
+
/** Whether parameter is required */
|
|
88
|
+
required?: boolean;
|
|
89
|
+
|
|
90
|
+
/** Options for select/picklist types */
|
|
91
|
+
options?: Array<{ label: string; value: string }>;
|
|
92
|
+
|
|
93
|
+
/** Default value */
|
|
94
|
+
defaultValue?: unknown;
|
|
95
|
+
|
|
96
|
+
/** Help text */
|
|
97
|
+
helpText?: string;
|
|
98
|
+
|
|
99
|
+
/** Placeholder text */
|
|
100
|
+
placeholder?: string;
|
|
101
|
+
|
|
102
|
+
/** Validation expression */
|
|
103
|
+
validation?: string;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Enhanced Action Schema (ObjectStack Spec v0.7.1)
|
|
108
|
+
*
|
|
109
|
+
* This is the primary action schema that should be used for all new implementations.
|
|
110
|
+
* The legacy ActionSchema in crud.ts is maintained for backward compatibility.
|
|
111
|
+
*/
|
|
112
|
+
export interface ActionSchema {
|
|
113
|
+
/** Unique action identifier (snake_case) */
|
|
114
|
+
name: string;
|
|
115
|
+
|
|
116
|
+
/** Display label */
|
|
117
|
+
label: string;
|
|
118
|
+
|
|
119
|
+
/** Optional icon (Lucide icon name) */
|
|
120
|
+
icon?: string;
|
|
121
|
+
|
|
122
|
+
// === Placement ===
|
|
123
|
+
|
|
124
|
+
/** Where to show this action (defaults to ['record_header']) */
|
|
125
|
+
locations?: ActionLocation[];
|
|
126
|
+
|
|
127
|
+
/** Visual component type (defaults to 'action:button') */
|
|
128
|
+
component?: ActionComponent;
|
|
129
|
+
|
|
130
|
+
// === Behavior ===
|
|
131
|
+
|
|
132
|
+
/** Action execution type */
|
|
133
|
+
type: ActionType;
|
|
134
|
+
|
|
135
|
+
/** Target for the action (URL, script name, etc.) */
|
|
136
|
+
target?: string;
|
|
137
|
+
|
|
138
|
+
/** Script to execute (for type: 'script') */
|
|
139
|
+
execute?: string;
|
|
140
|
+
|
|
141
|
+
/** API endpoint (for type: 'api') */
|
|
142
|
+
endpoint?: string;
|
|
143
|
+
|
|
144
|
+
/** HTTP method (for type: 'api') */
|
|
145
|
+
method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
146
|
+
|
|
147
|
+
// === Parameters ===
|
|
148
|
+
|
|
149
|
+
/** Input parameters to collect before execution */
|
|
150
|
+
params?: ActionParam[];
|
|
151
|
+
|
|
152
|
+
// === Feedback ===
|
|
153
|
+
|
|
154
|
+
/** Confirmation text to show before execution */
|
|
155
|
+
confirmText?: string;
|
|
156
|
+
|
|
157
|
+
/** Success message to show after execution */
|
|
158
|
+
successMessage?: string;
|
|
159
|
+
|
|
160
|
+
/** Error message to show on failure */
|
|
161
|
+
errorMessage?: string;
|
|
162
|
+
|
|
163
|
+
/** Whether to refresh data after execution */
|
|
164
|
+
refreshAfter?: boolean;
|
|
165
|
+
|
|
166
|
+
/** Toast notification configuration */
|
|
167
|
+
toast?: {
|
|
168
|
+
/** Show toast on success */
|
|
169
|
+
showOnSuccess?: boolean;
|
|
170
|
+
|
|
171
|
+
/** Show toast on error */
|
|
172
|
+
showOnError?: boolean;
|
|
173
|
+
|
|
174
|
+
/** Toast duration in milliseconds */
|
|
175
|
+
duration?: number;
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
// === Conditional ===
|
|
179
|
+
|
|
180
|
+
/** Expression controlling visibility (e.g., "status === 'draft'") */
|
|
181
|
+
visible?: string;
|
|
182
|
+
|
|
183
|
+
/** Expression controlling enabled state (e.g., "hasPermission('edit')") */
|
|
184
|
+
enabled?: string;
|
|
185
|
+
|
|
186
|
+
// === Styling ===
|
|
187
|
+
|
|
188
|
+
/** Button variant */
|
|
189
|
+
variant?: 'default' | 'primary' | 'secondary' | 'destructive' | 'outline' | 'ghost';
|
|
190
|
+
|
|
191
|
+
/** Button size */
|
|
192
|
+
size?: 'sm' | 'md' | 'lg';
|
|
193
|
+
|
|
194
|
+
/** Custom CSS class */
|
|
195
|
+
className?: string;
|
|
196
|
+
|
|
197
|
+
// === Metadata ===
|
|
198
|
+
|
|
199
|
+
/** Action description */
|
|
200
|
+
description?: string;
|
|
201
|
+
|
|
202
|
+
/** Permission required to execute */
|
|
203
|
+
permission?: string;
|
|
204
|
+
|
|
205
|
+
/** Tags for categorization */
|
|
206
|
+
tags?: string[];
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Action group for organizing related actions
|
|
211
|
+
*/
|
|
212
|
+
export interface ActionGroup {
|
|
213
|
+
/** Group name */
|
|
214
|
+
name: string;
|
|
215
|
+
|
|
216
|
+
/** Display label */
|
|
217
|
+
label: string;
|
|
218
|
+
|
|
219
|
+
/** Optional icon */
|
|
220
|
+
icon?: string;
|
|
221
|
+
|
|
222
|
+
/** Actions in this group */
|
|
223
|
+
actions: ActionSchema[];
|
|
224
|
+
|
|
225
|
+
/** Group visibility condition */
|
|
226
|
+
visible?: string;
|
|
227
|
+
|
|
228
|
+
/** Display as dropdown or inline */
|
|
229
|
+
display?: 'dropdown' | 'inline';
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Action execution context
|
|
234
|
+
*/
|
|
235
|
+
export interface ActionContext {
|
|
236
|
+
/** Current record data */
|
|
237
|
+
record?: Record<string, any>;
|
|
238
|
+
|
|
239
|
+
/** Selected records (for list actions) */
|
|
240
|
+
selectedRecords?: Record<string, any>[];
|
|
241
|
+
|
|
242
|
+
/** Current user */
|
|
243
|
+
user?: Record<string, any>;
|
|
244
|
+
|
|
245
|
+
/** Additional context data */
|
|
246
|
+
[key: string]: any;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Action execution result
|
|
251
|
+
*/
|
|
252
|
+
export interface ActionResult {
|
|
253
|
+
/** Whether action succeeded */
|
|
254
|
+
success: boolean;
|
|
255
|
+
|
|
256
|
+
/** Result data */
|
|
257
|
+
data?: any;
|
|
258
|
+
|
|
259
|
+
/** Error message if failed */
|
|
260
|
+
error?: string;
|
|
261
|
+
|
|
262
|
+
/** Whether to refresh data */
|
|
263
|
+
refresh?: boolean;
|
|
264
|
+
|
|
265
|
+
/** Whether to close dialog/modal */
|
|
266
|
+
close?: boolean;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Action executor function type
|
|
271
|
+
*/
|
|
272
|
+
export type ActionExecutor = (
|
|
273
|
+
action: ActionSchema,
|
|
274
|
+
context: ActionContext,
|
|
275
|
+
params?: Record<string, any>
|
|
276
|
+
) => Promise<ActionResult>;
|