@cntrl-site/sdk 1.15.0 → 1.16.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/Item.schema.js +17 -7
- package/lib/schemas/article/ItemBase.schema.js +0 -4
- package/lib/schemas/article/RichTextItem.schema.js +3 -1
- package/package.json +1 -1
- package/src/schemas/article/Item.schema.ts +18 -7
- package/src/schemas/article/ItemBase.schema.ts +0 -5
- package/src/schemas/article/RichTextItem.schema.ts +4 -1
- package/src/types/article/Item.ts +13 -9
|
@@ -7,6 +7,7 @@ const RichTextItem_schema_1 = require("./RichTextItem.schema");
|
|
|
7
7
|
const ItemBase_schema_1 = require("./ItemBase.schema");
|
|
8
8
|
const ArticleItemType_1 = require("../../types/article/ArticleItemType");
|
|
9
9
|
const ItemArea_1 = require("../../types/article/ItemArea");
|
|
10
|
+
const pointerEvents = zod_1.z.enum(['never', 'when_visible', 'always']).optional();
|
|
10
11
|
exports.FXControlSchema = zod_1.z.discriminatedUnion('type', [
|
|
11
12
|
zod_1.z.object({
|
|
12
13
|
type: zod_1.z.literal('float'),
|
|
@@ -54,7 +55,8 @@ const ImageItemSchema = ItemBase_schema_1.ItemBaseSchema.extend({
|
|
|
54
55
|
const VideoItemSchema = ItemBase_schema_1.ItemBaseSchema.extend({
|
|
55
56
|
type: zod_1.z.literal(ArticleItemType_1.ArticleItemType.Video),
|
|
56
57
|
commonParams: zod_1.z.object({
|
|
57
|
-
coverUrl: zod_1.z.string().nullable()
|
|
58
|
+
coverUrl: zod_1.z.string().nullable(),
|
|
59
|
+
pointerEvents
|
|
58
60
|
}).merge(FXParams),
|
|
59
61
|
sticky: zod_1.z.record(zod_1.z.object({
|
|
60
62
|
from: zod_1.z.number(),
|
|
@@ -77,7 +79,8 @@ const VideoItemSchema = ItemBase_schema_1.ItemBaseSchema.extend({
|
|
|
77
79
|
const RectangleItemSchema = ItemBase_schema_1.ItemBaseSchema.extend({
|
|
78
80
|
type: zod_1.z.literal(ArticleItemType_1.ArticleItemType.Rectangle),
|
|
79
81
|
commonParams: zod_1.z.object({
|
|
80
|
-
ratioLock: zod_1.z.boolean()
|
|
82
|
+
ratioLock: zod_1.z.boolean(),
|
|
83
|
+
pointerEvents
|
|
81
84
|
}),
|
|
82
85
|
sticky: zod_1.z.record(zod_1.z.object({
|
|
83
86
|
from: zod_1.z.number(),
|
|
@@ -97,7 +100,8 @@ const RectangleItemSchema = ItemBase_schema_1.ItemBaseSchema.extend({
|
|
|
97
100
|
const CustomItemSchema = ItemBase_schema_1.ItemBaseSchema.extend({
|
|
98
101
|
type: zod_1.z.literal(ArticleItemType_1.ArticleItemType.Custom),
|
|
99
102
|
commonParams: zod_1.z.object({
|
|
100
|
-
name: zod_1.z.string()
|
|
103
|
+
name: zod_1.z.string(),
|
|
104
|
+
pointerEvents
|
|
101
105
|
}),
|
|
102
106
|
sticky: zod_1.z.record(zod_1.z.object({
|
|
103
107
|
from: zod_1.z.number(),
|
|
@@ -116,7 +120,8 @@ const VimeoEmbedItemSchema = ItemBase_schema_1.ItemBaseSchema.extend({
|
|
|
116
120
|
pictureInPicture: zod_1.z.boolean(),
|
|
117
121
|
url: zod_1.z.string().min(1),
|
|
118
122
|
coverUrl: zod_1.z.string().nullable(),
|
|
119
|
-
ratioLock: zod_1.z.boolean()
|
|
123
|
+
ratioLock: zod_1.z.boolean(),
|
|
124
|
+
pointerEvents
|
|
120
125
|
}),
|
|
121
126
|
sticky: zod_1.z.record(zod_1.z.object({
|
|
122
127
|
from: zod_1.z.number(),
|
|
@@ -136,7 +141,8 @@ const YoutubeEmbedItemSchema = ItemBase_schema_1.ItemBaseSchema.extend({
|
|
|
136
141
|
controls: zod_1.z.boolean(),
|
|
137
142
|
loop: zod_1.z.boolean(),
|
|
138
143
|
url: zod_1.z.string().min(1),
|
|
139
|
-
coverUrl: zod_1.z.string().nullable()
|
|
144
|
+
coverUrl: zod_1.z.string().nullable(),
|
|
145
|
+
pointerEvents
|
|
140
146
|
}),
|
|
141
147
|
sticky: zod_1.z.record(zod_1.z.object({
|
|
142
148
|
from: zod_1.z.number(),
|
|
@@ -154,7 +160,8 @@ const CodeEmbedItemSchema = ItemBase_schema_1.ItemBaseSchema.extend({
|
|
|
154
160
|
commonParams: zod_1.z.object({
|
|
155
161
|
html: zod_1.z.string(),
|
|
156
162
|
scale: zod_1.z.boolean(),
|
|
157
|
-
iframe: zod_1.z.boolean()
|
|
163
|
+
iframe: zod_1.z.boolean(),
|
|
164
|
+
pointerEvents
|
|
158
165
|
}),
|
|
159
166
|
sticky: zod_1.z.record(zod_1.z.object({
|
|
160
167
|
from: zod_1.z.number(),
|
|
@@ -178,7 +185,9 @@ exports.ItemSchema = zod_1.z.lazy(() => zod_1.z.discriminatedUnion('type', [
|
|
|
178
185
|
CodeEmbedItemSchema,
|
|
179
186
|
ItemBase_schema_1.ItemBaseSchema.extend({
|
|
180
187
|
type: zod_1.z.literal(ArticleItemType_1.ArticleItemType.Group),
|
|
181
|
-
commonParams: zod_1.z.object({
|
|
188
|
+
commonParams: zod_1.z.object({
|
|
189
|
+
pointerEvents
|
|
190
|
+
}),
|
|
182
191
|
items: zod_1.z.array(exports.ItemSchema),
|
|
183
192
|
sticky: zod_1.z.record(zod_1.z.object({
|
|
184
193
|
from: zod_1.z.number(),
|
|
@@ -193,6 +202,7 @@ exports.ItemSchema = zod_1.z.lazy(() => zod_1.z.discriminatedUnion('type', [
|
|
|
193
202
|
type: zod_1.z.literal(ArticleItemType_1.ArticleItemType.Compound),
|
|
194
203
|
commonParams: zod_1.z.object({
|
|
195
204
|
overflow: zod_1.z.enum(['hidden', 'visible']),
|
|
205
|
+
pointerEvents,
|
|
196
206
|
}),
|
|
197
207
|
items: zod_1.z.array(exports.ItemSchema),
|
|
198
208
|
sticky: zod_1.z.record(zod_1.z.object({
|
|
@@ -8,9 +8,6 @@ exports.Link = zod_1.z.object({
|
|
|
8
8
|
url: zod_1.z.string().min(1),
|
|
9
9
|
target: zod_1.z.string().min(1)
|
|
10
10
|
});
|
|
11
|
-
const CommonParamsBase = zod_1.z.object({
|
|
12
|
-
sizing: zod_1.z.string().min(1)
|
|
13
|
-
});
|
|
14
11
|
exports.CompoundSettingsSchema = zod_1.z.object({
|
|
15
12
|
positionAnchor: zod_1.z.nativeEnum(ItemArea_1.AreaAnchor),
|
|
16
13
|
widthMode: zod_1.z.nativeEnum(ItemArea_1.DimensionMode),
|
|
@@ -21,7 +18,6 @@ exports.ItemBaseSchema = zod_1.z.object({
|
|
|
21
18
|
area: zod_1.z.record(ItemArea_schema_1.ItemAreaSchema),
|
|
22
19
|
hidden: zod_1.z.record(zod_1.z.boolean()),
|
|
23
20
|
link: exports.Link.optional(),
|
|
24
|
-
commonParams: CommonParamsBase,
|
|
25
21
|
compoundSettings: zod_1.z.record(exports.CompoundSettingsSchema).optional(),
|
|
26
22
|
layoutParams: zod_1.z.record(zod_1.z.any()).optional()
|
|
27
23
|
});
|
|
@@ -6,6 +6,7 @@ const RichText_1 = require("../../types/article/RichText");
|
|
|
6
6
|
const ItemBase_schema_1 = require("./ItemBase.schema");
|
|
7
7
|
const ArticleItemType_1 = require("../../types/article/ArticleItemType");
|
|
8
8
|
const ItemState_schema_1 = require("./ItemState.schema");
|
|
9
|
+
const pointerEvents = zod_1.z.enum(['never', 'when_visible', 'always']).optional();
|
|
9
10
|
exports.RichTextEntitySchema = zod_1.z.object({
|
|
10
11
|
start: zod_1.z.number().nonnegative(),
|
|
11
12
|
end: zod_1.z.number().nonnegative(),
|
|
@@ -30,7 +31,8 @@ exports.RichTextItemSchema = ItemBase_schema_1.ItemBaseSchema.extend({
|
|
|
30
31
|
type: zod_1.z.literal(ArticleItemType_1.ArticleItemType.RichText),
|
|
31
32
|
commonParams: zod_1.z.object({
|
|
32
33
|
text: zod_1.z.string(),
|
|
33
|
-
blocks: zod_1.z.array(exports.RichTextBlockSchema).optional()
|
|
34
|
+
blocks: zod_1.z.array(exports.RichTextBlockSchema).optional(),
|
|
35
|
+
pointerEvents
|
|
34
36
|
}),
|
|
35
37
|
sticky: zod_1.z.record(zod_1.z.object({
|
|
36
38
|
from: zod_1.z.number(),
|
package/package.json
CHANGED
|
@@ -22,6 +22,8 @@ import { ArticleItemType } from '../../types/article/ArticleItemType';
|
|
|
22
22
|
import { FXControlAny } from '../../types/article/FX';
|
|
23
23
|
import { AreaAnchor } from '../../types/article/ItemArea';
|
|
24
24
|
|
|
25
|
+
const pointerEvents = z.enum(['never', 'when_visible', 'always']).optional();
|
|
26
|
+
|
|
25
27
|
export const FXControlSchema = z.discriminatedUnion('type',[
|
|
26
28
|
z.object({
|
|
27
29
|
type: z.literal('float'),
|
|
@@ -76,7 +78,8 @@ const ImageItemSchema = ItemBaseSchema.extend({
|
|
|
76
78
|
const VideoItemSchema = ItemBaseSchema.extend({
|
|
77
79
|
type: z.literal(ArticleItemType.Video),
|
|
78
80
|
commonParams: z.object({
|
|
79
|
-
coverUrl: z.string().nullable()
|
|
81
|
+
coverUrl: z.string().nullable(),
|
|
82
|
+
pointerEvents
|
|
80
83
|
}).merge(FXParams),
|
|
81
84
|
sticky: z.record(
|
|
82
85
|
z.object({
|
|
@@ -104,7 +107,8 @@ const VideoItemSchema = ItemBaseSchema.extend({
|
|
|
104
107
|
const RectangleItemSchema = ItemBaseSchema.extend({
|
|
105
108
|
type: z.literal(ArticleItemType.Rectangle),
|
|
106
109
|
commonParams: z.object({
|
|
107
|
-
ratioLock: z.boolean()
|
|
110
|
+
ratioLock: z.boolean(),
|
|
111
|
+
pointerEvents
|
|
108
112
|
}),
|
|
109
113
|
sticky: z.record(
|
|
110
114
|
z.object({
|
|
@@ -129,7 +133,8 @@ const RectangleItemSchema = ItemBaseSchema.extend({
|
|
|
129
133
|
const CustomItemSchema = ItemBaseSchema.extend({
|
|
130
134
|
type: z.literal(ArticleItemType.Custom),
|
|
131
135
|
commonParams: z.object({
|
|
132
|
-
name: z.string()
|
|
136
|
+
name: z.string(),
|
|
137
|
+
pointerEvents
|
|
133
138
|
}),
|
|
134
139
|
sticky: z.record(
|
|
135
140
|
z.object({
|
|
@@ -151,7 +156,8 @@ const VimeoEmbedItemSchema = ItemBaseSchema.extend({
|
|
|
151
156
|
pictureInPicture: z.boolean(),
|
|
152
157
|
url: z.string().min(1),
|
|
153
158
|
coverUrl: z.string().nullable(),
|
|
154
|
-
ratioLock: z.boolean()
|
|
159
|
+
ratioLock: z.boolean(),
|
|
160
|
+
pointerEvents
|
|
155
161
|
}),
|
|
156
162
|
sticky: z.record(
|
|
157
163
|
z.object({
|
|
@@ -176,7 +182,8 @@ const YoutubeEmbedItemSchema = ItemBaseSchema.extend({
|
|
|
176
182
|
controls: z.boolean(),
|
|
177
183
|
loop: z.boolean(),
|
|
178
184
|
url: z.string().min(1),
|
|
179
|
-
coverUrl: z.string().nullable()
|
|
185
|
+
coverUrl: z.string().nullable(),
|
|
186
|
+
pointerEvents
|
|
180
187
|
}),
|
|
181
188
|
sticky: z.record(
|
|
182
189
|
z.object({
|
|
@@ -199,7 +206,8 @@ const CodeEmbedItemSchema = ItemBaseSchema.extend({
|
|
|
199
206
|
commonParams: z.object({
|
|
200
207
|
html: z.string(),
|
|
201
208
|
scale: z.boolean(),
|
|
202
|
-
iframe: z.boolean()
|
|
209
|
+
iframe: z.boolean(),
|
|
210
|
+
pointerEvents
|
|
203
211
|
}),
|
|
204
212
|
sticky: z.record(
|
|
205
213
|
z.object({
|
|
@@ -228,7 +236,9 @@ export const ItemSchema: ZodType<ItemAny> = z.lazy(() => z.discriminatedUnion('t
|
|
|
228
236
|
CodeEmbedItemSchema,
|
|
229
237
|
ItemBaseSchema.extend({
|
|
230
238
|
type: z.literal(ArticleItemType.Group),
|
|
231
|
-
commonParams: z.object({
|
|
239
|
+
commonParams: z.object({
|
|
240
|
+
pointerEvents
|
|
241
|
+
}),
|
|
232
242
|
items: z.array(ItemSchema),
|
|
233
243
|
sticky: z.record(
|
|
234
244
|
z.object({
|
|
@@ -247,6 +257,7 @@ export const ItemSchema: ZodType<ItemAny> = z.lazy(() => z.discriminatedUnion('t
|
|
|
247
257
|
type: z.literal(ArticleItemType.Compound),
|
|
248
258
|
commonParams: z.object({
|
|
249
259
|
overflow: z.enum(['hidden', 'visible']),
|
|
260
|
+
pointerEvents,
|
|
250
261
|
}),
|
|
251
262
|
items: z.array(ItemSchema),
|
|
252
263
|
sticky: z.record(
|
|
@@ -7,10 +7,6 @@ export const Link = z.object({
|
|
|
7
7
|
target: z.string().min(1)
|
|
8
8
|
});
|
|
9
9
|
|
|
10
|
-
const CommonParamsBase = z.object({
|
|
11
|
-
sizing: z.string().min(1)
|
|
12
|
-
});
|
|
13
|
-
|
|
14
10
|
export const CompoundSettingsSchema = z.object({
|
|
15
11
|
positionAnchor: z.nativeEnum(AreaAnchor),
|
|
16
12
|
widthMode: z.nativeEnum(DimensionMode),
|
|
@@ -22,7 +18,6 @@ export const ItemBaseSchema = z.object({
|
|
|
22
18
|
area: z.record(ItemAreaSchema),
|
|
23
19
|
hidden: z.record(z.boolean()),
|
|
24
20
|
link: Link.optional(),
|
|
25
|
-
commonParams: CommonParamsBase,
|
|
26
21
|
compoundSettings: z.record(CompoundSettingsSchema).optional(),
|
|
27
22
|
layoutParams: z.record(z.any()).optional()
|
|
28
23
|
});
|
|
@@ -5,6 +5,8 @@ import { ArticleItemType } from '../../types/article/ArticleItemType';
|
|
|
5
5
|
import { RichTextStateParamsSchema } from './ItemState.schema';
|
|
6
6
|
import { RichTextItem } from '../../types/article/Item';
|
|
7
7
|
|
|
8
|
+
const pointerEvents = z.enum(['never', 'when_visible', 'always']).optional();
|
|
9
|
+
|
|
8
10
|
export const RichTextEntitySchema = z.object({
|
|
9
11
|
start: z.number().nonnegative(),
|
|
10
12
|
end: z.number().nonnegative(),
|
|
@@ -34,7 +36,8 @@ export const RichTextItemSchema = ItemBaseSchema.extend({
|
|
|
34
36
|
type: z.literal(ArticleItemType.RichText),
|
|
35
37
|
commonParams: z.object({
|
|
36
38
|
text: z.string(),
|
|
37
|
-
blocks: z.array(RichTextBlockSchema).optional()
|
|
39
|
+
blocks: z.array(RichTextBlockSchema).optional(),
|
|
40
|
+
pointerEvents
|
|
38
41
|
}),
|
|
39
42
|
sticky: z.record(
|
|
40
43
|
z.object({
|
|
@@ -47,7 +47,11 @@ export interface ItemLayoutParamsMap {
|
|
|
47
47
|
[ArticleItemType.CodeEmbed]: CodeEmbedLayoutParams;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
interface
|
|
50
|
+
interface CommonParamsBase {
|
|
51
|
+
pointerEvents?: 'never' | 'when_visible' | 'always';
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
interface MediaCommonParams extends CommonParamsBase {
|
|
51
55
|
url: string;
|
|
52
56
|
hasGLEffect?: boolean;
|
|
53
57
|
fragmentShader: string | null;
|
|
@@ -61,32 +65,32 @@ interface VideoCommonParams extends MediaCommonParams {
|
|
|
61
65
|
|
|
62
66
|
interface ImageCommonParams extends MediaCommonParams {}
|
|
63
67
|
|
|
64
|
-
interface RichTextCommonParams {
|
|
68
|
+
interface RichTextCommonParams extends CommonParamsBase {
|
|
65
69
|
text: string;
|
|
66
70
|
blocks?: RichTextBlock[];
|
|
67
71
|
}
|
|
68
72
|
|
|
69
|
-
interface RectangleCommonParams {
|
|
73
|
+
interface RectangleCommonParams extends CommonParamsBase {
|
|
70
74
|
ratioLock: boolean;
|
|
71
75
|
}
|
|
72
76
|
|
|
73
|
-
interface CustomCommonParams {
|
|
77
|
+
interface CustomCommonParams extends CommonParamsBase {
|
|
74
78
|
name: string;
|
|
75
79
|
}
|
|
76
80
|
|
|
77
|
-
interface GroupCommonParams {}
|
|
81
|
+
interface GroupCommonParams extends CommonParamsBase {}
|
|
78
82
|
|
|
79
|
-
interface CompoundCommonParams {
|
|
83
|
+
interface CompoundCommonParams extends CommonParamsBase {
|
|
80
84
|
overflow: 'hidden' | 'visible';
|
|
81
85
|
}
|
|
82
86
|
|
|
83
|
-
interface CodeEmbedCommonParams {
|
|
87
|
+
interface CodeEmbedCommonParams extends CommonParamsBase {
|
|
84
88
|
html: string;
|
|
85
89
|
scale: boolean;
|
|
86
90
|
iframe: boolean;
|
|
87
91
|
}
|
|
88
92
|
|
|
89
|
-
interface VimeoEmbedCommonParams {
|
|
93
|
+
interface VimeoEmbedCommonParams extends CommonParamsBase {
|
|
90
94
|
play: 'on-hover' | 'on-click' | 'auto';
|
|
91
95
|
controls: boolean;
|
|
92
96
|
loop: boolean;
|
|
@@ -96,7 +100,7 @@ interface VimeoEmbedCommonParams {
|
|
|
96
100
|
coverUrl: string | null;
|
|
97
101
|
}
|
|
98
102
|
|
|
99
|
-
interface YoutubeEmbedCommonParams {
|
|
103
|
+
interface YoutubeEmbedCommonParams extends CommonParamsBase {
|
|
100
104
|
play: 'on-hover' | 'on-click' | 'auto';
|
|
101
105
|
controls: boolean;
|
|
102
106
|
loop: boolean;
|