@cntrl-site/sdk 1.15.0 → 1.16.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.
@@ -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'),
@@ -37,7 +38,9 @@ const FXParams = zod_1.z.object({
37
38
  });
38
39
  const ImageItemSchema = ItemBase_schema_1.ItemBaseSchema.extend({
39
40
  type: zod_1.z.literal(ArticleItemType_1.ArticleItemType.Image),
40
- commonParams: FXParams,
41
+ commonParams: zod_1.z.object({
42
+ pointerEvents
43
+ }).merge(FXParams),
41
44
  sticky: zod_1.z.record(zod_1.z.object({
42
45
  from: zod_1.z.number(),
43
46
  to: zod_1.z.number().optional()
@@ -54,7 +57,8 @@ const ImageItemSchema = ItemBase_schema_1.ItemBaseSchema.extend({
54
57
  const VideoItemSchema = ItemBase_schema_1.ItemBaseSchema.extend({
55
58
  type: zod_1.z.literal(ArticleItemType_1.ArticleItemType.Video),
56
59
  commonParams: zod_1.z.object({
57
- coverUrl: zod_1.z.string().nullable()
60
+ coverUrl: zod_1.z.string().nullable(),
61
+ pointerEvents
58
62
  }).merge(FXParams),
59
63
  sticky: zod_1.z.record(zod_1.z.object({
60
64
  from: zod_1.z.number(),
@@ -77,7 +81,8 @@ const VideoItemSchema = ItemBase_schema_1.ItemBaseSchema.extend({
77
81
  const RectangleItemSchema = ItemBase_schema_1.ItemBaseSchema.extend({
78
82
  type: zod_1.z.literal(ArticleItemType_1.ArticleItemType.Rectangle),
79
83
  commonParams: zod_1.z.object({
80
- ratioLock: zod_1.z.boolean()
84
+ ratioLock: zod_1.z.boolean(),
85
+ pointerEvents
81
86
  }),
82
87
  sticky: zod_1.z.record(zod_1.z.object({
83
88
  from: zod_1.z.number(),
@@ -97,7 +102,8 @@ const RectangleItemSchema = ItemBase_schema_1.ItemBaseSchema.extend({
97
102
  const CustomItemSchema = ItemBase_schema_1.ItemBaseSchema.extend({
98
103
  type: zod_1.z.literal(ArticleItemType_1.ArticleItemType.Custom),
99
104
  commonParams: zod_1.z.object({
100
- name: zod_1.z.string()
105
+ name: zod_1.z.string(),
106
+ pointerEvents
101
107
  }),
102
108
  sticky: zod_1.z.record(zod_1.z.object({
103
109
  from: zod_1.z.number(),
@@ -116,7 +122,8 @@ const VimeoEmbedItemSchema = ItemBase_schema_1.ItemBaseSchema.extend({
116
122
  pictureInPicture: zod_1.z.boolean(),
117
123
  url: zod_1.z.string().min(1),
118
124
  coverUrl: zod_1.z.string().nullable(),
119
- ratioLock: zod_1.z.boolean()
125
+ ratioLock: zod_1.z.boolean(),
126
+ pointerEvents
120
127
  }),
121
128
  sticky: zod_1.z.record(zod_1.z.object({
122
129
  from: zod_1.z.number(),
@@ -136,7 +143,8 @@ const YoutubeEmbedItemSchema = ItemBase_schema_1.ItemBaseSchema.extend({
136
143
  controls: zod_1.z.boolean(),
137
144
  loop: zod_1.z.boolean(),
138
145
  url: zod_1.z.string().min(1),
139
- coverUrl: zod_1.z.string().nullable()
146
+ coverUrl: zod_1.z.string().nullable(),
147
+ pointerEvents
140
148
  }),
141
149
  sticky: zod_1.z.record(zod_1.z.object({
142
150
  from: zod_1.z.number(),
@@ -154,7 +162,8 @@ const CodeEmbedItemSchema = ItemBase_schema_1.ItemBaseSchema.extend({
154
162
  commonParams: zod_1.z.object({
155
163
  html: zod_1.z.string(),
156
164
  scale: zod_1.z.boolean(),
157
- iframe: zod_1.z.boolean()
165
+ iframe: zod_1.z.boolean(),
166
+ pointerEvents
158
167
  }),
159
168
  sticky: zod_1.z.record(zod_1.z.object({
160
169
  from: zod_1.z.number(),
@@ -178,7 +187,9 @@ exports.ItemSchema = zod_1.z.lazy(() => zod_1.z.discriminatedUnion('type', [
178
187
  CodeEmbedItemSchema,
179
188
  ItemBase_schema_1.ItemBaseSchema.extend({
180
189
  type: zod_1.z.literal(ArticleItemType_1.ArticleItemType.Group),
181
- commonParams: zod_1.z.object({}),
190
+ commonParams: zod_1.z.object({
191
+ pointerEvents
192
+ }),
182
193
  items: zod_1.z.array(exports.ItemSchema),
183
194
  sticky: zod_1.z.record(zod_1.z.object({
184
195
  from: zod_1.z.number(),
@@ -193,6 +204,7 @@ exports.ItemSchema = zod_1.z.lazy(() => zod_1.z.discriminatedUnion('type', [
193
204
  type: zod_1.z.literal(ArticleItemType_1.ArticleItemType.Compound),
194
205
  commonParams: zod_1.z.object({
195
206
  overflow: zod_1.z.enum(['hidden', 'visible']),
207
+ pointerEvents,
196
208
  }),
197
209
  items: zod_1.z.array(exports.ItemSchema),
198
210
  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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cntrl-site/sdk",
3
- "version": "1.15.0",
3
+ "version": "1.16.1",
4
4
  "description": "Generic SDK for use in public websites.",
5
5
  "main": "lib/index.js",
6
6
  "types": "src/index.ts",
@@ -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'),
@@ -54,7 +56,9 @@ const FXParams = z.object({
54
56
 
55
57
  const ImageItemSchema = ItemBaseSchema.extend({
56
58
  type: z.literal(ArticleItemType.Image),
57
- commonParams: FXParams,
59
+ commonParams: z.object({
60
+ pointerEvents
61
+ }).merge(FXParams),
58
62
  sticky: z.record(
59
63
  z.object({
60
64
  from: z.number(),
@@ -76,7 +80,8 @@ const ImageItemSchema = ItemBaseSchema.extend({
76
80
  const VideoItemSchema = ItemBaseSchema.extend({
77
81
  type: z.literal(ArticleItemType.Video),
78
82
  commonParams: z.object({
79
- coverUrl: z.string().nullable()
83
+ coverUrl: z.string().nullable(),
84
+ pointerEvents
80
85
  }).merge(FXParams),
81
86
  sticky: z.record(
82
87
  z.object({
@@ -104,7 +109,8 @@ const VideoItemSchema = ItemBaseSchema.extend({
104
109
  const RectangleItemSchema = ItemBaseSchema.extend({
105
110
  type: z.literal(ArticleItemType.Rectangle),
106
111
  commonParams: z.object({
107
- ratioLock: z.boolean()
112
+ ratioLock: z.boolean(),
113
+ pointerEvents
108
114
  }),
109
115
  sticky: z.record(
110
116
  z.object({
@@ -129,7 +135,8 @@ const RectangleItemSchema = ItemBaseSchema.extend({
129
135
  const CustomItemSchema = ItemBaseSchema.extend({
130
136
  type: z.literal(ArticleItemType.Custom),
131
137
  commonParams: z.object({
132
- name: z.string()
138
+ name: z.string(),
139
+ pointerEvents
133
140
  }),
134
141
  sticky: z.record(
135
142
  z.object({
@@ -151,7 +158,8 @@ const VimeoEmbedItemSchema = ItemBaseSchema.extend({
151
158
  pictureInPicture: z.boolean(),
152
159
  url: z.string().min(1),
153
160
  coverUrl: z.string().nullable(),
154
- ratioLock: z.boolean()
161
+ ratioLock: z.boolean(),
162
+ pointerEvents
155
163
  }),
156
164
  sticky: z.record(
157
165
  z.object({
@@ -176,7 +184,8 @@ const YoutubeEmbedItemSchema = ItemBaseSchema.extend({
176
184
  controls: z.boolean(),
177
185
  loop: z.boolean(),
178
186
  url: z.string().min(1),
179
- coverUrl: z.string().nullable()
187
+ coverUrl: z.string().nullable(),
188
+ pointerEvents
180
189
  }),
181
190
  sticky: z.record(
182
191
  z.object({
@@ -199,7 +208,8 @@ const CodeEmbedItemSchema = ItemBaseSchema.extend({
199
208
  commonParams: z.object({
200
209
  html: z.string(),
201
210
  scale: z.boolean(),
202
- iframe: z.boolean()
211
+ iframe: z.boolean(),
212
+ pointerEvents
203
213
  }),
204
214
  sticky: z.record(
205
215
  z.object({
@@ -228,7 +238,9 @@ export const ItemSchema: ZodType<ItemAny> = z.lazy(() => z.discriminatedUnion('t
228
238
  CodeEmbedItemSchema,
229
239
  ItemBaseSchema.extend({
230
240
  type: z.literal(ArticleItemType.Group),
231
- commonParams: z.object({}),
241
+ commonParams: z.object({
242
+ pointerEvents
243
+ }),
232
244
  items: z.array(ItemSchema),
233
245
  sticky: z.record(
234
246
  z.object({
@@ -247,6 +259,7 @@ export const ItemSchema: ZodType<ItemAny> = z.lazy(() => z.discriminatedUnion('t
247
259
  type: z.literal(ArticleItemType.Compound),
248
260
  commonParams: z.object({
249
261
  overflow: z.enum(['hidden', 'visible']),
262
+ pointerEvents,
250
263
  }),
251
264
  items: z.array(ItemSchema),
252
265
  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 MediaCommonParams {
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;