@cntrl-site/sdk 1.3.0 → 1.4.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.
package/lib/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.KeyframeType = exports.AnchorSide = exports.ScaleAnchor = exports.ArticleItemType = exports.VerticalAlign = exports.TextTransform = exports.TextDecoration = exports.TextAlign = exports.SectionHeightMode = exports.getLayoutMediaQuery = exports.getLayoutStyles = exports.FontFaceGenerator = exports.CntrlClient = void 0;
3
+ exports.KeyframeType = exports.PositionType = exports.AnchorSide = exports.ScaleAnchor = exports.ArticleItemType = exports.VerticalAlign = exports.TextTransform = exports.TextDecoration = exports.TextAlign = exports.SectionHeightMode = exports.getLayoutMediaQuery = exports.getLayoutStyles = exports.FontFaceGenerator = exports.CntrlClient = void 0;
4
4
  // logic
5
5
  var Client_1 = require("./Client/Client");
6
6
  Object.defineProperty(exports, "CntrlClient", { enumerable: true, get: function () { return Client_1.Client; } });
@@ -22,5 +22,6 @@ Object.defineProperty(exports, "ArticleItemType", { enumerable: true, get: funct
22
22
  var ItemArea_1 = require("./types/article/ItemArea");
23
23
  Object.defineProperty(exports, "ScaleAnchor", { enumerable: true, get: function () { return ItemArea_1.ScaleAnchor; } });
24
24
  Object.defineProperty(exports, "AnchorSide", { enumerable: true, get: function () { return ItemArea_1.AnchorSide; } });
25
+ Object.defineProperty(exports, "PositionType", { enumerable: true, get: function () { return ItemArea_1.PositionType; } });
25
26
  var Keyframe_1 = require("./types/keyframe/Keyframe");
26
27
  Object.defineProperty(exports, "KeyframeType", { enumerable: true, get: function () { return Keyframe_1.KeyframeType; } });
@@ -9,7 +9,9 @@ const ArticleItemType_1 = require("../../types/article/ArticleItemType");
9
9
  const ImageItemSchema = ItemBase_schema_1.ItemBaseSchema.extend({
10
10
  type: zod_1.z.literal(ArticleItemType_1.ArticleItemType.Image),
11
11
  commonParams: zod_1.z.object({
12
- url: zod_1.z.string().min(1)
12
+ url: zod_1.z.string().min(1),
13
+ hasGLEffect: zod_1.z.boolean().optional(),
14
+ fragmentShader: zod_1.z.string().optional()
13
15
  }),
14
16
  sticky: zod_1.z.record(zod_1.z.object({
15
17
  from: zod_1.z.number(),
@@ -12,5 +12,6 @@ exports.ItemAreaSchema = zod_1.z.object({
12
12
  angle: zod_1.z.number(),
13
13
  anchorSide: zod_1.z.nativeEnum(ItemArea_1.AnchorSide).optional(),
14
14
  scale: zod_1.z.number().nonnegative(),
15
+ positionType: zod_1.z.nativeEnum(ItemArea_1.PositionType),
15
16
  scaleAnchor: zod_1.z.nativeEnum(ItemArea_1.ScaleAnchor)
16
17
  });
@@ -1,12 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ScaleAnchor = exports.AnchorSide = void 0;
3
+ exports.ScaleAnchor = exports.PositionType = exports.AnchorSide = void 0;
4
4
  var AnchorSide;
5
5
  (function (AnchorSide) {
6
6
  AnchorSide["Top"] = "top";
7
7
  AnchorSide["Bottom"] = "bottom";
8
8
  AnchorSide["Center"] = "center";
9
9
  })(AnchorSide = exports.AnchorSide || (exports.AnchorSide = {}));
10
+ var PositionType;
11
+ (function (PositionType) {
12
+ PositionType["SectionBased"] = "section-based";
13
+ PositionType["ScreenBased"] = "screen-based";
14
+ })(PositionType = exports.PositionType || (exports.PositionType = {}));
10
15
  var ScaleAnchor;
11
16
  (function (ScaleAnchor) {
12
17
  ScaleAnchor["TopLeft"] = "top-left";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cntrl-site/sdk",
3
- "version": "1.3.0",
3
+ "version": "1.4.1",
4
4
  "description": "Generic SDK for use in public websites.",
5
5
  "main": "lib/index.js",
6
6
  "types": "src/index.ts",
package/src/index.ts CHANGED
@@ -7,7 +7,7 @@ export { getLayoutStyles, getLayoutMediaQuery } from './utils';
7
7
  export { SectionHeightMode } from './types/article/Section';
8
8
  export { TextAlign, TextDecoration, TextTransform, VerticalAlign } from './types/article/RichText';
9
9
  export { ArticleItemType } from './types/article/ArticleItemType';
10
- export { ScaleAnchor, AnchorSide } from './types/article/ItemArea';
10
+ export { ScaleAnchor, AnchorSide, PositionType } from './types/article/ItemArea';
11
11
  export { KeyframeType } from './types/keyframe/Keyframe';
12
12
 
13
13
  // types
@@ -19,7 +19,9 @@ import { ArticleItemType } from '../../types/article/ArticleItemType';
19
19
  const ImageItemSchema = ItemBaseSchema.extend({
20
20
  type: z.literal(ArticleItemType.Image),
21
21
  commonParams: z.object({
22
- url: z.string().min(1)
22
+ url: z.string().min(1),
23
+ hasGLEffect: z.boolean().optional(),
24
+ fragmentShader: z.string().optional()
23
25
  }),
24
26
  sticky: z.record(
25
27
  z.object({
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { AnchorSide, ScaleAnchor } from '../../types/article/ItemArea';
2
+ import { AnchorSide, PositionType, ScaleAnchor } from '../../types/article/ItemArea';
3
3
 
4
4
  export const ItemAreaSchema = z.object({
5
5
  top: z.number(),
@@ -10,5 +10,6 @@ export const ItemAreaSchema = z.object({
10
10
  angle: z.number(),
11
11
  anchorSide: z.nativeEnum(AnchorSide).optional(),
12
12
  scale: z.number().nonnegative(),
13
+ positionType: z.nativeEnum(PositionType),
13
14
  scaleAnchor: z.nativeEnum(ScaleAnchor)
14
15
  });
@@ -43,7 +43,10 @@ interface MediaCommonParams {
43
43
 
44
44
  interface VideoCommonParams extends MediaCommonParams {}
45
45
 
46
- interface ImageCommonParams extends MediaCommonParams {}
46
+ interface ImageCommonParams extends MediaCommonParams {
47
+ hasGLEffect?: boolean;
48
+ fragmentShader?: string;
49
+ }
47
50
 
48
51
  interface RichTextCommonParams {
49
52
  text: string;
@@ -4,6 +4,11 @@ export enum AnchorSide {
4
4
  Center = 'center'
5
5
  }
6
6
 
7
+ export enum PositionType {
8
+ SectionBased = 'section-based',
9
+ ScreenBased = 'screen-based'
10
+ }
11
+
7
12
  export enum ScaleAnchor {
8
13
  TopLeft = 'top-left',
9
14
  TopCenter = 'top-center',
@@ -21,6 +26,7 @@ export interface ItemArea {
21
26
  left: number;
22
27
  width: number;
23
28
  height: number;
29
+ positionType: PositionType;
24
30
  zIndex: number;
25
31
  angle: number;
26
32
  anchorSide?: AnchorSide;