@cntrl-site/sdk-nextjs 1.8.40 → 1.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +4 -4
  3. package/TODO.md +1 -1
  4. package/cntrl-site-sdk-nextjs-1.8.40.tgz +0 -0
  5. package/eslint.config.mjs +35 -35
  6. package/jest.config.js +6 -6
  7. package/lib/common/useItemFXData.js +7 -7
  8. package/lib/components/Article.js +5 -5
  9. package/lib/components/LayoutStyle.js +4 -4
  10. package/lib/components/Section/Section.js +27 -27
  11. package/lib/components/items/CodeEmbedItem/CodeEmbedItem.js +36 -36
  12. package/lib/components/items/ComponentItem/ComponentItem.js +13 -13
  13. package/lib/components/items/CompoundItem/CompoundChild.js +20 -20
  14. package/lib/components/items/CompoundItem/CompoundItem.js +14 -14
  15. package/lib/components/items/CustomItem/CustomItem.js +9 -9
  16. package/lib/components/items/EmbedVideoItem/VimeoEmbed.js +24 -24
  17. package/lib/components/items/EmbedVideoItem/YoutubeEmbed.js +27 -27
  18. package/lib/components/items/FileItem/ImageItem.js +85 -58
  19. package/lib/components/items/FileItem/VideoItem.js +107 -80
  20. package/lib/components/items/FileItem/useFileItem.js +12 -5
  21. package/lib/components/items/GroupItem/GroupItem.js +14 -14
  22. package/lib/components/items/Item.js +30 -30
  23. package/lib/components/items/RectangleItem/RectangleItem.js +92 -36
  24. package/lib/components/items/RectangleItem/useRectangleItem.js +15 -8
  25. package/lib/components/items/RichTextItem/RichTextItem.js +22 -22
  26. package/lib/interactions/CSSPropertyNameMap.js +18 -18
  27. package/lib/utils/Animator/Animator.js +171 -19
  28. package/lib/utils/RichTextConverter/RichTextConverter.js +21 -21
  29. package/lib/utils/areFillsVisible/areFillsVisible.js +23 -0
  30. package/lib/utils/getFill.js +43 -0
  31. package/package.json +58 -57
  32. package/src/common/useCurrentLayout.ts +52 -52
  33. package/src/common/useExemplary.ts +9 -9
  34. package/src/common/useItemFXData.ts +47 -47
  35. package/src/common/useKeyframeValue.ts +85 -85
  36. package/src/common/useRegisterResize.ts +16 -16
  37. package/src/components/Article.tsx +73 -73
  38. package/src/components/ArticleWrapper.tsx +21 -21
  39. package/src/components/Head.tsx +56 -56
  40. package/src/components/LayoutStyle.tsx +21 -21
  41. package/src/components/Page.tsx +33 -33
  42. package/src/components/ScrollPlaybackVideo.tsx +56 -56
  43. package/src/components/Section/Section.tsx +127 -127
  44. package/src/components/Section/SectionImage.tsx +48 -48
  45. package/src/components/Section/SectionVideo.tsx +144 -144
  46. package/src/components/Section/useSectionColor.ts +19 -19
  47. package/src/components/Section/useSectionHeightMap.ts +19 -19
  48. package/src/components/items/CodeEmbedItem/CodeEmbedItem.tsx +145 -145
  49. package/src/components/items/CodeEmbedItem/useCodeEmbedItem.ts +36 -36
  50. package/src/components/items/ComponentItem/ComponentItem.tsx +67 -67
  51. package/src/components/items/ComponentItem/useComponentItem.ts +35 -35
  52. package/src/components/items/CompoundItem/CompoundChild.tsx +150 -150
  53. package/src/components/items/CompoundItem/CompoundItem.tsx +70 -70
  54. package/src/components/items/CompoundItem/useCompoundItem.ts +21 -21
  55. package/src/components/items/CustomItem/CustomItem.tsx +48 -48
  56. package/src/components/items/EmbedVideoItem/VimeoEmbed.tsx +206 -206
  57. package/src/components/items/EmbedVideoItem/YoutubeEmbed.tsx +193 -193
  58. package/src/components/items/EmbedVideoItem/useEmbedVideoItem.ts +46 -46
  59. package/src/components/items/FileItem/ImageItem.tsx +211 -158
  60. package/src/components/items/FileItem/VideoItem.tsx +328 -275
  61. package/src/components/items/FileItem/useFileItem.ts +81 -73
  62. package/src/components/items/GroupItem/GroupItem.tsx +81 -81
  63. package/src/components/items/GroupItem/useGroupItem.ts +34 -34
  64. package/src/components/items/Item.tsx +251 -251
  65. package/src/components/items/LinkWrapper.tsx +39 -39
  66. package/src/components/items/RectangleItem/RectangleItem.tsx +199 -97
  67. package/src/components/items/RectangleItem/useRectangleItem.ts +89 -82
  68. package/src/components/items/RichTextItem/RichTextItem.tsx +107 -107
  69. package/src/components/items/RichTextItem/useRichTextItem.ts +12 -12
  70. package/src/components/items/RichTextWrapper.tsx +15 -15
  71. package/src/components/items/itemsMap.ts +28 -28
  72. package/src/components/items/useDraggable.ts +252 -252
  73. package/src/components/items/useItemAngle.ts +13 -13
  74. package/src/components/items/useItemArea.ts +35 -35
  75. package/src/components/items/useItemPointerEvents.ts +23 -23
  76. package/src/components/items/useItemScale.ts +17 -17
  77. package/src/components/items/useItemTriggers.ts +15 -15
  78. package/src/components/items/useRichTextItemValues.ts +65 -65
  79. package/src/components/items/useSizing.ts +25 -25
  80. package/src/components/items/useStickyItemTop.ts +21 -21
  81. package/src/components/useLayoutContext.ts +7 -7
  82. package/src/index.ts +24 -24
  83. package/src/interactions/CSSPropertyNameMap.ts +37 -38
  84. package/src/interactions/InteractionsRegistry.ts +380 -380
  85. package/src/interactions/ItemInteractionCtrl.ts +78 -78
  86. package/src/interactions/getTransition.ts +27 -27
  87. package/src/interactions/types.ts +36 -36
  88. package/src/interactions/useItemInteractionCtrl.ts +18 -18
  89. package/src/provider/ArticleRectContext.ts +4 -4
  90. package/src/provider/CntrlContext.ts +5 -5
  91. package/src/provider/CntrlProvider.tsx +11 -11
  92. package/src/provider/CntrlSdkContext.ts +83 -83
  93. package/src/provider/CustomItemRegistry.ts +14 -14
  94. package/src/provider/CustomItemTypes.ts +3 -3
  95. package/src/provider/CustomSectionRegistry.ts +25 -25
  96. package/src/provider/InteractionsContext.tsx +59 -59
  97. package/src/provider/Keyframes.ts +11 -11
  98. package/src/provider/KeyframesContext.ts +5 -5
  99. package/src/provider/LayoutContext.ts +3 -3
  100. package/src/provider/WebGLContextManagerContext.tsx +4 -4
  101. package/src/provider/defaultContext.ts +8 -8
  102. package/src/provider/useCntrlContext.ts +8 -8
  103. package/src/styled-jsx.d.ts +1 -1
  104. package/src/utils/Animator/Animator.ts +571 -371
  105. package/src/utils/ArticleRectManager/ArticleRectObserver.ts +93 -93
  106. package/src/utils/ArticleRectManager/useArticleRectObserver.ts +17 -17
  107. package/src/utils/ArticleRectManager/useSectionRegistry.ts +11 -11
  108. package/src/utils/EventEmitter.ts +41 -41
  109. package/src/utils/RichTextConverter/RichTextConverter.tsx +326 -326
  110. package/src/utils/ScaleAnchorMap.ts +13 -13
  111. package/src/utils/StickyManager/StickyManager.ts +23 -23
  112. package/src/utils/Youtube/YouTubeIframeApiLoader.ts +58 -58
  113. package/src/utils/Youtube/YoutubeIframeApi.ts +101 -101
  114. package/src/utils/Youtube/useYouTubeIframeApi.ts +12 -12
  115. package/src/utils/areFillsVisible/areFillsVisible.test.ts +63 -0
  116. package/src/utils/areFillsVisible/areFillsVisible.ts +37 -0
  117. package/src/utils/binSearchInsertAt.ts +33 -33
  118. package/src/utils/castObject.ts +10 -10
  119. package/src/utils/checkOverflowClipSupport.ts +13 -13
  120. package/src/utils/effects/useImageFx.ts +156 -156
  121. package/src/utils/effects/useVideoFx.ts +158 -158
  122. package/src/utils/getAnchoredItemTop.ts +12 -12
  123. package/src/utils/getCompoundBoundaryStyles.ts +60 -60
  124. package/src/utils/getFill.ts +46 -0
  125. package/src/utils/getFontFamilyValue.ts +3 -3
  126. package/src/utils/getInvertedRanges.ts +43 -43
  127. package/src/utils/getItemTopStyle.ts +14 -14
  128. package/src/utils/getStyleFromItemStateAndParams.ts +8 -8
  129. package/src/utils/getValidYoutubeUrl.ts +29 -29
  130. package/src/utils/isItemType.ts +5 -5
  131. package/src/utils/rangeMap.ts +13 -13
  132. package/src/utils/useElementRect.ts +23 -23
  133. package/src/provider/InteractionsContext.old.tsx +0 -66
  134. package/src/provider/InteractionsContext.test.tsx +0 -97
