@cntrl-site/sdk 1.24.5 → 1.25.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.
Files changed (89) hide show
  1. package/lib/FontFaceGenerator/FontFaceGenerator.js +28 -0
  2. package/lib/ScrollPlaybackVideoManager/ScrollPlaybackVideoManager.js +221 -0
  3. package/lib/VideoDecoder/VideoDecoder.js +184 -0
  4. package/{dist → lib}/index.d.ts +0 -2
  5. package/lib/index.js +30 -0
  6. package/{dist → lib}/schemas/article/Article.schema.d.ts +12 -12
  7. package/{dist → lib}/schemas/article/ItemBase.schema.d.ts +10 -10
  8. package/{dist → lib}/schemas/article/RichTextItem.schema.d.ts +30 -30
  9. package/{dist → lib}/schemas/article/Section.schema.d.ts +3 -3
  10. package/{dist → lib}/types/keyframe/Keyframe.d.ts +1 -1
  11. package/lib/utils.js +30 -0
  12. package/package.json +9 -31
  13. package/dist/Client/Client.test.d.ts +0 -1
  14. package/dist/Client/__mock__/articleMock.d.ts +0 -2
  15. package/dist/Client/__mock__/keyframesMock.d.ts +0 -2
  16. package/dist/Client/__mock__/projectMock.d.ts +0 -2
  17. package/dist/Components/ControlSlider/ControlSlider.d.ts +0 -90
  18. package/dist/Components/ControlSlider/ControlSliderComponent.d.ts +0 -516
  19. package/dist/Components/ImageRevealSlider/ControlImageRevealSliderComponent.d.ts +0 -218
  20. package/dist/Components/ImageRevealSlider/ImageRevealSlider.d.ts +0 -38
  21. package/dist/Components/components.d.ts +0 -2
  22. package/dist/Components/helpers/RichTextRenderer/RichTextRenderer.d.ts +0 -6
  23. package/dist/Components/helpers/SvgImage/SvgImage.d.ts +0 -9
  24. package/dist/Components/utils/scalingValue.d.ts +0 -1
  25. package/dist/FontFaceGenerator/FontFaceGenerator.test.d.ts +0 -1
  26. package/dist/index.js +0 -2737
  27. package/dist/index.mjs +0 -2720
  28. package/dist/schemas/shared/FillLayer.schema.d.ts +0 -186
  29. package/dist/sdk.css +0 -1
  30. package/dist/types/component/Component.d.ts +0 -15
  31. /package/{dist → lib}/Client/Client.d.ts +0 -0
  32. /package/{dist → lib}/Client/Client.js +0 -0
  33. /package/{dist → lib}/FontFaceGenerator/FontFaceGenerator.d.ts +0 -0
  34. /package/{dist → lib}/ScrollPlaybackVideoManager/ScrollPlaybackVideoManager.d.ts +0 -0
  35. /package/{dist → lib}/VideoDecoder/VideoDecoder.d.ts +0 -0
  36. /package/{dist → lib}/cli.d.ts +0 -0
  37. /package/{dist → lib}/cli.js +0 -0
  38. /package/{dist → lib}/schemas/article/Article.schema.js +0 -0
  39. /package/{dist → lib}/schemas/article/FillLayer.schema.d.ts +0 -0
  40. /package/{dist → lib}/schemas/article/FillLayer.schema.js +0 -0
  41. /package/{dist → lib}/schemas/article/Interaction.schema.d.ts +0 -0
  42. /package/{dist → lib}/schemas/article/Interaction.schema.js +0 -0
  43. /package/{dist → lib}/schemas/article/Item.schema.d.ts +0 -0
  44. /package/{dist → lib}/schemas/article/Item.schema.js +0 -0
  45. /package/{dist → lib}/schemas/article/ItemArea.schema.d.ts +0 -0
  46. /package/{dist → lib}/schemas/article/ItemArea.schema.js +0 -0
  47. /package/{dist → lib}/schemas/article/ItemBase.schema.js +0 -0
  48. /package/{dist → lib}/schemas/article/ItemState.schema.d.ts +0 -0
  49. /package/{dist → lib}/schemas/article/ItemState.schema.js +0 -0
  50. /package/{dist → lib}/schemas/article/RichTextItem.schema.js +0 -0
  51. /package/{dist → lib}/schemas/article/Section.schema.js +0 -0
  52. /package/{dist → lib}/schemas/keyframe/Keyframes.schema.d.ts +0 -0
  53. /package/{dist → lib}/schemas/keyframe/Keyframes.schema.js +0 -0
  54. /package/{dist → lib}/schemas/project/Layout.schema.d.ts +0 -0
  55. /package/{dist → lib}/schemas/project/Layout.schema.js +0 -0
  56. /package/{dist → lib}/schemas/project/Project.schema.d.ts +0 -0
  57. /package/{dist → lib}/schemas/project/Project.schema.js +0 -0
  58. /package/{dist → lib}/types/article/Article.d.ts +0 -0
  59. /package/{dist → lib}/types/article/Article.js +0 -0
  60. /package/{dist → lib}/types/article/ArticleItemType.d.ts +0 -0
  61. /package/{dist → lib}/types/article/ArticleItemType.js +0 -0
  62. /package/{dist → lib}/types/article/CompoundSettings.d.ts +0 -0
  63. /package/{dist → lib}/types/article/CompoundSettings.js +0 -0
  64. /package/{dist → lib}/types/article/FX.d.ts +0 -0
  65. /package/{dist → lib}/types/article/FX.js +0 -0
  66. /package/{dist → lib}/types/article/Interaction.d.ts +0 -0
  67. /package/{dist → lib}/types/article/Interaction.js +0 -0
  68. /package/{dist → lib}/types/article/Item.d.ts +0 -0
  69. /package/{dist → lib}/types/article/Item.js +0 -0
  70. /package/{dist → lib}/types/article/ItemArea.d.ts +0 -0
  71. /package/{dist → lib}/types/article/ItemArea.js +0 -0
  72. /package/{dist → lib}/types/article/ItemState.d.ts +0 -0
  73. /package/{dist → lib}/types/article/ItemState.js +0 -0
  74. /package/{dist → lib}/types/article/RichText.d.ts +0 -0
  75. /package/{dist → lib}/types/article/RichText.js +0 -0
  76. /package/{dist → lib}/types/article/Section.d.ts +0 -0
  77. /package/{dist → lib}/types/article/Section.js +0 -0
  78. /package/{dist → lib}/types/keyframe/Keyframe.js +0 -0
  79. /package/{dist → lib}/types/project/Fonts.d.ts +0 -0
  80. /package/{dist → lib}/types/project/Fonts.js +0 -0
  81. /package/{dist → lib}/types/project/Layout.d.ts +0 -0
  82. /package/{dist → lib}/types/project/Layout.js +0 -0
  83. /package/{dist → lib}/types/project/Meta.d.ts +0 -0
  84. /package/{dist → lib}/types/project/Meta.js +0 -0
  85. /package/{dist → lib}/types/project/Page.d.ts +0 -0
  86. /package/{dist → lib}/types/project/Page.js +0 -0
  87. /package/{dist → lib}/types/project/Project.d.ts +0 -0
  88. /package/{dist → lib}/types/project/Project.js +0 -0
  89. /package/{dist → lib}/utils.d.ts +0 -0
