@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.
Files changed (141) hide show
  1. package/README.md +1 -1
  2. package/dist/ai.d.ts +376 -0
  3. package/dist/ai.d.ts.map +1 -0
  4. package/dist/ai.js +8 -0
  5. package/dist/app.d.ts +10 -0
  6. package/dist/app.d.ts.map +1 -1
  7. package/dist/blocks.d.ts +332 -0
  8. package/dist/blocks.d.ts.map +1 -0
  9. package/dist/blocks.js +8 -0
  10. package/dist/crud.d.ts +177 -3
  11. package/dist/crud.d.ts.map +1 -1
  12. package/dist/data-display.d.ts +35 -0
  13. package/dist/data-display.d.ts.map +1 -1
  14. package/dist/data-protocol.d.ts +1268 -0
  15. package/dist/data-protocol.d.ts.map +1 -0
  16. package/dist/data-protocol.js +8 -0
  17. package/dist/data.d.ts +74 -1
  18. package/dist/data.d.ts.map +1 -1
  19. package/dist/designer.d.ts +473 -0
  20. package/dist/designer.d.ts.map +1 -0
  21. package/dist/designer.js +8 -0
  22. package/dist/field-types.d.ts +353 -11
  23. package/dist/field-types.d.ts.map +1 -1
  24. package/dist/form.d.ts +35 -1
  25. package/dist/form.d.ts.map +1 -1
  26. package/dist/index.d.ts +58 -4
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.js +18 -0
  29. package/dist/layout.d.ts +63 -8
  30. package/dist/layout.d.ts.map +1 -1
  31. package/dist/mobile.d.ts +186 -0
  32. package/dist/mobile.d.ts.map +1 -0
  33. package/dist/mobile.js +8 -0
  34. package/dist/objectql.d.ts +337 -89
  35. package/dist/objectql.d.ts.map +1 -1
  36. package/dist/permissions.d.ts +150 -0
  37. package/dist/permissions.d.ts.map +1 -0
  38. package/dist/permissions.js +8 -0
  39. package/dist/plugin-scope.d.ts +194 -0
  40. package/dist/plugin-scope.d.ts.map +1 -0
  41. package/dist/plugin-scope.js +8 -0
  42. package/dist/reports.d.ts +336 -0
  43. package/dist/reports.d.ts.map +1 -0
  44. package/dist/reports.js +8 -0
  45. package/dist/tenant.d.ts +138 -0
  46. package/dist/tenant.d.ts.map +1 -0
  47. package/dist/tenant.js +8 -0
  48. package/dist/theme.d.ts +180 -0
  49. package/dist/theme.d.ts.map +1 -0
  50. package/dist/theme.js +8 -0
  51. package/dist/ui-action.d.ts +290 -0
  52. package/dist/ui-action.d.ts.map +1 -0
  53. package/dist/ui-action.js +8 -0
  54. package/dist/views.d.ts +427 -0
  55. package/dist/views.d.ts.map +1 -0
  56. package/dist/views.js +8 -0
  57. package/dist/widget.d.ts +181 -0
  58. package/dist/widget.d.ts.map +1 -0
  59. package/dist/widget.js +8 -0
  60. package/dist/workflow.d.ts +340 -0
  61. package/dist/workflow.d.ts.map +1 -0
  62. package/dist/workflow.js +8 -0
  63. package/dist/zod/app.zod.d.ts +120 -0
  64. package/dist/zod/app.zod.d.ts.map +1 -0
  65. package/dist/zod/app.zod.js +60 -0
  66. package/dist/zod/blocks.zod.d.ts +834 -0
  67. package/dist/zod/blocks.zod.d.ts.map +1 -0
  68. package/dist/zod/blocks.zod.js +145 -0
  69. package/dist/zod/complex.zod.d.ts +4 -4
  70. package/dist/zod/complex.zod.js +1 -1
  71. package/dist/zod/crud.zod.d.ts +598 -0
  72. package/dist/zod/crud.zod.d.ts.map +1 -0
  73. package/dist/zod/crud.zod.js +230 -0
  74. package/dist/zod/data-display.zod.js +1 -1
  75. package/dist/zod/disclosure.zod.js +1 -1
  76. package/dist/zod/feedback.zod.d.ts +10 -10
  77. package/dist/zod/feedback.zod.js +1 -1
  78. package/dist/zod/form.zod.d.ts +4 -4
  79. package/dist/zod/form.zod.js +1 -1
  80. package/dist/zod/index.zod.d.ts +2032 -30
  81. package/dist/zod/index.zod.d.ts.map +1 -1
  82. package/dist/zod/index.zod.js +96 -19
  83. package/dist/zod/layout.zod.d.ts +134 -2
  84. package/dist/zod/layout.zod.d.ts.map +1 -1
  85. package/dist/zod/layout.zod.js +35 -1
  86. package/dist/zod/navigation.zod.js +1 -1
  87. package/dist/zod/objectql.zod.d.ts +34 -18
  88. package/dist/zod/objectql.zod.d.ts.map +1 -1
  89. package/dist/zod/objectql.zod.js +9 -1
  90. package/dist/zod/overlay.zod.js +1 -1
  91. package/dist/zod/reports.zod.d.ts +1628 -0
  92. package/dist/zod/reports.zod.d.ts.map +1 -0
  93. package/dist/zod/reports.zod.js +152 -0
  94. package/dist/zod/theme.zod.d.ts +1292 -0
  95. package/dist/zod/theme.zod.d.ts.map +1 -0
  96. package/dist/zod/theme.zod.js +260 -0
  97. package/dist/zod/views.zod.d.ts +675 -0
  98. package/dist/zod/views.zod.d.ts.map +1 -0
  99. package/dist/zod/views.zod.js +159 -0
  100. package/package.json +3 -2
  101. package/src/__tests__/namespace-exports.test.ts +36 -0
  102. package/src/__tests__/phase2-schemas.test.ts +634 -0
  103. package/src/ai.ts +454 -0
  104. package/src/app.ts +12 -0
  105. package/src/blocks.ts +405 -0
  106. package/src/crud.ts +180 -3
  107. package/src/data-display.ts +31 -0
  108. package/src/data-protocol.ts +1679 -0
  109. package/src/data.ts +84 -1
  110. package/src/designer.ts +509 -0
  111. package/src/field-types.ts +392 -11
  112. package/src/form.ts +35 -1
  113. package/src/index.ts +426 -0
  114. package/src/layout.ts +66 -8
  115. package/src/mobile.ts +205 -0
  116. package/src/objectql.ts +412 -94
  117. package/src/permissions.ts +166 -0
  118. package/src/plugin-scope.ts +210 -0
  119. package/src/reports.ts +408 -0
  120. package/src/tenant.ts +153 -0
  121. package/src/theme.ts +238 -0
  122. package/src/ui-action.ts +415 -0
  123. package/src/views.ts +436 -0
  124. package/src/widget.ts +197 -0
  125. package/src/workflow.ts +409 -0
  126. package/src/zod/app.zod.ts +72 -0
  127. package/src/zod/blocks.zod.ts +170 -0
  128. package/src/zod/complex.zod.ts +1 -1
  129. package/src/zod/crud.zod.ts +259 -0
  130. package/src/zod/data-display.zod.ts +1 -1
  131. package/src/zod/disclosure.zod.ts +1 -1
  132. package/src/zod/feedback.zod.ts +1 -1
  133. package/src/zod/form.zod.ts +1 -1
  134. package/src/zod/index.zod.ts +178 -19
  135. package/src/zod/layout.zod.ts +39 -1
  136. package/src/zod/navigation.zod.ts +1 -1
  137. package/src/zod/objectql.zod.ts +9 -1
  138. package/src/zod/overlay.zod.ts +1 -1
  139. package/src/zod/reports.zod.ts +183 -0
  140. package/src/zod/theme.zod.ts +296 -0
  141. package/src/zod/views.zod.ts +182 -0
