@pebble-software/bonsai 0.1.0 → 0.1.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.
Files changed (45) hide show
  1. package/README.md +4 -0
  2. package/dist/ast.js +10 -0
  3. package/dist/ast.js.map +1 -0
  4. package/dist/chunks/builder.meta-WpXc5VBB.js +666 -0
  5. package/dist/chunks/builder.meta-WpXc5VBB.js.map +1 -0
  6. package/dist/chunks/{button-CSLrIvsS.js → button-jfJanilw.js} +46 -51
  7. package/dist/chunks/button-jfJanilw.js.map +1 -0
  8. package/dist/chunks/{create-renderer-1cky1uN9.js → create-renderer-DHneTPd-.js} +8 -8
  9. package/dist/chunks/{create-renderer-1cky1uN9.js.map → create-renderer-DHneTPd-.js.map} +1 -1
  10. package/dist/chunks/index-DzpRdatr.js +359 -0
  11. package/dist/chunks/index-DzpRdatr.js.map +1 -0
  12. package/dist/chunks/{render-shared-CIUUkLDn.js → render-shared-Ci28BpkI.js} +601 -931
  13. package/dist/chunks/render-shared-Ci28BpkI.js.map +1 -0
  14. package/dist/constants.d.ts +1 -0
  15. package/dist/constants.js +11 -0
  16. package/dist/constants.js.map +1 -0
  17. package/dist/core.js +3 -3
  18. package/dist/index.js +308 -955
  19. package/dist/index.js.map +1 -1
  20. package/dist/library/constants/src/components.d.ts +59 -0
  21. package/dist/library/constants/src/index.d.ts +2 -0
  22. package/dist/library/constants/src/webhook-events.d.ts +6 -0
  23. package/dist/library/schemas/src/bonsai.schema.d.ts +24 -0
  24. package/dist/library/schemas/src/builder.meta.d.ts +26 -0
  25. package/dist/presets/calendar.js +83 -74
  26. package/dist/presets/calendar.js.map +1 -1
  27. package/dist/presets/signature.js +9 -8
  28. package/dist/presets/signature.js.map +1 -1
  29. package/dist/schemas.d.ts +2 -0
  30. package/dist/schemas.js +13 -0
  31. package/dist/schemas.js.map +1 -0
  32. package/dist/styles/css/base.css +144 -0
  33. package/dist/styles/css/fonts.css +25 -0
  34. package/dist/styles/css/maplibre.css +29 -0
  35. package/dist/styles/css/overrides.css +7 -0
  36. package/dist/styles/css/tailwind.css +1 -0
  37. package/dist/styles/css/theme.css +197 -0
  38. package/dist/styles/css/tw-animate.css +1 -0
  39. package/dist/styles/css/utilities.css +44 -0
  40. package/dist/styles/presets.json +20 -0
  41. package/dist/styles/vendor/maplibre-gl.css +701 -0
  42. package/dist/styles/vendor/tw-animate.css +692 -0
  43. package/package.json +19 -3
  44. package/dist/chunks/button-CSLrIvsS.js.map +0 -1
  45. package/dist/chunks/render-shared-CIUUkLDn.js.map +0 -1
