pds-dev-kit-web-test 2.2.84 → 2.2.86
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/flexGridLayout/FlexGridLayout.d.ts +3 -0
- package/dist/src/sub/DynamicLayout/flexGridLayout/FlexGridLayout.js +18 -0
- package/dist/src/sub/DynamicLayout/pagesPreviewMock.js +1 -1
- package/dist/src/sub/DynamicLayout/sections/CustomSection/CustomSection.js +14 -7
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Text/Text.js +5 -1
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Text/useMaxFontAdjustment.d.ts +3 -0
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Text/useMaxFontAdjustment.js +43 -0
- package/package.json +1 -1
@@ -0,0 +1,18 @@
|
|
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;
|
@@ -5416,7 +5416,7 @@ exports.sampleCustomsectionOnlyText = {
|
|
5416
5416
|
CB_CONTENT_PROP_CLINK_SPEC_SRC: 'https://publ.co',
|
5417
5417
|
CB_CONTENT_PROP_CLINK_SPEC_TYPE: 'DISABLED'
|
5418
5418
|
},
|
5419
|
-
CB_CONTENT_PROP_TEXTOPTION: { CB_CONTENT_PROP_TEXTOPTION_SPEC_FITCONTENT:
|
5419
|
+
CB_CONTENT_PROP_TEXTOPTION: { CB_CONTENT_PROP_TEXTOPTION_SPEC_FITCONTENT: false },
|
5420
5420
|
CB_CONTENT_PROP_HOVER: {
|
5421
5421
|
CB_CONTENT_PROP_HOVER_SPEC_MUSE: true
|
5422
5422
|
},
|
@@ -358,13 +358,20 @@ 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
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
}
|
361
|
+
// const cellHeight = cellWidth * 0.56;
|
362
|
+
// const baseViewPort = 375;
|
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
|
+
// }
|
368
375
|
setRowHeight(cellWidth_1 * 0.56);
|
369
376
|
return;
|
370
377
|
}
|
@@ -33,6 +33,7 @@ var S_CB_AnimationObserverBox_1 = require("../components/S_CB_AnimationObserverB
|
|
33
33
|
var S_CB_Box_1 = require("../components/S_CB_Box");
|
34
34
|
var S_HiddenCover_1 = require("../components/S_HiddenCover");
|
35
35
|
var useCLINK_1 = __importDefault(require("../hooks/useCLINK"));
|
36
|
+
var useMaxFontAdjustment_1 = __importDefault(require("./useMaxFontAdjustment"));
|
36
37
|
function Text(props) {
|
37
38
|
var _a = (0, react_1.useContext)(DynamicLayout_1.dynamicLayoutContext), device = _a.device, mode = _a.mode;
|
38
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;
|
@@ -61,7 +62,10 @@ function Text(props) {
|
|
61
62
|
: CB_EFFECT_PROP_ENTANIM['CB_EFFECT_PROP_ENTANIM_SPEC_TYPE:MOBILE'] === 'NONE';
|
62
63
|
var hasEffect = !isNoneEffectType;
|
63
64
|
var effectVisibleStyle = hasEffect ? { opacity: isVisible ? 1 : 0 } : {};
|
64
|
-
|
65
|
+
var baseFontSize = (0, useMaxFontAdjustment_1.default)(cbRef, textStyle.fontSize, mode);
|
66
|
+
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: {
|
67
|
+
fontSize: "".concat(baseFontSize, "px")
|
68
|
+
} }, { children: (0, jsx_runtime_1.jsx)(S_CB_Box_1.S_CB_Box, __assign({ 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: {
|
65
69
|
whiteSpace: 'pre-wrap',
|
66
70
|
wordBreak: 'break-word',
|
67
71
|
height: 'fit-content',
|
@@ -0,0 +1,43 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
var react_1 = require("react");
|
4
|
+
var DEFAULT_BASE_FONT = 16;
|
5
|
+
var useMaxFontAdjustment = function (ref, defaultSize, mode) {
|
6
|
+
var _a = (0, react_1.useState)(DEFAULT_BASE_FONT), fontSize = _a[0], setFontSize = _a[1];
|
7
|
+
(0, react_1.useEffect)(function () {
|
8
|
+
if (mode !== 'PREVIEW') {
|
9
|
+
return;
|
10
|
+
}
|
11
|
+
if (!ref.current)
|
12
|
+
return;
|
13
|
+
var resizeObserver = new ResizeObserver(function (callback) {
|
14
|
+
var object = callback[0];
|
15
|
+
var height = object.contentRect.height;
|
16
|
+
var contentHeight = object.target.children[0].children[0].clientHeight;
|
17
|
+
var isOverflow = contentHeight > height;
|
18
|
+
if (isOverflow) {
|
19
|
+
setFontSize(function (prev) { return prev - 0.3; });
|
20
|
+
// setFontSize((prev) => {
|
21
|
+
// const value = parseEmToNumber(prev);
|
22
|
+
// if (value === null) {
|
23
|
+
// return prev;
|
24
|
+
// }
|
25
|
+
// return `${(value - 0.3).toFixed(3)}em`;
|
26
|
+
// });
|
27
|
+
}
|
28
|
+
});
|
29
|
+
resizeObserver.observe(ref.current);
|
30
|
+
return function () { return resizeObserver.disconnect(); }; // clean u
|
31
|
+
}, [ref, fontSize, mode]);
|
32
|
+
console.log({ defaultSize: defaultSize, fontSize: fontSize });
|
33
|
+
return fontSize;
|
34
|
+
};
|
35
|
+
exports.default = useMaxFontAdjustment;
|
36
|
+
function parseEmToNumber(value) {
|
37
|
+
var numericPart = value.replace('em', '').trim();
|
38
|
+
var result = parseFloat(numericPart);
|
39
|
+
if (isNaN(result)) {
|
40
|
+
return null;
|
41
|
+
}
|
42
|
+
return result;
|
43
|
+
}
|