@safe-ugc-ui/types 0.6.0 → 1.1.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,11 +95,14 @@ 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;
105
+ var MEDIUM_BREAKPOINT_MAX_WIDTH = 768;
42
106
  var ZINDEX_MIN = 0;
43
107
  var ZINDEX_MAX = 100;
44
108
  var TRANSFORM_SCALE_MIN = 0.1;
@@ -55,6 +119,7 @@ var ALLOWED_FONT_FAMILIES = [
55
119
  "display",
56
120
  "handwriting"
57
121
  ];
122
+ var ASPECT_RATIO_PATTERN = /^\s*[0-9]+(\.[0-9]+)?\s*\/\s*[0-9]+(\.[0-9]+)?\s*$/;
58
123
  var TEXT_SHADOW_MAX_COUNT = 5;
59
124
  var TEXT_SHADOW_BLUR_MAX = 100;
60
125
  var BOX_SHADOW_MAX_COUNT = 5;
@@ -65,6 +130,7 @@ var LETTER_SPACING_MIN = -10;
65
130
  var LETTER_SPACING_MAX = 50;
66
131
  var OPACITY_MIN = 0;
67
132
  var OPACITY_MAX = 1;
133
+ var BACKDROP_BLUR_MAX = 40;
68
134
  var TRANSITION_DURATION_MAX = 2e3;
69
135
  var TRANSITION_DELAY_MAX = 1e3;
70
136
  var TRANSITION_MAX_COUNT = 10;
@@ -150,7 +216,9 @@ var ALL_COMPONENT_TYPES = [
150
216
  "Chip",
151
217
  // 2.4 Interaction (optional)
152
218
  "Button",
153
- "Toggle"
219
+ "Toggle",
220
+ "Accordion",
221
+ "Tabs"
154
222
  ];
