@cntrl-site/sdk 1.21.1 → 1.22.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
@@ -248,7 +248,7 @@ const RichTextItemSchema = ItemBaseSchema.extend({
248
248
  isDraggable: zod.z.boolean().optional()
249
249
  })
250
250
  ),
251
- state: zod.z.record(zod.z.record(RichTextStateParamsSchema))
251
+ state: zod.z.record(RichTextStateParamsSchema)
252
252
  });
253
253
  const pointerEvents = zod.z.enum(["never", "when_visible", "always"]).optional();
254
254
  const FXControlSchema = zod.z.discriminatedUnion("type", [
@@ -295,7 +295,7 @@ const ImageItemSchema = ItemBaseSchema.extend({
295
295
  isDraggable: zod.z.boolean().optional()
296
296
  })
297
297
  ),
298
- state: zod.z.record(zod.z.record(MediaStateParamsSchema))
298
+ state: zod.z.record(MediaStateParamsSchema)
299
299
  });
300
300
  const VideoItemSchema = ItemBaseSchema.extend({
301
301
  type: zod.z.literal(ArticleItemType.Video),
@@ -324,7 +324,7 @@ const VideoItemSchema = ItemBaseSchema.extend({
324
324
  isDraggable: zod.z.boolean().optional()
325
325
  })
326
326
  ),
327
- state: zod.z.record(zod.z.record(MediaStateParamsSchema))
327
+ state: zod.z.record(MediaStateParamsSchema)
328
328
  });
329
329
  const RectangleItemSchema = ItemBaseSchema.extend({
330
330
  type: zod.z.literal(ArticleItemType.Rectangle),
@@ -350,7 +350,7 @@ const RectangleItemSchema = ItemBaseSchema.extend({
350
350
  isDraggable: zod.z.boolean().optional()
351
351
  })
352
352
  ),
353
- state: zod.z.record(zod.z.record(RectangleStateParamsSchema))
353
+ state: zod.z.record(RectangleStateParamsSchema)
354
354
  });
355
355
  const CustomItemSchema = ItemBaseSchema.extend({
356
356
  type: zod.z.literal(ArticleItemType.Custom),
@@ -367,7 +367,7 @@ const CustomItemSchema = ItemBaseSchema.extend({
367
367
  layoutParams: zod.z.record(zod.z.object({
368
368
  isDraggable: zod.z.boolean().optional()
369
369
  })),
370
- state: zod.z.record(zod.z.record(CustomItemStateParamsSchema))
370
+ state: zod.z.record(CustomItemStateParamsSchema)
371
371
  });
372
372
  const VimeoEmbedItemSchema = ItemBaseSchema.extend({
373
373
  type: zod.z.literal(ArticleItemType.VimeoEmbed),
@@ -395,7 +395,7 @@ const VimeoEmbedItemSchema = ItemBaseSchema.extend({
395
395
  opacity: zod.z.number().nonnegative()
396
396
  })
397
397
  ),
398
- state: zod.z.record(zod.z.record(EmbedStateParamsSchema))
398
+ state: zod.z.record(EmbedStateParamsSchema)
399
399
  });
400
400
  const YoutubeEmbedItemSchema = ItemBaseSchema.extend({
401
401
  type: zod.z.literal(ArticleItemType.YoutubeEmbed),
@@ -420,7 +420,7 @@ const YoutubeEmbedItemSchema = ItemBaseSchema.extend({
420
420
  opacity: zod.z.number().nonnegative()
421
421
  })
422
422
  ),
423
- state: zod.z.record(zod.z.record(EmbedStateParamsSchema))
423
+ state: zod.z.record(EmbedStateParamsSchema)
424
424
  });
425
425
  const CodeEmbedItemSchema = ItemBaseSchema.extend({
426
426
  type: zod.z.literal(ArticleItemType.CodeEmbed),
@@ -444,7 +444,7 @@ const CodeEmbedItemSchema = ItemBaseSchema.extend({
444
444
  isDraggable: zod.z.boolean().optional()
445
445
  })
446
446
  ),
447
- state: zod.z.record(zod.z.record(CodeEmbedStateParamsSchema))
447
+ state: zod.z.record(CodeEmbedStateParamsSchema)
448
448
  });
