@usethrottle/builder-schema 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 (24) hide show
  1. package/__tests__/fixtures/parity/01-hero-boxed.json +68 -0
  2. package/__tests__/fixtures/parity/02-full-bleed-image-hero.json +61 -0
  3. package/__tests__/fixtures/parity/03-two-columns-50-50.json +66 -0
  4. package/__tests__/fixtures/parity/04-three-columns-phone-widths.json +87 -0
  5. package/__tests__/fixtures/parity/05-four-columns-tablet-two-by-two.json +108 -0
  6. package/__tests__/fixtures/parity/06-inner-section-in-column.json +101 -0
  7. package/__tests__/fixtures/parity/07-hidden-on-phone.json +47 -0
  8. package/__tests__/fixtures/parity/08-device-specific-text-and-size.json +46 -0
  9. package/__tests__/fixtures/parity/09-every-basic-widget.json +100 -0
  10. package/__tests__/fixtures/parity/10-header-part.json +87 -0
  11. package/__tests__/fixtures/parity/11-footer-part.json +105 -0
  12. package/__tests__/fixtures/parity/12-announcement-bar.json +34 -0
  13. package/__tests__/fixtures/parity/13-product-slot-context.json +69 -0
  14. package/__tests__/fixtures/parity/14-published-snapshot-with-assets-and-custom-widget.json +84 -0
  15. package/__tests__/fixtures/parity/15-empty-document.json +4 -0
  16. package/__tests__/fixtures/parity/16-product-grid-and-featured.json +140 -0
  17. package/__tests__/fixtures/parity/17-collection-shelf-and-categories.json +153 -0
  18. package/__tests__/fixtures/parity/18-search-switches-and-greeting.json +80 -0
  19. package/__tests__/fixtures/parity/19-shop-slot-context.json +42 -0
  20. package/dist/index.cjs +240 -225
  21. package/dist/index.d.cts +9 -1
  22. package/dist/index.d.ts +9 -1
  23. package/dist/index.js +240 -225
  24. package/package.json +8 -3
package/dist/index.js CHANGED
@@ -1,3 +1,7 @@
1
+ // src/jitless.ts
2
+ import { z } from "zod";
3
+ z.config({ jitless: true });
4
+
1
5
  // src/ids.ts
2
6
  var NODE_ID_RE = /^[a-z0-9]{8,24}$/;
3
7
  var ALPHABET = "abcdefghijklmnopqrstuvwxyz0123456789";
@@ -128,7 +132,7 @@ function dropShadowed(issues) {
128
132
  }
129
133
 
130
134
  // src/document.ts
131
- import { z as z3 } from "zod";
135
+ import { z as z4 } from "zod";
132
136
 
133
137
  // src/walk.ts
