@cntrl-site/sdk-nextjs 1.1.5 → 1.2.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 (82) hide show
  1. package/.idea/modules.xml +8 -0
  2. package/.idea/sdk-nextjs.iml +12 -0
  3. package/.idea/vcs.xml +6 -0
  4. package/cntrl-site-sdk-nextjs-1.2.0.tgz +0 -0
  5. package/lib/components/Article.js +2 -2
  6. package/lib/components/{Section.js → Section/Section.js} +2 -2
  7. package/lib/components/{useSectionHeightMap.js → Section/useSectionHeightMap.js} +1 -1
  8. package/lib/components/items/{CodeEmbedItem.js → CodeEmbedItem/CodeEmbedItem.js} +2 -2
  9. package/lib/components/items/{useCodeEmbedItem.js → CodeEmbedItem/useCodeEmbedItem.js} +2 -2
  10. package/lib/components/items/CompoundItem/CompoundChild.js +95 -0
  11. package/lib/components/items/CompoundItem/CompoundItem.js +52 -0
  12. package/lib/components/items/CompoundItem/useCompoundItem.js +17 -0
  13. package/lib/components/items/{CustomItem.js → CustomItem/CustomItem.js} +2 -2
  14. package/lib/components/items/{VimeoEmbed.js → EmbedVideoItem/VimeoEmbed.js} +4 -4
  15. package/lib/components/items/{YoutubeEmbed.js → EmbedVideoItem/YoutubeEmbed.js} +5 -5
  16. package/lib/components/items/{useEmbedVideoItem.js → EmbedVideoItem/useEmbedVideoItem.js} +2 -2
  17. package/lib/components/items/{ImageItem.js → FileItem/ImageItem.js} +6 -6
  18. package/lib/components/items/{VideoItem.js → FileItem/VideoItem.js} +5 -5
  19. package/lib/components/items/{useFileItem.js → FileItem/useFileItem.js} +2 -2
  20. package/lib/components/items/{GroupItem.js → GroupItem/GroupItem.js} +5 -5
  21. package/lib/components/items/{useGroupItem.js → GroupItem/useGroupItem.js} +2 -2
  22. package/lib/components/{Item.js → items/Item.js} +39 -85
  23. package/lib/components/items/{RectangleItem.js → RectangleItem/RectangleItem.js} +3 -3
  24. package/lib/components/items/{useRectangleItem.js → RectangleItem/useRectangleItem.js} +2 -2
  25. package/lib/components/items/{RichTextItem.js → RichTextItem/RichTextItem.js} +7 -7
  26. package/lib/components/items/{useRichTextItem.js → RichTextItem/useRichTextItem.js} +2 -2
  27. package/lib/components/items/RichTextWrapper.js +10 -0
  28. package/lib/components/items/itemsMap.js +26 -0
  29. package/lib/components/{useItemAngle.js → items/useItemAngle.js} +1 -1
  30. package/lib/components/items/useItemArea.js +22 -0
  31. package/lib/components/items/useItemPointerEvents.js +14 -0
  32. package/lib/components/{useItemScale.js → items/useItemScale.js} +2 -2
  33. package/lib/components/items/useItemTriggers.js +17 -0
  34. package/lib/components/items/useSizing.js +23 -0
  35. package/lib/index.js +8 -8
  36. package/lib/interactions/InteractionsRegistry.js +6 -6
  37. package/lib/utils/RichTextConverter/RichTextConverter.js +1 -1
  38. package/lib/utils/getCompoundBondaryStyles.js +61 -0
  39. package/lib/utils/isItemType.js +7 -0
  40. package/package.json +2 -2
  41. package/src/components/Article.tsx +2 -2
  42. package/src/components/{Section.tsx → Section/Section.tsx} +2 -2
  43. package/src/components/{useSectionColor.ts → Section/useSectionColor.ts} +1 -1
  44. package/src/components/{useSectionHeightMap.ts → Section/useSectionHeightMap.ts} +1 -1
  45. package/src/components/items/{CodeEmbedItem.tsx → CodeEmbedItem/CodeEmbedItem.tsx} +2 -2
  46. package/src/components/items/{useCodeEmbedItem.ts → CodeEmbedItem/useCodeEmbedItem.ts} +2 -2
  47. package/src/components/items/CompoundItem/CompoundChild.tsx +130 -0
  48. package/src/components/items/CompoundItem/CompoundItem.tsx +70 -0
  49. package/src/components/items/CompoundItem/useCompoundItem.ts +21 -0
  50. package/src/components/items/{CustomItem.tsx → CustomItem/CustomItem.tsx} +2 -2
  51. package/src/components/items/{VimeoEmbed.tsx → EmbedVideoItem/VimeoEmbed.tsx} +5 -5
  52. package/src/components/items/{YoutubeEmbed.tsx → EmbedVideoItem/YoutubeEmbed.tsx} +6 -6
  53. package/src/components/items/{useEmbedVideoItem.ts → EmbedVideoItem/useEmbedVideoItem.ts} +2 -2
  54. package/src/components/items/{ImageItem.tsx → FileItem/ImageItem.tsx} +6 -6
  55. package/src/components/items/{VideoItem.tsx → FileItem/VideoItem.tsx} +5 -5
  56. package/src/components/items/{useFileItem.ts → FileItem/useFileItem.ts} +2 -2
  57. package/src/components/items/{GroupItem.tsx → GroupItem/GroupItem.tsx} +4 -5
  58. package/src/components/items/{useGroupItem.ts → GroupItem/useGroupItem.ts} +2 -2
  59. package/src/components/{Item.tsx → items/Item.tsx} +36 -105
  60. package/src/components/items/{RectangleItem.tsx → RectangleItem/RectangleItem.tsx} +3 -3
  61. package/src/components/items/{useRectangleItem.ts → RectangleItem/useRectangleItem.ts} +2 -2
  62. package/src/components/items/{RichTextItem.tsx → RichTextItem/RichTextItem.tsx} +7 -7
  63. package/src/components/items/{useRichTextItem.ts → RichTextItem/useRichTextItem.ts} +2 -2
  64. package/src/components/items/RichTextWrapper.tsx +15 -0
  65. package/src/components/items/itemsMap.ts +26 -0
  66. package/src/components/{useItemAngle.ts → items/useItemAngle.ts} +1 -1
  67. package/src/components/items/useItemArea.ts +35 -0
  68. package/src/components/items/useItemPointerEvents.ts +10 -0
  69. package/src/components/{useItemScale.ts → items/useItemScale.ts} +2 -2
  70. package/src/components/items/useItemTriggers.ts +15 -0
  71. package/src/components/items/useSizing.ts +25 -0
  72. package/src/index.ts +8 -8
  73. package/src/interactions/InteractionsRegistry.ts +6 -5
  74. package/src/utils/RichTextConverter/RichTextConverter.tsx +1 -1
  75. package/src/utils/getCompoundBondaryStyles.ts +62 -0
  76. package/src/utils/isItemType.ts +6 -0
  77. package/lib/components/useItemDimensions.js +0 -12
  78. package/lib/components/useItemPosition.js +0 -30
  79. package/src/components/useItemDimensions.ts +0 -16
  80. package/src/components/useItemPosition.ts +0 -37
  81. /package/lib/components/{LinkWrapper.js → items/LinkWrapper.js} +0 -0
  82. /package/src/components/{LinkWrapper.tsx → items/LinkWrapper.tsx} +0 -0