@@ -132,35 +132,35 @@ const YoutubeEmbedItem = ({ item, sectionId, onResize, interactionCtrl, onVisibi
132
132
  top: '0',
133
133
  left: '0',
134
134
  zIndex: 1
135
- }, alt: "Cover img" })), (0, jsx_runtime_1.jsx)("div", { className: `embed-${item.id}`, ref: setDiv, style: Object.assign(Object.assign({}, (radius !== undefined ? { borderRadius: `${radius * 100}vw` } : {})), { transition: (_j = frameStateParams === null || frameStateParams === void 0 ? void 0 : frameStateParams.transition) !== null && _j !== void 0 ? _j : 'none' }) })] }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
136
- .embed-youtube-video-wrapper-${item.id},
137
- .embed-${item.id} {
138
- position: absolute;
139
- width: 100%;
140
- height: 100%;
141
- }
142
- .embed-${item.id} {
143
- overflow: hidden;
144
- }
145
- .embed-youtube-video-wrapper-${item.id} iframe {
146
- width: 100%;
147
- height: 100%;
148
- z-index: 1;
149
- border: none;
150
- }
135
+ }, alt: "Cover img" })), (0, jsx_runtime_1.jsx)("div", { className: `embed-${item.id}`, ref: setDiv, style: Object.assign(Object.assign({}, (radius !== undefined ? { borderRadius: `${radius * 100}vw` } : {})), { transition: (_j = frameStateParams === null || frameStateParams === void 0 ? void 0 : frameStateParams.transition) !== null && _j !== void 0 ? _j : 'none' }) })] }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
136
+ .embed-youtube-video-wrapper-${item.id},
137
+ .embed-${item.id} {
138
+ position: absolute;
139
+ width: 100%;
140
+ height: 100%;
141
+ }
142
+ .embed-${item.id} {
143
+ overflow: hidden;
144
+ }
145
+ .embed-youtube-video-wrapper-${item.id} iframe {
146
+ width: 100%;
147
+ height: 100%;
148
+ z-index: 1;
149
+ border: none;
150
+ }
151
151
  ${(0, sdk_1.getLayoutStyles)(layouts, layoutValues, ([area, layoutParams]) => {
152
- return (`
153
- .embed-youtube-video-wrapper-${item.id} {
154
- opacity: ${layoutParams.opacity};
155
- transform: rotate(${area.angle}deg);
156
- filter: ${layoutParams.blur !== 0 ? `blur(${layoutParams.blur * 100}vw)` : 'unset'};
157
- ${layoutParams.blur !== 0 ? 'will-change: transform;' : ''}
158
- }
159
- .embed-youtube-video-wrapper-${item.id} .embed-${item.id} {
160
- border-radius: ${layoutParams.radius * 100}vw;
161
- }
152
+ return (`
153
+ .embed-youtube-video-wrapper-${item.id} {
154
+ opacity: ${layoutParams.opacity};
155
+ transform: rotate(${area.angle}deg);
156
+ filter: ${layoutParams.blur !== 0 ? `blur(${layoutParams.blur * 100}vw)` : 'unset'};
157
+ ${layoutParams.blur !== 0 ? 'will-change: transform;' : ''}
158
+ }
159
+ .embed-youtube-video-wrapper-${item.id} .embed-${item.id} {
160
+ border-radius: ${layoutParams.radius * 100}vw;
161
+ }
162
162
  `);
163
- })}
163
+ })}
164
164
  ` })] }));
165
165
  };
166
166
  exports.YoutubeEmbedItem = YoutubeEmbedItem;
@@ -7,7 +7,6 @@ exports.ImageItem = void 0;
7
7
  const jsx_runtime_1 = require("react/jsx-runtime");
8
8
  const react_1 = require("react");
9
9
  const style_1 = __importDefault(require("styled-jsx/style"));
10
- const color_1 = require("@cntrl-site/color");
11
10
  const sdk_1 = require("@cntrl-site/sdk");
12
11
  const LinkWrapper_1 = require("../LinkWrapper");
13
12
  const useFileItem_1 = require("./useFileItem");
@@ -19,12 +18,13 @@ const useElementRect_1 = require("../../../utils/useElementRect");
19
18
  const useLayoutContext_1 = require("../../useLayoutContext");
20
19
  const getStyleFromItemStateAndParams_1 = require("../../../utils/getStyleFromItemStateAndParams");
21
20
  const useItemFXData_1 = require("../../../common/useItemFXData");