449
449
  const ComponentItemSchema = ItemBaseSchema.extend({
450
450
  type: zod.z.literal(ArticleItemType.Component),
@@ -493,7 +493,7 @@ const ItemSchema = zod.z.lazy(() => zod.z.discriminatedUnion("type", [
493
493
  blur: zod.z.number()
494
494
  })
495
495
  ),
496
- state: zod.z.record(zod.z.record(GroupStateParamsSchema))
496
+ state: zod.z.record(GroupStateParamsSchema)
497
497
  }),
498
498
  ItemBaseSchema.extend({
499
499
  type: zod.z.literal(ArticleItemType.Compound),
@@ -513,7 +513,7 @@ const ItemSchema = zod.z.lazy(() => zod.z.discriminatedUnion("type", [
513
513
  opacity: zod.z.number().nonnegative()
514
514
  })
515
515
  ),
516
- state: zod.z.record(zod.z.record(CompoundStateParamsSchema))
516
+ state: zod.z.record(CompoundStateParamsSchema)
517
517
  })
518
518
  ]));
519
519
  const SectionHeightSchema = zod.z.object({
@@ -559,7 +559,7 @@ const InteractionSchema = zod.z.object({
559
559
  const ArticleSchema = zod.z.object({
560
560
  id: zod.z.string().min(1),
561
561
  sections: zod.z.array(SectionSchema),
562
- interactions: zod.z.array(InteractionSchema)
562
+ interactions: zod.z.record(zod.z.array(InteractionSchema))
563
563
  });
564
564
  const LayoutSchema = zod.z.object({
565
565
  id: zod.z.string(),
package/dist/index.mjs CHANGED
@@ -229,7 +229,7 @@ const RichTextItemSchema = ItemBaseSchema.extend({
229
229
  isDraggable: z.boolean().optional()
230
230
  })
231
231
  ),
232
- state: z.record(z.record(RichTextStateParamsSchema))
232
+ state: z.record(RichTextStateParamsSchema)
233
233
  });
234
234
  const pointerEvents = z.enum(["never", "when_visible", "always"]).optional();
235
235
  const FXControlSchema = z.discriminatedUnion("type", [
@@ -276,7 +276,7 @@ const ImageItemSchema = ItemBaseSchema.extend({
276
276
  isDraggable: z.boolean().optional()
277
277
  })
278
278
  ),
279
- state: z.record(z.record(MediaStateParamsSchema))
279
+ state: z.record(MediaStateParamsSchema)
280
280
  });
281
281
  const VideoItemSchema = ItemBaseSchema.extend({
282
282
  type: z.literal(ArticleItemType.Video),
@@ -305,7 +305,7 @@ const VideoItemSchema = ItemBaseSchema.extend({
305
305
  isDraggable: z.boolean().optional()
306
306
  })
307
307
  ),
308
- state: z.record(z.record(MediaStateParamsSchema))
308
+ state: z.record(MediaStateParamsSchema)
309
309
  });
310
310
  const RectangleItemSchema = ItemBaseSchema.extend({
311
311
  type: z.literal(ArticleItemType.Rectangle),
@@ -331,7 +331,7 @@ const RectangleItemSchema = ItemBaseSchema.extend({
331
331
  isDraggable: z.boolean().optional()
332
332
  })
333
333
  ),
334
- state: z.record(z.record(RectangleStateParamsSchema))
334
+ state: z.record(RectangleStateParamsSchema)
335
335
  });