134
138
  function walkNodes(doc, visit) {
@@ -303,7 +307,7 @@ function checkLimits(doc) {
303
307
  }
304
308
 
305
309
  // src/site-settings.ts
306
- import { z as z2 } from "zod";
310
+ import { z as z3 } from "zod";
307
311
 
308
312
  // src/fonts.ts
309
313
  var WEIGHTS_100_900 = [100, 200, 300, 400, 500, 600, 700, 800, 900];
@@ -360,7 +364,7 @@ var SITE_FONTS = FONT_DEFINITIONS;
360
364
  var SITE_FONT_FAMILIES = FONT_DEFINITIONS.map((f) => f.family);
361
365
 
362
366
  // src/safe.ts
363
- import { z } from "zod";
367
+ import { z as z2 } from "zod";
364
368
  var customIssue = (ctx, code, message, path = []) => {
365
369
  ctx.addIssue({ code: "custom", message, path, params: { code } });
366
370
  };
@@ -369,8 +373,8 @@ var FORBIDDEN_KEYS = /* @__PURE__ */ new Set([
369
373
  "constructor",
370
374
  "prototype"
371
375
  ]);
372
- function safeRecord(value, keySchema = z.string().max(64)) {
373
- return z.preprocess((input, ctx) => {
376
+ function safeRecord(value, keySchema = z2.string().max(64)) {
377
+ return z2.preprocess((input, ctx) => {
374
378
  if (typeof input === "object" && input !== null && !Array.isArray(input)) {
375
379
  for (const key of Object.getOwnPropertyNames(input)) {
376
380
  if (FORBIDDEN_KEYS.has(key)) {
@@ -384,7 +388,7 @@ function safeRecord(value, keySchema = z.string().max(64)) {
384
388
  }
385
389
  }
386
390
  return input;
387
- }, z.record(keySchema, value));
391
+ }, z2.record(keySchema, value));
388
392
  }
389
393
 
390
394
  // src/strings.ts
@@ -458,31 +462,31 @@ var CATALOG_STRING_KEYS = [
458
462
 
459
463
  // src/site-settings.ts
460
464
  var LOCALE_TAG_RE = /^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8}){0,3}$/;
461
- var localeTagSchema = z2.string().regex(LOCALE_TAG_RE);
462
- var localizedTextSchema = safeRecord(z2.string().max(2e3), localeTagSchema);
463
- var assetIdSchema = z2.string().min(1).max(64).regex(/^[A-Za-z0-9_-]+$/);
465
+ var localeTagSchema = z3.string().regex(LOCALE_TAG_RE);
466
+ var localizedTextSchema = safeRecord(z3.string().max(2e3), localeTagSchema);
467
+ var assetIdSchema = z3.string().min(1).max(64).regex(/^[A-Za-z0-9_-]+$/);
464
468
  var THROTTLE_PK_RE = /^pk_[a-z0-9]+_[A-Za-z0-9]{8,}$/;
465
469
  var SAFE_HREF = (
466
470
  // eslint-disable-next-line no-control-regex
467
471
  /^(?:https?:\/\/[^\s\\\u0000-\u001F\u007F]+|\/(?![/\\])[^\s\\\u0000-\u001F\u007F]*)$/iu
468
472
  );
469
473
  var ULID_RE = /^[0-9A-HJKMNP-TV-Z]{26}$/i;
470
- var menuTargetSchema = z2.discriminatedUnion("kind", [
471
- z2.object({ kind: z2.literal("page"), id: z2.string().regex(ULID_RE) }).strict(),
472
- z2.object({ kind: z2.literal("category"), id: z2.string().min(1).max(64) }).strict(),
473
- z2.object({ kind: z2.literal("collection"), id: z2.string().min(1).max(64) }).strict(),
474
- z2.object({ kind: z2.literal("product"), id: z2.string().min(1).max(64) }).strict(),
475
- z2.object({
476
- kind: z2.literal("search"),
477
- q: z2.string().min(1).max(200).regex(/^[^\u0000-\u001F\u007F]+$/u)
474
+ var menuTargetSchema = z3.discriminatedUnion("kind", [
475
+ z3.object({ kind: z3.literal("page"), id: z3.string().regex(ULID_RE) }).strict(),
476
+ z3.object({ kind: z3.literal("category"), id: z3.string().min(1).max(64) }).strict(),
477
+ z3.object({ kind: z3.literal("collection"), id: z3.string().min(1).max(64) }).strict(),
478
+ z3.object({ kind: z3.literal("product"), id: z3.string().min(1).max(64) }).strict(),
479
+ z3.object({
480
+ kind: z3.literal("search"),
481
+ q: z3.string().min(1).max(200).regex(/^[^\u0000-\u001F\u007F]+$/u)
478
482
  }).strict(),
479
- z2.object({
480
- kind: z2.literal("url"),
481
- href: z2.string().max(2e3).regex(SAFE_HREF)
483
+ z3.object({
484
+ kind: z3.literal("url"),
485
+ href: z3.string().max(2e3).regex(SAFE_HREF)
482
486
  }).strict()
483
487
  ]);
484
488
  var itemBase = { label: localizedTextSchema, target: menuTargetSchema };
485
- var menuItemLevel3 = z2.object({ ...itemBase, children: z2.array(z2.unknown()).optional() }).strict().superRefine((item, ctx) => {
489
+ var menuItemLevel3 = z3.object({ ...itemBase, children: z3.array(z3.unknown()).optional() }).strict().superRefine((item, ctx) => {
486
490
  if (item.children !== void 0 && item.children.length > 0) {
487
491
  customIssue(
488
492
  ctx,
@@ -492,8 +496,8 @@ var menuItemLevel3 = z2.object({ ...itemBase, children: z2.array(z2.unknown()).o
492
496
  );
493
497
  }
494
498
  });
495
- var menuItemLevel2 = z2.object({ ...itemBase, children: z2.array(menuItemLevel3).optional() }).strict();
496
- var menuItemLevel1 = z2.object({ ...itemBase, children: z2.array(menuItemLevel2).optional() }).strict();
499
+ var menuItemLevel2 = z3.object({ ...itemBase, children: z3.array(menuItemLevel3).optional() }).strict();
500
+ var menuItemLevel1 = z3.object({ ...itemBase, children: z3.array(menuItemLevel2).optional() }).strict();
497
501
  var menuItemSchema = menuItemLevel1;
498
502
  function countItems(items) {
499
503
  let count = 0;
@@ -503,7 +507,7 @@ function countItems(items) {
503
507
  }
504
508
  return count;
505
509
  }
506
- var menuSchema = z2.array(menuItemSchema).superRefine((items, ctx) => {
510
+ var menuSchema = z3.array(menuItemSchema).superRefine((items, ctx) => {
507
511
  if (countItems(items) > LIMITS.menuItems) {
508
512
  customIssue(
509
513
  ctx,
@@ -513,7 +517,7 @@ var menuSchema = z2.array(menuItemSchema).superRefine((items, ctx) => {
513
517
  }
514
518
  });
515
519
  var MENU_NAME_RE = /^[a-z][a-z0-9-]{0,39}$/;
516
- var menusSchema = z2.object({
520
+ var menusSchema = z3.object({
517
521
  header: menuSchema.default(() => []),
518
522
  footer: menuSchema.default(() => [])
519
523
  }).catchall(menuSchema).superRefine((menus, ctx) => {
@@ -533,8 +537,8 @@ var menusSchema = z2.object({
533
537
  );
534
538
  }
535
539
  });
536
- var colour = z2.string().regex(/^#(?:[0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/u);
537
- var paletteSchema = z2.object({
540
+ var colour = z3.string().regex(/^#(?:[0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/u);
541
+ var paletteSchema = z3.object({
538
542
  colorPrimary: colour,
539
543
  colorPrimaryForeground: colour,
540
544
  colorBackground: colour,
@@ -582,58 +586,58 @@ var defaultDark = () => ({
582
586
  colorWarning: "#fbbf24",
583
587
  colorDanger: "#f87171"
584
588
  });
585
- var fontFamily = z2.enum(SITE_FONT_FAMILIES);
586
- var themeSchema = z2.object({
587
- preset: z2.enum(["clean", "editorial", "bold"]).default("clean"),
589
+ var fontFamily = z3.enum(SITE_FONT_FAMILIES);
590
+ var themeSchema = z3.object({
591
+ preset: z3.enum(["clean", "editorial", "bold"]).default("clean"),
588
592
  // When false the preset's tokens apply, when true the merchant's values do.
589
- customized: z2.boolean().default(false),
593
+ customized: z3.boolean().default(false),
590
594
  light: paletteSchema.default(defaultLight),
591
595
  dark: paletteSchema.default(defaultDark),
592
- fonts: z2.object({
596
+ fonts: z3.object({
593
597
  heading: fontFamily.default("system-sans"),
594
598
  body: fontFamily.default("system-sans"),
595
599
  mono: fontFamily.default("system-mono")
596
600
  }).strict().prefault({}),
597
- radius: z2.number().int().min(0).max(32).default(8),
598
- spacingScale: z2.enum(["compact", "comfortable", "roomy"]).default("comfortable"),
599
- colorScheme: z2.enum(["light", "dark", "auto"]).default("auto")
601
+ radius: z3.number().int().min(0).max(32).default(8),
602
+ spacingScale: z3.enum(["compact", "comfortable", "roomy"]).default("comfortable"),
603
+ colorScheme: z3.enum(["light", "dark", "auto"]).default("auto")
600
604
  }).strict();
601
- var brandSchema = z2.object({
602
- storeName: z2.string().max(100).regex(/^[^\u0000-\u001F\u007F]*$/u).default(""),
603
- logo: z2.object({
605
+ var brandSchema = z3.object({
606
+ storeName: z3.string().max(100).regex(/^[^\u0000-\u001F\u007F]*$/u).default(""),
607
+ logo: z3.object({
604
608
  light: assetIdSchema.nullable().default(null),
605
609
  dark: assetIdSchema.nullable().default(null)
606
610
  }).strict().prefault({}),
607
611
  favicon: assetIdSchema.nullable().default(null)
608
612
  }).strict();
609
- var isoInstant = z2.iso.datetime({ offset: true });
610
- var announcementSchema = z2.object({
611
- enabled: z2.boolean().default(false),
613
+ var isoInstant = z3.iso.datetime({ offset: true });
614
+ var announcementSchema = z3.object({
615
+ enabled: z3.boolean().default(false),
612
616
  message: localizedTextSchema.default({}),
613
617
  target: menuTargetSchema.nullable().default(null),
614
618
  startsAt: isoInstant.nullable().default(null),
615
619
  endsAt: isoInstant.nullable().default(null)
616
620
  }).strict();
617
- var seoSchema = z2.object({
618
- titleTemplate: z2.string().min(1).max(200).default("{page} \u2013 {store}"),
621
+ var seoSchema = z3.object({
622
+ titleTemplate: z3.string().min(1).max(200).default("{page} \u2013 {store}"),
619
623
  defaultDescription: localizedTextSchema.default({}),
620
624
  shareImage: assetIdSchema.nullable().default(null)
621
625
  }).strict();
622
- var stringsSchema = z2.object(
626
+ var stringsSchema = z3.object(
623
627
  Object.fromEntries(
624
628
  SITE_STRING_KEYS.map((key) => [key, localizedTextSchema.optional()])
625
629
  )
626
630
  ).strict();
627
- var routesSchema = z2.object({
628
- page: z2.string().max(200).regex(/^\/(?!\/)[^\s\\]*\{handle\}[^\s\\]*$/).default("/pages/{handle}"),
629
- home: z2.literal("/").default("/")
631
+ var routesSchema = z3.object({
632
+ page: z3.string().max(200).regex(/^\/(?!\/)[^\s\\]*\{handle\}[^\s\\]*$/).default("/pages/{handle}"),
633
+ home: z3.literal("/").default("/")
630
634
  }).strict();
631
- var connectionsSchema = z2.object({
632
- throttlePublishableKey: z2.string().regex(THROTTLE_PK_RE).nullable().default(null)
635
+ var connectionsSchema = z3.object({
636
+ throttlePublishableKey: z3.string().regex(THROTTLE_PK_RE).nullable().default(null)
633
637
  }).strict();
634
- var localesSchema = z2.object({
638
+ var localesSchema = z3.object({
635
639
  default: localeTagSchema.default("en"),
636
- list: z2.array(localeTagSchema).min(1).max(50).default(["en"])
640
+ list: z3.array(localeTagSchema).min(1).max(50).default(["en"])
637
641
  }).strict().superRefine((locales, ctx) => {
638
642
  if (!locales.list.includes(locales.default)) {
639
643
  customIssue(ctx, "INVALID_VALUE", "The default locale must be in the list", ["list"]);
@@ -643,8 +647,8 @@ var localesSchema = z2.object({
643
647
  }
644
648
  });
645
649
  var SITE_SETTINGS_SCHEMA_VERSION = 1;
646
- var siteSettingsSchema = z2.object({
647
- schemaVersion: z2.literal(1).default(1),
650
+ var siteSettingsSchema = z3.object({
651
+ schemaVersion: z3.literal(1).default(1),
648
652
  brand: brandSchema.prefault({}),
649
653
  theme: themeSchema.prefault({}),
650
654
  menus: menusSchema.prefault({}),
@@ -655,7 +659,7 @@ var siteSettingsSchema = z2.object({
655
659
  connections: connectionsSchema.prefault({}),
656
660
  locales: localesSchema.prefault({}),
657
661
  /** The store origin, for editor links and the default notice endpoint. */
658
- storeUrl: z2.string().max(2e3).regex(/^https?:\/\/[^\s/\\]+$/i).nullable().default(null)
662
+ storeUrl: z3.string().max(2e3).regex(/^https?:\/\/[^\s/\\]+$/i).nullable().default(null)
659
663
  }).strict();
660
664
  function defaultSiteSettings() {
661
665
  return siteSettingsSchema.parse({});
@@ -690,7 +694,7 @@ function isSettingValue(value, depth = 0) {
690
694
  return false;
691
695
  }
692
696
  }
693
- var settingValueSchema = z3.preprocess((input, ctx) => {
697
+ var settingValueSchema = z4.preprocess((input, ctx) => {
694
698
  if (!isSettingValue(input)) {
695
699
  ctx.addIssue({
696
700
  code: "custom",
@@ -700,24 +704,24 @@ var settingValueSchema = z3.preprocess((input, ctx) => {
700
704
  return null;
701
705
  }
702
706
  return input;
703
- }, z3.json());
704
- var nodeIdSchema = z3.string().regex(NODE_ID_RE);
707
+ }, z4.json());
708
+ var nodeIdSchema = z4.string().regex(NODE_ID_RE);
705
709
  var COLOR_VALUE_RE = /^(?:token:[a-z][a-z0-9-]{0,30}|#[0-9a-fA-F]{6}(?:[0-9a-fA-F]{2})?)$/;
706
- var colorValueSchema = z3.string().regex(COLOR_VALUE_RE);
710
+ var colorValueSchema = z4.string().regex(COLOR_VALUE_RE);
707
711
  var SPACING_TOKENS = ["none", "xs", "s", "m", "l", "xl", "2xl"];
708
- var spacingValueSchema = z3.union([
709
- z3.enum(SPACING_TOKENS),
710
- z3.number().min(0).max(400)
712
+ var spacingValueSchema = z4.union([
713
+ z4.enum(SPACING_TOKENS),
714
+ z4.number().min(0).max(400)
711
715
  ]);
712
716
  var COMMON_SETTING_KEYS = ["hidden", "anchor", "spacingTop", "spacingBottom"];
713
717
  var ANCHOR_RE = /^[A-Za-z][A-Za-z0-9_-]{0,63}$/;
714
- var anchorSchema = z3.string().regex(ANCHOR_RE);
718
+ var anchorSchema = z4.string().regex(ANCHOR_RE);
715
719
  var VERTICAL_ALIGN = ["top", "center", "bottom", "stretch"];
716
- var backgroundSchema = z3.object({
720
+ var backgroundSchema = z4.object({
717
721
  color: colorValueSchema.optional(),
718
722
  image: assetIdSchema.optional(),
719
723
  overlay: colorValueSchema.optional(),
720
- position: z3.enum([
724
+ position: z4.enum([
721
725
  "center",
722
726
  "top",
723
727
  "bottom",
@@ -728,33 +732,33 @@ var backgroundSchema = z3.object({
728
732
  "bottom left",
729
733
  "bottom right"
730
734
  ]).optional(),
731
- size: z3.enum(["cover", "contain", "auto"]).optional()
735
+ size: z4.enum(["cover", "contain", "auto"]).optional()
732
736
  }).strict();
733
- var sectionPropsSchema = z3.object({
734
- width: z3.enum(["boxed", "full"]),
735
- contentWidth: z3.number().int().min(600).max(1600),
737
+ var sectionPropsSchema = z4.object({
738
+ width: z4.enum(["boxed", "full"]),
739
+ contentWidth: z4.number().int().min(600).max(1600),
736
740
  gap: spacingValueSchema,
737
741
  paddingY: spacingValueSchema,
738
742
  paddingX: spacingValueSchema,
739
- minHeight: z3.number().min(0).max(2e3),
740
- verticalAlign: z3.enum(VERTICAL_ALIGN),
743
+ minHeight: z4.number().min(0).max(2e3),
744
+ verticalAlign: z4.enum(VERTICAL_ALIGN),
741
745
  background: backgroundSchema,
742
- stackOrder: z3.enum(["normal", "reverse"]),
743
- hidden: z3.boolean(),
746
+ stackOrder: z4.enum(["normal", "reverse"]),
747
+ hidden: z4.boolean(),
744
748
  anchor: anchorSchema
745
749
  }).partial().strict();
746
- var columnWidth = z3.number().min(10).max(100).refine((w) => Math.abs(w * 100 - Math.round(w * 100)) < 1e-6, {
750
+ var columnWidth = z4.number().min(10).max(100).refine((w) => Math.abs(w * 100 - Math.round(w * 100)) < 1e-6, {
747
751
  message: "A column width has at most 2 decimals"
748
752
  });
749
753
  var columnPropsShape = {
750
754
  width: columnWidth,
751
- verticalAlign: z3.enum(VERTICAL_ALIGN),
755
+ verticalAlign: z4.enum(VERTICAL_ALIGN),
752
756
  padding: spacingValueSchema,
753
757
  background: backgroundSchema,
754
- hidden: z3.boolean(),
758
+ hidden: z4.boolean(),
755
759
  anchor: anchorSchema
756
760
  };
757
- var columnPropsSchema = z3.object({ ...columnPropsShape, width: columnPropsShape.width }).partial({ verticalAlign: true, padding: true, background: true, hidden: true, anchor: true }).strict();
761
+ var columnPropsSchema = z4.object({ ...columnPropsShape, width: columnPropsShape.width }).partial({ verticalAlign: true, padding: true, background: true, hidden: true, anchor: true }).strict();
758
762
  function overridesOf(shape) {
759
763
  const entries = Object.entries(shape).map(
760
764
  ([key, schema]) => [key, schema.nullable().optional()]
@@ -762,13 +766,13 @@ function overridesOf(shape) {
762
766
  return Object.fromEntries(entries);
763
767
  }
764
768
  function responsiveOf(shape) {
765
- const device = z3.object(overridesOf(shape)).strict();
766
- return z3.object({ tablet: device.optional(), phone: device.optional() }).strict();
769
+ const device = z4.object(overridesOf(shape)).strict();
770
+ return z4.object({ tablet: device.optional(), phone: device.optional() }).strict();
767
771
  }
768
772
  var sectionResponsive = responsiveOf(sectionPropsSchema.shape);
769
773
  var columnResponsive = responsiveOf(columnPropsShape);
770
774
  var WIDGET_TYPE_RE = /^(?:basic|catalog|commerce|custom)\.[a-z][a-z0-9-]{0,63}$/;
771
- var widgetTypeSchema = z3.string().superRefine((value, ctx) => {
775
+ var widgetTypeSchema = z4.string().superRefine((value, ctx) => {
772
776
  if (value === "inner-section") {
773
777
  customIssue(
774
778
  ctx,
@@ -783,32 +787,32 @@ var widgetTypeSchema = z3.string().superRefine((value, ctx) => {
783
787
  );
784
788
  }
785
789
  });
786
- var dataNameSchema = z3.string().regex(/^[a-z][A-Za-z0-9_]{0,39}$/);
787
- var dataBindingSchema = z3.union([
788
- z3.object({ source: z3.string().regex(/^context\.[a-z][a-z0-9-]{0,39}$/) }).strict(),
789
- z3.object({
790
- source: z3.string().regex(/^(?!context\.)[a-z][a-z0-9]*\.[a-z][a-z0-9-]{0,39}$/),
790
+ var dataNameSchema = z4.string().regex(/^[a-z][A-Za-z0-9_]{0,39}$/);
791
+ var dataBindingSchema = z4.union([
792
+ z4.object({ source: z4.string().regex(/^context\.[a-z][a-z0-9-]{0,39}$/) }).strict(),
793
+ z4.object({
794
+ source: z4.string().regex(/^(?!context\.)[a-z][a-z0-9]*\.[a-z][a-z0-9-]{0,39}$/),
791
795
  params: safeRecord(settingValueSchema)
792
796
  }).strict()
793
797
  ]);
794
798
  var settingsRecord = safeRecord(settingValueSchema);
795
- var widgetNodeSchema = z3.object({
799
+ var widgetNodeSchema = z4.object({
796
800
  id: nodeIdSchema,
797
801
  type: widgetTypeSchema,
798
- v: z3.number().int().min(1).max(9999),
802
+ v: z4.number().int().min(1).max(9999),
799
803
  props: settingsRecord,
800
- responsive: z3.object({
804
+ responsive: z4.object({
801
805
  tablet: safeRecord(settingValueSchema).optional(),
802
806
  phone: safeRecord(settingValueSchema).optional()
803
807
  }).strict().optional(),
804
808
  data: safeRecord(dataBindingSchema, dataNameSchema).optional()
805
809
  }).strict();
806
- var innerColumnNodeSchema = z3.object({
810
+ var innerColumnNodeSchema = z4.object({
807
811
  id: nodeIdSchema,
808
- type: z3.literal("column"),
812
+ type: z4.literal("column"),
809
813
  props: columnPropsSchema,
810
814
  responsive: columnResponsive.optional(),
811
- children: z3.array(widgetNodeSchema).max(LIMITS.childrenPerColumn)
815
+ children: z4.array(widgetNodeSchema).max(LIMITS.childrenPerColumn)
812
816
  }).strict();
813
817
  function checkColumnWidths(columns, ctx) {
814
818
  const sum = columns.reduce((total, column) => total + column.props.width, 0);
@@ -836,57 +840,57 @@ function checkColumnWidths(columns, ctx) {
836
840
  }
837
841
  }
838
842
  var columnsLength = { min: LIMITS.columnsMin, max: LIMITS.columnsMax };
839
- var innerSectionNodeSchema = z3.object({
843
+ var innerSectionNodeSchema = z4.object({
840
844
  id: nodeIdSchema,
841
- type: z3.literal("inner-section"),
845
+ type: z4.literal("inner-section"),
842
846
  props: sectionPropsSchema,
843
847
  responsive: sectionResponsive.optional(),
844
- columns: z3.array(innerColumnNodeSchema).min(columnsLength.min).max(columnsLength.max)
848
+ columns: z4.array(innerColumnNodeSchema).min(columnsLength.min).max(columnsLength.max)
845
849
  }).strict().superRefine((section, ctx) => checkColumnWidths(section.columns, ctx));
846
- var columnNodeSchema = z3.object({
850
+ var columnNodeSchema = z4.object({
847
851
  id: nodeIdSchema,
848
- type: z3.literal("column"),
852
+ type: z4.literal("column"),
849
853
  props: columnPropsSchema,
850
854
  responsive: columnResponsive.optional(),
851
- children: z3.array(z3.union([innerSectionNodeSchema, widgetNodeSchema])).max(LIMITS.childrenPerColumn)
855
+ children: z4.array(z4.union([innerSectionNodeSchema, widgetNodeSchema])).max(LIMITS.childrenPerColumn)
852
856
  }).strict();
853
- var sectionNodeSchema = z3.object({
857
+ var sectionNodeSchema = z4.object({
854
858
  id: nodeIdSchema,
855
- type: z3.literal("section"),
859
+ type: z4.literal("section"),
856
860
  props: sectionPropsSchema,
857
861
  responsive: sectionResponsive.optional(),
858
- columns: z3.array(columnNodeSchema).min(columnsLength.min).max(columnsLength.max)
862
+ columns: z4.array(columnNodeSchema).min(columnsLength.min).max(columnsLength.max)
859
863
  }).strict().superRefine((section, ctx) => checkColumnWidths(section.columns, ctx));
860
- var assetUrl = z3.string().max(2e3).regex(SAFE_HREF);
861
- var frozenAssetSchema = z3.object({
864
+ var assetUrl = z4.string().max(2e3).regex(SAFE_HREF);
865
+ var frozenAssetSchema = z4.object({
862
866
  url: assetUrl,
863
- width: z3.number().int().min(1).max(2e4),
864
- height: z3.number().int().min(1).max(2e4),
865
- variants: z3.array(
866
- z3.object({ width: z3.number().int().min(1).max(2e4), url: assetUrl }).strict()
867
+ width: z4.number().int().min(1).max(2e4),
868
+ height: z4.number().int().min(1).max(2e4),
869
+ variants: z4.array(
870
+ z4.object({ width: z4.number().int().min(1).max(2e4), url: assetUrl }).strict()
867
871
  ).max(12)
868
872
  }).strict();
869
873
  var CUSTOM_SNAPSHOT_KEY_RE = /^custom\.[a-z][a-z0-9-]{0,63}@[1-9][0-9]{0,3}$/;
870
- var customWidgetSnapshotSchema = z3.object({
871
- kind: z3.enum(["composite", "template"]),
872
- type: z3.string().regex(/^custom\.[a-z][a-z0-9-]{0,63}$/),
873
- v: z3.number().int().min(1).max(9999),
874
- title: z3.string().max(100),
875
- description: z3.string().max(500),
876
- icon: z3.string().max(40),
877
- group: z3.literal("custom"),
878
- settings: z3.array(z3.record(z3.string(), z3.unknown())).max(LIMITS.widgetSettings + COMMON_SETTING_KEYS.length),
879
- renamed: z3.record(z3.string(), z3.string()).optional(),
880
- removed: z3.array(z3.string()).optional()
874
+ var customWidgetSnapshotSchema = z4.object({
875
+ kind: z4.enum(["composite", "template"]),
876
+ type: z4.string().regex(/^custom\.[a-z][a-z0-9-]{0,63}$/),
877
+ v: z4.number().int().min(1).max(9999),
878
+ title: z4.string().max(100),
879
+ description: z4.string().max(500),
880
+ icon: z4.string().max(40),
881
+ group: z4.literal("custom"),
882
+ settings: z4.array(z4.record(z4.string(), z4.unknown())).max(LIMITS.widgetSettings + COMMON_SETTING_KEYS.length),
883
+ renamed: z4.record(z4.string(), z4.string()).optional(),
884
+ removed: z4.array(z4.string()).optional()
881
885
  }).loose();
882
886
  var CURRENT_SCHEMA_VERSION = 1;
883
- var pageDocumentSchema = z3.object({
884
- schemaVersion: z3.literal(1),
885
- sections: z3.array(sectionNodeSchema).max(LIMITS.sections),
887
+ var pageDocumentSchema = z4.object({
888
+ schemaVersion: z4.literal(1),
889
+ sections: z4.array(sectionNodeSchema).max(LIMITS.sections),
886
890
  // Published snapshots only.
887
891
  customWidgets: safeRecord(
888
892
  customWidgetSnapshotSchema,
889
- z3.string().regex(CUSTOM_SNAPSHOT_KEY_RE)
893
+ z4.string().regex(CUSTOM_SNAPSHOT_KEY_RE)
890
894
  ).optional(),
891
895
  assets: safeRecord(frozenAssetSchema, assetIdSchema).optional()
892
896
  }).strict().superRefine((doc, ctx) => {
@@ -1019,7 +1023,7 @@ function validateDocument(input) {
1019
1023
  }
1020
1024
 
1021
1025
  // src/widgets.ts
1022
- import { z as z4 } from "zod";
1026
+ import { z as z5 } from "zod";
1023
1027
 
1024
1028
  // src/basics.ts
1025
1029
  var opts = (...values) => values.map((value) => ({ value, label: value.charAt(0).toUpperCase() + value.slice(1) }));
@@ -1386,18 +1390,18 @@ var DATA_RESULT_TYPES = [
1386
1390
  var settingValue = settingValueSchema;
1387
1391
  var CSS_CONTROLS = ["color", "spacing", "font-size", "alignment", "number", "toggle", "select"];
1388
1392
  var CSS_OPTION_RE = /^[a-z0-9][a-z0-9:-]{0,39}$/;
1389
- var settingFieldSchema = z4.object({
1390
- key: z4.string().regex(/^[a-z][A-Za-z0-9]{0,39}$/),
1391
- label: z4.string().min(1).max(100),
1392
- tab: z4.enum(SETTING_TABS),
1393
- output: z4.enum(["css", "markup"]),
1394
- control: z4.enum(SETTING_CONTROLS),
1395
- translatable: z4.boolean().optional(),
1393
+ var settingFieldSchema = z5.object({
1394
+ key: z5.string().regex(/^[a-z][A-Za-z0-9]{0,39}$/),
1395
+ label: z5.string().min(1).max(100),
1396
+ tab: z5.enum(SETTING_TABS),
1397
+ output: z5.enum(["css", "markup"]),
1398
+ control: z5.enum(SETTING_CONTROLS),
1399
+ translatable: z5.boolean().optional(),
1396
1400
  default: settingValue,
1397
- min: z4.number().optional(),
1398
- max: z4.number().optional(),
1399
- options: z4.array(z4.object({ value: z4.string().max(60), label: z4.string().max(100) }).strict()).max(50).optional(),
1400
- maxLength: z4.number().int().min(1).max(2e4).optional()
1401
+ min: z5.number().optional(),
1402
+ max: z5.number().optional(),
1403
+ options: z5.array(z5.object({ value: z5.string().max(60), label: z5.string().max(100) }).strict()).max(50).optional(),
1404
+ maxLength: z5.number().int().min(1).max(2e4).optional()
1401
1405
  }).strict().superRefine((field2, ctx) => {
1402
1406
  if (field2.output !== "css") return;
1403
1407
  if (!CSS_CONTROLS.includes(field2.control) || field2.translatable === true) {
@@ -1417,46 +1421,46 @@ var settingFieldSchema = z4.object({
1417
1421
  const problem = validateSettingValue(field2, field2.default);
1418
1422
  if (problem !== null) customIssue(ctx, "INVALID_VALUE", `The default is invalid: ${problem}`, ["default"]);
1419
1423
  });
1420
- var fieldSpecSchema = z4.object({
1424
+ var fieldSpecSchema = z5.object({
1421
1425
  /** A dotted path a template may read, such as `price.display`. */
1422
- name: z4.string().regex(/^[a-z][A-Za-z0-9]*(?:\.[a-z][A-Za-z0-9]*)*$/),
1423
- type: z4.enum(["string", "number", "boolean", "money", "image", "url", "date", "list"]),
1426
+ name: z5.string().regex(/^[a-z][A-Za-z0-9]*(?:\.[a-z][A-Za-z0-9]*)*$/),
1427
+ type: z5.enum(["string", "number", "boolean", "money", "image", "url", "date", "list"]),
1424
1428
  example: settingValue.optional()
1425
1429
  }).strict();
1426
- var dataSourceDescriptorSchema = z4.object({
1427
- id: z4.string().regex(/^[a-z][a-z0-9]*\.[a-z][a-z0-9-]*$/),
1428
- provider: z4.enum(["catalog", "commerce"]),
1429
- title: z4.string().min(1).max(100),
1430
- description: z4.string().max(500),
1431
- params: z4.array(settingFieldSchema).max(LIMITS.widgetSettings),
1432
- result: z4.enum(DATA_RESULT_TYPES),
1433
- fields: z4.array(fieldSpecSchema).max(200),
1434
- perShopper: z4.boolean(),
1435
- cacheKind: z4.enum(["listings", "product", "reviews", "none"])
1430
+ var dataSourceDescriptorSchema = z5.object({
1431
+ id: z5.string().regex(/^[a-z][a-z0-9]*\.[a-z][a-z0-9-]*$/),
1432
+ provider: z5.enum(["catalog", "commerce"]),
1433
+ title: z5.string().min(1).max(100),
1434
+ description: z5.string().max(500),
1435
+ params: z5.array(settingFieldSchema).max(LIMITS.widgetSettings),
1436
+ result: z5.enum(DATA_RESULT_TYPES),
1437
+ fields: z5.array(fieldSpecSchema).max(200),
1438
+ perShopper: z5.boolean(),
1439
+ cacheKind: z5.enum(["listings", "product", "reviews", "none"])
1436
1440
  }).strict();
1437
- var widgetDefinitionSchema = z4.object({
1438
- type: z4.string().regex(WIDGET_TYPE_RE),
1439
- v: z4.number().int().min(1).max(9999),
1440
- title: z4.string().min(1).max(100),
1441
- group: z4.enum(WIDGET_GROUPS),
1442
- icon: z4.string().min(1).max(40),
1443
- description: z4.string().min(1).max(500),
1441
+ var widgetDefinitionSchema = z5.object({
1442
+ type: z5.string().regex(WIDGET_TYPE_RE),
1443
+ v: z5.number().int().min(1).max(9999),
1444
+ title: z5.string().min(1).max(100),
1445
+ group: z5.enum(WIDGET_GROUPS),
1446
+ icon: z5.string().min(1).max(40),
1447
+ description: z5.string().min(1).max(500),
1444
1448
  // The common props (hidden, anchor, spacing) do not count against the cap.
1445
- settings: z4.array(settingFieldSchema).max(LIMITS.widgetSettings + COMMON_SETTING_KEYS.length),
1446
- data: z4.record(
1447
- z4.string(),
1448
- z4.object({
1449
- accepts: z4.array(z4.enum(DATA_RESULT_TYPES)).min(1),
1450
- required: z4.boolean(),
1449
+ settings: z5.array(settingFieldSchema).max(LIMITS.widgetSettings + COMMON_SETTING_KEYS.length),
1450
+ data: z5.record(
1451
+ z5.string(),
1452
+ z5.object({
1453
+ accepts: z5.array(z5.enum(DATA_RESULT_TYPES)).min(1),
1454
+ required: z5.boolean(),
1451
1455
  default: dataBindingSchema.optional(),
1452
- label: z4.string().min(1).max(100)
1456
+ label: z5.string().min(1).max(100)
1453
1457
  }).strict()
1454
1458
  ).optional(),
1455
- placement: z4.object({
1456
- slotsOnly: z4.boolean().optional(),
1457
- notIn: z4.array(z4.enum(["header", "footer", "slot"])).optional(),
1459
+ placement: z5.object({
1460
+ slotsOnly: z5.boolean().optional(),
1461
+ notIn: z5.array(z5.enum(["header", "footer", "slot"])).optional(),
1458
1462
  /** Not allowed inside an inner section. */
1459
- topLevelOnly: z4.boolean().optional()
1463
+ topLevelOnly: z5.boolean().optional()
1460
1464
  }).strict().optional()
1461
1465
  }).strict().superRefine((def, ctx) => {
1462
1466
  const own = def.settings.filter(
@@ -1539,7 +1543,7 @@ function validateWidgetProps(def, props) {
1539
1543
  }
1540
1544
  return problems;
1541
1545
  }
1542
- var snapshotPlacementSchema = z4.object({ topLevelOnly: z4.boolean().optional() }).strict();
1546
+ var snapshotPlacementSchema = z5.object({ topLevelOnly: z5.boolean().optional() }).strict();
1543
1547
  function snapshotPlacement(snapshot) {
1544
1548
  const raw2 = snapshot.placement;
1545
1549
  if (raw2 === void 0) return void 0;
@@ -1827,6 +1831,17 @@ function propIssues(def, props, path, skipNull, common2 = false) {
1827
1831
  }
1828
1832
  return out;
1829
1833
  }
1834
+ function contextIssues(id, ctx, path) {
1835
+ if (ctx.documentKind !== "slot" || ctx.slotContext === void 0) return [];
1836
+ if (id === `context.${ctx.slotContext}`) return [];
1837
+ return [
1838
+ issue(
1839
+ path,
1840
+ "SOURCE_NOT_ENABLED",
1841
+ ctx.slotContext === "none" ? `This slot gives no context, so "${id}" is not available` : `This slot gives context.${ctx.slotContext}, so "${id}" is not available`
1842
+ )
1843
+ ];
1844
+ }
1830
1845
  function bindingIssues(def, name, binding, ctx, path) {
1831
1846
  const input = def.data?.[name];
1832
1847
  if (input === void 0) {
@@ -1836,7 +1851,7 @@ function bindingIssues(def, name, binding, ctx, path) {
1836
1851
  return [issue(path, "INVALID_SHAPE", "A binding is { source, params }")];
1837
1852
  }
1838
1853
  const { source: id } = binding;
1839
- if (id.startsWith("context.")) return [];
1854
+ if (id.startsWith("context.")) return contextIssues(id, ctx, [...path, "source"]);
1840
1855
  const source = ctx.registry.source(id);
1841
1856
  if (source === void 0 || !ctx.enabledSources.has(id)) {
1842
1857
  return [issue([...path, "source"], "SOURCE_NOT_ENABLED", `The data source "${id}" is not enabled`)];
@@ -2500,55 +2515,55 @@ function invertOps(before, ops, ctx) {
2500
2515
  }
2501
2516
 
2502
2517
  // src/op-schema.ts
2503
- import { z as z5 } from "zod";
2504
- var parentIdSchema = z5.union([z5.literal("root"), nodeIdSchema]);
2505
- var deviceSchema = z5.enum(["tablet", "phone"]);
2518
+ import { z as z6 } from "zod";
2519
+ var parentIdSchema = z6.union([z6.literal("root"), nodeIdSchema]);
2520
+ var deviceSchema = z6.enum(["tablet", "phone"]);
2506
2521
  var propsSchema = safeRecord(settingValueSchema);
2507
- var dataNameSchema2 = z5.string().regex(/^[a-z][A-Za-z0-9_]{0,39}$/);
2522
+ var dataNameSchema2 = z6.string().regex(/^[a-z][A-Za-z0-9_]{0,39}$/);
2508
2523
  var INDEX_MAX = 1e4;
2509
- var overridesSchema = z5.object({ tablet: propsSchema.optional(), phone: propsSchema.optional() }).strict();
2510
- var insertOp = z5.object({
2511
- op: z5.literal("insert"),
2524
+ var overridesSchema = z6.object({ tablet: propsSchema.optional(), phone: propsSchema.optional() }).strict();
2525
+ var insertOp = z6.object({
2526
+ op: z6.literal("insert"),
2512
2527
  parentId: parentIdSchema,
2513
- index: z5.number().int().min(0).max(INDEX_MAX),
2514
- node: z5.union([sectionNodeSchema, innerSectionNodeSchema, widgetNodeSchema])
2528
+ index: z6.number().int().min(0).max(INDEX_MAX),
2529
+ node: z6.union([sectionNodeSchema, innerSectionNodeSchema, widgetNodeSchema])
2515
2530
  }).strict();
2516
- var removeOp = z5.object({ op: z5.literal("remove"), id: nodeIdSchema }).strict();
2517
- var moveOp = z5.object({
2518
- op: z5.literal("move"),
2531
+ var removeOp = z6.object({ op: z6.literal("remove"), id: nodeIdSchema }).strict();
2532
+ var moveOp = z6.object({
2533
+ op: z6.literal("move"),
2519
2534
  id: nodeIdSchema,
2520
2535
  parentId: parentIdSchema,
2521
- index: z5.number().int().min(0).max(INDEX_MAX)
2536
+ index: z6.number().int().min(0).max(INDEX_MAX)
2522
2537
  }).strict();
2523
- var setPropsOp = z5.object({ op: z5.literal("setProps"), id: nodeIdSchema, props: propsSchema }).strict();
2524
- var setResponsiveOp = z5.object({
2525
- op: z5.literal("setResponsive"),
2538
+ var setPropsOp = z6.object({ op: z6.literal("setProps"), id: nodeIdSchema, props: propsSchema }).strict();
2539
+ var setResponsiveOp = z6.object({
2540
+ op: z6.literal("setResponsive"),
2526
2541
  id: nodeIdSchema,
2527
2542
  device: deviceSchema,
2528
2543
  props: propsSchema
2529
2544
  }).strict();
2530
- var setColumnsOp = z5.object({
2531
- op: z5.literal("setColumns"),
2545
+ var setColumnsOp = z6.object({
2546
+ op: z6.literal("setColumns"),
2532
2547
  sectionId: nodeIdSchema,
2533
- widths: z5.array(z5.number().finite()).max(50),
2548
+ widths: z6.array(z6.number().finite()).max(50),
2534
2549
  device: deviceSchema.optional(),
2535
- moveChildrenTo: z5.literal("previous").optional(),
2536
- newIds: z5.array(nodeIdSchema).max(50).optional()
2550
+ moveChildrenTo: z6.literal("previous").optional(),
2551
+ newIds: z6.array(nodeIdSchema).max(50).optional()
2537
2552
  }).strict();
2538
- var setDataOp = z5.object({
2539
- op: z5.literal("setData"),
2553
+ var setDataOp = z6.object({
2554
+ op: z6.literal("setData"),
2540
2555
  id: nodeIdSchema,
2541
2556
  name: dataNameSchema2,
2542
2557
  binding: dataBindingSchema.nullable()
2543
2558
  }).strict();
2544
- var replaceDocumentOp = z5.object({ op: z5.literal("replaceDocument"), document: pageDocumentSchema }).strict();
2545
- var upgradeNodeShape = { op: z5.literal("upgradeNode"), id: nodeIdSchema, toV: z5.number().int().min(1).max(9999) };
2546
- var upgradeNodeOp = z5.object({
2559
+ var replaceDocumentOp = z6.object({ op: z6.literal("replaceDocument"), document: pageDocumentSchema }).strict();
2560
+ var upgradeNodeShape = { op: z6.literal("upgradeNode"), id: nodeIdSchema, toV: z6.number().int().min(1).max(9999) };
2561
+ var upgradeNodeOp = z6.object({
2547
2562
  ...upgradeNodeShape,
2548
- restore: z5.object({ props: propsSchema, responsive: overridesSchema.optional() }).strict().optional()
2563
+ restore: z6.object({ props: propsSchema, responsive: overridesSchema.optional() }).strict().optional()
2549
2564
  }).strict();
2550
- var agentUpgradeNodeOp = z5.object(upgradeNodeShape).strict();
2551
- var docOpSchema = z5.discriminatedUnion("op", [
2565
+ var agentUpgradeNodeOp = z6.object(upgradeNodeShape).strict();
2566
+ var docOpSchema = z6.discriminatedUnion("op", [
2552
2567
  insertOp,
2553
2568
  removeOp,
2554
2569
  moveOp,
@@ -2560,7 +2575,7 @@ var docOpSchema = z5.discriminatedUnion("op", [
2560
2575
  upgradeNodeOp
2561
2576
  ]);
2562
2577
  var AGENT_MAX_OPS = 500;
2563
- var agentDocOpSchema = z5.discriminatedUnion("op", [
2578
+ var agentDocOpSchema = z6.discriminatedUnion("op", [
2564
2579
  insertOp,
2565
2580
  removeOp,
2566
2581
  moveOp,
@@ -2570,7 +2585,7 @@ var agentDocOpSchema = z5.discriminatedUnion("op", [
2570
2585
  setDataOp,
2571
2586
  agentUpgradeNodeOp
2572
2587
  ]);
2573
- var agentDocOpsSchema = z5.array(agentDocOpSchema).min(1).max(AGENT_MAX_OPS);
2588
+ var agentDocOpsSchema = z6.array(agentDocOpSchema).min(1).max(AGENT_MAX_OPS);
2574
2589
 
2575
2590
  // src/urls.ts
2576
2591
  var MAX_URL_LENGTH = 2e3;
@@ -4337,26 +4352,26 @@ function sanitizeWidgetCss(css, type) {
4337
4352
  }
4338
4353
 
4339
4354
  // src/custom-widget.ts
4340
- import { z as z6 } from "zod";
4355
+ import { z as z7 } from "zod";
4341
4356
  var SETTING_KEY_RE = /^[a-z][A-Za-z0-9]{0,39}$/;
4342
- var settingKey = z6.string().regex(SETTING_KEY_RE);
4343
- var inputName = z6.string().regex(/^[a-z][A-Za-z0-9]{0,39}$/);
4357
+ var settingKey = z7.string().regex(SETTING_KEY_RE);
4358
+ var inputName = z7.string().regex(/^[a-z][A-Za-z0-9]{0,39}$/);
4344
4359
  var dataInputShape = {
4345
- accepts: z6.array(z6.enum(DATA_RESULT_TYPES)).min(1).max(DATA_RESULT_TYPES.length),
4346
- required: z6.boolean(),
4347
- label: z6.string().min(1).max(100)
4360
+ accepts: z7.array(z7.enum(DATA_RESULT_TYPES)).min(1).max(DATA_RESULT_TYPES.length),
4361
+ required: z7.boolean(),
4362
+ label: z7.string().min(1).max(100)
4348
4363
  };
4349
4364
  var common = {
4350
- type: z6.string().regex(/^custom\.[a-z][a-z0-9-]{0,63}$/),
4351
- v: z6.number().int().min(1).max(9999),
4352
- title: z6.string().min(1).max(100),
4353
- description: z6.string().min(1).max(500),
4354
- icon: z6.string().min(1).max(40),
4355
- group: z6.literal("custom"),
4365
+ type: z7.string().regex(/^custom\.[a-z][a-z0-9-]{0,63}$/),
4366
+ v: z7.number().int().min(1).max(9999),
4367
+ title: z7.string().min(1).max(100),
4368
+ description: z7.string().min(1).max(500),
4369
+ icon: z7.string().min(1).max(40),
4370
+ group: z7.literal("custom"),
4356
4371
  // The common props (hidden, anchor, spacing) are added on normalisation and do not count.
4357
- settings: z6.array(settingFieldSchema).max(LIMITS.widgetSettings + COMMON_SETTING_KEYS.length),
4372
+ settings: z7.array(settingFieldSchema).max(LIMITS.widgetSettings + COMMON_SETTING_KEYS.length),
4358
4373
  renamed: safeRecord(settingKey, settingKey).optional(),
4359
- removed: z6.array(settingKey).max(LIMITS.widgetSettings).optional()
4374
+ removed: z7.array(settingKey).max(LIMITS.widgetSettings).optional()
4360
4375
  };
4361
4376
  function limitInputs(data, ctx) {
4362
4377
  if (data !== void 0 && Object.keys(data).length > LIMITS.customWidgetDataInputs) {
@@ -4368,31 +4383,31 @@ function limitInputs(data, ctx) {
4368
4383
  );
4369
4384
  }
4370
4385
  }
4371
- var templateSchema = z6.object({
4372
- kind: z6.literal("template"),
4386
+ var templateSchema = z7.object({
4387
+ kind: z7.literal("template"),
4373
4388
  ...common,
4374
- data: safeRecord(z6.object(dataInputShape).strict(), inputName).optional(),
4375
- template: z6.string(),
4376
- css: z6.string().optional()
4389
+ data: safeRecord(z7.object(dataInputShape).strict(), inputName).optional(),
4390
+ template: z7.string(),
4391
+ css: z7.string().optional()
4377
4392
  }).strict().superRefine((def, ctx) => limitInputs(def.data, ctx));
4378
4393
  var targetNode = nodeIdSchema;
4379
- var compositeSchema = z6.object({
4380
- kind: z6.literal("composite"),
4394
+ var compositeSchema = z7.object({
4395
+ kind: z7.literal("composite"),
4381
4396
  ...common,
4382
- body: z6.object({
4383
- columns: z6.array(z6.unknown()).optional(),
4384
- stack: z6.array(z6.unknown()).optional()
4397
+ body: z7.object({
4398
+ columns: z7.array(z7.unknown()).optional(),
4399
+ stack: z7.array(z7.unknown()).optional()
4385
4400
  }).strict(),
4386
- bindings: z6.array(
4387
- z6.object({
4401
+ bindings: z7.array(
4402
+ z7.object({
4388
4403
  setting: settingKey,
4389
- targets: z6.array(z6.object({ node: targetNode, prop: settingKey }).strict()).min(1).max(20)
4404
+ targets: z7.array(z7.object({ node: targetNode, prop: settingKey }).strict()).min(1).max(20)
4390
4405
  }).strict()
4391
4406
  ).max(LIMITS.widgetSettings),
4392
4407
  data: safeRecord(
4393
- z6.object({
4408
+ z7.object({
4394
4409
  ...dataInputShape,
4395
- targets: z6.array(z6.object({ node: targetNode, input: inputName }).strict()).min(1).max(20)
4410
+ targets: z7.array(z7.object({ node: targetNode, input: inputName }).strict()).min(1).max(20)
4396
4411
  }).strict(),
4397
4412
  inputName
4398
4413
  ).optional()