@cntrl-site/sdk 1.25.2 → 1.25.3

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/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2022 CNTRL
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2022 CNTRL
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,2 +1,2 @@
1
- # CNTRL SDK
2
- This is a root SDK module for CNTRL. Should be used along with other framework-specific modules like `@cntrl-site/sdk-react`
1
+ # CNTRL SDK
2
+ This is a root SDK module for CNTRL. Should be used along with other framework-specific modules like `@cntrl-site/sdk-react`
@@ -15,12 +15,12 @@ class FontFaceGenerator {
15
15
  const otherFiles = font.files
16
16
  .filter(file => file.type !== 'eot')
17
17
  .map(file => `url('${file.url}') format('${FILE_TYPES_MAP[file.type] || file.type}')`);
18
- return `
19
- @font-face {
20
- font-family: "${font.name}";
21
- font-weight: ${font.weight};
22
- font-style: ${font.style};
23
- ${eotFile ? `src: url('${eotFile.url}');\n ` : ''}src: ${otherFiles.join(', ')};
18
+ return `
19
+ @font-face {
20
+ font-family: "${font.name}";
21
+ font-weight: ${font.weight};
22
+ font-style: ${font.style};
23
+ ${eotFile ? `src: url('${eotFile.url}');\n ` : ''}src: ${otherFiles.join(', ')};
24
24
  }`;
25
25
  }).join('\n');
26
26
  }
@@ -47,7 +47,8 @@ const ImageItemSchema = ItemBase_schema_1.ItemBaseSchema.extend({
47
47
  strokeWidth: zod_1.z.number(),
48
48
  strokeFill: zod_1.z.array(FillLayer_schema_1.FillLayerSchema),
49
49
  blur: zod_1.z.number(),
50
- isDraggable: zod_1.z.boolean().optional()
50
+ isDraggable: zod_1.z.boolean().optional(),
51
+ blendMode: zod_1.z.string().optional()
51
52
  })),
52
53
  state: zod_1.z.record(ItemState_schema_1.MediaStateParamsSchema)
53
54
  });
@@ -72,6 +73,7 @@ const VideoItemSchema = ItemBase_schema_1.ItemBaseSchema.extend({
72
73
  strokeFill: zod_1.z.array(FillLayer_schema_1.FillLayerSchema),
73
74
  blur: zod_1.z.number(),
74
75
  isDraggable: zod_1.z.boolean().optional(),
76
+ blendMode: zod_1.z.string().optional(),
75
77
  play: zod_1.z.enum(['on-hover', 'on-click', 'auto']),
76
78
  muted: zod_1.z.boolean(),
77
79
  controls: zod_1.z.boolean(),
@@ -96,7 +98,8 @@ const RectangleItemSchema = ItemBase_schema_1.ItemBaseSchema.extend({
96
98
  blur: zod_1.z.number(),
97
99
  backdropBlur: zod_1.z.number(),
98
100
  blurMode: zod_1.z.enum(['default', 'backdrop']),
99
- isDraggable: zod_1.z.boolean().optional()
101
+ isDraggable: zod_1.z.boolean().optional(),
102
+ blendMode: zod_1.z.string().optional()
100
103
  })),
101
104
  state: zod_1.z.record(ItemState_schema_1.RectangleStateParamsSchema)
102
105
  });
@@ -111,7 +114,8 @@ const CustomItemSchema = ItemBase_schema_1.ItemBaseSchema.extend({
111
114
  to: zod_1.z.number().optional()
112
115
  }).nullable()),
113
116
  layoutParams: zod_1.z.record(zod_1.z.object({
114
- isDraggable: zod_1.z.boolean().optional()
117
+ isDraggable: zod_1.z.boolean().optional(),
118
+ blendMode: zod_1.z.string().optional()
115
119
  })),
116
120
  state: zod_1.z.record(ItemState_schema_1.CustomItemStateParamsSchema)
117
121
  });
@@ -135,7 +139,8 @@ const VimeoEmbedItemSchema = ItemBase_schema_1.ItemBaseSchema.extend({
135
139
  controls: zod_1.z.boolean(),
136
140
  loop: zod_1.z.boolean(),
137
141
  muted: zod_1.z.boolean(),
138
- pictureInPicture: zod_1.z.boolean()
142
+ pictureInPicture: zod_1.z.boolean(),
143
+ blendMode: zod_1.z.string().optional()
139
144
  })),
140
145
  state: zod_1.z.record(ItemState_schema_1.EmbedStateParamsSchema)
141
146
  });
@@ -157,6 +162,7 @@ const YoutubeEmbedItemSchema = ItemBase_schema_1.ItemBaseSchema.extend({
157
162
  play: zod_1.z.enum(['on-hover', 'on-click', 'auto']),
158
163
  controls: zod_1.z.boolean(),
159
164
  loop: zod_1.z.boolean(),
165
+ blendMode: zod_1.z.string().optional()
160
166
  })),
161
167
  state: zod_1.z.record(ItemState_schema_1.EmbedStateParamsSchema)
162
168
  });
@@ -176,7 +182,8 @@ const CodeEmbedItemSchema = ItemBase_schema_1.ItemBaseSchema.extend({
176
182
  areaAnchor: zod_1.z.nativeEnum(ItemArea_1.AreaAnchor),
177
183
  opacity: zod_1.z.number().nonnegative(),
178
184
  blur: zod_1.z.number(),
179
- isDraggable: zod_1.z.boolean().optional()
185
+ isDraggable: zod_1.z.boolean().optional(),
186
+ blendMode: zod_1.z.string().optional()
180
187
  })),
181
188
  state: zod_1.z.record(ItemState_schema_1.CodeEmbedStateParamsSchema)
182
189
  });
@@ -220,7 +227,7 @@ exports.ItemSchema = zod_1.z.lazy(() => zod_1.z.discriminatedUnion('type', [
220
227
  layoutParams: zod_1.z.record(zod_1.z.object({
221
228
  opacity: zod_1.z.number().nonnegative(),
222
229
  blur: zod_1.z.number(),
223
- isDraggable: zod_1.z.boolean().optional()
230
+ blendMode: zod_1.z.string().optional()
224
231
  })),
225
232
  state: zod_1.z.record(ItemState_schema_1.GroupStateParamsSchema)
226
233
  }),
@@ -237,7 +244,7 @@ exports.ItemSchema = zod_1.z.lazy(() => zod_1.z.discriminatedUnion('type', [
237
244
  }).nullable()),
238
245
  layoutParams: zod_1.z.record(zod_1.z.object({
239
246
  opacity: zod_1.z.number().nonnegative(),
240
- isDraggable: zod_1.z.boolean().optional()
247
+ blendMode: zod_1.z.string().optional()
241
248
  })),
242
249
  state: zod_1.z.record(ItemState_schema_1.CompoundStateParamsSchema)
243
250
  })
@@ -150,6 +150,7 @@ export declare const RichTextItemSchema: z.ZodObject<{
150
150
  fontWeight: z.ZodNumber;
151
151
  fontVariant: z.ZodString;
152
152
  isDraggable: z.ZodOptional<z.ZodBoolean>;
153
+ blendMode: z.ZodOptional<z.ZodString>;
153
154
  }, "strip", z.ZodTypeAny, {
154
155
  color: string;
155
156
  letterSpacing: number;
@@ -172,6 +173,7 @@ export declare const RichTextItemSchema: z.ZodObject<{
172
173
  value?: string | undefined;
173
174
  }[] | undefined;
174
175
  isDraggable?: boolean | undefined;
176
+ blendMode?: string | undefined;
175
177
  }, {
176
178
  color: string;
177
179
  letterSpacing: number;
@@ -194,6 +196,7 @@ export declare const RichTextItemSchema: z.ZodObject<{
194
196
  value?: string | undefined;
195
197
  }[] | undefined;
196
198
  isDraggable?: boolean | undefined;
199
+ blendMode?: string | undefined;
197
200
  }>>;
198
201
  state: z.ZodRecord<z.ZodString, z.ZodObject<{
199
202
  color: z.ZodOptional<z.ZodObject<{
@@ -1027,6 +1030,7 @@ export declare const RichTextItemSchema: z.ZodObject<{
1027
1030
  value?: string | undefined;
1028
1031
  }[] | undefined;
1029
1032
  isDraggable?: boolean | undefined;
1033
+ blendMode?: string | undefined;
1030
1034
  }>;
1031
1035
  commonParams: {
1032
1036
  text: string;
@@ -1216,6 +1220,7 @@ export declare const RichTextItemSchema: z.ZodObject<{
1216
1220
  value?: string | undefined;
1217
1221
  }[] | undefined;
1218
1222
  isDraggable?: boolean | undefined;
1223
+ blendMode?: string | undefined;
1219
1224
  }>;
1220
1225
  commonParams: {
1221
1226
  text: string;
@@ -54,7 +54,8 @@ exports.RichTextItemSchema = ItemBase_schema_1.ItemBaseSchema.extend({
54
54
  fontStyle: zod_1.z.string(),
55
55
  fontWeight: zod_1.z.number(),
56
56
  fontVariant: zod_1.z.string(),
57
- isDraggable: zod_1.z.boolean().optional()
57
+ isDraggable: zod_1.z.boolean().optional(),
58
+ blendMode: zod_1.z.string().optional()
58
59
  })),
59
60
  state: zod_1.z.record(ItemState_schema_1.RichTextStateParamsSchema)
60
61
  });
@@ -97,24 +97,29 @@ interface MediaLayoutParams {
97
97
  strokeFill: FillLayer[];
98
98
  blur: number;
99
99
  isDraggable?: boolean;
100
+ blendMode?: string;
100
101
  }
101
102
  interface CustomLayoutParams {
102
103
  isDraggable?: boolean;
104
+ blendMode?: string;
103
105
  }
104
106
  interface GroupLayoutParams {
105
107
  opacity: number;
106
108
  blur: number;
107
109
  isDraggable?: boolean;
110
+ blendMode?: string;
108
111
  }
109
112
  interface CompoundLayoutParams {
110
113
  opacity: number;
111
114
  isDraggable?: boolean;
115
+ blendMode?: string;
112
116
  }
113
117
  interface CodeEmbedLayoutParams {
114
118
  areaAnchor: AreaAnchor;
115
119
  opacity: number;
116
120
  blur: number;
117
121
  isDraggable?: boolean;
122
+ blendMode?: string;
118
123
  }
119
124
  interface VimeoEmbedLayoutParams {
120
125
  play: 'on-hover' | 'on-click' | 'auto';
@@ -125,6 +130,7 @@ interface VimeoEmbedLayoutParams {
125
130
  radius: number;
126
131
  blur: number;
127
132
  opacity: number;
133
+ blendMode?: string;
128
134
  }
129
135
  interface YoutubeEmbedLayoutParams {
130
136
  play: 'on-hover' | 'on-click' | 'auto';
@@ -133,6 +139,7 @@ interface YoutubeEmbedLayoutParams {
133
139
  radius: number;
134
140
  blur: number;
135
141
  opacity: number;
142
+ blendMode?: string;
136
143
  }
137
144
  interface ImageLayoutParams extends MediaLayoutParams {
138
145
  }
@@ -159,6 +166,7 @@ interface RichTextLayoutParams {
159
166
  fontWeight: number;
160
167
  fontVariant: string;
161
168
  isDraggable?: boolean;
169
+ blendMode?: string;
162
170
  }
163
171
  interface RectangleLayoutParams {
164
172
  radius: number;
@@ -169,6 +177,7 @@ interface RectangleLayoutParams {
169
177
  backdropBlur: number;
170
178
  blurMode: 'default' | 'backdrop';
171
179
  isDraggable?: boolean;
180
+ blendMode?: string;
172
181
  }
173
182
  export type FillLayer = SolidFillLayer | LinearGradientFillLayer | RadialGradientFillLayer | ConicGradientFillLayer | ImageLayer;
174
183
  type ColorPoint = {
package/lib/utils.js CHANGED
@@ -8,8 +8,8 @@ function getLayoutStyles(layouts, layoutValues, mapToStyles) {
8
8
  .sort((a, b) => a.startsWith - b.startsWith)
9
9
  .reduce((acc, layout) => {
10
10
  const values = layoutValues.map(lv => lv[layout.id]);
11
- return `
12
- ${acc}
11
+ return `
12
+ ${acc}
13
13
  ${layout.startsWith !== 0
14
14
  ? `@media (min-width: ${layout.startsWith}px) {${mapToStyles(values, layout.exemplary)}}`
15
15
  : `${mapToStyles(values, layout.exemplary)}`}`;
package/package.json CHANGED
@@ -1,62 +1,62 @@
1
- {
2
- "name": "@cntrl-site/sdk",
3
- "version": "1.25.2",
4
- "description": "Generic SDK for use in public websites.",
5
- "main": "lib/index.js",
6
- "types": "lib/index.d.ts",
7
- "scripts": {
8
- "test": "jest",
9
- "prebuild": "rimraf ./lib",
10
- "build": "tsc --project tsconfig.build.json",
11
- "prepublishOnly": "cross-env NODE_ENV=production npm run build"
12
- },
13
- "bin": {
14
- "cntrl-sdk": "lib/cli.js"
15
- },
16
- "files": [
17
- "lib",
18
- "resources"
19
- ],
20
- "repository": {
21
- "type": "git",
22
- "url": "git+https://github.com/cntrl-site/sdk.git"
23
- },
24
- "author": "arsen@momdesign.nyc",
25
- "license": "MIT",
26
- "bugs": {
27
- "url": "https://github.com/cntrl-site/sdk/issues"
28
- },
29
- "homepage": "https://github.com/cntrl-site/sdk#readme",
30
- "directories": {
31
- "lib": "lib"
32
- },
33
- "dependencies": {
34
- "@splidejs/react-splide": "^0.7.12",
35
- "@types/ejs": "^3.1.2",
36
- "@types/isomorphic-fetch": "^0.0.36",
37
- "@types/ua-parser-js": "^0.7.39",
38
- "commander": "^10.0.1",
39
- "dotenv": "^16.1.3",
40
- "ejs": "^3.1.9",
41
- "isomorphic-fetch": "^3.0.0",
42
- "mp4box": "^0.5.2",
43
- "styled-jsx": "^5.1.6",
44
- "ts-node": "^10.9.1",
45
- "ua-parser-js": "^1.0.37",
46
- "url": "^0.11.0",
47
- "zod": "^3.22.4"
48
- },
49
- "devDependencies": {
50
- "@tsconfig/node16": "^1.0.3",
51
- "@tsconfig/recommended": "^1.0.1",
52
- "@types/jest": "^29.0.0",
53
- "@types/node": "^18.11.7",
54
- "@types/react": "^18.2.0",
55
- "@types/react-dom": "^18.2.0",
56
- "@vitejs/plugin-react": "^4.3.4",
57
- "cross-env": "^10.1.0",
58
- "jest": "^28.1.3",
59
- "ts-jest": "^28.0.8",
60
- "typescript": "^5.2.2"
61
- }
62
- }
1
+ {
2
+ "name": "@cntrl-site/sdk",
3
+ "version": "1.25.3",
4
+ "description": "Generic SDK for use in public websites.",
5
+ "main": "lib/index.js",
6
+ "types": "lib/index.d.ts",
7
+ "scripts": {
8
+ "test": "jest",
9
+ "prebuild": "rimraf ./lib",
10
+ "build": "tsc --project tsconfig.build.json",
11
+ "prepublishOnly": "cross-env NODE_ENV=production npm run build"
12
+ },
13
+ "bin": {
14
+ "cntrl-sdk": "lib/cli.js"
15
+ },
16
+ "files": [
17
+ "lib",
18
+ "resources"
19
+ ],
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "git+https://github.com/cntrl-site/sdk.git"
23
+ },
24
+ "author": "arsen@momdesign.nyc",
25
+ "license": "MIT",
26
+ "bugs": {
27
+ "url": "https://github.com/cntrl-site/sdk/issues"
28
+ },
29
+ "homepage": "https://github.com/cntrl-site/sdk#readme",
30
+ "directories": {
31
+ "lib": "lib"
32
+ },
33
+ "dependencies": {
34
+ "@splidejs/react-splide": "^0.7.12",
35
+ "@types/ejs": "^3.1.2",
36
+ "@types/isomorphic-fetch": "^0.0.36",
37
+ "@types/ua-parser-js": "^0.7.39",
38
+ "commander": "^10.0.1",
39
+ "dotenv": "^16.1.3",
40
+ "ejs": "^3.1.9",
41
+ "isomorphic-fetch": "^3.0.0",
42
+ "mp4box": "^0.5.2",
43
+ "styled-jsx": "^5.1.6",
44
+ "ts-node": "^10.9.1",
45
+ "ua-parser-js": "^1.0.37",
46
+ "url": "^0.11.0",
47
+ "zod": "^3.22.4"
48
+ },
49
+ "devDependencies": {
50
+ "@tsconfig/node16": "^1.0.3",
51
+ "@tsconfig/recommended": "^1.0.1",
52
+ "@types/jest": "^29.0.0",
53
+ "@types/node": "^18.11.7",
54
+ "@types/react": "^18.2.0",
55
+ "@types/react-dom": "^18.2.0",
56
+ "@vitejs/plugin-react": "^4.3.4",
57
+ "cross-env": "^10.1.0",
58
+ "jest": "^28.1.3",
59
+ "ts-jest": "^28.0.8",
60
+ "typescript": "^5.2.2"
61
+ }
62
+ }
@@ -1,50 +1,50 @@
1
- // CAUTION: THIS FILE IS AUTO-GENERATED BASED ON
2
- // LAYOUT CONFIGURATION IN YOUR CNTRL PROJECT
3
- // WE HIGHLY ADVICE YOU TO NOT CHANGE IT MANUALLY
4
- @use "sass:map";
5
-
6
- $__CNTRL_LAYOUT_WIDTH__: <%= ranges[0].exemplary %>;
7
-
8
- $layout: (
9
- <% ranges.forEach(function(range) { %>
10
- <%= range.name %>: (
11
- start: <%= range.start %>,
12
- end: <%= range.end %>,
13
- exemplary: <%= range.exemplary %>,
14
- isFirst: <%= range.isFirst %>,
15
- isLast: <%= range.isLast %>
16
- ),
17
- <% }); %>
18
- );
19
-
20
- @function size($value) {
21
- @return #{$value/$__CNTRL_LAYOUT_WIDTH__*100}vw;
22
- }
23
-
24
- @mixin for($name) {
25
- $start: map.get(map.get($layout, $name), "start");
26
- $end: map.get(map.get($layout, $name), "end");
27
- $isFirst: map.get(map.get($layout, $name), "isFirst");
28
- $isLast: map.get(map.get($layout, $name), "isLast");
29
- $exemplary: map.get(map.get($layout, $name), "exemplary");
30
- $__CNTRL_LAYOUT_WIDTH__: $exemplary !global;
31
-
32
- @if $isFirst == true and $isLast == true {
33
- @content;
34
- } @else if $isFirst == true {
35
- @media (max-width: #{$end}px) {
36
- @content;
37
- }
38
- } @else if $isLast == true {
39
- @media (min-width: #{$start}px) {
40
- @content;
41
- }
42
- } @else {
43
- @media (min-width: #{$start}px) and (max-width: #{$end}px) {
44
- @content;
45
- }
46
- }
47
-
48
- // reset global variable back to first layout's exemplary (mobile-first)
49
- $__CNTRL_LAYOUT_WIDTH__: <%= ranges[0].exemplary %> !global;
50
- }
1
+ // CAUTION: THIS FILE IS AUTO-GENERATED BASED ON
2
+ // LAYOUT CONFIGURATION IN YOUR CNTRL PROJECT
3
+ // WE HIGHLY ADVICE YOU TO NOT CHANGE IT MANUALLY
4
+ @use "sass:map";
5
+
6
+ $__CNTRL_LAYOUT_WIDTH__: <%= ranges[0].exemplary %>;
7
+
8
+ $layout: (
9
+ <% ranges.forEach(function(range) { %>
10
+ <%= range.name %>: (
11
+ start: <%= range.start %>,
12
+ end: <%= range.end %>,
13
+ exemplary: <%= range.exemplary %>,
14
+ isFirst: <%= range.isFirst %>,
15
+ isLast: <%= range.isLast %>
16
+ ),
17
+ <% }); %>
18
+ );
19
+
20
+ @function size($value) {
21
+ @return #{$value/$__CNTRL_LAYOUT_WIDTH__*100}vw;
22
+ }
23
+
24
+ @mixin for($name) {
25
+ $start: map.get(map.get($layout, $name), "start");
26
+ $end: map.get(map.get($layout, $name), "end");
27
+ $isFirst: map.get(map.get($layout, $name), "isFirst");
28
+ $isLast: map.get(map.get($layout, $name), "isLast");
29
+ $exemplary: map.get(map.get($layout, $name), "exemplary");
30
+ $__CNTRL_LAYOUT_WIDTH__: $exemplary !global;
31
+
32
+ @if $isFirst == true and $isLast == true {
33
+ @content;
34
+ } @else if $isFirst == true {
35
+ @media (max-width: #{$end}px) {
36
+ @content;
37
+ }
38
+ } @else if $isLast == true {
39
+ @media (min-width: #{$start}px) {
40
+ @content;
41
+ }
42
+ } @else {
43
+ @media (min-width: #{$start}px) and (max-width: #{$end}px) {
44
+ @content;
45
+ }
46
+ }
47
+
48
+ // reset global variable back to first layout's exemplary (mobile-first)
49
+ $__CNTRL_LAYOUT_WIDTH__: <%= ranges[0].exemplary %> !global;
50
+ }