336
336
  const CustomItemSchema = ItemBaseSchema.extend({
337
337
  type: z.literal(ArticleItemType.Custom),
@@ -348,7 +348,7 @@ const CustomItemSchema = ItemBaseSchema.extend({
348
348
  layoutParams: z.record(z.object({
349
349
  isDraggable: z.boolean().optional()
350
350
  })),
351
- state: z.record(z.record(CustomItemStateParamsSchema))
351
+ state: z.record(CustomItemStateParamsSchema)
352
352
  });
353
353
  const VimeoEmbedItemSchema = ItemBaseSchema.extend({
354
354
  type: z.literal(ArticleItemType.VimeoEmbed),
@@ -376,7 +376,7 @@ const VimeoEmbedItemSchema = ItemBaseSchema.extend({
376
376
  opacity: z.number().nonnegative()
377
377
  })
378
378
  ),
379
- state: z.record(z.record(EmbedStateParamsSchema))
379
+ state: z.record(EmbedStateParamsSchema)
380
380
  });
381
381
  const YoutubeEmbedItemSchema = ItemBaseSchema.extend({
382
382
  type: z.literal(ArticleItemType.YoutubeEmbed),
@@ -401,7 +401,7 @@ const YoutubeEmbedItemSchema = ItemBaseSchema.extend({
401
401
  opacity: z.number().nonnegative()
402
402
  })
403
403
  ),
404
- state: z.record(z.record(EmbedStateParamsSchema))
404
+ state: z.record(EmbedStateParamsSchema)
405
405
  });
406
406
  const CodeEmbedItemSchema = ItemBaseSchema.extend({
407
407
  type: z.literal(ArticleItemType.CodeEmbed),
@@ -425,7 +425,7 @@ const CodeEmbedItemSchema = ItemBaseSchema.extend({
425
425
  isDraggable: z.boolean().optional()
426
426
  })
427
427
  ),
428
- state: z.record(z.record(CodeEmbedStateParamsSchema))
428
+ state: z.record(CodeEmbedStateParamsSchema)
429
429
  });
430
430
  const ComponentItemSchema = ItemBaseSchema.extend({
431
431
  type: z.literal(ArticleItemType.Component),
@@ -474,7 +474,7 @@ const ItemSchema = z.lazy(() => z.discriminatedUnion("type", [
474
474
  blur: z.number()
475
475
  })
476
476
  ),
477
- state: z.record(z.record(GroupStateParamsSchema))
477
+ state: z.record(GroupStateParamsSchema)
478
478
  }),
479
479
  ItemBaseSchema.extend({
480
480
  type: z.literal(ArticleItemType.Compound),
@@ -494,7 +494,7 @@ const ItemSchema = z.lazy(() => z.discriminatedUnion("type", [
494
494
  opacity: z.number().nonnegative()
495
495
  })
496
496
  ),
497
- state: z.record(z.record(CompoundStateParamsSchema))
497
+ state: z.record(CompoundStateParamsSchema)
498
498
  })
499
499
  ]));
