pds-dev-kit-web-test 2.2.88 → 2.2.90
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.
- package/dist/src/sub/DynamicLayout/pagesPreviewMock.d.ts +495 -0
- package/dist/src/sub/DynamicLayout/pagesPreviewMock.js +616 -1
- package/dist/src/sub/DynamicLayout/sections/CustomSection/CustomSection.js +4 -16
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/ComponentBlockMatcher.d.ts +2 -1
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/ComponentBlockMatcher.js +2 -2
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Text/Text.d.ts +3 -1
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Text/Text.js +3 -5
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Text/useMaxFontAdjustment.d.ts +2 -1
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Text/useMaxFontAdjustment.js +33 -18
- package/package.json +1 -1
- package/dist/src/sub/DynamicLayout/flexGridLayout/FlexGridLayout.d.ts +0 -3
- package/dist/src/sub/DynamicLayout/flexGridLayout/FlexGridLayout.js +0 -18
@@ -358,20 +358,8 @@ var CustomSection = (0, react_1.forwardRef)(function CustomSection(props, ref) {
|
|
358
358
|
var viewport = width + ((_a = padding === null || padding === void 0 ? void 0 : padding.left) !== null && _a !== void 0 ? _a : 0) + ((_b = padding === null || padding === void 0 ? void 0 : padding.right) !== null && _b !== void 0 ? _b : 0);
|
359
359
|
if (device === 'MOBILE') {
|
360
360
|
var cellWidth_1 = viewport / MOBILE_GRID_COLS;
|
361
|
-
|
362
|
-
|
363
|
-
// const gap = baseViewPort - viewport;
|
364
|
-
// // NOTE: 임시
|
365
|
-
// if (viewport > 480) {
|
366
|
-
// setBaseFontSize(22);
|
367
|
-
// }
|
368
|
-
// if (gap > 0) {
|
369
|
-
// const magicNumber = (gap / 22) ** 1.1;
|
370
|
-
// const resSize = 16 - magicNumber;
|
371
|
-
// console.log(resSize);
|
372
|
-
// console.log(cellHeight / 1.641);
|
373
|
-
// setBaseFontSize(resSize);
|
374
|
-
// }
|
361
|
+
var responsiveBaseFontSize = (viewport / 23.4).toFixed(3);
|
362
|
+
setBaseFontSize(Number(responsiveBaseFontSize));
|
375
363
|
setRowHeight(cellWidth_1 * 0.56);
|
376
364
|
return;
|
377
365
|
}
|
@@ -455,7 +443,7 @@ var CustomSection = (0, react_1.forwardRef)(function CustomSection(props, ref) {
|
|
455
443
|
return ((0, jsx_runtime_1.jsx)("div", __assign({ className: "cb-box-in-group", onClick: function (e) {
|
456
444
|
e.stopPropagation();
|
457
445
|
clickOneCBInBulk(matchedCB.id, array);
|
458
|
-
} }, { children: (0, jsx_runtime_1.jsx)(ErrorBoundary_1.ErrorBoundary, { children: (0, jsx_runtime_1.jsx)(ComponentBlockMatcher_1.default, { cbProps: cbCopy, device: device, index: index }) }) }), matchedCB.id));
|
446
|
+
} }, { children: (0, jsx_runtime_1.jsx)(ErrorBoundary_1.ErrorBoundary, { children: (0, jsx_runtime_1.jsx)(ComponentBlockMatcher_1.default, { cbProps: cbCopy, device: device, index: index, rootBaseFontSize: baseFontSize }) }) }), matchedCB.id));
|
459
447
|
}) })) }), each.i));
|
460
448
|
}
|
461
449
|
if (!matchedCB) {
|
@@ -471,7 +459,7 @@ var CustomSection = (0, react_1.forwardRef)(function CustomSection(props, ref) {
|
|
471
459
|
e.stopPropagation();
|
472
460
|
e.preventDefault();
|
473
461
|
onContextMenuCB(matchedCB.id, e);
|
474
|
-
} }, { children: (0, jsx_runtime_1.jsx)(ErrorBoundary_1.ErrorBoundary, { children: (0, jsx_runtime_1.jsx)(ComponentBlockMatcher_1.default, { index: index, cbProps: matchedCB, device: device }) }) })) }), each.i));
|
462
|
+
} }, { children: (0, jsx_runtime_1.jsx)(ErrorBoundary_1.ErrorBoundary, { children: (0, jsx_runtime_1.jsx)(ComponentBlockMatcher_1.default, { index: index, cbProps: matchedCB, device: device, rootBaseFontSize: baseFontSize }) }) })) }), each.i));
|
475
463
|
}) })) })) })) }) }));
|
476
464
|
});
|
477
465
|
function keepSimilarOrderToPreventRerender(arr) {
|
@@ -5,6 +5,7 @@ type Props = {
|
|
5
5
|
cbProps: ComponentBlock;
|
6
6
|
device: Device;
|
7
7
|
index: number;
|
8
|
+
rootBaseFontSize: number;
|
8
9
|
};
|
9
|
-
export default function ComponentBlockMatcher({ cbProps, device, index }: Props): JSX.Element;
|
10
|
+
export default function ComponentBlockMatcher({ cbProps, device, index, rootBaseFontSize }: Props): JSX.Element;
|
10
11
|
export {};
|
@@ -27,14 +27,14 @@ var Text_1 = __importDefault(require("./componentBlocks/Text/Text"));
|
|
27
27
|
var Twitter_1 = __importDefault(require("./componentBlocks/Twitter/Twitter"));
|
28
28
|
var Youtube_1 = require("./componentBlocks/Youtube");
|
29
29
|
function ComponentBlockMatcher(_a) {
|
30
|
-
var cbProps = _a.cbProps, device = _a.device, index = _a.index;
|
30
|
+
var cbProps = _a.cbProps, device = _a.device, index = _a.index, rootBaseFontSize = _a.rootBaseFontSize;
|
31
31
|
var componentBlockCode = cbProps.componentBlockCode, data = cbProps.jsonProperties.data;
|
32
32
|
var propsWithValue = device === 'MOBILE' ? (0, newUtils_1.replaceUndefinedValues)(data) : data;
|
33
33
|
switch (componentBlockCode) {
|
34
34
|
case types_1.CB_ALL_CODES.CB_BTN:
|
35
35
|
return (0, jsx_runtime_1.jsx)(Button_1.default, __assign({}, propsWithValue, { index: index }));
|
36
36
|
case types_1.CB_ALL_CODES.CB_TEXT:
|
37
|
-
return (0, jsx_runtime_1.jsx)(Text_1.default, __assign({}, propsWithValue, { index: index }));
|
37
|
+
return ((0, jsx_runtime_1.jsx)(Text_1.default, __assign({}, propsWithValue, { index: index, rootBaseFontSize: rootBaseFontSize })));
|
38
38
|
case types_1.CB_ALL_CODES.CB_RICHTEXT:
|
39
39
|
return (0, jsx_runtime_1.jsx)(RichText_1.RichText, __assign({}, propsWithValue, { index: index }));
|
40
40
|
case types_1.CB_ALL_CODES.CB_DIVIDER:
|
@@ -1,5 +1,7 @@
|
|
1
1
|
/// <reference types="react" />
|
2
2
|
import type { CB_TEXT_PROPERTIES_TYPE, IndexForIntersection } from '../../../../util/types';
|
3
|
-
type Props = CB_TEXT_PROPERTIES_TYPE & IndexForIntersection
|
3
|
+
type Props = CB_TEXT_PROPERTIES_TYPE & IndexForIntersection & {
|
4
|
+
rootBaseFontSize: number;
|
5
|
+
};
|
4
6
|
declare function Text(props: Props): JSX.Element;
|
5
7
|
export default Text;
|
@@ -36,7 +36,7 @@ var useCLINK_1 = __importDefault(require("../hooks/useCLINK"));
|
|
36
36
|
var useMaxFontAdjustment_1 = __importDefault(require("./useMaxFontAdjustment"));
|
37
37
|
function Text(props) {
|
38
38
|
var _a = (0, react_1.useContext)(DynamicLayout_1.dynamicLayoutContext), device = _a.device, mode = _a.mode;
|
39
|
-
var index = props.index, _b = props.CB_CONTENT_PROP_CLINK, CB_CONTENT_PROP_CLINK_SPEC_SRC = _b.CB_CONTENT_PROP_CLINK_SPEC_SRC, CB_CONTENT_PROP_CLINK_SPEC_TYPE = _b.CB_CONTENT_PROP_CLINK_SPEC_TYPE, CB_CONTENT_PROP_CLINK_SPEC_NEWTAB = _b.CB_CONTENT_PROP_CLINK_SPEC_NEWTAB, CB_CONTENT_PROP_CLINK_SPEC_INTERNALSRC = _b.CB_CONTENT_PROP_CLINK_SPEC_INTERNALSRC, CB_EFFECT_PROP_ENTANIM = props.CB_EFFECT_PROP_ENTANIM;
|
39
|
+
var index = props.index, _b = props.CB_CONTENT_PROP_CLINK, CB_CONTENT_PROP_CLINK_SPEC_SRC = _b.CB_CONTENT_PROP_CLINK_SPEC_SRC, CB_CONTENT_PROP_CLINK_SPEC_TYPE = _b.CB_CONTENT_PROP_CLINK_SPEC_TYPE, CB_CONTENT_PROP_CLINK_SPEC_NEWTAB = _b.CB_CONTENT_PROP_CLINK_SPEC_NEWTAB, CB_CONTENT_PROP_CLINK_SPEC_INTERNALSRC = _b.CB_CONTENT_PROP_CLINK_SPEC_INTERNALSRC, CB_EFFECT_PROP_ENTANIM = props.CB_EFFECT_PROP_ENTANIM, rootBaseFontSize = props.rootBaseFontSize;
|
40
40
|
var _c = (0, useCLINK_1.default)({
|
41
41
|
src: CB_CONTENT_PROP_CLINK_SPEC_SRC,
|
42
42
|
type: CB_CONTENT_PROP_CLINK_SPEC_TYPE,
|
@@ -63,10 +63,8 @@ function Text(props) {
|
|
63
63
|
var hasEffect = !isNoneEffectType;
|
64
64
|
var effectVisibleStyle = hasEffect ? { opacity: isVisible ? 1 : 0 } : {};
|
65
65
|
var textBoxRef = (0, react_1.useRef)(null);
|
66
|
-
var baseFontSize = (0, useMaxFontAdjustment_1.default)(textBoxRef, textStyle.fontSize, mode);
|
67
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [isEditModeAndHidden && (0, jsx_runtime_1.jsx)(S_HiddenCover_1.S_HiddenCover, {}), (0, jsx_runtime_1.jsx)(S_CB_AnimationObserverBox_1.S_CB_AnimationObserverBox, __assign({ ref: hasEffect ? cbRef : null, effectVisibleStyle: effectVisibleStyle, style: {
|
68
|
-
fontSize: "".concat(baseFontSize, "px")
|
69
|
-
} }, { children: (0, jsx_runtime_1.jsx)(S_CB_Box_1.S_CB_Box, __assign({ ref: textBoxRef, className: "cb-layout-box cb-text-box", normalStyle: __assign(__assign(__assign(__assign(__assign({}, textStyle), propsStyle), effectCssProperties), layoutStyle), { cursor: CLINKCursor, paddingTop: 0, paddingBottom: 0, paddingLeft: 0, paddingRight: 0 }), hoverStyle: __assign(__assign({}, textHoverStyle), propsHoverStyle), onClick: onClickCLINK }, { children: (0, jsx_runtime_1.jsx)(S_TextContent, __assign({ className: "cb-text-content", style: {
|
66
|
+
var baseFontSize = (0, useMaxFontAdjustment_1.default)(textBoxRef, textStyle.fontSize, mode, device, rootBaseFontSize);
|
67
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [isEditModeAndHidden && (0, jsx_runtime_1.jsx)(S_HiddenCover_1.S_HiddenCover, {}), (0, jsx_runtime_1.jsx)(S_CB_AnimationObserverBox_1.S_CB_AnimationObserverBox, __assign({ ref: hasEffect ? cbRef : null, effectVisibleStyle: effectVisibleStyle, style: { fontSize: rootBaseFontSize < 16 ? "".concat(baseFontSize, "px") : "".concat(rootBaseFontSize, "px") } }, { children: (0, jsx_runtime_1.jsx)(S_CB_Box_1.S_CB_Box, __assign({ ref: textBoxRef, className: "cb-layout-box cb-text-box", normalStyle: __assign(__assign(__assign(__assign(__assign({}, textStyle), propsStyle), effectCssProperties), layoutStyle), { cursor: CLINKCursor, paddingTop: 0, paddingBottom: 0, paddingLeft: 0, paddingRight: 0 }), hoverStyle: __assign(__assign({}, textHoverStyle), propsHoverStyle), onClick: onClickCLINK }, { children: (0, jsx_runtime_1.jsx)(S_TextContent, __assign({ className: "cb-text-content", style: {
|
70
68
|
whiteSpace: 'pre-wrap',
|
71
69
|
wordBreak: 'break-word',
|
72
70
|
height: 'fit-content',
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { RefObject } from 'react';
|
2
|
+
import type { Device } from '../../../../../../../DynamicLayout/sections/CustomSection/util/types';
|
2
3
|
import type { DynamicLayoutProps } from '../../../../../../../DynamicLayout/types';
|
3
|
-
declare const useMaxFontAdjustment: (ref: RefObject<HTMLDivElement>,
|
4
|
+
declare const useMaxFontAdjustment: (ref: RefObject<HTMLDivElement>, cbFontSize: string, mode: DynamicLayoutProps['mode'], device: Device, rootBaseFontSize: number) => number;
|
4
5
|
export default useMaxFontAdjustment;
|
@@ -2,43 +2,58 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
var react_1 = require("react");
|
4
4
|
var DEFAULT_BASE_FONT = 16;
|
5
|
-
var useMaxFontAdjustment = function (ref,
|
5
|
+
var useMaxFontAdjustment = function (ref, cbFontSize, mode, device, rootBaseFontSize) {
|
6
6
|
var _a = (0, react_1.useState)(DEFAULT_BASE_FONT), fontSize = _a[0], setFontSize = _a[1];
|
7
7
|
var ogRef = (0, react_1.useRef)(0);
|
8
8
|
(0, react_1.useEffect)(function () {
|
9
|
+
if (device === 'DESKTOP') {
|
10
|
+
return;
|
11
|
+
}
|
9
12
|
if (mode !== 'PREVIEW') {
|
10
13
|
return;
|
11
14
|
}
|
12
|
-
if (!ref.current)
|
15
|
+
if (!ref.current) {
|
16
|
+
return;
|
17
|
+
}
|
18
|
+
if (rootBaseFontSize >= 16) {
|
13
19
|
return;
|
14
|
-
if (fontSize === 16) {
|
15
|
-
var boxHeight = ref.current.clientHeight;
|
16
|
-
var contentHeight = ref.current.children[0].clientHeight;
|
17
|
-
var percent = (contentHeight / boxHeight) * 100;
|
18
|
-
ogRef.current = percent;
|
19
20
|
}
|
20
21
|
var resizeObserver = new ResizeObserver(function (callback) {
|
21
22
|
var object = callback[0];
|
22
23
|
var height = object.target.clientHeight;
|
23
24
|
var contentHeight = object.target.children[0].clientHeight;
|
25
|
+
var minFontSize = parseEmToNumber(cbFontSize) * 0.6;
|
26
|
+
if (fontSize === 16) {
|
27
|
+
var percent = (contentHeight / contentHeight) * 100;
|
28
|
+
ogRef.current = percent;
|
29
|
+
}
|
24
30
|
var p = (contentHeight / height) * 100;
|
25
31
|
var isOverflow = contentHeight > height;
|
26
32
|
var hasContentGap = p > ogRef.current;
|
33
|
+
var isNextMin = fontSize <= minFontSize;
|
34
|
+
console.log({
|
35
|
+
contentHeight: contentHeight,
|
36
|
+
height: height,
|
37
|
+
ogPercent: ogRef.current,
|
38
|
+
myP: p
|
39
|
+
});
|
40
|
+
if (isNextMin) {
|
41
|
+
return;
|
42
|
+
}
|
27
43
|
if (isOverflow || hasContentGap) {
|
28
44
|
setFontSize(function (prev) { return Number((prev - 0.3).toFixed(3)); });
|
29
|
-
// setFontSize((prev) => {
|
30
|
-
// const value = parseEmToNumber(prev);
|
31
|
-
// if (value === null) {
|
32
|
-
// return prev;
|
33
|
-
// }
|
34
|
-
// return `${(value - 0.3).toFixed(3)}em`;
|
35
|
-
// });
|
36
45
|
}
|
37
46
|
});
|
38
47
|
resizeObserver.observe(ref.current);
|
39
|
-
return function () {
|
40
|
-
|
41
|
-
|
48
|
+
return function () {
|
49
|
+
resizeObserver.disconnect();
|
50
|
+
};
|
51
|
+
}, [fontSize, mode, device, rootBaseFontSize]);
|
52
|
+
(0, react_1.useEffect)(function () {
|
53
|
+
return function () {
|
54
|
+
ogRef.current = 0;
|
55
|
+
};
|
56
|
+
}, []);
|
42
57
|
return fontSize;
|
43
58
|
};
|
44
59
|
exports.default = useMaxFontAdjustment;
|
@@ -46,7 +61,7 @@ function parseEmToNumber(value) {
|
|
46
61
|
var numericPart = value.replace('em', '').trim();
|
47
62
|
var result = parseFloat(numericPart);
|
48
63
|
if (isNaN(result)) {
|
49
|
-
return
|
64
|
+
return 0;
|
50
65
|
}
|
51
66
|
return result;
|
52
67
|
}
|
package/package.json
CHANGED
@@ -1,18 +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 __importDefault = (this && this.__importDefault) || function (mod) {
|
7
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
8
|
-
};
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
10
|
-
var jsx_runtime_1 = require("react/jsx-runtime");
|
11
|
-
require("react");
|
12
|
-
var styled_components_1 = __importDefault(require("styled-components"));
|
13
|
-
function FlexGridLayout() {
|
14
|
-
return (0, jsx_runtime_1.jsx)(S_Layout, { children: "FlexGridLayout" });
|
15
|
-
}
|
16
|
-
var S_Layout = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n background-color: white;\n"], ["\n background-color: white;\n"])));
|
17
|
-
exports.default = FlexGridLayout;
|
18
|
-
var templateObject_1;
|