@cntrl-site/sdk 1.14.0 → 1.15.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.
@@ -24,19 +24,20 @@ exports.FXControlSchema = zod_1.z.discriminatedUnion('type', [
24
24
  value: zod_1.z.tuple([zod_1.z.number(), zod_1.z.number()])
25
25
  })
26
26
  ]);
27
+ const FXParams = zod_1.z.object({
28
+ url: zod_1.z.string().min(1),
29
+ hasGLEffect: zod_1.z.boolean().optional(),
30
+ fragmentShader: zod_1.z.string().nullable(),
31
+ FXCursor: zod_1.z.object({
32
+ type: zod_1.z.enum(['mouse', 'manual']),
33
+ x: zod_1.z.number(),
34
+ y: zod_1.z.number()
35
+ }).nullable(),
36
+ FXControls: zod_1.z.array(exports.FXControlSchema).optional()
37
+ });
27
38
  const ImageItemSchema = ItemBase_schema_1.ItemBaseSchema.extend({
28
39
  type: zod_1.z.literal(ArticleItemType_1.ArticleItemType.Image),
29
- commonParams: zod_1.z.object({
30
- url: zod_1.z.string().min(1),
31
- hasGLEffect: zod_1.z.boolean().optional(),
32
- fragmentShader: zod_1.z.string().nullable(),
33
- FXCursor: zod_1.z.object({
34
- type: zod_1.z.enum(['mouse', 'manual']),
35
- x: zod_1.z.number(),
36
- y: zod_1.z.number()
37
- }).nullable(),
38
- FXControls: zod_1.z.array(exports.FXControlSchema).optional()
39
- }),
40
+ commonParams: FXParams,
40
41
  sticky: zod_1.z.record(zod_1.z.object({
41
42
  from: zod_1.z.number(),
42
43
  to: zod_1.z.number().optional()
@@ -53,9 +54,8 @@ const ImageItemSchema = ItemBase_schema_1.ItemBaseSchema.extend({
53
54
  const VideoItemSchema = ItemBase_schema_1.ItemBaseSchema.extend({
54
55
  type: zod_1.z.literal(ArticleItemType_1.ArticleItemType.Video),
55
56
  commonParams: zod_1.z.object({
56
- url: zod_1.z.string().min(1),
57
57
  coverUrl: zod_1.z.string().nullable()
58
- }),
58
+ }).merge(FXParams),
59
59
  sticky: zod_1.z.record(zod_1.z.object({
60
60
  from: zod_1.z.number(),
61
61
  to: zod_1.z.number().optional()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cntrl-site/sdk",
3
- "version": "1.14.0",
3
+ "version": "1.15.0",
4
4
  "description": "Generic SDK for use in public websites.",
5
5
  "main": "lib/index.js",
6
6
  "types": "src/index.ts",
@@ -40,19 +40,21 @@ export const FXControlSchema = z.discriminatedUnion('type',[
40
40
  })
41
41
  ]) satisfies ZodType<FXControlAny>;
42
42
 
43
+ const FXParams = z.object({
44
+ url: z.string().min(1),
45
+ hasGLEffect: z.boolean().optional(),
46
+ fragmentShader: z.string().nullable(),
47
+ FXCursor: z.object({
48
+ type: z.enum(['mouse', 'manual']),
49
+ x: z.number(),
50
+ y: z.number()
51
+ }).nullable(),
52
+ FXControls: z.array(FXControlSchema).optional()
53
+ });
54
+
43
55
  const ImageItemSchema = ItemBaseSchema.extend({
44
56
  type: z.literal(ArticleItemType.Image),
45
- commonParams: z.object({
46
- url: z.string().min(1),
47
- hasGLEffect: z.boolean().optional(),
48
- fragmentShader: z.string().nullable(),
49
- FXCursor: z.object({
50
- type: z.enum(['mouse', 'manual']),
51
- x: z.number(),
52
- y: z.number()
53
- }).nullable(),
54
- FXControls: z.array(FXControlSchema).optional()
55
- }),
57
+ commonParams: FXParams,
56
58
  sticky: z.record(
57
59
  z.object({
58
60
  from: z.number(),
@@ -74,9 +76,8 @@ const ImageItemSchema = ItemBaseSchema.extend({
74
76
  const VideoItemSchema = ItemBaseSchema.extend({
75
77
  type: z.literal(ArticleItemType.Video),
76
78
  commonParams: z.object({
77
- url: z.string().min(1),
78
79
  coverUrl: z.string().nullable()
79
- }),
80
+ }).merge(FXParams),
80
81
  sticky: z.record(
81
82
  z.object({
82
83
  from: z.number(),
@@ -49,18 +49,17 @@ export interface ItemLayoutParamsMap {
49
49
 
50
50
  interface MediaCommonParams {
51
51
  url: string;
52
+ hasGLEffect?: boolean;
53
+ fragmentShader: string | null;
54
+ FXCursor: FXCursor | null;
55
+ FXControls?: FXControlAny[];
52
56
  }
53
57
 
54
58
  interface VideoCommonParams extends MediaCommonParams {
55
59
  coverUrl: string | null;
56
60
  }
57
61
 
58
- interface ImageCommonParams extends MediaCommonParams {
59
- hasGLEffect?: boolean;
60
- fragmentShader: string | null;
61
- FXCursor: FXCursor | null;
62
- FXControls?: FXControlAny[];
63
- }
62
+ interface ImageCommonParams extends MediaCommonParams {}
64
63
 
65
64
  interface RichTextCommonParams {
66
65
  text: string;
Binary file