500
500
  const SectionHeightSchema = z.object({
@@ -540,7 +540,7 @@ const InteractionSchema = z.object({
540
540
  const ArticleSchema = z.object({
541
541
  id: z.string().min(1),
542
542
  sections: z.array(SectionSchema),
543
- interactions: z.array(InteractionSchema)
543
+ interactions: z.record(z.array(InteractionSchema))
544
544
  });
545
545
  const LayoutSchema = z.object({
546
546
  id: z.string(),
@@ -74,7 +74,7 @@ export declare const ArticleSchema: z.ZodObject<{
74
74
  offsetX: number | null;
75
75
  }> | undefined;
76
76
  }>, "many">;
77
- interactions: z.ZodArray<z.ZodObject<{
77
+ interactions: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodObject<{
78
78
  id: z.ZodString;
79
79
  triggers: z.ZodArray<z.ZodObject<{
80
80
  itemId: z.ZodString;
@@ -150,7 +150,7 @@ export declare const ArticleSchema: z.ZodObject<{
150
150
  }[] | undefined;
151
151
  }[];
152
152
  startStateId: string;
153
- }>, "many">;
153
+ }>, "many">>;
154
154
  }, "strip", z.ZodTypeAny, {
155
155
  id: string;
156
156
  sections: {
@@ -172,7 +172,7 @@ export declare const ArticleSchema: z.ZodObject<{
172
172
  offsetX: number | null;
173
173
  }> | undefined;
174
174
  }[];
175
- interactions: {
175
+ interactions: Record<string, {
176
176
  id: string;
177
177
  triggers: {
178
178
  type: "hover-in" | "hover-out" | "click";
@@ -188,7 +188,7 @@ export declare const ArticleSchema: z.ZodObject<{
188
188
  }[] | undefined;
189
189
  }[];
190
190
  startStateId: string;
191
- }[];
191
+ }[]>;
192
192
  }, {
193
193
  id: string;
194
194
  sections: {
@@ -210,7 +210,7 @@ export declare const ArticleSchema: z.ZodObject<{
210
210
  offsetX: number | null;
211
211
  }> | undefined;
212
212
  }[];
213
- interactions: {
213
+ interactions: Record<string, {
214
214
  id: string;
215
215
  triggers: {
216
216
  type: "hover-in" | "hover-out" | "click";
@@ -226,5 +226,5 @@ export declare const ArticleSchema: z.ZodObject<{
226
226
  }[] | undefined;
227
227
  }[];
228
228
  startStateId: string;
229
- }[];
229
+ }[]>;
230
230
  }>;
@@ -7,5 +7,5 @@ const Interaction_schema_1 = require("./Interaction.schema");
7
7
  exports.ArticleSchema = zod_1.z.object({
8
8
  id: zod_1.z.string().min(1),
9
9
  sections: zod_1.z.array(Section_schema_1.SectionSchema),
10
- interactions: zod_1.z.array(Interaction_schema_1.InteractionSchema)
10
+ interactions: zod_1.z.record(zod_1.z.array(Interaction_schema_1.InteractionSchema))
11
11
  });
@@ -48,7 +48,7 @@ const ImageItemSchema = ItemBase_schema_1.ItemBaseSchema.extend({
48
48
  blur: zod_1.z.number(),
49
49
  isDraggable: zod_1.z.boolean().optional()
50
50
  })),
51
- state: zod_1.z.record(zod_1.z.record(ItemState_schema_1.MediaStateParamsSchema))
51
+ state: zod_1.z.record(ItemState_schema_1.MediaStateParamsSchema)
52
52
  });
53
53
  const VideoItemSchema = ItemBase_schema_1.ItemBaseSchema.extend({
54
54
  type: zod_1.z.literal(ArticleItemType_1.ArticleItemType.Video),
@@ -73,7 +73,7 @@ const VideoItemSchema = ItemBase_schema_1.ItemBaseSchema.extend({
73
73
  blur: zod_1.z.number(),
74
74
  isDraggable: zod_1.z.boolean().optional()
75
75
  })),
76
- state: zod_1.z.record(zod_1.z.record(ItemState_schema_1.MediaStateParamsSchema))
76
+ state: zod_1.z.record(ItemState_schema_1.MediaStateParamsSchema)
77
77
  });
78
78
  const RectangleItemSchema = ItemBase_schema_1.ItemBaseSchema.extend({
79
79
  type: zod_1.z.literal(ArticleItemType_1.ArticleItemType.Rectangle),
@@ -95,7 +95,7 @@ const RectangleItemSchema = ItemBase_schema_1.ItemBaseSchema.extend({
95
95
  blurMode: zod_1.z.enum(['default', 'backdrop']),
96
96
  isDraggable: zod_1.z.boolean().optional()
97
97
  })),
98
- state: zod_1.z.record(zod_1.z.record(ItemState_schema_1.RectangleStateParamsSchema))
98
+ state: zod_1.z.record(ItemState_schema_1.RectangleStateParamsSchema)
99
99
  });