@@ -54,10 +54,10 @@ export declare const RichTextItemSchema: z.ZodObject<{
54
54
  height: z.ZodNumber;
55
55
  zIndex: z.ZodNumber;
56
56
  angle: z.ZodNumber;
57
- anchorSide: z.ZodOptional<z.ZodNativeEnum<typeof import('../..').AnchorSide>>;
57
+ anchorSide: z.ZodOptional<z.ZodNativeEnum<typeof import("../..").AnchorSide>>;
58
58
  scale: z.ZodNumber;
59
- positionType: z.ZodNativeEnum<typeof import('../..').PositionType>;
60
- scaleAnchor: z.ZodNativeEnum<typeof import('../..').AreaAnchor>;
59
+ positionType: z.ZodNativeEnum<typeof import("../..").PositionType>;
60
+ scaleAnchor: z.ZodNativeEnum<typeof import("../..").AreaAnchor>;
61
61
  }, "strip", z.ZodTypeAny, {
62
62
  left: number;
63
63
  top: number;
@@ -66,9 +66,9 @@ export declare const RichTextItemSchema: z.ZodObject<{
66
66
  width: number;
67
67
  height: number;
68
68
  zIndex: number;
69
- positionType: import('../..').PositionType;
70
- scaleAnchor: import('../..').AreaAnchor;
71
- anchorSide?: import('../..').AnchorSide | undefined;
69
+ positionType: import("../..").PositionType;
70
+ scaleAnchor: import("../..").AreaAnchor;
71
+ anchorSide?: import("../..").AnchorSide | undefined;
72
72
  }, {
73
73
  left: number;
74
74
  top: number;
@@ -77,22 +77,22 @@ export declare const RichTextItemSchema: z.ZodObject<{
77
77
  width: number;
78
78
  height: number;
79
79
  zIndex: number;
80
- positionType: import('../..').PositionType;
81
- scaleAnchor: import('../..').AreaAnchor;
82
- anchorSide?: import('../..').AnchorSide | undefined;
80
+ positionType: import("../..").PositionType;
81
+ scaleAnchor: import("../..").AreaAnchor;
82
+ anchorSide?: import("../..").AnchorSide | undefined;
83
83
  }>>;
84
84
  compoundSettings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
85
- positionAnchor: z.ZodNativeEnum<typeof import('../..').AreaAnchor>;
86
- widthMode: z.ZodNativeEnum<typeof import('../..').DimensionMode>;
87
- heightMode: z.ZodNativeEnum<typeof import('../..').DimensionMode>;
85
+ positionAnchor: z.ZodNativeEnum<typeof import("../..").AreaAnchor>;
86
+ widthMode: z.ZodNativeEnum<typeof import("../..").DimensionMode>;
87
+ heightMode: z.ZodNativeEnum<typeof import("../..").DimensionMode>;
88
88
  }, "strip", z.ZodTypeAny, {
89
- positionAnchor: import('../..').AreaAnchor;
90
- widthMode: import('../..').DimensionMode;
91
- heightMode: import('../..').DimensionMode;
89
+ positionAnchor: import("../..").AreaAnchor;
90
+ widthMode: import("../..").DimensionMode;
91
+ heightMode: import("../..").DimensionMode;
92
92
  }, {
93
- positionAnchor: import('../..').AreaAnchor;
94
- widthMode: import('../..').DimensionMode;
95
- heightMode: import('../..').DimensionMode;
93
+ positionAnchor: import("../..").AreaAnchor;
94
+ widthMode: import("../..").DimensionMode;
95
+ heightMode: import("../..").DimensionMode;
96
96
  }>>>;
97
97
  type: z.ZodLiteral<ArticleItemType.RichText>;
98
98
  commonParams: z.ZodObject<{
@@ -1001,9 +1001,9 @@ export declare const RichTextItemSchema: z.ZodObject<{
1001
1001
  width: number;
1002
1002
  height: number;
1003
1003
  zIndex: number;
1004
- positionType: import('../..').PositionType;
1005
- scaleAnchor: import('../..').AreaAnchor;
1006
- anchorSide?: import('../..').AnchorSide | undefined;
1004
+ positionType: import("../..").PositionType;
1005
+ scaleAnchor: import("../..").AreaAnchor;
1006
+ anchorSide?: import("../..").AnchorSide | undefined;
1007
1007
  }>;
1008
1008
  layoutParams: Record<string, {
1009
1009
  color: string;
@@ -1174,9 +1174,9 @@ export declare const RichTextItemSchema: z.ZodObject<{
1174
1174
  target: string;
1175
1175
  } | undefined;
1176
1176
  compoundSettings?: Record<string, {
1177
- positionAnchor: import('../..').AreaAnchor;
1178
- widthMode: import('../..').DimensionMode;
1179
- heightMode: import('../..').DimensionMode;
1177
+ positionAnchor: import("../..").AreaAnchor;
1178
+ widthMode: import("../..").DimensionMode;
1179
+ heightMode: import("../..").DimensionMode;
1180
1180
  }> | undefined;
1181
1181
  }, {
1182
1182
  hidden: Record<string, boolean>;
@@ -1190,9 +1190,9 @@ export declare const RichTextItemSchema: z.ZodObject<{
1190
1190
  width: number;
1191
1191
  height: number;
1192
1192
  zIndex: number;
1193
- positionType: import('../..').PositionType;
1194
- scaleAnchor: import('../..').AreaAnchor;
1195
- anchorSide?: import('../..').AnchorSide | undefined;
1193
+ positionType: import("../..").PositionType;
1194
+ scaleAnchor: import("../..").AreaAnchor;
1195
+ anchorSide?: import("../..").AnchorSide | undefined;
1196
1196
  }>;
1197
1197
  layoutParams: Record<string, {
1198
1198
  color: string;
@@ -1363,8 +1363,8 @@ export declare const RichTextItemSchema: z.ZodObject<{
1363
1363
  target: string;
1364
1364
  } | undefined;
1365
1365
  compoundSettings?: Record<string, {
1366
- positionAnchor: import('../..').AreaAnchor;
1367
- widthMode: import('../..').DimensionMode;
1368
- heightMode: import('../..').DimensionMode;
1366
+ positionAnchor: import("../..").AreaAnchor;
1367
+ widthMode: import("../..").DimensionMode;
1368
+ heightMode: import("../..").DimensionMode;
1369
1369
  }> | undefined;
1370
1370
  }>;
@@ -58,7 +58,7 @@ export declare const SectionMediaSchema: z.ZodDiscriminatedUnion<"type", [z.ZodO
58
58
  }>]>;
59
59
  export declare const SectionSchema: z.ZodObject<{
60
60
  id: z.ZodString;
61
- items: z.ZodArray<z.ZodType<import('../..').ItemAny, z.ZodTypeDef, import('../..').ItemAny>, "many">;
61
+ items: z.ZodArray<z.ZodType<import("../..").ItemAny, z.ZodTypeDef, import("../..").ItemAny>, "many">;
62
62
  name: z.ZodOptional<z.ZodString>;
63
63
  height: z.ZodRecord<z.ZodString, z.ZodObject<{
64
64
  mode: z.ZodNativeEnum<typeof SectionHeightMode>;
@@ -129,7 +129,7 @@ export declare const SectionSchema: z.ZodObject<{
129
129
  units: number;
130
130
  vhUnits?: number | undefined;
131
131
  }>;
132
- items: import('../..').ItemAny[];
132
+ items: import("../..").ItemAny[];
133
133
  name?: string | undefined;
134
134
  media?: Record<string, {
135
135
  url: string;
@@ -156,7 +156,7 @@ export declare const SectionSchema: z.ZodObject<{
156
156
  units: number;
157
157
  vhUnits?: number | undefined;
158
158
  }>;
159
- items: import('../..').ItemAny[];
159
+ items: import("../..").ItemAny[];
160
160
  name?: string | undefined;
161
161
  media?: Record<string, {
162
162
  url: string;
@@ -1,4 +1,4 @@
1
- import { FillLayer } from '../article/Item';
1
+ import { FillLayer } from "../article/Item";
2
2
  export type KeyframeAny = Keyframe<KeyframeType>;
3
3
  export interface Keyframe<T extends KeyframeType> {
4
4
  id: string;
package/lib/utils.js ADDED
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getLayoutStyles = getLayoutStyles;
4
+ exports.getLayoutMediaQuery = getLayoutMediaQuery;
5
+ function getLayoutStyles(layouts, layoutValues, mapToStyles) {
6
+ const mediaQueries = layouts
7
+ .sort((a, b) => a.startsWith - b.startsWith)
8
+ .reduce((acc, layout) => {
9
+ const values = layoutValues.map(lv => lv[layout.id]);
10
+ return `
11
+ ${acc}
12
+ ${layout.startsWith !== 0
13
+ ? `@media (min-width: ${layout.startsWith}px) {${mapToStyles(values, layout.exemplary)}}`
14
+ : `${mapToStyles(values, layout.exemplary)}`}`;
15
+ }, '');
16
+ return mediaQueries;
17
+ }
18
+ function getLayoutMediaQuery(layoutId, layouts) {
19
+ const sorted = layouts.slice().sort((a, b) => a.startsWith - b.startsWith);
20
+ const layoutIndex = sorted.findIndex(l => l.id === layoutId);
21
+ if (layoutIndex === -1) {
22
+ throw new Error(`No layout was found by the given id #${layoutId}`);
23
+ }
24
+ const current = sorted[layoutIndex];
25
+ const next = sorted[layoutIndex + 1];
26
+ if (!next) {
27
+ return `@media (min-width: ${current.startsWith}px)`;
28
+ }
29
+ return `@media (min-width: ${current.startsWith}px) and (max-width: ${next.startsWith - 1}px)`;
30
+ }
package/package.json CHANGED
@@ -1,36 +1,20 @@
1
1
  {
2
2
  "name": "@cntrl-site/sdk",
3
- "version": "1.24.5",
3
+ "version": "1.25.0",
4
4
  "description": "Generic SDK for use in public websites.",
5
- "main": "dist/index.js",
6
- "module": "dist/index.mjs",
7
- "types": "dist/index.d.ts",
8
- "style": "dist/sdk.css",
9
- "sideEffects": [
10
- "**/*.css"
11
- ],
12
- "exports": {
13
- ".": {
14
- "types": "./dist/index.d.ts",
15
- "import": "./dist/index.mjs",
16
- "require": "./dist/index.js"
17
- },
18
- "./style/sdk.css": {
19
- "default": "./dist/sdk.css"
20
- }
21
- },
5
+ "main": "lib/index.js",
6
+ "types": "lib/index.d.ts",
22
7
  "scripts": {
23
8
  "test": "jest",
24
- "dev": "vite development",
25
- "prebuild": "rimraf ./dist",
26
- "build": "vite build && tsc --project tsconfig.build.json",
9
+ "prebuild": "rimraf ./lib",
10
+ "build": "tsc --project tsconfig.build.json",
27
11
  "prepublishOnly": "cross-env NODE_ENV=production npm run build"
28
12
  },
29
13
  "bin": {
30
- "cntrl-sdk": "dist/cli.js"
14
+ "cntrl-sdk": "lib/cli.js"
31
15
  },
32
16
  "files": [
33
- "dist",
17
+ "lib",
34
18
  "resources"
35
19
  ],
36
20
  "repository": {
@@ -44,14 +28,13 @@
44
28
  },
45
29
  "homepage": "https://github.com/cntrl-site/sdk#readme",
46
30
  "directories": {
47
- "lib": "dist"
31
+ "lib": "lib"
48
32
  },
49
33
  "dependencies": {
50
34
  "@splidejs/react-splide": "^0.7.12",
51
35
  "@types/ejs": "^3.1.2",
52
36
  "@types/isomorphic-fetch": "^0.0.36",
53
37
  "@types/ua-parser-js": "^0.7.39",
54
- "classnames": "^2.5.1",
55
38
  "commander": "^10.0.1",
56
39
  "dotenv": "^16.1.3",
57
40
  "ejs": "^3.1.9",
@@ -73,12 +56,7 @@
73
56
  "@vitejs/plugin-react": "^4.3.4",
74
57
  "cross-env": "^10.1.0",
75
58
  "jest": "^28.1.3",
76
- "react": "^18.2.0",
77
- "react-dom": "^18.2.0",
78
- "sass": "^1.86.3",
79
59
  "ts-jest": "^28.0.8",
80
- "typescript": "^5.2.2",
81
- "vite": "^6.2.5",
82
- "vite-plugin-dts": "^4.5.3"
60
+ "typescript": "^5.2.2"
83
61
  }
84
62
  }
@@ -1 +0,0 @@
1
- export {};
@@ -1,2 +0,0 @@
1
- import { Article } from '../../types/article/Article';
2
- export declare const articleMock: Article;
@@ -1,2 +0,0 @@
1
- import { KeyframeAny } from '../../types/keyframe/Keyframe';
2
- export declare const keyframesMock: KeyframeAny[];
@@ -1,2 +0,0 @@
1
- import { Project } from '../../types/project/Project';
2
- export declare const projectMock: Project;
@@ -1,90 +0,0 @@
1
- interface SliderProps {
2
- settings: SliderSettings;
3
- content: SliderItem[];
4
- styles: SliderStyles;
5
- isEditor?: boolean;
6
- }
7
- export declare function ControlSlider({ settings, content, styles: sliderStyles, isEditor }: SliderProps): JSX.Element;
8
- type SliderItem = {
9
- image: {
10
- url: string;
11
- name?: string;
12
- objectFit?: 'cover' | 'contain';
13
- };
14
- imageCaption: any[];
15
- };
16
- type Offset = {
17
- x: number;
18
- y: number;
19
- };
20
- type SliderControls = {
21
- arrowsImgUrl: string | null;
22
- isActive: boolean;
23
- color: string;
24
- hover: string;
25
- offset: Offset;
26
- scale: number;
27
- };
28
- type SliderPagination = {
29
- position: 'outside-1' | 'outside-2' | 'inside-1' | 'inside-2';
30
- isActive: boolean;
31
- scale: number;
32
- offset: Offset;
33
- colors: string[];
34
- hover: string;
35
- };
36
- type Alignment = 'top-left' | 'top-center' | 'top-right' | 'middle-left' | 'middle-center' | 'middle-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
37
- type SliderCaption = {
38
- alignment: Alignment;
39
- isActive: boolean;
40
- color: string;
41
- offset: Offset;
42
- hover: string;
43
- };
44
- type Triggers = {
45
- triggersList: {
46
- click: boolean;
47
- drag: boolean;
48
- };
49
- autoPlay: string | null;
50
- };
51
- type SliderSettings = {
52
- controls: SliderControls;
53
- pagination: SliderPagination;
54
- direction: 'horiz' | 'vert';
55
- transition: {
56
- type: 'slide' | 'fade in';
57
- duration: string;
58
- backgroundColor: string | null;
59
- };
60
- caption: SliderCaption;
61
- triggers: Triggers;
62
- };
63
- type CaptionStyles = {
64
- fontSettings: {
65
- fontFamily: string;
66
- fontWeight: number;
67
- fontStyle: string;
68
- };
69
- widthSettings: {
70
- width: number;
71
- sizing: 'auto' | 'manual';
72
- };
73
- letterSpacing: number;
74
- textAlign: 'left' | 'center' | 'right';
75
- wordSpacing: number;
76
- fontSizeLineHeight: {
77
- fontSize: number;
78
- lineHeight: number;
79
- };
80
- textAppearance: {
81
- textTransform: 'none' | 'uppercase' | 'lowercase';
82
- textDecoration: 'none' | 'underline';
83
- fontVariant: 'normal' | 'small-caps';
84
- };
85
- color: string;
86
- };
87
- type SliderStyles = {
88
- caption: CaptionStyles;
89
- };
90
- export {};