@theweekendprojects/emvb-daisyui 0.0.0-stage → 0.2.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 (55) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +106 -2
  3. package/licenses/daisyui-MIT.txt +3 -0
  4. package/package.json +55 -4
  5. package/src/catalog/basic.ts +407 -0
  6. package/src/catalog/class-names.ts +623 -0
  7. package/src/catalog/countdown.ts +392 -0
  8. package/src/catalog/data-display.ts +563 -0
  9. package/src/catalog/forms.ts +433 -0
  10. package/src/catalog/index.ts +77 -0
  11. package/src/catalog/interactive.ts +567 -0
  12. package/src/catalog/layout-marketing.ts +641 -0
  13. package/src/catalog/missing-complex.ts +430 -0
  14. package/src/catalog/missing-primitives.ts +409 -0
  15. package/src/catalog/navigation.ts +438 -0
  16. package/src/catalog/value-class.ts +20 -0
  17. package/src/compatibility/index.ts +104 -0
  18. package/src/compound/editor.ts +299 -0
  19. package/src/compound/index.ts +157 -0
  20. package/src/conformance/cli.ts +9 -0
  21. package/src/conformance/compile.ts +77 -0
  22. package/src/conformance/index.ts +4 -0
  23. package/src/conformance/manifest.ts +39 -0
  24. package/src/conformance/official-inventory.ts +135 -0
  25. package/src/conformance/report-cli.ts +5 -0
  26. package/src/conformance/report.ts +59 -0
  27. package/src/conformance/verify-css.ts +22 -0
  28. package/src/extension/class-token.ts +11 -0
  29. package/src/extension/classes.ts +636 -0
  30. package/src/extension/collect-classes.ts +73 -0
  31. package/src/extension/content.ts +93 -0
  32. package/src/extension/daisy.css +12397 -0
  33. package/src/extension/daisy.js +1 -0
  34. package/src/extension/elements.ts +262 -0
  35. package/src/extension/index.ts +39 -0
  36. package/src/extension/to-output.ts +113 -0
  37. package/src/generator/artifacts.ts +81 -0
  38. package/src/generator/class-names.ts +35 -0
  39. package/src/generator/cli.ts +21 -0
  40. package/src/generator/generate.ts +122 -0
  41. package/src/generator/index.ts +2 -0
  42. package/src/generator/write-class-names.ts +10 -0
  43. package/src/index.ts +12 -0
  44. package/src/render/classes.ts +48 -0
  45. package/src/render/href.ts +19 -0
  46. package/src/render/index.ts +3 -0
  47. package/src/render/provider.ts +37 -0
  48. package/src/renderer.ts +6 -0
  49. package/src/runtime/browser.ts +11 -0
  50. package/src/runtime/index.ts +41 -0
  51. package/src/test-support.ts +13 -0
  52. package/src/themes/index.ts +72 -0
  53. package/src/types.ts +116 -0
  54. package/src/validation/index.ts +153 -0
  55. package/src/verified/primitives.ts +62 -0
