@cntrl-site/sdk 1.22.21 → 1.23.1-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 (82) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +2 -2
  3. package/package.json +79 -79
  4. package/resources/template.scss.ejs +50 -50
  5. package/dist/Client/Client.d.ts +0 -32
  6. package/dist/Client/Client.js +0 -128
  7. package/dist/Client/Client.test.d.ts +0 -1
  8. package/dist/Client/__mock__/articleMock.d.ts +0 -2
  9. package/dist/Client/__mock__/keyframesMock.d.ts +0 -2
  10. package/dist/Client/__mock__/projectMock.d.ts +0 -2
  11. package/dist/Components/ControlSlider/ControlSlider.d.ts +0 -90
  12. package/dist/Components/ControlSlider/ControlSliderComponent.d.ts +0 -500
  13. package/dist/Components/components.d.ts +0 -2
  14. package/dist/Components/helpers/RichTextRenderer/RichTextRenderer.d.ts +0 -6
  15. package/dist/Components/helpers/SvgImage/SvgImage.d.ts +0 -9
  16. package/dist/Components/utils/scalingValue.d.ts +0 -1
  17. package/dist/FontFaceGenerator/FontFaceGenerator.d.ts +0 -6
  18. package/dist/FontFaceGenerator/FontFaceGenerator.test.d.ts +0 -1
  19. package/dist/ScrollPlaybackVideoManager/ScrollPlaybackVideoManager.d.ts +0 -31
  20. package/dist/VideoDecoder/VideoDecoder.d.ts +0 -12
  21. package/dist/cli.d.ts +0 -10
  22. package/dist/cli.js +0 -64
  23. package/dist/index.d.ts +0 -23
  24. package/dist/index.js +0 -2217
  25. package/dist/index.mjs +0 -2200
  26. package/dist/schemas/article/Article.schema.d.ts +0 -293
  27. package/dist/schemas/article/Article.schema.js +0 -11
  28. package/dist/schemas/article/Interaction.schema.d.ts +0 -78
  29. package/dist/schemas/article/Interaction.schema.js +0 -24
  30. package/dist/schemas/article/Item.schema.d.ts +0 -40
  31. package/dist/schemas/article/Item.schema.js +0 -241
  32. package/dist/schemas/article/ItemArea.schema.d.ts +0 -36
  33. package/dist/schemas/article/ItemArea.schema.js +0 -17
  34. package/dist/schemas/article/ItemBase.schema.d.ts +0 -137
  35. package/dist/schemas/article/ItemBase.schema.js +0 -23
  36. package/dist/schemas/article/ItemState.schema.d.ts +0 -13561
  37. package/dist/schemas/article/ItemState.schema.js +0 -74
  38. package/dist/schemas/article/RichTextItem.schema.d.ts +0 -1370
  39. package/dist/schemas/article/RichTextItem.schema.js +0 -60
  40. package/dist/schemas/article/Section.schema.d.ts +0 -176
  41. package/dist/schemas/article/Section.schema.js +0 -38
  42. package/dist/schemas/keyframe/Keyframes.schema.d.ts +0 -934
  43. package/dist/schemas/keyframe/Keyframes.schema.js +0 -119
  44. package/dist/schemas/project/Layout.schema.d.ts +0 -17
  45. package/dist/schemas/project/Layout.schema.js +0 -10
  46. package/dist/schemas/project/Project.schema.d.ts +0 -253
  47. package/dist/schemas/project/Project.schema.js +0 -48
  48. package/dist/sdk.css +0 -1
  49. package/dist/types/article/Article.d.ts +0 -7
  50. package/dist/types/article/Article.js +0 -2
  51. package/dist/types/article/ArticleItemType.d.ts +0 -13
  52. package/dist/types/article/ArticleItemType.js +0 -17
  53. package/dist/types/article/CompoundSettings.d.ts +0 -6
  54. package/dist/types/article/CompoundSettings.js +0 -2
  55. package/dist/types/article/FX.d.ts +0 -23
  56. package/dist/types/article/FX.js +0 -2
  57. package/dist/types/article/Interaction.d.ts +0 -22
  58. package/dist/types/article/Interaction.js +0 -2
  59. package/dist/types/article/Item.d.ts +0 -202
  60. package/dist/types/article/Item.js +0 -3
  61. package/dist/types/article/ItemArea.d.ts +0 -36
  62. package/dist/types/article/ItemArea.js +0 -31
  63. package/dist/types/article/ItemState.d.ts +0 -77
  64. package/dist/types/article/ItemState.js +0 -3
  65. package/dist/types/article/RichText.d.ts +0 -40
  66. package/dist/types/article/RichText.js +0 -27
  67. package/dist/types/article/Section.d.ts +0 -37
  68. package/dist/types/article/Section.js +0 -8
  69. package/dist/types/component/Component.d.ts +0 -15
  70. package/dist/types/keyframe/Keyframe.d.ts +0 -89
  71. package/dist/types/keyframe/Keyframe.js +0 -21
  72. package/dist/types/project/Fonts.d.ts +0 -22
  73. package/dist/types/project/Fonts.js +0 -11
  74. package/dist/types/project/Layout.d.ts +0 -6
  75. package/dist/types/project/Layout.js +0 -2
  76. package/dist/types/project/Meta.d.ts +0 -9
  77. package/dist/types/project/Meta.js +0 -2
  78. package/dist/types/project/Page.d.ts +0 -11
  79. package/dist/types/project/Page.js +0 -2
  80. package/dist/types/project/Project.d.ts +0 -17
  81. package/dist/types/project/Project.js +0 -2
  82. package/dist/utils.d.ts +0 -3