155
223
  var FORBIDDEN_STYLE_PROPERTIES = [
156
224
  "backgroundImage",
@@ -162,7 +230,6 @@ var FORBIDDEN_STYLE_PROPERTIES = [
162
230
  "mixBlendMode",
163
231
  "animation",
164
232
  "transition",
165
- "clipPath",
166
233
  "mask"
167
234
  ];
168
235
  var FORBIDDEN_POSITION_VALUES = ["fixed", "sticky"];
@@ -331,71 +398,93 @@ var CSS_NAMED_COLORS = /* @__PURE__ */ new Set([
331
398
  ]);
332
399
 
333
400
  // src/styles.ts
334
- var gradientStopSchema = z2.object({
335
- color: dynamicSchema(z2.string()),
336
- position: dynamicSchema(z2.string())
401
+ var gradientStopSchema = z3.object({
402
+ color: dynamicSchema(z3.string()),
403
+ position: dynamicSchema(z3.string())
337
404
  // e.g. "0%", "100%"
338
405
  });
339
- var linearGradientSchema = z2.object({
340
- type: z2.literal("linear"),
341
- direction: dynamicSchema(z2.string()),
406
+ var linearGradientSchema = z3.object({
407
+ type: z3.literal("linear"),
408
+ direction: dynamicSchema(z3.string()),
342
409
  // e.g. "135deg", "to right"
343
- stops: z2.array(gradientStopSchema)
410
+ stops: z3.array(gradientStopSchema)
344
411
  });
345
- var radialGradientSchema = z2.object({
346
- type: z2.literal("radial"),
347
- stops: z2.array(gradientStopSchema)
412
+ var radialGradientSchema = z3.object({
413
+ type: z3.literal("radial"),
414
+ stops: z3.array(gradientStopSchema)
348
415
  });
349
- var repeatingLinearGradientSchema = z2.object({
350
- type: z2.literal("repeating-linear"),
351
- direction: dynamicSchema(z2.string()),
416
+ var repeatingLinearGradientSchema = z3.object({
417
+ type: z3.literal("repeating-linear"),
418
+ direction: dynamicSchema(z3.string()),
352
419
  // e.g. "180deg"
353
- stops: z2.array(gradientStopSchema)
420
+ stops: z3.array(gradientStopSchema)
354
421
  });
355
- var gradientObjectSchema = z2.union([
422
+ var gradientObjectSchema = z3.union([
356
423
  linearGradientSchema,
357
424
  radialGradientSchema,
358
425
  repeatingLinearGradientSchema
359
426
  ]);
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()),
427
+ var shadowObjectSchema = z3.object({
428
+ offsetX: dynamicSchema(z3.number()),
429
+ offsetY: dynamicSchema(z3.number()),
430
+ blur: dynamicSchema(z3.number()).optional(),
431
+ spread: dynamicSchema(z3.number()).optional(),
432
+ color: dynamicSchema(z3.string())
433
+ });
434
+ var textShadowObjectSchema = z3.object({
435
+ offsetX: dynamicSchema(z3.number()),
436
+ offsetY: dynamicSchema(z3.number()),
437
+ blur: dynamicSchema(z3.number()).optional(),
438
+ color: dynamicSchema(z3.string())
439
+ });
440
+ var borderStyleValueSchema = z3.enum(["solid", "dashed", "dotted", "none"]);
441
+ var borderObjectSchema = z3.object({
442
+ width: dynamicSchema(z3.number()),
376
443
  style: dynamicSchema(borderStyleValueSchema),
377
- color: dynamicSchema(z2.string())
444
+ color: dynamicSchema(z3.string())
378
445
  });
379
- var transformObjectSchema = z2.object({
380
- rotate: dynamicSchema(z2.string()).optional(),
446
+ var transformObjectSchema = z3.object({
447
+ rotate: dynamicSchema(z3.string()).optional(),
381
448
  // e.g. "45deg"
382
- scale: dynamicSchema(z2.number()).optional(),
449
+ scale: dynamicSchema(z3.number()).optional(),
383
450
  // 0.1 ~ 1.5
384
- translateX: dynamicSchema(z2.number()).optional(),
451
+ translateX: dynamicSchema(z3.number()).optional(),
385
452
  // -500 ~ 500
386
- translateY: dynamicSchema(z2.number()).optional()
453
+ translateY: dynamicSchema(z3.number()).optional()
387
454
  // -500 ~ 500
388
455
  });
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([
456
+ var clipPathCircleSchema = z3.object({
457
+ type: z3.literal("circle"),
458
+ radius: dynamicSchema(lengthSchema)
459
+ }).strict();
460
+ var clipPathEllipseSchema = z3.object({
461
+ type: z3.literal("ellipse"),
462
+ rx: dynamicSchema(lengthSchema),
463
+ ry: dynamicSchema(lengthSchema)
464
+ }).strict();
465
+ var clipPathInsetSchema = z3.object({
466
+ type: z3.literal("inset"),
467
+ top: dynamicSchema(lengthSchema),
468
+ right: dynamicSchema(lengthSchema),
469
+ bottom: dynamicSchema(lengthSchema),
470
+ left: dynamicSchema(lengthSchema),
471
+ round: dynamicSchema(lengthSchema).optional()
472
+ }).strict();
473
+ var clipPathObjectSchema = z3.union([
474
+ clipPathCircleSchema,
475
+ clipPathEllipseSchema,
476
+ clipPathInsetSchema
477
+ ]);
478
+ var positionValueSchema = z3.enum(["static", "relative", "absolute"]);
479
+ var overflowValueSchema = z3.enum(["visible", "hidden", "auto"]);
480
+ var displayValueSchema = z3.enum(["flex", "block", "none"]);
481
+ var flexDirectionValueSchema = z3.enum([
393
482
  "row",
394
483
  "column",
395
484
  "row-reverse",
396
485
  "column-reverse"
397
486
  ]);
398
- var justifyContentValueSchema = z2.enum([
487
+ var justifyContentValueSchema = z3.enum([
399
488
  "start",
400
489
  "flex-start",
401
490
  "center",
@@ -405,7 +494,7 @@ var justifyContentValueSchema = z2.enum([
405
494
  "space-around",
406
495
  "space-evenly"
407
496
  ]);
408
- var alignItemsValueSchema = z2.enum([
497
+ var alignItemsValueSchema = z3.enum([
409
498
  "start",
410
499
  "flex-start",
411
500
  "center",
@@ -414,7 +503,7 @@ var alignItemsValueSchema = z2.enum([
414
503
  "stretch",
415
504
  "baseline"
416
505
  ]);
417
- var alignSelfValueSchema = z2.enum([
506
+ var alignSelfValueSchema = z3.enum([
418
507
  "auto",
419
508
  "start",
420
509
  "flex-start",
@@ -423,57 +512,68 @@ var alignSelfValueSchema = z2.enum([
423
512
  "flex-end",
424
513
  "stretch"
425
514
  ]);
426
- var flexWrapValueSchema = z2.enum(["nowrap", "wrap", "wrap-reverse"]);
427
- var textAlignValueSchema = z2.enum([
515
+ var flexWrapValueSchema = z3.enum(["nowrap", "wrap", "wrap-reverse"]);
516
+ var textAlignValueSchema = z3.enum([
428
517
  "left",
429
518
  "center",
430
519
  "right",
431
520
  "justify"
432
521
  ]);
433
- var textDecorationValueSchema = z2.enum([
522
+ var textDecorationValueSchema = z3.enum([
434
523
  "none",
435
524
  "underline",
436
525
  "line-through"
437
526
  ]);
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)
527
+ var fontStyleValueSchema = z3.enum(["normal", "italic"]);
528
+ var fontFamilyValueSchema = z3.enum(ALLOWED_FONT_FAMILIES);
529
+ var fontWeightValueSchema = z3.union([
530
+ z3.enum(["normal", "bold"]),
531
+ z3.literal("100"),
532
+ z3.literal("200"),
533
+ z3.literal("300"),
534
+ z3.literal("400"),
535
+ z3.literal("500"),
536
+ z3.literal("600"),
537
+ z3.literal("700"),
538
+ z3.literal("800"),
539
+ z3.literal("900"),
540
+ z3.literal(100),
541
+ z3.literal(200),
542
+ z3.literal(300),
543
+ z3.literal(400),
544
+ z3.literal(500),
545
+ z3.literal(600),
546
+ z3.literal(700),
547
+ z3.literal(800),
548
+ z3.literal(900)
460
549
  ]);
461
- var easingValueSchema = z2.enum([
550
+ var easingValueSchema = z3.enum([
462
551
  "ease",
463
552
  "linear",
464
553
  "ease-in",
465
554
  "ease-out",
466
555
  "ease-in-out"
467
556
  ]);
468
- var transitionDefSchema = z2.object({
469
- property: z2.string(),
470
- duration: z2.number(),
557
+ var transitionDefSchema = z3.object({
558
+ property: z3.string(),
559
+ duration: z3.number(),
471
560
  easing: easingValueSchema.optional(),
472
- delay: z2.number().optional()
561
+ delay: z3.number().optional()
473
562
  });
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]);
563
+ var transitionFieldSchema = z3.union([transitionDefSchema, z3.array(transitionDefSchema)]).optional();
564
+ var textSpanStyleSchema = z3.object({
565
+ backgroundColor: dynamicSchema(colorSchema).optional(),
566
+ color: dynamicSchema(colorSchema).optional(),
567
+ fontFamily: dynamicSchema(fontFamilyValueSchema).optional(),
568
+ fontSize: dynamicSchema(lengthSchema).optional(),
569
+ fontWeight: dynamicSchema(fontWeightValueSchema).optional(),
570
+ fontStyle: dynamicSchema(fontStyleValueSchema).optional(),
571
+ textDecoration: dynamicSchema(textDecorationValueSchema).optional(),
572
+ letterSpacing: dynamicSchema(lengthSchema).optional(),
573
+ textShadow: z3.union([textShadowObjectSchema, z3.array(textShadowObjectSchema)]).optional()
574
+ }).strict();
575
+ var sizeValueSchema = z3.union([lengthSchema, percentageSchema, z3.literal("auto")]);
576
+ var lineHeightValueSchema = z3.union([z3.number(), lengthSchema]);
477
577
  var coreStyleShape = {
478
578
  // -----------------------------------------------------------------------
479
579
  // Layout — Dynamic
@@ -484,17 +584,21 @@ var coreStyleShape = {
484
584
  alignItems: dynamicSchema(alignItemsValueSchema).optional(),
485
585
  alignSelf: dynamicSchema(alignSelfValueSchema).optional(),
486
586
  flexWrap: dynamicSchema(flexWrapValueSchema).optional(),
487
- flex: dynamicSchema(z2.number()).optional(),
587
+ flex: dynamicSchema(z3.number()).optional(),
488
588
  gap: dynamicSchema(lengthSchema).optional(),
489
589
  // -----------------------------------------------------------------------
490
590
  // Sizing — Dynamic
491
591
  // -----------------------------------------------------------------------
492
592
  width: dynamicSchema(sizeValueSchema).optional(),
493
593
  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(),
594
+ aspectRatio: dynamicSchema(z3.union([
595
+ z3.number().positive(),
596
+ z3.string().regex(ASPECT_RATIO_PATTERN)
597
+ ])).optional(),
598
+ minWidth: dynamicSchema(z3.union([lengthSchema, percentageSchema])).optional(),
599
+ maxWidth: dynamicSchema(z3.union([lengthSchema, percentageSchema])).optional(),
600
+ minHeight: dynamicSchema(z3.union([lengthSchema, percentageSchema])).optional(),
601
+ maxHeight: dynamicSchema(z3.union([lengthSchema, percentageSchema])).optional(),
498
602
  // -----------------------------------------------------------------------
499
603
  // Spacing — Dynamic
500
604
  // -----------------------------------------------------------------------
@@ -535,7 +639,8 @@ var coreStyleShape = {
535
639
  // -----------------------------------------------------------------------
536
640
  // Opacity — Dynamic
537
641
  // -----------------------------------------------------------------------
538
- opacity: dynamicSchema(z2.number()).optional(),
642
+ opacity: dynamicSchema(z3.number()).optional(),
643
+ backdropBlur: dynamicSchema(z3.number()).optional(),
539
644
  // -----------------------------------------------------------------------
540
645
  // Gradient — Static only
541
646
  // -----------------------------------------------------------------------
@@ -543,11 +648,11 @@ var coreStyleShape = {
543
648
  // -----------------------------------------------------------------------
544
649
  // Shadow — Static only (single or array of shadows)
545
650
  // -----------------------------------------------------------------------
546
- boxShadow: z2.union([shadowObjectSchema, z2.array(shadowObjectSchema)]).optional(),
651
+ boxShadow: z3.union([shadowObjectSchema, z3.array(shadowObjectSchema)]).optional(),
547
652
  // -----------------------------------------------------------------------
548
653
  // Text shadow — Static only (single or array of shadows)
549
654
  // -----------------------------------------------------------------------
550
- textShadow: z2.union([textShadowObjectSchema, z2.array(textShadowObjectSchema)]).optional(),
655
+ textShadow: z3.union([textShadowObjectSchema, z3.array(textShadowObjectSchema)]).optional(),
551
656
  // -----------------------------------------------------------------------
552
657
  // Borders — Static only
553
658
  // -----------------------------------------------------------------------
@@ -560,6 +665,7 @@ var coreStyleShape = {
560
665
  // Transform — Static only (skew excluded)
561
666
  // -----------------------------------------------------------------------
562
667
  transform: transformObjectSchema.optional(),
668
+ clipPath: clipPathObjectSchema.optional(),
563
669
  // -----------------------------------------------------------------------
564
670
  // Overflow — Static only
565
671
  // -----------------------------------------------------------------------
@@ -575,184 +681,225 @@ var coreStyleShape = {
575
681
  // -----------------------------------------------------------------------
576
682
  // Object-fit — Dynamic (for Image nodes)
577
683
  // -----------------------------------------------------------------------
578
- objectFit: dynamicSchema(z2.enum(["cover", "contain", "fill", "none", "scale-down"])).optional(),
579
- objectPosition: dynamicSchema(z2.string()).optional(),
684
+ objectFit: dynamicSchema(z3.enum(["cover", "contain", "fill", "none", "scale-down"])).optional(),
685
+ objectPosition: dynamicSchema(z3.string()).optional(),
580
686
  // -----------------------------------------------------------------------
581
687
  // Grid — Dynamic
582
688
  // -----------------------------------------------------------------------
583
- gridTemplateColumns: dynamicSchema(z2.string()).optional(),
584
- gridTemplateRows: dynamicSchema(z2.string()).optional(),
585
- gridColumn: dynamicSchema(z2.string()).optional(),
586
- gridRow: dynamicSchema(z2.string()).optional(),
689
+ gridTemplateColumns: dynamicSchema(z3.string()).optional(),
690
+ gridTemplateRows: dynamicSchema(z3.string()).optional(),
691
+ gridColumn: dynamicSchema(z3.string()).optional(),
692
+ gridRow: dynamicSchema(z3.string()).optional(),
587
693
  // -----------------------------------------------------------------------
588
694
  // z-index — Static only (0-100 enforced at validation layer)
589
695
  // -----------------------------------------------------------------------
590
- zIndex: z2.number().optional(),
696
+ zIndex: z3.number().optional(),
591
697
  // -----------------------------------------------------------------------
592
698
  // $style — reference to a named style in card.styles
593
699
  // -----------------------------------------------------------------------
594
- $style: z2.string().optional()
700
+ $style: z3.string().optional()
595
701
  };
596
- var hoverStylePropsSchema = z2.object({
702
+ var hoverStylePropsSchema = z3.object({
597
703
  ...coreStyleShape,
598
704
  transition: transitionFieldSchema
599
705
  });
600
- var responsiveStylePropsSchema = z2.object({
706
+ var responsiveStylePropsSchema = z3.object({
601
707
  ...coreStyleShape
602
708
  });
603
- var responsivePropsSchema = z2.object({
709
+ var responsivePropsSchema = z3.object({
710
+ medium: responsiveStylePropsSchema.optional(),
604
711
  compact: responsiveStylePropsSchema.optional()
605
712
  }).strict();
606
- var stylePropsSchema = z2.object({
713
+ var stylePropsSchema = z3.object({
607
714
  ...coreStyleShape,
608
715
  hoverStyle: hoverStylePropsSchema.optional(),
609
716
  transition: transitionFieldSchema
610
717
  });
611
718
 
612
719
  // src/props.ts
613
- import { z as z3 } from "zod";
614
- var textPropsSchema = z3.object({
615
- content: dynamicSchema(z3.string())
720
+ import { z as z4 } from "zod";
721
+ var textSpanSchema = z4.object({
722
+ text: templatedStringSchema,
723
+ style: textSpanStyleSchema.optional()
724
+ }).strict();
725
+ var textPropsSchema = z4.object({
726
+ content: templatedStringSchema.optional(),
727
+ spans: z4.array(textSpanSchema).min(1).max(32).optional(),
728
+ maxLines: z4.number().int().min(1).max(10).optional(),
729
+ truncate: z4.enum(["ellipsis", "clip"]).optional()
616
730
  });
617
- var imagePropsSchema = z3.object({
731
+ var imagePropsSchema = z4.object({
618
732
  src: refOnlySchema(assetPathSchema),
619
- alt: dynamicSchema(z3.string()).optional()
733
+ alt: dynamicSchema(z4.string()).optional()
620
734
  });
621
- var progressBarPropsSchema = z3.object({
622
- value: dynamicSchema(z3.number()),
623
- max: dynamicSchema(z3.number()),
735
+ var progressBarPropsSchema = z4.object({
736
+ value: dynamicSchema(z4.number()),
737
+ max: dynamicSchema(z4.number()),
624
738
  color: dynamicSchema(colorSchema).optional()
625
739
  });
626
- var avatarPropsSchema = z3.object({
740
+ var avatarPropsSchema = z4.object({
627
741
  src: refOnlySchema(assetPathSchema),
628
742
  size: dynamicSchema(lengthSchema).optional()
629
743
  });
630
- var iconPropsSchema = z3.object({
744
+ var iconPropsSchema = z4.object({
631
745
  name: dynamicSchema(iconNameSchema),
632
746
  size: dynamicSchema(lengthSchema).optional(),
633
747
  color: dynamicSchema(colorSchema).optional()
634
748
  });
635
- var badgePropsSchema = z3.object({
636
- label: dynamicSchema(z3.string()),
749
+ var badgePropsSchema = z4.object({
750
+ label: templatedStringSchema,
637
751
  color: dynamicSchema(colorSchema).optional()
638
752
  });
639
- var chipPropsSchema = z3.object({
640
- label: dynamicSchema(z3.string()),
753
+ var chipPropsSchema = z4.object({
754
+ label: templatedStringSchema,
641
755
  color: dynamicSchema(colorSchema).optional()
642
756
  });
643
- var dividerPropsSchema = z3.object({
757
+ var dividerPropsSchema = z4.object({
644
758
  color: dynamicSchema(colorSchema).optional(),
645
759
  thickness: dynamicSchema(lengthSchema).optional()
646
760
  });
647
- var spacerPropsSchema = z3.object({
761
+ var spacerPropsSchema = z4.object({
648
762
  size: dynamicSchema(lengthSchema).optional()
649
763
  });
650
- var buttonPropsSchema = z3.object({
651
- label: dynamicSchema(z3.string()),
652
- action: z3.string()
764
+ var buttonPropsSchema = z4.object({
765
+ label: templatedStringSchema,
766
+ action: z4.string(),
767
+ disabled: z4.union([z4.boolean(), refSchema]).optional()
653
768
  });
654
- var togglePropsSchema = z3.object({
655
- value: dynamicSchema(z3.boolean()),
656
- onToggle: z3.string()
769
+ var togglePropsSchema = z4.object({
770
+ value: dynamicSchema(z4.boolean()),
771
+ onToggle: z4.string(),
772
+ disabled: dynamicSchema(z4.boolean()).optional()
657
773
  });
658
774
 
659
775
  // 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)
776
+ import { z as z5 } from "zod";
777
+ var fragmentUseNodeSchema = z5.object({
778
+ $use: z5.string(),
779
+ $if: conditionSchema.optional()
780
+ }).strict();
781
+ var forLoopSchema = z5.object({
782
+ for: z5.string(),
783
+ in: z5.string(),
784
+ template: z5.lazy(() => renderableNodeSchema)
665
785
  });
666
- var childrenSchema = z4.union([
667
- z4.array(z4.lazy(() => ugcNodeSchema)),
786
+ var childrenSchema = z5.union([
787
+ z5.array(z5.lazy(() => renderableNodeSchema)),
668
788
  forLoopSchema
669
789
  ]);
670
790
  var baseFields = {
791
+ $if: conditionSchema.optional(),
671
792
  style: stylePropsSchema.optional(),
672
793
  responsive: responsivePropsSchema.optional()
673
794
  };
674
- var boxNodeSchema = z4.object({
675
- type: z4.literal("Box"),
795
+ var boxNodeSchema = z5.object({
796
+ type: z5.literal("Box"),
676
797
  children: childrenSchema.optional(),
677
798
  ...baseFields
678
799
  });
679
- var rowNodeSchema = z4.object({
680
- type: z4.literal("Row"),
800
+ var rowNodeSchema = z5.object({
801
+ type: z5.literal("Row"),
681
802
  children: childrenSchema.optional(),
682
803
  ...baseFields
683
804
  });
684
- var columnNodeSchema = z4.object({
685
- type: z4.literal("Column"),
805
+ var columnNodeSchema = z5.object({
806
+ type: z5.literal("Column"),
686
807
  children: childrenSchema.optional(),
687
808
  ...baseFields
688
809
  });
689
- var stackNodeSchema = z4.object({
690
- type: z4.literal("Stack"),
810
+ var stackNodeSchema = z5.object({
811
+ type: z5.literal("Stack"),
691
812
  children: childrenSchema.optional(),
692
813
  ...baseFields
693
814
  });
694
- var gridNodeSchema = z4.object({
695
- type: z4.literal("Grid"),
815
+ var gridNodeSchema = z5.object({
816
+ type: z5.literal("Grid"),
696
817
  children: childrenSchema.optional(),
697
818
  ...baseFields
698
819
  });
699
- var textNodeSchema = z4.object({
700
- type: z4.literal("Text"),
820
+ var textNodeSchema = z5.object({
821
+ type: z5.literal("Text"),
701
822
  ...textPropsSchema.shape,
702
823
  ...baseFields
703
824
  });
704
- var imageNodeSchema = z4.object({
705
- type: z4.literal("Image"),
825
+ var imageNodeSchema = z5.object({
826
+ type: z5.literal("Image"),
706
827
  ...imagePropsSchema.shape,
707
828
  ...baseFields
708
829
  });
709
- var progressBarNodeSchema = z4.object({
710
- type: z4.literal("ProgressBar"),
830
+ var progressBarNodeSchema = z5.object({
831
+ type: z5.literal("ProgressBar"),
711
832
  ...progressBarPropsSchema.shape,
712
833
  ...baseFields
713
834
  });
714
- var avatarNodeSchema = z4.object({
715
- type: z4.literal("Avatar"),
835
+ var avatarNodeSchema = z5.object({
836
+ type: z5.literal("Avatar"),
716
837
  ...avatarPropsSchema.shape,
717
838
  ...baseFields
718
839
  });
719
- var iconNodeSchema = z4.object({
720
- type: z4.literal("Icon"),
840
+ var iconNodeSchema = z5.object({
841
+ type: z5.literal("Icon"),
721
842
  ...iconPropsSchema.shape,
722
843
  ...baseFields
723
844
  });
724
- var badgeNodeSchema = z4.object({
725
- type: z4.literal("Badge"),
845
+ var badgeNodeSchema = z5.object({
846
+ type: z5.literal("Badge"),
726
847
  ...badgePropsSchema.shape,
727
848
  ...baseFields
728
849
  });
729
- var chipNodeSchema = z4.object({
730
- type: z4.literal("Chip"),
850
+ var chipNodeSchema = z5.object({
851
+ type: z5.literal("Chip"),
731
852
  ...chipPropsSchema.shape,
732
853
  ...baseFields
733
854
  });
734
- var dividerNodeSchema = z4.object({
735
- type: z4.literal("Divider"),
855
+ var dividerNodeSchema = z5.object({
856
+ type: z5.literal("Divider"),
736
857
  ...dividerPropsSchema.shape,
737
858
  ...baseFields
738
859
  });
739
- var spacerNodeSchema = z4.object({
740
- type: z4.literal("Spacer"),
860
+ var spacerNodeSchema = z5.object({
861
+ type: z5.literal("Spacer"),
741
862
  ...spacerPropsSchema.shape,
742
863
  ...baseFields
743
864
  });
744
- var buttonNodeSchema = z4.object({
745
- type: z4.literal("Button"),
865
+ var buttonNodeSchema = z5.object({
866
+ type: z5.literal("Button"),
746
867
  ...buttonPropsSchema.shape,
747
868
  ...baseFields
748
869
  });
749
- var toggleNodeSchema = z4.object({
750
- type: z4.literal("Toggle"),
870
+ var toggleNodeSchema = z5.object({
871
+ type: z5.literal("Toggle"),
751
872
  ...togglePropsSchema.shape,
752
873
  ...baseFields
753
874
  });
754
- var ugcNodeSchema = z4.lazy(
755
- () => z4.discriminatedUnion("type", [
875
+ var interactiveItemIdSchema = z5.string().min(1).max(64);
876
+ var accordionItemSchema = z5.object({
877
+ id: interactiveItemIdSchema,
878
+ label: templatedStringSchema,
879
+ content: z5.lazy(() => renderableNodeSchema),
880
+ disabled: dynamicSchema(z5.boolean()).optional()
881
+ }).strict();
882
+ var tabsItemSchema = z5.object({
883
+ id: interactiveItemIdSchema,
884
+ label: templatedStringSchema,
885
+ content: z5.lazy(() => renderableNodeSchema),
886
+ disabled: dynamicSchema(z5.boolean()).optional()
887
+ }).strict();
888
+ var accordionNodeSchema = z5.object({
889
+ type: z5.literal("Accordion"),
890
+ items: z5.array(accordionItemSchema).min(1).max(MAX_INTERACTIVE_ITEMS),
891
+ allowMultiple: z5.boolean().optional(),
892
+ defaultExpanded: z5.array(interactiveItemIdSchema).max(MAX_INTERACTIVE_ITEMS).optional(),
893
+ ...baseFields
894
+ });
895
+ var tabsNodeSchema = z5.object({
896
+ type: z5.literal("Tabs"),
897
+ tabs: z5.array(tabsItemSchema).min(1).max(MAX_INTERACTIVE_ITEMS),
898
+ defaultTab: interactiveItemIdSchema.optional(),
899
+ ...baseFields
900
+ });
901
+ var ugcNodeSchema = z5.lazy(
902
+ () => z5.discriminatedUnion("type", [
756
903
  boxNodeSchema,
757
904
  rowNodeSchema,
758
905
  columnNodeSchema,
@@ -768,11 +915,19 @@ var ugcNodeSchema = z4.lazy(
768
915
  dividerNodeSchema,
769
916
  spacerNodeSchema,
770
917
  buttonNodeSchema,
771
- toggleNodeSchema
918
+ toggleNodeSchema,
919
+ accordionNodeSchema,
920
+ tabsNodeSchema
772
921
  ])
773
922
  );
774
- var phase1NodeSchema = z4.lazy(
775
- () => z4.discriminatedUnion("type", [
923
+ var renderableNodeSchema = z5.lazy(
924
+ () => z5.union([
925
+ ugcNodeSchema,
926
+ fragmentUseNodeSchema
927
+ ])
928
+ );
929
+ var phase1NodeSchema = z5.lazy(
930
+ () => z5.discriminatedUnion("type", [
776
931
  boxNodeSchema,
777
932
  rowNodeSchema,
778
933
  columnNodeSchema,
@@ -782,26 +937,29 @@ var phase1NodeSchema = z4.lazy(
782
937
  );
783
938
 
784
939
  // src/card.ts
785
- import { z as z5 } from "zod";
786
- var cardMetaSchema = z5.object({
787
- name: z5.string(),
788
- version: z5.string()
940
+ import { z as z6 } from "zod";
941
+ var cardMetaSchema = z6.object({
942
+ name: z6.string(),
943
+ version: z6.string()
789
944
  });
790
945
  var styleNamePattern = /^[A-Za-z][A-Za-z0-9_-]*$/;
791
- var ugcCardSchema = z5.object({
946
+ var ugcCardSchema = z6.object({
792
947
  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)
948
+ assets: z6.record(z6.string(), z6.string()).optional(),
949
+ state: z6.record(z6.string(), z6.unknown()).optional(),
950
+ styles: z6.record(z6.string().regex(styleNamePattern), stylePropsSchema).optional(),
951
+ fragments: z6.record(z6.string().regex(styleNamePattern), ugcNodeSchema).optional(),
952
+ views: z6.record(z6.string(), renderableNodeSchema)
797
953
  });
798
954
  export {
799
955
  ALLOWED_FONT_FAMILIES,
800
956
  ALLOWED_OVERFLOW_VALUES,
801
957
  ALLOWED_TRANSITION_PROPERTIES,
802
958
  ALL_COMPONENT_TYPES,
959
+ ASPECT_RATIO_PATTERN,
803
960
  ASSET_INDIVIDUAL_MAX_BYTES,
804
961
  ASSET_TOTAL_MAX_BYTES,
962
+ BACKDROP_BLUR_MAX,
805
963
  BORDER_RADIUS_MAX,
806
964
  BOX_SHADOW_BLUR_MAX,
807
965
  BOX_SHADOW_MAX_COUNT,
@@ -816,11 +974,14 @@ export {
816
974
  FORBIDDEN_STYLE_PROPERTIES,
817
975
  LETTER_SPACING_MAX,
818
976
  LETTER_SPACING_MIN,
977
+ MAX_CONDITION_DEPTH,
978
+ MAX_INTERACTIVE_ITEMS,
819
979
  MAX_LOOP_ITERATIONS,
820
980
  MAX_NESTED_LOOPS,
821
981
  MAX_NODE_COUNT,
822
982
  MAX_OVERFLOW_AUTO_COUNT,
823
983
  MAX_STACK_NESTING,
984
+ MEDIUM_BREAKPOINT_MAX_WIDTH,
824
985
  OPACITY_MAX,
825
986
  OPACITY_MIN,
826
987
  PHASE1_COMPONENT_TYPES,
@@ -838,6 +999,8 @@ export {
838
999
  TRANSITION_MAX_COUNT,
839
1000
  ZINDEX_MAX,
840
1001
  ZINDEX_MIN,
1002
+ accordionItemSchema,
1003
+ accordionNodeSchema,
841
1004
  alignItemsValueSchema,
842
1005
  alignSelfValueSchema,
843
1006
  assetPathSchema,
@@ -853,8 +1016,17 @@ export {
853
1016
  cardMetaSchema,
854
1017
  chipNodeSchema,
855
1018
  chipPropsSchema,
1019
+ clipPathCircleSchema,
1020
+ clipPathEllipseSchema,
1021
+ clipPathInsetSchema,
1022
+ clipPathObjectSchema,
856
1023
  colorSchema,
857
1024
  columnNodeSchema,
1025
+ comparisonConditionOpSchema,
1026
+ comparisonConditionSchema,
1027
+ conditionOperandLiteralSchema,
1028
+ conditionOperandSchema,
1029
+ conditionSchema,
858
1030
  displayValueSchema,
859
1031
  dividerNodeSchema,
860
1032
  dividerPropsSchema,
@@ -866,6 +1038,7 @@ export {
866
1038
  fontStyleValueSchema,
867
1039
  fontWeightValueSchema,
868
1040
  forLoopSchema,
1041
+ fragmentUseNodeSchema,
869
1042
  gradientObjectSchema,
870
1043
  gradientStopSchema,
871
1044
  gridNodeSchema,
@@ -878,6 +1051,7 @@ export {
878
1051
  isAssetPath,
879
1052
  isDynamic,
880
1053
  isRef,
1054
+ isTemplateValue,
881
1055
  justifyContentValueSchema,
882
1056
  lengthSchema,
883
1057
  linearGradientSchema,
@@ -890,6 +1064,7 @@ export {
890
1064
  radialGradientSchema,
891
1065
  refOnlySchema,
892
1066
  refSchema,
1067
+ renderableNodeSchema,
893
1068
  repeatingLinearGradientSchema,
894
1069
  responsivePropsSchema,
895
1070
  responsiveStylePropsSchema,
@@ -899,11 +1074,18 @@ export {
899
1074
  spacerPropsSchema,
900
1075
  stackNodeSchema,
901
1076
  stylePropsSchema,
1077
+ tabsItemSchema,
1078
+ tabsNodeSchema,
1079
+ templatePartSchema,
1080
+ templateValueSchema,
1081
+ templatedStringSchema,
902
1082
  textAlignValueSchema,
903
1083
  textDecorationValueSchema,
904
1084
  textNodeSchema,
905
1085
  textPropsSchema,
906
1086
  textShadowObjectSchema,
1087
+ textSpanSchema,
1088
+ textSpanStyleSchema,
907
1089
  toggleNodeSchema,
908
1090
  togglePropsSchema,
909
1091
  transformObjectSchema,