pds-dev-kit-web-test 2.3.4 → 2.3.6

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 (50) hide show
  1. package/dist/src/sub/DynamicLayout/components/SectionMatcher/SectionMatcher.js +1 -7
  2. package/dist/src/sub/DynamicLayout/pagesPreviewMock.d.ts +709 -1375
  3. package/dist/src/sub/DynamicLayout/pagesPreviewMock.js +1124 -2381
  4. package/dist/src/sub/DynamicLayout/sectionActionTypes.d.ts +0 -10
  5. package/dist/src/sub/DynamicLayout/sections/CustomSection/CustomSection.d.ts +0 -6
  6. package/dist/src/sub/DynamicLayout/sections/CustomSection/CustomSection.js +64 -77
  7. package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/ComponentBlockMatcher.d.ts +1 -2
  8. package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/ComponentBlockMatcher.js +3 -3
  9. package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Button/Button.js +1 -1
  10. package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Text/Text.d.ts +1 -3
  11. package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Text/Text.js +1 -60
  12. package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/components/S_CB_Box.js +1 -1
  13. package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/index.d.ts +1 -1
  14. package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/index.js +3 -3
  15. package/dist/src/sub/DynamicLayout/sections/CustomSection/components/index.d.ts +1 -1
  16. package/dist/src/sub/DynamicLayout/sections/CustomSection/components/index.js +2 -2
  17. package/dist/src/sub/DynamicLayout/sections/CustomSection/newUtils/textUtil.js +1 -12
  18. package/dist/src/sub/SandollFontKit/api/getSandollFonts.d.ts +14 -0
  19. package/dist/src/sub/SandollFontKit/api/getSandollFonts.js +77 -0
  20. package/dist/src/sub/SandollFontKit/api/types.d.ts +47 -0
  21. package/dist/src/sub/SandollFontKit/api/types.js +2 -0
  22. package/dist/src/sub/SandollFontKit/constants.d.ts +9 -0
  23. package/dist/src/sub/SandollFontKit/constants.js +33 -0
  24. package/dist/src/sub/SandollFontKit/headless/SandollFontItem.d.ts +13 -0
  25. package/dist/src/sub/SandollFontKit/headless/SandollFontItem.js +93 -0
  26. package/dist/src/sub/SandollFontKit/headless/SandollFontsList.d.ts +18 -0
  27. package/dist/src/sub/SandollFontKit/headless/SandollFontsList.js +126 -0
  28. package/dist/src/sub/SandollFontKit/index.d.ts +5 -0
  29. package/dist/src/sub/SandollFontKit/index.js +28 -0
  30. package/dist/src/sub/SandollFontKit/types.d.ts +19 -0
  31. package/dist/src/sub/SandollFontKit/types.js +2 -0
  32. package/dist/src/sub/SandollFontKit/utils/createSandollFontLink.d.ts +2 -0
  33. package/dist/src/sub/SandollFontKit/utils/createSandollFontLink.js +16 -0
  34. package/dist/src/sub/SandollFontKit/utils/delay.d.ts +1 -0
  35. package/dist/src/sub/SandollFontKit/utils/delay.js +6 -0
  36. package/package.json +1 -4
  37. package/dist/src/sub/DynamicLayout/sections/CustomSection/NewCustomSection.d.ts +0 -3
  38. package/dist/src/sub/DynamicLayout/sections/CustomSection/NewCustomSection.js +0 -70
  39. package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Text/index.d.ts +0 -1
  40. package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Text/index.js +0 -8
  41. package/dist/src/sub/DynamicLayout/sections/CustomSection/customSectionContext.d.ts +0 -10
  42. package/dist/src/sub/DynamicLayout/sections/CustomSection/customSectionContext.js +0 -21
  43. package/dist/src/sub/DynamicLayout/sections/TempCustomSection/FlexGridItem.d.ts +0 -11
  44. package/dist/src/sub/DynamicLayout/sections/TempCustomSection/FlexGridItem.js +0 -69
  45. package/dist/src/sub/DynamicLayout/sections/TempCustomSection/TempCustomSection.d.ts +0 -7
  46. package/dist/src/sub/DynamicLayout/sections/TempCustomSection/TempCustomSection.js +0 -87
  47. package/dist/src/sub/DynamicLayout/sections/TempCustomSection/useIsMounted.d.ts +0 -1
  48. package/dist/src/sub/DynamicLayout/sections/TempCustomSection/useIsMounted.js +0 -15
  49. package/dist/src/sub/DynamicLayout/sections/TempCustomSection/useResizableObserver.d.ts +0 -12
  50. package/dist/src/sub/DynamicLayout/sections/TempCustomSection/useResizableObserver.js +0 -74
