@cntrl-site/sdk 1.24.5 → 1.24.7-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.
@@ -328,9 +328,6 @@ export declare const ControlSliderComponent: {
328
328
  content: {
329
329
  layoutBased: boolean;
330
330
  type: string;
331
- settings: {
332
- addItemFromFileExplorer: boolean;
333
- };
334
331
  items: {
335
332
  type: string;
336
333
  properties: {
@@ -338,9 +335,6 @@ export declare const ControlSliderComponent: {
338
335
  type: string;
339
336
  display: {
340
337
  type: string;
341
- minWidth: number;
342
- defaultWidth: number;
343
- maxWidth: number;
344
338
  };
345
339
  properties: {
346
340
  url: {
@@ -360,9 +354,18 @@ export declare const ControlSliderComponent: {
360
354
  display: {
361
355
  type: string;
362
356
  placeholder: string;
363
- minWidth: number;
364
- defaultWidth: number;
365
- maxWidth: number;
357
+ };
358
+ };
359
+ link: {
360
+ type: string;
361
+ display: {
362
+ type: string;
363
+ placeholder: string;
364
+ };
365
+ properties: {
366
+ text: {
367
+ type: string;
368
+ };
366
369
  };
367
370
  };
368
371
  };
@@ -162,9 +162,6 @@ export declare const ControlImageRevealSliderComponent: {
162
162
  content: {
163
163
  layoutBased: boolean;
164
164
  type: string;
165
- settings: {
166
- addItemFromFileExplorer: boolean;
167
- };
168
165
  items: {
169
166
  type: string;
170
167
  properties: {
@@ -173,9 +170,6 @@ export declare const ControlImageRevealSliderComponent: {
173
170
  display: {
174
171
  type: string;
175
172
  isObjectFitEditable: boolean;
176
- minWidth: number;
177
- defaultWidth: number;
178
- maxWidth: number;
179
173
  };
180
174
  properties: {
181
175
  url: {
@@ -196,9 +190,6 @@ export declare const ControlImageRevealSliderComponent: {
196
190
  display: {
197
191
  type: string;
198
192
  placeholder: string;
199
- minWidth: number;
200
- defaultWidth: number;
201
- maxWidth: number;
202
193
  };
203
194
  };
204
195
  };
package/dist/index.js CHANGED
@@ -601,16 +601,28 @@ const SectionSchema = zod.z.object({
601
601
  });
602
602
  const ItemTriggerSchema = zod.z.object({
603
603
  itemId: zod.z.string(),
604
- type: zod.z.enum(["hover-in", "hover-out", "click"]),
604
+ type: zod.z.literal("item"),
605
+ triggerEvent: zod.z.enum(["hover-in", "hover-out", "click"]),
605
606
  from: zod.z.string(),
606
607
  to: zod.z.string()
607
608
  });
608
609
  const ScrollTriggerSchema = zod.z.object({
610
+ type: zod.z.literal("scroll-position"),
609
611
  position: zod.z.number(),
610
612
  from: zod.z.string(),
611
613
  to: zod.z.string(),
612
614
  isReverse: zod.z.boolean()
613
615
  });
616
+ const ItemScrollTriggerSchema = zod.z.object({
617
+ itemId: zod.z.string(),
618
+ type: zod.z.literal("item-scroll-position"),
619
+ itemPosition: zod.z.enum(["bottom", "center", "top"]),
620
+ screenPosition: zod.z.enum(["bottom", "center", "top"]),
621
+ offset: zod.z.number(),
622
+ from: zod.z.string(),
623
+ to: zod.z.string(),
624
+ isReverse: zod.z.boolean()
625
+ });
614
626
  const VideoInteractionActionSchema = zod.z.object({
615
627
  type: zod.z.enum(["play", "pause"]),
616
628
  itemId: zod.z.string()
@@ -621,7 +633,7 @@ const StateSchema = zod.z.object({
621
633
  });
622
634
  const InteractionSchema = zod.z.object({
623
635
  id: zod.z.string(),
624
- triggers: zod.z.array(zod.z.union([ItemTriggerSchema, ScrollTriggerSchema])),
636
+ triggers: zod.z.array(zod.z.union([ItemTriggerSchema, ScrollTriggerSchema, ItemScrollTriggerSchema])),
625
637
  states: zod.z.array(StateSchema),
626
638
  startStateId: zod.z.string()
627
639
  });
@@ -1386,7 +1398,6 @@ const RichTextRenderer = ({ content }) => {
1386
1398
  };
1387
1399
  function getLeafCss(leaf) {
1388
1400
  return {
1389
- ...leaf.fontFamily && { fontFamily: leaf.fontFamily },
1390
1401
  ...leaf.fontWeight && { fontWeight: leaf.fontWeight },
1391
1402
  ...leaf.fontStyle && { fontStyle: leaf.fontStyle },
1392
1403
  ...leaf.textDecoration && { textDecoration: leaf.textDecoration },
@@ -2058,19 +2069,13 @@ const ControlSliderComponent = {
2058
2069
  content: {
2059
2070
  layoutBased: false,
2060
2071
  type: "array",
2061
- settings: {
2062
- addItemFromFileExplorer: true
2063
- },
2064
2072
  items: {
2065
2073
  type: "object",
2066
2074
  properties: {
2067
2075
  image: {
2068
2076
  type: "object",
2069
2077
  display: {
2070
- type: "media-input",
2071
- minWidth: 48,
2072
- defaultWidth: 108,
2073
- maxWidth: 108
2078
+ type: "media-input"
2074
2079
  },
2075
2080
  properties: {
2076
2081
  url: {
@@ -2089,10 +2094,19 @@ const ControlSliderComponent = {
2089
2094
  imageCaption: {
2090
2095
  display: {
2091
2096
  type: "rich-text",
2092
- placeholder: "Add Caption...",
2093
- minWidth: 100,
2094
- defaultWidth: 300,
2095
- maxWidth: 500
2097
+ placeholder: "Add Caption..."
2098
+ }
2099
+ },
2100
+ link: {
2101
+ type: "object",
2102
+ display: {
2103
+ type: "text-input",
2104
+ placeholder: "Add Caption..."
2105
+ },
2106
+ properties: {
2107
+ text: {
2108
+ type: "string"
2109
+ }
2096
2110
  }
2097
2111
  }
2098
2112
  },
@@ -2634,9 +2648,6 @@ const ControlImageRevealSliderComponent = {
2634
2648
  content: {
2635
2649
  layoutBased: false,
2636
2650
  type: "array",
2637
- settings: {
2638
- addItemFromFileExplorer: true
2639
- },
2640
2651
  items: {
2641
2652
  type: "object",
2642
2653
  properties: {
@@ -2644,10 +2655,7 @@ const ControlImageRevealSliderComponent = {
2644
2655
  type: "object",
2645
2656
  display: {
2646
2657
  type: "media-input",
2647
- isObjectFitEditable: false,
2648
- minWidth: 48,
2649
- defaultWidth: 108,
2650
- maxWidth: 108
2658
+ isObjectFitEditable: false
2651
2659
  },
2652
2660
  properties: {
2653
2661
  url: {
@@ -2667,10 +2675,7 @@ const ControlImageRevealSliderComponent = {
2667
2675
  type: "string",
2668
2676
  display: {
2669
2677
  type: "text-input",
2670
- placeholder: "Enter link...",
2671
- minWidth: 100,
2672
- defaultWidth: 300,
2673
- maxWidth: 500
2678
+ placeholder: "Enter link..."
2674
2679
  }
2675
2680
  }
2676
2681
  },
package/dist/index.mjs CHANGED
@@ -582,16 +582,28 @@ const SectionSchema = z.object({
582
582
  });
583
583
  const ItemTriggerSchema = z.object({
584
584
  itemId: z.string(),
585
- type: z.enum(["hover-in", "hover-out", "click"]),
585
+ type: z.literal("item"),
586
+ triggerEvent: z.enum(["hover-in", "hover-out", "click"]),
586
587
  from: z.string(),
587
588
  to: z.string()
588
589
  });
589
590
  const ScrollTriggerSchema = z.object({
591
+ type: z.literal("scroll-position"),
590
592
  position: z.number(),
591
593
  from: z.string(),
592
594
  to: z.string(),
593
595
  isReverse: z.boolean()
594
596
  });
597
+ const ItemScrollTriggerSchema = z.object({
598
+ itemId: z.string(),
599
+ type: z.literal("item-scroll-position"),
600
+ itemPosition: z.enum(["bottom", "center", "top"]),
601
+ screenPosition: z.enum(["bottom", "center", "top"]),
602
+ offset: z.number(),
603
+ from: z.string(),
604
+ to: z.string(),
605
+ isReverse: z.boolean()
606
+ });
595
607
  const VideoInteractionActionSchema = z.object({
596
608
  type: z.enum(["play", "pause"]),
597
609
  itemId: z.string()
@@ -602,7 +614,7 @@ const StateSchema = z.object({
602
614
  });
603
615
  const InteractionSchema = z.object({
604
616
  id: z.string(),
605
- triggers: z.array(z.union([ItemTriggerSchema, ScrollTriggerSchema])),
617
+ triggers: z.array(z.union([ItemTriggerSchema, ScrollTriggerSchema, ItemScrollTriggerSchema])),
606
618
  states: z.array(StateSchema),
607
619
  startStateId: z.string()
608
620
  });
@@ -1367,7 +1379,6 @@ const RichTextRenderer = ({ content }) => {
1367
1379
  };
1368
1380
  function getLeafCss(leaf) {
1369
1381
  return {
1370
- ...leaf.fontFamily && { fontFamily: leaf.fontFamily },
1371
1382
  ...leaf.fontWeight && { fontWeight: leaf.fontWeight },
1372
1383
  ...leaf.fontStyle && { fontStyle: leaf.fontStyle },
1373
1384
  ...leaf.textDecoration && { textDecoration: leaf.textDecoration },
@@ -2039,19 +2050,13 @@ const ControlSliderComponent = {
2039
2050
  content: {
2040
2051
  layoutBased: false,
2041
2052
  type: "array",
2042
- settings: {
2043
- addItemFromFileExplorer: true
2044
- },
2045
2053
  items: {
2046
2054
  type: "object",
2047
2055
  properties: {
2048
2056
  image: {
2049
2057
  type: "object",
2050
2058
  display: {
2051
- type: "media-input",
2052
- minWidth: 48,
2053
- defaultWidth: 108,
2054
- maxWidth: 108
2059
+ type: "media-input"
2055
2060
  },
2056
2061
  properties: {
2057
2062
  url: {
@@ -2070,10 +2075,19 @@ const ControlSliderComponent = {
2070
2075
  imageCaption: {
2071
2076
  display: {
2072
2077
  type: "rich-text",
2073
- placeholder: "Add Caption...",
2074
- minWidth: 100,
2075
- defaultWidth: 300,
2076
- maxWidth: 500
2078
+ placeholder: "Add Caption..."
2079
+ }
2080
+ },
2081
+ link: {
2082
+ type: "object",
2083
+ display: {
2084
+ type: "text-input",
2085
+ placeholder: "Add Caption..."
2086
+ },
2087
+ properties: {
2088
+ text: {
2089
+ type: "string"
2090
+ }
2077
2091
  }
2078
2092
  }
2079
2093
  },
@@ -2615,9 +2629,6 @@ const ControlImageRevealSliderComponent = {
2615
2629
  content: {
2616
2630
  layoutBased: false,
2617
2631
  type: "array",
2618
- settings: {
2619
- addItemFromFileExplorer: true
2620
- },
2621
2632
  items: {
2622
2633
  type: "object",
2623
2634
  properties: {
@@ -2625,10 +2636,7 @@ const ControlImageRevealSliderComponent = {
2625
2636
  type: "object",
2626
2637
  display: {
2627
2638
  type: "media-input",
2628
- isObjectFitEditable: false,
2629
- minWidth: 48,
2630
- defaultWidth: 108,
2631
- maxWidth: 108
2639
+ isObjectFitEditable: false
2632
2640
  },
2633
2641
  properties: {
2634
2642
  url: {
@@ -2648,10 +2656,7 @@ const ControlImageRevealSliderComponent = {
2648
2656
  type: "string",
2649
2657
  display: {
2650
2658
  type: "text-input",
2651
- placeholder: "Enter link...",
2652
- minWidth: 100,
2653
- defaultWidth: 300,
2654
- maxWidth: 500
2659
+ placeholder: "Enter link..."
2655
2660
  }
2656
2661
  }
2657
2662
  },
@@ -123,34 +123,67 @@ export declare const ArticleSchema: z.ZodObject<{
123
123
  id: z.ZodString;
124
124
  triggers: z.ZodArray<z.ZodUnion<[z.ZodObject<{
125
125
  itemId: z.ZodString;
126
- type: z.ZodEnum<["hover-in", "hover-out", "click"]>;
126
+ type: z.ZodLiteral<"item">;
127
+ triggerEvent: z.ZodEnum<["hover-in", "hover-out", "click"]>;
127
128
  from: z.ZodString;
128
129
  to: z.ZodString;
129
130
  }, "strip", z.ZodTypeAny, {
130
- type: "hover-in" | "hover-out" | "click";
131
+ type: "item";
131
132
  from: string;
132
133
  to: string;
133
134
  itemId: string;
135
+ triggerEvent: "hover-in" | "hover-out" | "click";
134
136
  }, {
135
- type: "hover-in" | "hover-out" | "click";
137
+ type: "item";
136
138
  from: string;
137
139
  to: string;
138
140
  itemId: string;
141
+ triggerEvent: "hover-in" | "hover-out" | "click";
139
142
  }>, z.ZodObject<{
143
+ type: z.ZodLiteral<"scroll-position">;
140
144
  position: z.ZodNumber;
141
145
  from: z.ZodString;
142
146
  to: z.ZodString;
143
147
  isReverse: z.ZodBoolean;
144
148
  }, "strip", z.ZodTypeAny, {
145
149
  position: number;
150
+ type: "scroll-position";
146
151
  from: string;
147
152
  to: string;
148
153
  isReverse: boolean;
149
154
  }, {
150
155
  position: number;
156
+ type: "scroll-position";
151
157
  from: string;
152
158
  to: string;
153
159
  isReverse: boolean;
160
+ }>, z.ZodObject<{
161
+ itemId: z.ZodString;
162
+ type: z.ZodLiteral<"item-scroll-position">;
163
+ itemPosition: z.ZodEnum<["bottom", "center", "top"]>;
164
+ screenPosition: z.ZodEnum<["bottom", "center", "top"]>;
165
+ offset: z.ZodNumber;
166
+ from: z.ZodString;
167
+ to: z.ZodString;
168
+ isReverse: z.ZodBoolean;
169
+ }, "strip", z.ZodTypeAny, {
170
+ type: "item-scroll-position";
171
+ from: string;
172
+ to: string;
173
+ itemId: string;
174
+ isReverse: boolean;
175
+ itemPosition: "center" | "top" | "bottom";
176
+ screenPosition: "center" | "top" | "bottom";
177
+ offset: number;
178
+ }, {
179
+ type: "item-scroll-position";
180
+ from: string;
181
+ to: string;
182
+ itemId: string;
183
+ isReverse: boolean;
184
+ itemPosition: "center" | "top" | "bottom";
185
+ screenPosition: "center" | "top" | "bottom";
186
+ offset: number;
154
187
  }>]>, "many">;
155
188
  states: z.ZodArray<z.ZodObject<{
156
189
  id: z.ZodString;
@@ -181,15 +214,26 @@ export declare const ArticleSchema: z.ZodObject<{
181
214
  }, "strip", z.ZodTypeAny, {
182
215
  id: string;
183
216
  triggers: ({
184
- type: "hover-in" | "hover-out" | "click";
217
+ type: "item";
185
218
  from: string;
186
219
  to: string;
187
220
  itemId: string;
221
+ triggerEvent: "hover-in" | "hover-out" | "click";
188
222
  } | {
189
223
  position: number;
224
+ type: "scroll-position";
190
225
  from: string;
191
226
  to: string;
192
227
  isReverse: boolean;
228
+ } | {
229
+ type: "item-scroll-position";
230
+ from: string;
231
+ to: string;
232
+ itemId: string;
233
+ isReverse: boolean;
234
+ itemPosition: "center" | "top" | "bottom";
235
+ screenPosition: "center" | "top" | "bottom";
236
+ offset: number;
193
237
  })[];
194
238
  states: {
195
239
  id: string;
@@ -202,15 +246,26 @@ export declare const ArticleSchema: z.ZodObject<{
202
246
  }, {
203
247
  id: string;
204
248
  triggers: ({
205
- type: "hover-in" | "hover-out" | "click";
249
+ type: "item";
206
250
  from: string;
207
251
  to: string;
208
252
  itemId: string;
253
+ triggerEvent: "hover-in" | "hover-out" | "click";
209
254
  } | {
210
255
  position: number;
256
+ type: "scroll-position";
211
257
  from: string;
212
258
  to: string;
213
259
  isReverse: boolean;
260
+ } | {
261
+ type: "item-scroll-position";
262
+ from: string;
263
+ to: string;
264
+ itemId: string;
265
+ isReverse: boolean;
266
+ itemPosition: "center" | "top" | "bottom";
267
+ screenPosition: "center" | "top" | "bottom";
268
+ offset: number;
214
269
  })[];
215
270
  states: {
216
271
  id: string;
@@ -254,15 +309,26 @@ export declare const ArticleSchema: z.ZodObject<{
254
309
  interactions: Record<string, {
255
310
  id: string;
256
311
  triggers: ({
257
- type: "hover-in" | "hover-out" | "click";
312
+ type: "item";
258
313
  from: string;
259
314
  to: string;
260
315
  itemId: string;
316
+ triggerEvent: "hover-in" | "hover-out" | "click";
261
317
  } | {
262
318
  position: number;
319
+ type: "scroll-position";
263
320
  from: string;
264
321
  to: string;
265
322
  isReverse: boolean;
323
+ } | {
324
+ type: "item-scroll-position";
325
+ from: string;
326
+ to: string;
327
+ itemId: string;
328
+ isReverse: boolean;
329
+ itemPosition: "center" | "top" | "bottom";
330
+ screenPosition: "center" | "top" | "bottom";
331
+ offset: number;
266
332
  })[];
267
333
  states: {
268
334
  id: string;
@@ -306,15 +372,26 @@ export declare const ArticleSchema: z.ZodObject<{
306
372
  interactions: Record<string, {
307
373
  id: string;
308
374
  triggers: ({
309
- type: "hover-in" | "hover-out" | "click";
375
+ type: "item";
310
376
  from: string;
311
377
  to: string;
312
378
  itemId: string;
379
+ triggerEvent: "hover-in" | "hover-out" | "click";
313
380
  } | {
314
381
  position: number;
382
+ type: "scroll-position";
383
+ from: string;
384
+ to: string;
385
+ isReverse: boolean;
386
+ } | {
387
+ type: "item-scroll-position";
315
388
  from: string;
316
389
  to: string;
390
+ itemId: string;
317
391
  isReverse: boolean;
392
+ itemPosition: "center" | "top" | "bottom";
393
+ screenPosition: "center" | "top" | "bottom";
394
+ offset: number;
318
395
  })[];
319
396
  states: {
320
397
  id: string;
@@ -3,34 +3,67 @@ export declare const InteractionSchema: z.ZodObject<{
3
3
  id: z.ZodString;
4
4
  triggers: z.ZodArray<z.ZodUnion<[z.ZodObject<{
5
5
  itemId: z.ZodString;
6
- type: z.ZodEnum<["hover-in", "hover-out", "click"]>;
6
+ type: z.ZodLiteral<"item">;
7
+ triggerEvent: z.ZodEnum<["hover-in", "hover-out", "click"]>;
7
8
  from: z.ZodString;
8
9
  to: z.ZodString;
9
10
  }, "strip", z.ZodTypeAny, {
10
- type: "hover-in" | "hover-out" | "click";
11
+ type: "item";
11
12
  from: string;
12
13
  to: string;
13
14
  itemId: string;
15
+ triggerEvent: "hover-in" | "hover-out" | "click";
14
16
  }, {
15
- type: "hover-in" | "hover-out" | "click";
17
+ type: "item";
16
18
  from: string;
17
19
  to: string;
18
20
  itemId: string;
21
+ triggerEvent: "hover-in" | "hover-out" | "click";
19
22
  }>, z.ZodObject<{
23
+ type: z.ZodLiteral<"scroll-position">;
20
24
  position: z.ZodNumber;
21
25
  from: z.ZodString;
22
26
  to: z.ZodString;
23
27
  isReverse: z.ZodBoolean;
24
28
  }, "strip", z.ZodTypeAny, {
25
29
  position: number;
30
+ type: "scroll-position";
26
31
  from: string;
27
32
  to: string;
28
33
  isReverse: boolean;
29
34
  }, {
30
35
  position: number;
36
+ type: "scroll-position";
31
37
  from: string;
32
38
  to: string;
33
39
  isReverse: boolean;
40
+ }>, z.ZodObject<{
41
+ itemId: z.ZodString;
42
+ type: z.ZodLiteral<"item-scroll-position">;
43
+ itemPosition: z.ZodEnum<["bottom", "center", "top"]>;
44
+ screenPosition: z.ZodEnum<["bottom", "center", "top"]>;
45
+ offset: z.ZodNumber;
46
+ from: z.ZodString;
47
+ to: z.ZodString;
48
+ isReverse: z.ZodBoolean;
49
+ }, "strip", z.ZodTypeAny, {
50
+ type: "item-scroll-position";
51
+ from: string;
52
+ to: string;
53
+ itemId: string;
54
+ isReverse: boolean;
55
+ itemPosition: "center" | "top" | "bottom";
56
+ screenPosition: "center" | "top" | "bottom";
57
+ offset: number;
58
+ }, {
59
+ type: "item-scroll-position";
60
+ from: string;
61
+ to: string;
62
+ itemId: string;
63
+ isReverse: boolean;
64
+ itemPosition: "center" | "top" | "bottom";
65
+ screenPosition: "center" | "top" | "bottom";
66
+ offset: number;
34
67
  }>]>, "many">;
35
68
  states: z.ZodArray<z.ZodObject<{
36
69
  id: z.ZodString;
@@ -61,15 +94,26 @@ export declare const InteractionSchema: z.ZodObject<{
61
94
  }, "strip", z.ZodTypeAny, {
62
95
  id: string;
63
96
  triggers: ({
64
- type: "hover-in" | "hover-out" | "click";
97
+ type: "item";
65
98
  from: string;
66
99
  to: string;
67
100
  itemId: string;
101
+ triggerEvent: "hover-in" | "hover-out" | "click";
68
102
  } | {
69
103
  position: number;
104
+ type: "scroll-position";
105
+ from: string;
106
+ to: string;
107
+ isReverse: boolean;
108
+ } | {
109
+ type: "item-scroll-position";
70
110
  from: string;
71
111
  to: string;
112
+ itemId: string;
72
113
  isReverse: boolean;
114
+ itemPosition: "center" | "top" | "bottom";
115
+ screenPosition: "center" | "top" | "bottom";
116
+ offset: number;
73
117
  })[];
74
118
  states: {
75
119
  id: string;
@@ -82,15 +126,26 @@ export declare const InteractionSchema: z.ZodObject<{
82
126
  }, {
83
127
  id: string;
84
128
  triggers: ({
85
- type: "hover-in" | "hover-out" | "click";
129
+ type: "item";
86
130
  from: string;
87
131
  to: string;
88
132
  itemId: string;
133
+ triggerEvent: "hover-in" | "hover-out" | "click";
89
134
  } | {
90
135
  position: number;
136
+ type: "scroll-position";
137
+ from: string;
138
+ to: string;
139
+ isReverse: boolean;
140
+ } | {
141
+ type: "item-scroll-position";
91
142
  from: string;
92
143
  to: string;
144
+ itemId: string;
93
145
  isReverse: boolean;
146
+ itemPosition: "center" | "top" | "bottom";
147
+ screenPosition: "center" | "top" | "bottom";
148
+ offset: number;
94
149
  })[];
95
150
  states: {
96
151
  id: string;
@@ -4,16 +4,28 @@ exports.InteractionSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const ItemTriggerSchema = zod_1.z.object({
6
6
  itemId: zod_1.z.string(),
7
- type: zod_1.z.enum(['hover-in', 'hover-out', 'click']),
7
+ type: zod_1.z.literal('item'),
8
+ triggerEvent: zod_1.z.enum(['hover-in', 'hover-out', 'click']),
8
9
  from: zod_1.z.string(),
9
10
  to: zod_1.z.string()
10
11
  });
11
12
  const ScrollTriggerSchema = zod_1.z.object({
13
+ type: zod_1.z.literal('scroll-position'),
12
14
  position: zod_1.z.number(),
13
15
  from: zod_1.z.string(),
14
16
  to: zod_1.z.string(),
15
17
  isReverse: zod_1.z.boolean()
16
18
  });
19
+ const ItemScrollTriggerSchema = zod_1.z.object({
20
+ itemId: zod_1.z.string(),
21
+ type: zod_1.z.literal('item-scroll-position'),
22
+ itemPosition: zod_1.z.enum(['bottom', 'center', 'top']),
23
+ screenPosition: zod_1.z.enum(['bottom', 'center', 'top']),
24
+ offset: zod_1.z.number(),
25
+ from: zod_1.z.string(),
26
+ to: zod_1.z.string(),
27
+ isReverse: zod_1.z.boolean()
28
+ });
17
29
  const VideoInteractionActionSchema = zod_1.z.object({
18
30
  type: zod_1.z.enum(['play', 'pause']),
19
31
  itemId: zod_1.z.string()
@@ -24,7 +36,7 @@ const StateSchema = zod_1.z.object({
24
36
  });
25
37
  exports.InteractionSchema = zod_1.z.object({
26
38
  id: zod_1.z.string(),
27
- triggers: zod_1.z.array(zod_1.z.union([ItemTriggerSchema, ScrollTriggerSchema])),
39
+ triggers: zod_1.z.array(zod_1.z.union([ItemTriggerSchema, ScrollTriggerSchema, ItemScrollTriggerSchema])),
28
40
  states: zod_1.z.array(StateSchema),
29
41
  startStateId: zod_1.z.string(),
30
42
  });
@@ -1,21 +1,33 @@
1
1
  export interface Interaction {
2
2
  id: string;
3
- triggers: (InteractionItemTrigger | InteractionScrollTrigger)[];
3
+ triggers: InteractionTrigger[];
4
4
  states: InteractionState[];
5
5
  startStateId: string;
6
6
  }
7
7
  export interface InteractionItemTrigger {
8
8
  itemId: string;
9
- type: 'hover-in' | 'hover-out' | 'click';
9
+ type: 'item';
10
+ triggerEvent: 'hover-in' | 'hover-out' | 'click';
10
11
  from: StateId;
11
12
  to: StateId;
12
13
  }
13
14
  export interface InteractionScrollTrigger {
15
+ type: 'scroll-position';
14
16
  position: number;
15
17
  from: StateId;
16
18
  to: StateId;
17
19
  isReverse: boolean;
18
20
  }
21
+ export interface InteractionItemScrollTrigger {
22
+ itemId: string;
23
+ type: 'item-scroll-position';
24
+ itemPosition: 'bottom' | 'center' | 'top';
25
+ screenPosition: 'bottom' | 'center' | 'top';
26
+ offset: number;
27
+ from: StateId;
28
+ to: StateId;
29
+ isReverse: boolean;
30
+ }
19
31
  export type VideoInteractionAction = {
20
32
  type: 'play' | 'pause';
21
33
  itemId: string;
@@ -25,4 +37,5 @@ export interface InteractionState {
25
37
  actions?: VideoInteractionAction[];
26
38
  }
27
39
  type StateId = string;
40
+ export type InteractionTrigger = InteractionItemTrigger | InteractionScrollTrigger | InteractionItemScrollTrigger;
28
41
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cntrl-site/sdk",
3
- "version": "1.24.5",
3
+ "version": "1.24.7-0",
4
4
  "description": "Generic SDK for use in public websites.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",