@@ -3,57 +3,37 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.isItemType = exports.Item = void 0;
6
+ exports.Item = 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
10
  const sdk_1 = require("@cntrl-site/sdk");
11
- const RectangleItem_1 = require("./items/RectangleItem");
12
- const ImageItem_1 = require("./items/ImageItem");
13
- const VideoItem_1 = require("./items/VideoItem");
14
- const RichTextItem_1 = require("./items/RichTextItem");
15
- const VimeoEmbed_1 = require("./items/VimeoEmbed");
16
- const YoutubeEmbed_1 = require("./items/YoutubeEmbed");
17
- const CustomItem_1 = require("./items/CustomItem");
18
- const useCntrlContext_1 = require("../provider/useCntrlContext");
19
- const useItemPosition_1 = require("./useItemPosition");
20
- const useItemDimensions_1 = require("./useItemDimensions");
11
+ const useCntrlContext_1 = require("../../provider/useCntrlContext");
21
12
  const useItemScale_1 = require("./useItemScale");
22
- const ScaleAnchorMap_1 = require("../utils/ScaleAnchorMap");
23
- const useSectionHeightMap_1 = require("./useSectionHeightMap");
24
- const getItemTopStyle_1 = require("../utils/getItemTopStyle");
25
- const useStickyItemTop_1 = require("./items/useStickyItemTop");
26
- const getAnchoredItemTop_1 = require("../utils/getAnchoredItemTop");
27
- const useLayoutContext_1 = require("./useLayoutContext");
28
- const ArticleRectContext_1 = require("../provider/ArticleRectContext");
29
- const useExemplary_1 = require("../common/useExemplary");
30
- const GroupItem_1 = require("./items/GroupItem");
31
- const CodeEmbedItem_1 = require("./items/CodeEmbedItem");
32
- const KeyframesContext_1 = require("../provider/KeyframesContext");
33
- const useItemInteractionCtrl_1 = require("../interactions/useItemInteractionCtrl");
34
- const itemsMap = {
35
- [sdk_1.ArticleItemType.Rectangle]: RectangleItem_1.RectangleItem,
36
- [sdk_1.ArticleItemType.Image]: ImageItem_1.ImageItem,
37
- [sdk_1.ArticleItemType.Video]: VideoItem_1.VideoItem,
38
- [sdk_1.ArticleItemType.RichText]: RichTextItem_1.RichTextItem,
39
- [sdk_1.ArticleItemType.YoutubeEmbed]: YoutubeEmbed_1.YoutubeEmbedItem,
40
- [sdk_1.ArticleItemType.VimeoEmbed]: VimeoEmbed_1.VimeoEmbedItem,
41
- [sdk_1.ArticleItemType.Custom]: CustomItem_1.CustomItem,
42
- [sdk_1.ArticleItemType.Group]: GroupItem_1.GroupItem,
43
- [sdk_1.ArticleItemType.CodeEmbed]: CodeEmbedItem_1.CodeEmbedItem
44
- };
13
+ const ScaleAnchorMap_1 = require("../../utils/ScaleAnchorMap");
14
+ const useSectionHeightMap_1 = require("../Section/useSectionHeightMap");
15
+ const getItemTopStyle_1 = require("../../utils/getItemTopStyle");
16
+ const useStickyItemTop_1 = require("./useStickyItemTop");
17
+ const getAnchoredItemTop_1 = require("../../utils/getAnchoredItemTop");
18
+ const useLayoutContext_1 = require("../useLayoutContext");
19
+ const ArticleRectContext_1 = require("../../provider/ArticleRectContext");
20
+ const useExemplary_1 = require("../../common/useExemplary");
21
+ const KeyframesContext_1 = require("../../provider/KeyframesContext");
22
+ const useItemInteractionCtrl_1 = require("../../interactions/useItemInteractionCtrl");
23
+ const isItemType_1 = require("../../utils/isItemType");
24
+ const RichTextWrapper_1 = require("./RichTextWrapper");
25
+ const itemsMap_1 = require("./itemsMap");
26
+ const useItemTriggers_1 = require("./useItemTriggers");
27
+ const useSizing_1 = require("./useSizing");
28
+ const useItemPointerEvents_1 = require("./useItemPointerEvents");
29
+ const useItemArea_1 = require("./useItemArea");
45
30
  const stickyFix = `
46
31
  -webkit-transform: translate3d(0, 0, 0);
47
32
  transform: translate3d(0, 0, 0);
48
33
  `;
49
- const RichTextWrapper = ({ isRichText, children }) => {
50
- if (!isRichText)
51
- return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children });
52
- return ((0, jsx_runtime_1.jsx)("div", { style: { transformOrigin: 'top left', transform: 'scale(var(--layout-deviation))' }, children: children }));
53
- };
54
34
  const noop = () => null;