@@ -0,0 +1,666 @@
1
+ import { z as e } from "zod";
2
+ import { COMPONENT as t } from "../constants.js";
3
+ const r = e.object({
4
+ id: e.string().optional().meta({ description: "Unique identifier for the element" }),
5
+ className: e.string().optional().meta({ description: "CSS classes to apply to the element" })
6
+ }), ye = r.extend({
7
+ href: e.string({ error: "Link destination (href) is required" }).min(1, { message: "Link destination (href) cannot be empty" })
8
+ }), Se = r.extend({
9
+ variant: e.enum(["h1", "h2", "h3", "h4", "h5", "h6"], {
10
+ error: "Invalid heading variant. Must be one of: h1, h2, h3, h4, h5, or h6"
11
+ }).optional().meta({ description: "Heading level variant (h1-h6)" }),
12
+ as: e.enum(["h1", "h2", "h3", "h4", "h5", "h6"], {
13
+ error: "Invalid heading element type. Must be one of: h1, h2, h3, h4, h5, or h6"
14
+ }).optional().meta({ description: "Render as a different heading element" })
15
+ }).optional(), Le = r.extend({
16
+ size: e.enum(["xs", "sm", "md", "lg", "xl"], {
17
+ error: "Invalid paragraph size. Must be one of: xs, sm, md, lg, or xl"
18
+ }).optional().meta({ description: "Paragraph text size" }),
19
+ variant: e.enum(["default", "muted"]).optional().meta({ description: "Paragraph style variant" }),
20
+ as: e.enum(["p", "div", "span"]).optional().meta({ description: "Render as a different element" })
21
+ }).optional(), ve = r.optional(), _e = r.optional(), Pe = r.optional(), De = r.optional(), fe = r.optional(), Be = r.optional(), Ue = r.extend({
22
+ variant: e.enum(["default", "success", "warning", "destructive"], {
23
+ error: "Invalid alert variant. Must be one of: default, success, warning, or destructive"
24
+ }).optional().meta({ description: "Alert style variant" }),
25
+ size: e.enum(["default", "sm", "lg"]).optional().meta({ description: "Alert size" }),
26
+ raised: e.enum(["xs", "sm", "md", "lg", "xl"]).optional().meta({ description: "Alert shadow elevation" })
27
+ }).optional(), we = r.extend({
28
+ variant: e.enum(["default", "secondary", "destructive", "outline", "ghost"], {
29
+ error: "Invalid badge variant. Must be one of: default, secondary, destructive, outline, or ghost"
30
+ }).optional().meta({ description: "Badge style variant" }),
31
+ size: e.enum(["sm", "md", "lg"]).optional().meta({ description: "Badge size" }),
32
+ raised: e.enum(["xs", "sm", "md", "lg"]).optional().meta({ description: "Badge shadow elevation" }),
33
+ extrude: e.enum(["xs", "sm", "md", "lg"]).optional().meta({ description: "Badge extrude elevation" })
34
+ }).optional(), Ge = r.extend({
35
+ variant: e.enum(["default", "secondary", "outline", "destructive", "warning", "ghost"], {
36
+ error: "Invalid button variant. Must be one of: default, secondary, outline, destructive, warning, or ghost"
37
+ }).optional().meta({ description: "Button style variant" }),
38
+ size: e.enum(["xs", "sm", "md", "lg"], {
39
+ error: "Invalid button size. Must be one of: xs, sm, md, or lg"
40
+ }).optional().meta({ description: "Button size" }),
41
+ icon: e.enum(["xs", "sm", "md", "lg"]).optional().meta({ description: "Icon-only button size" }),
42
+ raised: e.enum(["xs", "sm", "md", "lg", "xl"]).optional().meta({ description: "Button shadow elevation" }),
43
+ extrude: e.enum(["xs", "sm", "md", "lg", "xl"]).optional().meta({ description: "Button extrude elevation" }),
44
+ disabled: e.union([e.string(), e.boolean()]).optional().meta({ description: "Whether the button is disabled" }),
45
+ loading: e.union([e.string(), e.boolean()]).optional().meta({ description: "Whether to show a loading spinner" }),
46
+ type: e.enum(["button", "submit"], {
47
+ error: "Invalid button type. Must be either 'button' or 'submit'"
48
+ }).optional().meta({ description: "Button type attribute" })
49
+ }).optional(), ke = r.extend({
50
+ size: e.enum(["sm", "md"]).optional().meta({ description: "Card size" }),
51
+ raised: e.enum(["none", "xs", "sm", "md", "lg", "xl"]).optional().meta({ description: "Card shadow elevation" })
52
+ }).optional(), He = r.optional(), ze = r.optional(), Me = r.optional(), We = r.optional(), Fe = r.optional(), je = r.optional(), qe = r.optional(), Xe = r.extend({
53
+ checked: e.union([e.string(), e.boolean()]).optional().meta({ description: "Checkbox checked state" }),
54
+ disabled: e.union([e.string(), e.boolean()]).optional().meta({ description: "Whether the checkbox is disabled" }),
55
+ required: e.union([e.string(), e.boolean()]).optional().meta({ description: "Whether the checkbox must be checked" }),
56
+ size: e.enum(["xs", "sm", "md", "lg", "xl"]).optional().meta({ description: "Checkbox size" })
57
+ }).strict(), Ve = r.extend({
58
+ src: e.union(
59
+ [
60
+ e.url({ error: "Image source (src) must be a valid URL" }),
61
+ e.string().min(1, { message: "Image source (src) cannot be empty" })
62
+ ],
63
+ {
64
+ error: "Image source (src) is required"
65
+ }
66
+ ),
67
+ alt: e.string().optional().default("unknown image url").meta({ description: "Alternative text for the image" })
68
+ }).strict(), Ke = r.extend({
69
+ value: e.union([e.string(), e.number()], {
70
+ error: "OTP value is required"
71
+ }).meta({ description: "Current OTP value" }),
72
+ placeholder: e.string().optional().meta({ description: "Placeholder text for the OTP input" }),
73
+ disabled: e.union([e.string(), e.boolean()]).optional().meta({ description: "Whether the OTP input is disabled" }),
74
+ containerClassName: e.string().optional().meta({ description: "Custom CSS class for the OTP input container" })
75
+ }).strict(), Ye = r.extend({
76
+ type: e.enum(["text", "email", "password", "number"], {
77
+ error: "Invalid input type. Must be one of: text, email, password, or number"
78
+ }).optional().meta({ description: "Input type; a number input stores a number" }),
79
+ value: e.union([e.string(), e.number()], {
80
+ error: "Input value is required"
81
+ }).meta({ description: "Current input value" }),
82
+ placeholder: e.string().optional().meta({ description: "Placeholder text shown when empty" }),
83
+ disabled: e.union([e.string(), e.boolean()]).optional().meta({ description: "Whether the input is disabled" })
84
+ }).strict(), Ze = r.extend({
85
+ htmlFor: e.string().min(1, {
86
+ message: "Label 'for' attribute is required and must reference an input ID"
87
+ }).meta({ description: "ID of the associated input element" }),
88
+ size: e.enum(["xs", "sm", "md", "lg", "xl"]).optional().meta({ description: "Label text size" }),
89
+ variant: e.enum(["default", "underline", "destructive"]).optional().meta({ description: "Label style variant" })
90
+ }).strict(), Je = r.extend({
91
+ checked: e.union([e.string(), e.boolean()], {
92
+ error: "Switch checked state is required"
93
+ }).meta({ description: "Current switch state" }),
94
+ disabled: e.union([e.string(), e.boolean()]).optional().meta({ description: "Whether the switch is disabled" }),
95
+ required: e.union([e.string(), e.boolean()]).optional().meta({ description: "Whether the switch must be turned on" }),
96
+ size: e.enum(["sm", "md", "lg"]).optional().meta({ description: "Switch size" }),
97
+ rounded: e.enum(["none", "sm", "md", "lg", "full"]).optional().meta({ description: "Switch border radius" })
98
+ }).strict(), Qe = r.extend({
99
+ value: e.string({ error: "Textarea value is required" }).meta({ description: "Current textarea content" }),
100
+ placeholder: e.string().optional().meta({ description: "Placeholder text shown when empty" }),
101
+ disabled: e.union([e.string(), e.boolean()]).optional().meta({ description: "Whether the textarea is disabled" }),
102
+ autosize: e.boolean().optional().meta({ description: "Whether the textarea auto-resizes to fit content" }),
103
+ rows: e.number().min(1, { message: "Minimum number of rows is 1" }).max(100, { message: "Maximum number of rows is 100" }).optional().meta({ description: "Number of visible text lines" }),
104
+ minLength: e.number().min(0, { message: "Minimum character length cannot be negative" }).optional().meta({ description: "Minimum number of characters allowed" }),
105
+ maxLength: e.number().max(1e4, { message: "Maximum character length cannot exceed 10,000" }).optional().meta({ description: "Maximum number of characters allowed" })
106
+ }).strict(), $e = r.optional(), et = r.optional(), tt = r.extend({
107
+ align: e.enum(["inline-start", "inline-end", "block-start", "block-end"]).optional().meta({ description: "Alignment of the addon within the input group" })
108
+ }).optional(), nt = r.extend({
109
+ value: e.union([e.string(), e.number()], {
110
+ error: "Input value is required"
111
+ }).meta({ description: "Current input value" }),
112
+ placeholder: e.string().optional().meta({ description: "Placeholder text shown when empty" }),
113
+ disabled: e.union([e.string(), e.boolean()]).optional().meta({ description: "Whether the input is disabled" })
114
+ }).strict(), at = r.extend({
115
+ variant: e.enum(["default", "secondary", "outline", "destructive", "warning", "ghost"]).optional(),
116
+ size: e.enum(["xs", "sm", "md", "lg"]).optional()
117
+ }).optional(), ot = r.extend({
118
+ value: e.string({ error: "Textarea value is required" }).meta({ description: "Current textarea content" }),
119
+ placeholder: e.string().optional(),
120
+ disabled: e.union([e.string(), e.boolean()]).optional()
121
+ }).strict(), it = r.extend({
122
+ value: e.string().nullable().meta({ description: "Current signature value (base64 or null if empty)" }),
123
+ canvasClassname: e.string().optional().meta({ description: "Custom CSS class for the signature canvas" }),
124
+ imageType: e.enum(["image/png", "image/jpeg", "image/webp"]).optional().meta({ description: "Image format for the exported signature" })
125
+ }).strict(), rt = r.extend({
126
+ selected: e.union([e.string(), e.date(), e.array(e.date())], {
127
+ error: "Invalid calendar selection. Must be a date string, Date object, or array of dates"
128
+ }).optional().meta({ description: "Currently selected date(s)" }),
129
+ buttonVariant: e.enum(["default", "secondary", "outline", "destructive", "warning", "ghost"]).optional().meta({ description: "Variant for calendar navigation buttons" }),
130
+ hideWeekends: e.boolean().optional().meta({ description: "Whether to hide Saturday and Sunday columns" })
131
+ }).optional(), st = r.optional(), lt = r.optional(), dt = r.optional(), ct = r.optional(), pt = r.optional(), mt = r.optional(), gt = r.optional(), ut = r.optional(), At = r.extend({
132
+ variant: e.enum(["default", "contained", "separated"]).optional().meta({ description: "Accordion style variant" }),
133
+ raised: e.enum(["xs", "sm", "md", "lg"]).optional().meta({ description: "Accordion shadow elevation" }),
134
+ extrude: e.enum(["xs", "sm", "md", "lg"]).optional().meta({ description: "Accordion extrude elevation" })
135
+ }).optional(), ht = r.optional(), Tt = r.extend({
136
+ disabled: e.union([e.string(), e.boolean()]).optional().meta({ description: "Whether the accordion trigger is disabled" }),
137
+ icon: e.any().optional().meta({ description: "Custom icon component for the trigger" })
138
+ }).optional(), bt = r.optional(), Ct = r.extend({
139
+ src: e.string().optional().meta({ description: "Image source URL" }),
140
+ alt: e.string().optional().meta({ description: "Alternative text for the avatar image" }),
141
+ size: e.enum(["full", "sm", "md", "lg", "xl"]).optional().meta({ description: "Avatar size" }),
142
+ rounded: e.enum(["none", "sm", "md", "lg", "full"]).optional().meta({ description: "Avatar border radius" }),
143
+ raised: e.enum(["xs", "sm", "md", "lg"]).optional().meta({ description: "Avatar shadow elevation" }),
144
+ fallback: e.string().optional().meta({ description: "Fallback text or element when image fails to load" }),
145
+ badge: e.any().optional().meta({ description: "Badge element to overlay on the avatar" })
146
+ }).optional(), xt = r.optional(), Nt = r.optional(), Et = r.optional(), Ot = r.extend({
147
+ variant: e.enum(["spinner", "ping"]).optional().meta({ description: "Loader animation variant" }),
148
+ fill: e.enum(["default", "destructive", "warning", "pending"]).optional().meta({ description: "Loader fill color" }),
149
+ size: e.enum(["sm", "md", "lg"]).optional().meta({ description: "Loader size" }),
150
+ icon: e.any().optional().meta({ description: "Custom spinner icon component" }),
151
+ pingIcon: e.any().optional().meta({ description: "Custom ping icon component" }),
152
+ iconProps: e.any().optional().meta({ description: "Props to pass to the icon components" })
153
+ }).optional(), It = r.extend({
154
+ mode: e.enum(["single", "multiple"]).optional().meta({ description: "Progress display mode" }),
155
+ value: e.union([
156
+ e.number().nullable(),
157
+ e.array(
158
+ e.object({
159
+ name: e.string().optional(),
160
+ value: e.number()
161
+ })
162
+ )
163
+ ]).optional().meta({ description: "Current progress value(s)" }),
164
+ size: e.enum(["xs", "sm", "md", "lg", "xl"]).optional().meta({ description: "Progress size" }),
165
+ raised: e.enum(["default", "xs", "sm", "md", "lg", "xl"]).optional().meta({ description: "Progress shadow elevation" }),
166
+ stacked: e.enum(["default", "xs", "sm", "md", "lg", "xl"]).optional().meta({ description: "Progress stacked spacing" })
167
+ }).optional(), Rt = r.extend({
168
+ variant: e.enum(["circle", "square", "default", "text"]).optional().meta({ description: "Skeleton shape variant" }),
169
+ animate: e.boolean().optional().meta({ description: "Whether to animate the skeleton" })
170
+ }).optional(), yt = e.lazy(() => e.union([e.string(), Ee])), i = e.object({
171
+ children: e.array(yt).optional().meta({ description: "Child nodes to render inside this element" })
172
+ }), b = i.extend({
173
+ type: e.literal(t.DIV),
174
+ args: De
175
+ }).meta({ description: "Container div element for grouping content" }), C = i.extend({
176
+ type: e.literal(t.A),
177
+ args: ye
178
+ }).meta({ description: "Anchor/link element" }), x = i.extend({
179
+ type: e.literal(t.H),
180
+ args: Se
181
+ }).meta({ description: "Heading element (h1-h6)" }), N = i.extend({
182
+ type: e.literal(t.P),
183
+ args: Le
184
+ }).meta({ description: "Paragraph text element" }), E = i.extend({
185
+ type: e.literal(t.OL),
186
+ args: ve
187
+ }).meta({ description: "Ordered list element" }), O = i.extend({
188
+ type: e.literal(t.UL),
189
+ args: _e
190
+ }).meta({ description: "Unordered list element" }), I = i.extend({
191
+ type: e.literal(t.LI),
192
+ args: Pe
193
+ }).meta({ description: "List item element" }), R = i.extend({
194
+ type: e.literal(t.SPAN),
195
+ args: fe
196
+ }).meta({ description: "Inline span element" }), y = i.extend({
197
+ type: e.literal(t.SEPARATOR),
198
+ args: Be
199
+ }).meta({ description: "Horizontal separator / divider element" }), S = i.extend({
200
+ type: e.literal(t.ALERT),
201
+ args: Ue
202
+ }).meta({ description: "Alert message box" }), L = i.extend({
203
+ type: e.literal(t.BADGE),
204
+ args: we
205
+ }).meta({ description: "Badge/status indicator" }), v = i.extend({
206
+ type: e.literal(t.BUTTON),
207
+ args: Ge
208
+ }).meta({ description: "Clickable button element" }), _ = i.extend({
209
+ type: e.literal(t.CARD),
210
+ args: ke
211
+ }).meta({ description: "Card container element" }), P = i.extend({
212
+ type: e.literal(t.CHECKBOX),
213
+ args: Xe
214
+ }).meta({ description: "Checkbox input element" }), D = i.extend({
215
+ type: e.literal(t.IMAGE),
216
+ args: Ve
217
+ }).meta({ description: "Image element" }), f = i.extend({
218
+ type: e.literal(t.OTP),
219
+ args: Ke
220
+ }).meta({ description: "One-time password (OTP) input" }), B = i.extend({
221
+ type: e.literal(t.INPUT),
222
+ args: Ye
223
+ }).meta({ description: "Text input element" }), U = i.extend({
224
+ type: e.literal(t.LABEL),
225
+ args: Ze
226
+ }).meta({ description: "Form label element" }), w = i.extend({
227
+ type: e.literal(t.SWITCH),
228
+ args: Je
229
+ }).meta({ description: "Toggle switch element" }), G = i.extend({
230
+ type: e.literal(t.TEXTAREA),
231
+ args: Qe
232
+ }).meta({ description: "Multi-line text input" }), k = i.extend({
233
+ type: e.literal(t.SIGNATURE),
234
+ args: it
235
+ }).meta({ description: "Signature pad input" }), H = i.extend({
236
+ type: e.literal(t.CALENDAR),
237
+ args: rt
238
+ }).meta({ description: "Date picker calendar" }), z = i.extend({
239
+ type: e.literal(t.CARD_HEADER),
240
+ args: He
241
+ }).meta({ description: "Card header container" }), M = i.extend({
242
+ type: e.literal(t.CARD_TITLE),
243
+ args: ze
244
+ }).meta({ description: "Card title element" }), W = i.extend({
245
+ type: e.literal(t.CARD_DESCRIPTION),
246
+ args: Me
247
+ }).meta({ description: "Card description element" }), F = i.extend({
248
+ type: e.literal(t.CARD_CONTENT),
249
+ args: We
250
+ }).meta({ description: "Card content body" }), j = i.extend({
251
+ type: e.literal(t.CARD_FOOTER),
252
+ args: Fe
253
+ }).meta({ description: "Card footer container" }), q = i.extend({
254
+ type: e.literal(t.CARD_ACTION),
255
+ args: je
256
+ }).meta({ description: "Card action slot" }), X = i.extend({
257
+ type: e.literal(t.CARD_ICON),
258
+ args: qe
259
+ }).meta({ description: "Card icon slot" }), V = i.extend({
260
+ type: e.literal(t.TABLE),
261
+ args: st
262
+ }).meta({ description: "Table container" }), K = i.extend({
263
+ type: e.literal(t.TABLE_HEADER),
264
+ args: lt
265
+ }).meta({ description: "Table header section" }), Y = i.extend({
266
+ type: e.literal(t.TABLE_BODY),
267
+ args: dt
268
+ }).meta({ description: "Table body section" }), Z = i.extend({
269
+ type: e.literal(t.TABLE_FOOTER),
270
+ args: ct
271
+ }).meta({ description: "Table footer section" }), J = i.extend({
272
+ type: e.literal(t.TABLE_HEAD),
273
+ args: pt
274
+ }).meta({ description: "Table header cell" }), Q = i.extend({
275
+ type: e.literal(t.TABLE_ROW),
276
+ args: mt
277
+ }).meta({ description: "Table row" }), $ = i.extend({
278
+ type: e.literal(t.TABLE_CELL),
279
+ args: gt
280
+ }).meta({ description: "Table data cell" }), ee = i.extend({
281
+ type: e.literal(t.TABLE_CAPTION),
282
+ args: ut
283
+ }).meta({ description: "Table caption" }), te = i.extend({
284
+ type: e.literal(t.ACCORDION),
285
+ args: At
286
+ }).meta({ description: "Accordion container" }), ne = i.extend({
287
+ type: e.literal(t.ACCORDION_ITEM),
288
+ args: ht
289
+ }).meta({ description: "Accordion item" }), ae = i.extend({
290
+ type: e.literal(t.ACCORDION_TRIGGER),
291
+ args: Tt
292
+ }).meta({ description: "Accordion trigger" }), oe = i.extend({
293
+ type: e.literal(t.ACCORDION_CONTENT),
294
+ args: bt
295
+ }).meta({ description: "Accordion content panel" }), ie = i.extend({
296
+ type: e.literal(t.AVATAR),
297
+ args: Ct
298
+ }).meta({ description: "Avatar image or fallback" }), re = i.extend({
299
+ type: e.literal(t.COLLAPSIBLE),
300
+ args: xt
301
+ }).meta({ description: "Collapsible container" }), se = i.extend({
302
+ type: e.literal(t.COLLAPSIBLE_TRIGGER),
303
+ args: Nt
304
+ }).meta({ description: "Collapsible trigger" }), le = i.extend({
305
+ type: e.literal(t.COLLAPSIBLE_CONTENT),
306
+ args: Et
307
+ }).meta({ description: "Collapsible content panel" }), de = i.extend({
308
+ type: e.literal(t.LOADER),
309
+ args: Ot
310
+ }).meta({ description: "Loading spinner indicator" }), ce = i.extend({
311
+ type: e.literal(t.PROGRESS),
312
+ args: It
313
+ }).meta({ description: "Progress bar indicator" }), pe = i.extend({
314
+ type: e.literal(t.SKELETON),
315
+ args: Rt
316
+ }).meta({ description: "Skeleton loading placeholder" }), me = i.extend({
317
+ type: e.literal(t.INPUT_GROUP),
318
+ args: $e
319
+ }).meta({ description: "Input group container" }), ge = i.extend({
320
+ type: e.literal(t.INPUT_GROUP_TEXT),
321
+ args: et
322
+ }).meta({ description: "Text element within input group" }), ue = i.extend({
323
+ type: e.literal(t.INPUT_GROUP_ADDON),
324
+ args: tt
325
+ }).meta({ description: "Addon container within input group" }), Ae = i.extend({
326
+ type: e.literal(t.INPUT_GROUP_INPUT),
327
+ args: nt
328
+ }).meta({ description: "Input element within input group" }), he = i.extend({
329
+ type: e.literal(t.INPUT_GROUP_BUTTON),
330
+ args: at
331
+ }).meta({ description: "Button element within input group" }), Te = i.extend({
332
+ type: e.literal(t.INPUT_GROUP_TEXTAREA),
333
+ args: ot
334
+ }).meta({ description: "Textarea element within input group" }), St = e.object({
335
+ items: e.string({ error: "each.items is required" }).min(1, { message: "each.items cannot be empty" }).meta({
336
+ description: 'Binding path to the array to iterate, e.g. "{{applicants}}". Must be a plain path (not a computed/filtered expression) so each row maps back to a real store index for two-way binding.'
337
+ }),
338
+ as: e.string({ error: "each.as is required" }).min(1, { message: "each.as cannot be empty" }).meta({ description: 'Alias name bound to the current item, e.g. "applicant"' }),
339
+ index: e.string().optional().meta({ description: "Alias name bound to the current numeric index" }),
340
+ key: e.string().optional().meta({
341
+ description: 'Binding expression used as the React key per row, e.g. "{{applicant.id}}". Falls back to the row index when omitted.'
342
+ })
343
+ }).strict(), be = i.extend({
344
+ type: e.literal(t.EACH),
345
+ args: St
346
+ }).meta({ description: "Repeats its children once per item in a bound array" }), Lt = e.object({
347
+ condition: e.string({ error: "if.condition is required" }).min(1, { message: "if.condition cannot be empty" }).meta({ description: "Binding expression; children render only when it evaluates truthy" })
348
+ }).strict(), Ce = i.extend({
349
+ type: e.literal(t.IF),
350
+ args: Lt
351
+ }).meta({ description: "Conditionally renders its children based on a bound expression" });
352
+ function a(s) {
353
+ return s.shape.args;
354
+ }
355
+ function o(s) {
356
+ return s.meta()?.description;
357
+ }
358
+ function vt(s) {
359
+ if (Object.keys(s).length === 0)
360
+ throw new Error("createTemplateSchema: registry must declare at least one component");
361
+ let l;
362
+ const d = e.lazy(() => e.union([e.string(), l])), c = e.object({
363
+ children: e.array(d).optional().meta({ description: "Child nodes to render inside this element" })
364
+ }), g = Object.entries(s).map(([Ie, { argsSchema: Re, description: h }]) => {
365
+ const T = c.extend({
366
+ type: e.literal(Ie),
367
+ args: Re
368
+ });
369
+ return h ? T.meta({ description: h }) : T;
370
+ });
371
+ return l = e.discriminatedUnion(
372
+ "type",
373
+ g
374
+ ), { Node: d, ComponentNode: l };
375
+ }
376
+ const _t = {
377
+ [t.DIV]: { argsSchema: a(b), description: o(b) },
378
+ [t.A]: { argsSchema: a(C), description: o(C) },
379
+ [t.H]: { argsSchema: a(x), description: o(x) },
380
+ [t.P]: { argsSchema: a(N), description: o(N) },
381
+ [t.OL]: { argsSchema: a(E), description: o(E) },
382
+ [t.UL]: { argsSchema: a(O), description: o(O) },
383
+ [t.LI]: { argsSchema: a(I), description: o(I) },
384
+ [t.SPAN]: { argsSchema: a(R), description: o(R) },
385
+ [t.SEPARATOR]: {
386
+ argsSchema: a(y),
387
+ description: o(y)
388
+ },
389
+ [t.ALERT]: { argsSchema: a(S), description: o(S) },
390
+ [t.BADGE]: { argsSchema: a(L), description: o(L) },
391
+ [t.BUTTON]: { argsSchema: a(v), description: o(v) },
392
+ [t.CARD]: { argsSchema: a(_), description: o(_) },
393
+ [t.CARD_HEADER]: {
394
+ argsSchema: a(z),
395
+ description: o(z)
396
+ },
397
+ [t.CARD_TITLE]: {
398
+ argsSchema: a(M),
399
+ description: o(M)
400
+ },
401
+ [t.CARD_DESCRIPTION]: {
402
+ argsSchema: a(W),
403
+ description: o(W)
404
+ },
405
+ [t.CARD_CONTENT]: {
406
+ argsSchema: a(F),
407
+ description: o(F)
408
+ },
409
+ [t.CARD_FOOTER]: {
410
+ argsSchema: a(j),
411
+ description: o(j)
412
+ },
413
+ [t.CARD_ACTION]: {
414
+ argsSchema: a(q),
415
+ description: o(q)
416
+ },
417
+ [t.CARD_ICON]: {
418
+ argsSchema: a(X),
419
+ description: o(X)
420
+ },
421
+ [t.CHECKBOX]: {
422
+ argsSchema: a(P),
423
+ description: o(P)
424
+ },
425
+ [t.IMAGE]: { argsSchema: a(D), description: o(D) },
426
+ [t.OTP]: { argsSchema: a(f), description: o(f) },
427
+ [t.INPUT]: { argsSchema: a(B), description: o(B) },
428
+ [t.LABEL]: { argsSchema: a(U), description: o(U) },
429
+ [t.SWITCH]: { argsSchema: a(w), description: o(w) },
430
+ [t.TEXTAREA]: {
431
+ argsSchema: a(G),
432
+ description: o(G)
433
+ },
434
+ [t.SIGNATURE]: {
435
+ argsSchema: a(k),
436
+ description: o(k)
437
+ },
438
+ [t.CALENDAR]: {
439
+ argsSchema: a(H),
440
+ description: o(H)
441
+ },
442
+ [t.TABLE]: { argsSchema: a(V), description: o(V) },
443
+ [t.TABLE_HEADER]: {
444
+ argsSchema: a(K),
445
+ description: o(K)
446
+ },
447
+ [t.TABLE_BODY]: {
448
+ argsSchema: a(Y),
449
+ description: o(Y)
450
+ },
451
+ [t.TABLE_FOOTER]: {
452
+ argsSchema: a(Z),
453
+ description: o(Z)
454
+ },
455
+ [t.TABLE_HEAD]: {
456
+ argsSchema: a(J),
457
+ description: o(J)
458
+ },
459
+ [t.TABLE_ROW]: {
460
+ argsSchema: a(Q),
461
+ description: o(Q)
462
+ },
463
+ [t.TABLE_CELL]: {
464
+ argsSchema: a($),
465
+ description: o($)
466
+ },
467
+ [t.TABLE_CAPTION]: {
468
+ argsSchema: a(ee),
469
+ description: o(ee)
470
+ },
471
+ [t.ACCORDION]: {
472
+ argsSchema: a(te),
473
+ description: o(te)
474
+ },
475
+ [t.ACCORDION_ITEM]: {
476
+ argsSchema: a(ne),
477
+ description: o(ne)
478
+ },
479
+ [t.ACCORDION_TRIGGER]: {
480
+ argsSchema: a(ae),
481
+ description: o(ae)
482
+ },
483
+ [t.ACCORDION_CONTENT]: {
484
+ argsSchema: a(oe),
485
+ description: o(oe)
486
+ },
487
+ [t.AVATAR]: { argsSchema: a(ie), description: o(ie) },
488
+ [t.COLLAPSIBLE]: {
489
+ argsSchema: a(re),
490
+ description: o(re)
491
+ },
492
+ [t.COLLAPSIBLE_TRIGGER]: {
493
+ argsSchema: a(se),
494
+ description: o(se)
495
+ },
496
+ [t.COLLAPSIBLE_CONTENT]: {
497
+ argsSchema: a(le),
498
+ description: o(le)
499
+ },
500
+ [t.LOADER]: { argsSchema: a(de), description: o(de) },
501
+ [t.PROGRESS]: {
502
+ argsSchema: a(ce),
503
+ description: o(ce)
504
+ },
505
+ [t.SKELETON]: {
506
+ argsSchema: a(pe),
507
+ description: o(pe)
508
+ },
509
+ [t.INPUT_GROUP]: {
510
+ argsSchema: a(me),
511
+ description: o(me)
512
+ },
513
+ [t.INPUT_GROUP_TEXT]: {
514
+ argsSchema: a(ge),
515
+ description: o(ge)
516
+ },
517
+ [t.INPUT_GROUP_ADDON]: {
518
+ argsSchema: a(ue),
519
+ description: o(ue)
520
+ },
521
+ [t.INPUT_GROUP_INPUT]: {
522
+ argsSchema: a(Ae),
523
+ description: o(Ae)
524
+ },
525
+ [t.INPUT_GROUP_BUTTON]: {
526
+ argsSchema: a(he),
527
+ description: o(he)
528
+ },
529
+ [t.INPUT_GROUP_TEXTAREA]: {
530
+ argsSchema: a(Te),
531
+ description: o(Te)
532
+ },
533
+ [t.EACH]: { argsSchema: a(be), description: o(be) },
534
+ [t.IF]: { argsSchema: a(Ce), description: o(Ce) }
535
+ }, Ne = vt(_t), Ee = Ne.ComponentNode, kt = Ne.Node, A = Object.fromEntries(
536
+ Ee.options.map((s) => [s.shape.type.value, s])
537
+ ), Oe = e.registry(), Pt = e.registry(), n = t, Dt = [
538
+ n.INPUT,
539
+ n.INPUT_GROUP_INPUT,
540
+ n.INPUT_GROUP_TEXTAREA,
541
+ n.TEXTAREA,
542
+ n.IMAGE,
543
+ n.SEPARATOR,
544
+ n.CHECKBOX,
545
+ n.SWITCH,
546
+ n.OTP,
547
+ n.SIGNATURE,
548
+ n.CALENDAR,
549
+ n.LOADER,
550
+ n.SKELETON,
551
+ n.PROGRESS,
552
+ n.AVATAR
553
+ ], xe = [n.TABLE_HEADER, n.TABLE_BODY, n.TABLE_FOOTER], p = [n.CARD, n.CARD_HEADER, n.CARD_FOOTER], m = [n.INPUT_GROUP, n.INPUT_GROUP_ADDON], u = {
554
+ [n.ACCORDION]: { accepts: [n.ACCORDION_ITEM] },
555
+ [n.ACCORDION_ITEM]: { accepts: [n.ACCORDION_TRIGGER, n.ACCORDION_CONTENT], parent: [n.ACCORDION] },
556
+ [n.ACCORDION_TRIGGER]: { parent: [n.ACCORDION_ITEM] },
557
+ [n.ACCORDION_CONTENT]: { parent: [n.ACCORDION_ITEM] },
558
+ [n.COLLAPSIBLE_TRIGGER]: { parent: [n.COLLAPSIBLE] },
559
+ [n.COLLAPSIBLE_CONTENT]: { parent: [n.COLLAPSIBLE] },
560
+ [n.TABLE]: { accepts: [...xe, n.TABLE_CAPTION] },
561
+ [n.TABLE_HEADER]: { accepts: [n.TABLE_ROW], parent: [n.TABLE] },
562
+ [n.TABLE_BODY]: { accepts: [n.TABLE_ROW], parent: [n.TABLE] },
563
+ [n.TABLE_FOOTER]: { accepts: [n.TABLE_ROW], parent: [n.TABLE] },
564
+ [n.TABLE_CAPTION]: { parent: [n.TABLE] },
565
+ [n.TABLE_ROW]: { accepts: [n.TABLE_CELL, n.TABLE_HEAD], parent: xe },
566
+ [n.TABLE_CELL]: { parent: [n.TABLE_ROW] },
567
+ [n.TABLE_HEAD]: { parent: [n.TABLE_ROW] },
568
+ [n.CARD_HEADER]: { parent: [n.CARD] },
569
+ [n.CARD_CONTENT]: { parent: [n.CARD] },
570
+ [n.CARD_FOOTER]: { parent: [n.CARD] },
571
+ [n.CARD_TITLE]: { parent: p },
572
+ [n.CARD_DESCRIPTION]: { parent: p },
573
+ [n.CARD_ACTION]: { parent: p },
574
+ [n.CARD_ICON]: { parent: p },
575
+ [n.INPUT_GROUP_ADDON]: { parent: [n.INPUT_GROUP] },
576
+ [n.INPUT_GROUP_TEXT]: { parent: m },
577
+ [n.INPUT_GROUP_INPUT]: { parent: m },
578
+ [n.INPUT_GROUP_BUTTON]: { parent: m },
579
+ [n.INPUT_GROUP_TEXTAREA]: { parent: m },
580
+ [n.OL]: { accepts: [n.LI] },
581
+ [n.UL]: { accepts: [n.LI] },
582
+ [n.LI]: { parent: [n.OL, n.UL] }
583
+ };
584
+ for (const s of Dt) u[s] = { ...u[s], accepts: "none" };
585
+ const ft = {
586
+ id: { label: "Element ID", group: "Advanced" },
587
+ className: { label: "Classes", group: "Advanced" },
588
+ href: { label: "Link URL", group: "Content", placeholder: "https://" },
589
+ src: { label: "Image URL", group: "Content", placeholder: "https:// or {{binding}}" },
590
+ alt: { label: "Alt text", group: "Content" },
591
+ placeholder: { label: "Placeholder", group: "Content" },
592
+ fallback: { label: "Fallback text", group: "Content" },
593
+ value: { label: "Bound value", control: "binding", group: "Data" },
594
+ checked: { label: "Bound value", control: "binding", group: "Data" },
595
+ selected: { label: "Bound value", control: "binding", group: "Data" },
596
+ htmlFor: { label: "For input (ID)", group: "Data" },
597
+ disabled: { label: "Disabled", group: "Data" },
598
+ required: { label: "Required", group: "Data" },
599
+ loading: { label: "Loading", group: "Data" },
600
+ readonly: { label: "Read only", group: "Data" },
601
+ items: { label: "Repeat over", control: "binding", group: "Data", placeholder: "{{items}}" },
602
+ index: { label: "Index alias", group: "Data" },
603
+ key: { label: "Row key", control: "binding", group: "Advanced" },
604
+ condition: { label: "Show when", control: "binding", group: "Data", placeholder: "{{flag}}" },
605
+ variant: { label: "Variant", group: "Style" },
606
+ size: { label: "Size", group: "Style" },
607
+ raised: { label: "Shadow", group: "Style" },
608
+ extrude: { label: "Extrude", group: "Style" },
609
+ rounded: { label: "Corners", group: "Style" },
610
+ align: { label: "Alignment", group: "Style" },
611
+ fill: { label: "Colour", group: "Style" },
612
+ stacked: { label: "Stacked spacing", group: "Style" },
613
+ animate: { label: "Animate", group: "Style" },
614
+ buttonVariant: { label: "Button variant", group: "Style" },
615
+ mode: { label: "Mode", group: "Style" },
616
+ rows: { label: "Rows", group: "Style" },
617
+ autosize: { label: "Auto-size", group: "Style" },
618
+ type: { label: "Button type", group: "Content" },
619
+ imageType: { label: "Image format", group: "Advanced" },
620
+ containerClassName: { label: "Container classes", group: "Advanced" },
621
+ canvasClassname: { label: "Canvas classes", group: "Advanced" },
622
+ minLength: { label: "Min length", group: "Advanced" },
623
+ maxLength: { label: "Max length", group: "Advanced" },
624
+ hideWeekends: { label: "Hide weekends", group: "Advanced" },
625
+ pins: { label: "Pins", control: "json", group: "Advanced" },
626
+ zoom: { label: "Zoom", group: "Advanced" },
627
+ pitch: { label: "Pitch", group: "Advanced" },
628
+ fixed: { label: "Fixed viewport", group: "Advanced" },
629
+ allowMultiple: { label: "Allow multiple pins", group: "Advanced" },
630
+ icon: { label: "Icon", group: "Advanced" },
631
+ pingIcon: { label: "Ping icon", control: "json", group: "Advanced" },
632
+ iconProps: { label: "Icon props", control: "json", group: "Advanced" },
633
+ badge: { label: "Badge", control: "json", group: "Advanced" }
634
+ }, Bt = {
635
+ [n.EACH]: { as: { label: "Item alias", group: "Data" } },
636
+ [n.H]: { as: { label: "Render as", group: "Advanced" } },
637
+ [n.P]: { as: { label: "Render as", group: "Advanced" } },
638
+ [n.BUTTON]: { icon: { label: "Icon-only size", group: "Style" } }
639
+ };
640
+ function Ut(s) {
641
+ let l = A[s]?.shape.args;
642
+ for (; l instanceof e.ZodOptional; ) l = l.unwrap();
643
+ return l instanceof e.ZodObject ? l : void 0;
644
+ }
645
+ for (const [s, l] of Object.entries(A)) {
646
+ Oe.add(l, { accepts: "any", ...u[s] });
647
+ const d = Ut(s)?.shape ?? {};
648
+ for (const [c, g] of Object.entries(d))
649
+ Pt.add(g, { ...ft[c], ...Bt[s]?.[c] });
650
+ }
651
+ function Ht(s) {
652
+ const l = A[s];
653
+ return l && Oe.get(l) || { accepts: "any" };
654
+ }
655
+ export {
656
+ Ee as C,
657
+ A as N,
658
+ _t as P,
659
+ kt as a,
660
+ Ht as b,
661
+ vt as c,
662
+ Pt as f,
663
+ Ut as g,
664
+ Oe as n
665
+ };
666
+ //# sourceMappingURL=builder.meta-WpXc5VBB.js.map