21
+ const getFill_1 = require("../../../utils/getFill");
22
22
  const ImageItem = ({ item, sectionId, onResize, interactionCtrl, onVisibilityChange }) => {
23
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
23
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
24
24
  const id = (0, react_1.useId)();
25
25
  const { layouts } = (0, useCntrlContext_1.useCntrlContext)();
26
26
  const layoutId = (0, useLayoutContext_1.useLayoutContext)();
27
- const { radius: itemRadius, strokeWidth: itemStrokeWidth, opacity: itemOpacity, strokeColor: itemStrokeColor, blur: itemBlur } = (0, useFileItem_1.useFileItem)(item, sectionId);
27
+ const { radius: itemRadius, strokeWidth: itemStrokeWidth, opacity: itemOpacity, strokeFill: itemStrokeFill, blur: itemBlur } = (0, useFileItem_1.useFileItem)(item, sectionId);
28
28
  const itemAngle = (0, useItemAngle_1.useItemAngle)(item, sectionId);
29
29
  const [wrapperRef, setWrapperRef] = (0, react_1.useState)(null);
30
30
  (0, useRegisterResize_1.useRegisterResize)(wrapperRef, onResize);
@@ -38,7 +38,10 @@ const ImageItem = ({ item, sectionId, onResize, interactionCtrl, onVisibilityCha
38
38
  const width = area && exemplary ? area.width * exemplary : 0;
39
39
  const height = area && exemplary ? area.height * exemplary : 0;
40
40
  const wrapperStateParams = interactionCtrl === null || interactionCtrl === void 0 ? void 0 : interactionCtrl.getState(['angle', 'opacity', 'blur']);
41
- const imgStateParams = interactionCtrl === null || interactionCtrl === void 0 ? void 0 : interactionCtrl.getState(['strokeWidth', 'radius', 'strokeColor']);
41
+ const imgStateParams = interactionCtrl === null || interactionCtrl === void 0 ? void 0 : interactionCtrl.getState(['strokeWidth', 'radius']);
42
+ const stateStrokeFillParams = interactionCtrl === null || interactionCtrl === void 0 ? void 0 : interactionCtrl.getState(['strokeFill']);
43
+ const stateStrokeFillLayers = (_b = stateStrokeFillParams === null || stateStrokeFillParams === void 0 ? void 0 : stateStrokeFillParams.styles) === null || _b === void 0 ? void 0 : _b.strokeFill;
44
+ const strokeSolidTransition = (_c = stateStrokeFillParams === null || stateStrokeFillParams === void 0 ? void 0 : stateStrokeFillParams.transition) !== null && _c !== void 0 ? _c : 'none';
42
45
  (0, react_1.useEffect)(() => {
43
46
  isInitialRef.current = false;
44
47
  }, []);
@@ -48,66 +51,90 @@ const ImageItem = ({ item, sectionId, onResize, interactionCtrl, onVisibilityCha
48
51
  controlsValues
49
52
  }, width, height);
50
53
  const rect = (0, useElementRect_1.useElementRect)(wrapperRef);
51
- const rectWidth = Math.floor((_b = rect === null || rect === void 0 ? void 0 : rect.width) !== null && _b !== void 0 ? _b : 0);
52
- const rectHeight = Math.floor((_c = rect === null || rect === void 0 ? void 0 : rect.height) !== null && _c !== void 0 ? _c : 0);
53
- const borderColor = (0, react_1.useMemo)(() => {
54
- var _a;
55
- const borderColor = (0, getStyleFromItemStateAndParams_1.getStyleFromItemStateAndParams)((_a = imgStateParams === null || imgStateParams === void 0 ? void 0 : imgStateParams.styles) === null || _a === void 0 ? void 0 : _a.strokeColor, itemStrokeColor);
56
- return borderColor ? color_1.CntrlColor.parse(borderColor) : undefined;
57
- }, [itemStrokeColor, (_d = imgStateParams === null || imgStateParams === void 0 ? void 0 : imgStateParams.styles) === null || _d === void 0 ? void 0 : _d.strokeColor]);
58
- const radius = (0, getStyleFromItemStateAndParams_1.getStyleFromItemStateAndParams)((_e = imgStateParams === null || imgStateParams === void 0 ? void 0 : imgStateParams.styles) === null || _e === void 0 ? void 0 : _e.radius, itemRadius);
59
- const strokeWidth = (0, getStyleFromItemStateAndParams_1.getStyleFromItemStateAndParams)((_f = imgStateParams === null || imgStateParams === void 0 ? void 0 : imgStateParams.styles) === null || _f === void 0 ? void 0 : _f.strokeWidth, itemStrokeWidth);
60
- const angle = (0, getStyleFromItemStateAndParams_1.getStyleFromItemStateAndParams)((_g = wrapperStateParams === null || wrapperStateParams === void 0 ? void 0 : wrapperStateParams.styles) === null || _g === void 0 ? void 0 : _g.angle, itemAngle);
61
- const opacity = (0, getStyleFromItemStateAndParams_1.getStyleFromItemStateAndParams)((_h = wrapperStateParams === null || wrapperStateParams === void 0 ? void 0 : wrapperStateParams.styles) === null || _h === void 0 ? void 0 : _h.opacity, itemOpacity);
62
- const blur = (0, getStyleFromItemStateAndParams_1.getStyleFromItemStateAndParams)((_j = wrapperStateParams === null || wrapperStateParams === void 0 ? void 0 : wrapperStateParams.styles) === null || _j === void 0 ? void 0 : _j.blur, itemBlur);
63
- const inlineStyles = Object.assign(Object.assign(Object.assign(Object.assign({}, (borderColor ? { borderColor: `${borderColor.fmt('rgba')}` } : {})), (radius !== undefined ? { borderRadius: `${radius * 100}vw` } : {})), (strokeWidth !== undefined ? { borderWidth: `${strokeWidth * 100}vw` } : {})), { transition: (_k = imgStateParams === null || imgStateParams === void 0 ? void 0 : imgStateParams.transition) !== null && _k !== void 0 ? _k : 'none' });
54
+ const rectWidth = Math.floor((_d = rect === null || rect === void 0 ? void 0 : rect.width) !== null && _d !== void 0 ? _d : 0);
55
+ const rectHeight = Math.floor((_e = rect === null || rect === void 0 ? void 0 : rect.height) !== null && _e !== void 0 ? _e : 0);
56
+ const radius = (0, getStyleFromItemStateAndParams_1.getStyleFromItemStateAndParams)((_f = imgStateParams === null || imgStateParams === void 0 ? void 0 : imgStateParams.styles) === null || _f === void 0 ? void 0 : _f.radius, itemRadius);
57
+ const strokeWidth = (0, getStyleFromItemStateAndParams_1.getStyleFromItemStateAndParams)((_g = imgStateParams === null || imgStateParams === void 0 ? void 0 : imgStateParams.styles) === null || _g === void 0 ? void 0 : _g.strokeWidth, itemStrokeWidth);
58
+ const angle = (0, getStyleFromItemStateAndParams_1.getStyleFromItemStateAndParams)((_h = wrapperStateParams === null || wrapperStateParams === void 0 ? void 0 : wrapperStateParams.styles) === null || _h === void 0 ? void 0 : _h.angle, itemAngle);
59
+ const opacity = (0, getStyleFromItemStateAndParams_1.getStyleFromItemStateAndParams)((_j = wrapperStateParams === null || wrapperStateParams === void 0 ? void 0 : wrapperStateParams.styles) === null || _j === void 0 ? void 0 : _j.opacity, itemOpacity);
60
+ const blur = (0, getStyleFromItemStateAndParams_1.getStyleFromItemStateAndParams)((_k = wrapperStateParams === null || wrapperStateParams === void 0 ? void 0 : wrapperStateParams.styles) === null || _k === void 0 ? void 0 : _k.blur, itemBlur);
61
+ const strokeValue = stateStrokeFillLayers
62
+ ? (0, getStyleFromItemStateAndParams_1.getStyleFromItemStateAndParams)(stateStrokeFillLayers[0], itemStrokeFill === null || itemStrokeFill === void 0 ? void 0 : itemStrokeFill[0])
63
+ : itemStrokeFill === null || itemStrokeFill === void 0 ? void 0 : itemStrokeFill[0];
64
+ const stroke = strokeValue
65
+ ? (_l = (0, getFill_1.getFill)(strokeValue)) !== null && _l !== void 0 ? _l : 'transparent'
66
+ : 'transparent';
67
+ const inlineStyles = Object.assign(Object.assign(Object.assign({}, (radius !== undefined ? { borderRadius: `${radius * 100}vw` } : {})), (strokeWidth !== undefined ? { borderWidth: `${strokeWidth * 100}vw` } : {})), { transition: (_m = imgStateParams === null || imgStateParams === void 0 ? void 0 : imgStateParams.transition) !== null && _m !== void 0 ? _m : 'none' });
64
68
  const isInteractive = opacity !== 0;
65
69
  (0, react_1.useEffect)(() => {
66
70
  onVisibilityChange === null || onVisibilityChange === void 0 ? void 0 : onVisibilityChange(isInteractive);
67
71
  }, [isInteractive, onVisibilityChange]);
68
- return ((0, jsx_runtime_1.jsx)(LinkWrapper_1.LinkWrapper, { url: (_l = item.link) === null || _l === void 0 ? void 0 : _l.url, target: (_m = item.link) === null || _m === void 0 ? void 0 : _m.target, children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: `image-wrapper-${item.id}`, ref: setWrapperRef, style: Object.assign(Object.assign(Object.assign(Object.assign({}, (opacity !== undefined ? { opacity } : {})), (angle !== undefined ? { transform: `rotate(${angle}deg)` } : {})), (blur !== undefined ? { filter: `blur(${blur * 100}vw)` } : {})), { willChange: blur !== 0 && blur !== undefined ? 'transform' : 'unset', transition: (_o = wrapperStateParams === null || wrapperStateParams === void 0 ? void 0 : wrapperStateParams.transition) !== null && _o !== void 0 ? _o : 'none' }), children: hasGLEffect && isFXAllowed
69
- ? ((0, jsx_runtime_1.jsx)("canvas", { style: inlineStyles, ref: fxCanvas, className: `img-canvas image-${item.id}`, width: rectWidth, height: rectHeight }))
70
- : ((0, jsx_runtime_1.jsx)("img", { alt: "", className: `image image-${item.id}`, style: inlineStyles, src: item.commonParams.url })) }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
71
- .image-wrapper-${item.id} {
72
- position: absolute;
73
- width: 100%;
74
- height: 100%;
75
- box-sizing: border-box;
76
- display: flex;
77
- }
78
- .image {
79
- width: 100%;
80
- height: 100%;
81
- opacity: 1;
82
- object-fit: cover;
83
- pointer-events: none;
84
- border-style: solid;
85
- overflow: hidden;
86
- box-sizing: border-box;
87
- }
88
- .img-canvas {
89
- border: solid;
90
- width: 100%;
91
- height: 100%;
92
- pointer-events: none;
93
- border-width: 0;
94
- box-sizing: border-box;
95
- }
72
+ return ((0, jsx_runtime_1.jsx)(LinkWrapper_1.LinkWrapper, { url: (_o = item.link) === null || _o === void 0 ? void 0 : _o.url, target: (_p = item.link) === null || _p === void 0 ? void 0 : _p.target, children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: `image-wrapper-${item.id}`, ref: setWrapperRef, style: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (opacity !== undefined ? { opacity } : {})), (angle !== undefined ? { transform: `rotate(${angle}deg)` } : {})), (blur !== undefined ? { filter: `blur(${blur * 100}vw)` } : {})), (strokeValue ? Object.assign({ '--stroke-background': stroke }, (strokeValue.type === 'image' ? {
73
+ '--stroke-background-position': 'center',
74
+ '--stroke-background-size': strokeValue.behavior === 'repeat' ? `${strokeValue.backgroundSize}%` : strokeValue.behavior,
75
+ '--stroke-background-repeat': strokeValue.behavior === 'repeat' ? 'repeat' : 'no-repeat'
76
+ } : {})) : {})), { willChange: blur !== 0 && blur !== undefined ? 'transform' : 'unset', transition: (_q = wrapperStateParams === null || wrapperStateParams === void 0 ? void 0 : wrapperStateParams.transition) !== null && _q !== void 0 ? _q : 'none' }), children: [hasGLEffect && isFXAllowed
77
+ ? ((0, jsx_runtime_1.jsx)("canvas", { style: inlineStyles, ref: fxCanvas, className: `img-canvas image-${item.id}`, width: rectWidth, height: rectHeight }))
78
+ : ((0, jsx_runtime_1.jsx)("img", { alt: "", className: `image image-${item.id}`, style: inlineStyles, src: item.commonParams.url })), (0, jsx_runtime_1.jsx)("div", { className: `image-border-${item.id}`, style: Object.assign({ position: 'absolute', inset: 0, borderRadius: 'inherit', pointerEvents: 'none', zIndex: 2, WebkitMask: 'linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)', WebkitMaskComposite: 'xor', maskComposite: 'exclude' }, (strokeWidth !== 0 && strokeValue ? Object.assign(Object.assign(Object.assign({}, (strokeWidth ? { padding: `${strokeWidth * 100}vw` } : {})), (strokeValue.type === 'solid' ? { transition: strokeSolidTransition, background: stroke } : {})), (strokeValue.type === 'image' ? {
79
+ backgroundPosition: 'center',
80
+ backgroundSize: strokeValue.behavior === 'repeat' ? `${strokeValue.backgroundSize}%` : strokeValue.behavior,
81
+ backgroundRepeat: strokeValue.behavior === 'repeat' ? 'repeat' : 'no-repeat'
82
+ } : {
83
+ background: stroke,
84
+ })) : { background: stroke })) })] }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
85
+ .image-wrapper-${item.id} {
86
+ position: absolute;
87
+ width: 100%;
88
+ height: 100%;
89
+ box-sizing: border-box;
90
+ display: flex;
91
+ }
92
+ .image {
93
+ width: 100%;
94
+ height: 100%;
95
+ opacity: 1;
96
+ object-fit: cover;
97
+ pointer-events: none;
98
+ border-style: solid;
99
+ overflow: hidden;
100
+ box-sizing: border-box;
101
+ }
102
+ .img-canvas {
103
+ border: solid;
104
+ width: 100%;
105
+ height: 100%;
106
+ pointer-events: none;
107
+ border-width: 0;
108
+ box-sizing: border-box;
109
+ }
96
110
  ${(0, sdk_1.getLayoutStyles)(layouts, layoutValues, ([area, layoutParams]) => {
97
- return (`
98
- .image-wrapper-${item.id} {
99
- opacity: ${layoutParams.opacity};
100
- transform: rotate(${area.angle}deg);
101
- filter: ${layoutParams.blur !== 0 ? `blur(${layoutParams.blur * 100}vw)` : 'unset'};
102
- ${layoutParams.blur !== 0 ? 'will-change: transform;' : ''}
103
- }
104
- .image-${item.id} {
105
- border-color: ${color_1.CntrlColor.parse(layoutParams.strokeColor).fmt('rgba')};
106
- border-radius: ${layoutParams.radius * 100}vw;
107
- border-width: ${layoutParams.strokeWidth * 100}vw;
108
- }
111
+ return (`
112
+ .image-wrapper-${item.id} {
113
+ opacity: ${layoutParams.opacity};
114
+ transform: rotate(${area.angle}deg);
115
+ filter: ${layoutParams.blur !== 0 ? `blur(${layoutParams.blur * 100}vw)` : 'unset'};
116
+ ${layoutParams.blur !== 0 ? 'will-change: transform;' : ''}
117
+ }
118
+ .image-${item.id} {
119
+ border: solid;
120
+ border-color: transparent;
121
+ border-width: ${layoutParams.strokeWidth * 100}vw;
122
+ border-radius: ${layoutParams.radius * 100}vw;
123
+ }
124
+ .image-border-${item.id} {
125
+ position: absolute;
126
+ inset: 0;
127
+ border-radius: inherit;
128
+ pointer-events: none;
129
+ z-index: 2;
130
+ -webkit-mask:
131
+ linear-gradient(#fff 0 0) content-box,
132
+ linear-gradient(#fff 0 0);
133
+ -webkit-mask-composite: xor;
134
+ mask-composite: exclude;
135
+ }
109
136
  `);
110
- })}
137
+ })}
111
138
  ` })] }) }));
