@cntrl-site/sdk 1.5.2 → 1.5.4

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.
@@ -11,7 +11,12 @@ const ImageItemSchema = ItemBase_schema_1.ItemBaseSchema.extend({
11
11
  commonParams: zod_1.z.object({
12
12
  url: zod_1.z.string().min(1),
13
13
  hasGLEffect: zod_1.z.boolean().optional(),
14
- fragmentShader: zod_1.z.string().optional()
14
+ fragmentShader: zod_1.z.string().optional(),
15
+ FXCursor: zod_1.z.object({
16
+ type: zod_1.z.enum(['mouse', 'manual']),
17
+ x: zod_1.z.number(),
18
+ y: zod_1.z.number()
19
+ }).optional()
15
20
  }),
16
21
  sticky: zod_1.z.record(zod_1.z.object({
17
22
  from: zod_1.z.number(),
@@ -128,22 +133,7 @@ const YoutubeEmbedItemSchema = ItemBase_schema_1.ItemBaseSchema.extend({
128
133
  hover: zod_1.z.record(ItemState_schema_1.EmbedHoverStateParamsSchema)
129
134
  })
130
135
  });
131
- const GroupItemSchema = ItemBase_schema_1.ItemBaseSchema.extend({
132
- type: zod_1.z.literal(ArticleItemType_1.ArticleItemType.Group),
133
- commonParams: zod_1.z.object({}),
134
- itemsIds: zod_1.z.array(zod_1.z.string()),
135
- sticky: zod_1.z.record(zod_1.z.object({
136
- from: zod_1.z.number(),
137
- to: zod_1.z.number().optional()
138
- }).nullable()),
139
- layoutParams: zod_1.z.record(zod_1.z.object({
140
- opacity: zod_1.z.number().nonnegative()
141
- })),
142
- state: zod_1.z.object({
143
- hover: zod_1.z.record(ItemState_schema_1.GroupHoverStateParamsSchema)
144
- })
145
- });
146
- exports.ItemSchema = zod_1.z.discriminatedUnion('type', [
136
+ exports.ItemSchema = zod_1.z.lazy(() => zod_1.z.discriminatedUnion('type', [
147
137
  ImageItemSchema,
148
138
  VideoItemSchema,
149
139
  RectangleItemSchema,
@@ -151,5 +141,19 @@ exports.ItemSchema = zod_1.z.discriminatedUnion('type', [
151
141
  RichTextItem_schema_1.RichTextItemSchema,
152
142
  VimeoEmbedItemSchema,
153
143
  YoutubeEmbedItemSchema,
154
- GroupItemSchema
155
- ]);
144
+ ItemBase_schema_1.ItemBaseSchema.extend({
145
+ type: zod_1.z.literal(ArticleItemType_1.ArticleItemType.Group),
146
+ commonParams: zod_1.z.object({}),
147
+ items: zod_1.z.array(exports.ItemSchema),
148
+ sticky: zod_1.z.record(zod_1.z.object({
149
+ from: zod_1.z.number(),
150
+ to: zod_1.z.number().optional()
151
+ }).nullable()),
152
+ layoutParams: zod_1.z.record(zod_1.z.object({
153
+ opacity: zod_1.z.number().nonnegative()
154
+ })),
155
+ state: zod_1.z.object({
156
+ hover: zod_1.z.record(ItemState_schema_1.GroupHoverStateParamsSchema)
157
+ })
158
+ })
159
+ ]));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cntrl-site/sdk",
3
- "version": "1.5.2",
3
+ "version": "1.5.4",
4
4
  "description": "Generic SDK for use in public websites.",
5
5
  "main": "lib/index.js",
6
6
  "types": "src/index.ts",
@@ -1,7 +1,9 @@
1
1
  import { z, ZodType } from 'zod';
2
2
  import {
3
- CustomItem, GroupItem,
3
+ CustomItem,
4
+ GroupItem,
4
5
  ImageItem,
6
+ ItemAny,
5
7
  RectangleItem,
6
8
  VideoItem,
7
9
  VimeoEmbedItem,
@@ -21,7 +23,12 @@ const ImageItemSchema = ItemBaseSchema.extend({
21
23
  commonParams: z.object({
22
24
  url: z.string().min(1),
23
25
  hasGLEffect: z.boolean().optional(),
24
- fragmentShader: z.string().optional()
26
+ fragmentShader: z.string().optional(),
27
+ FXCursor: z.object({
28
+ type: z.enum(['mouse', 'manual']),
29
+ x: z.number(),
30
+ y: z.number()
31
+ }).optional()
25
32
  }),
26
33
  sticky: z.record(
27
34
  z.object({
@@ -166,27 +173,7 @@ const YoutubeEmbedItemSchema = ItemBaseSchema.extend({
166
173
  })
167
174
  }) satisfies ZodType<YoutubeEmbedItem>;
168
175
 
169
- const GroupItemSchema = ItemBaseSchema.extend({
170
- type: z.literal(ArticleItemType.Group),
171
- commonParams: z.object({}),
172
- itemsIds: z.array(z.string()),
173
- sticky: z.record(
174
- z.object({
175
- from: z.number(),
176
- to: z.number().optional()
177
- }).nullable(),
178
- ),
179
- layoutParams: z.record(
180
- z.object({
181
- opacity: z.number().nonnegative()
182
- })
183
- ),
184
- state: z.object({
185
- hover: z.record(GroupHoverStateParamsSchema)
186
- })
187
- }) satisfies ZodType<GroupItem>;
188
-
189
- export const ItemSchema = z.discriminatedUnion('type', [
176
+ export const ItemSchema: ZodType<ItemAny> = z.lazy(() => z.discriminatedUnion('type', [
190
177
  ImageItemSchema,
191
178
  VideoItemSchema,
192
179
  RectangleItemSchema,
@@ -194,5 +181,23 @@ export const ItemSchema = z.discriminatedUnion('type', [
194
181
  RichTextItemSchema,
195
182
  VimeoEmbedItemSchema,
196
183
  YoutubeEmbedItemSchema,
197
- GroupItemSchema
198
- ]);
184
+ ItemBaseSchema.extend({
185
+ type: z.literal(ArticleItemType.Group),
186
+ commonParams: z.object({}),
187
+ items: z.array(ItemSchema),
188
+ sticky: z.record(
189
+ z.object({
190
+ from: z.number(),
191
+ to: z.number().optional()
192
+ }).nullable(),
193
+ ),
194
+ layoutParams: z.record(
195
+ z.object({
196
+ opacity: z.number().nonnegative()
197
+ })
198
+ ),
199
+ state: z.object({
200
+ hover: z.record(GroupHoverStateParamsSchema)
201
+ })
202
+ })
203
+ ]));
@@ -44,11 +44,18 @@ interface MediaCommonParams {
44
44
  url: string;
45
45
  }
46
46
 
47
+ interface FXCursor {
48
+ type: 'mouse' | 'manual';
49
+ x: number;
50
+ y: number;
51
+ }
52
+
47
53
  interface VideoCommonParams extends MediaCommonParams {}
48
54
 
49
55
  interface ImageCommonParams extends MediaCommonParams {
50
56
  hasGLEffect?: boolean;
51
57
  fragmentShader?: string;
58
+ cursor?: FXCursor;
52
59
  }
53
60
 
54
61
  interface RichTextCommonParams {