@@ -0,0 +1,5 @@
1
+ export { default as SandollFontItem } from './headless/SandollFontItem';
2
+ export { default as SandollFontsList } from './headless/SandollFontsList';
3
+ export { default as createSandollFontLink } from './utils/createSandollFontLink';
4
+ export * from './types';
5
+ export * from './constants';
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ var __importDefault = (this && this.__importDefault) || function (mod) {
17
+ return (mod && mod.__esModule) ? mod : { "default": mod };
18
+ };
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.createSandollFontLink = exports.SandollFontsList = exports.SandollFontItem = void 0;
21
+ var SandollFontItem_1 = require("./headless/SandollFontItem");
22
+ Object.defineProperty(exports, "SandollFontItem", { enumerable: true, get: function () { return __importDefault(SandollFontItem_1).default; } });
23
+ var SandollFontsList_1 = require("./headless/SandollFontsList");
24
+ Object.defineProperty(exports, "SandollFontsList", { enumerable: true, get: function () { return __importDefault(SandollFontsList_1).default; } });
25
+ var createSandollFontLink_1 = require("./utils/createSandollFontLink");
26
+ Object.defineProperty(exports, "createSandollFontLink", { enumerable: true, get: function () { return __importDefault(createSandollFontLink_1).default; } });
27
+ __exportStar(require("./types"), exports);
28
+ __exportStar(require("./constants"), exports);
@@ -0,0 +1,19 @@
1
+ import type { SandollFont } from './api/types';
2
+ import type { PDSIconType } from '../../common/types';
3
+ export type SANDOLL_Font = SandollFont;
4
+ export type SANDOLL_CategoryType = 'serif' | 'san-serif' | 'slab' | 'round' | 'script' | 'deco' | 'symbol' | 'blackLetter';
5
+ export type SANDOLL_SortOptionType = 'date' | 'alpha';
6
+ export type SANDOLL_CategoryIconType = Record<SANDOLL_Category, PDSIconType>;
7
+ export type SANDOLL_Category = 'serif' | 'san-serif' | 'slab' | 'round' | 'script' | 'deco' | 'symbol' | 'blackLetter';
8
+ export type SANDOLL_FilterOptionHandlerArgType = {
9
+ name: 'searchQuery';
10
+ value: string;
11
+ } | {
12
+ name: 'categories';
13
+ value: SANDOLL_CategoryType[];
14
+ };
15
+ export type SANDOLL_ChangeFilterOptionHandler = (arg: SANDOLL_FilterOptionHandlerArgType) => void;
16
+ export type SANDOLL_FilterOptionType = {
17
+ searchQuery: string;
18
+ categories: SANDOLL_CategoryType[];
19
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ declare function createSandollFontLink(href: string): void;
2
+ export default createSandollFontLink;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ // href: CSS_URI_FOR_PUBL_OR_INDIVIDUAL_URI
4
+ function createSandollFontLink(href) {
5
+ try {
6
+ var linkTag = document.createElement('link');
7
+ linkTag.setAttribute('rel', 'stylesheet');
8
+ linkTag.setAttribute('charset', 'utf-8');
9
+ linkTag.setAttribute('href', href);
10
+ document.head.appendChild(linkTag);
11
+ }
12
+ catch (error) {
13
+ console.error(error);
14
+ }
15
+ }
16
+ exports.default = createSandollFontLink;
@@ -0,0 +1 @@
1
+ export default function delay(ms: number): Promise<unknown>;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ function delay(ms) {
4
+ return new Promise(function (resolve) { return setTimeout(resolve, ms); });
5
+ }
6
+ exports.default = delay;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pds-dev-kit-web-test",
3
- "version": "2.3.04",
3
+ "version": "2.3.6",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "main": "dist/index.js",
@@ -25,7 +25,6 @@
25
25
  "publ-echo": "^0.0.45",
26
26
  "react-hook-form": "^7.28.1",
27
27
  "react-i18next": "^11.12.0",
28
- "react-measure": "^2.5.2",
29
28
  "react-router-dom": "^5.2.0",
30
29
  "react-scripts": "4.0.3",
31
30
  "smoothscroll-polyfill": "^0.4.4",
@@ -86,8 +85,6 @@
86
85
  "@storybook/react": "^6.3.12",
87
86
  "@types/lodash": "^4.14.175",
88
87
  "@types/node": "^16.10.2",
89
- "@types/react-grid-layout": "^1.3.5",
90
- "@types/react-measure": "^2.0.12",
91
88
  "@types/react-router-dom": "^5.3.3",
92
89
  "@types/smoothscroll-polyfill": "^0.3.1",
93
90
  "@types/styled-components": "^5.1.9",
@@ -1,3 +0,0 @@
1
- /// <reference types="react" />
2
- declare function NewCustomSection(): JSX.Element;
3
- export default NewCustomSection;
@@ -1,70 +0,0 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __importDefault = (this && this.__importDefault) || function (mod) {
14
- return (mod && mod.__esModule) ? mod : { "default": mod };
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- var jsx_runtime_1 = require("react/jsx-runtime");
18
- require("publ-echo");
19
- var ReactGridLayout_1 = __importDefault(require("publ-echo/dist/lib/GridLayoutEditor/ReactGridLayout"));
20
- var react_1 = require("react");
21
- var react_measure_1 = __importDefault(require("react-measure"));
22
- var CustomSection_1 = require("./CustomSection");
23
- function NewCustomSection() {
24
- var _a = (0, react_1.useState)([
25
- {
26
- i: 'a',
27
- x: 0,
28
- y: 0,
29
- w: 3,
30
- h: 6,
31
- text: 'iam AAAAAAAA AAAAAAAA AAAAAAAA AAAAAAAA AAAAAAAA AAAAAAAA AAAAAAAA AAAAAAAA AAAAAAAA',
32
- autoSize: true
33
- },
34
- { i: 'b', x: 1, y: 0, w: 3, h: 2, text: 'iam BBBBBBBB' },
35
- { i: 'c', x: 4, y: 0, w: 1, h: 2, text: 'iam CCCCCCCC' }
36
- ]), layout = _a[0], setLayout = _a[1];
37
- function onSizeChange(size, index) {
38
- setLayout(function (prev) {
39
- var copy = JSON.parse(JSON.stringify(prev));
40
- // From formula pixelHeight = (rowHeight * h) + (marginH * (h - 1))
41
- // h = (pixelHeight + marginH) / (marginH + rowHeight)
42
- var newH = (size.height + 50) / (50 + 30);
43
- copy[index].h = newH;
44
- copy[index].minH = newH;
45
- console.log('size changed so setLayout');
46
- return copy;
47
- });
48
- // const placeholder = document.querySelector('.react-grid-placeholder')
49
- // placeholder.height = 100;
50
- }
51
- return ((0, jsx_runtime_1.jsx)(CustomSection_1.S_gleStyles, __assign({ style: { backgroundColor: 'white' } }, { children: (0, jsx_runtime_1.jsx)(ReactGridLayout_1.default, __assign({ layout: layout,
52
- // onLayoutChange={onLayoutChange}
53
- allowOverlap: true, margin: [50, 50], cols: 12, rowHeight: 30, width: 1200, resizeHandles: ['n', 'e', 'w', 'sw', 'se', 's', 'nw', 'ne'] }, { children: layout.map(function (item, index) { return ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(MeasuredCB, { text: item.text, onSizeChange: function (size) { return onSizeChange(size, index); } }) }, item.i)); }) })) })));
54
- }
55
- var MeasuredCB = function (_a) {
56
- var text = _a.text, onSizeChange = _a.onSizeChange;
57
- var handleResize = function (contentRect) {
58
- if (contentRect.bounds) {
59
- onSizeChange({
60
- width: contentRect.bounds.width,
61
- height: contentRect.bounds.height
62
- });
63
- }
64
- };
65
- return ((0, jsx_runtime_1.jsx)(react_measure_1.default, __assign({ bounds: true, onResize: handleResize }, { children: function (_a) {
66
- var measureRef = _a.measureRef;
67
- return ((0, jsx_runtime_1.jsx)("div", __assign({ ref: measureRef, contentEditable: true, style: { outline: 'none' } }, { children: text })));
68
- } })));
69
- };
70
- exports.default = NewCustomSection;
@@ -1,8 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Text = void 0;
7
- var Text_1 = require("./Text");
8
- Object.defineProperty(exports, "Text", { enumerable: true, get: function () { return __importDefault(Text_1).default; } });
@@ -1,10 +0,0 @@
1
- import React from 'react';
2
- import type { LayoutsType } from './CustomSection';
3
- import type { TypeOfSectionAction } from '../../../DynamicLayout/sectionActionTypes';
4
- export interface CustomSectionContext {
5
- rowHeight: number;
6
- setLayouts: React.Dispatch<React.SetStateAction<LayoutsType>>;
7
- sectionActionHandler?: (action: TypeOfSectionAction) => void;
8
- }
9
- export declare const CustomSectionContext: React.Context<CustomSectionContext | undefined>;
10
- export declare function useCustomSectionContext(): CustomSectionContext;
@@ -1,21 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.useCustomSectionContext = exports.CustomSectionContext = void 0;
7
- var react_1 = __importDefault(require("react"));
8
- exports.CustomSectionContext = react_1.default.createContext(undefined);
9
- // export const CustomSectionContextProvider: React.FC = ({ children }) => {
10
- // const [user, setUser] = React.useState<string>('');
11
- // const value = { user, setUser };
12
- // return <CustomSectionContext.Provider value={value}>{children}</CustomSectionContext.Provider>;
13
- // };
14
- function useCustomSectionContext() {
15
- var context = react_1.default.useContext(exports.CustomSectionContext);
16
- if (context === undefined) {
17
- throw new Error('useCustomSectionContext must be used within an AppProvider');
18
- }
19
- return context;
20
- }
21
- exports.useCustomSectionContext = useCustomSectionContext;
@@ -1,11 +0,0 @@
1
- /// <reference types="react" />
2
- import { type ComponentBlock } from '../CustomSection/types';
3
- import type { Device } from '../CustomSection/util/types';
4
- type Props = {
5
- cb: ComponentBlock;
6
- index: number;
7
- device: Device;
8
- rowHeight: number;
9
- };
10
- declare function FlexGridItem({ cb, index, device, rowHeight }: Props): JSX.Element;
11
- export default FlexGridItem;
@@ -1,69 +0,0 @@
1
- "use strict";
2
- var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
3
- if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
4
- return cooked;
5
- };
6
- var __assign = (this && this.__assign) || function () {
7
- __assign = Object.assign || function(t) {
8
- for (var s, i = 1, n = arguments.length; i < n; i++) {
9
- s = arguments[i];
10
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
11
- t[p] = s[p];
12
- }
13
- return t;
14
- };
15
- return __assign.apply(this, arguments);
16
- };
17
- var __importDefault = (this && this.__importDefault) || function (mod) {
18
- return (mod && mod.__esModule) ? mod : { "default": mod };
19
- };
20
- Object.defineProperty(exports, "__esModule", { value: true });
21
- var jsx_runtime_1 = require("react/jsx-runtime");
22
- require("react");
23
- var styled_components_1 = __importDefault(require("styled-components"));
24
- var components_1 = require("../CustomSection/components");
25
- var types_1 = require("../CustomSection/types");
26
- var gap = 10;
27
- function FlexGridItem(_a) {
28
- var cb = _a.cb, index = _a.index, device = _a.device, rowHeight = _a.rowHeight;
29
- var defaultHeight = getMaxHeight(cb.jsonProperties.data.CB_PLACEMENT_PROP_PLACEMENT, device, rowHeight);
30
- var gridArea = getGridAreaFromCB(cb.jsonProperties.data.CB_PLACEMENT_PROP_PLACEMENT, device);
31
- return ((0, jsx_runtime_1.jsx)(GridItem, __assign({ style: {
32
- gridArea: gridArea,
33
- maxHeight: cb.componentBlockCode !== types_1.CB_ALL_CODES.CB_TEXT ? defaultHeight : undefined
34
- } }, { children: (0, jsx_runtime_1.jsx)(components_1.ComponentBlockMatcher, { id: Number(cb.id), cbProps: cb, device: device, index: index }) })));
35
- }
36
- var S_CB = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n border: 1px solid red;\n /* max-height: fit-content; */\n min-height: ", ";\n"], ["\n border: 1px solid red;\n /* max-height: fit-content; */\n min-height: ", ";\n"])), function (props) { return "".concat(props.defaultHeight, "px"); });
37
- var GridItem = styled_components_1.default.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n height: auto;\n max-height: fit-content;\n word-break: break-word;\n"], ["\n height: auto;\n max-height: fit-content;\n word-break: break-word;\n"])));
38
- function getMaxHeight(props, device, rowHeight) {
39
- if (device === 'DESKTOP') {
40
- var CB_PLACEMENT_PROP_PLACEMENT_SPEC_ROWS = props.CB_PLACEMENT_PROP_PLACEMENT_SPEC_ROWS;
41
- var height_1 = (CB_PLACEMENT_PROP_PLACEMENT_SPEC_ROWS * rowHeight) + ((CB_PLACEMENT_PROP_PLACEMENT_SPEC_ROWS - 1) * gap);
42
- return height_1;
43
- }
44
- var rowsMobile = props['CB_PLACEMENT_PROP_PLACEMENT_SPEC_ROWS:MOBILE'];
45
- var height = (rowsMobile * rowHeight) + ((rowsMobile - 1) * gap);
46
- return height;
47
- }
48
- function getGridAreaFromCB(props, device) {
49
- var CB_PLACEMENT_PROP_PLACEMENT_SPEC_STARTX = props.CB_PLACEMENT_PROP_PLACEMENT_SPEC_STARTX, CB_PLACEMENT_PROP_PLACEMENT_SPEC_STARTY = props.CB_PLACEMENT_PROP_PLACEMENT_SPEC_STARTY, cols = props.CB_PLACEMENT_PROP_PLACEMENT_SPEC_COLS, rows = props.CB_PLACEMENT_PROP_PLACEMENT_SPEC_ROWS;
50
- if (device === 'DESKTOP') {
51
- var colStart_1 = CB_PLACEMENT_PROP_PLACEMENT_SPEC_STARTX + 1;
52
- var rowStart_1 = CB_PLACEMENT_PROP_PLACEMENT_SPEC_STARTY + 1;
53
- var rowEnd_1 = rows + rowStart_1;
54
- var colEnd_1 = cols + colStart_1;
55
- // <grid-row-start> / <grid-column-start> / <grid-row-end> / <grid-column-end>;
56
- return "".concat(rowStart_1, " / ").concat(colStart_1, " / ").concat(rowEnd_1, " / ").concat(colEnd_1);
57
- }
58
- var startXMobile = props['CB_PLACEMENT_PROP_PLACEMENT_SPEC_STARTX:MOBILE'];
59
- var startYMobile = props['CB_PLACEMENT_PROP_PLACEMENT_SPEC_STARTY:MOBILE'];
60
- var colsMobile = props['CB_PLACEMENT_PROP_PLACEMENT_SPEC_COLS:MOBILE'];
61
- var rowsMobile = props['CB_PLACEMENT_PROP_PLACEMENT_SPEC_ROWS:MOBILE'];
62
- var colStart = startXMobile + 1;
63
- var rowStart = startYMobile + 1;
64
- var rowEnd = rowsMobile + rowStart;
65
- var colEnd = colsMobile + colStart;
66
- return "".concat(rowStart, " / ").concat(colStart, " / ").concat(rowEnd, " / ").concat(colEnd);
67
- }
68
- exports.default = FlexGridItem;
69
- var templateObject_1, templateObject_2;
@@ -1,7 +0,0 @@
1
- /// <reference types="react" />
2
- import type { ISection } from '../../../DynamicLayout/types';
3
- type Props = {
4
- section: ISection;
5
- };
6
- declare function TempCustomSection({ section }: Props): JSX.Element;
7
- export default TempCustomSection;
@@ -1,87 +0,0 @@
1
- "use strict";
2
- var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
3
- if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
4
- return cooked;
5
- };
6
- var __assign = (this && this.__assign) || function () {
7
- __assign = Object.assign || function(t) {
8
- for (var s, i = 1, n = arguments.length; i < n; i++) {
9
- s = arguments[i];
10
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
11
- t[p] = s[p];
12
- }
13
- return t;
14
- };
15
- return __assign.apply(this, arguments);
16
- };
17
- var __importDefault = (this && this.__importDefault) || function (mod) {
18
- return (mod && mod.__esModule) ? mod : { "default": mod };
19
- };
20
- Object.defineProperty(exports, "__esModule", { value: true });
21
- var jsx_runtime_1 = require("react/jsx-runtime");
22
- var react_1 = require("react");
23
- var components_1 = require("../../../DynamicLayout/components");
24
- var ErrorBoundary_1 = require("../../../DynamicLayout/components/Section/ErrorBoundary");
25
- var dynamicLayoutContext_1 = require("../../../DynamicLayout/dynamicLayoutContext");
26
- var styled_components_1 = __importDefault(require("styled-components"));
27
- var CustomSection_1 = require("../CustomSection/CustomSection");
28
- var customSectionContext_1 = require("../CustomSection/customSectionContext");
29
- var util_1 = require("../CustomSection/util");
30
- var parseSectionPadding_1 = __importDefault(require("../CustomSection/util/layoutPropParsers/parseSectionPadding"));
31
- var FlexGridItem_1 = __importDefault(require("./FlexGridItem"));
32
- var useResizableObserver_1 = require("./useResizableObserver");
33
- function TempCustomSection(_a) {
34
- var _b;
35
- var section = _a.section;
36
- var _c = (0, react_1.useContext)(dynamicLayoutContext_1.dynamicLayoutContext), device = _c.device, editingSectionId = _c.editingSectionId, mode = _c.mode, shortcutKeyMode = _c.shortcutKeyMode, sectionActionHandler = _c.sectionActionHandler;
37
- var isMobile = device === 'MOBILE';
38
- var ref = (0, react_1.useRef)(null);
39
- var size = (0, useResizableObserver_1.useResizeObserver)({ ref: ref, box: 'border-box' });
40
- if (!section.jsonProperties) {
41
- return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: "Error: No JsonProperties of section" });
42
- }
43
- var _d = section.jsonProperties.data, CB_PLACEMENT_PROP_SECTION = _d.CB_PLACEMENT_PROP_SECTION, CB_LAYOUT_PROP_PADDING = _d.CB_LAYOUT_PROP_PADDING;
44
- var sectionRow = CB_PLACEMENT_PROP_SECTION.CB_PLACEMENT_PROP_SECTION_SPEC_ROWS;
45
- var _e = (0, util_1.parseCustomSectionPlacement)({
46
- isMobile: isMobile,
47
- customSectionProps: CB_PLACEMENT_PROP_SECTION
48
- }), rows = _e.rows, width = _e.width, minHeight = _e.minHeight, isFullWidth = _e.isFullWidth;
49
- var padding = (0, parseSectionPadding_1.default)(CB_LAYOUT_PROP_PADDING, 'DESKTOP');
50
- var customSectionStyles = {
51
- minHeight: "".concat(minHeight, "vh"),
52
- width: '100%',
53
- maxWidth: isFullWidth ? '' : "".concat(width, "px")
54
- };
55
- var rowHeight = (function () {
56
- if (!size.width) {
57
- return 50;
58
- }
59
- // NOTE: local환경에서 CB_CONTENT_PROP_SECTION이 없는 경우가 있음.
60
- // const responsiveFontMode =
61
- // !!CB_CONTENT_PROP_SECTION?.CB_CONTENT_PROP_SECTION_SPEC_VARIABLEROOTFONTSIZE;
62
- if (device === 'MOBILE') {
63
- var cellWidth_1 = size.width / CustomSection_1.MOBILE_GRID_COLS;
64
- // baseFontSize !== 16 && setBaseFontSize(16);
65
- return cellWidth_1 * 0.56;
66
- }
67
- var cellWidth = size.width / CustomSection_1.DESKTOP_GRID_COLS;
68
- return cellWidth * 0.56;
69
- // responsiveFontMode ? setBaseFontSize(cellWidth / 2.35) : setBaseFontSize(16);
70
- })();
71
- return ((0, jsx_runtime_1.jsx)(S_SectionWrapper, { children: (0, jsx_runtime_1.jsx)(customSectionContext_1.CustomSectionContext.Provider, __assign({ value: { rowHeight: rowHeight, setLayouts: null, sectionActionHandler: null } }, { children: (0, jsx_runtime_1.jsx)(components_1.CustomSection, __assign({}, section, { overrideStyles: {
72
- minHeight: customSectionStyles.minHeight,
73
- paddingTop: padding.top,
74
- paddingBottom: padding.bottom,
75
- paddingRight: padding.right,
76
- paddingLeft: padding.left
77
- } }, { children: (0, jsx_runtime_1.jsx)(GridContainer, __assign({ ref: ref, cols: isMobile ? 8 : 24, rowHeight: rowHeight, sectionRow: sectionRow, style: {
78
- width: customSectionStyles.width,
79
- maxWidth: customSectionStyles.maxWidth,
80
- minWidth: isMobile ? CustomSection_1.GLE_MIN_WIDTH_MOBILE_PX : CustomSection_1.GLE_MIN_WIDTH_DESKTOP_PX,
81
- fontSize: "16px"
82
- } }, { children: (_b = section.componentBlocks) === null || _b === void 0 ? void 0 : _b.map(function (cb, index) { return ((0, jsx_runtime_1.jsx)(ErrorBoundary_1.ErrorBoundary, { children: (0, jsx_runtime_1.jsx)(FlexGridItem_1.default, { cb: cb, index: index, device: device, rowHeight: rowHeight }) }, cb.id)); }) })) })) })) }));
83
- }
84
- var S_SectionWrapper = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: relative;\n"], ["\n position: relative;\n"])));
85
- var GridContainer = styled_components_1.default.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: grid; /* Space between grid items */\n gap: 10px;\n grid-template-columns: repeat(", ", 1fr);\n grid-template-rows: repeat(\n ", ",\n minmax(", ", auto)\n );\n\n * {\n box-sizing: border-box;\n }\n"], ["\n display: grid; /* Space between grid items */\n gap: 10px;\n grid-template-columns: repeat(", ", 1fr);\n grid-template-rows: repeat(\n ", ",\n minmax(", ", auto)\n );\n\n * {\n box-sizing: border-box;\n }\n"])), function (props) { return props.cols; }, function (props) { return props.sectionRow; }, function (props) { return "".concat(props.rowHeight, "px"); });
86
- exports.default = TempCustomSection;
87
- var templateObject_1, templateObject_2;
@@ -1 +0,0 @@
1
- export declare function useIsMounted(): () => boolean;
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useIsMounted = void 0;
4
- var react_1 = require("react");
5
- function useIsMounted() {
6
- var isMounted = (0, react_1.useRef)(false);
7
- (0, react_1.useEffect)(function () {
8
- isMounted.current = true;
9
- return function () {
10
- isMounted.current = false;
11
- };
12
- }, []);
13
- return (0, react_1.useCallback)(function () { return isMounted.current; }, []);
14
- }
15
- exports.useIsMounted = useIsMounted;
@@ -1,12 +0,0 @@
1
- import type { RefObject } from 'react';
2
- type Size = {
3
- width: number | undefined;
4
- height: number | undefined;
5
- };
6
- type UseResizeObserverOptions<T extends HTMLElement = HTMLElement> = {
7
- ref: RefObject<T>;
8
- onResize?: (size: Size) => void;
9
- box?: 'border-box' | 'content-box' | 'device-pixel-content-box';
10
- };
11
- export declare function useResizeObserver<T extends HTMLElement = HTMLElement>(options: UseResizeObserverOptions<T>): Size;
12
- export {};
@@ -1,74 +0,0 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.useResizeObserver = void 0;
15
- var react_1 = require("react");
16
- var useIsMounted_1 = require("./useIsMounted");
17
- var initialSize = {
18
- width: undefined,
19
- height: undefined
20
- };
21
- function useResizeObserver(options) {
22
- var ref = options.ref, _a = options.box, box = _a === void 0 ? 'content-box' : _a;
23
- var _b = (0, react_1.useState)(initialSize), _c = _b[0], width = _c.width, height = _c.height, setSize = _b[1];
24
- var isMounted = (0, useIsMounted_1.useIsMounted)();
25
- var previousSize = (0, react_1.useRef)(__assign({}, initialSize));
26
- var onResize = (0, react_1.useRef)(undefined);
27
- onResize.current = options.onResize;
28
- (0, react_1.useEffect)(function () {
29
- if (!ref.current)
30
- return;
31
- if (typeof window === 'undefined' || !('ResizeObserver' in window))
32
- return;
33
- var observer = new ResizeObserver(function (_a) {
34
- var entry = _a[0];
35
- var boxProp = box === 'border-box'
36
- ? 'borderBoxSize'
37
- : box === 'device-pixel-content-box'
38
- ? 'devicePixelContentBoxSize'
39
- : 'contentBoxSize';
40
- var newWidth = extractSize(entry, boxProp, 'inlineSize');
41
- var newHeight = extractSize(entry, boxProp, 'blockSize');
42
- var hasChanged = previousSize.current.width !== newWidth || previousSize.current.height !== newHeight;
43
- if (hasChanged) {
44
- var newSize = { width: newWidth, height: newHeight };
45
- previousSize.current.width = newWidth;
46
- previousSize.current.height = newHeight;
47
- if (onResize.current) {
48
- onResize.current(newSize);
49
- }
50
- else if (isMounted()) {
51
- setSize(newSize);
52
- }
53
- }
54
- });
55
- observer.observe(ref.current, { box: box });
56
- return function () {
57
- observer.disconnect();
58
- };
59
- }, [box, ref, isMounted]);
60
- return { width: width, height: height };
61
- }
62
- exports.useResizeObserver = useResizeObserver;
63
- function extractSize(entry, box, sizeType) {
64
- if (!entry[box]) {
65
- if (box === 'contentBoxSize') {
66
- return entry.contentRect[sizeType === 'inlineSize' ? 'width' : 'height'];
67
- }
68
- return undefined;
69
- }
70
- return Array.isArray(entry[box])
71
- ? entry[box][0][sizeType]
72
- : // @ts-ignore Support Firefox's non-standard behavior
73
- entry[box][sizeType];
74
- }