@cntrl-site/sdk 1.22.21 → 1.23.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.d.ts +1 -1
- package/dist/index.js +8 -2
- package/dist/index.mjs +8 -2
- package/dist/schemas/article/Article.schema.d.ts +45 -10
- package/dist/schemas/article/Interaction.schema.d.ts +31 -6
- package/dist/schemas/article/Interaction.schema.js +8 -2
- package/dist/types/article/Interaction.d.ts +8 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export type { Item, ImageItem, ItemAny, CustomItem, ItemCommonParamsMap, ItemLay
|
|
|
13
13
|
export type { RichTextBlock, RichTextEntity, RichTextStyle } from './types/article/RichText';
|
|
14
14
|
export type { ItemArea } from './types/article/ItemArea';
|
|
15
15
|
export type { ItemState, ItemStateParams, StateParams, ItemStatesMap } from './types/article/ItemState';
|
|
16
|
-
export type { Interaction,
|
|
16
|
+
export type { Interaction, InteractionItemTrigger, InteractionScrollTrigger, InteractionState } from './types/article/Interaction';
|
|
17
17
|
export type { Layout } from './types/project/Layout';
|
|
18
18
|
export type { Project } from './types/project/Project';
|
|
19
19
|
export type { Meta } from './types/project/Meta';
|
package/dist/index.js
CHANGED
|
@@ -550,12 +550,18 @@ const SectionSchema = zod.z.object({
|
|
|
550
550
|
color: zod.z.record(zod.z.nullable(zod.z.string())),
|
|
551
551
|
media: zod.z.record(SectionMediaSchema).optional()
|
|
552
552
|
});
|
|
553
|
-
const
|
|
553
|
+
const ItemTriggerSchema = zod.z.object({
|
|
554
554
|
itemId: zod.z.string(),
|
|
555
555
|
type: zod.z.enum(["hover-in", "hover-out", "click"]),
|
|
556
556
|
from: zod.z.string(),
|
|
557
557
|
to: zod.z.string()
|
|
558
558
|
});
|
|
559
|
+
const ScrollTriggerSchema = zod.z.object({
|
|
560
|
+
position: zod.z.number(),
|
|
561
|
+
from: zod.z.string(),
|
|
562
|
+
to: zod.z.string(),
|
|
563
|
+
isReverse: zod.z.boolean()
|
|
564
|
+
});
|
|
559
565
|
const VideoInteractionActionSchema = zod.z.object({
|
|
560
566
|
type: zod.z.enum(["play", "pause"]),
|
|
561
567
|
itemId: zod.z.string()
|
|
@@ -566,7 +572,7 @@ const StateSchema = zod.z.object({
|
|
|
566
572
|
});
|
|
567
573
|
const InteractionSchema = zod.z.object({
|
|
568
574
|
id: zod.z.string(),
|
|
569
|
-
triggers: zod.z.array(
|
|
575
|
+
triggers: zod.z.array(zod.z.union([ItemTriggerSchema, ScrollTriggerSchema])),
|
|
570
576
|
states: zod.z.array(StateSchema),
|
|
571
577
|
startStateId: zod.z.string()
|
|
572
578
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -531,12 +531,18 @@ const SectionSchema = z.object({
|
|
|
531
531
|
color: z.record(z.nullable(z.string())),
|
|
532
532
|
media: z.record(SectionMediaSchema).optional()
|
|
533
533
|
});
|
|
534
|
-
const
|
|
534
|
+
const ItemTriggerSchema = z.object({
|
|
535
535
|
itemId: z.string(),
|
|
536
536
|
type: z.enum(["hover-in", "hover-out", "click"]),
|
|
537
537
|
from: z.string(),
|
|
538
538
|
to: z.string()
|
|
539
539
|
});
|
|
540
|
+
const ScrollTriggerSchema = z.object({
|
|
541
|
+
position: z.number(),
|
|
542
|
+
from: z.string(),
|
|
543
|
+
to: z.string(),
|
|
544
|
+
isReverse: z.boolean()
|
|
545
|
+
});
|
|
540
546
|
const VideoInteractionActionSchema = z.object({
|
|
541
547
|
type: z.enum(["play", "pause"]),
|
|
542
548
|
itemId: z.string()
|
|
@@ -547,7 +553,7 @@ const StateSchema = z.object({
|
|
|
547
553
|
});
|
|
548
554
|
const InteractionSchema = z.object({
|
|
549
555
|
id: z.string(),
|
|
550
|
-
triggers: z.array(
|
|
556
|
+
triggers: z.array(z.union([ItemTriggerSchema, ScrollTriggerSchema])),
|
|
551
557
|
states: z.array(StateSchema),
|
|
552
558
|
startStateId: z.string()
|
|
553
559
|
});
|
|
@@ -121,7 +121,7 @@ export declare const ArticleSchema: z.ZodObject<{
|
|
|
121
121
|
}>, "many">;
|
|
122
122
|
interactions: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodObject<{
|
|
123
123
|
id: z.ZodString;
|
|
124
|
-
triggers: z.ZodArray<z.ZodObject<{
|
|
124
|
+
triggers: z.ZodArray<z.ZodUnion<[z.ZodObject<{
|
|
125
125
|
itemId: z.ZodString;
|
|
126
126
|
type: z.ZodEnum<["hover-in", "hover-out", "click"]>;
|
|
127
127
|
from: z.ZodString;
|
|
@@ -136,7 +136,22 @@ export declare const ArticleSchema: z.ZodObject<{
|
|
|
136
136
|
from: string;
|
|
137
137
|
to: string;
|
|
138
138
|
itemId: string;
|
|
139
|
-
}>,
|
|
139
|
+
}>, z.ZodObject<{
|
|
140
|
+
position: z.ZodNumber;
|
|
141
|
+
from: z.ZodString;
|
|
142
|
+
to: z.ZodString;
|
|
143
|
+
isReverse: z.ZodBoolean;
|
|
144
|
+
}, "strip", z.ZodTypeAny, {
|
|
145
|
+
position: number;
|
|
146
|
+
from: string;
|
|
147
|
+
to: string;
|
|
148
|
+
isReverse: boolean;
|
|
149
|
+
}, {
|
|
150
|
+
position: number;
|
|
151
|
+
from: string;
|
|
152
|
+
to: string;
|
|
153
|
+
isReverse: boolean;
|
|
154
|
+
}>]>, "many">;
|
|
140
155
|
states: z.ZodArray<z.ZodObject<{
|
|
141
156
|
id: z.ZodString;
|
|
142
157
|
actions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -165,12 +180,17 @@ export declare const ArticleSchema: z.ZodObject<{
|
|
|
165
180
|
startStateId: z.ZodString;
|
|
166
181
|
}, "strip", z.ZodTypeAny, {
|
|
167
182
|
id: string;
|
|
168
|
-
triggers: {
|
|
183
|
+
triggers: ({
|
|
169
184
|
type: "hover-in" | "hover-out" | "click";
|
|
170
185
|
from: string;
|
|
171
186
|
to: string;
|
|
172
187
|
itemId: string;
|
|
173
|
-
}
|
|
188
|
+
} | {
|
|
189
|
+
position: number;
|
|
190
|
+
from: string;
|
|
191
|
+
to: string;
|
|
192
|
+
isReverse: boolean;
|
|
193
|
+
})[];
|
|
174
194
|
states: {
|
|
175
195
|
id: string;
|
|
176
196
|
actions?: {
|
|
@@ -181,12 +201,17 @@ export declare const ArticleSchema: z.ZodObject<{
|
|
|
181
201
|
startStateId: string;
|
|
182
202
|
}, {
|
|
183
203
|
id: string;
|
|
184
|
-
triggers: {
|
|
204
|
+
triggers: ({
|
|
185
205
|
type: "hover-in" | "hover-out" | "click";
|
|
186
206
|
from: string;
|
|
187
207
|
to: string;
|
|
188
208
|
itemId: string;
|
|
189
|
-
}
|
|
209
|
+
} | {
|
|
210
|
+
position: number;
|
|
211
|
+
from: string;
|
|
212
|
+
to: string;
|
|
213
|
+
isReverse: boolean;
|
|
214
|
+
})[];
|
|
190
215
|
states: {
|
|
191
216
|
id: string;
|
|
192
217
|
actions?: {
|
|
@@ -228,12 +253,17 @@ export declare const ArticleSchema: z.ZodObject<{
|
|
|
228
253
|
}[];
|
|
229
254
|
interactions: Record<string, {
|
|
230
255
|
id: string;
|
|
231
|
-
triggers: {
|
|
256
|
+
triggers: ({
|
|
232
257
|
type: "hover-in" | "hover-out" | "click";
|
|
233
258
|
from: string;
|
|
234
259
|
to: string;
|
|
235
260
|
itemId: string;
|
|
236
|
-
}
|
|
261
|
+
} | {
|
|
262
|
+
position: number;
|
|
263
|
+
from: string;
|
|
264
|
+
to: string;
|
|
265
|
+
isReverse: boolean;
|
|
266
|
+
})[];
|
|
237
267
|
states: {
|
|
238
268
|
id: string;
|
|
239
269
|
actions?: {
|
|
@@ -275,12 +305,17 @@ export declare const ArticleSchema: z.ZodObject<{
|
|
|
275
305
|
}[];
|
|
276
306
|
interactions: Record<string, {
|
|
277
307
|
id: string;
|
|
278
|
-
triggers: {
|
|
308
|
+
triggers: ({
|
|
279
309
|
type: "hover-in" | "hover-out" | "click";
|
|
280
310
|
from: string;
|
|
281
311
|
to: string;
|
|
282
312
|
itemId: string;
|
|
283
|
-
}
|
|
313
|
+
} | {
|
|
314
|
+
position: number;
|
|
315
|
+
from: string;
|
|
316
|
+
to: string;
|
|
317
|
+
isReverse: boolean;
|
|
318
|
+
})[];
|
|
284
319
|
states: {
|
|
285
320
|
id: string;
|
|
286
321
|
actions?: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const InteractionSchema: z.ZodObject<{
|
|
3
3
|
id: z.ZodString;
|
|
4
|
-
triggers: z.ZodArray<z.ZodObject<{
|
|
4
|
+
triggers: z.ZodArray<z.ZodUnion<[z.ZodObject<{
|
|
5
5
|
itemId: z.ZodString;
|
|
6
6
|
type: z.ZodEnum<["hover-in", "hover-out", "click"]>;
|
|
7
7
|
from: z.ZodString;
|
|
@@ -16,7 +16,22 @@ export declare const InteractionSchema: z.ZodObject<{
|
|
|
16
16
|
from: string;
|
|
17
17
|
to: string;
|
|
18
18
|
itemId: string;
|
|
19
|
-
}>,
|
|
19
|
+
}>, z.ZodObject<{
|
|
20
|
+
position: z.ZodNumber;
|
|
21
|
+
from: z.ZodString;
|
|
22
|
+
to: z.ZodString;
|
|
23
|
+
isReverse: z.ZodBoolean;
|
|
24
|
+
}, "strip", z.ZodTypeAny, {
|
|
25
|
+
position: number;
|
|
26
|
+
from: string;
|
|
27
|
+
to: string;
|
|
28
|
+
isReverse: boolean;
|
|
29
|
+
}, {
|
|
30
|
+
position: number;
|
|
31
|
+
from: string;
|
|
32
|
+
to: string;
|
|
33
|
+
isReverse: boolean;
|
|
34
|
+
}>]>, "many">;
|
|
20
35
|
states: z.ZodArray<z.ZodObject<{
|
|
21
36
|
id: z.ZodString;
|
|
22
37
|
actions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -45,12 +60,17 @@ export declare const InteractionSchema: z.ZodObject<{
|
|
|
45
60
|
startStateId: z.ZodString;
|
|
46
61
|
}, "strip", z.ZodTypeAny, {
|
|
47
62
|
id: string;
|
|
48
|
-
triggers: {
|
|
63
|
+
triggers: ({
|
|
49
64
|
type: "hover-in" | "hover-out" | "click";
|
|
50
65
|
from: string;
|
|
51
66
|
to: string;
|
|
52
67
|
itemId: string;
|
|
53
|
-
}
|
|
68
|
+
} | {
|
|
69
|
+
position: number;
|
|
70
|
+
from: string;
|
|
71
|
+
to: string;
|
|
72
|
+
isReverse: boolean;
|
|
73
|
+
})[];
|
|
54
74
|
states: {
|
|
55
75
|
id: string;
|
|
56
76
|
actions?: {
|
|
@@ -61,12 +81,17 @@ export declare const InteractionSchema: z.ZodObject<{
|
|
|
61
81
|
startStateId: string;
|
|
62
82
|
}, {
|
|
63
83
|
id: string;
|
|
64
|
-
triggers: {
|
|
84
|
+
triggers: ({
|
|
65
85
|
type: "hover-in" | "hover-out" | "click";
|
|
66
86
|
from: string;
|
|
67
87
|
to: string;
|
|
68
88
|
itemId: string;
|
|
69
|
-
}
|
|
89
|
+
} | {
|
|
90
|
+
position: number;
|
|
91
|
+
from: string;
|
|
92
|
+
to: string;
|
|
93
|
+
isReverse: boolean;
|
|
94
|
+
})[];
|
|
70
95
|
states: {
|
|
71
96
|
id: string;
|
|
72
97
|
actions?: {
|
|
@@ -2,12 +2,18 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.InteractionSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
-
const
|
|
5
|
+
const ItemTriggerSchema = zod_1.z.object({
|
|
6
6
|
itemId: zod_1.z.string(),
|
|
7
7
|
type: zod_1.z.enum(['hover-in', 'hover-out', 'click']),
|
|
8
8
|
from: zod_1.z.string(),
|
|
9
9
|
to: zod_1.z.string()
|
|
10
10
|
});
|
|
11
|
+
const ScrollTriggerSchema = zod_1.z.object({
|
|
12
|
+
position: zod_1.z.number(),
|
|
13
|
+
from: zod_1.z.string(),
|
|
14
|
+
to: zod_1.z.string(),
|
|
15
|
+
isReverse: zod_1.z.boolean()
|
|
16
|
+
});
|
|
11
17
|
const VideoInteractionActionSchema = zod_1.z.object({
|
|
12
18
|
type: zod_1.z.enum(['play', 'pause']),
|
|
13
19
|
itemId: zod_1.z.string()
|
|
@@ -18,7 +24,7 @@ const StateSchema = zod_1.z.object({
|
|
|
18
24
|
});
|
|
19
25
|
exports.InteractionSchema = zod_1.z.object({
|
|
20
26
|
id: zod_1.z.string(),
|
|
21
|
-
triggers: zod_1.z.array(
|
|
27
|
+
triggers: zod_1.z.array(zod_1.z.union([ItemTriggerSchema, ScrollTriggerSchema])),
|
|
22
28
|
states: zod_1.z.array(StateSchema),
|
|
23
29
|
startStateId: zod_1.z.string(),
|
|
24
30
|
});
|
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
export interface Interaction {
|
|
2
2
|
id: string;
|
|
3
|
-
triggers:
|
|
3
|
+
triggers: (InteractionItemTrigger | InteractionScrollTrigger)[];
|
|
4
4
|
states: InteractionState[];
|
|
5
5
|
startStateId: string;
|
|
6
6
|
}
|
|
7
|
-
export interface
|
|
7
|
+
export interface InteractionItemTrigger {
|
|
8
8
|
itemId: string;
|
|
9
9
|
type: 'hover-in' | 'hover-out' | 'click';
|
|
10
10
|
from: StateId;
|
|
11
11
|
to: StateId;
|
|
12
12
|
}
|
|
13
|
+
export interface InteractionScrollTrigger {
|
|
14
|
+
position: number;
|
|
15
|
+
from: StateId;
|
|
16
|
+
to: StateId;
|
|
17
|
+
isReverse: boolean;
|
|
18
|
+
}
|
|
13
19
|
export type VideoInteractionAction = {
|
|
14
20
|
type: 'play' | 'pause';
|
|
15
21
|
itemId: string;
|