100
100
  const CustomItemSchema = ItemBase_schema_1.ItemBaseSchema.extend({
101
101
  type: zod_1.z.literal(ArticleItemType_1.ArticleItemType.Custom),
@@ -110,7 +110,7 @@ const CustomItemSchema = ItemBase_schema_1.ItemBaseSchema.extend({
110
110
  layoutParams: zod_1.z.record(zod_1.z.object({
111
111
  isDraggable: zod_1.z.boolean().optional()
112
112
  })),
113
- state: zod_1.z.record(zod_1.z.record(ItemState_schema_1.CustomItemStateParamsSchema))
113
+ state: zod_1.z.record(ItemState_schema_1.CustomItemStateParamsSchema)
114
114
  });
115
115
  const VimeoEmbedItemSchema = ItemBase_schema_1.ItemBaseSchema.extend({
116
116
  type: zod_1.z.literal(ArticleItemType_1.ArticleItemType.VimeoEmbed),
@@ -134,7 +134,7 @@ const VimeoEmbedItemSchema = ItemBase_schema_1.ItemBaseSchema.extend({
134
134
  blur: zod_1.z.number(),
135
135
  opacity: zod_1.z.number().nonnegative()
136
136
  })),
137
- state: zod_1.z.record(zod_1.z.record(ItemState_schema_1.EmbedStateParamsSchema))
137
+ state: zod_1.z.record(ItemState_schema_1.EmbedStateParamsSchema)
138
138
  });
139
139
  const YoutubeEmbedItemSchema = ItemBase_schema_1.ItemBaseSchema.extend({
140
140
  type: zod_1.z.literal(ArticleItemType_1.ArticleItemType.YoutubeEmbed),
@@ -155,7 +155,7 @@ const YoutubeEmbedItemSchema = ItemBase_schema_1.ItemBaseSchema.extend({
155
155
  blur: zod_1.z.number(),
156
156
  opacity: zod_1.z.number().nonnegative()
157
157
  })),
158
- state: zod_1.z.record(zod_1.z.record(ItemState_schema_1.EmbedStateParamsSchema))
158
+ state: zod_1.z.record(ItemState_schema_1.EmbedStateParamsSchema)
159
159
  });
160
160
  const CodeEmbedItemSchema = ItemBase_schema_1.ItemBaseSchema.extend({
161
161
  type: zod_1.z.literal(ArticleItemType_1.ArticleItemType.CodeEmbed),
@@ -175,7 +175,7 @@ const CodeEmbedItemSchema = ItemBase_schema_1.ItemBaseSchema.extend({
175
175
  blur: zod_1.z.number(),
176
176
  isDraggable: zod_1.z.boolean().optional()
177
177
  })),
178
- state: zod_1.z.record(zod_1.z.record(ItemState_schema_1.CodeEmbedStateParamsSchema))
178
+ state: zod_1.z.record(ItemState_schema_1.CodeEmbedStateParamsSchema)
179
179
  });
180
180
  const ComponentItemSchema = ItemBase_schema_1.ItemBaseSchema.extend({
181
181
  type: zod_1.z.literal(ArticleItemType_1.ArticleItemType.Component),
@@ -218,7 +218,7 @@ exports.ItemSchema = zod_1.z.lazy(() => zod_1.z.discriminatedUnion('type', [
218
218
  opacity: zod_1.z.number().nonnegative(),
219
219
  blur: zod_1.z.number()
220
220
  })),
221
- state: zod_1.z.record(zod_1.z.record(ItemState_schema_1.GroupStateParamsSchema))
221
+ state: zod_1.z.record(ItemState_schema_1.GroupStateParamsSchema)
222
222
  }),
223
223
  ItemBase_schema_1.ItemBaseSchema.extend({
224
224
  type: zod_1.z.literal(ArticleItemType_1.ArticleItemType.Compound),
@@ -234,6 +234,6 @@ exports.ItemSchema = zod_1.z.lazy(() => zod_1.z.discriminatedUnion('type', [
234
234
  layoutParams: zod_1.z.record(zod_1.z.object({
235
235
  opacity: zod_1.z.number().nonnegative()
236
236
  })),
237
- state: zod_1.z.record(zod_1.z.record(ItemState_schema_1.CompoundStateParamsSchema))
237
+ state: zod_1.z.record(ItemState_schema_1.CompoundStateParamsSchema)
238
238
  })
239
239
  ]));
