pds-dev-kit-web-test 2.7.622 → 2.7.624
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/CompositionEditor/CompositionEditor.js +1 -1
- package/dist/src/sub/DynamicLayout/sections/CustomSection/CustomSection.js +2 -1
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Image/Image.js +2 -1
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Image/Shape.d.ts +42 -0
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Image/Shape.js +113 -0
- package/package.json +1 -1
- package/release-note.md +2 -2
|
@@ -134,6 +134,7 @@ var CompositionEditor = (0, react_1.forwardRef)(function CompositionEditorCanvas
|
|
|
134
134
|
},
|
|
135
135
|
selectCBInBulk: function (blockIds) {
|
|
136
136
|
setBulkBlockIds(blockIds);
|
|
137
|
+
setSelectedBlockId('BULK');
|
|
137
138
|
},
|
|
138
139
|
selectGroup: function (groupBlockId) {
|
|
139
140
|
setBulkBlockIds([]);
|
|
@@ -1058,7 +1059,6 @@ var CompositionEditor = (0, react_1.forwardRef)(function CompositionEditorCanvas
|
|
|
1058
1059
|
}
|
|
1059
1060
|
var editableCBIDs = (0, group_1.findDirectChildrenCbIds)(newblock, editingGroupBlock);
|
|
1060
1061
|
var i18n = (0, react_i18next_1.useTranslation)('translation').i18n;
|
|
1061
|
-
console.log('selectedBlockId', selectedBlockId);
|
|
1062
1062
|
return ((0, jsx_runtime_1.jsx)(ErrorBoundary_1.ErrorBoundary, { children: (0, jsx_runtime_1.jsx)(dynamicLayoutContext_1.dynamicLayoutContext.Provider, __assign({ value: {
|
|
1063
1063
|
device: device,
|
|
1064
1064
|
mode: mode,
|
|
@@ -127,6 +127,7 @@ var CustomSection = (0, react_1.forwardRef)(function CustomSection(props, ref) {
|
|
|
127
127
|
},
|
|
128
128
|
selectCBInBulk: function (blockIds) {
|
|
129
129
|
setBulkBlockIds(blockIds);
|
|
130
|
+
setSelectedBlockId('BULK');
|
|
130
131
|
},
|
|
131
132
|
selectGroup: function (groupBlockId) {
|
|
132
133
|
setBulkBlockIds([]);
|
|
@@ -474,7 +475,7 @@ var CustomSection = (0, react_1.forwardRef)(function CustomSection(props, ref) {
|
|
|
474
475
|
return;
|
|
475
476
|
}
|
|
476
477
|
setBulkBlockIds(newBulks);
|
|
477
|
-
setSelectedBlockId(
|
|
478
|
+
setSelectedBlockId('BULK');
|
|
478
479
|
var newBulkCBIds = newBulks
|
|
479
480
|
.map(function (id) { return (0, group_1.formatBlockIdToCbId)(id); })
|
|
480
481
|
.filter(function (each) { return each !== null; });
|
|
@@ -53,6 +53,7 @@ var S_CB_AnimationObserverBox_1 = require("../components/S_CB_AnimationObserverB
|
|
|
53
53
|
var S_CB_BoxWithShadow_1 = require("../components/S_CB_BoxWithShadow");
|
|
54
54
|
var S_HiddenCover_1 = require("../components/S_HiddenCover");
|
|
55
55
|
var useCLINK_1 = __importDefault(require("../hooks/useCLINK"));
|
|
56
|
+
var Shape_1 = __importDefault(require("./Shape"));
|
|
56
57
|
function Image(props) {
|
|
57
58
|
var _a = (0, react_1.useContext)(DynamicLayout_1.dynamicLayoutContext), device = _a.device, mode = _a.mode;
|
|
58
59
|
var queryContext = (0, compositionQueryContext_1.useCCBQueryPath)();
|
|
@@ -133,7 +134,7 @@ function Image(props) {
|
|
|
133
134
|
}
|
|
134
135
|
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
|
|
135
136
|
};
|
|
136
|
-
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 }, { children: (0, jsx_runtime_1.jsx)(S_ImageWrapper, __assign({ style: __assign({}, effectCssProperties) }, { children: (0, jsx_runtime_1.jsxs)(S_CB_BoxWithShadow_1.S_CB_BoxWithShadow, __assign({ className: "cb-layout-box", normalStyle: __assign(__assign(__assign(__assign({}, layout), { overflow: 'hidden' }), boxStyle.normal), { cursor: CLINKCursor }), hoverStyle: __assign({}, boxStyle.hover), cbStylePropsShadowSpecs: CB_STYLE_PROP_SHADOW, device: device, onClick: onClickCLINK }, { children: [(0, jsx_runtime_1.jsx)(
|
|
137
|
+
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 }, { children: (0, jsx_runtime_1.jsx)(S_ImageWrapper, __assign({ style: __assign({}, effectCssProperties) }, { children: (0, jsx_runtime_1.jsxs)(S_CB_BoxWithShadow_1.S_CB_BoxWithShadow, __assign({ className: "cb-layout-box", normalStyle: __assign(__assign(__assign(__assign({}, layout), { overflow: 'hidden' }), boxStyle.normal), { cursor: CLINKCursor }), hoverStyle: __assign({}, boxStyle.hover), cbStylePropsShadowSpecs: CB_STYLE_PROP_SHADOW, device: device, onClick: onClickCLINK }, { children: [(0, jsx_runtime_1.jsx)(Shape_1.default, { shape: "TRIANGLE", src: imgSrc() === 'ERROR'
|
|
137
138
|
? 'https://static.publ.site/pages-sample/img_cb_style_prop_bgmedia_spec_imageselector_01.png'
|
|
138
139
|
: imgSrc(), normalStyle: __assign({}, imgStyle.normal), hoverStyle: __assign({}, imgStyle.hover) }), showDataNotFound()] })) })) }))] }));
|
|
139
140
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CSSProperties } from 'styled-components';
|
|
3
|
+
declare const SHAPE_PATHS: {
|
|
4
|
+
CIRCLE: string;
|
|
5
|
+
SQUARE: string;
|
|
6
|
+
ROUNDED_SQUARE: string;
|
|
7
|
+
ARCH: string;
|
|
8
|
+
UPSIDE_DOWN_ARCH: string;
|
|
9
|
+
PILL: string;
|
|
10
|
+
Oval: string;
|
|
11
|
+
TRIANGLE: string;
|
|
12
|
+
DIAMOND: string;
|
|
13
|
+
PENTAGON: string;
|
|
14
|
+
HEXAGON: string;
|
|
15
|
+
OCTAGON: string;
|
|
16
|
+
STAR_4: string;
|
|
17
|
+
STAR_5: string;
|
|
18
|
+
STAR_8: string;
|
|
19
|
+
BURST: string;
|
|
20
|
+
BLOB_1: string;
|
|
21
|
+
BLOB_2: string;
|
|
22
|
+
LEAF: string;
|
|
23
|
+
SHIELD: string;
|
|
24
|
+
TICKET: string;
|
|
25
|
+
TRAPEZOID: string;
|
|
26
|
+
PARALLELOGRAM: string;
|
|
27
|
+
RHOMBUS: string;
|
|
28
|
+
};
|
|
29
|
+
export type ShapeType = keyof typeof SHAPE_PATHS;
|
|
30
|
+
interface ShapeImageProps {
|
|
31
|
+
src: string;
|
|
32
|
+
shape?: ShapeType;
|
|
33
|
+
normalStyle: CSSProperties;
|
|
34
|
+
hoverStyle: CSSProperties;
|
|
35
|
+
focalPoint?: {
|
|
36
|
+
x: number;
|
|
37
|
+
y: number;
|
|
38
|
+
};
|
|
39
|
+
className?: string;
|
|
40
|
+
}
|
|
41
|
+
declare const ShapeImage: React.FC<ShapeImageProps>;
|
|
42
|
+
export default ShapeImage;
|
|
@@ -0,0 +1,113 @@
|
|
|
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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
18
|
+
if (k2 === undefined) k2 = k;
|
|
19
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
20
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
21
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
22
|
+
}
|
|
23
|
+
Object.defineProperty(o, k2, desc);
|
|
24
|
+
}) : (function(o, m, k, k2) {
|
|
25
|
+
if (k2 === undefined) k2 = k;
|
|
26
|
+
o[k2] = m[k];
|
|
27
|
+
}));
|
|
28
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
29
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
30
|
+
}) : function(o, v) {
|
|
31
|
+
o["default"] = v;
|
|
32
|
+
});
|
|
33
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
42
|
+
var react_1 = require("react");
|
|
43
|
+
var styled_components_1 = __importStar(require("styled-components"));
|
|
44
|
+
// 1. Squarespace Fluid Engine의 모든 핵심 Shape Paths
|
|
45
|
+
var SHAPE_PATHS = {
|
|
46
|
+
// 기본 도형
|
|
47
|
+
CIRCLE: 'M50,0A50,50,0,1,1,50,100A50,50,0,1,1,50,0',
|
|
48
|
+
SQUARE: 'M0,0 L100,0 L100,100 L0,100 Z',
|
|
49
|
+
ROUNDED_SQUARE: 'M0,20 Q0,0 20,0 L80,0 Q100,0 100,20 L100,80 Q100,100 80,100 L20,100 Q0,100 0,80 Z',
|
|
50
|
+
// 아치 및 타원형
|
|
51
|
+
ARCH: 'M0,100 L0,50 C0,22.4 22.4,0 50,0 C77.6,0 100,22.4 100,50 L100,100 Z',
|
|
52
|
+
UPSIDE_DOWN_ARCH: 'M100,0 L100,50 C100,77.6 77.6,100 50,100 C22.4,100 0,77.6 0,50 L0,0 Z',
|
|
53
|
+
PILL: 'M0,50 C0,22.4 22.4,0 50,0 L50,0 C77.6,0 100,22.4 100,50 L100,50 C100,77.6 77.6,100 50,100 L50,100 C22.4,100 0,77.6 0,50 Z',
|
|
54
|
+
Oval: 'M50,0C22.4,0,0,22.4,0,50s22.4,50,50,50s50-22.4,50-50S77.6,0,50,0z',
|
|
55
|
+
// 다각형
|
|
56
|
+
TRIANGLE: 'M50,0 L100,100 L0,100 Z',
|
|
57
|
+
DIAMOND: 'M50,0 L100,50 L50,100 L0,50 Z',
|
|
58
|
+
PENTAGON: 'M50,0 L100,38 L81,100 L19,100 L0,38 Z',
|
|
59
|
+
HEXAGON: 'M25,0 L75,0 L100,50 L75,100 L25,100 L0,50 Z',
|
|
60
|
+
OCTAGON: 'M30,0 L70,0 L100,30 L100,70 L70,100 L30,100 L0,70 L0,30 Z',
|
|
61
|
+
// 별 및 배지
|
|
62
|
+
STAR_4: 'M50,0 L60,40 L100,50 L60,60 L50,100 L40,60 L0,50 L40,40 Z',
|
|
63
|
+
STAR_5: 'M50,0 L61,35 L98,35 L68,57 L79,91 L50,70 L21,91 L32,57 L2,35 L39,35 Z',
|
|
64
|
+
STAR_8: 'M50,0 L58,33 L85,15 L75,45 L100,50 L75,55 L85,85 L58,67 L50,100 L42,67 L15,85 L25,55 L0,50 L25,45 L15,15 L42,33 Z',
|
|
65
|
+
BURST: 'M50,0 L60,10 L80,0 L80,20 L100,20 L90,40 L100,60 L80,60 L80,80 L60,70 L50,80 L40,70 L20,80 L20,60 L0,60 L10,40 L0,20 L20,20 L20,0 L40,10 Z',
|
|
66
|
+
// 유기적 / 특수 형태
|
|
67
|
+
BLOB_1: 'M85,30 C95,50 85,80 60,90 C35,100 10,80 5,50 C0,20 30,0 60,5 C80,10 75,10 85,30 Z',
|
|
68
|
+
BLOB_2: 'M90,40 C100,60 80,90 50,95 C20,100 0,80 0,50 C0,20 30,0 60,0 C80,0 80,20 90,40 Z',
|
|
69
|
+
LEAF: 'M0,100 C0,100 0,0 100,0 C100,0 100,100 0,100 Z',
|
|
70
|
+
SHIELD: 'M0,0 L100,0 L100,60 C100,85 50,100 50,100 C50,100 0,85 0,60 Z',
|
|
71
|
+
TICKET: 'M0,20 Q0,0 20,0 L80,0 Q100,0 100,20 L100,40 Q85,50 100,60 L100,80 Q100,100 80,100 L20,100 Q0,100 0,80 L0,60 Q15,50 0,40 Z',
|
|
72
|
+
TRAPEZOID: 'M20,0 L80,0 L100,100 L0,100 Z',
|
|
73
|
+
PARALLELOGRAM: 'M20,0 L100,0 L80,100 L0,100 Z',
|
|
74
|
+
RHOMBUS: 'M30,0 L100,0 L70,100 L0,100 Z'
|
|
75
|
+
};
|
|
76
|
+
// 기존 스타일드 컴포넌트 로직 유지
|
|
77
|
+
var S_ImageContainer = styled_components_1.default.div(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n position: relative;\n height: 100%;\n width: 100%;\n overflow: hidden;\n\n ", ";\n\n & img {\n width: 100%;\n height: 100%;\n transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);\n\n // \uC170\uC774\uD504\uAC00 \uC788\uC744 \uB54C\uB9CC clip-path \uC801\uC6A9\n ", "\n\n ", ";\n }\n\n &:hover {\n ", ";\n }\n\n &:hover img {\n ", ";\n }\n"], ["\n position: relative;\n height: 100%;\n width: 100%;\n overflow: hidden;\n\n ", ";\n\n & img {\n width: 100%;\n height: 100%;\n transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);\n\n // \uC170\uC774\uD504\uAC00 \uC788\uC744 \uB54C\uB9CC clip-path \uC801\uC6A9\n ", "\n\n ", ";\n }\n\n &:hover {\n ", ";\n }\n\n &:hover img {\n ", ";\n }\n"])), function (_a) {
|
|
78
|
+
var normalStyle = _a.normalStyle;
|
|
79
|
+
return (0, styled_components_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n "], ["\n ", "\n "])), normalStyle);
|
|
80
|
+
}, function (_a) {
|
|
81
|
+
var hasShape = _a.hasShape, maskId = _a.maskId;
|
|
82
|
+
return hasShape && (0, styled_components_1.css)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n -webkit-clip-path: url(#", ");\n clip-path: url(#", ");\n "], ["\n -webkit-clip-path: url(#", ");\n clip-path: url(#", ");\n "])), maskId, maskId);
|
|
83
|
+
}, function (_a) {
|
|
84
|
+
var normalStyle = _a.normalStyle;
|
|
85
|
+
var isContain = normalStyle.backgroundSize === 'contain';
|
|
86
|
+
return (0, styled_components_1.css)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n object-fit: ", ";\n "], ["\n object-fit: ", ";\n "])), isContain ? 'contain' : 'cover');
|
|
87
|
+
}, function (_a) {
|
|
88
|
+
var hoverStyle = _a.hoverStyle;
|
|
89
|
+
return (0, styled_components_1.css)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n ", "\n "], ["\n ", "\n "])), hoverStyle);
|
|
90
|
+
}, function (_a) {
|
|
91
|
+
var hoverStyle = _a.hoverStyle, normalStyle = _a.normalStyle;
|
|
92
|
+
var isContain = hoverStyle.backgroundSize
|
|
93
|
+
? hoverStyle.backgroundSize === 'contain'
|
|
94
|
+
: normalStyle.backgroundSize === 'contain';
|
|
95
|
+
return (0, styled_components_1.css)(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n object-fit: ", ";\n "], ["\n object-fit: ", ";\n "])), isContain ? 'contain' : 'cover');
|
|
96
|
+
});
|
|
97
|
+
var S_ShapeSelect = styled_components_1.default.div(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n position: absolute;\n right: 8px;\n top: 8px;\n z-index: 2;\n\n select {\n appearance: none;\n background: rgba(0, 0, 0, 0.6);\n border: 1px solid rgba(255, 255, 255, 0.4);\n border-radius: 6px;\n color: #fff;\n font-size: 12px;\n outline: none;\n padding: 4px 8px;\n }\n"], ["\n position: absolute;\n right: 8px;\n top: 8px;\n z-index: 2;\n\n select {\n appearance: none;\n background: rgba(0, 0, 0, 0.6);\n border: 1px solid rgba(255, 255, 255, 0.4);\n border-radius: 6px;\n color: #fff;\n font-size: 12px;\n outline: none;\n padding: 4px 8px;\n }\n"])));
|
|
98
|
+
var ShapeImage = function (_a) {
|
|
99
|
+
var src = _a.src, shape = _a.shape, normalStyle = _a.normalStyle, hoverStyle = _a.hoverStyle, _b = _a.focalPoint, focalPoint = _b === void 0 ? { x: 0.5, y: 0.5 } : _b, className = _a.className;
|
|
100
|
+
// 컴포넌트 인스턴스마다 고유한 마스크 ID 생성
|
|
101
|
+
var maskId = (0, react_1.useMemo)(function () { return "sqs-mask-".concat(Math.random().toString(36).substr(2, 9)); }, []);
|
|
102
|
+
var _c = (0, react_1.useState)(shape !== null && shape !== void 0 ? shape : ''), selectedShape = _c[0], setSelectedShape = _c[1];
|
|
103
|
+
(0, react_1.useEffect)(function () {
|
|
104
|
+
setSelectedShape(shape !== null && shape !== void 0 ? shape : '');
|
|
105
|
+
}, [shape]);
|
|
106
|
+
var effectiveShape = selectedShape || undefined;
|
|
107
|
+
var shapeOptions = Object.keys(SHAPE_PATHS);
|
|
108
|
+
return ((0, jsx_runtime_1.jsxs)(S_ImageContainer, __assign({ normalStyle: normalStyle, hoverStyle: hoverStyle, maskId: maskId, hasShape: !!effectiveShape, className: className }, { children: [(0, jsx_runtime_1.jsx)(S_ShapeSelect, { children: (0, jsx_runtime_1.jsxs)("select", __assign({ value: selectedShape, onChange: function (event) { return setSelectedShape(event.target.value); } }, { children: [(0, jsx_runtime_1.jsx)("option", __assign({ value: "" }, { children: "None" })), shapeOptions.map(function (option) { return ((0, jsx_runtime_1.jsx)("option", __assign({ value: option }, { children: option }), option)); })] })) }), effectiveShape && ((0, jsx_runtime_1.jsx)("svg", __assign({ width: "0", height: "0", style: { position: 'absolute' } }, { children: (0, jsx_runtime_1.jsx)("defs", { children: (0, jsx_runtime_1.jsx)("clipPath", __assign({ id: maskId, clipPathUnits: "objectBoundingBox" }, { children: (0, jsx_runtime_1.jsx)("path", { d: SHAPE_PATHS[effectiveShape], transform: "scale(0.01)" }) })) }) }))), (0, jsx_runtime_1.jsx)("img", { src: src, alt: "content", style: {
|
|
109
|
+
objectPosition: "".concat(focalPoint.x * 100, "% ").concat(focalPoint.y * 100, "%")
|
|
110
|
+
} })] })));
|
|
111
|
+
};
|
|
112
|
+
exports.default = ShapeImage;
|
|
113
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7;
|
package/package.json
CHANGED
package/release-note.md
CHANGED