@cntrl-site/sdk 1.22.8 → 1.22.9-alpha.1
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
|
@@ -536,12 +536,18 @@ const SectionSchema = zod.z.object({
|
|
|
536
536
|
offsetX: zod.z.number().nullable()
|
|
537
537
|
})).optional()
|
|
538
538
|
});
|
|
539
|
-
const
|
|
539
|
+
const ItemTriggerSchema = zod.z.object({
|
|
540
540
|
itemId: zod.z.string(),
|
|
541
541
|
type: zod.z.enum(["hover-in", "hover-out", "click"]),
|
|
542
542
|
from: zod.z.string(),
|
|
543
543
|
to: zod.z.string()
|
|
544
544
|
});
|
|
545
|
+
const ScrollTriggerSchema = zod.z.object({
|
|
546
|
+
position: zod.z.number(),
|
|
547
|
+
from: zod.z.string(),
|
|
548
|
+
to: zod.z.string(),
|
|
549
|
+
isReverse: zod.z.boolean()
|
|
550
|
+
});
|
|
545
551
|
const VideoInteractionActionSchema = zod.z.object({
|
|
546
552
|
type: zod.z.enum(["play", "pause"]),
|
|
547
553
|
itemId: zod.z.string()
|
|
@@ -552,7 +558,7 @@ const StateSchema = zod.z.object({
|
|
|
552
558
|
});
|
|
553
559
|
const InteractionSchema = zod.z.object({
|
|
554
560
|
id: zod.z.string(),
|
|
555
|
-
triggers: zod.z.array(
|
|
561
|
+
triggers: zod.z.array(zod.z.union([ItemTriggerSchema, ScrollTriggerSchema])),
|
|
556
562
|
states: zod.z.array(StateSchema),
|
|
557
563
|
startStateId: zod.z.string()
|
|
558
564
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -517,12 +517,18 @@ const SectionSchema = z.object({
|
|
|
517
517
|
offsetX: z.number().nullable()
|
|
518
518
|
})).optional()
|
|
519
519
|
});
|
|
520
|
-
const
|
|
520
|
+
const ItemTriggerSchema = z.object({
|
|
521
521
|
itemId: z.string(),
|
|
522
522
|
type: z.enum(["hover-in", "hover-out", "click"]),
|
|
523
523
|
from: z.string(),
|
|
524
524
|
to: z.string()
|
|
525
525
|
});
|
|
526
|
+
const ScrollTriggerSchema = z.object({
|
|
527
|
+
position: z.number(),
|
|
528
|
+
from: z.string(),
|
|
529
|
+
to: z.string(),
|
|
530
|
+
isReverse: z.boolean()
|
|
531
|
+
});
|
|
526
532
|
const VideoInteractionActionSchema = z.object({
|
|
527
533
|
type: z.enum(["play", "pause"]),
|
|
528
534
|
itemId: z.string()
|
|
@@ -533,7 +539,7 @@ const StateSchema = z.object({
|
|
|
533
539
|
});
|
|
534
540
|
const InteractionSchema = z.object({
|
|
535
541
|
id: z.string(),
|
|
536
|
-
triggers: z.array(
|
|
542
|
+
triggers: z.array(z.union([ItemTriggerSchema, ScrollTriggerSchema])),
|
|
537
543
|
states: z.array(StateSchema),
|
|
538
544
|
startStateId: z.string()
|
|
539
545
|
});
|
|
@@ -76,7 +76,7 @@ export declare const ArticleSchema: z.ZodObject<{
|
|
|
76
76
|
}>, "many">;
|
|
77
77
|
interactions: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodObject<{
|
|
78
78
|
id: z.ZodString;
|
|
79
|
-
triggers: z.ZodArray<z.ZodObject<{
|
|
79
|
+
triggers: z.ZodArray<z.ZodUnion<[z.ZodObject<{
|
|
80
80
|
itemId: z.ZodString;
|
|
81
81
|
type: z.ZodEnum<["hover-in", "hover-out", "click"]>;
|
|
82
82
|
from: z.ZodString;
|
|
@@ -91,7 +91,22 @@ export declare const ArticleSchema: z.ZodObject<{
|
|
|
91
91
|
from: string;
|
|
92
92
|
to: string;
|
|
93
93
|
itemId: string;
|
|
94
|
-
}>,
|
|
94
|
+
}>, z.ZodObject<{
|
|
95
|
+
position: z.ZodNumber;
|
|
96
|
+
from: z.ZodString;
|
|
97
|
+
to: z.ZodString;
|
|
98
|
+
isReverse: z.ZodBoolean;
|
|
99
|
+
}, "strip", z.ZodTypeAny, {
|
|
100
|
+
position: number;
|
|
101
|
+
from: string;
|
|
102
|
+
to: string;
|
|
103
|
+
isReverse: boolean;
|
|
104
|
+
}, {
|
|
105
|
+
position: number;
|
|
106
|
+
from: string;
|
|
107
|
+
to: string;
|
|
108
|
+
isReverse: boolean;
|
|
109
|
+
}>]>, "many">;
|
|
95
110
|
states: z.ZodArray<z.ZodObject<{
|
|
96
111
|
id: z.ZodString;
|
|
97
112
|
actions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -120,12 +135,17 @@ export declare const ArticleSchema: z.ZodObject<{
|
|
|
120
135
|
startStateId: z.ZodString;
|
|
121
136
|
}, "strip", z.ZodTypeAny, {
|
|
122
137
|
id: string;
|
|
123
|
-
triggers: {
|
|
138
|
+
triggers: ({
|
|
124
139
|
type: "hover-in" | "hover-out" | "click";
|
|
125
140
|
from: string;
|
|
126
141
|
to: string;
|
|
127
142
|
itemId: string;
|
|
128
|
-
}
|
|
143
|
+
} | {
|
|
144
|
+
position: number;
|
|
145
|
+
from: string;
|
|
146
|
+
to: string;
|
|
147
|
+
isReverse: boolean;
|
|
148
|
+
})[];
|
|
129
149
|
states: {
|
|
130
150
|
id: string;
|
|
131
151
|
actions?: {
|
|
@@ -136,12 +156,17 @@ export declare const ArticleSchema: z.ZodObject<{
|
|
|
136
156
|
startStateId: string;
|
|
137
157
|
}, {
|
|
138
158
|
id: string;
|
|
139
|
-
triggers: {
|
|
159
|
+
triggers: ({
|
|
140
160
|
type: "hover-in" | "hover-out" | "click";
|
|
141
161
|
from: string;
|
|
142
162
|
to: string;
|
|
143
163
|
itemId: string;
|
|
144
|
-
}
|
|
164
|
+
} | {
|
|
165
|
+
position: number;
|
|
166
|
+
from: string;
|
|
167
|
+
to: string;
|
|
168
|
+
isReverse: boolean;
|
|
169
|
+
})[];
|
|
145
170
|
states: {
|
|
146
171
|
id: string;
|
|
147
172
|
actions?: {
|
|
@@ -174,12 +199,17 @@ export declare const ArticleSchema: z.ZodObject<{
|
|
|
174
199
|
}[];
|
|
175
200
|
interactions: Record<string, {
|
|
176
201
|
id: string;
|
|
177
|
-
triggers: {
|
|
202
|
+
triggers: ({
|
|
178
203
|
type: "hover-in" | "hover-out" | "click";
|
|
179
204
|
from: string;
|
|
180
205
|
to: string;
|
|
181
206
|
itemId: string;
|
|
182
|
-
}
|
|
207
|
+
} | {
|
|
208
|
+
position: number;
|
|
209
|
+
from: string;
|
|
210
|
+
to: string;
|
|
211
|
+
isReverse: boolean;
|
|
212
|
+
})[];
|
|
183
213
|
states: {
|
|
184
214
|
id: string;
|
|
185
215
|
actions?: {
|
|
@@ -212,12 +242,17 @@ export declare const ArticleSchema: z.ZodObject<{
|
|
|
212
242
|
}[];
|
|
213
243
|
interactions: Record<string, {
|
|
214
244
|
id: string;
|
|
215
|
-
triggers: {
|
|
245
|
+
triggers: ({
|
|
216
246
|
type: "hover-in" | "hover-out" | "click";
|
|
217
247
|
from: string;
|
|
218
248
|
to: string;
|
|
219
249
|
itemId: string;
|
|
220
|
-
}
|
|
250
|
+
} | {
|
|
251
|
+
position: number;
|
|
252
|
+
from: string;
|
|
253
|
+
to: string;
|
|
254
|
+
isReverse: boolean;
|
|
255
|
+
})[];
|
|
221
256
|
states: {
|
|
222
257
|
id: string;
|
|
223
258
|
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;
|