112
139
  };
113
140
  exports.ImageItem = ImageItem;
@@ -7,7 +7,6 @@ exports.VideoItem = void 0;
7
7
  const jsx_runtime_1 = require("react/jsx-runtime");
8
8
  const react_1 = require("react");
9
9
  const style_1 = __importDefault(require("styled-jsx/style"));
10
- const color_1 = require("@cntrl-site/color");
11
10
  const sdk_1 = require("@cntrl-site/sdk");
12
11
  const LinkWrapper_1 = require("../LinkWrapper");
13
12
  const useFileItem_1 = require("./useFileItem");
@@ -20,12 +19,13 @@ const getStyleFromItemStateAndParams_1 = require("../../../utils/getStyleFromIte
20
19
  const useVideoFx_1 = require("../../../utils/effects/useVideoFx");
21
20
  const useElementRect_1 = require("../../../utils/useElementRect");
22
21
  const useItemFXData_1 = require("../../../common/useItemFXData");
22
+ const getFill_1 = require("../../../utils/getFill");
23
23
  const VideoItem = ({ item, sectionId, onResize, interactionCtrl, onVisibilityChange }) => {
24
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
24
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
25
25
  const id = (0, react_1.useId)();
26
26
  const { layouts } = (0, useCntrlContext_1.useCntrlContext)();
27
27
  const layoutId = (0, useLayoutContext_1.useLayoutContext)();
28
- const { radius: itemRadius, strokeWidth: itemStrokeWidth, strokeColor: itemStrokeColor, opacity: itemOpacity, blur: itemBlur } = (0, useFileItem_1.useFileItem)(item, sectionId);
28
+ const { radius: itemRadius, strokeWidth: itemStrokeWidth, strokeFill: itemStrokeFill, opacity: itemOpacity, blur: itemBlur } = (0, useFileItem_1.useFileItem)(item, sectionId);
29
29
  const [isVideoPlaying, setIsVideoPlaying] = (0, react_1.useState)(false);
30
30
  const isScrollPausedRef = (0, react_1.useRef)(false);
31
31
  const [userPaused, setUserPaused] = (0, react_1.useState)(false);
@@ -49,17 +49,21 @@ const VideoItem = ({ item, sectionId, onResize, interactionCtrl, onVisibilityCha
49
49
  const layoutValues = [item.area, item.layoutParams];
50
50
  const hasScrollPlayback = scrollPlayback !== null;
51
51
  const wrapperStateParams = interactionCtrl === null || interactionCtrl === void 0 ? void 0 : interactionCtrl.getState(['angle', 'opacity', 'blur']);
52
- const videoStateParams = interactionCtrl === null || interactionCtrl === void 0 ? void 0 : interactionCtrl.getState(['strokeWidth', 'radius', 'strokeColor']);
53
- const borderColor = (0, react_1.useMemo)(() => {
54
- var _a;
55
- const strokeColor = (0, getStyleFromItemStateAndParams_1.getStyleFromItemStateAndParams)((_a = videoStateParams === null || videoStateParams === void 0 ? void 0 : videoStateParams.styles) === null || _a === void 0 ? void 0 : _a.color, itemStrokeColor);
56
- return strokeColor ? color_1.CntrlColor.parse(strokeColor) : undefined;
57
- }, [(_d = videoStateParams === null || videoStateParams === void 0 ? void 0 : videoStateParams.styles) === null || _d === void 0 ? void 0 : _d.color, itemStrokeColor]);
58
- const angle = (0, getStyleFromItemStateAndParams_1.getStyleFromItemStateAndParams)((_e = wrapperStateParams === null || wrapperStateParams === void 0 ? void 0 : wrapperStateParams.styles) === null || _e === void 0 ? void 0 : _e.angle, itemAngle);
59
- const opacity = (0, getStyleFromItemStateAndParams_1.getStyleFromItemStateAndParams)((_f = wrapperStateParams === null || wrapperStateParams === void 0 ? void 0 : wrapperStateParams.styles) === null || _f === void 0 ? void 0 : _f.opacity, itemOpacity);
60
- const blur = (0, getStyleFromItemStateAndParams_1.getStyleFromItemStateAndParams)((_g = wrapperStateParams === null || wrapperStateParams === void 0 ? void 0 : wrapperStateParams.styles) === null || _g === void 0 ? void 0 : _g.blur, itemBlur);
61
- const strokeWidth = (0, getStyleFromItemStateAndParams_1.getStyleFromItemStateAndParams)((_h = wrapperStateParams === null || wrapperStateParams === void 0 ? void 0 : wrapperStateParams.styles) === null || _h === void 0 ? void 0 : _h.strokeWidth, itemStrokeWidth);
62
- const radius = (0, getStyleFromItemStateAndParams_1.getStyleFromItemStateAndParams)((_j = wrapperStateParams === null || wrapperStateParams === void 0 ? void 0 : wrapperStateParams.styles) === null || _j === void 0 ? void 0 : _j.radius, itemRadius);
52
+ const videoStateParams = interactionCtrl === null || interactionCtrl === void 0 ? void 0 : interactionCtrl.getState(['strokeWidth', 'radius']);
53
+ const stateStrokeFillParams = interactionCtrl === null || interactionCtrl === void 0 ? void 0 : interactionCtrl.getState(['strokeFill']);
54
+ const stateStrokeFillLayers = (_d = stateStrokeFillParams === null || stateStrokeFillParams === void 0 ? void 0 : stateStrokeFillParams.styles) === null || _d === void 0 ? void 0 : _d.strokeFill;
55
+ const strokeSolidTransition = (_e = stateStrokeFillParams === null || stateStrokeFillParams === void 0 ? void 0 : stateStrokeFillParams.transition) !== null && _e !== void 0 ? _e : 'none';
56
+ const angle = (0, getStyleFromItemStateAndParams_1.getStyleFromItemStateAndParams)((_f = wrapperStateParams === null || wrapperStateParams === void 0 ? void 0 : wrapperStateParams.styles) === null || _f === void 0 ? void 0 : _f.angle, itemAngle);
57
+ const opacity = (0, getStyleFromItemStateAndParams_1.getStyleFromItemStateAndParams)((_g = wrapperStateParams === null || wrapperStateParams === void 0 ? void 0 : wrapperStateParams.styles) === null || _g === void 0 ? void 0 : _g.opacity, itemOpacity);
58
+ const blur = (0, getStyleFromItemStateAndParams_1.getStyleFromItemStateAndParams)((_h = wrapperStateParams === null || wrapperStateParams === void 0 ? void 0 : wrapperStateParams.styles) === null || _h === void 0 ? void 0 : _h.blur, itemBlur);
59
+ const strokeWidth = (0, getStyleFromItemStateAndParams_1.getStyleFromItemStateAndParams)((_j = wrapperStateParams === null || wrapperStateParams === void 0 ? void 0 : wrapperStateParams.styles) === null || _j === void 0 ? void 0 : _j.strokeWidth, itemStrokeWidth);
60
+ const radius = (0, getStyleFromItemStateAndParams_1.getStyleFromItemStateAndParams)((_k = wrapperStateParams === null || wrapperStateParams === void 0 ? void 0 : wrapperStateParams.styles) === null || _k === void 0 ? void 0 : _k.radius, itemRadius);
61
+ const strokeValue = stateStrokeFillLayers
62
+ ? (0, getStyleFromItemStateAndParams_1.getStyleFromItemStateAndParams)(stateStrokeFillLayers[0], itemStrokeFill === null || itemStrokeFill === void 0 ? void 0 : itemStrokeFill[0])
63
+ : itemStrokeFill === null || itemStrokeFill === void 0 ? void 0 : itemStrokeFill[0];
64
+ const stroke = strokeValue
65
+ ? (_l = (0, getFill_1.getFill)(strokeValue)) !== null && _l !== void 0 ? _l : 'transparent'
66
+ : 'transparent';
63
67
  (0, react_1.useEffect)(() => {
64
68
  isInitialRef.current = false;
65
69
  }, []);
@@ -69,7 +73,7 @@ const VideoItem = ({ item, sectionId, onResize, interactionCtrl, onVisibilityCha
69
73
  controls: controlsValues
70
74
  }, width, height);
71
75
  (0, useRegisterResize_1.useRegisterResize)(ref, onResize);
72
- const inlineStyles = Object.assign(Object.assign(Object.assign(Object.assign({}, (radius !== undefined ? { borderRadius: `${radius * 100}vw` } : {})), (strokeWidth !== undefined ? { borderWidth: `${strokeWidth * 100}vw` } : {})), (borderColor ? { borderColor: `${borderColor.toCss()}` } : {})), { transition: (_k = videoStateParams === null || videoStateParams === void 0 ? void 0 : videoStateParams.transition) !== null && _k !== void 0 ? _k : 'none' });
76
+ const inlineStyles = Object.assign(Object.assign(Object.assign({}, (radius !== undefined ? { borderRadius: `${radius * 100}vw` } : {})), (strokeWidth !== undefined ? { borderWidth: `${strokeWidth * 100}vw` } : {})), { transition: (_m = videoStateParams === null || videoStateParams === void 0 ? void 0 : videoStateParams.transition) !== null && _m !== void 0 ? _m : 'none' });
73
77
  const isInteractive = opacity !== 0;
74
78
  (0, react_1.useEffect)(() => {
75
79
  onVisibilityChange === null || onVisibilityChange === void 0 ? void 0 : onVisibilityChange(isInteractive);
@@ -92,7 +96,11 @@ const VideoItem = ({ item, sectionId, onResize, interactionCtrl, onVisibilityCha
92
96
  observer.observe(ref);
93
97
  return () => observer.disconnect();
94
98
  }, [layoutParams, videoRef, ref, userPaused, isVideoInteracted]);
95
- return ((0, jsx_runtime_1.jsxs)(LinkWrapper_1.LinkWrapper, { url: (_l = item.link) === null || _l === void 0 ? void 0 : _l.url, target: (_m = item.link) === null || _m === void 0 ? void 0 : _m.target, children: [(0, jsx_runtime_1.jsxs)("div", { className: `video-wrapper-${item.id}`, ref: setRef, style: Object.assign(Object.assign(Object.assign(Object.assign({}, (opacity !== undefined ? { opacity } : {})), (angle !== undefined ? { transform: `rotate(${angle}deg)` } : {})), (blur !== undefined ? { filter: `blur(${blur * 100}vw)` } : {})), { willChange: blur !== 0 && blur !== undefined ? 'transform' : 'unset', transition: (_o = wrapperStateParams === null || wrapperStateParams === void 0 ? void 0 : wrapperStateParams.transition) !== null && _o !== void 0 ? _o : 'none' }), children: [hasScrollPlayback && ((0, jsx_runtime_1.jsx)(ScrollPlaybackVideo_1.ScrollPlaybackVideo, { sectionId: sectionId, src: item.commonParams.url, playbackParams: scrollPlayback, style: inlineStyles, className: `video video-playback-wrapper video-${item.id}` })), hasGLEffect && isFXAllowed && ((0, jsx_runtime_1.jsx)("canvas", { style: inlineStyles, ref: fxCanvas, className: `video-canvas video-${item.id}`, width: rectWidth, height: rectHeight })), !hasScrollPlayback && !hasGLEffect && layoutParams && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("video", { poster: (_p = item.commonParams.coverUrl) !== null && _p !== void 0 ? _p : '', ref: setVideoRef, autoPlay: layoutParams.play === 'auto', preload: "auto", onClick: () => {
99
+ return ((0, jsx_runtime_1.jsxs)(LinkWrapper_1.LinkWrapper, { url: (_o = item.link) === null || _o === void 0 ? void 0 : _o.url, target: (_p = item.link) === null || _p === void 0 ? void 0 : _p.target, children: [(0, jsx_runtime_1.jsxs)("div", { className: `video-wrapper-${item.id}`, ref: setRef, style: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (opacity !== undefined ? { opacity } : {})), (angle !== undefined ? { transform: `rotate(${angle}deg)` } : {})), (blur !== undefined ? { filter: `blur(${blur * 100}vw)` } : {})), (strokeValue ? Object.assign({ '--stroke-background': stroke }, (strokeValue.type === 'image' ? {
100
+ '--stroke-background-position': 'center',
101
+ '--stroke-background-size': strokeValue.behavior === 'repeat' ? `${strokeValue.backgroundSize}%` : strokeValue.behavior,
102
+ '--stroke-background-repeat': strokeValue.behavior === 'repeat' ? 'repeat' : 'no-repeat'
103
+ } : {})) : {})), { willChange: blur !== 0 && blur !== undefined ? 'transform' : 'unset', transition: (_q = wrapperStateParams === null || wrapperStateParams === void 0 ? void 0 : wrapperStateParams.transition) !== null && _q !== void 0 ? _q : 'none' }), children: [hasScrollPlayback && ((0, jsx_runtime_1.jsx)(ScrollPlaybackVideo_1.ScrollPlaybackVideo, { sectionId: sectionId, src: item.commonParams.url, playbackParams: scrollPlayback, style: inlineStyles, className: `video video-playback-wrapper video-${item.id}` })), hasGLEffect && isFXAllowed && ((0, jsx_runtime_1.jsx)("canvas", { style: inlineStyles, ref: fxCanvas, className: `video-canvas video-${item.id}`, width: rectWidth, height: rectHeight })), !hasScrollPlayback && !hasGLEffect && layoutParams && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("video", { poster: (_r = item.commonParams.coverUrl) !== null && _r !== void 0 ? _r : '', ref: setVideoRef, autoPlay: layoutParams.play === 'auto', preload: "auto", onClick: () => {
96
104
  setIsVideoInteracted(true);
97
105
  }, muted: layoutParams.muted, onPlay: () => {
98
106
  setIsVideoPlaying(true);
@@ -115,7 +123,7 @@ const VideoItem = ({ item, sectionId, onResize, interactionCtrl, onVisibilityCha
115
123
  return;
116
124
  setIsVideoInteracted(true);
117
125
  videoRef.play();
118
- }, src: (_q = item.commonParams.coverUrl) !== null && _q !== void 0 ? _q : '', className: `video-cover-${item.id}`, onClick: () => {
126
+ }, src: (_s = item.commonParams.coverUrl) !== null && _s !== void 0 ? _s : '', className: `video-cover-${item.id}`, onClick: () => {
119
127
  if (!videoRef)
120
128
  return;
121
129
  setIsVideoInteracted(true);
@@ -130,71 +138,90 @@ const VideoItem = ({ item, sectionId, onResize, interactionCtrl, onVisibilityCha
130
138
  else {
131
139
  videoRef.play();
132
140
  }
133
- } })))] }))] }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
134
- .video-wrapper-${item.id} {
135
- position: absolute;
136
- overflow: hidden;
137
- width: 100%;
138
- height: 100%;
139
- box-sizing: border-box;
140
- opacity: ${opacity};
141
- }
142
- .video-overlay-${item.id} {
143
- position: absolute;
144
- top: 0;
145
- left: 0;
146
- cursor: pointer;
147
- width: 100%;
148
- height: 100%;
149
- }
150
- .video-cover-${item.id} {
151
- position: absolute;
152
- top: 0;
153
- left: 0;
154
- cursor: pointer;
155
- width: 100%;
156
- height: 100%;
157
- object-fit: cover;
158
- }
159
- .video {
160
- width: 100%;
161
- height: 100%;
162
- box-sizing: border-box;
163
- opacity: 1;
164
- object-fit: cover;
165
- overflow: hidden;
166
- border-style: solid;
167
- }
168
- .video-${item.id} {
169
- border-color: ${itemStrokeColor};
170
- }
171
- .video-playback-wrapper {
172
- display: flex;
173
- justify-content: center;
174
- }
175
- .video-canvas {
176
- border: solid;
177
- width: 100%;
178
- height: 100%;
179
- pointer-events: none;
180
- border-width: 0;
181
- box-sizing: border-box;
182
- }
141
+ } })))] })), (0, jsx_runtime_1.jsx)("div", { className: `video-border-${item.id}`, style: Object.assign({ position: 'absolute', inset: 0, borderRadius: 'inherit', pointerEvents: 'none', zIndex: 2, WebkitMask: 'linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)', WebkitMaskComposite: 'xor', maskComposite: 'exclude' }, (strokeWidth !== 0 && strokeValue ? Object.assign(Object.assign(Object.assign({}, (strokeWidth ? { padding: `${strokeWidth * 100}vw` } : {})), (strokeValue.type === 'solid' ? { transition: strokeSolidTransition, background: stroke } : {})), (strokeValue.type === 'image' ? {
142
+ backgroundPosition: 'center',
143
+ backgroundSize: strokeValue.behavior === 'repeat' ? `${strokeValue.backgroundSize}%` : strokeValue.behavior,
144
+ backgroundRepeat: strokeValue.behavior === 'repeat' ? 'repeat' : 'no-repeat'
145
+ } : {
146
+ background: stroke,
147
+ })) : { background: stroke })) })] }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
148
+ .video-wrapper-${item.id} {
149
+ position: absolute;
150
+ overflow: hidden;
151
+ width: 100%;
152
+ height: 100%;
153
+ box-sizing: border-box;
154
+ opacity: ${opacity};
155
+ }
156
+ .video-overlay-${item.id} {
157
+ position: absolute;
158
+ top: 0;
159
+ left: 0;
160
+ cursor: pointer;
161
+ width: 100%;
162
+ height: 100%;
163
+ }
164
+ .video-cover-${item.id} {
165
+ position: absolute;
166
+ top: 0;
167
+ left: 0;
168
+ cursor: pointer;
169
+ width: 100%;
170
+ height: 100%;
171
+ object-fit: cover;
172
+ }
173
+ .video {
174
+ width: 100%;
175
+ height: 100%;
176
+ box-sizing: border-box;
177
+ opacity: 1;
178
+ object-fit: cover;
179
+ overflow: hidden;
180
+ border-style: solid;
181
+ }
182
+ .video-${item.id} {
183
+ border-radius: ${radius !== undefined ? `${radius * 100}vw` : '0'};
184
+ }
185
+ .video-playback-wrapper {
186
+ display: flex;
187
+ justify-content: center;
188
+ }
189
+ .video-canvas {
190
+ border: solid;
191
+ width: 100%;
192
+ height: 100%;
193
+ pointer-events: none;
194
+ border-width: 0;
195
+ box-sizing: border-box;
196
+ }
183
197
  ${(0, sdk_1.getLayoutStyles)(layouts, layoutValues, ([area, layoutParams]) => {
184
- return (`
185
- .video-wrapper-${item.id} {
186
- opacity: ${layoutParams.opacity};
187
- transform: rotate(${area.angle}deg);
188
- filter: ${layoutParams.blur !== 0 ? `blur(${layoutParams.blur * 100}vw)` : 'unset'};
189
- ${layoutParams.blur !== 0 ? 'will-change: transform;' : ''}
190
- }
191
- .video-${item.id} {
192
- border-color: ${color_1.CntrlColor.parse(layoutParams.strokeColor).fmt('rgba')};
193
- border-radius: ${layoutParams.radius * 100}vw;
194
- border-width: ${layoutParams.strokeWidth * 100}vw;
195
- }
198
+ return (`
199
+ .video-wrapper-${item.id} {
200
+ opacity: ${layoutParams.opacity};
201
+ transform: rotate(${area.angle}deg);
202
+ filter: ${layoutParams.blur !== 0 ? `blur(${layoutParams.blur * 100}vw)` : 'unset'};
203
+ ${layoutParams.blur !== 0 ? 'will-change: transform;' : ''}
204
+ }
205
+ .video-${item.id} {
206
+ border: solid;
207
+ border-color: transparent;
208
+ border-width: ${layoutParams.strokeWidth * 100}vw;
209
+ border-radius: ${layoutParams.radius * 100}vw;
210
+ }
211
+ .video-border-${item.id} {
212
+ position: absolute;
213
+ inset: 0;
214
+ border-radius: inherit;
215
+ pointer-events: none;
216
+ z-index: 2;
217
+ -webkit-mask:
218
+ linear-gradient(#fff 0 0) content-box,
219
+ linear-gradient(#fff 0 0);
220
+ -webkit-mask-composite: xor;
221
+ mask-composite: exclude;
222
+ }
196
223
  `);
197
- })}
224
+ })}
198
225
  ` })] }));
199
226
  };
200
227
  exports.VideoItem = VideoItem;
@@ -4,7 +4,14 @@ exports.useFileItem = void 0;
4
4
  const sdk_1 = require("@cntrl-site/sdk");
5
5
  const useKeyframeValue_1 = require("../../../common/useKeyframeValue");
6
6
  const useLayoutContext_1 = require("../../useLayoutContext");
7
- const DEFAULT_COLOR = 'rgba(0, 0, 0, 1)';
7
+ const DEFAULT_FILL = [
8
+ {
9
+ id: 'default',
10
+ type: 'solid',
11
+ value: 'rgba(0, 0, 0, 1)',
12
+ blendMode: 'normal'
13
+ }
14
+ ];
8
15
  function useFileItem(item, sectionId) {
9
16
  const layoutId = (0, useLayoutContext_1.useLayoutContext)();
10
17
  const radius = (0, useKeyframeValue_1.useKeyframeValue)(item, sdk_1.KeyframeType.BorderRadius, (item, layoutId) => {
@@ -25,18 +32,18 @@ function useFileItem(item, sectionId) {
25
32
  const layoutParams = item.layoutParams[layoutId];
26
33
  return 'opacity' in layoutParams ? layoutParams.opacity : 1;
27
34
  }, (animator, scroll, value) => value !== undefined ? animator.getOpacity({ opacity: value }, scroll).opacity : undefined, sectionId, [layoutId]);
28
- const strokeColor = (0, useKeyframeValue_1.useKeyframeValue)(item, sdk_1.KeyframeType.BorderColor, (item, layoutId) => {
35
+ const strokeFill = (0, useKeyframeValue_1.useKeyframeValue)(item, sdk_1.KeyframeType.BorderFill, (item, layoutId) => {
29
36
  if (!layoutId)
30
37
  return;
31
38
  const layoutParams = item.layoutParams[layoutId];
32
- return 'strokeColor' in layoutParams ? layoutParams.strokeColor : DEFAULT_COLOR;
33
- }, (animator, scroll, value) => value ? animator.getBorderColor({ color: value }, scroll).color : undefined, sectionId, [layoutId]);
39
+ return 'strokeFill' in layoutParams ? layoutParams.strokeFill : DEFAULT_FILL;
40
+ }, (animator, scroll, value) => value ? animator.getBorderFill(value, scroll) : undefined, sectionId, [layoutId]);
34
41
  const blur = (0, useKeyframeValue_1.useKeyframeValue)(item, sdk_1.KeyframeType.Blur, (item, layoutId) => {
35
42
  if (!layoutId)
36
43
  return;
37
44
  const layoutParams = item.layoutParams[layoutId];
38
45
  return 'blur' in layoutParams ? layoutParams.blur : 0;
39
46
  }, (animator, scroll, value) => value !== undefined ? animator.getBlur({ blur: value }, scroll).blur : undefined, sectionId, [layoutId]);
40
- return { radius, strokeWidth, opacity, strokeColor, blur };
47
+ return { radius, strokeWidth, opacity, strokeFill, blur };
41
48
  }
42
49
  exports.useFileItem = useFileItem;
@@ -34,22 +34,22 @@ const GroupItem = ({ item, sectionId, onResize, interactionCtrl, onVisibilityCha
34
34
  (0, react_1.useEffect)(() => {
35
35
  onVisibilityChange === null || onVisibilityChange === void 0 ? void 0 : onVisibilityChange(isInteractive);
36
36
  }, [isInteractive, onVisibilityChange]);
37
- return ((0, jsx_runtime_1.jsx)(LinkWrapper_1.LinkWrapper, { url: (_d = item.link) === null || _d === void 0 ? void 0 : _d.url, target: (_e = item.link) === null || _e === void 0 ? void 0 : _e.target, children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: `group-${item.id}`, ref: setRef, style: Object.assign(Object.assign(Object.assign(Object.assign({}, (opacity !== undefined ? { opacity } : {})), (angle !== undefined ? { transform: `rotate(${angle}deg)` } : {})), (blur !== undefined ? { filter: `blur(${blur * 100}vw)` } : {})), { transition: (_f = stateParams === null || stateParams === void 0 ? void 0 : stateParams.transition) !== null && _f !== void 0 ? _f : 'none', willChange: blur !== 0 && blur !== undefined ? 'transform' : 'unset' }), children: items && items.map(item => isInCompound ? ((0, jsx_runtime_1.jsx)(CompoundChild_1.CompoundChild, { item: item, sectionId: sectionId, isParentVisible: isInteractive }, item.id)) : ((0, jsx_runtime_1.jsx)(Item_1.Item, { item: item, sectionId: sectionId, isParentVisible: isInteractive, isInGroup: true }, item.id))) }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
38
- .group-${item.id} {
39
- position: absolute;
40
- width: 100%;
41
- height: 100%;
42
- box-sizing: border-box;
43
- }
37
+ return ((0, jsx_runtime_1.jsx)(LinkWrapper_1.LinkWrapper, { url: (_d = item.link) === null || _d === void 0 ? void 0 : _d.url, target: (_e = item.link) === null || _e === void 0 ? void 0 : _e.target, children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: `group-${item.id}`, ref: setRef, style: Object.assign(Object.assign(Object.assign(Object.assign({}, (opacity !== undefined ? { opacity } : {})), (angle !== undefined ? { transform: `rotate(${angle}deg)` } : {})), (blur !== undefined ? { filter: `blur(${blur * 100}vw)` } : {})), { transition: (_f = stateParams === null || stateParams === void 0 ? void 0 : stateParams.transition) !== null && _f !== void 0 ? _f : 'none', willChange: blur !== 0 && blur !== undefined ? 'transform' : 'unset' }), children: items && items.map(item => isInCompound ? ((0, jsx_runtime_1.jsx)(CompoundChild_1.CompoundChild, { item: item, sectionId: sectionId, isParentVisible: isInteractive }, item.id)) : ((0, jsx_runtime_1.jsx)(Item_1.Item, { item: item, sectionId: sectionId, isParentVisible: isInteractive, isInGroup: true }, item.id))) }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
38
+ .group-${item.id} {
39
+ position: absolute;
40
+ width: 100%;
41
+ height: 100%;
42
+ box-sizing: border-box;
43
+ }
44
44
  ${(0, sdk_1.getLayoutStyles)(layouts, layoutValues, ([area, layoutParams]) => {
45
- return (`
46
- .group-${item.id} {
47
- opacity: ${layoutParams.opacity};
48
- filter: ${layoutParams.blur !== 0 ? `blur(${layoutParams.blur * 100}vw)` : 'unset'};
49
- transform: rotate(${area.angle}deg);
50
- }
45
+ return (`
46
+ .group-${item.id} {
47
+ opacity: ${layoutParams.opacity};
48
+ filter: ${layoutParams.blur !== 0 ? `blur(${layoutParams.blur * 100}vw)` : 'unset'};
49
+ transform: rotate(${area.angle}deg);
50
+ }
51
51
  `);
52
- })}
52
+ })}
53
53
  ` })] }) }));
54
54
  };
55
55
  exports.GroupItem = GroupItem;