@@ -0,0 +1,427 @@
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
+ * @object-ui/types - View Component Schemas
10
+ *
11
+ * Type definitions for various view components (List, Detail, Grid, Kanban, Calendar).
12
+ * These schemas enable building different data visualization interfaces.
13
+ *
14
+ * @module views
15
+ * @packageDocumentation
16
+ */
17
+ import type { BaseSchema, SchemaNode } from './base';
18
+ import type { ActionSchema } from './crud';
19
+ import type { TableColumn } from './data-display';
20
+ /**
21
+ * View Type
22
+ */
23
+ export type ViewType = 'list' | 'detail' | 'grid' | 'kanban' | 'calendar' | 'timeline' | 'map';
24
+ /**
25
+ * Detail View Field Configuration
26
+ */
27
+ export interface DetailViewField {
28
+ /**
29
+ * Field name/path
30
+ */
31
+ name: string;
32
+ /**
33
+ * Display label
34
+ */
35
+ label?: string;
36
+ /**
37
+ * Field type for rendering
38
+ */
39
+ type?: 'text' | 'image' | 'link' | 'badge' | 'date' | 'datetime' | 'json' | 'html' | 'markdown' | 'custom';
40
+ /**
41
+ * Format string (e.g., date format)
42
+ */
43
+ format?: string;
44
+ /**
45
+ * Custom renderer
46
+ */
47
+ render?: SchemaNode;
48
+ /**
49
+ * Field value
50
+ */
51
+ value?: any;
52
+ /**
53
+ * Whether field is read-only
54
+ */
55
+ readonly?: boolean;
56
+ /**
57
+ * Field visibility condition
58
+ */
59
+ visible?: boolean | string;
60
+ /**
61
+ * Span across columns (for grid layout)
62
+ */
63
+ span?: number;
64
+ }
65
+ /**
66
+ * Detail View Section/Group
67
+ */
68
+ export interface DetailViewSection {
69
+ /**
70
+ * Section title
71
+ */
72
+ title?: string;
73
+ /**
74
+ * Section description
75
+ */
76
+ description?: string;
77
+ /**
78
+ * Section icon
79
+ */
80
+ icon?: string;
81
+ /**
82
+ * Fields in this section
83
+ */
84
+ fields: DetailViewField[];
85
+ /**
86
+ * Collapsible section
87
+ */
88
+ collapsible?: boolean;
89
+ /**
90
+ * Default collapsed state
91
+ */
92
+ defaultCollapsed?: boolean;
93
+ /**
94
+ * Grid columns for field layout
95
+ */
96
+ columns?: number;
97
+ /**
98
+ * Section visibility condition
99
+ */
100
+ visible?: boolean | string;
101
+ }
102
+ /**
103
+ * Detail View Tab
104
+ */
105
+ export interface DetailViewTab {
106
+ /**
107
+ * Tab key/identifier
108
+ */
109
+ key: string;
110
+ /**
111
+ * Tab label
112
+ */
113
+ label: string;
114
+ /**
115
+ * Tab icon
116
+ */
117
+ icon?: string;
118
+ /**
119
+ * Tab content
120
+ */
121
+ content: SchemaNode | SchemaNode[];
122
+ /**
123
+ * Tab visibility condition
124
+ */
125
+ visible?: boolean | string;
126
+ /**
127
+ * Badge count
128
+ */
129
+ badge?: string | number;
130
+ }
131
+ /**
132
+ * Detail View Schema - Display detailed information about a single record
133
+ * Enhanced in Phase 2 with better organization and features
134
+ */
135
+ export interface DetailViewSchema extends BaseSchema {
136
+ type: 'detail-view';
137
+ /**
138
+ * Detail title
139
+ */
140
+ title?: string;
141
+ /**
142
+ * API endpoint to fetch detail data
143
+ */
144
+ api?: string;
145
+ /**
146
+ * Resource ID to display
147
+ */
148
+ resourceId?: string | number;
149
+ /**
150
+ * Object name (for ObjectQL integration)
151
+ */
152
+ objectName?: string;
153
+ /**
154
+ * Data to display (if not fetching from API)
155
+ */
156
+ data?: any;
157
+ /**
158
+ * Layout mode
159
+ */
160
+ layout?: 'vertical' | 'horizontal' | 'grid';
161
+ /**
162
+ * Grid columns (for grid layout)
163
+ */
164
+ columns?: number;
165
+ /**
166
+ * Field sections for organized display
167
+ */
168
+ sections?: DetailViewSection[];
169
+ /**
170
+ * Direct fields (without sections)
171
+ */
172
+ fields?: DetailViewField[];
173
+ /**
174
+ * Actions available in detail view
175
+ */
176
+ actions?: ActionSchema[];
177
+ /**
178
+ * Tabs for additional content
179
+ */
180
+ tabs?: DetailViewTab[];
181
+ /**
182
+ * Show back button
183
+ * @default true
184
+ */
185
+ showBack?: boolean;
186
+ /**
187
+ * Back button URL
188
+ */
189
+ backUrl?: string;
190
+ /**
191
+ * Custom back action
192
+ */
193
+ onBack?: string;
194
+ /**
195
+ * Show edit button
196
+ */
197
+ showEdit?: boolean;
198
+ /**
199
+ * Edit button URL
200
+ */
201
+ editUrl?: string;
202
+ /**
203
+ * Show delete button
204
+ */
205
+ showDelete?: boolean;
206
+ /**
207
+ * Delete confirmation message
208
+ */
209
+ deleteConfirmation?: string;
210
+ /**
211
+ * Whether to show loading state
212
+ * @default true
213
+ */
214
+ loading?: boolean;
215
+ /**
216
+ * Custom header content
217
+ */
218
+ header?: SchemaNode;
219
+ /**
220
+ * Custom footer content
221
+ */
222
+ footer?: SchemaNode;
223
+ /**
224
+ * Navigation handler for SPA-aware routing.
225
+ * Called instead of window.location.href for back/edit navigation.
226
+ * @param url - The URL to navigate to
227
+ * @param options - Navigation options (replace, newTab, etc.)
228
+ */
229
+ onNavigate?: (url: string, options?: {
230
+ replace?: boolean;
231
+ newTab?: boolean;
232
+ }) => void;
233
+ /**
234
+ * Related records section
235
+ */
236
+ related?: Array<{
237
+ /**
238
+ * Relation title
239
+ */
240
+ title: string;
241
+ /**
242
+ * Relation type
243
+ */
244
+ type: 'list' | 'grid' | 'table';
245
+ /**
246
+ * API endpoint for related data
247
+ */
248
+ api?: string;
249
+ /**
250
+ * Static data
251
+ */
252
+ data?: any[];
253
+ /**
254
+ * Columns for table view
255
+ */
256
+ columns?: TableColumn[];
257
+ /**
258
+ * Fields for list view
259
+ */
260
+ fields?: string[];
261
+ }>;
262
+ }
263
+ /**
264
+ * View Switcher Schema - Toggle between different view modes
265
+ * New in Phase 2
266
+ */
267
+ export interface ViewSwitcherSchema extends BaseSchema {
268
+ type: 'view-switcher';
269
+ /**
270
+ * Available view types
271
+ */
272
+ views: Array<{
273
+ /**
274
+ * View type
275
+ */
276
+ type: ViewType;
277
+ /**
278
+ * View label
279
+ */
280
+ label?: string;
281
+ /**
282
+ * View icon
283
+ */
284
+ icon?: string;
285
+ /**
286
+ * View schema
287
+ */
288
+ schema?: SchemaNode;
289
+ }>;
290
+ /**
291
+ * Default/active view
292
+ */
293
+ defaultView?: ViewType;
294
+ /**
295
+ * Current active view
296
+ */
297
+ activeView?: ViewType;
298
+ /**
299
+ * Switcher variant
300
+ */
301
+ variant?: 'tabs' | 'buttons' | 'dropdown';
302
+ /**
303
+ * Switcher position
304
+ */
305
+ position?: 'top' | 'bottom' | 'left' | 'right';
306
+ /**
307
+ * View change callback
308
+ */
309
+ onViewChange?: string;
310
+ /**
311
+ * Persist view preference
312
+ */
313
+ persistPreference?: boolean;
314
+ /**
315
+ * Storage key for persisting view
316
+ */
317
+ storageKey?: string;
318
+ }
319
+ /**
320
+ * Filter UI Schema - Enhanced filter interface
321
+ * New in Phase 2
322
+ */
323
+ export interface FilterUISchema extends BaseSchema {
324
+ type: 'filter-ui';
325
+ /**
326
+ * Available filters
327
+ */
328
+ filters: Array<{
329
+ /**
330
+ * Filter field
331
+ */
332
+ field: string;
333
+ /**
334
+ * Filter label
335
+ */
336
+ label?: string;
337
+ /**
338
+ * Filter type
339
+ */
340
+ type: 'text' | 'number' | 'select' | 'date' | 'date-range' | 'boolean';
341
+ /**
342
+ * Filter operator
343
+ */
344
+ operator?: 'equals' | 'contains' | 'startsWith' | 'gt' | 'lt' | 'between' | 'in';
345
+ /**
346
+ * Options for select filter
347
+ */
348
+ options?: Array<{
349
+ label: string;
350
+ value: any;
351
+ }>;
352
+ /**
353
+ * Placeholder
354
+ */
355
+ placeholder?: string;
356
+ }>;
357
+ /**
358
+ * Current filter values
359
+ */
360
+ values?: Record<string, any>;
361
+ /**
362
+ * Filter change callback
363
+ */
364
+ onChange?: string;
365
+ /**
366
+ * Show clear button
367
+ */
368
+ showClear?: boolean;
369
+ /**
370
+ * Show apply button
371
+ */
372
+ showApply?: boolean;
373
+ /**
374
+ * Filter layout
375
+ */
376
+ layout?: 'inline' | 'popover' | 'drawer';
377
+ }
378
+ /**
379
+ * Sort UI Schema - Enhanced sort interface
380
+ * New in Phase 2
381
+ */
382
+ export interface SortUISchema extends BaseSchema {
383
+ type: 'sort-ui';
384
+ /**
385
+ * Sortable fields
386
+ */
387
+ fields: Array<{
388
+ /**
389
+ * Field name
390
+ */
391
+ field: string;
392
+ /**
393
+ * Field label
394
+ */
395
+ label?: string;
396
+ }>;
397
+ /**
398
+ * Current sort configuration
399
+ */
400
+ sort?: Array<{
401
+ /**
402
+ * Field to sort by
403
+ */
404
+ field: string;
405
+ /**
406
+ * Sort direction
407
+ */
408
+ direction: 'asc' | 'desc';
409
+ }>;
410
+ /**
411
+ * Sort change callback
412
+ */
413
+ onChange?: string;
414
+ /**
415
+ * Allow multiple sort fields
416
+ */
417
+ multiple?: boolean;
418
+ /**
419
+ * UI variant
420
+ */
421
+ variant?: 'dropdown' | 'buttons';
422
+ }
423
+ /**
424
+ * Union type of all view schemas
425
+ */
426
+ export type ViewComponentSchema = DetailViewSchema | ViewSwitcherSchema | FilterUISchema | SortUISchema;
427
+ //# sourceMappingURL=views.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"views.d.ts","sourceRoot":"","sources":["../src/views.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAC3C,OAAO,KAAK,EAAE,WAAW,EAAE,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G,QAAQ,CAAC;CAC1C;AAED;;;GAGG;AACH,MAAM,WAAW,YAAa,SAAQ,UAAU;IAC9C,IAAI,EAAE,SAAS,CAAC;IAChB;;OAEG;IACH,MAAM,EAAE,KAAK,CAAC;QACZ;;WAEG;QACH,KAAK,EAAE,MAAM,CAAC;QACd;;WAEG;QACH,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC,CAAC;IACH;;OAEG;IACH,IAAI,CAAC,EAAE,KAAK,CAAC;QACX;;WAEG;QACH,KAAK,EAAE,MAAM,CAAC;QACd;;WAEG;QACH,SAAS,EAAE,KAAK,GAAG,MAAM,CAAC;KAC3B,CAAC,CAAC;IACH;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,OAAO,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;CAClC;AAED;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAC3B,gBAAgB,GAChB,kBAAkB,GAClB,cAAc,GACd,YAAY,CAAC"}
package/dist/views.js ADDED
@@ -0,0 +1,8 @@
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
+ export {};
@@ -0,0 +1,181 @@
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
+ * @object-ui/types - Widget Manifest & Registry Types
10
+ *
11
+ * Defines the WidgetManifest interface for runtime widget registration,
12
+ * plugin auto-discovery from server metadata, and custom widget registry
13
+ * for user-defined components.
14
+ *
15
+ * @module widget
16
+ * @packageDocumentation
17
+ */
18
+ /**
19
+ * Widget manifest describing a runtime-loadable widget.
20
+ *
21
+ * A manifest provides all metadata needed to discover, load, and render
22
+ * a widget without requiring an upfront import of its code.
23
+ *
24
+ * @example
25
+ * ```ts
26
+ * const manifest: WidgetManifest = {
27
+ * name: 'custom-chart',
28
+ * version: '1.0.0',
29
+ * type: 'chart',
30
+ * label: 'Custom Chart Widget',
31
+ * description: 'A custom chart powered by D3.',
32
+ * category: 'data-visualization',
33
+ * icon: 'BarChart',
34
+ * source: { type: 'module', url: '/widgets/custom-chart.js' },
35
+ * };
36
+ * ```
37
+ */
38
+ export interface WidgetManifest {
39
+ /** Unique widget identifier (e.g., 'custom-chart', 'org.acme.table') */
40
+ name: string;
41
+ /** Semver version string */
42
+ version: string;
43
+ /** Component type key used for schema rendering (e.g., 'chart', 'grid') */
44
+ type: string;
45
+ /** Human-readable label for the widget */
46
+ label: string;
47
+ /** Short description of the widget */
48
+ description?: string;
49
+ /** Category for grouping in the designer palette */
50
+ category?: string;
51
+ /** Icon name (Lucide icon name) or SVG string */
52
+ icon?: string;
53
+ /** Thumbnail image URL for the designer palette */
54
+ thumbnail?: string;
55
+ /** Widget loading source configuration */
56
+ source: WidgetSource;
57
+ /** Required peer dependencies (e.g., { 'react': '^18.0.0' }) */
58
+ peerDependencies?: Record<string, string>;
59
+ /** Dependencies on other widgets by name */
60
+ dependencies?: string[];
61
+ /** Default props to apply when the widget is first dropped in the designer */
62
+ defaultProps?: Record<string, unknown>;
63
+ /** Input schema for the widget's configurable properties */
64
+ inputs?: WidgetInput[];
65
+ /** Whether the widget can contain child components */
66
+ isContainer?: boolean;
67
+ /** Widget capabilities */
68
+ capabilities?: WidgetCapabilities;
69
+ /** Additional metadata */
70
+ metadata?: Record<string, unknown>;
71
+ }
72
+ /**
73
+ * Describes how to load the widget's code at runtime.
74
+ */
75
+ export type WidgetSource = WidgetSourceModule | WidgetSourceInline | WidgetSourceRegistry;
76
+ /**
77
+ * Load from an ES module URL.
78
+ *
79
+ * ⚠️ SECURITY WARNING: Only use URLs from trusted sources.
80
+ * Never pass user-supplied URLs directly. URLs should be validated
81
+ * and controlled by your application. This feature uses dynamic imports
82
+ * which bypass static analysis and may be restricted by Content Security Policy.
83
+ */
84
+ export interface WidgetSourceModule {
85
+ type: 'module';
86
+ /**
87
+ * URL to the ES module (e.g., '/widgets/chart.js' or 'https://cdn.example.com/widget.mjs')
88
+ * Must be from a trusted source - never user input.
89
+ */
90
+ url: string;
91
+ /** Named export to use (default: 'default') */
92
+ exportName?: string;
93
+ }
94
+ /** The component is provided inline (already loaded) */
95
+ export interface WidgetSourceInline {
96
+ type: 'inline';
97
+ /** The React component (already resolved) */
98
+ component: unknown;
99
+ }
100
+ /** The component is registered in the global component registry */
101
+ export interface WidgetSourceRegistry {
102
+ type: 'registry';
103
+ /** The component type key in the registry */
104
+ registryKey: string;
105
+ }
106
+ /**
107
+ * Configurable input for a widget.
108
+ */
109
+ export interface WidgetInput {
110
+ /** Input field name (maps to prop name) */
111
+ name: string;
112
+ /** Input field type */
113
+ type: 'string' | 'number' | 'boolean' | 'enum' | 'array' | 'object' | 'color' | 'date' | 'code' | 'file' | 'slot';
114
+ /** Human-readable label */
115
+ label?: string;
116
+ /** Default value */
117
+ defaultValue?: unknown;
118
+ /** Whether this input is required */
119
+ required?: boolean;
120
+ /** Enum options (for type: 'enum') */
121
+ options?: string[] | Array<{
122
+ label: string;
123
+ value: unknown;
124
+ }>;
125
+ /** Help text */
126
+ description?: string;
127
+ /** Whether this is an advanced setting (hidden by default) */
128
+ advanced?: boolean;
129
+ }
130
+ /**
131
+ * Widget capabilities flag set.
132
+ */
133
+ export interface WidgetCapabilities {
134
+ /** Widget supports data binding via dataSource */
135
+ dataBinding?: boolean;
136
+ /** Widget supports real-time updates */
137
+ realTime?: boolean;
138
+ /** Widget supports export (PDF, CSV, etc.) */
139
+ export?: boolean;
140
+ /** Widget supports responsive sizing */
141
+ responsive?: boolean;
142
+ /** Widget supports theming */
143
+ themeable?: boolean;
144
+ /** Widget supports drag and drop */
145
+ draggable?: boolean;
146
+ /** Widget supports resize */
147
+ resizable?: boolean;
148
+ }
149
+ /**
150
+ * Resolved widget: a manifest with its loaded component.
151
+ */
152
+ export interface ResolvedWidget {
153
+ /** The original manifest */
154
+ manifest: WidgetManifest;
155
+ /** The loaded React component */
156
+ component: unknown;
157
+ /** Timestamp when the widget was loaded */
158
+ loadedAt: number;
159
+ }
160
+ /**
161
+ * Widget registry event types.
162
+ */
163
+ export type WidgetRegistryEvent = {
164
+ type: 'widget:registered';
165
+ widget: WidgetManifest;
166
+ } | {
167
+ type: 'widget:unregistered';
168
+ name: string;
169
+ } | {
170
+ type: 'widget:loaded';
171
+ widget: ResolvedWidget;
172
+ } | {
173
+ type: 'widget:error';
174
+ name: string;
175
+ error: Error;
176
+ };
177
+ /**
178
+ * Widget registry event listener.
179
+ */
180
+ export type WidgetRegistryListener = (event: WidgetRegistryEvent) => void;
181
+ //# sourceMappingURL=widget.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"widget.d.ts","sourceRoot":"","sources":["../src/widget.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;;;GASG;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,cAAc;IAC7B,wEAAwE;IACxE,IAAI,EAAE,MAAM,CAAC;IAEb,4BAA4B;IAC5B,OAAO,EAAE,MAAM,CAAC;IAEhB,2EAA2E;IAC3E,IAAI,EAAE,MAAM,CAAC;IAEb,0CAA0C;IAC1C,KAAK,EAAE,MAAM,CAAC;IAEd,sCAAsC;IACtC,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,oDAAoD;IACpD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,iDAAiD;IACjD,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,mDAAmD;IACnD,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,0CAA0C;IAC1C,MAAM,EAAE,YAAY,CAAC;IAErB,gEAAgE;IAChE,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC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CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CAAE,CAAC;AAEzD;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI,CAAC"}
package/dist/widget.js ADDED
@@ -0,0 +1,8 @@
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
+ export {};