@docyrus/generative-ui-core 0.0.1 → 0.0.2

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 ADDED
@@ -0,0 +1,1222 @@
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
+ DASHBOARD_CUSTOM_RULES: () => DASHBOARD_CUSTOM_RULES,
24
+ DATA_GRID_CUSTOM_RULES: () => DATA_GRID_CUSTOM_RULES,
25
+ EMAIL_CUSTOM_RULES: () => EMAIL_CUSTOM_RULES,
26
+ FORM_CUSTOM_RULES: () => FORM_CUSTOM_RULES,
27
+ IMAGE_CUSTOM_RULES: () => IMAGE_CUSTOM_RULES,
28
+ PDF_CUSTOM_RULES: () => PDF_CUSTOM_RULES,
29
+ ROOT_ELEMENT_TYPES: () => ROOT_ELEMENT_TYPES,
30
+ SUPPORTED_MODES: () => SUPPORTED_MODES,
31
+ WIDGET_CUSTOM_RULES: () => WIDGET_CUSTOM_RULES,
32
+ compileDashboardSpec: () => compileDashboardSpec,
33
+ compileDataGridSpec: () => compileDataGridSpec,
34
+ compileFormSpec: () => compileFormSpec,
35
+ compileWidgetSpec: () => compileWidgetSpec,
36
+ createDashboardAdapterSpec: () => createDashboardAdapterSpec,
37
+ createDataGridAdapterSpec: () => createDataGridAdapterSpec,
38
+ createFormAdapterSpec: () => createFormAdapterSpec,
39
+ createWidgetAdapterSpec: () => createWidgetAdapterSpec,
40
+ dashboardCatalog: () => dashboardCatalog,
41
+ dashboardSchema: () => dashboardSchema,
42
+ dashboardStandardComponentDefinitions: () => dashboardStandardComponentDefinitions,
43
+ dataGridCatalog: () => dataGridCatalog,
44
+ dataGridSchema: () => dataGridSchema,
45
+ dataGridStandardComponentDefinitions: () => dataGridStandardComponentDefinitions,
46
+ emailCatalog: () => emailCatalog,
47
+ formCatalog: () => formCatalog,
48
+ formSchema: () => formSchema,
49
+ formStandardComponentDefinitions: () => formStandardComponentDefinitions,
50
+ getCatalogForMode: () => getCatalogForMode,
51
+ imageCatalog: () => imageCatalog,
52
+ pdfCatalog: () => pdfCatalog,
53
+ widgetCatalog: () => widgetCatalog,
54
+ widgetSchema: () => widgetSchema,
55
+ widgetStandardComponentDefinitions: () => widgetStandardComponentDefinitions
56
+ });
57
+ module.exports = __toCommonJS(index_exports);
58
+
59
+ // src/mode-catalogs.ts
60
+ var import_core = require("@json-render/core");
61
+ var import_v4 = require("zod/v4");
62
+ var DEFAULT_GRID_BREAKPOINTS = [
63
+ "lg",
64
+ "md",
65
+ "sm",
66
+ "xs",
67
+ "xxs"
68
+ ];
69
+ function createReactModeSchema(defaultRules) {
70
+ return (0, import_core.defineSchema)(
71
+ (s) => ({
72
+ spec: s.object({
73
+ root: s.string(),
74
+ elements: s.record(
75
+ s.object({
76
+ type: s.ref("catalog.components"),
77
+ props: s.propsOf("catalog.components"),
78
+ children: s.array(s.string()),
79
+ visible: s.any()
80
+ })
81
+ )
82
+ }),
83
+ catalog: s.object({
84
+ components: s.map({
85
+ props: s.zod(),
86
+ slots: s.array(s.string()),
87
+ description: s.string(),
88
+ example: s.any()
89
+ }),
90
+ actions: s.map({
91
+ params: s.zod(),
92
+ description: s.string()
93
+ })
94
+ })
95
+ }),
96
+ { defaultRules }
97
+ );
98
+ }
99
+ var smartCanvasGridItemSchema = import_v4.z.object({
100
+ i: import_v4.z.string().optional(),
101
+ x: import_v4.z.number(),
102
+ y: import_v4.z.number(),
103
+ w: import_v4.z.number(),
104
+ h: import_v4.z.number(),
105
+ minW: import_v4.z.number().optional(),
106
+ maxW: import_v4.z.number().optional(),
107
+ minH: import_v4.z.number().optional(),
108
+ maxH: import_v4.z.number().optional(),
109
+ static: import_v4.z.boolean().optional(),
110
+ isDraggable: import_v4.z.boolean().optional(),
111
+ isResizable: import_v4.z.boolean().optional()
112
+ });
113
+ var smartCanvasFlowNodeLayoutSchema = import_v4.z.object({
114
+ id: import_v4.z.string(),
115
+ x: import_v4.z.number(),
116
+ y: import_v4.z.number(),
117
+ width: import_v4.z.number().optional(),
118
+ height: import_v4.z.number().optional()
119
+ });
120
+ var smartCanvasFlowViewportSchema = import_v4.z.object({
121
+ x: import_v4.z.number(),
122
+ y: import_v4.z.number(),
123
+ zoom: import_v4.z.number()
124
+ });
125
+ var dashboardWidgetLayoutSchema = import_v4.z.object({
126
+ grid: import_v4.z.record(import_v4.z.string(), smartCanvasGridItemSchema).optional(),
127
+ flow: smartCanvasFlowNodeLayoutSchema.optional(),
128
+ stackOrder: import_v4.z.number().int().optional()
129
+ });
130
+ var smartCanvasSeriesConfigSchema = import_v4.z.object({
131
+ field: import_v4.z.string(),
132
+ label: import_v4.z.string().optional(),
133
+ color: import_v4.z.string().optional()
134
+ });
135
+ var smartCanvasCartesianChartConfigSchema = import_v4.z.object({
136
+ xField: import_v4.z.string(),
137
+ series: import_v4.z.array(smartCanvasSeriesConfigSchema).min(1),
138
+ aspectRatio: import_v4.z.string().optional(),
139
+ showGrid: import_v4.z.boolean().optional(),
140
+ showTooltip: import_v4.z.boolean().optional(),
141
+ stacked: import_v4.z.boolean().optional(),
142
+ orientation: import_v4.z.enum(["vertical", "horizontal"]).optional()
143
+ });
144
+ var smartCanvasCategoryChartConfigSchema = import_v4.z.object({
145
+ labelField: import_v4.z.string(),
146
+ valueField: import_v4.z.string(),
147
+ colorField: import_v4.z.string().optional(),
148
+ maxValueField: import_v4.z.string().optional(),
149
+ aspectRatio: import_v4.z.string().optional(),
150
+ innerRadius: import_v4.z.number().optional(),
151
+ orientation: import_v4.z.enum(["vertical", "horizontal"]).optional()
152
+ });
153
+ var smartCanvasRadarMetricConfigSchema = import_v4.z.object({
154
+ key: import_v4.z.string(),
155
+ label: import_v4.z.string().optional()
156
+ });
157
+ var smartCanvasRadarChartConfigSchema = import_v4.z.object({
158
+ labelField: import_v4.z.string(),
159
+ metrics: import_v4.z.array(smartCanvasRadarMetricConfigSchema).min(1),
160
+ colorField: import_v4.z.string().optional()
161
+ });
162
+ var smartCanvasSankeyChartConfigSchema = import_v4.z.object({
163
+ sourceField: import_v4.z.string(),
164
+ targetField: import_v4.z.string(),
165
+ valueField: import_v4.z.string()
166
+ });
167
+ var smartCanvasChoroplethFeatureSchema = import_v4.z.object({
168
+ type: import_v4.z.literal("Feature"),
169
+ geometry: import_v4.z.any(),
170
+ properties: import_v4.z.record(import_v4.z.string(), import_v4.z.any()).nullable().optional(),
171
+ id: import_v4.z.union([import_v4.z.string(), import_v4.z.number()]).optional()
172
+ });
173
+ var smartCanvasChoroplethFeatureCollectionSchema = import_v4.z.object({
174
+ type: import_v4.z.literal("FeatureCollection"),
175
+ features: import_v4.z.array(smartCanvasChoroplethFeatureSchema)
176
+ });
177
+ var smartCanvasChoroplethChartConfigSchema = import_v4.z.object({
178
+ featureIdField: import_v4.z.string(),
179
+ valueField: import_v4.z.string(),
180
+ featureCollection: smartCanvasChoroplethFeatureCollectionSchema
181
+ });
182
+ var smartCanvasStatsFormatConfigSchema = import_v4.z.object({
183
+ locale: import_v4.z.string().optional(),
184
+ style: import_v4.z.enum(["number", "currency", "percent"]).optional(),
185
+ currency: import_v4.z.string().optional(),
186
+ currencyDisplay: import_v4.z.enum([
187
+ "symbol",
188
+ "code",
189
+ "name",
190
+ "narrowSymbol"
191
+ ]).optional(),
192
+ notation: import_v4.z.enum([
193
+ "standard",
194
+ "scientific",
195
+ "engineering",
196
+ "compact"
197
+ ]).optional(),
198
+ minimumFractionDigits: import_v4.z.number().optional(),
199
+ maximumFractionDigits: import_v4.z.number().optional(),
200
+ signDisplay: import_v4.z.enum([
201
+ "auto",
202
+ "always",
203
+ "exceptZero",
204
+ "negative",
205
+ "never"
206
+ ]).optional(),
207
+ percentScale: import_v4.z.enum(["whole", "fraction"]).optional()
208
+ });
209
+ var smartCanvasStatsItemConfigSchema = import_v4.z.object({
210
+ id: import_v4.z.string(),
211
+ title: import_v4.z.string(),
212
+ valueField: import_v4.z.string(),
213
+ eyebrow: import_v4.z.string().optional(),
214
+ subtitle: import_v4.z.string().optional(),
215
+ icon: import_v4.z.string().optional(),
216
+ color: import_v4.z.string().optional(),
217
+ unitLabel: import_v4.z.string().optional(),
218
+ format: smartCanvasStatsFormatConfigSchema.optional()
219
+ });
220
+ var smartCanvasStatsLayoutSchema = import_v4.z.discriminatedUnion("type", [
221
+ import_v4.z.object({
222
+ type: import_v4.z.literal("grid"),
223
+ columns: import_v4.z.number(),
224
+ gap: import_v4.z.union([import_v4.z.number(), import_v4.z.string()]).optional(),
225
+ maxCardWidth: import_v4.z.union([import_v4.z.number(), import_v4.z.string()]).optional()
226
+ }),
227
+ import_v4.z.object({
228
+ type: import_v4.z.literal("flex"),
229
+ cardWidth: import_v4.z.union([import_v4.z.number(), import_v4.z.string()]),
230
+ behavior: import_v4.z.enum(["wrap", "scroll"]),
231
+ gap: import_v4.z.union([import_v4.z.number(), import_v4.z.string()]).optional()
232
+ }),
233
+ import_v4.z.object({
234
+ type: import_v4.z.literal("tabs"),
235
+ defaultTabId: import_v4.z.string().optional()
236
+ })
237
+ ]);
238
+ var smartCanvasStatsConfigSchema = import_v4.z.object({
239
+ items: import_v4.z.array(smartCanvasStatsItemConfigSchema).min(1),
240
+ layout: smartCanvasStatsLayoutSchema
241
+ });
242
+ var smartCanvasDataGridColumnConfigSchema = import_v4.z.object({
243
+ key: import_v4.z.string(),
244
+ header: import_v4.z.string().optional()
245
+ });
246
+ var smartCanvasDataGridConfigSchema = import_v4.z.object({
247
+ columns: import_v4.z.array(smartCanvasDataGridColumnConfigSchema).optional(),
248
+ rowHeight: import_v4.z.enum([
249
+ "short",
250
+ "medium",
251
+ "tall",
252
+ "extra-tall"
253
+ ]).optional(),
254
+ displayMode: import_v4.z.enum(["table", "gallery"]).optional(),
255
+ enableSearch: import_v4.z.boolean().optional()
256
+ });
257
+ var widgetBasePropsSchema = import_v4.z.object({
258
+ id: import_v4.z.string(),
259
+ title: import_v4.z.string(),
260
+ description: import_v4.z.string().optional(),
261
+ wrapInAwesomeCard: import_v4.z.boolean(),
262
+ query: import_v4.z.record(import_v4.z.string(), import_v4.z.any()),
263
+ locked: import_v4.z.boolean().optional(),
264
+ hidden: import_v4.z.boolean().optional(),
265
+ dashboardLayout: dashboardWidgetLayoutSchema.optional()
266
+ });
267
+ var dashboardSurfacePropsSchema = import_v4.z.object({
268
+ mode: import_v4.z.enum(["infinite-grid", "free-canvas", "stacked-cards"]).optional(),
269
+ selectedWidgetId: import_v4.z.string().nullable().optional(),
270
+ stackActiveId: import_v4.z.string().nullable().optional(),
271
+ flowViewport: smartCanvasFlowViewportSchema.nullable().optional()
272
+ });
273
+ var widgetSurfacePropsSchema = import_v4.z.object({});
274
+ var formOptionSchema = import_v4.z.object({
275
+ id: import_v4.z.string(),
276
+ name: import_v4.z.string(),
277
+ color: import_v4.z.string().optional(),
278
+ icon: import_v4.z.string().optional(),
279
+ description: import_v4.z.string().optional()
280
+ });
281
+ var formFieldBasePropsSchema = import_v4.z.object({
282
+ id: import_v4.z.string(),
283
+ name: import_v4.z.string(),
284
+ slug: import_v4.z.string(),
285
+ description: import_v4.z.string().optional(),
286
+ placeholder: import_v4.z.string().optional(),
287
+ helperText: import_v4.z.string().optional(),
288
+ required: import_v4.z.boolean().optional(),
289
+ readOnly: import_v4.z.boolean().optional(),
290
+ defaultValue: import_v4.z.any().optional(),
291
+ validations: import_v4.z.array(import_v4.z.string()).nullable().optional()
292
+ });
293
+ var choiceFieldPropsSchema = formFieldBasePropsSchema.extend({
294
+ options: import_v4.z.array(formOptionSchema).min(1)
295
+ });
296
+ var formSurfacePropsSchema = import_v4.z.object({
297
+ title: import_v4.z.string().optional(),
298
+ description: import_v4.z.string().optional(),
299
+ submitLabel: import_v4.z.string().optional(),
300
+ initialValues: import_v4.z.record(import_v4.z.string(), import_v4.z.any()).optional()
301
+ });
302
+ function createWidgetDefinition(configSchema, description, example) {
303
+ return {
304
+ props: widgetBasePropsSchema.extend({ config: configSchema }),
305
+ slots: [],
306
+ description,
307
+ example
308
+ };
309
+ }
310
+ function createFieldDefinition(props, description, example) {
311
+ return {
312
+ props,
313
+ slots: [],
314
+ description,
315
+ example
316
+ };
317
+ }
318
+ var WIDGET_COMPONENT_KIND_BY_NAME = {
319
+ LineChartWidget: "line-chart",
320
+ LiveLineChartWidget: "live-line-chart",
321
+ AreaChartWidget: "area-chart",
322
+ BarChartWidget: "bar-chart",
323
+ FunnelChartWidget: "funnel-chart",
324
+ RingChartWidget: "ring-chart",
325
+ PieChartWidget: "pie-chart",
326
+ RadarChartWidget: "radar-chart",
327
+ SankeyChartWidget: "sankey-chart",
328
+ ChoroplethChartWidget: "choropleth-chart",
329
+ AwesomeStatsWidget: "awesome-stats",
330
+ DataGridWidget: "data-grid"
331
+ };
332
+ var FIELD_COMPONENT_TYPE_BY_NAME = {
333
+ TextField: "field-text",
334
+ TextareaField: "field-textarea",
335
+ EmailField: "field-email",
336
+ NumberField: "field-number",
337
+ SelectField: "field-select",
338
+ RadioGroupField: "field-radioGroup",
339
+ CheckboxField: "field-checkbox",
340
+ SwitchField: "field-switch",
341
+ DateField: "field-date",
342
+ DateTimeField: "field-dateTime",
343
+ TimeField: "field-time",
344
+ DateRangeField: "field-dateRange"
345
+ };
346
+ var sharedWidgetStandardComponentDefinitions = {
347
+ LineChartWidget: createWidgetDefinition(
348
+ smartCanvasCartesianChartConfigSchema,
349
+ "A single line chart widget that plots one or more series against an x-axis field.",
350
+ {
351
+ id: "widget-revenue-trend",
352
+ title: "Revenue Trend",
353
+ wrapInAwesomeCard: true,
354
+ query: { columns: ["date", "revenue"] },
355
+ config: {
356
+ xField: "date",
357
+ series: [{ field: "revenue", label: "Revenue", color: "var(--chart-line-primary)" }],
358
+ showGrid: true,
359
+ showTooltip: true
360
+ },
361
+ dashboardLayout: {
362
+ grid: {
363
+ lg: {
364
+ x: 0,
365
+ y: 0,
366
+ w: 6,
367
+ h: 4
368
+ }
369
+ }
370
+ }
371
+ }
372
+ ),
373
+ LiveLineChartWidget: createWidgetDefinition(
374
+ smartCanvasCartesianChartConfigSchema,
375
+ "A line chart widget intended for live or near-real-time metrics.",
376
+ {
377
+ id: "widget-live-latency",
378
+ title: "Live Latency",
379
+ wrapInAwesomeCard: true,
380
+ query: { columns: ["timestamp", "latency_ms"] },
381
+ config: {
382
+ xField: "timestamp",
383
+ series: [{ field: "latency_ms", label: "Latency (ms)" }]
384
+ }
385
+ }
386
+ ),
387
+ AreaChartWidget: createWidgetDefinition(
388
+ smartCanvasCartesianChartConfigSchema,
389
+ "A filled trend chart widget for time-series or cumulative comparisons.",
390
+ {
391
+ id: "widget-signups-area",
392
+ title: "Weekly Signups",
393
+ wrapInAwesomeCard: true,
394
+ query: { columns: ["week", "signups"] },
395
+ config: {
396
+ xField: "week",
397
+ series: [{ field: "signups", label: "Signups" }],
398
+ showGrid: true
399
+ }
400
+ }
401
+ ),
402
+ BarChartWidget: createWidgetDefinition(
403
+ smartCanvasCartesianChartConfigSchema,
404
+ "A grouped or stacked bar chart widget for categorical comparisons.",
405
+ {
406
+ id: "widget-pipeline-bars",
407
+ title: "Pipeline by Rep",
408
+ wrapInAwesomeCard: true,
409
+ query: { columns: ["rep", "pipeline_value"] },
410
+ config: {
411
+ xField: "rep",
412
+ series: [{ field: "pipeline_value", label: "Pipeline Value" }],
413
+ orientation: "vertical"
414
+ }
415
+ }
416
+ ),
417
+ FunnelChartWidget: createWidgetDefinition(
418
+ smartCanvasCategoryChartConfigSchema,
419
+ "A funnel widget for stage conversion or sequential drop-off analysis.",
420
+ {
421
+ id: "widget-support-funnel",
422
+ title: "Support Funnel",
423
+ wrapInAwesomeCard: true,
424
+ query: { columns: ["stage", "count"] },
425
+ config: {
426
+ labelField: "stage",
427
+ valueField: "count"
428
+ }
429
+ }
430
+ ),
431
+ RingChartWidget: createWidgetDefinition(
432
+ smartCanvasCategoryChartConfigSchema,
433
+ "A ring widget for progress-style categorical metrics.",
434
+ {
435
+ id: "widget-goal-rings",
436
+ title: "Quota Progress",
437
+ wrapInAwesomeCard: true,
438
+ query: { columns: ["team", "value", "maxValue"] },
439
+ config: {
440
+ labelField: "team",
441
+ valueField: "value",
442
+ maxValueField: "maxValue"
443
+ }
444
+ }
445
+ ),
446
+ PieChartWidget: createWidgetDefinition(
447
+ smartCanvasCategoryChartConfigSchema,
448
+ "A pie widget for showing distribution across categories.",
449
+ {
450
+ id: "widget-channel-mix",
451
+ title: "Channel Mix",
452
+ wrapInAwesomeCard: true,
453
+ query: { columns: ["channel", "tickets"] },
454
+ config: {
455
+ labelField: "channel",
456
+ valueField: "tickets",
457
+ innerRadius: 72
458
+ }
459
+ }
460
+ ),
461
+ RadarChartWidget: createWidgetDefinition(
462
+ smartCanvasRadarChartConfigSchema,
463
+ "A radar widget for comparing multiple metrics for one or more entities.",
464
+ {
465
+ id: "widget-team-radar",
466
+ title: "Team Profile",
467
+ wrapInAwesomeCard: true,
468
+ query: { columns: [
469
+ "team",
470
+ "quality",
471
+ "speed",
472
+ "scale"
473
+ ] },
474
+ config: {
475
+ labelField: "team",
476
+ metrics: [{ key: "quality", label: "Quality" }, { key: "speed", label: "Speed" }, { key: "scale", label: "Scale" }]
477
+ }
478
+ }
479
+ ),
480
+ SankeyChartWidget: createWidgetDefinition(
481
+ smartCanvasSankeyChartConfigSchema,
482
+ "A sankey widget for visualizing flow between source and target nodes.",
483
+ {
484
+ id: "widget-journey-sankey",
485
+ title: "Journey Flow",
486
+ wrapInAwesomeCard: true,
487
+ query: { columns: ["source", "target", "count"] },
488
+ config: {
489
+ sourceField: "source",
490
+ targetField: "target",
491
+ valueField: "count"
492
+ }
493
+ }
494
+ ),
495
+ ChoroplethChartWidget: createWidgetDefinition(
496
+ smartCanvasChoroplethChartConfigSchema,
497
+ "A choropleth widget that shades geographic features by a numeric field.",
498
+ {
499
+ id: "widget-global-coverage",
500
+ title: "Global Coverage",
501
+ wrapInAwesomeCard: true,
502
+ query: { columns: ["country_code", "coverage"] },
503
+ config: {
504
+ featureIdField: "country_code",
505
+ valueField: "coverage",
506
+ featureCollection: {
507
+ type: "FeatureCollection",
508
+ features: []
509
+ }
510
+ }
511
+ }
512
+ ),
513
+ AwesomeStatsWidget: createWidgetDefinition(
514
+ smartCanvasStatsConfigSchema,
515
+ "A stats card widget that presents one or more highlight metrics.",
516
+ {
517
+ id: "widget-top-metrics",
518
+ title: "Top Metrics",
519
+ wrapInAwesomeCard: true,
520
+ query: { columns: ["revenue", "conversion_rate"] },
521
+ config: {
522
+ items: [{ id: "revenue", title: "Revenue", valueField: "revenue" }, { id: "conversion", title: "Conversion", valueField: "conversion_rate" }],
523
+ layout: { type: "grid", columns: 2, gap: 16 }
524
+ }
525
+ }
526
+ ),
527
+ DataGridWidget: createWidgetDefinition(
528
+ smartCanvasDataGridConfigSchema,
529
+ "A read-only data grid widget for tabular or gallery-style datasets.",
530
+ {
531
+ id: "widget-open-deals",
532
+ title: "Open Deals",
533
+ wrapInAwesomeCard: false,
534
+ query: { columns: ["deal_name", "owner", "amount"] },
535
+ config: {
536
+ columns: [{ key: "deal_name", header: "Deal" }, { key: "owner", header: "Owner" }, { key: "amount", header: "Amount" }],
537
+ displayMode: "table",
538
+ rowHeight: "medium",
539
+ enableSearch: true
540
+ }
541
+ }
542
+ )
543
+ };
544
+ var dashboardStandardComponentDefinitions = {
545
+ DashboardSurface: {
546
+ props: dashboardSurfacePropsSchema,
547
+ slots: ["default"],
548
+ description: "Root dashboard surface. Use it as the root element and place widget components directly as children.",
549
+ example: {
550
+ mode: "infinite-grid",
551
+ selectedWidgetId: "widget-revenue-trend",
552
+ flowViewport: { x: 0, y: 0, zoom: 1 }
553
+ }
554
+ },
555
+ ...sharedWidgetStandardComponentDefinitions
556
+ };
557
+ var widgetStandardComponentDefinitions = {
558
+ WidgetSurface: {
559
+ props: widgetSurfacePropsSchema,
560
+ slots: ["default"],
561
+ description: "Root widget surface. Use it as the root element and place exactly one widget component as its child.",
562
+ example: {}
563
+ },
564
+ ...sharedWidgetStandardComponentDefinitions
565
+ };
566
+ var dataGridStandardComponentDefinitions = {
567
+ WidgetSurface: {
568
+ props: widgetSurfacePropsSchema,
569
+ slots: ["default"],
570
+ description: "Root data-grid surface. Use it as the root element and place exactly one DataGridWidget child.",
571
+ example: {}
572
+ },
573
+ DataGridWidget: sharedWidgetStandardComponentDefinitions.DataGridWidget
574
+ };
575
+ var formStandardComponentDefinitions = {
576
+ FormSurface: {
577
+ props: formSurfacePropsSchema,
578
+ slots: ["default"],
579
+ description: "Root form surface. Use it as the root element and place generated field components directly as children.",
580
+ example: {
581
+ title: "Lead Capture",
582
+ description: "Collect the details needed to qualify a new inbound lead.",
583
+ submitLabel: "Save lead",
584
+ initialValues: { region: "emea" }
585
+ }
586
+ },
587
+ TextField: createFieldDefinition(
588
+ formFieldBasePropsSchema,
589
+ "Single-line text input field.",
590
+ {
591
+ id: "first_name",
592
+ name: "First name",
593
+ slug: "firstName",
594
+ placeholder: "Jane"
595
+ }
596
+ ),
597
+ TextareaField: createFieldDefinition(
598
+ formFieldBasePropsSchema,
599
+ "Multi-line text area field.",
600
+ {
601
+ id: "summary",
602
+ name: "Summary",
603
+ slug: "summary",
604
+ helperText: "Add extra context for the team."
605
+ }
606
+ ),
607
+ EmailField: createFieldDefinition(
608
+ formFieldBasePropsSchema,
609
+ "Email address input field.",
610
+ {
611
+ id: "email",
612
+ name: "Email",
613
+ slug: "email",
614
+ placeholder: "jane@example.com"
615
+ }
616
+ ),
617
+ NumberField: createFieldDefinition(
618
+ formFieldBasePropsSchema,
619
+ "Numeric input field.",
620
+ {
621
+ id: "seats",
622
+ name: "Seats",
623
+ slug: "seats",
624
+ defaultValue: 25
625
+ }
626
+ ),
627
+ SelectField: createFieldDefinition(
628
+ choiceFieldPropsSchema,
629
+ "Select dropdown field with predefined options.",
630
+ {
631
+ id: "segment",
632
+ name: "Segment",
633
+ slug: "segment",
634
+ options: [{ id: "enterprise", name: "Enterprise" }, { id: "mid-market", name: "Mid-market" }]
635
+ }
636
+ ),
637
+ RadioGroupField: createFieldDefinition(
638
+ choiceFieldPropsSchema,
639
+ "Radio group field with mutually exclusive options.",
640
+ {
641
+ id: "priority",
642
+ name: "Priority",
643
+ slug: "priority",
644
+ options: [{ id: "high", name: "High" }, { id: "medium", name: "Medium" }]
645
+ }
646
+ ),
647
+ CheckboxField: createFieldDefinition(
648
+ formFieldBasePropsSchema,
649
+ "Boolean checkbox field.",
650
+ {
651
+ id: "accept_terms",
652
+ name: "Accept terms",
653
+ slug: "acceptTerms",
654
+ required: true
655
+ }
656
+ ),
657
+ SwitchField: createFieldDefinition(
658
+ formFieldBasePropsSchema,
659
+ "Boolean switch field.",
660
+ {
661
+ id: "notify_team",
662
+ name: "Notify team",
663
+ slug: "notifyTeam",
664
+ defaultValue: true
665
+ }
666
+ ),
667
+ DateField: createFieldDefinition(
668
+ formFieldBasePropsSchema,
669
+ "Date picker field.",
670
+ { id: "start_date", name: "Start date", slug: "startDate" }
671
+ ),
672
+ DateTimeField: createFieldDefinition(
673
+ formFieldBasePropsSchema,
674
+ "Date and time picker field.",
675
+ { id: "demo_slot", name: "Demo slot", slug: "demoSlot" }
676
+ ),
677
+ TimeField: createFieldDefinition(
678
+ formFieldBasePropsSchema,
679
+ "Time-only picker field.",
680
+ { id: "meeting_time", name: "Meeting time", slug: "meetingTime" }
681
+ ),
682
+ DateRangeField: createFieldDefinition(
683
+ formFieldBasePropsSchema,
684
+ "Date range picker field.",
685
+ { id: "campaign_window", name: "Campaign window", slug: "campaignWindow" }
686
+ )
687
+ };
688
+ var dashboardSchema = createReactModeSchema([
689
+ "The root element MUST be DashboardSurface.",
690
+ "DashboardSurface children MUST be widget components only.",
691
+ `Supported dashboard widget components: ${Object.keys(WIDGET_COMPONENT_KIND_BY_NAME).join(", ")}.`,
692
+ "Use DashboardSurface props for mode selection and viewport metadata. Use widget dashboardLayout props for grid, flow, and stack placement metadata.",
693
+ "Widget components are shared with widget mode. Do not wrap them in another surface component.",
694
+ "CRITICAL INTEGRITY CHECK: Every child element referenced by DashboardSurface MUST exist in the flat elements map."
695
+ ]);
696
+ var widgetSchema = createReactModeSchema([
697
+ "The root element MUST be WidgetSurface.",
698
+ "WidgetSurface MUST contain exactly one shared widget component child.",
699
+ `Supported widget components: ${Object.keys(WIDGET_COMPONENT_KIND_BY_NAME).join(", ")}.`,
700
+ "Do not use DashboardSurface in widget mode.",
701
+ "CRITICAL INTEGRITY CHECK: The widget child referenced by WidgetSurface MUST exist in the flat elements map."
702
+ ]);
703
+ var dataGridSchema = createReactModeSchema([
704
+ "The root element MUST be WidgetSurface.",
705
+ "WidgetSurface MUST contain exactly one DataGridWidget child.",
706
+ "Supported component types: WidgetSurface and DataGridWidget.",
707
+ "Do not use chart widgets in data-grid mode.",
708
+ "CRITICAL INTEGRITY CHECK: The DataGridWidget child referenced by WidgetSurface MUST exist in the flat elements map."
709
+ ]);
710
+ var formSchema = createReactModeSchema([
711
+ "The root element MUST be FormSurface.",
712
+ "FormSurface children MUST be field components only.",
713
+ `Supported field components: ${Object.keys(FIELD_COMPONENT_TYPE_BY_NAME).join(", ")}.`,
714
+ "Keep form-level title, description, submitLabel, and initialValues on FormSurface props.",
715
+ "Use options only for select-style fields such as SelectField and RadioGroupField.",
716
+ "CRITICAL INTEGRITY CHECK: Every child element referenced by FormSurface MUST exist in the flat elements map."
717
+ ]);
718
+ var dashboardCatalog = (0, import_core.defineCatalog)(dashboardSchema, {
719
+ components: dashboardStandardComponentDefinitions,
720
+ actions: {}
721
+ });
722
+ var widgetCatalog = (0, import_core.defineCatalog)(widgetSchema, {
723
+ components: widgetStandardComponentDefinitions,
724
+ actions: {}
725
+ });
726
+ var dataGridCatalog = (0, import_core.defineCatalog)(dataGridSchema, {
727
+ components: dataGridStandardComponentDefinitions,
728
+ actions: {}
729
+ });
730
+ var formCatalog = (0, import_core.defineCatalog)(formSchema, {
731
+ components: formStandardComponentDefinitions,
732
+ actions: {}
733
+ });
734
+ function normalizeWidgetGridLayouts(widgetId, layouts) {
735
+ if (!layouts) {
736
+ return {};
737
+ }
738
+ return Object.entries(layouts).reduce((accumulator, [breakpoint, layout]) => {
739
+ if (!layout) {
740
+ return accumulator;
741
+ }
742
+ accumulator[breakpoint] = {
743
+ ...layout,
744
+ i: layout.i ?? widgetId
745
+ };
746
+ return accumulator;
747
+ }, {});
748
+ }
749
+ function compileDashboardValue(props, nodes) {
750
+ if (nodes.length === 0) {
751
+ throw new Error("DashboardSurface requires at least one widget child.");
752
+ }
753
+ const widgets = nodes.map(({ widget }) => widget);
754
+ const defaultSelectedId = widgets.find((widget) => !widget.hidden)?.id ?? widgets[0]?.id ?? null;
755
+ const selectedWidgetId = props.selectedWidgetId ?? defaultSelectedId;
756
+ const gridLayouts = nodes.reduce((accumulator, node) => {
757
+ const layoutsByBreakpoint = normalizeWidgetGridLayouts(node.widget.id, node.dashboardLayout?.grid);
758
+ Object.entries(layoutsByBreakpoint).forEach(([breakpoint, layout]) => {
759
+ accumulator[breakpoint] ??= [];
760
+ accumulator[breakpoint].push(layout);
761
+ });
762
+ return accumulator;
763
+ }, {});
764
+ DEFAULT_GRID_BREAKPOINTS.forEach((breakpoint) => {
765
+ gridLayouts[breakpoint] ??= [];
766
+ });
767
+ const flowNodes = nodes.map((node) => node.dashboardLayout?.flow).filter((value) => Boolean(value)).map((layout, index) => ({
768
+ ...layout,
769
+ id: layout.id || widgets[index]?.id || ""
770
+ }));
771
+ const stackOrder = [...nodes].map((node, index) => ({
772
+ widgetId: node.widget.id,
773
+ order: node.dashboardLayout?.stackOrder ?? index,
774
+ index
775
+ })).sort((left, right) => left.order - right.order || left.index - right.index).map((entry) => entry.widgetId);
776
+ return {
777
+ mode: props.mode ?? "infinite-grid",
778
+ selectedWidgetId,
779
+ widgets,
780
+ layouts: {
781
+ grid: gridLayouts,
782
+ flow: {
783
+ nodes: flowNodes,
784
+ viewport: props.flowViewport ?? null
785
+ },
786
+ stack: {
787
+ order: stackOrder,
788
+ activeId: props.stackActiveId ?? (selectedWidgetId && stackOrder.includes(selectedWidgetId) ? selectedWidgetId : stackOrder[0] ?? null)
789
+ }
790
+ }
791
+ };
792
+ }
793
+ function compileStandaloneWidget(nodes) {
794
+ if (nodes.length !== 1) {
795
+ throw new Error(`WidgetSurface requires exactly one widget child, received ${nodes.length}.`);
796
+ }
797
+ return nodes[0].widget;
798
+ }
799
+ function compileFormDefinition(props, fields) {
800
+ return {
801
+ title: props.title,
802
+ description: props.description,
803
+ submitLabel: props.submitLabel,
804
+ initialValues: props.initialValues,
805
+ fields
806
+ };
807
+ }
808
+ function isRecord(value) {
809
+ return typeof value === "object" && value !== null && !Array.isArray(value);
810
+ }
811
+ function getElement(spec, elementId) {
812
+ if (!isRecord(spec.elements)) {
813
+ throw new Error("Spec is missing a valid elements map.");
814
+ }
815
+ const element = spec.elements[elementId];
816
+ if (!isRecord(element)) {
817
+ throw new Error(`Spec is missing element "${elementId}".`);
818
+ }
819
+ return element;
820
+ }
821
+ function getRootElement(spec, expectedType) {
822
+ if (typeof spec.root !== "string" || spec.root.length === 0) {
823
+ throw new Error("Spec is missing a valid root element id.");
824
+ }
825
+ const rootElement = getElement(spec, spec.root);
826
+ if (rootElement.type !== expectedType) {
827
+ throw new Error(`Root element must be "${expectedType}".`);
828
+ }
829
+ return {
830
+ rootId: spec.root,
831
+ rootElement
832
+ };
833
+ }
834
+ function getChildIds(element) {
835
+ const { children } = element;
836
+ if (!Array.isArray(children)) {
837
+ return [];
838
+ }
839
+ return children.filter((value) => typeof value === "string");
840
+ }
841
+ function parseComponentProps(schema, props, label) {
842
+ const result = schema.safeParse(props ?? {});
843
+ if (!result.success) {
844
+ const issue = result.error.issues[0];
845
+ const detail = issue ? `${issue.path.join(".") || "props"}: ${issue.message}` : "invalid props";
846
+ throw new Error(`${label} has invalid props (${detail}).`);
847
+ }
848
+ return result.data;
849
+ }
850
+ function compileWidgetNode(spec, elementId) {
851
+ const element = getElement(spec, elementId);
852
+ if (typeof element.type !== "string" || !(element.type in WIDGET_COMPONENT_KIND_BY_NAME)) {
853
+ throw new Error(`Dashboard/widget child "${elementId}" must be a supported widget component.`);
854
+ }
855
+ const widgetDefinition = sharedWidgetStandardComponentDefinitions[element.type];
856
+ const widgetProps = parseComponentProps(
857
+ widgetDefinition.props,
858
+ element.props,
859
+ `${element.type} (${elementId})`
860
+ );
861
+ const { dashboardLayout, ...widget } = widgetProps;
862
+ return {
863
+ widget: {
864
+ ...widget,
865
+ kind: WIDGET_COMPONENT_KIND_BY_NAME[element.type]
866
+ },
867
+ dashboardLayout
868
+ };
869
+ }
870
+ function compileFieldNode(spec, elementId) {
871
+ const element = getElement(spec, elementId);
872
+ if (typeof element.type !== "string" || !(element.type in FIELD_COMPONENT_TYPE_BY_NAME)) {
873
+ throw new Error(`Form child "${elementId}" must be a supported field component.`);
874
+ }
875
+ const fieldDefinition = formStandardComponentDefinitions[element.type];
876
+ const fieldProps = parseComponentProps(
877
+ fieldDefinition.props,
878
+ element.props,
879
+ `${element.type} (${elementId})`
880
+ );
881
+ return {
882
+ field: {
883
+ ...fieldProps,
884
+ type: FIELD_COMPONENT_TYPE_BY_NAME[element.type]
885
+ }
886
+ };
887
+ }
888
+ function compileDashboardSpec(spec) {
889
+ const { rootElement } = getRootElement(spec, "DashboardSurface");
890
+ const nodes = getChildIds(rootElement).map((childId) => compileWidgetNode(spec, childId));
891
+ return compileDashboardValue(
892
+ parseComponentProps(dashboardStandardComponentDefinitions.DashboardSurface.props, rootElement.props, "DashboardSurface"),
893
+ nodes
894
+ );
895
+ }
896
+ function compileWidgetSpec(spec) {
897
+ const { rootElement } = getRootElement(spec, "WidgetSurface");
898
+ parseComponentProps(widgetStandardComponentDefinitions.WidgetSurface.props, rootElement.props, "WidgetSurface");
899
+ const nodes = getChildIds(rootElement).map((childId) => compileWidgetNode(spec, childId));
900
+ return compileStandaloneWidget(nodes);
901
+ }
902
+ function compileDataGridSpec(spec) {
903
+ const { rootElement } = getRootElement(spec, "WidgetSurface");
904
+ parseComponentProps(dataGridStandardComponentDefinitions.WidgetSurface.props, rootElement.props, "WidgetSurface");
905
+ const nodes = getChildIds(rootElement).map((childId) => compileWidgetNode(spec, childId));
906
+ const widget = compileStandaloneWidget(nodes);
907
+ if (widget.kind !== "data-grid") {
908
+ throw new Error("Data-grid mode requires the child component to be DataGridWidget.");
909
+ }
910
+ return widget;
911
+ }
912
+ function compileFormSpec(spec) {
913
+ const { rootElement } = getRootElement(spec, "FormSurface");
914
+ const fields = getChildIds(rootElement).map((childId) => compileFieldNode(spec, childId).field);
915
+ return compileFormDefinition(
916
+ parseComponentProps(formStandardComponentDefinitions.FormSurface.props, rootElement.props, "FormSurface"),
917
+ fields
918
+ );
919
+ }
920
+ function createAdapterSpec(rootId, type, props) {
921
+ return {
922
+ root: rootId,
923
+ elements: {
924
+ [rootId]: {
925
+ type,
926
+ props,
927
+ children: []
928
+ }
929
+ }
930
+ };
931
+ }
932
+ function createDashboardAdapterSpec(spec) {
933
+ return createAdapterSpec(spec.root, "DashboardSurface", { value: compileDashboardSpec(spec) });
934
+ }
935
+ function createWidgetAdapterSpec(spec) {
936
+ return createAdapterSpec(spec.root, "WidgetSurface", { widget: compileWidgetSpec(spec) });
937
+ }
938
+ function createDataGridAdapterSpec(spec) {
939
+ return createAdapterSpec(spec.root, "WidgetSurface", { widget: compileDataGridSpec(spec) });
940
+ }
941
+ function createFormAdapterSpec(spec) {
942
+ return createAdapterSpec(spec.root, "FormSurface", { definition: compileFormSpec(spec) });
943
+ }
944
+
945
+ // src/mode-entries.ts
946
+ var import_core2 = require("@json-render/core");
947
+ var import_image = require("@json-render/image");
948
+ var import_react_email = require("@json-render/react-email");
949
+ var import_react_pdf = require("@json-render/react-pdf");
950
+ var SUPPORTED_MODES = ["dashboard", "widget", "data-grid", "form", "email", "pdf", "image"];
951
+ var ALLOWED_WIDGET_KINDS = [
952
+ "line-chart",
953
+ "area-chart",
954
+ "bar-chart",
955
+ "funnel-chart",
956
+ "ring-chart",
957
+ "pie-chart",
958
+ "radar-chart",
959
+ "sankey-chart",
960
+ "choropleth-chart",
961
+ "awesome-stats",
962
+ "data-grid",
963
+ "live-line-chart"
964
+ ];
965
+ var ALLOWED_FIELD_TYPES = [
966
+ "field-text",
967
+ "field-textarea",
968
+ "field-email",
969
+ "field-number",
970
+ "field-select",
971
+ "field-radioGroup",
972
+ "field-checkbox",
973
+ "field-switch",
974
+ "field-date",
975
+ "field-dateTime",
976
+ "field-time",
977
+ "field-dateRange"
978
+ ];
979
+ var CHILD_REFERENCE_RULE = "CRITICAL: Every ID listed in a children array MUST have a matching element object in the elements map. Never reference an element ID that does not exist. Before finalizing, verify that every children entry across all elements points to an existing element key.";
980
+ var DASHBOARD_CUSTOM_RULES = [
981
+ CHILD_REFERENCE_RULE,
982
+ "All generated IDs must be stable strings.",
983
+ `Allowed widget kinds: ${ALLOWED_WIDGET_KINDS.join(", ")}. Do not use any other kind.`,
984
+ "Ensure every widget query.columns covers all config data fields (xField, series fields, valueField, labelField, etc.).",
985
+ `Example target JSON:
986
+ {
987
+ "root": "dashboard-1",
988
+ "elements": {
989
+ "dashboard-1": {
990
+ "type": "DashboardSurface",
991
+ "props": {
992
+ "mode": "infinite-grid",
993
+ "selectedWidgetId": "widget-revenue-trend"
994
+ },
995
+ "children": ["widget-revenue-trend"]
996
+ },
997
+ "widget-revenue-trend": {
998
+ "type": "LineChartWidget",
999
+ "props": {
1000
+ "id": "widget-revenue-trend",
1001
+ "title": "Revenue Trend",
1002
+ "wrapInAwesomeCard": true,
1003
+ "query": { "columns": ["date", "revenue"] },
1004
+ "config": {
1005
+ "xField": "date",
1006
+ "series": [{ "field": "revenue", "label": "Revenue" }],
1007
+ "showGrid": true,
1008
+ "showTooltip": true
1009
+ },
1010
+ "dashboardLayout": {
1011
+ "grid": { "lg": { "x": 0, "y": 0, "w": 6, "h": 4 } }
1012
+ }
1013
+ },
1014
+ "children": []
1015
+ }
1016
+ }
1017
+ }`
1018
+ ];
1019
+ var WIDGET_CUSTOM_RULES = [
1020
+ CHILD_REFERENCE_RULE,
1021
+ "All generated IDs must be stable strings.",
1022
+ `Allowed widget kinds: ${ALLOWED_WIDGET_KINDS.join(", ")}. Do not use any other kind.`,
1023
+ "Ensure query.columns covers all config data fields.",
1024
+ `Example target JSON:
1025
+ {
1026
+ "root": "widget-1",
1027
+ "elements": {
1028
+ "widget-1": {
1029
+ "type": "WidgetSurface",
1030
+ "props": {},
1031
+ "children": ["widget-revenue-mix"]
1032
+ },
1033
+ "widget-revenue-mix": {
1034
+ "type": "PieChartWidget",
1035
+ "props": {
1036
+ "id": "widget-revenue-mix",
1037
+ "title": "Revenue Mix",
1038
+ "wrapInAwesomeCard": true,
1039
+ "query": { "columns": ["product_family", "total_amount"] },
1040
+ "config": {
1041
+ "labelField": "product_family",
1042
+ "valueField": "total_amount",
1043
+ "innerRadius": 72
1044
+ }
1045
+ },
1046
+ "children": []
1047
+ }
1048
+ }
1049
+ }`
1050
+ ];
1051
+ var DATA_GRID_CUSTOM_RULES = [
1052
+ CHILD_REFERENCE_RULE,
1053
+ "All generated IDs must be stable strings.",
1054
+ "The root element must be WidgetSurface.",
1055
+ "WidgetSurface must contain exactly one DataGridWidget child.",
1056
+ "Supported component types: WidgetSurface and DataGridWidget only.",
1057
+ "Do not use chart or stats widgets in data-grid mode.",
1058
+ "Ensure query.columns covers every configured data-grid column key.",
1059
+ `Example target JSON:
1060
+ {
1061
+ "root": "data-grid-1",
1062
+ "elements": {
1063
+ "data-grid-1": {
1064
+ "type": "WidgetSurface",
1065
+ "props": {},
1066
+ "children": ["widget-open-deals"]
1067
+ },
1068
+ "widget-open-deals": {
1069
+ "type": "DataGridWidget",
1070
+ "props": {
1071
+ "id": "widget-open-deals",
1072
+ "title": "Open Deals",
1073
+ "wrapInAwesomeCard": false,
1074
+ "query": { "columns": ["deal_name", "owner", "amount"] },
1075
+ "config": {
1076
+ "columns": [
1077
+ { "key": "deal_name", "header": "Deal" },
1078
+ { "key": "owner", "header": "Owner" },
1079
+ { "key": "amount", "header": "Amount" }
1080
+ ],
1081
+ "displayMode": "table",
1082
+ "rowHeight": "medium",
1083
+ "enableSearch": true
1084
+ }
1085
+ },
1086
+ "children": []
1087
+ }
1088
+ }
1089
+ }`
1090
+ ];
1091
+ var FORM_CUSTOM_RULES = [
1092
+ CHILD_REFERENCE_RULE,
1093
+ "All generated IDs must be stable strings.",
1094
+ `Allowed field types: ${ALLOWED_FIELD_TYPES.join(", ")}. Do not use any other type.`,
1095
+ `Example target JSON:
1096
+ {
1097
+ "root": "form-1",
1098
+ "elements": {
1099
+ "form-1": {
1100
+ "type": "FormSurface",
1101
+ "props": {
1102
+ "title": "Lead Intake",
1103
+ "description": "Capture the first details for a new inbound lead.",
1104
+ "submitLabel": "Create Lead",
1105
+ "initialValues": { "newsletter_opt_in": false }
1106
+ },
1107
+ "children": ["field-1", "field-2", "field-3"]
1108
+ },
1109
+ "field-1": {
1110
+ "type": "TextField",
1111
+ "props": {
1112
+ "id": "field-1",
1113
+ "name": "Full Name",
1114
+ "slug": "full_name",
1115
+ "placeholder": "Jane Doe",
1116
+ "required": true
1117
+ },
1118
+ "children": []
1119
+ },
1120
+ "field-2": {
1121
+ "type": "EmailField",
1122
+ "props": {
1123
+ "id": "field-2",
1124
+ "name": "Email",
1125
+ "slug": "email",
1126
+ "placeholder": "jane@company.com",
1127
+ "required": true
1128
+ },
1129
+ "children": []
1130
+ },
1131
+ "field-3": {
1132
+ "type": "SelectField",
1133
+ "props": {
1134
+ "id": "field-3",
1135
+ "name": "Lead Source",
1136
+ "slug": "lead_source",
1137
+ "options": [{ "id": "website", "name": "Website" }, { "id": "referral", "name": "Referral" }]
1138
+ },
1139
+ "children": []
1140
+ }
1141
+ }
1142
+ }`
1143
+ ];
1144
+ var EMAIL_CUSTOM_RULES = [
1145
+ CHILD_REFERENCE_RULE,
1146
+ "All generated IDs must be stable strings.",
1147
+ "Root element must be Html. Include Head and Body children.",
1148
+ "Use email-safe structure with Container, Section, Row, Column for layout."
1149
+ ];
1150
+ var PDF_CUSTOM_RULES = [
1151
+ CHILD_REFERENCE_RULE,
1152
+ "All generated IDs must be stable strings.",
1153
+ "Root element must be Document. The first child of Document must be a Page.",
1154
+ "Include at least one Page element. Keep structure printable and deterministic."
1155
+ ];
1156
+ var IMAGE_CUSTOM_RULES = [
1157
+ CHILD_REFERENCE_RULE,
1158
+ "All generated IDs must be stable strings.",
1159
+ "Root element must be Frame with explicit width and height props.",
1160
+ "Keep structure deterministic."
1161
+ ];
1162
+ var emailCatalog = (0, import_core2.defineCatalog)(import_react_email.schema, { components: import_react_email.standardComponentDefinitions, actions: {} });
1163
+ var pdfCatalog = (0, import_core2.defineCatalog)(import_react_pdf.schema, { components: import_react_pdf.standardComponentDefinitions, actions: {} });
1164
+ var imageCatalog = (0, import_core2.defineCatalog)(import_image.schema, { components: import_image.standardComponentDefinitions, actions: {} });
1165
+ var CATALOG_MAP = {
1166
+ dashboard: { catalog: dashboardCatalog, customRules: DASHBOARD_CUSTOM_RULES },
1167
+ widget: { catalog: widgetCatalog, customRules: WIDGET_CUSTOM_RULES },
1168
+ "data-grid": { catalog: dataGridCatalog, customRules: DATA_GRID_CUSTOM_RULES },
1169
+ form: { catalog: formCatalog, customRules: FORM_CUSTOM_RULES },
1170
+ email: { catalog: emailCatalog, customRules: EMAIL_CUSTOM_RULES },
1171
+ pdf: { catalog: pdfCatalog, customRules: PDF_CUSTOM_RULES },
1172
+ image: { catalog: imageCatalog, customRules: IMAGE_CUSTOM_RULES }
1173
+ };
1174
+ var ROOT_ELEMENT_TYPES = {
1175
+ dashboard: "DashboardSurface",
1176
+ widget: "WidgetSurface",
1177
+ "data-grid": "WidgetSurface",
1178
+ form: "FormSurface",
1179
+ email: "Html",
1180
+ pdf: "Document",
1181
+ image: "Frame"
1182
+ };
1183
+ function getCatalogForMode(mode) {
1184
+ return CATALOG_MAP[mode];
1185
+ }
1186
+ // Annotate the CommonJS export names for ESM import in node:
1187
+ 0 && (module.exports = {
1188
+ DASHBOARD_CUSTOM_RULES,
1189
+ DATA_GRID_CUSTOM_RULES,
1190
+ EMAIL_CUSTOM_RULES,
1191
+ FORM_CUSTOM_RULES,
1192
+ IMAGE_CUSTOM_RULES,
1193
+ PDF_CUSTOM_RULES,
1194
+ ROOT_ELEMENT_TYPES,
1195
+ SUPPORTED_MODES,
1196
+ WIDGET_CUSTOM_RULES,
1197
+ compileDashboardSpec,
1198
+ compileDataGridSpec,
1199
+ compileFormSpec,
1200
+ compileWidgetSpec,
1201
+ createDashboardAdapterSpec,
1202
+ createDataGridAdapterSpec,
1203
+ createFormAdapterSpec,
1204
+ createWidgetAdapterSpec,
1205
+ dashboardCatalog,
1206
+ dashboardSchema,
1207
+ dashboardStandardComponentDefinitions,
1208
+ dataGridCatalog,
1209
+ dataGridSchema,
1210
+ dataGridStandardComponentDefinitions,
1211
+ emailCatalog,
1212
+ formCatalog,
1213
+ formSchema,
1214
+ formStandardComponentDefinitions,
1215
+ getCatalogForMode,
1216
+ imageCatalog,
1217
+ pdfCatalog,
1218
+ widgetCatalog,
1219
+ widgetSchema,
1220
+ widgetStandardComponentDefinitions
1221
+ });
1222
+ //# sourceMappingURL=index.cjs.map