package/dist/index.mjs DELETED
@@ -1,2200 +0,0 @@
1
- import fetch$1 from "isomorphic-fetch";
2
- import { URL } from "url";
3
- import { z } from "zod";
4
- import UAParser from "ua-parser-js";
5
- import * as MP4Box from "mp4box";
6
- import { jsx, Fragment, jsxs } from "react/jsx-runtime";
7
- import { useState, useEffect, useRef } from "react";
8
- import { Splide, SplideSlide } from "@splidejs/react-splide";
9
- import cn from "classnames";
10
- var SectionHeightMode = /* @__PURE__ */ ((SectionHeightMode2) => {
11
- SectionHeightMode2["ControlUnits"] = "control-units";
12
- SectionHeightMode2["ViewportHeightUnits"] = "viewport-height-units";
13
- return SectionHeightMode2;
14
- })(SectionHeightMode || {});
15
- const TransitionSchema = z.object({
16
- timing: z.string(),
17
- duration: z.number(),
18
- delay: z.number()
19
- });
20
- const getStateParamsSchema = (schema) => {
21
- return z.object({
22
- value: schema,
23
- in: TransitionSchema,
24
- out: TransitionSchema
25
- }).optional();
26
- };
27
- const ItemStateBaseSchema = z.object({
28
- width: getStateParamsSchema(z.number()),
29
- height: getStateParamsSchema(z.number()),
30
- angle: getStateParamsSchema(z.number()),
31
- top: getStateParamsSchema(z.number()),
32
- left: getStateParamsSchema(z.number()),
33
- scale: getStateParamsSchema(z.number()),
34
- blur: getStateParamsSchema(z.number())
35
- });
36
- const MediaStateParamsSchema = z.object({
37
- opacity: getStateParamsSchema(z.number()),
38
- radius: getStateParamsSchema(z.number()),
39
- strokeWidth: getStateParamsSchema(z.number()),
40
- strokeColor: getStateParamsSchema(z.string())
41
- }).merge(ItemStateBaseSchema);
42
- const RectangleStateParamsSchema = z.object({
43
- strokeWidth: getStateParamsSchema(z.number()),
44
- radius: getStateParamsSchema(z.number()),
45
- fillColor: getStateParamsSchema(z.string()),
46
- strokeColor: getStateParamsSchema(z.string()),
47
- backdropBlur: getStateParamsSchema(z.number())
48
- }).merge(ItemStateBaseSchema);
49
- const CustomItemStateParamsSchema = ItemStateBaseSchema;
50
- const EmbedStateParamsSchema = z.object({
51
- radius: getStateParamsSchema(z.number()),
52
- opacity: getStateParamsSchema(z.number().nonnegative())
53
- }).merge(ItemStateBaseSchema);
54
- const RichTextStateParamsSchema = z.object({
55
- color: getStateParamsSchema(z.string()),
56
- letterSpacing: getStateParamsSchema(z.number()),
57
- wordSpacing: getStateParamsSchema(z.number())
58
- }).merge(ItemStateBaseSchema);
59
- const GroupStateParamsSchema = z.object({
60
- opacity: getStateParamsSchema(z.number().nonnegative()),
61
- blur: getStateParamsSchema(z.number().nonnegative())
62
- }).merge(ItemStateBaseSchema);
63
- const CompoundStateParamsSchema = z.object({
64
- opacity: getStateParamsSchema(z.number().nonnegative())
65
- }).merge(ItemStateBaseSchema);
66
- const CodeEmbedStateParamsSchema = z.object({
67
- opacity: getStateParamsSchema(z.number().nonnegative())
68
- }).merge(ItemStateBaseSchema);
69
- const ComponentStateParamsSchema = z.object({
70
- opacity: getStateParamsSchema(z.number().nonnegative())
71
- }).merge(ItemStateBaseSchema);
72
- z.union([
73
- EmbedStateParamsSchema,
74
- MediaStateParamsSchema,
75
- RectangleStateParamsSchema,
76
- RichTextStateParamsSchema,
77
- CustomItemStateParamsSchema,
78
- GroupStateParamsSchema,
79
- CompoundStateParamsSchema,
80
- CodeEmbedStateParamsSchema,
81
- ComponentStateParamsSchema
82
- ]);
83
- var TextAlign = /* @__PURE__ */ ((TextAlign2) => {
84
- TextAlign2["Left"] = "left";
85
- TextAlign2["Right"] = "right";
86
- TextAlign2["Center"] = "center";
87
- TextAlign2["Justify"] = "justify";
88
- return TextAlign2;
89
- })(TextAlign || {});
90
- var TextTransform = /* @__PURE__ */ ((TextTransform2) => {
91
- TextTransform2["None"] = "none";
92
- TextTransform2["Uppercase"] = "uppercase";
93
- TextTransform2["Lowercase"] = "lowercase";
94
- return TextTransform2;
95
- })(TextTransform || {});
96
- var VerticalAlign = /* @__PURE__ */ ((VerticalAlign2) => {
97
- VerticalAlign2["Super"] = "super";
98
- VerticalAlign2["Sub"] = "sub";
99
- VerticalAlign2["Unset"] = "unset";
100
- return VerticalAlign2;
101
- })(VerticalAlign || {});
102
- var TextDecoration = /* @__PURE__ */ ((TextDecoration2) => {
103
- TextDecoration2["Underline"] = "underline";
104
- TextDecoration2["None"] = "none";
105
- return TextDecoration2;
106
- })(TextDecoration || {});
107
- var AnchorSide = /* @__PURE__ */ ((AnchorSide2) => {
108
- AnchorSide2["Top"] = "top";
109
- AnchorSide2["Bottom"] = "bottom";
110
- AnchorSide2["Center"] = "center";
111
- return AnchorSide2;
112
- })(AnchorSide || {});
113
- var PositionType = /* @__PURE__ */ ((PositionType2) => {
114
- PositionType2["SectionBased"] = "section-based";
115
- PositionType2["ScreenBased"] = "screen-based";
116
- return PositionType2;
117
- })(PositionType || {});
118
- var AreaAnchor = /* @__PURE__ */ ((AreaAnchor2) => {
119
- AreaAnchor2["TopLeft"] = "top-left";
120
- AreaAnchor2["TopCenter"] = "top-center";
121
- AreaAnchor2["TopRight"] = "top-right";
122
- AreaAnchor2["MiddleLeft"] = "middle-left";
123
- AreaAnchor2["MiddleCenter"] = "middle-center";
124
- AreaAnchor2["MiddleRight"] = "middle-right";
125
- AreaAnchor2["BottomLeft"] = "bottom-left";
126
- AreaAnchor2["BottomCenter"] = "bottom-center";
127
- AreaAnchor2["BottomRight"] = "bottom-right";
128
- return AreaAnchor2;
129
- })(AreaAnchor || {});
130
- var DimensionMode = /* @__PURE__ */ ((DimensionMode2) => {
131
- DimensionMode2["ControlUnits"] = "control-units";
132
- DimensionMode2["Relative"] = "relative";
133
- return DimensionMode2;
134
- })(DimensionMode || {});
135
- const ItemAreaSchema = z.object({
136
- top: z.number(),
137
- left: z.number(),
138
- width: z.number(),
139
- height: z.number(),
140
- zIndex: z.number(),
141
- angle: z.number(),
142
- anchorSide: z.nativeEnum(AnchorSide).optional(),
143
- scale: z.number().nonnegative(),
144
- positionType: z.nativeEnum(PositionType),
145
- scaleAnchor: z.nativeEnum(AreaAnchor)
146
- });
147
- const Link = z.object({
148
- url: z.string().min(1),
149
- target: z.string().min(1)
150
- });
151
- const CompoundSettingsSchema = z.object({
152
- positionAnchor: z.nativeEnum(AreaAnchor),
153
- widthMode: z.nativeEnum(DimensionMode),
154
- heightMode: z.nativeEnum(DimensionMode)
155
- });
156
- const ItemBaseSchema = z.object({
157
- id: z.string().min(1),
158
- area: z.record(ItemAreaSchema),
159
- hidden: z.record(z.boolean()),
160
- link: Link.optional(),
161
- compoundSettings: z.record(CompoundSettingsSchema).optional(),
162
- layoutParams: z.record(z.any()).optional()
163
- });
164
- var ArticleItemType = /* @__PURE__ */ ((ArticleItemType2) => {
165
- ArticleItemType2["Image"] = "image";
166
- ArticleItemType2["RichText"] = "richtext";
167
- ArticleItemType2["Video"] = "video";
168
- ArticleItemType2["Rectangle"] = "rectangle";
169
- ArticleItemType2["VimeoEmbed"] = "vimeo-embed";
170
- ArticleItemType2["YoutubeEmbed"] = "youtube-embed";
171
- ArticleItemType2["Custom"] = "custom";
172
- ArticleItemType2["Group"] = "group";
173
- ArticleItemType2["CodeEmbed"] = "code-embed";
174
- ArticleItemType2["Compound"] = "compound";
175
- ArticleItemType2["Component"] = "component";
176
- return ArticleItemType2;
177
- })(ArticleItemType || {});
178
- const pointerEvents$1 = z.enum(["never", "when_visible", "always"]).optional();
179
- const RichTextEntitySchema = z.object({
180
- start: z.number().nonnegative(),
181
- end: z.number().nonnegative(),
182
- type: z.string(),
183
- data: z.any().optional()
184
- });
185
- const RichTextStyleSchema = z.object({
186
- start: z.number().nonnegative(),
187
- end: z.number().nonnegative(),
188
- style: z.string().min(1),
189
- value: z.string().optional()
190
- });
191
- const RichTextBlockSchema = z.lazy(() => z.object({
192
- start: z.number().nonnegative(),
193
- end: z.number().nonnegative(),
194
- type: z.string().min(1),
195
- entities: z.array(RichTextEntitySchema).optional(),
196
- children: z.array(RichTextBlockSchema).optional(),
197
- data: z.any().optional()
198
- }));
199
- const RichTextItemSchema = ItemBaseSchema.extend({
200
- type: z.literal(ArticleItemType.RichText),
201
- commonParams: z.object({
202
- text: z.string(),
203
- blocks: z.array(RichTextBlockSchema).optional(),
204
- pointerEvents: pointerEvents$1
205
- }),
206
- sticky: z.record(
207
- z.object({
208
- from: z.number(),
209
- to: z.number().optional()
210
- }).nullable()
211
- ),
212
- layoutParams: z.record(
213
- z.object({
214
- rangeStyles: z.array(RichTextStyleSchema).optional(),
215
- textAlign: z.nativeEnum(TextAlign),
216
- sizing: z.string(),
217
- blur: z.number(),
218
- fontSize: z.number(),
219
- lineHeight: z.number(),
220
- letterSpacing: z.number(),
221
- wordSpacing: z.number(),
222
- textTransform: z.nativeEnum(TextTransform),
223
- verticalAlign: z.nativeEnum(VerticalAlign),
224
- color: z.string(),
225
- typeFace: z.string(),
226
- fontStyle: z.string(),
227
- fontWeight: z.number(),
228
- fontVariant: z.string(),
229
- isDraggable: z.boolean().optional()
230
- })
231
- ),
232
- state: z.record(RichTextStateParamsSchema)
233
- });
234
- const pointerEvents = z.enum(["never", "when_visible", "always"]).optional();
235
- const FXControlSchema = z.discriminatedUnion("type", [
236
- z.object({
237
- type: z.literal("float"),
238
- shaderParam: z.string(),
239
- value: z.number()
240
- }),
241
- z.object({
242
- type: z.literal("int"),
243
- shaderParam: z.string(),
244
- value: z.number()
245
- }),
246
- z.object({
247
- type: z.literal("vec2"),
248
- shaderParam: z.string(),
249
- value: z.tuple([z.number(), z.number()])
250
- })
251
- ]);
252
- const FXParams = z.object({
253
- url: z.string().min(1),
254
- hasGLEffect: z.boolean().optional(),
255
- fragmentShader: z.string().nullable(),
256
- FXControls: z.array(FXControlSchema).optional()
257
- });
258
- const ImageItemSchema = ItemBaseSchema.extend({
259
- type: z.literal(ArticleItemType.Image),
260
- commonParams: z.object({
261
- pointerEvents
262
- }).merge(FXParams),
263
- sticky: z.record(
264
- z.object({
265
- from: z.number(),
266
- to: z.number().optional()
267
- }).nullable()
268
- ),
269
- layoutParams: z.record(
270
- z.object({
271
- opacity: z.number().nonnegative(),
272
- radius: z.number(),
273
- strokeWidth: z.number(),
274
- strokeColor: z.string(),
275
- blur: z.number(),
276
- isDraggable: z.boolean().optional()
277
- })
278
- ),
279
- state: z.record(MediaStateParamsSchema)
280
- });
281
- const VideoItemSchema = ItemBaseSchema.extend({
282
- type: z.literal(ArticleItemType.Video),
283
- commonParams: z.object({
284
- coverUrl: z.string().nullable(),
285
- pointerEvents
286
- }).merge(FXParams),
287
- sticky: z.record(
288
- z.object({
289
- from: z.number(),
290
- to: z.number().optional()
291
- }).nullable()
292
- ),
293
- layoutParams: z.record(
294
- z.object({
295
- scrollPlayback: z.object({
296
- from: z.number(),
297
- to: z.number()
298
- }).nullable(),
299
- opacity: z.number().nonnegative(),
300
- radius: z.number(),
301
- strokeWidth: z.number(),
302
- strokeColor: z.string(),
303
- blur: z.number(),
304
- isDraggable: z.boolean().optional(),
305
- play: z.enum(["on-hover", "on-click", "auto"]),
306
- muted: z.boolean(),
307
- controls: z.boolean()
308
- })
309
- ),
310
- state: z.record(MediaStateParamsSchema)
311
- });
312
- const RectangleItemSchema = ItemBaseSchema.extend({
313
- type: z.literal(ArticleItemType.Rectangle),
314
- commonParams: z.object({
315
- ratioLock: z.boolean(),
316
- pointerEvents
317
- }),
318
- sticky: z.record(
319
- z.object({
320
- from: z.number(),
321
- to: z.number().optional()
322
- }).nullable()
323
- ),
324
- layoutParams: z.record(
325
- z.object({
326
- radius: z.number(),
327
- strokeWidth: z.number(),
328
- fillColor: z.string().min(1),
329
- strokeColor: z.string().min(1),
330
- blur: z.number(),
331
- backdropBlur: z.number(),
332
- blurMode: z.enum(["default", "backdrop"]),
333
- isDraggable: z.boolean().optional()
334
- })
335
- ),
336
- state: z.record(RectangleStateParamsSchema)
337
- });
338
- const CustomItemSchema = ItemBaseSchema.extend({
339
- type: z.literal(ArticleItemType.Custom),
340
- commonParams: z.object({
341
- name: z.string(),
342
- pointerEvents
343
- }),
344
- sticky: z.record(
345
- z.object({
346
- from: z.number(),
347
- to: z.number().optional()
348
- }).nullable()
349
- ),
350
- layoutParams: z.record(z.object({
351
- isDraggable: z.boolean().optional()
352
- })),
353
- state: z.record(CustomItemStateParamsSchema)
354
- });
355
- const VimeoEmbedItemSchema = ItemBaseSchema.extend({
356
- type: z.literal(ArticleItemType.VimeoEmbed),
357
- commonParams: z.object({
358
- url: z.string().min(1),
359
- coverUrl: z.string().nullable(),
360
- ratioLock: z.boolean(),
361
- pointerEvents
362
- }),
363
- sticky: z.record(
364
- z.object({
365
- from: z.number(),
366
- to: z.number().optional()
367
- }).nullable()
368
- ),
369
- layoutParams: z.record(
370
- z.object({
371
- radius: z.number(),
372
- blur: z.number(),
373
- opacity: z.number().nonnegative(),
374
- play: z.union([z.literal("on-hover"), z.literal("on-click"), z.literal("auto")]),
375
- controls: z.boolean(),
376
- loop: z.boolean(),
377
- muted: z.boolean(),
378
- pictureInPicture: z.boolean()
379
- })
380
- ),
381
- state: z.record(EmbedStateParamsSchema)
382
- });
383
- const YoutubeEmbedItemSchema = ItemBaseSchema.extend({
384
- type: z.literal(ArticleItemType.YoutubeEmbed),
385
- commonParams: z.object({
386
- url: z.string().min(1),
387
- coverUrl: z.string().nullable(),
388
- pointerEvents
389
- }),
390
- sticky: z.record(
391
- z.object({
392
- from: z.number(),
393
- to: z.number().optional()
394
- }).nullable()
395
- ),
396
- layoutParams: z.record(
397
- z.object({
398
- radius: z.number(),
399
- blur: z.number(),
400
- opacity: z.number().nonnegative(),
401
- play: z.enum(["on-hover", "on-click", "auto"]),
402
- controls: z.boolean(),
403
- loop: z.boolean()
404
- })
405
- ),
406
- state: z.record(EmbedStateParamsSchema)
407
- });
408
- const CodeEmbedItemSchema = ItemBaseSchema.extend({
409
- type: z.literal(ArticleItemType.CodeEmbed),
410
- commonParams: z.object({
411
- html: z.string(),
412
- scale: z.boolean(),
413
- iframe: z.boolean(),
414
- pointerEvents
415
- }),
416
- sticky: z.record(
417
- z.object({
418
- from: z.number(),
419
- to: z.number().optional()
420
- }).nullable()
421
- ),
422
- layoutParams: z.record(
423
- z.object({
424
- areaAnchor: z.nativeEnum(AreaAnchor),
425
- opacity: z.number().nonnegative(),
426
- blur: z.number(),
427
- isDraggable: z.boolean().optional()
428
- })
429
- ),
430
- state: z.record(CodeEmbedStateParamsSchema)
431
- });
432
- const ComponentItemSchema = ItemBaseSchema.extend({
433
- type: z.literal(ArticleItemType.Component),
434
- commonParams: z.object({
435
- componentId: z.string(),
436
- content: z.any().optional()
437
- }),
438
- sticky: z.record(
439
- z.object({
440
- from: z.number(),
441
- to: z.number().optional()
442
- }).nullable()
443
- ),
444
- layoutParams: z.record(z.object({
445
- parameters: z.any().optional(),
446
- opacity: z.number().nonnegative(),
447
- blur: z.number()
448
- })),
449
- state: z.record(ComponentStateParamsSchema)
450
- });
451
- const ItemSchema = z.lazy(() => z.discriminatedUnion("type", [
452
- ImageItemSchema,
453
- VideoItemSchema,
454
- RectangleItemSchema,
455
- CustomItemSchema,
456
- RichTextItemSchema,
457
- VimeoEmbedItemSchema,
458
- YoutubeEmbedItemSchema,
459
- CodeEmbedItemSchema,
460
- ComponentItemSchema,
461
- ItemBaseSchema.extend({
462
- type: z.literal(ArticleItemType.Group),
463
- commonParams: z.object({
464
- pointerEvents
465
- }),
466
- items: z.array(ItemSchema),
467
- sticky: z.record(
468
- z.object({
469
- from: z.number(),
470
- to: z.number().optional()
471
- }).nullable()
472
- ),
473
- layoutParams: z.record(
474
- z.object({
475
- opacity: z.number().nonnegative(),
476
- blur: z.number()
477
- })
478
- ),
479
- state: z.record(GroupStateParamsSchema)
480
- }),
481
- ItemBaseSchema.extend({
482
- type: z.literal(ArticleItemType.Compound),
483
- commonParams: z.object({
484
- overflow: z.enum(["hidden", "visible"]),
485
- pointerEvents
486
- }),
487
- items: z.array(ItemSchema),
488
- sticky: z.record(
489
- z.object({
490
- from: z.number(),
491
- to: z.number().optional()
492
- }).nullable()
493
- ),
494
- layoutParams: z.record(
495
- z.object({
496
- opacity: z.number().nonnegative()
497
- })
498
- ),
499
- state: z.record(CompoundStateParamsSchema)
500
- })
501
- ]));
502
- const SectionHeightSchema = z.object({
503
- mode: z.nativeEnum(SectionHeightMode),
504
- units: z.number().nonnegative(),
505
- vhUnits: z.number().nonnegative().optional()
506
- });
507
- const SectionVideoSchema = z.object({
508
- url: z.string(),
509
- size: z.string(),
510
- type: z.literal("video"),
511
- play: z.enum(["on-click", "auto"]),
512
- coverUrl: z.string().nullable(),
513
- position: z.string(),
514
- offsetX: z.number().nullable()
515
- });
516
- const SectionImageSchema = z.object({
517
- url: z.string(),
518
- type: z.literal("image"),
519
- size: z.string(),
520
- position: z.string(),
521
- offsetX: z.number().nullable()
522
- });
523
- const SectionMediaSchema = z.discriminatedUnion("type", [SectionVideoSchema, SectionImageSchema]);
524
- const SectionSchema = z.object({
525
- id: z.string().min(1),
526
- items: z.array(ItemSchema),
527
- name: z.string().optional(),
528
- height: z.record(SectionHeightSchema),
529
- position: z.record(z.number()),
530
- hidden: z.record(z.boolean()),
531
- color: z.record(z.nullable(z.string())),
532
- media: z.record(SectionMediaSchema).optional()
533
- });
534
- const TriggerSchema = z.object({
535
- itemId: z.string(),
536
- type: z.enum(["hover-in", "hover-out", "click"]),
537
- from: z.string(),
538
- to: z.string()
539
- });
540
- const VideoInteractionActionSchema = z.object({
541
- type: z.enum(["play", "pause"]),
542
- itemId: z.string()
543
- });
544
- const StateSchema = z.object({
545
- id: z.string(),
546
- actions: z.array(VideoInteractionActionSchema).optional()
547
- });
548
- const InteractionSchema = z.object({
549
- id: z.string(),
550
- triggers: z.array(TriggerSchema),
551
- states: z.array(StateSchema),
552
- startStateId: z.string()
553
- });
554
- const ArticleSchema = z.object({
555
- id: z.string().min(1),
556
- sections: z.array(SectionSchema),
557
- interactions: z.record(z.array(InteractionSchema))
558
- });
559
- const LayoutSchema = z.object({
560
- id: z.string(),
561
- title: z.string(),
562
- startsWith: z.number().nonnegative(),
563
- exemplary: z.number().positive()
564
- });
565
- var FontFileTypes = /* @__PURE__ */ ((FontFileTypes2) => {
566
- FontFileTypes2["OTF"] = "otf";
567
- FontFileTypes2["TTF"] = "ttf";
568
- FontFileTypes2["WOFF"] = "woff";
569
- FontFileTypes2["WOFF2"] = "woff2";
570
- FontFileTypes2["EOT"] = "eot";
571
- return FontFileTypes2;
572
- })(FontFileTypes || {});
573
- const ProjectSchema = z.object({
574
- id: z.string().min(1),
575
- html: z.object({
576
- head: z.string(),
577
- afterBodyOpen: z.string(),
578
- beforeBodyClose: z.string()
579
- }),
580
- meta: z.object({
581
- title: z.string().optional(),
582
- description: z.string().optional(),
583
- opengraphThumbnail: z.string().optional(),
584
- keywords: z.string().optional(),
585
- favicon: z.string().optional()
586
- }),
587
- layouts: z.array(LayoutSchema),
588
- pages: z.array(z.object({
589
- title: z.string(),
590
- articleId: z.string().min(1),
591
- slug: z.string(),
592
- meta: z.object({
593
- title: z.string().optional(),
594
- description: z.string().optional(),
595
- opengraphThumbnail: z.string().optional(),
596
- keywords: z.string().optional(),
597
- enabled: z.boolean()
598
- }).optional(),
599
- id: z.string().min(1)
600
- })),
601
- fonts: z.object({
602
- google: z.string(),
603
- adobe: z.string(),
604
- custom: z.array(z.object({
605
- name: z.string().min(1),
606
- style: z.string().min(1),
607
- weight: z.number(),
608
- files: z.array(
609
- z.object({
610
- type: z.nativeEnum(FontFileTypes),
611
- url: z.string()
612
- })
613
- )
614
- }))
615
- })
616
- });
617
- var KeyframeType = /* @__PURE__ */ ((KeyframeType2) => {
618
- KeyframeType2["Dimensions"] = "dimensions";
619
- KeyframeType2["Position"] = "position";
620
- KeyframeType2["Rotation"] = "rotation";
621
- KeyframeType2["BorderRadius"] = "border-radius";
622
- KeyframeType2["BorderWidth"] = "border-width";
623
- KeyframeType2["Color"] = "color";
624
- KeyframeType2["BorderColor"] = "border-color";
625
- KeyframeType2["Opacity"] = "opacity";
626
- KeyframeType2["Scale"] = "scale";
627
- KeyframeType2["TextColor"] = "text-color";
628
- KeyframeType2["LetterSpacing"] = "letter-spacing";
629
- KeyframeType2["WordSpacing"] = "word-spacing";
630
- KeyframeType2["Blur"] = "blur";
631
- KeyframeType2["BackdropBlur"] = "backdrop-blur";
632
- KeyframeType2["FXParams"] = "fx-params";
633
- return KeyframeType2;
634
- })(KeyframeType || {});
635
- const KeyframesBaseSchema = z.object({
636
- id: z.string().min(1),
637
- layoutId: z.string().min(1),
638
- itemId: z.string().min(1),
639
- position: z.number()
640
- });
641
- const DimensionsKeyframeSchema = KeyframesBaseSchema.extend({
642
- type: z.literal(KeyframeType.Dimensions),
643
- value: z.object({
644
- width: z.number().nonnegative(),
645
- height: z.number().nonnegative()
646
- })
647
- });
648
- const PositionKeyframeSchema = KeyframesBaseSchema.extend({
649
- type: z.literal(KeyframeType.Position),
650
- value: z.object({
651
- top: z.number(),
652
- left: z.number()
653
- })
654
- });
655
- const RotationKeyframeSchema = KeyframesBaseSchema.extend({
656
- type: z.literal(KeyframeType.Rotation),
657
- value: z.object({
658
- angle: z.number()
659
- })
660
- });
661
- const BorderRadiusKeyframeSchema = KeyframesBaseSchema.extend({
662
- type: z.literal(KeyframeType.BorderRadius),
663
- value: z.object({
664
- radius: z.number().nonnegative()
665
- })
666
- });
667
- const BorderWidthKeyframeSchema = KeyframesBaseSchema.extend({
668
- type: z.literal(KeyframeType.BorderWidth),
669
- value: z.object({
670
- borderWidth: z.number().nonnegative()
671
- })
672
- });
673
- const ColorKeyframeSchema = KeyframesBaseSchema.extend({
674
- type: z.literal(KeyframeType.Color),
675
- value: z.object({
676
- color: z.string()
677
- })
678
- });
679
- const BorderColorKeyframeSchema = KeyframesBaseSchema.extend({
680
- type: z.literal(KeyframeType.BorderColor),
681
- value: z.object({
682
- color: z.string()
683
- })
684
- });
685
- const OpacityKeyframeSchema = KeyframesBaseSchema.extend({
686
- type: z.literal(KeyframeType.Opacity),
687
- value: z.object({
688
- opacity: z.number().nonnegative()
689
- })
690
- });
691
- const ScaleKeyframeSchema = KeyframesBaseSchema.extend({
692
- type: z.literal(KeyframeType.Scale),
693
- value: z.object({
694
- scale: z.number().nonnegative()
695
- })
696
- });
697
- const BlurKeyframeSchema = KeyframesBaseSchema.extend({
698
- type: z.literal(KeyframeType.Blur),
699
- value: z.object({
700
- blur: z.number()
701
- })
702
- });
703
- const BackdropBlurKeyframeSchema = KeyframesBaseSchema.extend({
704
- type: z.literal(KeyframeType.BackdropBlur),
705
- value: z.object({
706
- backdropBlur: z.number()
707
- })
708
- });
709
- const TextColorKeyframeSchema = KeyframesBaseSchema.extend({
710
- type: z.literal(KeyframeType.TextColor),
711
- value: z.object({
712
- color: z.string()
713
- })
714
- });
715
- const LetterSpacingKeyframeSchema = KeyframesBaseSchema.extend({
716
- type: z.literal(KeyframeType.LetterSpacing),
717
- value: z.object({
718
- letterSpacing: z.number()
719
- })
720
- });
721
- const WordSpacingKeyframeSchema = KeyframesBaseSchema.extend({
722
- type: z.literal(KeyframeType.WordSpacing),
723
- value: z.object({
724
- wordSpacing: z.number()
725
- })
726
- });
727
- const FXParamsKeyframeSchema = KeyframesBaseSchema.extend({
728
- type: z.literal(KeyframeType.FXParams),
729
- value: z.record(z.string(), z.number())
730
- });
731
- const KeyframeSchema = z.discriminatedUnion("type", [
732
- DimensionsKeyframeSchema,
733
- PositionKeyframeSchema,
734
- RotationKeyframeSchema,
735
- BorderRadiusKeyframeSchema,
736
- BorderWidthKeyframeSchema,
737
- ColorKeyframeSchema,
738
- BorderColorKeyframeSchema,
739
- OpacityKeyframeSchema,
740
- ScaleKeyframeSchema,
741
- BlurKeyframeSchema,
742
- BackdropBlurKeyframeSchema,
743
- TextColorKeyframeSchema,
744
- LetterSpacingKeyframeSchema,
745
- WordSpacingKeyframeSchema,
746
- FXParamsKeyframeSchema
747
- ]);
748
- const KeyframesSchema = z.array(KeyframeSchema);
749
- class Client {
750
- constructor(APIUrl, fetchImpl = fetch$1) {
751
- this.fetchImpl = fetchImpl;
752
- this.url = new URL(APIUrl);
753
- if (!this.url.username) {
754
- throw new Error("Project ID is missing in the URL.");
755
- }
756
- if (!this.url.password) {
757
- throw new Error("API key is missing in the URL.");
758
- }
759
- }
760
- static getPageMeta(projectMeta, pageMeta) {
761
- return pageMeta.enabled ? {
762
- title: pageMeta.title ? pageMeta.title : projectMeta.title ?? "",
763
- description: pageMeta.description ? pageMeta.description : projectMeta.description ?? "",
764
- keywords: pageMeta.keywords ? pageMeta.keywords : projectMeta.keywords ?? "",
765
- opengraphThumbnail: pageMeta.opengraphThumbnail ? pageMeta.opengraphThumbnail : projectMeta.opengraphThumbnail ?? "",
766
- favicon: projectMeta.favicon ?? ""
767
- } : projectMeta;
768
- }
769
- async getPageData(pageSlug, buildMode = "default") {
770
- try {
771
- const project = await this.fetchProject(buildMode);
772
- const articleId = this.findArticleIdByPageSlug(pageSlug, project.pages);
773
- const { article, keyframes } = await this.fetchArticle(articleId, buildMode);
774
- const page = project.pages.find((page2) => page2.slug === pageSlug);
775
- const meta = Client.getPageMeta(project.meta, page == null ? void 0 : page.meta);
776
- return {
777
- project,
778
- article,
779
- keyframes,
780
- meta
781
- };
782
- } catch (e) {
783
- throw e;
784
- }
785
- }
786
- async getProjectPagesPaths() {
787
- try {
788
- const { pages } = await this.fetchProject();
789
- return pages.map((p) => p.slug);
790
- } catch (e) {
791
- throw e;
792
- }
793
- }
794
- async getLayouts() {
795
- try {
796
- const { layouts } = await this.fetchProject();
797
- return layouts;
798
- } catch (e) {
799
- throw e;
800
- }
801
- }
802
- async fetchProject(buildMode = "default") {
803
- const { username: projectId, password: apiKey, origin } = this.url;
804
- const url = new URL(`/projects/${projectId}?buildMode=${buildMode}`, origin);
805
- const response = await this.fetchImpl(url.href, {
806
- headers: {
807
- Authorization: `Bearer ${apiKey}`
808
- }
809
- });
810
- if (!response.ok) {
811
- throw new Error(`Failed to fetch project with id #${projectId}: ${response.statusText}`);
812
- }
813
- const data = await response.json();
814
- const project = ProjectSchema.parse(data);
815
- return project;
816
- }
817
- async fetchArticle(articleId, buildMode = "default") {
818
- const { username: projectId, password: apiKey, origin } = this.url;
819
- const url = new URL(`/projects/${projectId}/articles/${articleId}?buildMode=${buildMode}`, origin);
820
- const response = await this.fetchImpl(url.href, {
821
- headers: {
822
- Authorization: `Bearer ${apiKey}`
823
- }
824
- });
825
- if (!response.ok) {
826
- throw new Error(`Failed to fetch article with id #${articleId}: ${response.statusText}`);
827
- }
828
- const data = await response.json();
829
- const article = ArticleSchema.parse(data.article);
830
- const keyframes = KeyframesSchema.parse(data.keyframes);
831
- return { article, keyframes };
832
- }
833
- findArticleIdByPageSlug(slug, pages) {
834
- const { username: projectId } = this.url;
835
- const page = pages.find((page2) => page2.slug === slug);
836
- if (!page) {
837
- throw new Error(`Page with a slug ${slug} was not found in project with id #${projectId}`);
838
- }
839
- return page.articleId;
840
- }
841
- }
842
- const FILE_TYPES_MAP = {
843
- ttf: "truetype",
844
- otf: "opentype"
845
- };
846
- class FontFaceGenerator {
847
- constructor(fonts) {
848
- this.fonts = fonts;
849
- }
850
- generate() {
851
- return this.fonts.map((font) => {
852
- const eotFile = font.files.find((file) => file.type === "eot");
853
- const otherFiles = font.files.filter((file) => file.type !== "eot").map((file) => `url('${file.url}') format('${FILE_TYPES_MAP[file.type] || file.type}')`);
854
- return `
855
- @font-face {
856
- font-family: "${font.name}";
857
- font-weight: ${font.weight};
858
- font-style: ${font.style};
859
- ${eotFile ? `src: url('${eotFile.url}');
860
- ` : ""}src: ${otherFiles.join(", ")};
861
- }`;
862
- }).join("\n");
863
- }
864
- }
865
- function getLayoutStyles(layouts, layoutValues, mapToStyles) {
866
- const mediaQueries = layouts.sort((a, b) => a.startsWith - b.startsWith).reduce(
867
- (acc, layout) => {
868
- const values = layoutValues.map((lv) => lv[layout.id]);
869
- return `
870
- ${acc}
871
- ${layout.startsWith !== 0 ? `@media (min-width: ${layout.startsWith}px) {${mapToStyles(values, layout.exemplary)}}` : `${mapToStyles(values, layout.exemplary)}`}`;
872
- },
873
- ""
874
- );
875
- return mediaQueries;
876
- }
877
- function getLayoutMediaQuery(layoutId, layouts) {
878
- const sorted = layouts.slice().sort((a, b) => a.startsWith - b.startsWith);
879
- const layoutIndex = sorted.findIndex((l) => l.id === layoutId);
880
- if (layoutIndex === -1) {
881
- throw new Error(`No layout was found by the given id #${layoutId}`);
882
- }
883
- const current = sorted[layoutIndex];
884
- const next = sorted[layoutIndex + 1];
885
- if (!next) {
886
- return `@media (min-width: ${current.startsWith}px)`;
887
- }
888
- return `@media (min-width: ${current.startsWith}px) and (max-width: ${next.startsWith - 1}px)`;
889
- }
890
- class Writer {
891
- constructor(size) {
892
- this.data = new Uint8Array(size);
893
- this.idx = 0;
894
- this.size = size;
895
- }
896
- getData() {
897
- if (this.idx !== this.size) throw new Error("Mismatch between size reserved and sized used");
898
- return this.data.slice(0, this.idx);
899
- }
900
- writeUint8(value) {
901
- this.data.set([value], this.idx);
902
- this.idx += 1;
903
- }
904
- writeUint16(value) {
905
- const arr = new Uint16Array(1);
906
- arr[0] = value;
907
- const buffer = new Uint8Array(arr.buffer);
908
- this.data.set([buffer[1], buffer[0]], this.idx);
909
- this.idx += 2;
910
- }
911
- writeUint8Array(value) {
912
- this.data.set(value, this.idx);
913
- this.idx += value.length;
914
- }
915
- }
916
- const getExtradata = (avccBox) => {
917
- let i;
918
- let size = 7;
919
- for (i = 0; i < avccBox.SPS.length; i += 1) {
920
- size += 2 + avccBox.SPS[i].length;
921
- }
922
- for (i = 0; i < avccBox.PPS.length; i += 1) {
923
- size += 2 + avccBox.PPS[i].length;
924
- }
925
- const writer = new Writer(size);
926
- writer.writeUint8(avccBox.configurationVersion);
927
- writer.writeUint8(avccBox.AVCProfileIndication);
928
- writer.writeUint8(avccBox.profile_compatibility);
929
- writer.writeUint8(avccBox.AVCLevelIndication);
930
- writer.writeUint8(avccBox.lengthSizeMinusOne + (63 << 2));
931
- writer.writeUint8(avccBox.nb_SPS_nalus + (7 << 5));
932
- for (i = 0; i < avccBox.SPS.length; i += 1) {
933
- writer.writeUint16(avccBox.SPS[i].length);
934
- writer.writeUint8Array(avccBox.SPS[i].nalu);
935
- }
936
- writer.writeUint8(avccBox.nb_PPS_nalus);
937
- for (i = 0; i < avccBox.PPS.length; i += 1) {
938
- writer.writeUint16(avccBox.PPS[i].length);
939
- writer.writeUint8Array(avccBox.PPS[i].nalu);
940
- }
941
- return writer.getData();
942
- };
943
- const decodeVideo = (src, emitFrame, { VideoDecoder: VideoDecoder2, EncodedVideoChunk: EncodedVideoChunk2, debug }) => new Promise((resolve, reject) => {
944
- if (debug) console.info("Decoding video from", src);
945
- try {
946
- const mp4boxfile = MP4Box.createFile();
947
- let codec;
948
- const decoder = new VideoDecoder2({
949
- output: (frame) => {
950
- createImageBitmap(frame, { resizeQuality: "low" }).then((bitmap) => {
951
- emitFrame(bitmap);
952
- frame.close();
953
- if (decoder.decodeQueueSize <= 0) {
954
- setTimeout(() => {
955
- if (decoder.state !== "closed") {
956
- decoder.close();
957
- resolve();
958
- }
959
- }, 500);
960
- }
961
- });
962
- },
963
- error: (e) => {
964
- console.error(e);
965
- reject(e);
966
- }
967
- });
968
- mp4boxfile.onReady = (info) => {
969
- if (info && info.videoTracks && info.videoTracks[0]) {
970
- [{ codec }] = info.videoTracks;
971
- if (debug) console.info("Video with codec:", codec);
972
- const avccBox = mp4boxfile.moov.traks[0].mdia.minf.stbl.stsd.entries[0].avcC;
973
- const extradata = getExtradata(avccBox);
974
- decoder.configure({ codec, description: extradata });
975
- mp4boxfile.setExtractionOptions(info.videoTracks[0].id);
976
- mp4boxfile.start();
977
- } else reject(new Error("URL provided is not a valid mp4 video file."));
978
- };
979
- mp4boxfile.onSamples = (track_id, ref, samples) => {
980
- for (let i = 0; i < samples.length; i += 1) {
981
- const sample = samples[i];
982
- const type = sample.is_sync ? "key" : "delta";
983
- const chunk = new EncodedVideoChunk2({
984
- type,
985
- timestamp: sample.cts,
986
- duration: sample.duration,
987
- data: sample.data
988
- });
989
- decoder.decode(chunk);
990
- }
991
- };
992
- fetch(src).then((res) => {
993
- const reader = res.body.getReader();
994
- let offset = 0;
995
- function appendBuffers({ done, value }) {
996
- if (done) {
997
- mp4boxfile.flush();
998
- return null;
999
- }
1000
- const buf = value.buffer;
1001
- buf.fileStart = offset;
1002
- offset += buf.byteLength;
1003
- mp4boxfile.appendBuffer(buf);
1004
- return reader.read().then(appendBuffers);
1005
- }
1006
- return reader.read().then(appendBuffers);
1007
- });
1008
- } catch (e) {
1009
- reject(e);
1010
- }
1011
- });
1012
- const videoDecoder = (src, emitFrame, debug) => {
1013
- if (typeof VideoDecoder === "function" && typeof EncodedVideoChunk === "function") {
1014
- if (debug)
1015
- console.info("WebCodecs is natively supported, using native version...");
1016
- return decodeVideo(src, emitFrame, {
1017
- VideoDecoder,
1018
- EncodedVideoChunk,
1019
- debug
1020
- });
1021
- }
1022
- if (debug) console.info("WebCodecs is not available in this browser.");
1023
- return Promise.resolve();
1024
- };
1025
- class ScrollPlaybackVideoManager {
1026
- constructor(options) {
1027
- this.currentTime = 0;
1028
- this.targetTime = 0;
1029
- this.canvas = null;
1030
- this.context = null;
1031
- this.frames = [];
1032
- this.frameRate = 0;
1033
- this.transitioning = false;
1034
- this.debug = false;
1035
- this.frameThreshold = 0.1;
1036
- this.transitionSpeed = 10;
1037
- this.useWebCodecs = true;
1038
- this.resize = () => {
1039
- if (this.debug) console.info("ScrollVideo resizing...");
1040
- if (this.canvas) {
1041
- this.setCoverStyle(this.canvas);
1042
- } else if (this.video) {
1043
- this.setCoverStyle(this.video);
1044
- }
1045
- this.paintCanvasFrame(Math.floor(this.currentTime * this.frameRate));
1046
- };
1047
- this.decodeVideo = () => {
1048
- if (!this.video) return;
1049
- if (this.useWebCodecs && this.video.src) {
1050
- videoDecoder(
1051
- this.video.src,
1052
- (frame) => {
1053
- this.frames.push(frame);
1054
- },
1055
- this.debug
1056
- ).then(() => {
1057
- if (!this.video || !this.container) return;
1058
- if (this.frames.length === 0) {
1059
- if (this.debug) console.error("No frames were received from webCodecs");
1060
- return;
1061
- }
1062
- this.frameRate = this.frames.length / this.video.duration;
1063
- if (this.debug) console.info("Received", this.frames.length, "frames");
1064
- this.canvas = document.createElement("canvas");
1065
- this.context = this.canvas.getContext("2d");
1066
- this.video.style.display = "none";
1067
- this.container.appendChild(this.canvas);
1068
- this.paintCanvasFrame(Math.floor(this.currentTime * this.frameRate));
1069
- }).catch(() => {
1070
- if (this.debug) console.error("Error encountered while decoding video");
1071
- this.frames = [];
1072
- this.video.load();
1073
- });
1074
- }
1075
- };
1076
- this.resizeObserver = new ResizeObserver(() => {
1077
- this.resize();
1078
- });
1079
- const {
1080
- src,
1081
- videoContainer
1082
- } = options;
1083
- if (typeof document !== "object") {
1084
- console.error("ScrollVideo must be initiated in a DOM context");
1085
- return;
1086
- }
1087
- if (!videoContainer) {
1088
- console.error("scrollVideoContainer must be a valid DOM object");
1089
- return;
1090
- }
1091
- if (!src) {
1092
- console.error("Must provide valid video src to ScrollVideo");
1093
- return;
1094
- }
1095
- this.container = typeof videoContainer === "string" ? document.getElementById(videoContainer) : videoContainer;
1096
- this.resizeObserver.observe(this.container);
1097
- this.video = document.createElement("video");
1098
- this.video.src = src;
1099
- this.video.preload = "auto";
1100
- this.video.tabIndex = 0;
1101
- this.video.playsInline = true;
1102
- this.video.muted = true;
1103
- this.video.pause();
1104
- this.video.load();
1105
- this.container.appendChild(this.video);
1106
- const browserEngine = new UAParser().getEngine();
1107
- this.isSafari = browserEngine.name === "WebKit";
1108
- if (this.debug && this.isSafari) console.info("Safari browser detected");
1109
- this.video.addEventListener("loadedmetadata", () => this.setTargetTimePercent(0, true), { once: true });
1110
- this.video.addEventListener("progress", this.resize);
1111
- this.decodeVideo();
1112
- }
1113
- setCoverStyle(el) {
1114
- if (el && this.container) {
1115
- el.style.position = "absolute";
1116
- el.style.top = "50%";
1117
- el.style.left = "50%";
1118
- el.style.transform = "translate(-50%, -50%)";
1119
- const { width: containerWidth, height: containerHeight } = this.container.getBoundingClientRect();
1120
- const width = el.videoWidth || el.width;
1121
- const height = el.videoHeight || el.height;
1122
- if (containerWidth / containerHeight > width / height) {
1123
- el.style.width = "100%";
1124
- el.style.height = "auto";
1125
- } else {
1126
- el.style.height = "100%";
1127
- el.style.width = "auto";
1128
- }
1129
- }
1130
- }
1131
- paintCanvasFrame(frameNum) {
1132
- if (this.canvas) {
1133
- const frameIdx = Math.min(frameNum, this.frames.length - 1);
1134
- const currFrame = this.frames[frameIdx];
1135
- if (currFrame && this.container) {
1136
- if (this.debug) console.info("Painting frame", frameIdx);
1137
- this.canvas.width = currFrame.width;
1138
- this.canvas.height = currFrame.height;
1139
- const { width, height } = this.container.getBoundingClientRect();
1140
- this.resetCanvasDimensions(width, height, currFrame.width, currFrame.height);
1141
- this.context.drawImage(currFrame, 0, 0, currFrame.width, currFrame.height);
1142
- }
1143
- }
1144
- }
1145
- transitionToTargetTime(jump) {
1146
- if (!this.video) return;
1147
- if (this.debug) console.info("Transitioning targetTime:", this.targetTime, "currentTime:", this.currentTime);
1148
- if (isNaN(this.targetTime) || Math.abs(this.currentTime - this.targetTime) < this.frameThreshold) {
1149
- this.video.pause();
1150
- this.transitioning = false;
1151
- return;
1152
- }
1153
- if (this.targetTime > this.video.duration) {
1154
- this.targetTime = this.video.duration;
1155
- }
1156
- if (this.targetTime < 0) {
1157
- this.targetTime = 0;
1158
- }
1159
- const transitionForward = this.targetTime - this.currentTime;
1160
- if (this.canvas) {
1161
- this.currentTime += transitionForward / (256 / this.transitionSpeed);
1162
- if (jump) {
1163
- this.currentTime = this.targetTime;
1164
- }
1165
- this.paintCanvasFrame(Math.floor(this.currentTime * this.frameRate));
1166
- } else if (jump || this.isSafari || this.targetTime - this.currentTime < 0) {
1167
- this.video.pause();
1168
- this.currentTime += transitionForward / (64 / this.transitionSpeed);
1169
- if (jump) {
1170
- this.currentTime = this.targetTime;
1171
- }
1172
- this.video.currentTime = this.currentTime;
1173
- } else {
1174
- const playbackRate = Math.max(Math.min(transitionForward * 4, this.transitionSpeed, 16), 1);
1175
- if (this.debug) console.info("ScrollVideo playbackRate:", playbackRate);
1176
- if (!isNaN(playbackRate)) {
1177
- this.video.playbackRate = playbackRate;
1178
- this.video.play();
1179
- }
1180
- this.currentTime = this.video.currentTime;
1181
- }
1182
- if (typeof requestAnimationFrame === "function") {
1183
- requestAnimationFrame(() => this.transitionToTargetTime(jump));
1184
- }
1185
- }
1186
- resetCanvasDimensions(w, h, frameW, frameH) {
1187
- if (!this.canvas) return;
1188
- if (w / h > frameW / frameH) {
1189
- this.canvas.style.width = "100%";
1190
- this.canvas.style.height = "auto";
1191
- } else {
1192
- this.canvas.style.height = "100%";
1193
- this.canvas.style.width = "auto";
1194
- }
1195
- }
1196
- setTargetTimePercent(setPercentage, jump = true) {
1197
- if (!this.video) return;
1198
- this.targetTime = Math.max(Math.min(setPercentage, 1), 0) * (this.frames.length && this.frameRate ? this.frames.length / this.frameRate : this.video.duration);
1199
- if (!jump && Math.abs(this.currentTime - this.targetTime) < this.frameThreshold) return;
1200
- if (!jump && this.transitioning) return;
1201
- if (!this.canvas && !this.video.paused) this.video.play();
1202
- this.transitioning = true;
1203
- this.transitionToTargetTime(jump);
1204
- }
1205
- destroy() {
1206
- var _a;
1207
- this.resizeObserver.unobserve(this.container);
1208
- (_a = this.video) == null ? void 0 : _a.removeEventListener("progress", this.resize);
1209
- if (this.debug) console.info("Destroying ScrollVideo");
1210
- if (this.container) this.container.innerHTML = "";
1211
- }
1212
- }
1213
- const wrapper = "ControlSlider-module__wrapper___sHEkd";
1214
- const sliderItem = "ControlSlider-module__sliderItem___QQSkR";
1215
- const sliderImage = "ControlSlider-module__sliderImage___9hRl-";
1216
- const arrow = "ControlSlider-module__arrow___05ghY";
1217
- const arrowVertical = "ControlSlider-module__arrowVertical___tBfVN";
1218
- const nextArrow = "ControlSlider-module__nextArrow___-30Yc";
1219
- const arrowInner = "ControlSlider-module__arrowInner___aEra3";
1220
- const arrowIcon = "ControlSlider-module__arrowIcon___S4ztF";
1221
- const arrowImg = "ControlSlider-module__arrowImg___2dwJW";
1222
- const mirror = "ControlSlider-module__mirror___brd6U";
1223
- const pagination = "ControlSlider-module__pagination___bicLF";
1224
- const paginationInner = "ControlSlider-module__paginationInner___bT-P-";
1225
- const paginationVertical = "ControlSlider-module__paginationVertical___zYqKw";
1226
- const paginationItem = "ControlSlider-module__paginationItem___nTRbk";
1227
- const dot = "ControlSlider-module__dot___p1Qun";
1228
- const activeDot = "ControlSlider-module__activeDot___LHFaj";
1229
- const paginationInsideBottom = "ControlSlider-module__paginationInsideBottom___R3FWn";
1230
- const paginationInsideTop = "ControlSlider-module__paginationInsideTop___V-qb-";
1231
- const paginationOutsideBottom = "ControlSlider-module__paginationOutsideBottom___14w8D";
1232
- const paginationOutsideTop = "ControlSlider-module__paginationOutsideTop___SCLqB";
1233
- const paginationInsideLeft = "ControlSlider-module__paginationInsideLeft___yOBRZ";
1234
- const paginationInsideRight = "ControlSlider-module__paginationInsideRight___Rtt3o";
1235
- const paginationOutsideLeft = "ControlSlider-module__paginationOutsideLeft___lahaw";
1236
- const paginationOutsideRight = "ControlSlider-module__paginationOutsideRight___EtuQa";
1237
- const imgWrapper = "ControlSlider-module__imgWrapper___UjEgB";
1238
- const captionBlock = "ControlSlider-module__captionBlock___dJ6-j";
1239
- const captionTextWrapper = "ControlSlider-module__captionTextWrapper___HFlpf";
1240
- const captionText = "ControlSlider-module__captionText___uGBVc";
1241
- const active = "ControlSlider-module__active___WZK4G";
1242
- const withPointerEvents = "ControlSlider-module__withPointerEvents___t-18M";
1243
- const topLeftAlignment = "ControlSlider-module__topLeftAlignment___zjnGM";
1244
- const topCenterAlignment = "ControlSlider-module__topCenterAlignment___gD1xW";
1245
- const topRightAlignment = "ControlSlider-module__topRightAlignment___NMapS";
1246
- const middleLeftAlignment = "ControlSlider-module__middleLeftAlignment___OnUrY";
1247
- const middleCenterAlignment = "ControlSlider-module__middleCenterAlignment___Tdkl0";
1248
- const middleRightAlignment = "ControlSlider-module__middleRightAlignment___wEbfX";
1249
- const bottomLeftAlignment = "ControlSlider-module__bottomLeftAlignment___cTP2-";
1250
- const bottomCenterAlignment = "ControlSlider-module__bottomCenterAlignment___c54fB";
1251
- const bottomRightAlignment = "ControlSlider-module__bottomRightAlignment___kEwrz";
1252
- const clickOverlay = "ControlSlider-module__clickOverlay___DZA28";
1253
- const contain = "ControlSlider-module__contain___pLyq7";
1254
- const cover = "ControlSlider-module__cover___KdDat";
1255
- const styles$2 = {
1256
- wrapper,
1257
- sliderItem,
1258
- sliderImage,
1259
- arrow,
1260
- arrowVertical,
1261
- nextArrow,
1262
- arrowInner,
1263
- arrowIcon,
1264
- arrowImg,
1265
- mirror,
1266
- pagination,
1267
- paginationInner,
1268
- paginationVertical,
1269
- paginationItem,
1270
- dot,
1271
- activeDot,
1272
- paginationInsideBottom,
1273
- paginationInsideTop,
1274
- paginationOutsideBottom,
1275
- paginationOutsideTop,
1276
- paginationInsideLeft,
1277
- paginationInsideRight,
1278
- paginationOutsideLeft,
1279
- paginationOutsideRight,
1280
- imgWrapper,
1281
- captionBlock,
1282
- captionTextWrapper,
1283
- captionText,
1284
- active,
1285
- withPointerEvents,
1286
- topLeftAlignment,
1287
- topCenterAlignment,
1288
- topRightAlignment,
1289
- middleLeftAlignment,
1290
- middleCenterAlignment,
1291
- middleRightAlignment,
1292
- bottomLeftAlignment,
1293
- bottomCenterAlignment,
1294
- bottomRightAlignment,
1295
- clickOverlay,
1296
- contain,
1297
- cover
1298
- };
1299
- const link = "RichTextRenderer-module__link___BWeZ2";
1300
- const styles$1 = {
1301
- link
1302
- };
1303
- const RichTextRenderer = ({ content }) => {
1304
- const getChildren = (children) => {
1305
- return children.map((child, i) => {
1306
- if (child.type === "link") {
1307
- return /* @__PURE__ */ jsx("a", { className: styles$1.link, href: child.value, target: child.target, children: getChildren(child.children) }, i);
1308
- }
1309
- return /* @__PURE__ */ jsx("span", { style: getLeafCss(child), children: child.text }, i);
1310
- });
1311
- };
1312
- return /* @__PURE__ */ jsx(Fragment, { children: content.map((block, i) => {
1313
- const children = block.children;
1314
- return /* @__PURE__ */ jsx("div", { children: getChildren(children) }, i);
1315
- }) });
1316
- };
1317
- function getLeafCss(leaf) {
1318
- return {
1319
- ...leaf.fontWeight && { fontWeight: leaf.fontWeight },
1320
- ...leaf.fontStyle && { fontStyle: leaf.fontStyle },
1321
- ...leaf.textDecoration && { textDecoration: leaf.textDecoration },
1322
- ...leaf.textTransform && { textTransform: leaf.textTransform },
1323
- ...leaf.fontVariant && { fontVariant: leaf.fontVariant },
1324
- ...leaf.verticalAlign && {
1325
- verticalAlign: leaf.verticalAlign,
1326
- lineHeight: "0px"
1327
- }
1328
- };
1329
- }
1330
- function scalingValue(value, isEditor = false) {
1331
- return isEditor ? `calc(var(--cntrl-article-width) * ${value})` : `${value * 100}vw`;
1332
- }
1333
- const svg = "SvgImage-module__svg___q3xE-";
1334
- const img = "SvgImage-module__img___VsTm-";
1335
- const styles = {
1336
- svg,
1337
- img
1338
- };
1339
- const SvgImage = ({ url, fill = "#000000", hoverFill = "#CCCCCC", className = "" }) => {
1340
- const [supportsMask, setSupportsMask] = useState(true);
1341
- useEffect(() => {
1342
- if (typeof window !== "undefined" && window.CSS) {
1343
- const supported = CSS.supports("mask-image", 'url("")') || CSS.supports("-webkit-mask-image", 'url("")');
1344
- setSupportsMask(supported);
1345
- }
1346
- }, []);
1347
- if (!url.endsWith(".svg") || !supportsMask) {
1348
- return /* @__PURE__ */ jsx("img", { src: url, alt: "", className: cn(styles.img, className) });
1349
- }
1350
- return /* @__PURE__ */ jsx(
1351
- "span",
1352
- {
1353
- "data-supports-mask": supportsMask,
1354
- className: cn(styles.svg, className),
1355
- style: {
1356
- "--svg": `url(${url})`,
1357
- "--fill": fill,
1358
- "--hover-fill": hoverFill
1359
- }
1360
- }
1361
- );
1362
- };
1363
- const alignmentClassName = {
1364
- "top-left": styles$2.topLeftAlignment,
1365
- "top-center": styles$2.topCenterAlignment,
1366
- "top-right": styles$2.topRightAlignment,
1367
- "middle-left": styles$2.middleLeftAlignment,
1368
- "middle-center": styles$2.middleCenterAlignment,
1369
- "middle-right": styles$2.middleRightAlignment,
1370
- "bottom-left": styles$2.bottomLeftAlignment,
1371
- "bottom-center": styles$2.bottomCenterAlignment,
1372
- "bottom-right": styles$2.bottomRightAlignment
1373
- };
1374
- function ControlSlider({ settings, content, styles: sliderStyles, isEditor }) {
1375
- const [sliderRef, setSliderRef] = useState(null);
1376
- const { widthSettings, fontSettings, letterSpacing, textAlign, wordSpacing, fontSizeLineHeight, textAppearance, color } = sliderStyles.caption;
1377
- const [sliderDimensions, setSliderDimensions] = useState(void 0);
1378
- const [wrapperRef, setWrapperRef] = useState(null);
1379
- const [currentSlideIndex, setCurrentSlideIndex] = useState(0);
1380
- const [key, setKey] = useState(0);
1381
- const { direction, transition, controls, pagination: pagination2, caption, triggers } = settings;
1382
- const prevSliderTypeRef = useRef(transition.type);
1383
- const { x: controlsOffsetX, y: controlsOffsetY } = settings.controls.offset;
1384
- const handleArrowClick = (dir) => {
1385
- if (sliderRef) {
1386
- sliderRef.go(dir);
1387
- }
1388
- };
1389
- useEffect(() => {
1390
- if (!wrapperRef) return;
1391
- const observer = new ResizeObserver((entries) => {
1392
- if (!sliderRef) return;
1393
- const [wrapper2] = entries;
1394
- setSliderDimensions({
1395
- width: Math.round(wrapper2.contentRect.width),
1396
- height: Math.round(wrapper2.contentRect.height)
1397
- });
1398
- });
1399
- observer.observe(wrapperRef);
1400
- return () => observer.unobserve(wrapperRef);
1401
- }, [wrapperRef]);
1402
- useEffect(() => {
1403
- if (!sliderRef || prevSliderTypeRef.current === transition.type) return;
1404
- setKey((prev) => prev + 1);
1405
- prevSliderTypeRef.current = transition.type;
1406
- }, [transition.type]);
1407
- return /* @__PURE__ */ jsx("div", { className: cn(styles$2.wrapper, { [styles$2.editor]: isEditor }), ref: setWrapperRef, children: /* @__PURE__ */ jsxs("div", { className: styles$2.sliderInner, style: {
1408
- width: sliderDimensions ? sliderDimensions.width : "100%",
1409
- height: sliderDimensions ? sliderDimensions.height : "100%"
1410
- }, children: [
1411
- settings.caption.isActive && /* @__PURE__ */ jsx(
1412
- "div",
1413
- {
1414
- className: cn(styles$2.captionBlock),
1415
- children: /* @__PURE__ */ jsx(
1416
- "div",
1417
- {
1418
- className: styles$2.captionTextWrapper,
1419
- children: content.map((item, index) => /* @__PURE__ */ jsx(
1420
- "div",
1421
- {
1422
- className: cn(styles$2.captionText, alignmentClassName[caption.alignment], {
1423
- [styles$2.withPointerEvents]: index === currentSlideIndex && isEditor,
1424
- [styles$2.active]: index === currentSlideIndex
1425
- }),
1426
- style: {
1427
- fontFamily: fontSettings.fontFamily,
1428
- fontWeight: fontSettings.fontWeight,
1429
- fontStyle: fontSettings.fontStyle,
1430
- width: widthSettings.sizing === "auto" ? "max-content" : scalingValue(widthSettings.width, isEditor),
1431
- letterSpacing: scalingValue(letterSpacing, isEditor),
1432
- wordSpacing: scalingValue(wordSpacing, isEditor),
1433
- textAlign,
1434
- fontSize: scalingValue(fontSizeLineHeight.fontSize, isEditor),
1435
- lineHeight: scalingValue(fontSizeLineHeight.lineHeight, isEditor),
1436
- textTransform: textAppearance.textTransform ?? "none",
1437
- textDecoration: textAppearance.textDecoration ?? "none",
1438
- fontVariant: textAppearance.fontVariant ?? "normal",
1439
- color,
1440
- transitionDuration: transition.duration ? `${Math.round(parseInt(transition.duration) / 2)}ms` : "500ms"
1441
- },
1442
- children: /* @__PURE__ */ jsx(
1443
- "div",
1444
- {
1445
- "data-styles": "caption",
1446
- className: styles$2.captionTextInner,
1447
- style: {
1448
- "--link-hover-color": caption.hover,
1449
- position: "relative",
1450
- top: scalingValue(caption.offset.y, isEditor),
1451
- left: scalingValue(caption.offset.x, isEditor)
1452
- },
1453
- children: /* @__PURE__ */ jsx(RichTextRenderer, { content: item.imageCaption })
1454
- }
1455
- )
1456
- },
1457
- index
1458
- ))
1459
- }
1460
- )
1461
- }
1462
- ),
1463
- /* @__PURE__ */ jsx(
1464
- Splide,
1465
- {
1466
- onMove: (e) => {
1467
- setCurrentSlideIndex(e.index);
1468
- },
1469
- ref: setSliderRef,
1470
- options: {
1471
- arrows: false,
1472
- speed: transition.duration ? parseInt(transition.duration) : 500,
1473
- autoplay: isEditor ? false : triggers.autoPlay !== null,
1474
- ...triggers.autoPlay !== null && {
1475
- interval: parseInt(triggers.autoPlay) * 1e3
1476
- },
1477
- direction: direction === "horiz" || transition.type === "fade in" ? "ltr" : "ttb",
1478
- pagination: false,
1479
- drag: triggers.triggersList.drag,
1480
- perPage: 1,
1481
- width: sliderDimensions ? sliderDimensions.width : "100%",
1482
- height: sliderDimensions ? sliderDimensions.height : "100%",
1483
- type: transition.type === "fade in" ? "fade" : "loop",
1484
- rewind: true
1485
- },
1486
- children: content.map((item, index) => /* @__PURE__ */ jsx(SplideSlide, { children: /* @__PURE__ */ jsx(
1487
- "div",
1488
- {
1489
- className: styles$2.sliderItem,
1490
- children: /* @__PURE__ */ jsx(
1491
- "div",
1492
- {
1493
- className: styles$2.imgWrapper,
1494
- children: /* @__PURE__ */ jsx(
1495
- "img",
1496
- {
1497
- className: cn(styles$2.sliderImage, {
1498
- [styles$2.contain]: item.image.objectFit === "contain",
1499
- [styles$2.cover]: item.image.objectFit === "cover"
1500
- }),
1501
- src: item.image.url,
1502
- alt: item.image.name ?? ""
1503
- }
1504
- )
1505
- }
1506
- )
1507
- }
1508
- ) }, index))
1509
- },
1510
- key
1511
- ),
1512
- controls.isActive && /* @__PURE__ */ jsxs(Fragment, { children: [
1513
- /* @__PURE__ */ jsx(
1514
- "div",
1515
- {
1516
- className: cn(styles$2.arrow, {
1517
- [styles$2.arrowVertical]: direction === "vert"
1518
- }),
1519
- style: {
1520
- color: controls.color,
1521
- ["--arrow-hover-color"]: controls.hover
1522
- },
1523
- children: /* @__PURE__ */ jsxs(
1524
- "button",
1525
- {
1526
- onClick: () => {
1527
- handleArrowClick("-1");
1528
- },
1529
- className: styles$2.arrowInner,
1530
- style: {
1531
- transform: `translate(${scalingValue(controlsOffsetX, isEditor)}, ${scalingValue(controlsOffsetY * (direction === "horiz" ? 1 : -1), isEditor)}) scale(${settings.controls.scale / 100}) rotate(${direction === "horiz" ? "0deg" : "90deg"})`
1532
- },
1533
- children: [
1534
- controls.arrowsImgUrl && /* @__PURE__ */ jsx(
1535
- SvgImage,
1536
- {
1537
- url: controls.arrowsImgUrl,
1538
- fill: controls.color,
1539
- hoverFill: controls.hover,
1540
- className: cn(styles$2.arrowImg, styles$2.mirror)
1541
- }
1542
- ),
1543
- !controls.arrowsImgUrl && /* @__PURE__ */ jsx(ArrowIcon, { color: controls.color, className: cn(styles$2.arrowIcon, styles$2.arrowImg, styles$2.mirror) })
1544
- ]
1545
- }
1546
- )
1547
- }
1548
- ),
1549
- /* @__PURE__ */ jsx(
1550
- "div",
1551
- {
1552
- className: cn(styles$2.arrow, styles$2.nextArrow, {
1553
- [styles$2.arrowVertical]: direction === "vert"
1554
- }),
1555
- style: {
1556
- color: controls.color,
1557
- ["--arrow-hover-color"]: controls.hover
1558
- },
1559
- children: /* @__PURE__ */ jsxs(
1560
- "button",
1561
- {
1562
- className: styles$2.arrowInner,
1563
- onClick: () => handleArrowClick("+1"),
1564
- style: {
1565
- transform: `translate(${scalingValue(controlsOffsetX * (direction === "horiz" ? -1 : 1), isEditor)}, ${scalingValue(controlsOffsetY, isEditor)}) scale(${settings.controls.scale / 100}) rotate(${direction === "horiz" ? "0deg" : "90deg"})`
1566
- },
1567
- children: [
1568
- controls.arrowsImgUrl && /* @__PURE__ */ jsx(
1569
- SvgImage,
1570
- {
1571
- url: controls.arrowsImgUrl,
1572
- fill: controls.color,
1573
- hoverFill: controls.hover,
1574
- className: styles$2.arrowImg
1575
- }
1576
- ),
1577
- !controls.arrowsImgUrl && /* @__PURE__ */ jsx(ArrowIcon, { color: controls.color, className: cn(styles$2.arrowIcon, styles$2.arrowImg) })
1578
- ]
1579
- }
1580
- )
1581
- }
1582
- )
1583
- ] }),
1584
- triggers.triggersList.click && /* @__PURE__ */ jsx(
1585
- "div",
1586
- {
1587
- className: styles$2.clickOverlay,
1588
- onClick: () => {
1589
- if (sliderRef) {
1590
- sliderRef.go("+1");
1591
- }
1592
- }
1593
- }
1594
- ),
1595
- pagination2.isActive && /* @__PURE__ */ jsx(
1596
- "div",
1597
- {
1598
- className: cn(styles$2.pagination, {
1599
- [styles$2.paginationInsideBottom]: pagination2.position === "inside-1" && direction === "horiz",
1600
- [styles$2.paginationInsideTop]: pagination2.position === "inside-2" && direction === "horiz",
1601
- [styles$2.paginationOutsideBottom]: pagination2.position === "outside-1" && direction === "horiz",
1602
- [styles$2.paginationOutsideTop]: pagination2.position === "outside-2" && direction === "horiz",
1603
- [styles$2.paginationInsideLeft]: pagination2.position === "inside-1" && direction === "vert",
1604
- [styles$2.paginationInsideRight]: pagination2.position === "inside-2" && direction === "vert",
1605
- [styles$2.paginationOutsideLeft]: pagination2.position === "outside-1" && direction === "vert",
1606
- [styles$2.paginationOutsideRight]: pagination2.position === "outside-2" && direction === "vert",
1607
- [styles$2.paginationVertical]: direction === "vert"
1608
- }),
1609
- children: /* @__PURE__ */ jsx(
1610
- "div",
1611
- {
1612
- className: styles$2.paginationInner,
1613
- style: {
1614
- backgroundColor: pagination2.colors[2],
1615
- transform: `scale(${pagination2.scale / 100}) translate(${scalingValue(pagination2.offset.x, isEditor)}, ${scalingValue(pagination2.offset.y, isEditor)}) rotate(${direction === "horiz" ? "0deg" : "90deg"})`
1616
- },
1617
- children: content.map((_, index) => /* @__PURE__ */ jsx(
1618
- "button",
1619
- {
1620
- onClick: () => {
1621
- if (sliderRef) {
1622
- sliderRef.go(index);
1623
- }
1624
- },
1625
- className: cn(styles$2.paginationItem),
1626
- children: /* @__PURE__ */ jsx(
1627
- "div",
1628
- {
1629
- className: cn(styles$2.dot, {
1630
- [styles$2.activeDot]: index === currentSlideIndex
1631
- }),
1632
- style: {
1633
- backgroundColor: index === currentSlideIndex ? pagination2.colors[0] : pagination2.colors[1],
1634
- ["--pagination-hover-color"]: pagination2.hover
1635
- }
1636
- }
1637
- )
1638
- },
1639
- index
1640
- ))
1641
- }
1642
- )
1643
- }
1644
- )
1645
- ] }) });
1646
- }
1647
- function ArrowIcon({ color, className }) {
1648
- return /* @__PURE__ */ jsx("svg", { viewBox: "0 0 10 18", className, children: /* @__PURE__ */ jsx("g", { id: "Symbols", stroke: "none", strokeWidth: "1", fillRule: "evenodd", children: /* @__PURE__ */ jsx("path", { d: "M-3.70710678,4.29289322 C-3.34662282,3.93240926 -2.77939176,3.90467972 -2.38710056,4.20970461 L-2.29289322,4.29289322 L5,11.585 L12.2928932,4.29289322 C12.6533772,3.93240926 13.2206082,3.90467972 13.6128994,4.20970461 L13.7071068,4.29289322 C14.0675907,4.65337718 14.0953203,5.22060824 13.7902954,5.61289944 L13.7071068,5.70710678 L5.70710678,13.7071068 C5.34662282,14.0675907 4.77939176,14.0953203 4.38710056,13.7902954 L4.29289322,13.7071068 L-3.70710678,5.70710678 C-4.09763107,5.31658249 -4.09763107,4.68341751 -3.70710678,4.29289322 Z", id: "Shape-Copy", fill: color, transform: "translate(5, 9) rotate(-90) translate(-5, -9)" }) }) });
1649
- }
1650
- const ControlSliderComponent = {
1651
- element: ControlSlider,
1652
- id: "control-slider",
1653
- name: "Slider",
1654
- preview: {
1655
- type: "video",
1656
- url: "https://cdn.cntrl.site/projects/01GJ2SMPPCQ7JSNGVXZ2DHWXWF/articles-assets/01JTFXX5M899RG2JA2GTJG1WNX.mp4"
1657
- },
1658
- defaultSize: {
1659
- width: 400,
1660
- height: 400
1661
- },
1662
- schema: {
1663
- type: "object",
1664
- properties: {
1665
- settings: {
1666
- layoutBased: true,
1667
- type: "object",
1668
- properties: {
1669
- triggers: {
1670
- name: "triggers",
1671
- icon: "target",
1672
- tooltip: "Triggers",
1673
- type: "object",
1674
- properties: {
1675
- triggersList: {
1676
- type: "object",
1677
- display: {
1678
- type: "toggle-ratio-group"
1679
- },
1680
- properties: {
1681
- click: {
1682
- type: "boolean"
1683
- },
1684
- drag: {
1685
- type: "boolean"
1686
- }
1687
- }
1688
- },
1689
- autoPlay: {
1690
- type: ["string", "null"],
1691
- label: "Auto",
1692
- display: {
1693
- type: "step-selector"
1694
- },
1695
- enum: [null, "1s", "2s", "3s", "4s", "5s"]
1696
- }
1697
- }
1698
- },
1699
- direction: {
1700
- name: "direction",
1701
- icon: "horizontal-resize",
1702
- tooltip: "Direction",
1703
- type: "string",
1704
- display: {
1705
- type: "ratio-group"
1706
- },
1707
- enum: ["horiz", "vert"]
1708
- },
1709
- transition: {
1710
- name: "transit",
1711
- icon: "transition",
1712
- tooltip: "Transition",
1713
- type: "object",
1714
- properties: {
1715
- type: {
1716
- type: "string",
1717
- display: {
1718
- type: "ratio-group"
1719
- },
1720
- enum: ["slide", "fade in"]
1721
- },
1722
- duration: {
1723
- type: "string",
1724
- label: "hourglass-icon",
1725
- display: {
1726
- type: "step-selector"
1727
- },
1728
- enum: ["100ms", "250ms", "500ms", "1000ms"]
1729
- }
1730
- }
1731
- },
1732
- controls: {
1733
- name: "controls",
1734
- icon: "controls",
1735
- tooltip: "Controls",
1736
- type: "object",
1737
- properties: {
1738
- isActive: {
1739
- type: "boolean",
1740
- display: {
1741
- type: "setting-toggle"
1742
- }
1743
- },
1744
- arrowsImgUrl: {
1745
- type: ["string", "null"],
1746
- display: {
1747
- type: "settings-image-input"
1748
- }
1749
- },
1750
- offset: {
1751
- type: "object",
1752
- display: {
1753
- type: "offset-controls"
1754
- },
1755
- properties: {
1756
- x: {
1757
- type: "number"
1758
- },
1759
- y: {
1760
- type: "number"
1761
- }
1762
- }
1763
- },
1764
- scale: {
1765
- type: "number",
1766
- name: "scale",
1767
- min: 50,
1768
- max: 600,
1769
- display: {
1770
- type: "range-control"
1771
- }
1772
- },
1773
- color: {
1774
- name: "color",
1775
- type: "string",
1776
- display: {
1777
- type: "settings-color-picker",
1778
- format: "single"
1779
- }
1780
- },
1781
- hover: {
1782
- name: "hover",
1783
- type: "string",
1784
- display: {
1785
- type: "settings-color-picker",
1786
- format: "single"
1787
- }
1788
- }
1789
- }
1790
- },
1791
- pagination: {
1792
- name: "nav",
1793
- icon: "pagination",
1794
- tooltip: "Navigation",
1795
- type: "object",
1796
- properties: {
1797
- isActive: {
1798
- type: "boolean",
1799
- display: {
1800
- type: "setting-toggle"
1801
- }
1802
- },
1803
- position: {
1804
- name: "nav position",
1805
- display: {
1806
- type: "socket",
1807
- direction: "horizontal"
1808
- },
1809
- type: "string",
1810
- enum: ["outside-1", "outside-2", "inside-1", "inside-2"]
1811
- },
1812
- offset: {
1813
- type: "object",
1814
- display: {
1815
- type: "offset-controls"
1816
- },
1817
- properties: {
1818
- x: {
1819
- type: "number"
1820
- },
1821
- y: {
1822
- type: "number"
1823
- }
1824
- }
1825
- },
1826
- scale: {
1827
- type: "number",
1828
- name: "scale",
1829
- min: 10,
1830
- max: 400,
1831
- display: {
1832
- type: "range-control"
1833
- }
1834
- },
1835
- colors: {
1836
- display: {
1837
- type: "settings-color-picker",
1838
- format: "multiple"
1839
- },
1840
- name: "color",
1841
- type: "array",
1842
- items: {
1843
- type: "string"
1844
- }
1845
- },
1846
- hover: {
1847
- name: "hover",
1848
- type: "string",
1849
- display: {
1850
- type: "settings-color-picker",
1851
- format: "single"
1852
- }
1853
- }
1854
- }
1855
- },
1856
- caption: {
1857
- name: "Caption",
1858
- icon: "text-icon",
1859
- tooltip: "Caption",
1860
- type: "object",
1861
- properties: {
1862
- isActive: {
1863
- type: "boolean",
1864
- display: {
1865
- type: "setting-toggle"
1866
- }
1867
- },
1868
- alignment: {
1869
- name: "Alignment",
1870
- type: "string",
1871
- display: {
1872
- type: "align-grid"
1873
- },
1874
- enum: ["top-left", "top-center", "top-right", "middle-left", "middle-center", "middle-right", "bottom-left", "bottom-center", "bottom-right"]
1875
- },
1876
- offset: {
1877
- type: "object",
1878
- display: {
1879
- type: "offset-controls"
1880
- },
1881
- properties: {
1882
- x: {
1883
- type: "number"
1884
- },
1885
- y: {
1886
- type: "number"
1887
- }
1888
- }
1889
- },
1890
- hover: {
1891
- name: "hover",
1892
- type: "string",
1893
- display: {
1894
- type: "settings-color-picker",
1895
- format: "single"
1896
- }
1897
- }
1898
- }
1899
- }
1900
- },
1901
- default: {
1902
- triggers: {
1903
- triggersList: {
1904
- click: false,
1905
- drag: true
1906
- },
1907
- autoPlay: null
1908
- },
1909
- controls: {
1910
- isActive: true,
1911
- arrowsImgUrl: null,
1912
- offset: {
1913
- x: 0,
1914
- y: 0
1915
- },
1916
- scale: 100,
1917
- color: "#000000",
1918
- hover: "#cccccc"
1919
- },
1920
- transition: {
1921
- type: "slide",
1922
- duration: "500ms"
1923
- },
1924
- pagination: {
1925
- isActive: true,
1926
- scale: 50,
1927
- position: "outside-1",
1928
- offset: {
1929
- x: 0,
1930
- y: 0
1931
- },
1932
- colors: ["#cccccc", "#cccccc", "#000000"],
1933
- hover: "#cccccc"
1934
- },
1935
- direction: "horiz",
1936
- caption: {
1937
- offset: {
1938
- x: 0,
1939
- y: 0
1940
- },
1941
- isActive: true,
1942
- alignment: "middle-center",
1943
- hover: "#cccccc"
1944
- }
1945
- },
1946
- displayRules: [
1947
- {
1948
- if: {
1949
- name: "direction",
1950
- value: "vert"
1951
- },
1952
- then: {
1953
- name: "properties.pagination.properties.position.display.direction",
1954
- value: "vertical"
1955
- }
1956
- }
1957
- ]
1958
- },
1959
- content: {
1960
- layoutBased: false,
1961
- type: "array",
1962
- items: {
1963
- type: "object",
1964
- properties: {
1965
- image: {
1966
- type: "object",
1967
- display: {
1968
- type: "media-input"
1969
- },
1970
- properties: {
1971
- url: {
1972
- type: "string"
1973
- },
1974
- name: {
1975
- type: "string"
1976
- },
1977
- objectFit: {
1978
- type: "string",
1979
- enum: ["cover", "contain"]
1980
- }
1981
- },
1982
- required: ["url", "name"]
1983
- },
1984
- imageCaption: {
1985
- display: {
1986
- type: "rich-text",
1987
- placeholder: "Add Caption..."
1988
- }
1989
- },
1990
- link: {
1991
- type: "object",
1992
- display: {
1993
- type: "text-input",
1994
- placeholder: "Add Caption..."
1995
- },
1996
- properties: {
1997
- text: {
1998
- type: "string"
1999
- }
2000
- }
2001
- }
2002
- },
2003
- required: ["image"]
2004
- },
2005
- default: [
2006
- {
2007
- image: {
2008
- objectFit: "cover",
2009
- url: "https://cdn.cntrl.site/projects/01GJ2SMPPCQ7JSNGVXZ2DHWXWF/articles-assets/01JRZ15T247392621FNTTRCW9D.jpeg",
2010
- name: "Slider-1.jpeg"
2011
- },
2012
- imageCaption: [
2013
- {
2014
- type: "paragraph",
2015
- children: [{ text: "" }]
2016
- }
2017
- ]
2018
- },
2019
- {
2020
- image: {
2021
- objectFit: "cover",
2022
- url: "https://cdn.cntrl.site/projects/01GJ2SMPPCQ7JSNGVXZ2DHWXWF/articles-assets/01JRZ17S8TS9T62P7NKTNNEB64.jpeg",
2023
- name: "Slider-2.jpeg"
2024
- },
2025
- imageCaption: [
2026
- {
2027
- type: "paragraph",
2028
- children: [{ text: "" }]
2029
- }
2030
- ]
2031
- },
2032
- {
2033
- image: {
2034
- objectFit: "cover",
2035
- url: "https://cdn.cntrl.site/projects/01GJ2SMPPCQ7JSNGVXZ2DHWXWF/articles-assets/01JRZ197S89RNT6RA7ZJSX3Z38.jpeg",
2036
- name: "Slider-3.jpeg"
2037
- },
2038
- imageCaption: [
2039
- {
2040
- type: "paragraph",
2041
- children: [{ text: "" }]
2042
- }
2043
- ]
2044
- }
2045
- ]
2046
- },
2047
- styles: {
2048
- layoutBased: true,
2049
- type: "object",
2050
- properties: {
2051
- caption: {
2052
- dataName: "caption",
2053
- type: "object",
2054
- properties: {
2055
- fontSettings: {
2056
- type: "object",
2057
- display: {
2058
- type: "font-settings"
2059
- },
2060
- properties: {
2061
- fontFamily: {
2062
- type: "string"
2063
- },
2064
- fontWeight: {
2065
- type: "number"
2066
- },
2067
- fontStyle: {
2068
- type: "string"
2069
- }
2070
- }
2071
- },
2072
- widthSettings: {
2073
- display: {
2074
- type: "text-width-control"
2075
- },
2076
- type: "object",
2077
- properties: {
2078
- width: {
2079
- type: "number"
2080
- },
2081
- sizing: {
2082
- type: "string",
2083
- enum: ["auto", "manual"]
2084
- }
2085
- }
2086
- },
2087
- fontSizeLineHeight: {
2088
- type: "object",
2089
- display: {
2090
- type: "font-size-line-height"
2091
- },
2092
- properties: {
2093
- fontSize: {
2094
- type: "number"
2095
- },
2096
- lineHeight: {
2097
- type: "number"
2098
- }
2099
- }
2100
- },
2101
- letterSpacing: {
2102
- display: {
2103
- type: "letter-spacing-input"
2104
- },
2105
- type: "number"
2106
- },
2107
- wordSpacing: {
2108
- display: {
2109
- type: "word-spacing-input"
2110
- },
2111
- type: "number"
2112
- },
2113
- textAlign: {
2114
- display: {
2115
- type: "text-align-control"
2116
- },
2117
- type: "string",
2118
- enum: ["left", "center", "right", "justify"]
2119
- },
2120
- textAppearance: {
2121
- display: {
2122
- type: "text-appearance"
2123
- },
2124
- properties: {
2125
- textTransform: {
2126
- type: "string",
2127
- enum: ["none", "uppercase", "lowercase", "capitalize"]
2128
- },
2129
- textDecoration: {
2130
- type: "string",
2131
- enum: ["none", "underline"]
2132
- },
2133
- fontVariant: {
2134
- type: "string",
2135
- enum: ["normal", "small-caps"]
2136
- }
2137
- }
2138
- },
2139
- color: {
2140
- display: {
2141
- type: "style-panel-color-picker"
2142
- },
2143
- type: "string"
2144
- }
2145
- }
2146
- }
2147
- },
2148
- default: {
2149
- caption: {
2150
- widthSettings: {
2151
- width: 0.13,
2152
- sizing: "auto"
2153
- },
2154
- fontSettings: {
2155
- fontFamily: "Arial",
2156
- fontWeight: 400,
2157
- fontStyle: "normal"
2158
- },
2159
- fontSizeLineHeight: {
2160
- fontSize: 0.02,
2161
- lineHeight: 0.02
2162
- },
2163
- letterSpacing: 0,
2164
- wordSpacing: 0,
2165
- textAlign: "left",
2166
- textAppearance: {
2167
- textTransform: "none",
2168
- textDecoration: "none",
2169
- fontVariant: "normal"
2170
- },
2171
- color: "#000000"
2172
- }
2173
- }
2174
- }
2175
- },
2176
- required: ["settings", "content", "styles"]
2177
- }
2178
- };
2179
- const components = [
2180
- ControlSliderComponent
2181
- ];
2182
- export {
2183
- AnchorSide,
2184
- AreaAnchor,
2185
- ArticleItemType,
2186
- Client as CntrlClient,
2187
- DimensionMode,
2188
- FontFaceGenerator,
2189
- KeyframeType,
2190
- PositionType,
2191
- ScrollPlaybackVideoManager,
2192
- SectionHeightMode,
2193
- TextAlign,
2194
- TextDecoration,
2195
- TextTransform,
2196
- VerticalAlign,
2197
- components,
2198
- getLayoutMediaQuery,
2199
- getLayoutStyles
2200
- };