@@ -0,0 +1,641 @@
1
+ import type { DaisyComponentDefinition, DaisyVNode } from "../types.ts";
2
+ import { safeHref } from "../render/href.ts";
3
+ const clamp = (value: unknown, min: number, max: number) =>
4
+ Math.min(max, Math.max(min, Number(value)));
5
+
6
+ export const HERO: DaisyComponentDefinition = {
7
+ id: "hero",
8
+ label: "Hero",
9
+ category: "Marketing",
10
+ tag: "section",
11
+ rootClass: "hero",
12
+ container: true,
13
+ fields: [
14
+ { key: "title", label: "Title", kind: "text", default: "Build beautiful pages" },
15
+ {
16
+ key: "body",
17
+ label: "Body",
18
+ kind: "textarea",
19
+ default: "Compose EmDash pages visually with daisyUI.",
20
+ },
21
+ { key: "action", label: "Action label", kind: "text", default: "Get started" },
22
+ { key: "href", label: "Action URL", kind: "href", default: "#start" },
23
+ {
24
+ key: "height",
25
+ label: "Height",
26
+ kind: "select",
27
+ default: "md",
28
+ options: ["sm", "md", "lg", "screen"],
29
+ classMap: { sm: "min-h-64", md: "min-h-96", lg: "min-h-[32rem]", screen: "min-h-screen" },
30
+ },
31
+ {
32
+ key: "align",
33
+ label: "Alignment",
34
+ kind: "select",
35
+ default: "center",
36
+ options: ["start", "center", "end"],
37
+ classMap: { start: "text-left", center: "text-center", end: "text-right" },
38
+ },
39
+ ],
40
+ build(node, classes, children) {
41
+ return {
42
+ tag: "section",
43
+ attrs: { class: classes.join(" ") },
44
+ children: [
45
+ {
46
+ tag: "div",
47
+ attrs: { class: "hero-content" },
48
+ children: [
49
+ {
50
+ tag: "div",
51
+ attrs: { class: "max-w-xl" },
52
+ children: [
53
+ {
54
+ tag: "h1",
55
+ attrs: { class: "text-5xl font-bold" },
56
+ children: [String(node.props.title)],
57
+ },
58
+ { tag: "p", attrs: { class: "py-6" }, children: [String(node.props.body)] },
59
+ {
60
+ tag: "a",
61
+ attrs: { class: "btn btn-primary", href: safeHref(node.props.href) },
62
+ children: [String(node.props.action)],
63
+ },
64
+ ...children,
65
+ ],
66
+ },
67
+ ],
68
+ },
69
+ ],
70
+ };
71
+ },
72
+ };
73
+ export const STACK: DaisyComponentDefinition = {
74
+ id: "stack",
75
+ label: "Stack",
76
+ category: "Layout",
77
+ tag: "div",
78
+ rootClass: "stack",
79
+ container: true,
80
+ fields: [
81
+ { key: "label", label: "Stack label", kind: "text", default: "Stacked content" },
82
+ { key: "count", label: "Placeholder layers", kind: "number", default: 3 },
83
+ {
84
+ key: "size",
85
+ label: "Size",
86
+ kind: "select",
87
+ default: "md",
88
+ options: ["sm", "md", "lg"],
89
+ classMap: { sm: "w-48", md: "w-72", lg: "w-96" },
90
+ },
91
+ {
92
+ key: "placement",
93
+ label: "Layer order",
94
+ kind: "select",
95
+ default: "default",
96
+ options: ["default", "top", "bottom", "start", "end"],
97
+ optionLabels: {
98
+ default: "Last child on top",
99
+ top: "First child on top",
100
+ bottom: "First child at the bottom",
101
+ start: "Stacked to the start",
102
+ end: "Stacked to the end",
103
+ },
104
+ classMap: {
105
+ default: "",
106
+ top: "stack-top",
107
+ bottom: "stack-bottom",
108
+ start: "stack-start",
109
+ end: "stack-end",
110
+ },
111
+ },
112
+ ],
113
+ build(node, classes, children) {
114
+ const count = clamp(node.props.count, 1, 6);
115
+ const placeholders: Array<DaisyVNode> = Array.from(
116
+ { length: Math.max(0, count - children.length) },
117
+ (_, i) => ({
118
+ tag: "div",
119
+ attrs: { class: "card bg-base-200 shadow-sm" },
120
+ children: [{ tag: "div", attrs: { class: "card-body" }, children: [`Layer ${i + 1}`] }],
121
+ }),
122
+ );
123
+ return {
124
+ tag: "div",
125
+ attrs: { class: classes.join(" "), "aria-label": String(node.props.label) },
126
+ children: [...children, ...placeholders].slice(0, count),
127
+ };
128
+ },
129
+ };
130
+ export const DIVIDER: DaisyComponentDefinition = {
131
+ id: "divider",
132
+ label: "Divider",
133
+ category: "Layout",
134
+ tag: "div",
135
+ rootClass: "divider",
136
+ fields: [
137
+ { key: "label", label: "Label", kind: "text", default: "OR", textContent: true },
138
+ {
139
+ key: "direction",
140
+ label: "Direction",
141
+ kind: "select",
142
+ default: "horizontal",
143
+ options: ["horizontal", "vertical"],
144
+ classMap: { horizontal: "divider-horizontal", vertical: "divider-vertical" },
145
+ },
146
+ {
147
+ key: "placement",
148
+ label: "Label position",
149
+ kind: "select",
150
+ default: "center",
151
+ options: ["center", "start", "end"],
152
+ optionLabels: { center: "Centred", start: "Start", end: "End" },
153
+ classMap: { center: "", start: "divider-start", end: "divider-end" },
154
+ },
155
+ {
156
+ key: "tone",
157
+ label: "Color",
158
+ kind: "select",
159
+ default: "neutral",
160
+ options: ["neutral", "primary", "secondary", "accent", "info", "success", "warning", "error"],
161
+ classMap: {
162
+ neutral: "divider-neutral",
163
+ primary: "divider-primary",
164
+ secondary: "divider-secondary",
165
+ accent: "divider-accent",
166
+ info: "divider-info",
167
+ success: "divider-success",
168
+ warning: "divider-warning",
169
+ error: "divider-error",
170
+ },
171
+ },
172
+ ],
173
+ };
174
+ export const JOIN: DaisyComponentDefinition = {
175
+ id: "join",
176
+ label: "Join",
177
+ category: "Layout",
178
+ tag: "div",
179
+ rootClass: "join",
180
+ container: true,
181
+ fields: [
182
+ { key: "label", label: "Group label", kind: "text", default: "Joined controls" },
183
+ {
184
+ key: "direction",
185
+ label: "Direction",
186
+ kind: "select",
187
+ default: "horizontal",
188
+ options: ["horizontal", "vertical"],
189
+ classMap: { horizontal: "join-horizontal", vertical: "join-vertical" },
190
+ },
191
+ ],
192
+ build(node, classes, children) {
193
+ // An empty group shows three buttons, so it has a visible size in the editor and on the page.
194
+ const items: DaisyVNode[] = children.length
195
+ ? children
196
+ : ["Button", "Button", "Button"].map((label) => ({
197
+ tag: "button",
198
+ attrs: { type: "button", class: "btn" },
199
+ children: [label],
200
+ }));
201
+ return {
202
+ tag: "div",
203
+ attrs: { class: classes.join(" "), role: "group", "aria-label": String(node.props.label) },
204
+ children: items.map((child) =>
205
+ Object.assign({}, child, {
206
+ attrs: {
207
+ ...child.attrs,
208
+ // Buttons in a join keep their natural width, as they do in a row of their own.
209
+ class: [
210
+ child.attrs.class,
211
+ "join-item",
212
+ /\bbtn\b/.test(String(child.attrs.class ?? "")) ? "w-auto!" : "",
213
+ ]
214
+ .filter(Boolean)
215
+ .join(" "),
216
+ },
217
+ }),
218
+ ),
219
+ };
220
+ },
221
+ };
222
+ // Position and tone classes belong to the badge; the rest of the classes belong to the root.
223
+ const isBadgeClass = (c: string) => c.startsWith("indicator-") || c.startsWith("badge-");
224
+
225
+ export const INDICATOR: DaisyComponentDefinition = {
226
+ id: "indicator",
227
+ label: "Indicator",
228
+ category: "Layout",
229
+ tag: "div",
230
+ rootClass: "indicator",
231
+ container: true,
232
+ fields: [
233
+ { key: "badge", label: "Indicator text", kind: "text", default: "New" },
234
+ {
235
+ key: "position",
236
+ label: "Position",
237
+ kind: "select",
238
+ default: "top-end",
239
+ options: [
240
+ "top-start",
241
+ "top-center",
242
+ "top-end",
243
+ "middle-start",
244
+ "middle-end",
245
+ "bottom-start",
246
+ "bottom-center",
247
+ "bottom-end",
248
+ ],
249
+ classMap: {
250
+ "top-start": "indicator-top indicator-start",
251
+ "top-center": "indicator-top indicator-center",
252
+ "top-end": "indicator-top indicator-end",
253
+ "middle-start": "indicator-middle indicator-start",
254
+ "middle-end": "indicator-middle indicator-end",
255
+ "bottom-start": "indicator-bottom indicator-start",
256
+ "bottom-center": "indicator-bottom indicator-center",
257
+ "bottom-end": "indicator-bottom indicator-end",
258
+ },
259
+ },
260
+ {
261
+ key: "tone",
262
+ label: "Color",
263
+ kind: "select",
264
+ default: "primary",
265
+ options: ["neutral", "primary", "secondary", "accent", "success", "warning", "error"],
266
+ classMap: {
267
+ neutral: "badge-neutral",
268
+ primary: "badge-primary",
269
+ secondary: "badge-secondary",
270
+ accent: "badge-accent",
271
+ success: "badge-success",
272
+ warning: "badge-warning",
273
+ error: "badge-error",
274
+ },
275
+ },
276
+ ],
277
+ build(node, classes, children) {
278
+ // Position and tone belong to the badge; everything else (root class, centring) to the root.
279
+ const badgeClasses = classes.filter(isBadgeClass);
280
+ return {
281
+ tag: "div",
282
+ attrs: { class: classes.filter((c) => !isBadgeClass(c)).join(" ") },
283
+ children: [
284
+ {
285
+ tag: "span",
286
+ attrs: { class: ["indicator-item badge", ...badgeClasses].join(" ") },
287
+ children: [String(node.props.badge)],
288
+ },
289
+ // With nothing inside, a box stands in for the content the badge sits on.
290
+ ...(children.length
291
+ ? children
292
+ : [{ tag: "div", attrs: { class: "w-32 h-20 rounded-box bg-base-200" }, children: [] }]),
293
+ ],
294
+ };
295
+ },
296
+ };
297
+ export const MASK: DaisyComponentDefinition = {
298
+ id: "mask",
299
+ label: "Mask",
300
+ category: "Layout",
301
+ tag: "img",
302
+ rootClass: "mask",
303
+ fields: [
304
+ { key: "src", label: "Image", kind: "media", default: "", attribute: "src" },
305
+ {
306
+ key: "alt",
307
+ label: "Alternative text",
308
+ kind: "text",
309
+ default: "Masked image",
310
+ attribute: "alt",
311
+ },
312
+ {
313
+ key: "shape",
314
+ label: "Shape",
315
+ kind: "select",
316
+ default: "squircle",
317
+ options: [
318
+ "squircle",
319
+ "heart",
320
+ "hexagon",
321
+ "hexagon-2",
322
+ "decagon",
323
+ "pentagon",
324
+ "diamond",
325
+ "star",
326
+ "star-2",
327
+ "circle",
328
+ "triangle",
329
+ "triangle-2",
330
+ "triangle-3",
331
+ "triangle-4",
332
+ ],
333
+ classMap: {
334
+ triangle: "mask-triangle",
335
+ "triangle-2": "mask-triangle-2",
336
+ "triangle-3": "mask-triangle-3",
337
+ "triangle-4": "mask-triangle-4",
338
+ squircle: "mask-squircle",
339
+ heart: "mask-heart",
340
+ hexagon: "mask-hexagon",
341
+ "hexagon-2": "mask-hexagon-2",
342
+ decagon: "mask-decagon",
343
+ pentagon: "mask-pentagon",
344
+ diamond: "mask-diamond",
345
+ star: "mask-star",
346
+ "star-2": "mask-star-2",
347
+ circle: "mask-circle",
348
+ },
349
+ },
350
+ {
351
+ key: "half",
352
+ label: "Half",
353
+ kind: "select",
354
+ default: "none",
355
+ options: ["none", "half-1", "half-2"],
356
+ optionLabels: { none: "Whole", "half-1": "Left half", "half-2": "Right half" },
357
+ classMap: { none: "", "half-1": "mask-half-1", "half-2": "mask-half-2" },
358
+ },
359
+ {
360
+ key: "size",
361
+ label: "Size",
362
+ kind: "select",
363
+ default: "md",
364
+ options: ["sm", "md", "lg"],
365
+ classMap: {
366
+ sm: "w-24 aspect-square",
367
+ md: "w-48 aspect-square",
368
+ lg: "w-72 aspect-square",
369
+ },
370
+ },
371
+ ],
372
+ build(node, classes) {
373
+ // No picture: a neutral block with the same shape, so no file is requested.
374
+ if (!String(node.props.src ?? "").trim())
375
+ return {
376
+ tag: "div",
377
+ attrs: {
378
+ // A brand gradient: neutral black read as a hole on the dark theme.
379
+ class: [...classes, "bg-linear-to-br from-primary to-secondary"].join(" "),
380
+ role: "img",
381
+ "aria-label": String(node.props.alt),
382
+ },
383
+ children: [],
384
+ };
385
+ return {
386
+ tag: "img",
387
+ attrs: {
388
+ class: classes.join(" "),
389
+ src: safeHref(node.props.src),
390
+ alt: String(node.props.alt),
391
+ loading: "lazy",
392
+ },
393
+ children: [],
394
+ };
395
+ },
396
+ };
397
+ export const BROWSER_MOCKUP: DaisyComponentDefinition = {
398
+ id: "browser-mockup",
399
+ label: "Browser Mockup",
400
+ category: "Marketing",
401
+ tag: "div",
402
+ rootClass: "mockup-browser border border-base-300",
403
+ container: true,
404
+ fields: [
405
+ { key: "url", label: "Address", kind: "text", default: "https://emdash.dev" },
406
+ { key: "content", label: "Content", kind: "textarea", default: "Your page preview" },
407
+ ],
408
+ build(node, classes, children) {
409
+ return {
410
+ tag: "div",
411
+ attrs: { class: classes.join(" ") },
412
+ children: [
413
+ {
414
+ tag: "div",
415
+ attrs: { class: "mockup-browser-toolbar" },
416
+ children: [{ tag: "div", attrs: { class: "input" }, children: [String(node.props.url)] }],
417
+ },
418
+ {
419
+ tag: "div",
420
+ attrs: { class: "grid place-content-center border-t border-base-300 h-64" },
421
+ children: [String(node.props.content), ...children],
422
+ },
423
+ ],
424
+ };
425
+ },
426
+ };
427
+ export const PHONE_MOCKUP: DaisyComponentDefinition = {
428
+ id: "phone-mockup",
429
+ label: "Phone Mockup",
430
+ category: "Marketing",
431
+ tag: "div",
432
+ rootClass: "mockup-phone",
433
+ container: true,
434
+ fields: [
435
+ { key: "camera", label: "Show camera", kind: "boolean", default: true },
436
+ { key: "content", label: "Content", kind: "textarea", default: "Mobile preview" },
437
+ ],
438
+ build(node, classes, children) {
439
+ return {
440
+ tag: "div",
441
+ attrs: { class: classes.join(" ") },
442
+ children: [
443
+ ...(node.props.camera
444
+ ? [{ tag: "div", attrs: { class: "mockup-phone-camera" }, children: [] } as DaisyVNode]
445
+ : []),
446
+ {
447
+ tag: "div",
448
+ attrs: { class: "mockup-phone-display" },
449
+ children: [
450
+ {
451
+ tag: "div",
452
+ attrs: { class: "grid place-content-center bg-base-200 h-full" },
453
+ children: [String(node.props.content), ...children],
454
+ },
455
+ ],
456
+ },
457
+ ],
458
+ };
459
+ },
460
+ };
461
+ export const CODE_MOCKUP: DaisyComponentDefinition = {
462
+ id: "code-mockup",
463
+ label: "Code Mockup",
464
+ category: "Marketing",
465
+ tag: "pre",
466
+ rootClass: "mockup-code",
467
+ fields: [
468
+ { key: "code", label: "Code", kind: "textarea", default: "npm install @theweekendprojects/emvb-daisyui" },
469
+ { key: "prefix", label: "Prompt", kind: "text", default: "$" },
470
+ {
471
+ key: "tone",
472
+ label: "Tone",
473
+ kind: "select",
474
+ default: "neutral",
475
+ options: ["neutral", "primary", "secondary", "accent"],
476
+ classMap: {
477
+ neutral: "bg-neutral text-neutral-content",
478
+ primary: "bg-primary text-primary-content",
479
+ secondary: "bg-secondary text-secondary-content",
480
+ accent: "bg-accent text-accent-content",
481
+ },
482
+ },
483
+ ],
484
+ build(node, classes) {
485
+ return {
486
+ tag: "div",
487
+ attrs: { class: classes.join(" ") },
488
+ children: [
489
+ {
490
+ tag: "pre",
491
+ attrs: { "data-prefix": String(node.props.prefix) },
492
+ children: [{ tag: "code", attrs: {}, children: [String(node.props.code)] }],
493
+ },
494
+ ],
495
+ };
496
+ },
497
+ };
498
+ // Lays children side by side on wide screens and stacks them on phones. The recipes use it for
499
+ // rows of cards and numbers; the Columns setting is the number of columns on a wide screen.
500
+ export const COLUMNS: DaisyComponentDefinition = {
501
+ id: "columns",
502
+ label: "Columns",
503
+ category: "Layout",
504
+ tag: "div",
505
+ rootClass: "grid w-full gap-4",
506
+ container: true,
507
+ fields: [
508
+ {
509
+ key: "columns",
510
+ label: "Columns on a wide screen",
511
+ kind: "select",
512
+ default: "3",
513
+ options: ["2", "3", "4"],
514
+ classMap: { "2": "md:grid-cols-2", "3": "md:grid-cols-3", "4": "md:grid-cols-4" },
515
+ },
516
+ ],
517
+ build(node, classes, children, options) {
518
+ // An empty grid has no height. On the canvas show one labelled cell per column so there is
519
+ // something to drop into; the public page stays empty.
520
+ const count = Number(node.props.columns ?? 3);
521
+ const placeholders =
522
+ options?.mode === "editor" && children.length === 0
523
+ ? Array.from({ length: count }, (_, index) => ({
524
+ tag: "div",
525
+ attrs: { class: "rounded-box bg-base-200 p-6 text-base-content/60" },
526
+ children: [`Column ${index + 1}`],
527
+ }))
528
+ : [];
529
+ return {
530
+ tag: "div",
531
+ attrs: { class: classes.join(" ") },
532
+ children: children.length ? children : placeholders,
533
+ };
534
+ },
535
+ };
536
+
537
+ // Column templates for the split preset, keyed by the ratio the author picks. Full class names
538
+ // on purpose: Tailwind only generates classes it can see as literals in the source.
539
+ const SPLIT_COLUMNS: Record<string, string> = {
540
+ "1:1": "md:grid-cols-2",
541
+ "1:2": "md:grid-cols-[1fr_2fr]",
542
+ "2:1": "md:grid-cols-[2fr_1fr]",
543
+ "1:3": "md:grid-cols-[1fr_3fr]",
544
+ "3:1": "md:grid-cols-[3fr_1fr]",
545
+ };
546
+
547
+ // The sidebar preset keeps its narrow default at 1:1; the other ratios widen or narrow it.
548
+ const SIDEBAR_COLUMNS: Record<string, string> = {
549
+ "1:1": "md:grid-cols-[16rem_1fr]",
550
+ "1:2": "md:grid-cols-[1fr_2fr]",
551
+ "2:1": "md:grid-cols-[2fr_1fr]",
552
+ "1:3": "md:grid-cols-[1fr_3fr]",
553
+ "3:1": "md:grid-cols-[3fr_1fr]",
554
+ };
555
+
556
+ // daisyUI has no container. These presets are the common page structures (single column, two
557
+ // columns, sidebar and content, card row); they stack on phones and split from the medium breakpoint.
558
+ export const CONTAINER: DaisyComponentDefinition = {
559
+ id: "container",
560
+ label: "Container",
561
+ category: "Layout",
562
+ tag: "div",
563
+ rootClass: "container",
564
+ container: true,
565
+ fields: [
566
+ {
567
+ key: "layout",
568
+ label: "Layout",
569
+ kind: "select",
570
+ default: "centered",
571
+ options: ["centered", "split", "sidebar", "cards"],
572
+ optionLabels: {
573
+ centered: "Centred column",
574
+ split: "Two columns",
575
+ sidebar: "Sidebar and content",
576
+ cards: "Three columns",
577
+ },
578
+ classMap: {
579
+ centered: "",
580
+ split: "grid grid-cols-1 gap-6 items-center",
581
+ sidebar: "grid grid-cols-1 gap-6",
582
+ cards: "grid grid-cols-1 md:grid-cols-3 gap-6",
583
+ },
584
+ },
585
+ {
586
+ // Used by the split and sidebar presets. Each class is written out in full so Tailwind
587
+ // generates it. Phones always get one column; the ratio applies from the medium breakpoint.
588
+ key: "ratio",
589
+ label: "Column ratio",
590
+ kind: "select",
591
+ default: "1:1",
592
+ options: ["1:1", "1:2", "2:1", "1:3", "3:1"],
593
+ optionLabels: {
594
+ "1:1": "Equal (sidebar: narrow)",
595
+ "1:2": "1 to 2",
596
+ "2:1": "2 to 1",
597
+ "1:3": "1 to 3",
598
+ "3:1": "3 to 1",
599
+ },
600
+ },
601
+ ],
602
+ build(node, classes, children, options) {
603
+ const ratio = String(node.props.ratio ?? "1:1");
604
+ const columns =
605
+ node.props.layout === "sidebar"
606
+ ? SIDEBAR_COLUMNS[ratio]
607
+ : node.props.layout === "split"
608
+ ? SPLIT_COLUMNS[ratio]
609
+ : undefined;
610
+ // An empty container shows a labelled box only on the canvas, so there is something to drop
611
+ // into; the public page renders nothing for it.
612
+ const placeholder =
613
+ options?.mode === "editor" && children.length === 0
614
+ ? [
615
+ {
616
+ tag: "div",
617
+ attrs: { class: "rounded-box bg-base-200 p-6 text-base-content/60" },
618
+ children: ["Add elements inside this container"],
619
+ },
620
+ ]
621
+ : [];
622
+ return {
623
+ tag: "div",
624
+ attrs: { class: [...classes, columns ?? ""].filter(Boolean).join(" ") },
625
+ children: children.length ? children : placeholder,
626
+ };
627
+ },
628
+ };
629
+
630
+ export const LAYOUT_MARKETING_DAISY_COMPONENTS = [
631
+ HERO,
632
+ STACK,
633
+ DIVIDER,
634
+ JOIN,
635
+ INDICATOR,
636
+ MASK,
637
+ BROWSER_MOCKUP,
638
+ PHONE_MOCKUP,
639
+ CODE_MOCKUP,
640
+ CONTAINER,
641
+ ] as const;