@safe-ugc-ui/types 0.6.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -3,6 +3,21 @@ import { z } from "zod";
3
3
  var refSchema = z.object({
4
4
  $ref: z.string()
5
5
  });
6
+ var templatePartSchema = z.union([
7
+ z.string(),
8
+ z.number(),
9
+ z.boolean(),
10
+ z.null(),
11
+ refSchema
12
+ ]);
13
+ var templateValueSchema = z.object({
14
+ $template: z.array(templatePartSchema).min(1)
15
+ }).strict();
16
+ var templatedStringSchema = z.union([
17
+ z.string(),
18
+ refSchema,
19
+ templateValueSchema
20
+ ]);
6
21
  var assetPathSchema = z.string().startsWith("@assets/");
7
22
  var colorSchema = z.string();
8
23
  var lengthSchema = z.union([z.number(), z.string()]);
@@ -20,12 +35,58 @@ function isRef(value) {
20
35
  function isDynamic(value) {
21
36
  return isRef(value);
22
37
  }
38
+ function isTemplateValue(value) {
39
+ return typeof value === "object" && value !== null && "$template" in value && Array.isArray(value.$template);
40
+ }
23
41
  function isAssetPath(value) {
24
42
  return typeof value === "string" && value.startsWith("@assets/");
25
43
  }
26
44
 
27
- // src/styles.ts
45
+ // src/conditions.ts
28
46
  import { z as z2 } from "zod";
47
+ var conditionOperandLiteralSchema = z2.union([
48
+ z2.string(),
49
+ z2.number(),
50
+ z2.boolean(),
51
+ z2.null()
52
+ ]);
53
+ var conditionOperandSchema = z2.union([
54
+ conditionOperandLiteralSchema,
55
+ refSchema
56
+ ]);
57
+ var comparisonConditionOpSchema = z2.enum([
58
+ "eq",
59
+ "ne",
60
+ "gt",
61
+ "gte",
62
+ "lt",
63
+ "lte"
64
+ ]);
65
+ var comparisonConditionSchema = z2.object({
66
+ op: comparisonConditionOpSchema,
67
+ left: conditionOperandSchema,
68
+ right: conditionOperandSchema
69
+ });
70
+ var conditionSchema = z2.lazy(() => z2.union([
71
+ z2.boolean(),
72
+ refSchema,
73
+ z2.object({
74
+ op: z2.literal("not"),
75
+ value: conditionSchema
76
+ }),
77
+ z2.object({
78
+ op: z2.literal("and"),
79
+ values: z2.array(conditionSchema).min(1)
80
+ }),
81
+ z2.object({
82
+ op: z2.literal("or"),
83
+ values: z2.array(conditionSchema).min(1)
84
+ }),
85
+ comparisonConditionSchema
86
+ ]));
87
+
88
+ // src/styles.ts
89
+ import { z as z3 } from "zod";
29
90
 
30
91
  // src/constants.ts
31
92
  var CARD_JSON_MAX_BYTES = 1e6;
@@ -34,8 +95,10 @@ var STYLE_OBJECTS_TOTAL_MAX_BYTES = 1e5;
34
95
  var ASSET_INDIVIDUAL_MAX_BYTES = 5e6;
35
96
  var ASSET_TOTAL_MAX_BYTES = 5e7;
36
97
  var MAX_NODE_COUNT = 1e4;
98
+ var MAX_INTERACTIVE_ITEMS = 16;
37
99
  var MAX_LOOP_ITERATIONS = 1e3;
38
100
  var MAX_NESTED_LOOPS = 2;
101
+ var MAX_CONDITION_DEPTH = 5;
39
102
  var MAX_OVERFLOW_AUTO_COUNT = 2;
40
103
  var MAX_STACK_NESTING = 3;
41
104
  var COMPACT_BREAKPOINT_MAX_WIDTH = 480;
@@ -55,6 +118,7 @@ var ALLOWED_FONT_FAMILIES = [
55
118
  "display",
56
119
  "handwriting"
57
120
  ];
121
+ var ASPECT_RATIO_PATTERN = /^\s*[0-9]+(\.[0-9]+)?\s*\/\s*[0-9]+(\.[0-9]+)?\s*$/;
58
122
  var TEXT_SHADOW_MAX_COUNT = 5;
59
123
  var TEXT_SHADOW_BLUR_MAX = 100;
60
124
  var BOX_SHADOW_MAX_COUNT = 5;
@@ -150,7 +214,9 @@ var ALL_COMPONENT_TYPES = [
150
214
  "Chip",
151
215
  // 2.4 Interaction (optional)
152
216
  "Button",
153
- "Toggle"
217
+ "Toggle",
218
+ "Accordion",
219
+ "Tabs"
154
220
  ];
155
221
  var FORBIDDEN_STYLE_PROPERTIES = [
156
222
  "backgroundImage",
@@ -331,71 +397,71 @@ var CSS_NAMED_COLORS = /* @__PURE__ */ new Set([
331
397
  ]);
332
398
 
333
399
  // src/styles.ts
334
- var gradientStopSchema = z2.object({
335
- color: dynamicSchema(z2.string()),
336
- position: dynamicSchema(z2.string())
400
+ var gradientStopSchema = z3.object({
401
+ color: dynamicSchema(z3.string()),
402
+ position: dynamicSchema(z3.string())
337
403
  // e.g. "0%", "100%"
338
404
  });
339
- var linearGradientSchema = z2.object({
340
- type: z2.literal("linear"),
341
- direction: dynamicSchema(z2.string()),
405
+ var linearGradientSchema = z3.object({
406
+ type: z3.literal("linear"),
407
+ direction: dynamicSchema(z3.string()),
342
408
  // e.g. "135deg", "to right"
343
- stops: z2.array(gradientStopSchema)
409
+ stops: z3.array(gradientStopSchema)
344
410
  });
345
- var radialGradientSchema = z2.object({
346
- type: z2.literal("radial"),
347
- stops: z2.array(gradientStopSchema)
411
+ var radialGradientSchema = z3.object({
412
+ type: z3.literal("radial"),
413
+ stops: z3.array(gradientStopSchema)
348
414
  });
349
- var repeatingLinearGradientSchema = z2.object({
350
- type: z2.literal("repeating-linear"),
351
- direction: dynamicSchema(z2.string()),
415
+ var repeatingLinearGradientSchema = z3.object({
416
+ type: z3.literal("repeating-linear"),
417
+ direction: dynamicSchema(z3.string()),
352
418
  // e.g. "180deg"
353
- stops: z2.array(gradientStopSchema)
419
+ stops: z3.array(gradientStopSchema)
354
420
  });
355
- var gradientObjectSchema = z2.union([
421
+ var gradientObjectSchema = z3.union([
356
422
  linearGradientSchema,
357
423
  radialGradientSchema,
358
424
  repeatingLinearGradientSchema
359
425
  ]);
360
- var shadowObjectSchema = z2.object({
361
- offsetX: dynamicSchema(z2.number()),
362
- offsetY: dynamicSchema(z2.number()),
363
- blur: dynamicSchema(z2.number()).optional(),
364
- spread: dynamicSchema(z2.number()).optional(),
365
- color: dynamicSchema(z2.string())
366
- });
367
- var textShadowObjectSchema = z2.object({
368
- offsetX: dynamicSchema(z2.number()),
369
- offsetY: dynamicSchema(z2.number()),
370
- blur: dynamicSchema(z2.number()).optional(),
371
- color: dynamicSchema(z2.string())
372
- });
373
- var borderStyleValueSchema = z2.enum(["solid", "dashed", "dotted", "none"]);
374
- var borderObjectSchema = z2.object({
375
- width: dynamicSchema(z2.number()),
426
+ var shadowObjectSchema = z3.object({
427
+ offsetX: dynamicSchema(z3.number()),
428
+ offsetY: dynamicSchema(z3.number()),
429
+ blur: dynamicSchema(z3.number()).optional(),
430
+ spread: dynamicSchema(z3.number()).optional(),
431
+ color: dynamicSchema(z3.string())
432
+ });
433
+ var textShadowObjectSchema = z3.object({
434
+ offsetX: dynamicSchema(z3.number()),
435
+ offsetY: dynamicSchema(z3.number()),
436
+ blur: dynamicSchema(z3.number()).optional(),
437
+ color: dynamicSchema(z3.string())
438
+ });
439
+ var borderStyleValueSchema = z3.enum(["solid", "dashed", "dotted", "none"]);
440
+ var borderObjectSchema = z3.object({
441
+ width: dynamicSchema(z3.number()),
376
442
  style: dynamicSchema(borderStyleValueSchema),
377
- color: dynamicSchema(z2.string())
443
+ color: dynamicSchema(z3.string())
378
444
  });
379
- var transformObjectSchema = z2.object({
380
- rotate: dynamicSchema(z2.string()).optional(),
445
+ var transformObjectSchema = z3.object({
446
+ rotate: dynamicSchema(z3.string()).optional(),
381
447
  // e.g. "45deg"
382
- scale: dynamicSchema(z2.number()).optional(),
448
+ scale: dynamicSchema(z3.number()).optional(),
383
449
  // 0.1 ~ 1.5
384
- translateX: dynamicSchema(z2.number()).optional(),
450
+ translateX: dynamicSchema(z3.number()).optional(),
385
451
  // -500 ~ 500
386
- translateY: dynamicSchema(z2.number()).optional()
452
+ translateY: dynamicSchema(z3.number()).optional()
387
453
  // -500 ~ 500
388
454
  });
389
- var positionValueSchema = z2.enum(["static", "relative", "absolute"]);
390
- var overflowValueSchema = z2.enum(["visible", "hidden", "auto"]);
391
- var displayValueSchema = z2.enum(["flex", "block", "none"]);
392
- var flexDirectionValueSchema = z2.enum([
455
+ var positionValueSchema = z3.enum(["static", "relative", "absolute"]);
456
+ var overflowValueSchema = z3.enum(["visible", "hidden", "auto"]);
457
+ var displayValueSchema = z3.enum(["flex", "block", "none"]);
458
+ var flexDirectionValueSchema = z3.enum([
393
459
  "row",
394
460
  "column",
395
461
  "row-reverse",
396
462
  "column-reverse"
397
463
  ]);
398
- var justifyContentValueSchema = z2.enum([
464
+ var justifyContentValueSchema = z3.enum([
399
465
  "start",
400
466
  "flex-start",
401
467
  "center",
@@ -405,7 +471,7 @@ var justifyContentValueSchema = z2.enum([
405
471
  "space-around",
406
472
  "space-evenly"
407
473
  ]);
408
- var alignItemsValueSchema = z2.enum([
474
+ var alignItemsValueSchema = z3.enum([
409
475
  "start",
410
476
  "flex-start",
411
477
  "center",
@@ -414,7 +480,7 @@ var alignItemsValueSchema = z2.enum([
414
480
  "stretch",
415
481
  "baseline"
416
482
  ]);
417
- var alignSelfValueSchema = z2.enum([
483
+ var alignSelfValueSchema = z3.enum([
418
484
  "auto",
419
485
  "start",
420
486
  "flex-start",
@@ -423,57 +489,68 @@ var alignSelfValueSchema = z2.enum([
423
489
  "flex-end",
424
490
  "stretch"
425
491
  ]);
426
- var flexWrapValueSchema = z2.enum(["nowrap", "wrap", "wrap-reverse"]);
427
- var textAlignValueSchema = z2.enum([
492
+ var flexWrapValueSchema = z3.enum(["nowrap", "wrap", "wrap-reverse"]);
493
+ var textAlignValueSchema = z3.enum([
428
494
  "left",
429
495
  "center",
430
496
  "right",
431
497
  "justify"
432
498
  ]);
433
- var textDecorationValueSchema = z2.enum([
499
+ var textDecorationValueSchema = z3.enum([
434
500
  "none",
435
501
  "underline",
436
502
  "line-through"
437
503
  ]);
438
- var fontStyleValueSchema = z2.enum(["normal", "italic"]);
439
- var fontFamilyValueSchema = z2.enum(ALLOWED_FONT_FAMILIES);
440
- var fontWeightValueSchema = z2.union([
441
- z2.enum(["normal", "bold"]),
442
- z2.literal("100"),
443
- z2.literal("200"),
444
- z2.literal("300"),
445
- z2.literal("400"),
446
- z2.literal("500"),
447
- z2.literal("600"),
448
- z2.literal("700"),
449
- z2.literal("800"),
450
- z2.literal("900"),
451
- z2.literal(100),
452
- z2.literal(200),
453
- z2.literal(300),
454
- z2.literal(400),
455
- z2.literal(500),
456
- z2.literal(600),
457
- z2.literal(700),
458
- z2.literal(800),
459
- z2.literal(900)
504
+ var fontStyleValueSchema = z3.enum(["normal", "italic"]);
505
+ var fontFamilyValueSchema = z3.enum(ALLOWED_FONT_FAMILIES);
506
+ var fontWeightValueSchema = z3.union([
507
+ z3.enum(["normal", "bold"]),
508
+ z3.literal("100"),
509
+ z3.literal("200"),
510
+ z3.literal("300"),
511
+ z3.literal("400"),
512
+ z3.literal("500"),
513
+ z3.literal("600"),
514
+ z3.literal("700"),
515
+ z3.literal("800"),
516
+ z3.literal("900"),
517
+ z3.literal(100),
518
+ z3.literal(200),
519
+ z3.literal(300),
520
+ z3.literal(400),
521
+ z3.literal(500),
522
+ z3.literal(600),
523
+ z3.literal(700),
524
+ z3.literal(800),
525
+ z3.literal(900)
460
526
  ]);
461
- var easingValueSchema = z2.enum([
527
+ var easingValueSchema = z3.enum([
462
528
  "ease",
463
529
  "linear",
464
530
  "ease-in",
465
531
  "ease-out",
466
532
  "ease-in-out"
467
533
  ]);
468
- var transitionDefSchema = z2.object({
469
- property: z2.string(),
470
- duration: z2.number(),
534
+ var transitionDefSchema = z3.object({
535
+ property: z3.string(),
536
+ duration: z3.number(),
471
537
  easing: easingValueSchema.optional(),
472
- delay: z2.number().optional()
538
+ delay: z3.number().optional()
473
539
  });
474
- var transitionFieldSchema = z2.union([transitionDefSchema, z2.array(transitionDefSchema)]).optional();
475
- var sizeValueSchema = z2.union([lengthSchema, percentageSchema, z2.literal("auto")]);
476
- var lineHeightValueSchema = z2.union([z2.number(), lengthSchema]);
540
+ var transitionFieldSchema = z3.union([transitionDefSchema, z3.array(transitionDefSchema)]).optional();
541
+ var textSpanStyleSchema = z3.object({
542
+ backgroundColor: dynamicSchema(colorSchema).optional(),
543
+ color: dynamicSchema(colorSchema).optional(),
544
+ fontFamily: dynamicSchema(fontFamilyValueSchema).optional(),
545
+ fontSize: dynamicSchema(lengthSchema).optional(),
546
+ fontWeight: dynamicSchema(fontWeightValueSchema).optional(),
547
+ fontStyle: dynamicSchema(fontStyleValueSchema).optional(),
548
+ textDecoration: dynamicSchema(textDecorationValueSchema).optional(),
549
+ letterSpacing: dynamicSchema(lengthSchema).optional(),
550
+ textShadow: z3.union([textShadowObjectSchema, z3.array(textShadowObjectSchema)]).optional()
551
+ }).strict();
552
+ var sizeValueSchema = z3.union([lengthSchema, percentageSchema, z3.literal("auto")]);
553
+ var lineHeightValueSchema = z3.union([z3.number(), lengthSchema]);
477
554
  var coreStyleShape = {
478
555
  // -----------------------------------------------------------------------
479
556
  // Layout — Dynamic
@@ -484,17 +561,21 @@ var coreStyleShape = {
484
561
  alignItems: dynamicSchema(alignItemsValueSchema).optional(),
485
562
  alignSelf: dynamicSchema(alignSelfValueSchema).optional(),
486
563
  flexWrap: dynamicSchema(flexWrapValueSchema).optional(),
487
- flex: dynamicSchema(z2.number()).optional(),
564
+ flex: dynamicSchema(z3.number()).optional(),
488
565
  gap: dynamicSchema(lengthSchema).optional(),
489
566
  // -----------------------------------------------------------------------
490
567
  // Sizing — Dynamic
491
568
  // -----------------------------------------------------------------------
492
569
  width: dynamicSchema(sizeValueSchema).optional(),
493
570
  height: dynamicSchema(sizeValueSchema).optional(),
494
- minWidth: dynamicSchema(z2.union([lengthSchema, percentageSchema])).optional(),
495
- maxWidth: dynamicSchema(z2.union([lengthSchema, percentageSchema])).optional(),
496
- minHeight: dynamicSchema(z2.union([lengthSchema, percentageSchema])).optional(),
497
- maxHeight: dynamicSchema(z2.union([lengthSchema, percentageSchema])).optional(),
571
+ aspectRatio: dynamicSchema(z3.union([
572
+ z3.number().positive(),
573
+ z3.string().regex(ASPECT_RATIO_PATTERN)
574
+ ])).optional(),
575
+ minWidth: dynamicSchema(z3.union([lengthSchema, percentageSchema])).optional(),
576
+ maxWidth: dynamicSchema(z3.union([lengthSchema, percentageSchema])).optional(),
577
+ minHeight: dynamicSchema(z3.union([lengthSchema, percentageSchema])).optional(),
578
+ maxHeight: dynamicSchema(z3.union([lengthSchema, percentageSchema])).optional(),
498
579
  // -----------------------------------------------------------------------
499
580
  // Spacing — Dynamic
500
581
  // -----------------------------------------------------------------------
@@ -535,7 +616,7 @@ var coreStyleShape = {
535
616
  // -----------------------------------------------------------------------
536
617
  // Opacity — Dynamic
537
618
  // -----------------------------------------------------------------------
538
- opacity: dynamicSchema(z2.number()).optional(),
619
+ opacity: dynamicSchema(z3.number()).optional(),
539
620
  // -----------------------------------------------------------------------
540
621
  // Gradient — Static only
541
622
  // -----------------------------------------------------------------------
@@ -543,11 +624,11 @@ var coreStyleShape = {
543
624
  // -----------------------------------------------------------------------
544
625
  // Shadow — Static only (single or array of shadows)
545
626
  // -----------------------------------------------------------------------
546
- boxShadow: z2.union([shadowObjectSchema, z2.array(shadowObjectSchema)]).optional(),
627
+ boxShadow: z3.union([shadowObjectSchema, z3.array(shadowObjectSchema)]).optional(),
547
628
  // -----------------------------------------------------------------------
548
629
  // Text shadow — Static only (single or array of shadows)
549
630
  // -----------------------------------------------------------------------
550
- textShadow: z2.union([textShadowObjectSchema, z2.array(textShadowObjectSchema)]).optional(),
631
+ textShadow: z3.union([textShadowObjectSchema, z3.array(textShadowObjectSchema)]).optional(),
551
632
  // -----------------------------------------------------------------------
552
633
  // Borders — Static only
553
634
  // -----------------------------------------------------------------------
@@ -575,184 +656,224 @@ var coreStyleShape = {
575
656
  // -----------------------------------------------------------------------
576
657
  // Object-fit — Dynamic (for Image nodes)
577
658
  // -----------------------------------------------------------------------
578
- objectFit: dynamicSchema(z2.enum(["cover", "contain", "fill", "none", "scale-down"])).optional(),
579
- objectPosition: dynamicSchema(z2.string()).optional(),
659
+ objectFit: dynamicSchema(z3.enum(["cover", "contain", "fill", "none", "scale-down"])).optional(),
660
+ objectPosition: dynamicSchema(z3.string()).optional(),
580
661
  // -----------------------------------------------------------------------
581
662
  // Grid — Dynamic
582
663
  // -----------------------------------------------------------------------
583
- gridTemplateColumns: dynamicSchema(z2.string()).optional(),
584
- gridTemplateRows: dynamicSchema(z2.string()).optional(),
585
- gridColumn: dynamicSchema(z2.string()).optional(),
586
- gridRow: dynamicSchema(z2.string()).optional(),
664
+ gridTemplateColumns: dynamicSchema(z3.string()).optional(),
665
+ gridTemplateRows: dynamicSchema(z3.string()).optional(),
666
+ gridColumn: dynamicSchema(z3.string()).optional(),
667
+ gridRow: dynamicSchema(z3.string()).optional(),
587
668
  // -----------------------------------------------------------------------
588
669
  // z-index — Static only (0-100 enforced at validation layer)
589
670
  // -----------------------------------------------------------------------
590
- zIndex: z2.number().optional(),
671
+ zIndex: z3.number().optional(),
591
672
  // -----------------------------------------------------------------------
592
673
  // $style — reference to a named style in card.styles
593
674
  // -----------------------------------------------------------------------
594
- $style: z2.string().optional()
675
+ $style: z3.string().optional()
595
676
  };
596
- var hoverStylePropsSchema = z2.object({
677
+ var hoverStylePropsSchema = z3.object({
597
678
  ...coreStyleShape,
598
679
  transition: transitionFieldSchema
599
680
  });
600
- var responsiveStylePropsSchema = z2.object({
681
+ var responsiveStylePropsSchema = z3.object({
601
682
  ...coreStyleShape
602
683
  });
603
- var responsivePropsSchema = z2.object({
684
+ var responsivePropsSchema = z3.object({
604
685
  compact: responsiveStylePropsSchema.optional()
605
686
  }).strict();
606
- var stylePropsSchema = z2.object({
687
+ var stylePropsSchema = z3.object({
607
688
  ...coreStyleShape,
608
689
  hoverStyle: hoverStylePropsSchema.optional(),
609
690
  transition: transitionFieldSchema
610
691
  });
611
692
 
612
693
  // src/props.ts
613
- import { z as z3 } from "zod";
614
- var textPropsSchema = z3.object({
615
- content: dynamicSchema(z3.string())
694
+ import { z as z4 } from "zod";
695
+ var textSpanSchema = z4.object({
696
+ text: templatedStringSchema,
697
+ style: textSpanStyleSchema.optional()
698
+ }).strict();
699
+ var textPropsSchema = z4.object({
700
+ content: templatedStringSchema.optional(),
701
+ spans: z4.array(textSpanSchema).min(1).max(32).optional(),
702
+ maxLines: z4.number().int().min(1).max(10).optional(),
703
+ truncate: z4.enum(["ellipsis", "clip"]).optional()
616
704
  });
617
- var imagePropsSchema = z3.object({
705
+ var imagePropsSchema = z4.object({
618
706
  src: refOnlySchema(assetPathSchema),
619
- alt: dynamicSchema(z3.string()).optional()
707
+ alt: dynamicSchema(z4.string()).optional()
620
708
  });
621
- var progressBarPropsSchema = z3.object({
622
- value: dynamicSchema(z3.number()),
623
- max: dynamicSchema(z3.number()),
709
+ var progressBarPropsSchema = z4.object({
710
+ value: dynamicSchema(z4.number()),
711
+ max: dynamicSchema(z4.number()),
624
712
  color: dynamicSchema(colorSchema).optional()
625
713
  });
626
- var avatarPropsSchema = z3.object({
714
+ var avatarPropsSchema = z4.object({
627
715
  src: refOnlySchema(assetPathSchema),
628
716
  size: dynamicSchema(lengthSchema).optional()
629
717
  });
630
- var iconPropsSchema = z3.object({
718
+ var iconPropsSchema = z4.object({
631
719
  name: dynamicSchema(iconNameSchema),
632
720
  size: dynamicSchema(lengthSchema).optional(),
633
721
  color: dynamicSchema(colorSchema).optional()
634
722
  });
635
- var badgePropsSchema = z3.object({
636
- label: dynamicSchema(z3.string()),
723
+ var badgePropsSchema = z4.object({
724
+ label: templatedStringSchema,
637
725
  color: dynamicSchema(colorSchema).optional()
638
726
  });
639
- var chipPropsSchema = z3.object({
640
- label: dynamicSchema(z3.string()),
727
+ var chipPropsSchema = z4.object({
728
+ label: templatedStringSchema,
641
729
  color: dynamicSchema(colorSchema).optional()
642
730
  });
643
- var dividerPropsSchema = z3.object({
731
+ var dividerPropsSchema = z4.object({
644
732
  color: dynamicSchema(colorSchema).optional(),
645
733
  thickness: dynamicSchema(lengthSchema).optional()
646
734
  });
647
- var spacerPropsSchema = z3.object({
735
+ var spacerPropsSchema = z4.object({
648
736
  size: dynamicSchema(lengthSchema).optional()
649
737
  });
650
- var buttonPropsSchema = z3.object({
651
- label: dynamicSchema(z3.string()),
652
- action: z3.string()
738
+ var buttonPropsSchema = z4.object({
739
+ label: templatedStringSchema,
740
+ action: z4.string(),
741
+ disabled: z4.union([z4.boolean(), refSchema]).optional()
653
742
  });
654
- var togglePropsSchema = z3.object({
655
- value: dynamicSchema(z3.boolean()),
656
- onToggle: z3.string()
743
+ var togglePropsSchema = z4.object({
744
+ value: dynamicSchema(z4.boolean()),
745
+ onToggle: z4.string(),
746
+ disabled: dynamicSchema(z4.boolean()).optional()
657
747
  });
658
748
 
659
749
  // src/primitives.ts
660
- import { z as z4 } from "zod";
661
- var forLoopSchema = z4.object({
662
- for: z4.string(),
663
- in: z4.string(),
664
- template: z4.lazy(() => ugcNodeSchema)
750
+ import { z as z5 } from "zod";
751
+ var fragmentUseNodeSchema = z5.object({
752
+ $use: z5.string(),
753
+ $if: conditionSchema.optional()
754
+ }).strict();
755
+ var forLoopSchema = z5.object({
756
+ for: z5.string(),
757
+ in: z5.string(),
758
+ template: z5.lazy(() => renderableNodeSchema)
665
759
  });
666
- var childrenSchema = z4.union([
667
- z4.array(z4.lazy(() => ugcNodeSchema)),
760
+ var childrenSchema = z5.union([
761
+ z5.array(z5.lazy(() => renderableNodeSchema)),
668
762
  forLoopSchema
669
763
  ]);
670
764
  var baseFields = {
765
+ $if: conditionSchema.optional(),
671
766
  style: stylePropsSchema.optional(),
672
767
  responsive: responsivePropsSchema.optional()
673
768
  };
674
- var boxNodeSchema = z4.object({
675
- type: z4.literal("Box"),
769
+ var boxNodeSchema = z5.object({
770
+ type: z5.literal("Box"),
676
771
  children: childrenSchema.optional(),
677
772
  ...baseFields
678
773
  });
679
- var rowNodeSchema = z4.object({
680
- type: z4.literal("Row"),
774
+ var rowNodeSchema = z5.object({
775
+ type: z5.literal("Row"),
681
776
  children: childrenSchema.optional(),
682
777
  ...baseFields
683
778
  });
684
- var columnNodeSchema = z4.object({
685
- type: z4.literal("Column"),
779
+ var columnNodeSchema = z5.object({
780
+ type: z5.literal("Column"),
686
781
  children: childrenSchema.optional(),
687
782
  ...baseFields
688
783
  });
689
- var stackNodeSchema = z4.object({
690
- type: z4.literal("Stack"),
784
+ var stackNodeSchema = z5.object({
785
+ type: z5.literal("Stack"),
691
786
  children: childrenSchema.optional(),
692
787
  ...baseFields
693
788
  });
694
- var gridNodeSchema = z4.object({
695
- type: z4.literal("Grid"),
789
+ var gridNodeSchema = z5.object({
790
+ type: z5.literal("Grid"),
696
791
  children: childrenSchema.optional(),
697
792
  ...baseFields
698
793
  });
699
- var textNodeSchema = z4.object({
700
- type: z4.literal("Text"),
794
+ var textNodeSchema = z5.object({
795
+ type: z5.literal("Text"),
701
796
  ...textPropsSchema.shape,
702
797
  ...baseFields
703
798
  });
704
- var imageNodeSchema = z4.object({
705
- type: z4.literal("Image"),
799
+ var imageNodeSchema = z5.object({
800
+ type: z5.literal("Image"),
706
801
  ...imagePropsSchema.shape,
707
802
  ...baseFields
708
803
  });
709
- var progressBarNodeSchema = z4.object({
710
- type: z4.literal("ProgressBar"),
804
+ var progressBarNodeSchema = z5.object({
805
+ type: z5.literal("ProgressBar"),
711
806
  ...progressBarPropsSchema.shape,
712
807
  ...baseFields
713
808
  });
714
- var avatarNodeSchema = z4.object({
715
- type: z4.literal("Avatar"),
809
+ var avatarNodeSchema = z5.object({
810
+ type: z5.literal("Avatar"),
716
811
  ...avatarPropsSchema.shape,
717
812
  ...baseFields
718
813
  });
719
- var iconNodeSchema = z4.object({
720
- type: z4.literal("Icon"),
814
+ var iconNodeSchema = z5.object({
815
+ type: z5.literal("Icon"),
721
816
  ...iconPropsSchema.shape,
722
817
  ...baseFields
723
818
  });
724
- var badgeNodeSchema = z4.object({
725
- type: z4.literal("Badge"),
819
+ var badgeNodeSchema = z5.object({
820
+ type: z5.literal("Badge"),
726
821
  ...badgePropsSchema.shape,
727
822
  ...baseFields
728
823
  });
729
- var chipNodeSchema = z4.object({
730
- type: z4.literal("Chip"),
824
+ var chipNodeSchema = z5.object({
825
+ type: z5.literal("Chip"),
731
826
  ...chipPropsSchema.shape,
732
827
  ...baseFields
733
828
  });
734
- var dividerNodeSchema = z4.object({
735
- type: z4.literal("Divider"),
829
+ var dividerNodeSchema = z5.object({
830
+ type: z5.literal("Divider"),
736
831
  ...dividerPropsSchema.shape,
737
832
  ...baseFields
738
833
  });
739
- var spacerNodeSchema = z4.object({
740
- type: z4.literal("Spacer"),
834
+ var spacerNodeSchema = z5.object({
835
+ type: z5.literal("Spacer"),
741
836
  ...spacerPropsSchema.shape,
742
837
  ...baseFields
743
838
  });
744
- var buttonNodeSchema = z4.object({
745
- type: z4.literal("Button"),
839
+ var buttonNodeSchema = z5.object({
840
+ type: z5.literal("Button"),
746
841
  ...buttonPropsSchema.shape,
747
842
  ...baseFields
748
843
  });
749
- var toggleNodeSchema = z4.object({
750
- type: z4.literal("Toggle"),
844
+ var toggleNodeSchema = z5.object({
845
+ type: z5.literal("Toggle"),
751
846
  ...togglePropsSchema.shape,
752
847
  ...baseFields
753
848
  });
754
- var ugcNodeSchema = z4.lazy(
755
- () => z4.discriminatedUnion("type", [
849
+ var interactiveItemIdSchema = z5.string().min(1).max(64);
850
+ var accordionItemSchema = z5.object({
851
+ id: interactiveItemIdSchema,
852
+ label: templatedStringSchema,
853
+ content: z5.lazy(() => renderableNodeSchema),
854
+ disabled: dynamicSchema(z5.boolean()).optional()
855
+ }).strict();
856
+ var tabsItemSchema = z5.object({
857
+ id: interactiveItemIdSchema,
858
+ label: templatedStringSchema,
859
+ content: z5.lazy(() => renderableNodeSchema),
860
+ disabled: dynamicSchema(z5.boolean()).optional()
861
+ }).strict();
862
+ var accordionNodeSchema = z5.object({
863
+ type: z5.literal("Accordion"),
864
+ items: z5.array(accordionItemSchema).min(1).max(MAX_INTERACTIVE_ITEMS),
865
+ allowMultiple: z5.boolean().optional(),
866
+ defaultExpanded: z5.array(interactiveItemIdSchema).max(MAX_INTERACTIVE_ITEMS).optional(),
867
+ ...baseFields
868
+ });
869
+ var tabsNodeSchema = z5.object({
870
+ type: z5.literal("Tabs"),
871
+ tabs: z5.array(tabsItemSchema).min(1).max(MAX_INTERACTIVE_ITEMS),
872
+ defaultTab: interactiveItemIdSchema.optional(),
873
+ ...baseFields
874
+ });
875
+ var ugcNodeSchema = z5.lazy(
876
+ () => z5.discriminatedUnion("type", [
756
877
  boxNodeSchema,
757
878
  rowNodeSchema,
758
879
  columnNodeSchema,
@@ -768,11 +889,19 @@ var ugcNodeSchema = z4.lazy(
768
889
  dividerNodeSchema,
769
890
  spacerNodeSchema,
770
891
  buttonNodeSchema,
771
- toggleNodeSchema
892
+ toggleNodeSchema,
893
+ accordionNodeSchema,
894
+ tabsNodeSchema
772
895
  ])
773
896
  );
774
- var phase1NodeSchema = z4.lazy(
775
- () => z4.discriminatedUnion("type", [
897
+ var renderableNodeSchema = z5.lazy(
898
+ () => z5.union([
899
+ ugcNodeSchema,
900
+ fragmentUseNodeSchema
901
+ ])
902
+ );
903
+ var phase1NodeSchema = z5.lazy(
904
+ () => z5.discriminatedUnion("type", [
776
905
  boxNodeSchema,
777
906
  rowNodeSchema,
778
907
  columnNodeSchema,
@@ -782,24 +911,26 @@ var phase1NodeSchema = z4.lazy(
782
911
  );
783
912
 
784
913
  // src/card.ts
785
- import { z as z5 } from "zod";
786
- var cardMetaSchema = z5.object({
787
- name: z5.string(),
788
- version: z5.string()
914
+ import { z as z6 } from "zod";
915
+ var cardMetaSchema = z6.object({
916
+ name: z6.string(),
917
+ version: z6.string()
789
918
  });
790
919
  var styleNamePattern = /^[A-Za-z][A-Za-z0-9_-]*$/;
791
- var ugcCardSchema = z5.object({
920
+ var ugcCardSchema = z6.object({
792
921
  meta: cardMetaSchema,
793
- assets: z5.record(z5.string(), z5.string()).optional(),
794
- state: z5.record(z5.string(), z5.unknown()).optional(),
795
- styles: z5.record(z5.string().regex(styleNamePattern), stylePropsSchema).optional(),
796
- views: z5.record(z5.string(), ugcNodeSchema)
922
+ assets: z6.record(z6.string(), z6.string()).optional(),
923
+ state: z6.record(z6.string(), z6.unknown()).optional(),
924
+ styles: z6.record(z6.string().regex(styleNamePattern), stylePropsSchema).optional(),
925
+ fragments: z6.record(z6.string().regex(styleNamePattern), ugcNodeSchema).optional(),
926
+ views: z6.record(z6.string(), renderableNodeSchema)
797
927
  });
798
928
  export {
799
929
  ALLOWED_FONT_FAMILIES,
800
930
  ALLOWED_OVERFLOW_VALUES,
801
931
  ALLOWED_TRANSITION_PROPERTIES,
802
932
  ALL_COMPONENT_TYPES,
933
+ ASPECT_RATIO_PATTERN,
803
934
  ASSET_INDIVIDUAL_MAX_BYTES,
804
935
  ASSET_TOTAL_MAX_BYTES,
805
936
  BORDER_RADIUS_MAX,
@@ -816,6 +947,8 @@ export {
816
947
  FORBIDDEN_STYLE_PROPERTIES,
817
948
  LETTER_SPACING_MAX,
818
949
  LETTER_SPACING_MIN,
950
+ MAX_CONDITION_DEPTH,
951
+ MAX_INTERACTIVE_ITEMS,
819
952
  MAX_LOOP_ITERATIONS,
820
953
  MAX_NESTED_LOOPS,
821
954
  MAX_NODE_COUNT,
@@ -838,6 +971,8 @@ export {
838
971
  TRANSITION_MAX_COUNT,
839
972
  ZINDEX_MAX,
840
973
  ZINDEX_MIN,
974
+ accordionItemSchema,
975
+ accordionNodeSchema,
841
976
  alignItemsValueSchema,
842
977
  alignSelfValueSchema,
843
978
  assetPathSchema,
@@ -855,6 +990,11 @@ export {
855
990
  chipPropsSchema,
856
991
  colorSchema,
857
992
  columnNodeSchema,
993
+ comparisonConditionOpSchema,
994
+ comparisonConditionSchema,
995
+ conditionOperandLiteralSchema,
996
+ conditionOperandSchema,
997
+ conditionSchema,
858
998
  displayValueSchema,
859
999
  dividerNodeSchema,
860
1000
  dividerPropsSchema,
@@ -866,6 +1006,7 @@ export {
866
1006
  fontStyleValueSchema,
867
1007
  fontWeightValueSchema,
868
1008
  forLoopSchema,
1009
+ fragmentUseNodeSchema,
869
1010
  gradientObjectSchema,
870
1011
  gradientStopSchema,
871
1012
  gridNodeSchema,
@@ -878,6 +1019,7 @@ export {
878
1019
  isAssetPath,
879
1020
  isDynamic,
880
1021
  isRef,
1022
+ isTemplateValue,
881
1023
  justifyContentValueSchema,
882
1024
  lengthSchema,
883
1025
  linearGradientSchema,
@@ -890,6 +1032,7 @@ export {
890
1032
  radialGradientSchema,
891
1033
  refOnlySchema,
892
1034
  refSchema,
1035
+ renderableNodeSchema,
893
1036
  repeatingLinearGradientSchema,
894
1037
  responsivePropsSchema,
895
1038
  responsiveStylePropsSchema,
@@ -899,11 +1042,18 @@ export {
899
1042
  spacerPropsSchema,
900
1043
  stackNodeSchema,
901
1044
  stylePropsSchema,
1045
+ tabsItemSchema,
1046
+ tabsNodeSchema,
1047
+ templatePartSchema,
1048
+ templateValueSchema,
1049
+ templatedStringSchema,
902
1050
  textAlignValueSchema,
903
1051
  textDecorationValueSchema,
904
1052
  textNodeSchema,
905
1053
  textPropsSchema,
906
1054
  textShadowObjectSchema,
1055
+ textSpanSchema,
1056
+ textSpanStyleSchema,
907
1057
  toggleNodeSchema,
908
1058
  togglePropsSchema,
909
1059
  transformObjectSchema,