@object-ui/types 0.3.1 → 2.0.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 +1 -1
- package/dist/ai.d.ts +376 -0
- package/dist/ai.d.ts.map +1 -0
- package/dist/ai.js +8 -0
- package/dist/app.d.ts +10 -0
- package/dist/app.d.ts.map +1 -1
- package/dist/blocks.d.ts +332 -0
- package/dist/blocks.d.ts.map +1 -0
- package/dist/blocks.js +8 -0
- package/dist/crud.d.ts +177 -3
- package/dist/crud.d.ts.map +1 -1
- package/dist/data-display.d.ts +35 -0
- package/dist/data-display.d.ts.map +1 -1
- 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 +74 -1
- package/dist/data.d.ts.map +1 -1
- package/dist/designer.d.ts +473 -0
- package/dist/designer.d.ts.map +1 -0
- package/dist/designer.js +8 -0
- package/dist/field-types.d.ts +353 -11
- package/dist/field-types.d.ts.map +1 -1
- package/dist/form.d.ts +35 -1
- package/dist/form.d.ts.map +1 -1
- package/dist/index.d.ts +58 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -0
- package/dist/layout.d.ts +63 -8
- package/dist/layout.d.ts.map +1 -1
- package/dist/mobile.d.ts +186 -0
- package/dist/mobile.d.ts.map +1 -0
- package/dist/mobile.js +8 -0
- package/dist/objectql.d.ts +337 -89
- package/dist/objectql.d.ts.map +1 -1
- package/dist/permissions.d.ts +150 -0
- package/dist/permissions.d.ts.map +1 -0
- package/dist/permissions.js +8 -0
- 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/reports.d.ts +336 -0
- package/dist/reports.d.ts.map +1 -0
- package/dist/reports.js +8 -0
- package/dist/tenant.d.ts +138 -0
- package/dist/tenant.d.ts.map +1 -0
- package/dist/tenant.js +8 -0
- package/dist/theme.d.ts +180 -0
- package/dist/theme.d.ts.map +1 -0
- package/dist/theme.js +8 -0
- package/dist/ui-action.d.ts +290 -0
- package/dist/ui-action.d.ts.map +1 -0
- package/dist/ui-action.js +8 -0
- package/dist/views.d.ts +427 -0
- package/dist/views.d.ts.map +1 -0
- package/dist/views.js +8 -0
- package/dist/widget.d.ts +181 -0
- package/dist/widget.d.ts.map +1 -0
- package/dist/widget.js +8 -0
- package/dist/workflow.d.ts +340 -0
- package/dist/workflow.d.ts.map +1 -0
- package/dist/workflow.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/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 +4 -4
- package/dist/zod/complex.zod.js +1 -1
- 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.js +1 -1
- package/dist/zod/disclosure.zod.js +1 -1
- package/dist/zod/feedback.zod.d.ts +10 -10
- package/dist/zod/feedback.zod.js +1 -1
- package/dist/zod/form.zod.d.ts +4 -4
- package/dist/zod/form.zod.js +1 -1
- package/dist/zod/index.zod.d.ts +2032 -30
- package/dist/zod/index.zod.d.ts.map +1 -1
- package/dist/zod/index.zod.js +96 -19
- package/dist/zod/layout.zod.d.ts +134 -2
- package/dist/zod/layout.zod.d.ts.map +1 -1
- package/dist/zod/layout.zod.js +35 -1
- package/dist/zod/navigation.zod.js +1 -1
- package/dist/zod/objectql.zod.d.ts +34 -18
- package/dist/zod/objectql.zod.d.ts.map +1 -1
- package/dist/zod/objectql.zod.js +9 -1
- package/dist/zod/overlay.zod.js +1 -1
- 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 +1292 -0
- package/dist/zod/theme.zod.d.ts.map +1 -0
- package/dist/zod/theme.zod.js +260 -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 +3 -2
- package/src/__tests__/namespace-exports.test.ts +36 -0
- package/src/__tests__/phase2-schemas.test.ts +634 -0
- package/src/ai.ts +454 -0
- package/src/app.ts +12 -0
- package/src/blocks.ts +405 -0
- package/src/crud.ts +180 -3
- package/src/data-display.ts +31 -0
- package/src/data-protocol.ts +1679 -0
- package/src/data.ts +84 -1
- package/src/designer.ts +509 -0
- package/src/field-types.ts +392 -11
- package/src/form.ts +35 -1
- package/src/index.ts +426 -0
- package/src/layout.ts +66 -8
- package/src/mobile.ts +205 -0
- package/src/objectql.ts +412 -94
- package/src/permissions.ts +166 -0
- package/src/plugin-scope.ts +210 -0
- package/src/reports.ts +408 -0
- package/src/tenant.ts +153 -0
- package/src/theme.ts +238 -0
- package/src/ui-action.ts +415 -0
- package/src/views.ts +436 -0
- package/src/widget.ts +197 -0
- package/src/workflow.ts +409 -0
- package/src/zod/app.zod.ts +72 -0
- package/src/zod/blocks.zod.ts +170 -0
- package/src/zod/complex.zod.ts +1 -1
- package/src/zod/crud.zod.ts +259 -0
- package/src/zod/data-display.zod.ts +1 -1
- package/src/zod/disclosure.zod.ts +1 -1
- package/src/zod/feedback.zod.ts +1 -1
- package/src/zod/form.zod.ts +1 -1
- package/src/zod/index.zod.ts +178 -19
- package/src/zod/layout.zod.ts +39 -1
- package/src/zod/navigation.zod.ts +1 -1
- package/src/zod/objectql.zod.ts +9 -1
- package/src/zod/overlay.zod.ts +1 -1
- package/src/zod/reports.zod.ts +183 -0
- package/src/zod/theme.zod.ts +296 -0
- package/src/zod/views.zod.ts +182 -0
package/src/theme.ts
ADDED
|
@@ -0,0 +1,238 @@
|
|
|
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 aligned with @objectstack/spec.
|
|
13
|
+
* Provides the complete design token system: colors, typography,
|
|
14
|
+
* spacing, borders, shadows, breakpoints, animation, z-index.
|
|
15
|
+
*
|
|
16
|
+
* @module theme
|
|
17
|
+
* @packageDocumentation
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import type { BaseSchema } from './base';
|
|
21
|
+
|
|
22
|
+
// ============================================================================
|
|
23
|
+
// Spec-Canonical Theme Sub-types — imported from @objectstack/spec/ui
|
|
24
|
+
// Rule: "Never Redefine Types. ALWAYS import them."
|
|
25
|
+
// ============================================================================
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Color Palette Definition
|
|
29
|
+
* Canonical definition from @objectstack/spec/ui.
|
|
30
|
+
*/
|
|
31
|
+
export type { ColorPalette } from '@objectstack/spec/ui';
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Typography Configuration
|
|
35
|
+
* Canonical definition from @objectstack/spec/ui.
|
|
36
|
+
*/
|
|
37
|
+
export type { Typography } from '@objectstack/spec/ui';
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Spacing Scale Configuration
|
|
41
|
+
* Canonical definition from @objectstack/spec/ui.
|
|
42
|
+
*/
|
|
43
|
+
export type { Spacing } from '@objectstack/spec/ui';
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Border Radius Configuration
|
|
47
|
+
* Canonical definition from @objectstack/spec/ui.
|
|
48
|
+
*/
|
|
49
|
+
export type { BorderRadius } from '@objectstack/spec/ui';
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Shadow Configuration
|
|
53
|
+
* Canonical definition from @objectstack/spec/ui.
|
|
54
|
+
*/
|
|
55
|
+
export type { Shadow } from '@objectstack/spec/ui';
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Responsive Breakpoints Configuration
|
|
59
|
+
* Canonical definition from @objectstack/spec/ui.
|
|
60
|
+
*/
|
|
61
|
+
export type { Breakpoints } from '@objectstack/spec/ui';
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Animation Configuration
|
|
65
|
+
* Canonical definition from @objectstack/spec/ui.
|
|
66
|
+
*/
|
|
67
|
+
export type { Animation } from '@objectstack/spec/ui';
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Z-Index Layer Configuration
|
|
71
|
+
* Canonical definition from @objectstack/spec/ui.
|
|
72
|
+
*/
|
|
73
|
+
export type { ZIndex } from '@objectstack/spec/ui';
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Theme Mode
|
|
77
|
+
* Canonical definition from @objectstack/spec/ui.
|
|
78
|
+
*/
|
|
79
|
+
export type { ThemeMode } from '@objectstack/spec/ui';
|
|
80
|
+
|
|
81
|
+
// Import spec types for local use in interfaces below
|
|
82
|
+
import type {
|
|
83
|
+
ColorPalette,
|
|
84
|
+
Typography,
|
|
85
|
+
Spacing,
|
|
86
|
+
BorderRadius,
|
|
87
|
+
Shadow,
|
|
88
|
+
Breakpoints,
|
|
89
|
+
Animation,
|
|
90
|
+
ZIndex,
|
|
91
|
+
ThemeMode,
|
|
92
|
+
} from '@objectstack/spec/ui';
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Logo / Branding Assets
|
|
96
|
+
* ObjectUI-specific convenience type matching the inline logo object
|
|
97
|
+
* in @objectstack/spec ThemeSchema.
|
|
98
|
+
*/
|
|
99
|
+
export interface ThemeLogo {
|
|
100
|
+
/** Logo URL for light mode */
|
|
101
|
+
light?: string;
|
|
102
|
+
/** Logo URL for dark mode */
|
|
103
|
+
dark?: string;
|
|
104
|
+
/** Favicon URL */
|
|
105
|
+
favicon?: string;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Complete Theme Definition
|
|
110
|
+
* Compatible with @objectstack/spec Theme (input shape).
|
|
111
|
+
*
|
|
112
|
+
* Note: The spec's z.infer<Theme> has `mode` required (via ZodDefault).
|
|
113
|
+
* ObjectUI uses the input shape where `mode` is optional (defaults to 'auto').
|
|
114
|
+
*
|
|
115
|
+
* This is the canonical JSON shape for a theme.
|
|
116
|
+
* It can be serialized, stored, and applied at runtime via ThemeProvider.
|
|
117
|
+
*/
|
|
118
|
+
export interface Theme {
|
|
119
|
+
/** Theme identifier (required) */
|
|
120
|
+
name: string;
|
|
121
|
+
/** Display label (required) */
|
|
122
|
+
label: string;
|
|
123
|
+
/** Human-readable description */
|
|
124
|
+
description?: string;
|
|
125
|
+
/** Theme mode: light, dark, or auto (default: 'auto') */
|
|
126
|
+
mode?: ThemeMode;
|
|
127
|
+
/** Semantic color palette (primary is required) */
|
|
128
|
+
colors: ColorPalette;
|
|
129
|
+
/** Typography design tokens */
|
|
130
|
+
typography?: Typography;
|
|
131
|
+
/** Spacing scale */
|
|
132
|
+
spacing?: Spacing;
|
|
133
|
+
/** Border radius scale */
|
|
134
|
+
borderRadius?: BorderRadius;
|
|
135
|
+
/** Shadow scale */
|
|
136
|
+
shadows?: Shadow;
|
|
137
|
+
/** Responsive breakpoint definitions */
|
|
138
|
+
breakpoints?: Breakpoints;
|
|
139
|
+
/** Animation duration and timing */
|
|
140
|
+
animation?: Animation;
|
|
141
|
+
/** Z-index layering system */
|
|
142
|
+
zIndex?: ZIndex;
|
|
143
|
+
/** Arbitrary CSS custom properties */
|
|
144
|
+
customVars?: Record<string, string>;
|
|
145
|
+
/** Logo/branding assets */
|
|
146
|
+
logo?: ThemeLogo;
|
|
147
|
+
/** Extend another theme by name */
|
|
148
|
+
extends?: string;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// ============================================================================
|
|
152
|
+
// ObjectUI Component Schemas (UI rendering)
|
|
153
|
+
// ============================================================================
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Theme Component Schema
|
|
157
|
+
*
|
|
158
|
+
* Used by SchemaRenderer to render a theme manager component.
|
|
159
|
+
*/
|
|
160
|
+
export interface ThemeSchema extends BaseSchema {
|
|
161
|
+
type: 'theme';
|
|
162
|
+
|
|
163
|
+
/** Current theme mode */
|
|
164
|
+
mode?: ThemeMode;
|
|
165
|
+
|
|
166
|
+
/** Available themes */
|
|
167
|
+
themes?: Theme[];
|
|
168
|
+
|
|
169
|
+
/** Active theme name */
|
|
170
|
+
activeTheme?: string;
|
|
171
|
+
|
|
172
|
+
/** Allow user theme switching */
|
|
173
|
+
allowSwitching?: boolean;
|
|
174
|
+
|
|
175
|
+
/** Persist theme preference to storage */
|
|
176
|
+
persistPreference?: boolean;
|
|
177
|
+
|
|
178
|
+
/** Storage key for persisting theme */
|
|
179
|
+
storageKey?: string;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Theme Switcher Component Schema
|
|
184
|
+
*/
|
|
185
|
+
export interface ThemeSwitcherSchema extends BaseSchema {
|
|
186
|
+
type: 'theme-switcher';
|
|
187
|
+
|
|
188
|
+
/** Switcher variant */
|
|
189
|
+
variant?: 'dropdown' | 'toggle' | 'buttons';
|
|
190
|
+
|
|
191
|
+
/** Show mode selector (light/dark) */
|
|
192
|
+
showMode?: boolean;
|
|
193
|
+
|
|
194
|
+
/** Show theme selector */
|
|
195
|
+
showThemes?: boolean;
|
|
196
|
+
|
|
197
|
+
/** Icon for light mode */
|
|
198
|
+
lightIcon?: string;
|
|
199
|
+
|
|
200
|
+
/** Icon for dark mode */
|
|
201
|
+
darkIcon?: string;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Theme Preview Component Schema
|
|
206
|
+
*/
|
|
207
|
+
export interface ThemePreviewSchema extends BaseSchema {
|
|
208
|
+
type: 'theme-preview';
|
|
209
|
+
|
|
210
|
+
/** Theme to preview */
|
|
211
|
+
theme?: Theme;
|
|
212
|
+
|
|
213
|
+
/** Preview mode */
|
|
214
|
+
mode?: ThemeMode;
|
|
215
|
+
|
|
216
|
+
/** Show color palette */
|
|
217
|
+
showColors?: boolean;
|
|
218
|
+
|
|
219
|
+
/** Show typography samples */
|
|
220
|
+
showTypography?: boolean;
|
|
221
|
+
|
|
222
|
+
/** Show component samples */
|
|
223
|
+
showComponents?: boolean;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
// ============================================================================
|
|
227
|
+
// Legacy Aliases (Backward Compatibility)
|
|
228
|
+
// ============================================================================
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* @deprecated Use `Theme` instead. Kept for backward compatibility.
|
|
232
|
+
*/
|
|
233
|
+
export type ThemeDefinition = Theme;
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* @deprecated Use `Spacing` instead. Kept for backward compatibility.
|
|
237
|
+
*/
|
|
238
|
+
export type SpacingScale = Spacing;
|
package/src/ui-action.ts
ADDED
|
@@ -0,0 +1,415 @@
|
|
|
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 v2.0.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
|
+
// Spec-Canonical Action Sub-types — imported from @objectstack/spec/ui
|
|
24
|
+
// ============================================================================
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Action placement locations
|
|
28
|
+
* Canonical definition from @objectstack/spec/ui ActionSchema.locations.
|
|
29
|
+
*/
|
|
30
|
+
export type ActionLocation =
|
|
31
|
+
| 'list_toolbar' // Top toolbar in list views
|
|
32
|
+
| 'list_item' // Per-item actions in list
|
|
33
|
+
| 'record_header' // Header area of record detail
|
|
34
|
+
| 'record_more' // More menu in record detail
|
|
35
|
+
| 'record_related' // Related lists section
|
|
36
|
+
| 'global_nav'; // Global navigation bar
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Visual component type for actions
|
|
40
|
+
* Canonical definition from @objectstack/spec/ui ActionSchema.component.
|
|
41
|
+
*/
|
|
42
|
+
export type ActionComponent =
|
|
43
|
+
| 'action:button' // Standard button
|
|
44
|
+
| 'action:icon' // Icon-only button
|
|
45
|
+
| 'action:menu' // Menu item
|
|
46
|
+
| 'action:group'; // Action group/dropdown
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Action execution type
|
|
50
|
+
* Canonical definition from @objectstack/spec/ui ActionSchema.type.
|
|
51
|
+
*/
|
|
52
|
+
export type ActionType =
|
|
53
|
+
| 'script' // Execute JavaScript/expression
|
|
54
|
+
| 'url' // Navigate to URL
|
|
55
|
+
| 'modal' // Open modal dialog
|
|
56
|
+
| 'flow' // Start workflow/automation
|
|
57
|
+
| 'api'; // Call API endpoint
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Field type for action parameters
|
|
61
|
+
* Subset of field types commonly used in action parameter collection UIs.
|
|
62
|
+
* Aligned with the field types available in @objectstack/spec ActionParamSchema.
|
|
63
|
+
*/
|
|
64
|
+
export type ActionParamFieldType =
|
|
65
|
+
| 'text'
|
|
66
|
+
| 'textarea'
|
|
67
|
+
| 'number'
|
|
68
|
+
| 'boolean'
|
|
69
|
+
| 'date'
|
|
70
|
+
| 'datetime'
|
|
71
|
+
| 'time'
|
|
72
|
+
| 'select'
|
|
73
|
+
| 'email'
|
|
74
|
+
| 'phone'
|
|
75
|
+
| 'url'
|
|
76
|
+
| 'password'
|
|
77
|
+
| 'file'
|
|
78
|
+
| 'color'
|
|
79
|
+
| 'slider'
|
|
80
|
+
| 'rating';
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Action parameter definition (ObjectStack Spec v2.0.1)
|
|
84
|
+
*/
|
|
85
|
+
export interface ActionParam {
|
|
86
|
+
/** Parameter name (snake_case) */
|
|
87
|
+
name: string;
|
|
88
|
+
|
|
89
|
+
/** Display label */
|
|
90
|
+
label: string;
|
|
91
|
+
|
|
92
|
+
/** Field type for input */
|
|
93
|
+
type: ActionParamFieldType;
|
|
94
|
+
|
|
95
|
+
/** Whether parameter is required */
|
|
96
|
+
required?: boolean;
|
|
97
|
+
|
|
98
|
+
/** Options for select/picklist types */
|
|
99
|
+
options?: Array<{ label: string; value: string }>;
|
|
100
|
+
|
|
101
|
+
/** Default value */
|
|
102
|
+
defaultValue?: unknown;
|
|
103
|
+
|
|
104
|
+
/** Help text */
|
|
105
|
+
helpText?: string;
|
|
106
|
+
|
|
107
|
+
/** Placeholder text */
|
|
108
|
+
placeholder?: string;
|
|
109
|
+
|
|
110
|
+
/** Validation expression */
|
|
111
|
+
validation?: string;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Enhanced Action Schema (ObjectStack Spec v2.0.1)
|
|
116
|
+
*
|
|
117
|
+
* This is the primary action schema that should be used for all new implementations.
|
|
118
|
+
* The legacy ActionSchema in crud.ts is maintained for backward compatibility.
|
|
119
|
+
*/
|
|
120
|
+
export interface ActionSchema {
|
|
121
|
+
/** Unique action identifier (snake_case) */
|
|
122
|
+
name: string;
|
|
123
|
+
|
|
124
|
+
/** Display label */
|
|
125
|
+
label: string;
|
|
126
|
+
|
|
127
|
+
/** Optional icon (Lucide icon name) */
|
|
128
|
+
icon?: string;
|
|
129
|
+
|
|
130
|
+
// === Placement ===
|
|
131
|
+
|
|
132
|
+
/** Where to show this action (defaults to ['record_header']) */
|
|
133
|
+
locations?: ActionLocation[];
|
|
134
|
+
|
|
135
|
+
/** Visual component type (defaults to 'action:button') */
|
|
136
|
+
component?: ActionComponent;
|
|
137
|
+
|
|
138
|
+
// === Behavior ===
|
|
139
|
+
|
|
140
|
+
/** Action execution type */
|
|
141
|
+
type: ActionType;
|
|
142
|
+
|
|
143
|
+
/** Target for the action (URL, script name, etc.) */
|
|
144
|
+
target?: string;
|
|
145
|
+
|
|
146
|
+
/** Script to execute (for type: 'script') */
|
|
147
|
+
execute?: string;
|
|
148
|
+
|
|
149
|
+
/** API endpoint (for type: 'api') */
|
|
150
|
+
endpoint?: string;
|
|
151
|
+
|
|
152
|
+
/** HTTP method (for type: 'api') */
|
|
153
|
+
method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
154
|
+
|
|
155
|
+
// === Parameters ===
|
|
156
|
+
|
|
157
|
+
/** Input parameters to collect before execution */
|
|
158
|
+
params?: ActionParam[];
|
|
159
|
+
|
|
160
|
+
// === Feedback ===
|
|
161
|
+
|
|
162
|
+
/** Confirmation text to show before execution */
|
|
163
|
+
confirmText?: string;
|
|
164
|
+
|
|
165
|
+
/** Success message to show after execution */
|
|
166
|
+
successMessage?: string;
|
|
167
|
+
|
|
168
|
+
/** Error message to show on failure */
|
|
169
|
+
errorMessage?: string;
|
|
170
|
+
|
|
171
|
+
/** Whether to refresh data after execution */
|
|
172
|
+
refreshAfter?: boolean;
|
|
173
|
+
|
|
174
|
+
/** Toast notification configuration */
|
|
175
|
+
toast?: {
|
|
176
|
+
/** Show toast on success */
|
|
177
|
+
showOnSuccess?: boolean;
|
|
178
|
+
|
|
179
|
+
/** Show toast on error */
|
|
180
|
+
showOnError?: boolean;
|
|
181
|
+
|
|
182
|
+
/** Toast duration in milliseconds */
|
|
183
|
+
duration?: number;
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
// === Conditional ===
|
|
187
|
+
|
|
188
|
+
/** Expression controlling visibility (e.g., "status === 'draft'") */
|
|
189
|
+
visible?: string;
|
|
190
|
+
|
|
191
|
+
/** Expression controlling enabled state (e.g., "hasPermission('edit')") */
|
|
192
|
+
enabled?: string;
|
|
193
|
+
|
|
194
|
+
// === Styling ===
|
|
195
|
+
|
|
196
|
+
/** Button variant */
|
|
197
|
+
variant?: 'default' | 'primary' | 'secondary' | 'destructive' | 'outline' | 'ghost';
|
|
198
|
+
|
|
199
|
+
/** Button size */
|
|
200
|
+
size?: 'sm' | 'md' | 'lg';
|
|
201
|
+
|
|
202
|
+
/** Custom CSS class */
|
|
203
|
+
className?: string;
|
|
204
|
+
|
|
205
|
+
// === Metadata ===
|
|
206
|
+
|
|
207
|
+
/** Action description */
|
|
208
|
+
description?: string;
|
|
209
|
+
|
|
210
|
+
/** Permission required to execute */
|
|
211
|
+
permission?: string;
|
|
212
|
+
|
|
213
|
+
/** Tags for categorization */
|
|
214
|
+
tags?: string[];
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Action group for organizing related actions
|
|
219
|
+
*/
|
|
220
|
+
export interface ActionGroup {
|
|
221
|
+
/** Group name */
|
|
222
|
+
name: string;
|
|
223
|
+
|
|
224
|
+
/** Display label */
|
|
225
|
+
label: string;
|
|
226
|
+
|
|
227
|
+
/** Optional icon */
|
|
228
|
+
icon?: string;
|
|
229
|
+
|
|
230
|
+
/** Actions in this group */
|
|
231
|
+
actions: ActionSchema[];
|
|
232
|
+
|
|
233
|
+
/** Group visibility condition */
|
|
234
|
+
visible?: string;
|
|
235
|
+
|
|
236
|
+
/** Display as dropdown or inline */
|
|
237
|
+
display?: 'dropdown' | 'inline';
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Action execution context
|
|
242
|
+
*/
|
|
243
|
+
export interface ActionContext {
|
|
244
|
+
/** Current record data */
|
|
245
|
+
record?: Record<string, any>;
|
|
246
|
+
|
|
247
|
+
/** Selected records (for list actions) */
|
|
248
|
+
selectedRecords?: Record<string, any>[];
|
|
249
|
+
|
|
250
|
+
/** Current user */
|
|
251
|
+
user?: Record<string, any>;
|
|
252
|
+
|
|
253
|
+
/** Additional context data */
|
|
254
|
+
[key: string]: any;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Action execution result
|
|
259
|
+
*/
|
|
260
|
+
export interface ActionResult {
|
|
261
|
+
/** Whether action succeeded */
|
|
262
|
+
success: boolean;
|
|
263
|
+
|
|
264
|
+
/** Result data */
|
|
265
|
+
data?: any;
|
|
266
|
+
|
|
267
|
+
/** Error message if failed */
|
|
268
|
+
error?: string;
|
|
269
|
+
|
|
270
|
+
/** Whether to refresh data */
|
|
271
|
+
refresh?: boolean;
|
|
272
|
+
|
|
273
|
+
/** Whether to close dialog/modal */
|
|
274
|
+
close?: boolean;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Action executor function type
|
|
279
|
+
*/
|
|
280
|
+
export type ActionExecutor = (
|
|
281
|
+
action: ActionSchema,
|
|
282
|
+
context: ActionContext,
|
|
283
|
+
params?: Record<string, any>
|
|
284
|
+
) => Promise<ActionResult>;
|
|
285
|
+
|
|
286
|
+
// ============================================================================
|
|
287
|
+
// Batch Operations (Q2 2026 - Spec v2.0.1 Enhancement)
|
|
288
|
+
// ============================================================================
|
|
289
|
+
|
|
290
|
+
/** Batch operation configuration */
|
|
291
|
+
export interface BatchOperationConfig {
|
|
292
|
+
/** Operation name */
|
|
293
|
+
name: string;
|
|
294
|
+
/** Display label */
|
|
295
|
+
label: string;
|
|
296
|
+
/** Target action to execute on each record */
|
|
297
|
+
action: string;
|
|
298
|
+
/** Whether to run in parallel */
|
|
299
|
+
parallel?: boolean;
|
|
300
|
+
/** Maximum concurrent operations */
|
|
301
|
+
concurrency?: number;
|
|
302
|
+
/** Whether to continue on error */
|
|
303
|
+
continueOnError?: boolean;
|
|
304
|
+
/** Progress callback expression */
|
|
305
|
+
onProgress?: string;
|
|
306
|
+
/** Completion callback expression */
|
|
307
|
+
onComplete?: string;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/** Batch operation result */
|
|
311
|
+
export interface BatchOperationResult {
|
|
312
|
+
/** Total items processed */
|
|
313
|
+
total: number;
|
|
314
|
+
/** Successfully processed count */
|
|
315
|
+
succeeded: number;
|
|
316
|
+
/** Failed count */
|
|
317
|
+
failed: number;
|
|
318
|
+
/** Individual results */
|
|
319
|
+
results: Array<{
|
|
320
|
+
recordId: string;
|
|
321
|
+
success: boolean;
|
|
322
|
+
error?: string;
|
|
323
|
+
}>;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
// ============================================================================
|
|
327
|
+
// Transaction Support (Q2 2026 - Spec v2.0.1 Enhancement)
|
|
328
|
+
// ============================================================================
|
|
329
|
+
|
|
330
|
+
/** Transaction isolation level */
|
|
331
|
+
export type TransactionIsolationLevel = 'read-uncommitted' | 'read-committed' | 'repeatable-read' | 'serializable';
|
|
332
|
+
|
|
333
|
+
/** Transaction configuration */
|
|
334
|
+
export interface TransactionConfig {
|
|
335
|
+
/** Transaction name for identification */
|
|
336
|
+
name?: string;
|
|
337
|
+
/** Isolation level */
|
|
338
|
+
isolation?: TransactionIsolationLevel;
|
|
339
|
+
/** Timeout in milliseconds */
|
|
340
|
+
timeout?: number;
|
|
341
|
+
/** Actions to execute within the transaction */
|
|
342
|
+
actions: ActionSchema[];
|
|
343
|
+
/** Rollback action on failure */
|
|
344
|
+
rollbackAction?: string;
|
|
345
|
+
/** Whether to auto-retry on conflict */
|
|
346
|
+
retryOnConflict?: boolean;
|
|
347
|
+
/** Maximum retry attempts */
|
|
348
|
+
maxRetries?: number;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
/** Transaction result */
|
|
352
|
+
export interface TransactionResult {
|
|
353
|
+
/** Whether all actions succeeded */
|
|
354
|
+
success: boolean;
|
|
355
|
+
/** Transaction ID */
|
|
356
|
+
transactionId: string;
|
|
357
|
+
/** Individual action results */
|
|
358
|
+
actionResults: ActionResult[];
|
|
359
|
+
/** Error if transaction failed */
|
|
360
|
+
error?: string;
|
|
361
|
+
/** Whether the transaction was rolled back */
|
|
362
|
+
rolledBack?: boolean;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
// ============================================================================
|
|
366
|
+
// Undo/Redo Support (Q2 2026 - Spec v2.0.1 Enhancement)
|
|
367
|
+
// ============================================================================
|
|
368
|
+
|
|
369
|
+
/** Undo/redo operation entry */
|
|
370
|
+
export interface UndoRedoEntry {
|
|
371
|
+
/** Entry identifier */
|
|
372
|
+
id: string;
|
|
373
|
+
/** Action that was performed */
|
|
374
|
+
action: string;
|
|
375
|
+
/** Description of the action */
|
|
376
|
+
description: string;
|
|
377
|
+
/** Timestamp */
|
|
378
|
+
timestamp: string;
|
|
379
|
+
/** Data before the action (for undo) */
|
|
380
|
+
previousState: Record<string, unknown>;
|
|
381
|
+
/** Data after the action (for redo) */
|
|
382
|
+
nextState: Record<string, unknown>;
|
|
383
|
+
/** Target object */
|
|
384
|
+
object?: string;
|
|
385
|
+
/** Target record ID */
|
|
386
|
+
recordId?: string;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
/** Undo/redo configuration */
|
|
390
|
+
export interface UndoRedoConfig {
|
|
391
|
+
/** Enable undo/redo */
|
|
392
|
+
enabled: boolean;
|
|
393
|
+
/** Maximum history size */
|
|
394
|
+
maxHistorySize?: number;
|
|
395
|
+
/** Actions that support undo */
|
|
396
|
+
undoableActions?: string[];
|
|
397
|
+
/** Whether to group rapid changes */
|
|
398
|
+
groupChanges?: boolean;
|
|
399
|
+
/** Group timeout in milliseconds */
|
|
400
|
+
groupTimeout?: number;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
/** Undo/redo state */
|
|
404
|
+
export interface UndoRedoState {
|
|
405
|
+
/** Whether undo is available */
|
|
406
|
+
canUndo: boolean;
|
|
407
|
+
/** Whether redo is available */
|
|
408
|
+
canRedo: boolean;
|
|
409
|
+
/** Undo stack */
|
|
410
|
+
undoStack: UndoRedoEntry[];
|
|
411
|
+
/** Redo stack */
|
|
412
|
+
redoStack: UndoRedoEntry[];
|
|
413
|
+
/** Current position in history */
|
|
414
|
+
currentIndex: number;
|
|
415
|
+
}
|