55
35
  const Item = ({ item, sectionId, articleHeight, isParentVisible = true, isInGroup = false }) => {
56
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
36
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
57
37
  const itemWrapperRef = (0, react_1.useRef)(null);
58
38
  const itemInnerRef = (0, react_1.useRef)(null);
59
39
  const rectObserver = (0, react_1.useContext)(ArticleRectContext_1.ArticleRectContext);
@@ -63,38 +43,36 @@ const Item = ({ item, sectionId, articleHeight, isParentVisible = true, isInGrou
63
43
  const { layouts } = (0, useCntrlContext_1.useCntrlContext)();
64
44
  const layout = (0, useLayoutContext_1.useLayoutContext)();
65
45
  const exemplary = (0, useExemplary_1.useExemplary)();
66
- const [allowPointerEvents, setAllowPointerEvents] = (0, react_1.useState)(isParentVisible);
46
+ const { handleVisibilityChange, allowPointerEvents } = (0, useItemPointerEvents_1.useItemPointerEvents)(isParentVisible);
67
47
  const [wrapperHeight, setWrapperHeight] = (0, react_1.useState)(undefined);
68
48
  const [itemHeight, setItemHeight] = (0, react_1.useState)(undefined);
69
49
  const itemScale = (0, useItemScale_1.useItemScale)(item, sectionId);
70
50
  const interactionCtrl = (0, useItemInteractionCtrl_1.useItemInteractionCtrl)(item.id);
51
+ const triggers = (0, useItemTriggers_1.useItemTriggers)(interactionCtrl);
71
52
  const wrapperStateProps = interactionCtrl === null || interactionCtrl === void 0 ? void 0 : interactionCtrl.getState(['top', 'left']);
72
- const innerStateProps = interactionCtrl === null || interactionCtrl === void 0 ? void 0 : interactionCtrl.getState(['width', 'height', 'scale']);
73
- const position = (0, useItemPosition_1.useItemPosition)(item, sectionId, {
53
+ const innerStateProps = interactionCtrl === null || interactionCtrl === void 0 ? void 0 : interactionCtrl.getState(['width', 'height', 'scale', 'top', 'left']);
54
+ const { width, height, top, left } = (0, useItemArea_1.useItemArea)(item, sectionId, {
74
55
  top: (_a = wrapperStateProps === null || wrapperStateProps === void 0 ? void 0 : wrapperStateProps.styles) === null || _a === void 0 ? void 0 : _a.top,
75
56
  left: (_b = wrapperStateProps === null || wrapperStateProps === void 0 ? void 0 : wrapperStateProps.styles) === null || _b === void 0 ? void 0 : _b.left,
57
+ width: (_c = innerStateProps === null || innerStateProps === void 0 ? void 0 : innerStateProps.styles) === null || _c === void 0 ? void 0 : _c.width,
58
+ height: (_d = innerStateProps === null || innerStateProps === void 0 ? void 0 : innerStateProps.styles) === null || _d === void 0 ? void 0 : _d.height
76
59
  });
77
60
  const sectionHeight = (0, useSectionHeightMap_1.useSectionHeightData)(sectionId);
78
61
  const stickyTop = (0, useStickyItemTop_1.useStickyItemTop)(item, sectionHeight, sectionId);
79
- const dimensions = (0, useItemDimensions_1.useItemDimensions)(item, sectionId);
80
62
  const layoutValues = [item.area, item.hidden];
81
- const isInitialRef = (0, react_1.useRef)(true);
82
63
  layoutValues.push(item.sticky);
83
64
  layoutValues.push(sectionHeight);
84
65
  if (item.layoutParams) {
85
66
  layoutValues.push(item.layoutParams);
86
67
  }
87
- const sizing = layout && isItemType(item, sdk_1.ArticleItemType.RichText)
88
- ? item.layoutParams[layout].sizing
89
- : undefined;
90
- const sizingAxis = parseSizing(sizing);
91
- const ItemComponent = itemsMap[item.type] || noop;
68
+ const sizingAxis = (0, useSizing_1.useSizing)(item);
69
+ const ItemComponent = itemsMap_1.itemsMap[item.type] || noop;
92
70
  const sectionTop = rectObserver ? rectObserver.getSectionTop(sectionId) : 0;
93
71
  const handleItemResize = (height) => {
94
72
  if (!layout)
95
73
  return;
96
74
  const sticky = item.sticky[layout];
97
- if (!sticky || stickyTop === undefined) {
75
+ if (!sticky || stickyTop === undefined || !articleHeight) {
98
76
  setWrapperHeight(undefined);
99
77
  return;
100
78
  }
@@ -107,43 +85,30 @@ const Item = ({ item, sectionId, articleHeight, isParentVisible = true, isInGrou
107
85
  setItemHeight(height);
108
86
  setWrapperHeight(wrapperHeight);
109
87
  };
110
- const handleVisibilityChange = (0, react_1.useCallback)((isVisible) => {
111
- if (!isParentVisible)
112
- return;
113
- setAllowPointerEvents(isVisible);
114
- }, [isParentVisible]);
115
- (0, react_1.useEffect)(() => {
116
- isInitialRef.current = false;
117
- }, []);
118
- const isRichText = isItemType(item, sdk_1.ArticleItemType.RichText);
119
- const width = ((_d = (_c = innerStateProps === null || innerStateProps === void 0 ? void 0 : innerStateProps.styles) === null || _c === void 0 ? void 0 : _c.width) !== null && _d !== void 0 ? _d : dimensions === null || dimensions === void 0 ? void 0 : dimensions.width);
120
- const height = ((_f = (_e = innerStateProps === null || innerStateProps === void 0 ? void 0 : innerStateProps.styles) === null || _e === void 0 ? void 0 : _e.height) !== null && _f !== void 0 ? _f : dimensions === null || dimensions === void 0 ? void 0 : dimensions.height);
121
- const scale = (_h = (_g = innerStateProps === null || innerStateProps === void 0 ? void 0 : innerStateProps.styles) === null || _g === void 0 ? void 0 : _g.scale) !== null && _h !== void 0 ? _h : itemScale;
122
- const hasClickTriggers = (_j = interactionCtrl === null || interactionCtrl === void 0 ? void 0 : interactionCtrl.getHasTrigger(item.id, 'click')) !== null && _j !== void 0 ? _j : false;
88
+ const isRichText = (0, isItemType_1.isItemType)(item, sdk_1.ArticleItemType.RichText);
89
+ const anchorSide = layout ? item.area[layout].anchorSide : sdk_1.AnchorSide.Top;
90
+ const positionType = layout ? item.area[layout].positionType : sdk_1.PositionType.ScreenBased;
91
+ const isScreenBasedBottom = positionType === sdk_1.PositionType.ScreenBased && anchorSide === sdk_1.AnchorSide.Bottom;
92
+ const scale = (_f = (_e = innerStateProps === null || innerStateProps === void 0 ? void 0 : innerStateProps.styles) === null || _e === void 0 ? void 0 : _e.scale) !== null && _f !== void 0 ? _f : itemScale;
93
+ const hasClickTriggers = (_g = interactionCtrl === null || interactionCtrl === void 0 ? void 0 : interactionCtrl.getHasTrigger(item.id, 'click')) !== null && _g !== void 0 ? _g : false;
123
94
  return ((0, jsx_runtime_1.jsxs)("div", { className: `item-wrapper-${item.id}`, ref: itemWrapperRef, onTransitionEnd: (e) => {
124
95
  var _a;
125
96
  e.stopPropagation();
126
97
  (_a = interactionCtrl === null || interactionCtrl === void 0 ? void 0 : interactionCtrl.handleTransitionEnd) === null || _a === void 0 ? void 0 : _a.call(interactionCtrl, e.propertyName);
127
- }, style: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (position ? { top: position.top } : {})), (position ? { left: position.left } : {})), (position ? { bottom: position.bottom } : {})), (wrapperHeight !== undefined ? { height: `${wrapperHeight * 100}vw` } : {})), { transition: (_k = wrapperStateProps === null || wrapperStateProps === void 0 ? void 0 : wrapperStateProps.transition) !== null && _k !== void 0 ? _k : 'none' }), children: [(0, jsx_runtime_1.jsx)("div", { suppressHydrationWarning: true, className: `item-${item.id}`, style: {
98
+ }, style: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (top ? { top: isScreenBasedBottom ? 'unset' : (0, getItemTopStyle_1.getItemTopStyle)(top, anchorSide) } : {})), (left ? { left: `${left * 100}vw` } : {})), (top ? { bottom: isScreenBasedBottom ? `${-top * 100}vw` : 'unset' } : {})), (wrapperHeight !== undefined ? { height: `${wrapperHeight * 100}vw` } : {})), { transition: (_h = wrapperStateProps === null || wrapperStateProps === void 0 ? void 0 : wrapperStateProps.transition) !== null && _h !== void 0 ? _h : 'none' }), children: [(0, jsx_runtime_1.jsx)("div", { suppressHydrationWarning: true, className: `item-${item.id}`, style: {
128
99
  opacity: (keyframes.length !== 0 && !layout) ? 0 : 1,
129
100
  top: `${stickyTop * 100}vw`,
130
101
  height: isRichText && itemHeight ? `${itemHeight * 100}vw` : 'unset',
131
- }, children: (0, jsx_runtime_1.jsx)(RichTextWrapper, { isRichText: isRichText, children: (0, jsx_runtime_1.jsx)("div", { className: `item-${item.id}-inner`, ref: itemInnerRef, onClick: () => {
132
- interactionCtrl === null || interactionCtrl === void 0 ? void 0 : interactionCtrl.sendTrigger('click');
133
- }, onMouseEnter: () => {
134
- interactionCtrl === null || interactionCtrl === void 0 ? void 0 : interactionCtrl.sendTrigger('hover-in');
135
- }, onMouseLeave: () => {
136
- interactionCtrl === null || interactionCtrl === void 0 ? void 0 : interactionCtrl.sendTrigger('hover-out');
137
- }, style: Object.assign(Object.assign(Object.assign({}, ((width && height) ? {
102
+ }, children: (0, jsx_runtime_1.jsx)(RichTextWrapper_1.RichTextWrapper, { isRichText: isRichText, children: (0, jsx_runtime_1.jsx)("div", Object.assign({ className: `item-${item.id}-inner`, ref: itemInnerRef, style: Object.assign(Object.assign(Object.assign({}, ((width && height) ? {
138
103
  width: `${sizingAxis.x === 'manual'
139
104
  ? isRichText
140
105
  ? `${width * exemplary}px`
141
106
  : `${width * 100}vw`
142
107
  : 'max-content'}`,
143
108
  height: `${sizingAxis.y === 'manual' ? `${height * 100}vw` : 'unset'}`
144
- } : {})), (scale !== undefined ? { transform: `scale(${scale})`, 'WebkitTransform': `scale(${scale})` } : {})), { transition: (_l = innerStateProps === null || innerStateProps === void 0 ? void 0 : innerStateProps.transition) !== null && _l !== void 0 ? _l : 'none', cursor: hasClickTriggers ? 'pointer' : 'unset', pointerEvents: allowPointerEvents ? 'auto' : 'none' }), children: (0, jsx_runtime_1.jsx)(ItemComponent, { item: item, sectionId: sectionId, onResize: handleItemResize, articleHeight: articleHeight, interactionCtrl: interactionCtrl, onVisibilityChange: handleVisibilityChange }) }) }) }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
109
+ } : {})), (scale !== undefined ? { transform: `scale(${scale})`, 'WebkitTransform': `scale(${scale})` } : {})), { transition: (_j = innerStateProps === null || innerStateProps === void 0 ? void 0 : innerStateProps.transition) !== null && _j !== void 0 ? _j : 'none', cursor: hasClickTriggers ? 'pointer' : 'unset', pointerEvents: allowPointerEvents ? 'auto' : 'none' }) }, triggers, { children: (0, jsx_runtime_1.jsx)(ItemComponent, { item: item, sectionId: sectionId, onResize: handleItemResize, articleHeight: articleHeight, interactionCtrl: interactionCtrl, onVisibilityChange: handleVisibilityChange }) })) }) }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
145
110
  ${(0, sdk_1.getLayoutStyles)(layouts, layoutValues, ([area, hidden, sticky, sectionHeight, layoutParams]) => {
146
- const sizingAxis = parseSizing(layoutParams.sizing);
111
+ const sizingAxis = (0, useSizing_1.parseSizing)(layoutParams.sizing);
147
112
  const isScreenBasedBottom = area.positionType === sdk_1.PositionType.ScreenBased && area.anchorSide === sdk_1.AnchorSide.Bottom;
148
113
  const scaleAnchor = area.scaleAnchor;
149
114
  return (`
@@ -177,14 +142,3 @@ const Item = ({ item, sectionId, articleHeight, isParentVisible = true, isInGrou
177
142
  ` })] }));
178
143
  };
179
144
  exports.Item = Item;
180
- function parseSizing(sizing = 'manual') {
181
- const axisSizing = sizing.split(' ');
182
- return {
183
- y: axisSizing[0],
184
- x: axisSizing[1] ? axisSizing[1] : axisSizing[0]
185
- };
186
- }
187
- function isItemType(item, itemType) {
188
- return item.type === itemType;
189
- }
190
- exports.isItemType = isItemType;
@@ -12,9 +12,9 @@ const sdk_1 = require("@cntrl-site/sdk");
12
12
  const LinkWrapper_1 = require("../LinkWrapper");
13
13
  const useRectangleItem_1 = require("./useRectangleItem");
14
14
  const useItemAngle_1 = require("../useItemAngle");
15
- const useCntrlContext_1 = require("../../provider/useCntrlContext");
16
- const useRegisterResize_1 = require("../../common/useRegisterResize");
17
- const getStyleFromItemStateAndParams_1 = require("../../utils/getStyleFromItemStateAndParams");
15
+ const useCntrlContext_1 = require("../../../provider/useCntrlContext");
16
+ const useRegisterResize_1 = require("../../../common/useRegisterResize");
17
+ const getStyleFromItemStateAndParams_1 = require("../../../utils/getStyleFromItemStateAndParams");
18
18
  const RectangleItem = ({ item, sectionId, onResize, interactionCtrl, onVisibilityChange }) => {
19
19
  var _a, _b, _c, _d;
20
20
  const id = (0, react_1.useId)();
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useRectangleItem = void 0;
4
4
  const sdk_1 = require("@cntrl-site/sdk");
5
- const useKeyframeValue_1 = require("../../common/useKeyframeValue");
6
- const useLayoutContext_1 = require("../useLayoutContext");
5
+ const useKeyframeValue_1 = require("../../../common/useKeyframeValue");
6
+ const useLayoutContext_1 = require("../../useLayoutContext");
7
7
  const defaultColor = 'rgba(0, 0, 0, 1)';
8
8
  const useRectangleItem = (item, sectionId) => {
9
9
  const layoutId = (0, useLayoutContext_1.useLayoutContext)();
@@ -10,14 +10,14 @@ const color_1 = require("@cntrl-site/color");
10
10
  const sdk_1 = require("@cntrl-site/sdk");
11
11
  const style_1 = __importDefault(require("styled-jsx/style"));
12
12
  const useRichTextItem_1 = require("./useRichTextItem");
13
- const useCntrlContext_1 = require("../../provider/useCntrlContext");
14
- const useRichTextItemValues_1 = require("./useRichTextItemValues");
15
- const useRegisterResize_1 = require("../../common/useRegisterResize");
16
- const getFontFamilyValue_1 = require("../../utils/getFontFamilyValue");
17
- const useExemplary_1 = require("../../common/useExemplary");
13
+ const useCntrlContext_1 = require("../../../provider/useCntrlContext");
14
+ const useRichTextItemValues_1 = require("../useRichTextItemValues");
15
+ const useRegisterResize_1 = require("../../../common/useRegisterResize");
16
+ const getFontFamilyValue_1 = require("../../../utils/getFontFamilyValue");
17
+ const useExemplary_1 = require("../../../common/useExemplary");
18
18
  const useItemAngle_1 = require("../useItemAngle");
19
- const getStyleFromItemStateAndParams_1 = require("../../utils/getStyleFromItemStateAndParams");
20
- const useCurrentLayout_1 = require("../../common/useCurrentLayout");
19
+ const getStyleFromItemStateAndParams_1 = require("../../../utils/getStyleFromItemStateAndParams");
20
+ const useCurrentLayout_1 = require("../../../common/useCurrentLayout");
21
21
  const RichTextItem = ({ item, sectionId, onResize, interactionCtrl, onVisibilityChange }) => {
22
22
  var _a, _b, _c, _d;
23
23
  const id = (0, react_1.useId)();
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useRichTextItem = void 0;
4
- const RichTextConverter_1 = require("../../utils/RichTextConverter/RichTextConverter");
5
- const useCntrlContext_1 = require("../../provider/useCntrlContext");
4
+ const RichTextConverter_1 = require("../../../utils/RichTextConverter/RichTextConverter");
5
+ const useCntrlContext_1 = require("../../../provider/useCntrlContext");
6
6
  const richTextConverter = new RichTextConverter_1.RichTextConverter();
7
7
  const useRichTextItem = (item) => {
8
8
  const { layouts } = (0, useCntrlContext_1.useCntrlContext)();
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RichTextWrapper = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const RichTextWrapper = ({ isRichText, children, transformOrigin = 'top left' }) => {
6
+ if (!isRichText)
7
+ return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children });
8
+ return ((0, jsx_runtime_1.jsx)("div", { style: { transformOrigin, transform: 'scale(var(--layout-deviation))' }, children: children }));
9
+ };
10
+ exports.RichTextWrapper = RichTextWrapper;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.itemsMap = void 0;
4
+ const sdk_1 = require("@cntrl-site/sdk");
5
+ const RectangleItem_1 = require("./RectangleItem/RectangleItem");
6
+ const ImageItem_1 = require("./FileItem/ImageItem");
7
+ const VideoItem_1 = require("./FileItem/VideoItem");
8
+ const RichTextItem_1 = require("./RichTextItem/RichTextItem");
9
+ const YoutubeEmbed_1 = require("./EmbedVideoItem/YoutubeEmbed");
10
+ const VimeoEmbed_1 = require("./EmbedVideoItem/VimeoEmbed");
11
+ const CustomItem_1 = require("./CustomItem/CustomItem");
12
+ const GroupItem_1 = require("./GroupItem/GroupItem");
13
+ const CodeEmbedItem_1 = require("./CodeEmbedItem/CodeEmbedItem");
14
+ const CompoundItem_1 = require("./CompoundItem/CompoundItem");
15
+ exports.itemsMap = {
16
+ [sdk_1.ArticleItemType.Rectangle]: RectangleItem_1.RectangleItem,
17
+ [sdk_1.ArticleItemType.Image]: ImageItem_1.ImageItem,
18
+ [sdk_1.ArticleItemType.Video]: VideoItem_1.VideoItem,
19
+ [sdk_1.ArticleItemType.RichText]: RichTextItem_1.RichTextItem,
20
+ [sdk_1.ArticleItemType.YoutubeEmbed]: YoutubeEmbed_1.YoutubeEmbedItem,
21
+ [sdk_1.ArticleItemType.VimeoEmbed]: VimeoEmbed_1.VimeoEmbedItem,
22
+ [sdk_1.ArticleItemType.Custom]: CustomItem_1.CustomItem,
23
+ [sdk_1.ArticleItemType.Group]: GroupItem_1.GroupItem,
24
+ [sdk_1.ArticleItemType.Compound]: CompoundItem_1.CompoundItem,
25
+ [sdk_1.ArticleItemType.CodeEmbed]: CodeEmbedItem_1.CodeEmbedItem
26
+ };
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useItemAngle = void 0;
4
4
  const sdk_1 = require("@cntrl-site/sdk");
5
- const useKeyframeValue_1 = require("../common/useKeyframeValue");
5
+ const useKeyframeValue_1 = require("../../common/useKeyframeValue");
6
6
  const useItemAngle = (item, sectionId) => {
7
7
  const angle = (0, useKeyframeValue_1.useKeyframeValue)(item, sdk_1.KeyframeType.Rotation, (item, layoutId) => layoutId ? item.area[layoutId].angle : undefined, (animator, scroll, value) => value !== undefined ? animator.getRotation({ angle: value }, scroll).angle : undefined, sectionId);
8
8
  return angle;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useItemArea = void 0;
4
+ const sdk_1 = require("@cntrl-site/sdk");
5
+ const useLayoutContext_1 = require("../useLayoutContext");
6
+ const useKeyframeValue_1 = require("../../common/useKeyframeValue");
7
+ function useItemArea(item, sectionId, stateValues) {
8
+ var _a, _b, _c, _d;
9
+ const layoutId = (0, useLayoutContext_1.useLayoutContext)();
10
+ const position = (0, useKeyframeValue_1.useKeyframeValue)(item, sdk_1.KeyframeType.Position, (item, layoutId) => {
11
+ if (!layoutId)
12
+ return;
13
+ return item.area[layoutId];
14
+ }, (animator, scroll, value) => value ? animator.getPositions(value, scroll) : undefined, sectionId, [layoutId]);
15
+ const dimensions = (0, useKeyframeValue_1.useKeyframeValue)(item, sdk_1.KeyframeType.Dimensions, (item, layoutId) => layoutId ? item.area[layoutId] : undefined, (animator, scroll, value) => value ? animator.getDimensions(value, scroll) : undefined, sectionId, [layoutId]);
16
+ const width = ((_a = stateValues.width) !== null && _a !== void 0 ? _a : dimensions === null || dimensions === void 0 ? void 0 : dimensions.width);
17
+ const height = ((_b = stateValues.height) !== null && _b !== void 0 ? _b : dimensions === null || dimensions === void 0 ? void 0 : dimensions.height);
18
+ const top = ((_c = stateValues.top) !== null && _c !== void 0 ? _c : position === null || position === void 0 ? void 0 : position.top);
19
+ const left = ((_d = stateValues.left) !== null && _d !== void 0 ? _d : position === null || position === void 0 ? void 0 : position.left);
20
+ return { width, height, top, left };
21
+ }
22
+ exports.useItemArea = useItemArea;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useItemPointerEvents = void 0;
4
+ const react_1 = require("react");
5
+ function useItemPointerEvents(isParentVisible) {
6
+ const [allowPointerEvents, setAllowPointerEvents] = (0, react_1.useState)(isParentVisible);
7
+ const handleVisibilityChange = (0, react_1.useCallback)((isVisible) => {
8
+ if (!isParentVisible)
9
+ return;
10
+ setAllowPointerEvents(isVisible);
11
+ }, [isParentVisible]);
12
+ return { allowPointerEvents, handleVisibilityChange };
13
+ }
14
+ exports.useItemPointerEvents = useItemPointerEvents;
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useItemScale = void 0;
4
4
  const sdk_1 = require("@cntrl-site/sdk");
5
- const useKeyframeValue_1 = require("../common/useKeyframeValue");
6
- const useLayoutContext_1 = require("./useLayoutContext");
5
+ const useKeyframeValue_1 = require("../../common/useKeyframeValue");
6
+ const useLayoutContext_1 = require("../useLayoutContext");
7
7
  const useItemScale = (item, sectionId) => {
8
8
  const layoutId = (0, useLayoutContext_1.useLayoutContext)();
9
9
  const scale = (0, useKeyframeValue_1.useKeyframeValue)(item, sdk_1.KeyframeType.Scale, (item, layoutId) => (layoutId ? item.area[layoutId].scale : undefined), (animator, scroll, value) => value !== undefined ? animator.getScale({ scale: value }, scroll).scale : undefined, sectionId, [layoutId]);
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useItemTriggers = void 0;
4
+ function useItemTriggers(interactionCtrl) {
5
+ return {
6
+ onClick: () => {
7
+ interactionCtrl === null || interactionCtrl === void 0 ? void 0 : interactionCtrl.sendTrigger('click');
8
+ },
9
+ onMouseEnter: () => {
10
+ interactionCtrl === null || interactionCtrl === void 0 ? void 0 : interactionCtrl.sendTrigger('hover-in');
11
+ },
12
+ onMouseLeave: () => {
13
+ interactionCtrl === null || interactionCtrl === void 0 ? void 0 : interactionCtrl.sendTrigger('hover-out');
14
+ }
15
+ };
16
+ }
17
+ exports.useItemTriggers = useItemTriggers;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseSizing = exports.useSizing = void 0;
4
+ const isItemType_1 = require("../../utils/isItemType");
5
+ const sdk_1 = require("@cntrl-site/sdk");
6
+ const useLayoutContext_1 = require("../useLayoutContext");
7
+ function useSizing(item) {
8
+ const layout = (0, useLayoutContext_1.useLayoutContext)();
9
+ const sizing = layout && (0, isItemType_1.isItemType)(item, sdk_1.ArticleItemType.RichText)
10
+ ? item.layoutParams[layout].sizing
11
+ : undefined;
12
+ const sizingAxis = parseSizing(sizing);
13
+ return sizingAxis;
14
+ }
15
+ exports.useSizing = useSizing;
16
+ function parseSizing(sizing = 'manual') {
17
+ const axisSizing = sizing.split(' ');
18
+ return {
19
+ y: axisSizing[0],
20
+ x: axisSizing[1] ? axisSizing[1] : axisSizing[0]
21
+ };
22
+ }
23
+ exports.parseSizing = parseSizing;
package/lib/index.js CHANGED
@@ -24,23 +24,23 @@ var Head_1 = require("./components/Head");
24
24
  Object.defineProperty(exports, "Head", { enumerable: true, get: function () { return Head_1.CNTRLHead; } });
25
25
  var Article_1 = require("./components/Article");
26
26
  Object.defineProperty(exports, "Article", { enumerable: true, get: function () { return Article_1.Article; } });
27
- var Section_1 = require("./components/Section");
27
+ var Section_1 = require("./components/Section/Section");
28
28
  Object.defineProperty(exports, "Section", { enumerable: true, get: function () { return Section_1.Section; } });
29
- var Item_1 = require("./components/Item");
29
+ var Item_1 = require("./components/items/Item");
30
30
  Object.defineProperty(exports, "Item", { enumerable: true, get: function () { return Item_1.Item; } });
31
- var ImageItem_1 = require("./components/items/ImageItem");
31
+ var ImageItem_1 = require("./components/items/FileItem/ImageItem");
32
32
  Object.defineProperty(exports, "ImageItem", { enumerable: true, get: function () { return ImageItem_1.ImageItem; } });
33
- var RectangleItem_1 = require("./components/items/RectangleItem");
33
+ var RectangleItem_1 = require("./components/items/RectangleItem/RectangleItem");
34
34
  Object.defineProperty(exports, "RectangleItem", { enumerable: true, get: function () { return RectangleItem_1.RectangleItem; } });
35
- var RichTextItem_1 = require("./components/items/RichTextItem");
35
+ var RichTextItem_1 = require("./components/items/RichTextItem/RichTextItem");
36
36
  Object.defineProperty(exports, "RichTextItem", { enumerable: true, get: function () { return RichTextItem_1.RichTextItem; } });
37
- var VideoItem_1 = require("./components/items/VideoItem");
37
+ var VideoItem_1 = require("./components/items/FileItem/VideoItem");
38
38
  Object.defineProperty(exports, "VideoItem", { enumerable: true, get: function () { return VideoItem_1.VideoItem; } });
39
39
  var LayoutStyle_1 = require("./components/LayoutStyle");
40
40
  Object.defineProperty(exports, "LayoutStyle", { enumerable: true, get: function () { return LayoutStyle_1.LayoutStyle; } });
41
- var VimeoEmbed_1 = require("./components/items/VimeoEmbed");
41
+ var VimeoEmbed_1 = require("./components/items/EmbedVideoItem/VimeoEmbed");
42
42
  Object.defineProperty(exports, "VimeoEmbedItem", { enumerable: true, get: function () { return VimeoEmbed_1.VimeoEmbedItem; } });
43
- var YoutubeEmbed_1 = require("./components/items/YoutubeEmbed");
43
+ var YoutubeEmbed_1 = require("./components/items/EmbedVideoItem/YoutubeEmbed");
44
44
  Object.defineProperty(exports, "YoutubeEmbedItem", { enumerable: true, get: function () { return YoutubeEmbed_1.YoutubeEmbedItem; } });
45
45
  const defaultContext_1 = require("./provider/defaultContext");
46
46
  var CntrlProvider_1 = require("./provider/CntrlProvider");
@@ -13,7 +13,7 @@ var __rest = (this && this.__rest) || function (s, e) {
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
14
  exports.InteractionsRegistry = void 0;
15
15
  const sdk_1 = require("@cntrl-site/sdk");
16
- const Item_1 = require("../components/Item");
16
+ const isItemType_1 = require("../utils/isItemType");
17
17
  class InteractionsRegistry {
18
18
  constructor(article, layoutId) {
19
19
  this.layoutId = layoutId;
@@ -202,11 +202,11 @@ class InteractionsRegistry {
202
202
  for (const item of section.items) {
203
203
  const { items } = item, itemWithoutChildren = __rest(item, ["items"]);
204
204
  itemsArr.push(itemWithoutChildren);
205
- if (!(0, Item_1.isItemType)(item, sdk_1.ArticleItemType.Group))
206
- continue;
207
- const groupChildren = (_a = item === null || item === void 0 ? void 0 : item.items) !== null && _a !== void 0 ? _a : [];
208
- for (const child of groupChildren) {
209
- itemsArr.push(child);
205
+ if ((0, isItemType_1.isItemType)(item, sdk_1.ArticleItemType.Group) || (0, isItemType_1.isItemType)(item, sdk_1.ArticleItemType.Compound)) {
206
+ const groupChildren = (_a = item === null || item === void 0 ? void 0 : item.items) !== null && _a !== void 0 ? _a : [];
207
+ for (const child of groupChildren) {
208
+ itemsArr.push(child);
209
+ }
210
210
  }
211
211
  }
212
212
  }
@@ -4,7 +4,7 @@ exports.RichTextConverter = exports.FontStyles = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const color_1 = require("@cntrl-site/color");
6
6
  const sdk_1 = require("@cntrl-site/sdk");
7
- const LinkWrapper_1 = require("../../components/LinkWrapper");
7
+ const LinkWrapper_1 = require("../../components/items/LinkWrapper");
8
8
  const getFontFamilyValue_1 = require("../getFontFamilyValue");
9
9
  exports.FontStyles = {
10
10
  'normal': {},
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getCompoundTransform = exports.getCompoundLeft = exports.getCompoundTop = exports.getCompoundWidth = exports.getCompoundHeight = void 0;
4
+ const sdk_1 = require("@cntrl-site/sdk");
5
+ const positionMatrix = {
6
+ [sdk_1.AreaAnchor.TopLeft]: [0, 0],
7
+ [sdk_1.AreaAnchor.TopCenter]: [0, 0.5],
8
+ [sdk_1.AreaAnchor.TopRight]: [0, 1],
9
+ [sdk_1.AreaAnchor.MiddleLeft]: [0.5, 0],
10
+ [sdk_1.AreaAnchor.MiddleCenter]: [0.5, 0.5],
11
+ [sdk_1.AreaAnchor.MiddleRight]: [0.5, 1],
12
+ [sdk_1.AreaAnchor.BottomLeft]: [1, 0],
13
+ [sdk_1.AreaAnchor.BottomCenter]: [1, 0.5],
14
+ [sdk_1.AreaAnchor.BottomRight]: [1, 1]
15
+ };
16
+ function getCompoundHeight(compoundSettings, height) {
17
+ if (!height || !compoundSettings)
18
+ return;
19
+ if (compoundSettings.heightMode === 'relative') {
20
+ return `${height * 100}%`;
21
+ }
22
+ return `${height * 100}vw`;
23
+ }
24
+ exports.getCompoundHeight = getCompoundHeight;
25
+ function getCompoundWidth(compoundSettings, width, isRichText, exemplary) {
26
+ if (!width || !compoundSettings)
27
+ return;
28
+ if (compoundSettings.widthMode === 'relative') {
29
+ return `${width * 100}%`;
30
+ }
31
+ return isRichText && exemplary ? `${width * exemplary}px` : `${width * 100}vw`;
32
+ }
33
+ exports.getCompoundWidth = getCompoundWidth;
34
+ function getCompoundTop(compoundSettings, top) {
35
+ if (!top || !compoundSettings)
36
+ return;
37
+ if (compoundSettings.heightMode === 'relative') {
38
+ return `${top * 100}%`;
39
+ }
40
+ const [ky] = positionMatrix[compoundSettings.positionAnchor];
41
+ return `calc(${ky * 100}% + ${top * 100}vw)`;
42
+ }
43
+ exports.getCompoundTop = getCompoundTop;
44
+ function getCompoundLeft(compoundSettings, left) {
45
+ if (!left || !compoundSettings)
46
+ return;
47
+ if (compoundSettings.widthMode === 'relative') {
48
+ return `${left * 100}%`;
49
+ }
50
+ const [_, kx] = positionMatrix[compoundSettings.positionAnchor];
51
+ return `calc(${kx * 100}% + ${left * 100}vw)`;
52
+ }
53
+ exports.getCompoundLeft = getCompoundLeft;
54
+ function getCompoundTransform(compoundSettings) {
55
+ if (!compoundSettings)
56
+ return 'unset';
57
+ const areaAnchor = compoundSettings.positionAnchor;
58
+ const [ky, kx] = positionMatrix[areaAnchor];
59
+ return `translate(${kx * (-100)}%, ${ky * (-100)}%)`;
60
+ }
61
+ exports.getCompoundTransform = getCompoundTransform;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isItemType = void 0;
4
+ function isItemType(item, itemType) {
5
+ return item.type === itemType;
6
+ }
7
+ exports.isItemType = isItemType;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cntrl-site/sdk-nextjs",
3
- "version": "1.1.5",
3
+ "version": "1.2.1",
4
4
  "description": "SDK for Next.js",
5
5
  "author": "arsen@momdesign.nyc",
6
6
  "license": "MIT",
@@ -31,7 +31,7 @@
31
31
  "@antfu/eslint-config": "^3.8.0",
32
32
  "@cntrl-site/color": "^1.0.0",
33
33
  "@cntrl-site/effects": "^1.2.0",
34
- "@cntrl-site/sdk": "^1.13.0",
34
+ "@cntrl-site/sdk": "^1.14.0",
35
35
  "@types/vimeo__player": "^2.18.0",
36
36
  "@vimeo/player": "^2.20.1",
37
37
  "html-react-parser": "^3.0.1",
@@ -1,8 +1,8 @@
1
1
  import { FC, useEffect, useId, useRef, useState } from 'react';
2
2
  import JSXStyle from 'styled-jsx/style';
3
3
  import { Article as TArticle } from '@cntrl-site/sdk';
4
- import { Section } from './Section';
5
- import { Item } from './Item';
4
+ import { Section } from './Section/Section';
5
+ import { Item } from './items/Item';
6
6
  import { useArticleRectObserver } from '../utils/ArticleRectManager/useArticleRectObserver';
7
7
  import { ArticleRectContext } from '../provider/ArticleRectContext';
8
8
  import { ArticleWrapper } from './ArticleWrapper';
@@ -7,8 +7,8 @@ import {
7
7
  SectionHeight,
8
8
  SectionHeightMode
9
9
  } from '@cntrl-site/sdk';
10
- import { useCntrlContext } from '../provider/useCntrlContext';
11
- import { useSectionRegistry } from '../utils/ArticleRectManager/useSectionRegistry';
10
+ import { useCntrlContext } from '../../provider/useCntrlContext';
11
+ import { useSectionRegistry } from '../../utils/ArticleRectManager/useSectionRegistry';
12
12
  import { CntrlColor } from '@cntrl-site/color';
13
13
 
14
14
  type SectionChild = ReactElement<any, any>;
@@ -1,6 +1,6 @@
1
1
  import { useMemo } from 'react';
2
2
  import { CntrlColor } from '@cntrl-site/color';
3
- import { useLayoutContext } from './useLayoutContext';
3
+ import { useLayoutContext } from '../useLayoutContext';
4
4
 
5
5
  type LayoutIdentifier = string;
6
6
  const DEFAULT_COLOR = 'rgba(0, 0, 0, 0)';
@@ -1,5 +1,5 @@
1
1
  import { useContext } from 'react';
2
- import { CntrlContext } from '../provider/CntrlContext';
2
+ import { CntrlContext } from '../../provider/CntrlContext';
3
3
  import { Layout, SectionHeight } from '@cntrl-site/sdk';
4
4
  import { getSectionHeight } from './Section';
5
5