@@ -195,7 +195,7 @@ export declare const RichTextItemSchema: z.ZodObject<{
195
195
  }[] | undefined;
196
196
  isDraggable?: boolean | undefined;
197
197
  }>>;
198
- state: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodObject<{
198
+ state: z.ZodRecord<z.ZodString, z.ZodObject<{
199
199
  color: z.ZodOptional<z.ZodObject<{
200
200
  value: z.ZodString;
201
201
  in: z.ZodObject<{
@@ -988,7 +988,7 @@ export declare const RichTextItemSchema: z.ZodObject<{
988
988
  delay: number;
989
989
  };
990
990
  } | undefined;
991
- }>>>;
991
+ }>>;
992
992
  }, "strip", z.ZodTypeAny, {
993
993
  hidden: Record<string, boolean>;
994
994
  type: ArticleItemType.RichText;
@@ -1037,7 +1037,7 @@ export declare const RichTextItemSchema: z.ZodObject<{
1037
1037
  from: number;
1038
1038
  to?: number | undefined;
1039
1039
  } | null>;
1040
- state: Record<string, Record<string, {
1040
+ state: Record<string, {
1041
1041
  color?: {
1042
1042
  value: string;
1043
1043
  in: {
@@ -1168,7 +1168,7 @@ export declare const RichTextItemSchema: z.ZodObject<{
1168
1168
  delay: number;
1169
1169
  };
1170
1170
  } | undefined;
1171
- }>>;
1171
+ }>;
1172
1172
  link?: {
1173
1173
  url: string;
1174
1174
  target: string;
@@ -1226,7 +1226,7 @@ export declare const RichTextItemSchema: z.ZodObject<{
1226
1226
  from: number;
1227
1227
  to?: number | undefined;
1228
1228
  } | null>;
1229
- state: Record<string, Record<string, {
1229
+ state: Record<string, {
1230
1230
  color?: {
1231
1231
  value: string;
1232
1232
  in: {
@@ -1357,7 +1357,7 @@ export declare const RichTextItemSchema: z.ZodObject<{
1357
1357
  delay: number;
1358
1358
  };
1359
1359
  } | undefined;
1360
- }>>;
1360
+ }>;
1361
1361
  link?: {
1362
1362
  url: string;
1363
1363
  target: string;
@@ -56,5 +56,5 @@ exports.RichTextItemSchema = ItemBase_schema_1.ItemBaseSchema.extend({
56
56
  fontVariant: zod_1.z.string(),
57
57
  isDraggable: zod_1.z.boolean().optional()
58
58
  })),
59
- state: zod_1.z.record(zod_1.z.record(ItemState_schema_1.RichTextStateParamsSchema))
59
+ state: zod_1.z.record(ItemState_schema_1.RichTextStateParamsSchema)
60
60
  });
@@ -3,5 +3,5 @@ import { Interaction } from './Interaction';
3
3
  export interface Article {
4
4
  id: string;
5
5
  sections: Section[];
6
- interactions: Interaction[];
6
+ interactions: Record<string, Interaction[]>;
7
7
  }
@@ -1,7 +1,6 @@
1
1
  import { ArticleItemType } from './ArticleItemType';
2
- type LayoutId = string;
3
2
  type StateId = string;
4
- export type ItemState<T extends ArticleItemType> = Record<LayoutId, Record<StateId, ItemStatesMap[T]>>;
3
+ export type ItemState<T extends ArticleItemType> = Record<StateId, ItemStatesMap[T]>;
5
4
  export type ItemStateParams = ItemStatesMap[ArticleItemType];
6
5
  export interface ItemStatesMap {
7
6
  [ArticleItemType.Image]: MediaStateParams;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cntrl-site/sdk",
3
- "version": "1.21.1",
3
+ "version": "1.22.0",
4
4
  "description": "Generic SDK for use in public websites.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",