@cntrl-site/sdk 1.16.1 → 1.19.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/lib/schemas/article/Interaction.schema.js +6 -1
- package/lib/schemas/article/Item.schema.js +2 -1
- package/lib/schemas/article/ItemState.schema.js +2 -1
- package/package.json +1 -1
- package/src/schemas/article/Interaction.schema.ts +8 -2
- package/src/schemas/article/Item.schema.ts +2 -1
- package/src/schemas/article/ItemState.schema.ts +2 -1
- package/src/types/article/Interaction.ts +6 -0
- package/src/types/article/Item.ts +1 -0
- package/src/types/article/ItemState.ts +1 -0
|
@@ -8,8 +8,13 @@ const TriggerSchema = zod_1.z.object({
|
|
|
8
8
|
from: zod_1.z.string(),
|
|
9
9
|
to: zod_1.z.string()
|
|
10
10
|
});
|
|
11
|
+
const VideoInteractionActionSchema = zod_1.z.object({
|
|
12
|
+
type: zod_1.z.enum(['play', 'pause']),
|
|
13
|
+
itemId: zod_1.z.string()
|
|
14
|
+
});
|
|
11
15
|
const StateSchema = zod_1.z.object({
|
|
12
|
-
id: zod_1.z.string()
|
|
16
|
+
id: zod_1.z.string(),
|
|
17
|
+
actions: zod_1.z.array(VideoInteractionActionSchema).optional()
|
|
13
18
|
});
|
|
14
19
|
exports.InteractionSchema = zod_1.z.object({
|
|
15
20
|
id: zod_1.z.string(),
|
|
@@ -196,7 +196,8 @@ exports.ItemSchema = zod_1.z.lazy(() => zod_1.z.discriminatedUnion('type', [
|
|
|
196
196
|
to: zod_1.z.number().optional()
|
|
197
197
|
}).nullable()),
|
|
198
198
|
layoutParams: zod_1.z.record(zod_1.z.object({
|
|
199
|
-
opacity: zod_1.z.number().nonnegative()
|
|
199
|
+
opacity: zod_1.z.number().nonnegative(),
|
|
200
|
+
blur: zod_1.z.number()
|
|
200
201
|
})),
|
|
201
202
|
state: zod_1.z.record(zod_1.z.record(ItemState_schema_1.GroupStateParamsSchema))
|
|
202
203
|
}),
|
|
@@ -49,7 +49,8 @@ exports.RichTextStateParamsSchema = zod_1.z.object({
|
|
|
49
49
|
wordSpacing: (0, exports.getStateParamsSchema)(zod_1.z.number())
|
|
50
50
|
}).merge(exports.ItemStateBaseSchema);
|
|
51
51
|
exports.GroupStateParamsSchema = zod_1.z.object({
|
|
52
|
-
opacity: (0, exports.getStateParamsSchema)(zod_1.z.number().nonnegative())
|
|
52
|
+
opacity: (0, exports.getStateParamsSchema)(zod_1.z.number().nonnegative()),
|
|
53
|
+
blur: (0, exports.getStateParamsSchema)(zod_1.z.number().nonnegative())
|
|
53
54
|
}).merge(exports.ItemStateBaseSchema);
|
|
54
55
|
exports.CompoundStateParamsSchema = zod_1.z.object({
|
|
55
56
|
opacity: (0, exports.getStateParamsSchema)(zod_1.z.number().nonnegative())
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z, ZodType } from 'zod';
|
|
2
|
-
import { Interaction, InteractionTrigger } from '../../types/article/Interaction';
|
|
2
|
+
import { Interaction, InteractionTrigger, VideoInteractionAction } from '../../types/article/Interaction';
|
|
3
3
|
|
|
4
4
|
const TriggerSchema = z.object({
|
|
5
5
|
itemId: z.string(),
|
|
@@ -8,8 +8,14 @@ const TriggerSchema = z.object({
|
|
|
8
8
|
to: z.string()
|
|
9
9
|
}) satisfies ZodType<InteractionTrigger>;
|
|
10
10
|
|
|
11
|
+
const VideoInteractionActionSchema = z.object({
|
|
12
|
+
type: z.enum(['play', 'pause']),
|
|
13
|
+
itemId: z.string()
|
|
14
|
+
}) satisfies ZodType<VideoInteractionAction>;
|
|
15
|
+
|
|
11
16
|
const StateSchema = z.object({
|
|
12
|
-
id: z.string()
|
|
17
|
+
id: z.string(),
|
|
18
|
+
actions: z.array(VideoInteractionActionSchema).optional()
|
|
13
19
|
});
|
|
14
20
|
|
|
15
21
|
export const InteractionSchema = z.object({
|
|
@@ -250,7 +250,8 @@ export const ItemSchema: ZodType<ItemAny> = z.lazy(() => z.discriminatedUnion('t
|
|
|
250
250
|
),
|
|
251
251
|
layoutParams: z.record(
|
|
252
252
|
z.object({
|
|
253
|
-
opacity: z.number().nonnegative()
|
|
253
|
+
opacity: z.number().nonnegative(),
|
|
254
|
+
blur: z.number()
|
|
254
255
|
})
|
|
255
256
|
),
|
|
256
257
|
state: z.record(z.record(GroupStateParamsSchema))
|
|
@@ -64,7 +64,8 @@ export const RichTextStateParamsSchema = z.object({
|
|
|
64
64
|
}).merge(ItemStateBaseSchema) satisfies ZodType<RichTextStateParams>;
|
|
65
65
|
|
|
66
66
|
export const GroupStateParamsSchema = z.object({
|
|
67
|
-
opacity: getStateParamsSchema(z.number().nonnegative())
|
|
67
|
+
opacity: getStateParamsSchema(z.number().nonnegative()),
|
|
68
|
+
blur: getStateParamsSchema(z.number().nonnegative())
|
|
68
69
|
}).merge(ItemStateBaseSchema) satisfies ZodType<GroupStateParams>;
|
|
69
70
|
|
|
70
71
|
export const CompoundStateParamsSchema = z.object({
|
|
@@ -12,8 +12,14 @@ export interface InteractionTrigger {
|
|
|
12
12
|
to: StateId;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
export type VideoInteractionAction = {
|
|
16
|
+
type: 'play' | 'pause';
|
|
17
|
+
itemId: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
15
20
|
export interface InteractionState {
|
|
16
21
|
id: StateId;
|
|
22
|
+
actions?: VideoInteractionAction[];
|
|
17
23
|
}
|
|
18
24
|
|
|
19
25
|
type StateId = string;
|
|
@@ -74,6 +74,7 @@ export interface CustomItemStateParams extends ItemStatesBaseMap {}
|
|
|
74
74
|
|
|
75
75
|
export interface GroupStateParams extends ItemStatesBaseMap {
|
|
76
76
|
opacity?: StateParams<number>;
|
|
77
|
+
blur?: StateParams<number>;
|
|
77
78
|
}
|
|
78
79
|
|
|
79
80
|
export interface CompoundStateParams extends ItemStatesBaseMap {
|