@cntrl-site/sdk-nextjs 1.9.138 → 1.9.139

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.
@@ -0,0 +1,5 @@
1
+ <component name="ProjectCodeStyleConfiguration">
2
+ <state>
3
+ <option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
4
+ </state>
5
+ </component>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/sdk-nextjs.iml" filepath="$PROJECT_DIR$/.idea/sdk-nextjs.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
@@ -0,0 +1,12 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="WEB_MODULE" version="4">
3
+ <component name="NewModuleRootManager">
4
+ <content url="file://$MODULE_DIR$">
5
+ <excludeFolder url="file://$MODULE_DIR$/temp" />
6
+ <excludeFolder url="file://$MODULE_DIR$/.tmp" />
7
+ <excludeFolder url="file://$MODULE_DIR$/tmp" />
8
+ </content>
9
+ <orderEntry type="inheritedJdk" />
10
+ <orderEntry type="sourceFolder" forTests="false" />
11
+ </component>
12
+ </module>
package/.idea/vcs.xml ADDED
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
+ </component>
6
+ </project>
@@ -29,7 +29,8 @@ const RichTextItem = ({ item, sectionId, onResize, interactionCtrl, onVisibility
29
29
  const [ref, setRef] = (0, react_1.useState)(null);
30
30
  const { layouts } = (0, useCntrlContext_1.useCntrlContext)();
31
31
  const itemAngle = (0, useItemAngle_1.useItemAngle)(item, sectionId);
32
- const { blur: itemBlur, wordSpacing: itemWordSpacing, letterSpacing: itemLetterSpacing, color: itemColor, fontSize, lineHeight, xSizing } = (0, useRichTextItemValues_1.useRichTextItemValues)(item, sectionId);
32
+ const { blur: itemBlur, wordSpacing: itemWordSpacing, letterSpacing: itemLetterSpacing, color: itemColor, fontSize, lineHeight, xSizing, columns, columnGutter, hyphens } = (0, useRichTextItemValues_1.useRichTextItemValues)(item, sectionId);
33
+ const columnsEnabled = (columns !== null && columns !== void 0 ? columns : 1) > 1;
33
34
  const layoutValues = [item.area, item.layoutParams];
34
35
  const exemplary = (0, useExemplary_1.useExemplary)();
35
36
  const { layoutId } = (0, useCurrentLayout_1.useCurrentLayout)();
@@ -61,8 +62,12 @@ const RichTextItem = ({ item, sectionId, onResize, interactionCtrl, onVisibility
61
62
  (0, react_1.useEffect)(() => {
62
63
  onVisibilityChange === null || onVisibilityChange === void 0 ? void 0 : onVisibilityChange(isInteractive);
63
64
  }, [isInteractive, onVisibilityChange]);
64
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Wrapper, { ref: setRef, className: `rich-text-wrapper-${item.id}${layoutId ? '' : ` ${RichTextConverter_1.RICH_TEXT_LAYOUT_PENDING_CLASS}`}`, style: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (blur !== undefined ? { filter: `blur(${blur * 100}vw)` } : {})), (textColor ? { color: `${textColor.fmt('rgba')}` } : {})), (angle !== undefined ? { transform: `rotate(${angle}deg)` } : {})), (letterSpacing !== undefined ? { letterSpacing: `${letterSpacing * exemplary}px` } : {})), (wordSpacing !== undefined ? { wordSpacing: `${wordSpacing * exemplary}px` } : {})), (fontSize !== undefined ? { fontSize: `${Math.round(fontSize * exemplary)}px` } : {})), (lineHeight !== undefined ? { lineHeight: `${lineHeight * exemplary}px` } : {})), { willChange: blur !== 0 && blur !== undefined ? 'transform' : 'unset', transition }), children: content }), (0, jsx_runtime_1.jsxs)(style_1.default, { id: id, children: [styles, `${(0, sdk_1.getLayoutStyles)(layouts, layoutValues, ([area, layoutParams]) => {
65
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Wrapper, { ref: setRef, className: `rich-text-wrapper-${item.id}${layoutId ? '' : ` ${RichTextConverter_1.RICH_TEXT_LAYOUT_PENDING_CLASS}`}`, style: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (blur !== undefined ? { filter: `blur(${blur * 100}vw)` } : {})), (textColor ? { color: `${textColor.fmt('rgba')}` } : {})), (angle !== undefined ? { transform: `rotate(${angle}deg)` } : {})), (letterSpacing !== undefined ? { letterSpacing: `${letterSpacing * exemplary}px` } : {})), (wordSpacing !== undefined ? { wordSpacing: `${wordSpacing * exemplary}px` } : {})), (fontSize !== undefined ? { fontSize: `${Math.round(fontSize * exemplary)}px` } : {})), (lineHeight !== undefined ? { lineHeight: `${lineHeight * exemplary}px` } : {})), (columnsEnabled ? { columnCount: columns, columnFill: 'balance' } : {})), (columnsEnabled && columnGutter !== undefined ? { columnGap: `${Math.round(columnGutter * exemplary)}px` } : {})), (hyphens !== undefined ? { hyphens, WebkitHyphens: hyphens } : {})), { willChange: blur !== 0 && blur !== undefined ? 'transform' : 'unset', transition }), children: content }), (0, jsx_runtime_1.jsxs)(style_1.default, { id: id, children: [styles, `${(0, sdk_1.getLayoutStyles)(layouts, layoutValues, ([area, layoutParams]) => {
66
+ var _a, _b, _c;
65
67
  const color = color_1.CntrlColor.parse(layoutParams.color);
68
+ const columns = (_a = layoutParams.columns) !== null && _a !== void 0 ? _a : 1;
69
+ const columnsEnabled = columns > 1;
70
+ const hyphens = (_b = layoutParams.hyphens) !== null && _b !== void 0 ? _b : sdk_1.Hyphens.None;
66
71
  return (`
67
72
  .rich-text-wrapper-${item.id} {
68
73
  margin: 0;
@@ -79,6 +84,17 @@ const RichTextItem = ({ item, sectionId, onResize, interactionCtrl, onVisibility
79
84
  transform: rotate(${area.angle}deg);
80
85
  filter: ${layoutParams.blur !== 0 ? `blur(${layoutParams.blur * 100}vw)` : 'unset'};
81
86
  text-transform: ${layoutParams.textTransform};
87
+ column-count: ${columnsEnabled ? columns : 'unset'};
88
+ column-gap: ${columnsEnabled ? `${((_c = layoutParams.columnGutter) !== null && _c !== void 0 ? _c : 0) * 100}vw` : 'unset'};
89
+ column-fill: ${columnsEnabled ? 'balance' : 'unset'};
90
+ hyphens: ${hyphens};
91
+ -webkit-hyphens: ${hyphens};
92
+ hyphenate-limit-chars: 6 3 2;
93
+ hyphenate-limit-lines: 2;
94
+ hyphenate-limit-last: always;
95
+ hyphenate-limit-zone: 8%;
96
+ -webkit-hyphenate-limit-before: 3;
97
+ -webkit-hyphenate-limit-after: 2;
82
98
  ${layoutParams.blur !== 0 ? 'will-change: transform;' : ''}
83
99
  }
84
100
  @supports not (color: oklch(42% 0.3 90 / 1)) {
@@ -34,6 +34,9 @@ const useRichTextItemValues = (item, sectionId) => {
34
34
  const fontSize = layoutId ? item.layoutParams[layoutId].fontSize : undefined;
35
35
  const lineHeight = layoutId ? item.layoutParams[layoutId].lineHeight : undefined;
36
36
  const xSizing = layoutId ? item.layoutParams[layoutId].sizing : undefined;
37
- return { blur, letterSpacing, wordSpacing, color, fontSize, lineHeight, xSizing };
37
+ const columns = layoutId ? item.layoutParams[layoutId].columns : undefined;
38
+ const columnGutter = layoutId ? item.layoutParams[layoutId].columnGutter : undefined;
39
+ const hyphens = layoutId ? item.layoutParams[layoutId].hyphens : undefined;
40
+ return { blur, letterSpacing, wordSpacing, color, fontSize, lineHeight, xSizing, columns, columnGutter, hyphens };
38
41
  };
39
42
  exports.useRichTextItemValues = useRichTextItemValues;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cntrl-site/sdk-nextjs",
3
- "version": "1.9.138",
3
+ "version": "1.9.139",
4
4
  "description": "SDK for Next.js",
5
5
  "author": "arsen@momdesign.nyc",
6
6
  "license": "MIT",
@@ -33,7 +33,7 @@
33
33
  "@cntrl-site/color": "^1.0.0",
34
34
  "@cntrl-site/components": "^1.0.85",
35
35
  "@cntrl-site/effects": "^1.4.2",
36
- "@cntrl-site/sdk": "^1.28.9",
36
+ "@cntrl-site/sdk": "^1.28.10",
37
37
  "@types/vimeo__player": "^2.18.0",
38
38
  "@vimeo/player": "^2.25.0",
39
39
  "html-react-parser": "^3.0.1",
@@ -1,6 +1,6 @@
1
1
  import { FC, useEffect, useId, useMemo, useState } from 'react';
2
2
  import { CntrlColor } from '@cntrl-site/color';
3
- import { getLayoutStyles, RichTextItem as TRichTextItem } from '@cntrl-site/sdk';
3
+ import { getLayoutStyles, Hyphens, RichTextItem as TRichTextItem } from '@cntrl-site/sdk';
4
4
  import JSXStyle from 'styled-jsx/style';
5
5
  import { ItemProps } from '../Item';
6
6
  import { useRichTextItem } from './useRichTextItem';
@@ -30,8 +30,12 @@ export const RichTextItem: FC<ItemProps<TRichTextItem>> = ({ item, sectionId, on
30
30
  color: itemColor,
31
31
  fontSize,
32
32
  lineHeight,
33
- xSizing
33
+ xSizing,
34
+ columns,
35
+ columnGutter,
36
+ hyphens
34
37
  } = useRichTextItemValues(item, sectionId);
38
+ const columnsEnabled = (columns ?? 1) > 1;
35
39
  const layoutValues: Record<string, any>[] = [item.area, item.layoutParams];
36
40
  const exemplary = useExemplary();
37
41
  const { layoutId } = useCurrentLayout();
@@ -76,6 +80,9 @@ export const RichTextItem: FC<ItemProps<TRichTextItem>> = ({ item, sectionId, on
76
80
  ...(wordSpacing !== undefined ? { wordSpacing: `${wordSpacing as number * exemplary}px` } : {}),
77
81
  ...(fontSize !== undefined ? { fontSize: `${Math.round(fontSize * exemplary)}px` } : {}),
78
82
  ...(lineHeight !== undefined ? { lineHeight: `${lineHeight * exemplary}px` } : {}),
83
+ ...(columnsEnabled ? { columnCount: columns, columnFill: 'balance' as const } : {}),
84
+ ...(columnsEnabled && columnGutter !== undefined ? { columnGap: `${Math.round(columnGutter * exemplary)}px` } : {}),
85
+ ...(hyphens !== undefined ? { hyphens, WebkitHyphens: hyphens } : {}),
79
86
  willChange: blur !== 0 && blur !== undefined ? 'transform' : 'unset',
80
87
  transition
81
88
  }}
@@ -86,6 +93,9 @@ export const RichTextItem: FC<ItemProps<TRichTextItem>> = ({ item, sectionId, on
86
93
  {styles}
87
94
  {`${getLayoutStyles(layouts, layoutValues, ([area, layoutParams]) => {
88
95
  const color = CntrlColor.parse(layoutParams.color);
96
+ const columns = layoutParams.columns ?? 1;
97
+ const columnsEnabled = columns > 1;
98
+ const hyphens = layoutParams.hyphens ?? Hyphens.None;
89
99
  return (`
90
100
  .rich-text-wrapper-${item.id} {
91
101
  margin: 0;
@@ -102,6 +112,17 @@ export const RichTextItem: FC<ItemProps<TRichTextItem>> = ({ item, sectionId, on
102
112
  transform: rotate(${area.angle}deg);
103
113
  filter: ${layoutParams.blur !== 0 ? `blur(${layoutParams.blur * 100}vw)` : 'unset'};
104
114
  text-transform: ${layoutParams.textTransform};
115
+ column-count: ${columnsEnabled ? columns : 'unset'};
116
+ column-gap: ${columnsEnabled ? `${(layoutParams.columnGutter ?? 0) * 100}vw` : 'unset'};
117
+ column-fill: ${columnsEnabled ? 'balance' : 'unset'};
118
+ hyphens: ${hyphens};
119
+ -webkit-hyphens: ${hyphens};
120
+ hyphenate-limit-chars: 6 3 2;
121
+ hyphenate-limit-lines: 2;
122
+ hyphenate-limit-last: always;
123
+ hyphenate-limit-zone: 8%;
124
+ -webkit-hyphenate-limit-before: 3;
125
+ -webkit-hyphenate-limit-after: 2;
105
126
  ${layoutParams.blur !== 0 ? 'will-change: transform;' : ''}
106
127
  }
107
128
  @supports not (color: oklch(42% 0.3 90 / 1)) {
@@ -61,6 +61,9 @@ export const useRichTextItemValues = (item: RichTextItem, sectionId: string) =>
61
61
  const fontSize = layoutId ? item.layoutParams[layoutId].fontSize : undefined;
62
62
  const lineHeight = layoutId ? item.layoutParams[layoutId].lineHeight : undefined;
63
63
  const xSizing = layoutId ? item.layoutParams[layoutId].sizing : undefined;
64
+ const columns = layoutId ? item.layoutParams[layoutId].columns : undefined;
65
+ const columnGutter = layoutId ? item.layoutParams[layoutId].columnGutter : undefined;
66
+ const hyphens = layoutId ? item.layoutParams[layoutId].hyphens : undefined;
64
67
 
65
- return { blur, letterSpacing, wordSpacing, color, fontSize, lineHeight, xSizing };
68
+ return { blur, letterSpacing, wordSpacing, color, fontSize, lineHeight, xSizing, columns, columnGutter, hyphens };
66
69
  };