pds-dev-kit-web-test 0.2.45 → 0.2.46
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/mock_samplePage.js +1 -1
- package/dist/src/sub/DynamicLayout/pagesPreviewMock.d.ts +1 -1
- package/dist/src/sub/DynamicLayout/pagesPreviewMock.js +3 -3
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Text/Text.js +4 -0
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Text/getGoogleFonts.d.ts +2 -0
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Text/getGoogleFonts.js +13 -0
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Text/useGoogleFonts.d.ts +4 -0
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Text/useGoogleFonts.js +123 -0
- package/dist/src/sub/DynamicLayout/sections/CustomSection/newUtils/textUtil.d.ts +3 -2
- package/dist/src/sub/DynamicLayout/sections/CustomSection/newUtils/textUtil.js +5 -2
- package/package.json +1 -1
- package/release-note.md +6 -8
- package/webhook/node_modules/esrecurse/.babelrc +3 -0
|
@@ -2810,7 +2810,7 @@ var realMock = [
|
|
|
2810
2810
|
CB_CONTENT_PROP_HOVER_SPEC_MUSE: true
|
|
2811
2811
|
},
|
|
2812
2812
|
CB_CONTENT_PROP_TEXT: {
|
|
2813
|
-
CB_CONTENT_PROP_TEXT_SPEC_TEXT: 'New
|
|
2813
|
+
CB_CONTENT_PROP_TEXT_SPEC_TEXT: 'New Text2222'
|
|
2814
2814
|
},
|
|
2815
2815
|
CB_CONTENT_PROP_VISIBILITY: {
|
|
2816
2816
|
CB_CONTENT_PROP_VISIBILITY_SPEC_DESKTOP: true,
|
|
@@ -98,7 +98,7 @@ export declare const pages0803PreviewSections: {
|
|
|
98
98
|
'CB_STYLE_PROP_TEXT_SPEC_SIZE:MOBILE': null;
|
|
99
99
|
'CB_STYLE_PROP_TEXT_SPEC_SIZE:MOBILE:HOVER': null;
|
|
100
100
|
CB_STYLE_PROP_TEXT_SPEC_TYPEFACE: string;
|
|
101
|
-
'CB_STYLE_PROP_TEXT_SPEC_TYPEFACE:HOVER':
|
|
101
|
+
'CB_STYLE_PROP_TEXT_SPEC_TYPEFACE:HOVER': string;
|
|
102
102
|
'CB_STYLE_PROP_TEXT_SPEC_TYPEFACE:MOBILE': null;
|
|
103
103
|
'CB_STYLE_PROP_TEXT_SPEC_TYPEFACE:MOBILE:HOVER': null;
|
|
104
104
|
CB_STYLE_PROP_TEXT_SPEC_VERTICAL: string;
|
|
@@ -26,7 +26,7 @@ exports.pages0803PreviewSections = [
|
|
|
26
26
|
CB_CONTENT_PROP_HOVER_SPEC_MUSE: true
|
|
27
27
|
},
|
|
28
28
|
CB_CONTENT_PROP_TEXT: {
|
|
29
|
-
CB_CONTENT_PROP_TEXT_SPEC_TEXT: 'New
|
|
29
|
+
CB_CONTENT_PROP_TEXT_SPEC_TEXT: 'New Text3333'
|
|
30
30
|
},
|
|
31
31
|
CB_CONTENT_PROP_VISIBILITY: {
|
|
32
32
|
CB_CONTENT_PROP_VISIBILITY_SPEC_DESKTOP: true,
|
|
@@ -102,8 +102,8 @@ exports.pages0803PreviewSections = [
|
|
|
102
102
|
'CB_STYLE_PROP_TEXT_SPEC_SIZE:HOVER': null,
|
|
103
103
|
'CB_STYLE_PROP_TEXT_SPEC_SIZE:MOBILE': null,
|
|
104
104
|
'CB_STYLE_PROP_TEXT_SPEC_SIZE:MOBILE:HOVER': null,
|
|
105
|
-
CB_STYLE_PROP_TEXT_SPEC_TYPEFACE: '
|
|
106
|
-
'CB_STYLE_PROP_TEXT_SPEC_TYPEFACE:HOVER':
|
|
105
|
+
CB_STYLE_PROP_TEXT_SPEC_TYPEFACE: 'GOOGLE:Dokdo',
|
|
106
|
+
'CB_STYLE_PROP_TEXT_SPEC_TYPEFACE:HOVER': 'GOOGLE:Lobster',
|
|
107
107
|
'CB_STYLE_PROP_TEXT_SPEC_TYPEFACE:MOBILE': null,
|
|
108
108
|
'CB_STYLE_PROP_TEXT_SPEC_TYPEFACE:MOBILE:HOVER': null,
|
|
109
109
|
CB_STYLE_PROP_TEXT_SPEC_VERTICAL: 'MIDDLE',
|
|
@@ -25,6 +25,8 @@ var S_CB_AnimationObserverBox_1 = require("../components/S_CB_AnimationObserverB
|
|
|
25
25
|
var S_CB_Box_1 = require("../components/S_CB_Box");
|
|
26
26
|
var S_HiddenCover_1 = require("../components/S_HiddenCover");
|
|
27
27
|
var useCLINK_1 = __importDefault(require("../hooks/useCLINK"));
|
|
28
|
+
var getGoogleFonts_1 = __importDefault(require("./getGoogleFonts"));
|
|
29
|
+
var useGoogleFonts_1 = __importDefault(require("./useGoogleFonts"));
|
|
28
30
|
function Text(props) {
|
|
29
31
|
var _a = (0, react_1.useContext)(DynamicLayout_1.dynamicLayoutContext), device = _a.device, mode = _a.mode;
|
|
30
32
|
var _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;
|
|
@@ -37,6 +39,8 @@ function Text(props) {
|
|
|
37
39
|
var _d = getTextStyles(props.CB_STYLE_PROP_TEXT, device), textStyle = _d.style, textHoverStyle = _d.hoverStyle;
|
|
38
40
|
var _e = (0, util_1.parseProperties)(props, device), propsStyle = _e.style, propsHoverStyle = _e.hoverStyle, layoutStyle = _e.layout, effect = _e.effect;
|
|
39
41
|
var isEditModeAndHidden = propsStyle.visibility === 'hidden' && mode === 'EDIT';
|
|
42
|
+
var googleFonts = (0, getGoogleFonts_1.default)(props.CB_STYLE_PROP_TEXT, device === 'MOBILE');
|
|
43
|
+
(0, useGoogleFonts_1.default)({ fonts: googleFonts });
|
|
40
44
|
if (mode === 'EDIT') {
|
|
41
45
|
propsStyle.visibility = 'visible';
|
|
42
46
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
function getGoogleFonts(props, isMobile) {
|
|
4
|
+
var typeface = props.CB_STYLE_PROP_TEXT_SPEC_TYPEFACE;
|
|
5
|
+
var typefaceHover = props['CB_STYLE_PROP_TEXT_SPEC_TYPEFACE:HOVER'];
|
|
6
|
+
var typefaceMobile = props['CB_STYLE_PROP_TEXT_SPEC_TYPEFACE:MOBILE'];
|
|
7
|
+
var typefaceMobileHover = props['CB_STYLE_PROP_TEXT_SPEC_TYPEFACE:MOBILE:HOVER'];
|
|
8
|
+
if (isMobile) {
|
|
9
|
+
return [typefaceMobile, typefaceMobileHover].filter(function (each) { return each && each.startsWith('GOOGLE:'); });
|
|
10
|
+
}
|
|
11
|
+
return [typeface, typefaceHover].filter(function (each) { return each && each.startsWith('GOOGLE:'); });
|
|
12
|
+
}
|
|
13
|
+
exports.default = getGoogleFonts;
|
|
@@ -0,0 +1,123 @@
|
|
|
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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
+
function step(op) {
|
|
27
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
+
switch (op[0]) {
|
|
32
|
+
case 0: case 1: t = op; break;
|
|
33
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
+
default:
|
|
37
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
+
if (t[2]) _.ops.pop();
|
|
42
|
+
_.trys.pop(); continue;
|
|
43
|
+
}
|
|
44
|
+
op = body.call(thisArg, _);
|
|
45
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
50
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
|
+
};
|
|
52
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
|
+
var react_1 = require("react");
|
|
54
|
+
var getGoogleFontCss_1 = __importDefault(require("../../../../../../../GoogleFontkit/api/getGoogleFontCss"));
|
|
55
|
+
var getGoogleWebFonts_1 = __importDefault(require("../../../../../../../GoogleFontkit/api/getGoogleWebFonts"));
|
|
56
|
+
var createStyleSheet_1 = __importDefault(require("../../../../../../../GoogleFontkit/utils/createStyleSheet"));
|
|
57
|
+
var extractFontStyles_1 = __importDefault(require("../../../../../../../GoogleFontkit/utils/extractFontStyles"));
|
|
58
|
+
var fillStyleSheet_1 = __importDefault(require("../../../../../../../GoogleFontkit/utils/fillStyleSheet"));
|
|
59
|
+
var getFontId_1 = __importDefault(require("../../../../../../../GoogleFontkit/utils/getFontId"));
|
|
60
|
+
var isStyleSheetExists_1 = __importDefault(require("../../../../../../../GoogleFontkit/utils/isStyleSheetExists"));
|
|
61
|
+
var parseFontVariants_1 = __importDefault(require("../../../../../../../GoogleFontkit/utils/parseFontVariants"));
|
|
62
|
+
function useGoogleFonts(_a) {
|
|
63
|
+
var fonts = _a.fonts;
|
|
64
|
+
(0, react_1.useEffect)(function () {
|
|
65
|
+
fonts.forEach(function (fontFamily) {
|
|
66
|
+
var parsedFontFamily = fontFamily.substring(7);
|
|
67
|
+
var fontId = (0, getFontId_1.default)(parsedFontFamily);
|
|
68
|
+
if ((0, isStyleSheetExists_1.default)(fontId)) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
(0, createStyleSheet_1.default)(fontId, false);
|
|
72
|
+
getFonts(parsedFontFamily);
|
|
73
|
+
});
|
|
74
|
+
function getCss(font) {
|
|
75
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
76
|
+
var css, fontStyles;
|
|
77
|
+
return __generator(this, function (_a) {
|
|
78
|
+
switch (_a.label) {
|
|
79
|
+
case 0: return [4 /*yield*/, (0, getGoogleFontCss_1.default)({
|
|
80
|
+
family: "".concat(font.family).concat((0, parseFontVariants_1.default)(font.variants, {
|
|
81
|
+
prefix: ':wght@',
|
|
82
|
+
separator: ';'
|
|
83
|
+
})),
|
|
84
|
+
'font-display': 'swap'
|
|
85
|
+
})];
|
|
86
|
+
case 1:
|
|
87
|
+
css = _a.sent();
|
|
88
|
+
fontStyles = (0, extractFontStyles_1.default)(css);
|
|
89
|
+
(0, fillStyleSheet_1.default)(font.id, fontStyles[font.id]);
|
|
90
|
+
return [2 /*return*/];
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
function getFonts(fontFamily) {
|
|
96
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
97
|
+
var items, googleFonts, e_1;
|
|
98
|
+
return __generator(this, function (_a) {
|
|
99
|
+
switch (_a.label) {
|
|
100
|
+
case 0:
|
|
101
|
+
_a.trys.push([0, 2, , 3]);
|
|
102
|
+
return [4 /*yield*/, (0, getGoogleWebFonts_1.default)({
|
|
103
|
+
key: 'AIzaSyDvOkXcd-jqqD1z1P-RmIBM9RzGpEXRwV0',
|
|
104
|
+
family: fontFamily
|
|
105
|
+
})];
|
|
106
|
+
case 1:
|
|
107
|
+
items = (_a.sent()).items;
|
|
108
|
+
googleFonts = items.map(function (item) { return (__assign(__assign({}, item), { id: (0, getFontId_1.default)(item.family) })); });
|
|
109
|
+
googleFonts.forEach(function (font) { return getCss(font); });
|
|
110
|
+
return [3 /*break*/, 3];
|
|
111
|
+
case 2:
|
|
112
|
+
e_1 = _a.sent();
|
|
113
|
+
// eslint-disable-next-line no-console
|
|
114
|
+
console.error(e_1);
|
|
115
|
+
return [3 /*break*/, 3];
|
|
116
|
+
case 3: return [2 /*return*/];
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
}, [fonts]);
|
|
122
|
+
}
|
|
123
|
+
exports.default = useGoogleFonts;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { Device } from '../util/types';
|
|
2
|
+
import type { CSSProperties } from 'styled-components';
|
|
2
3
|
export declare function parseStyleTextToCSSProp<T>({ availableSpecCodes, props, propKey, device }: ParseStyleTextProps<T>): {
|
|
3
|
-
style:
|
|
4
|
-
hoverStyle:
|
|
4
|
+
style: CSSProperties;
|
|
5
|
+
hoverStyle: CSSProperties;
|
|
5
6
|
};
|
|
6
7
|
type ParseStyleTextProps<T> = {
|
|
7
8
|
availableSpecCodes: Array<keyof T>;
|
|
@@ -173,8 +173,11 @@ function getFontName(value) {
|
|
|
173
173
|
return 'serif';
|
|
174
174
|
case 'PRETENDARD':
|
|
175
175
|
return 'Pretendard JP, sans-serif';
|
|
176
|
-
default:
|
|
177
|
-
|
|
176
|
+
default: {
|
|
177
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
178
|
+
var _a = value.split(':'), _1 = _a[0], font = _a[1];
|
|
179
|
+
return "".concat(font);
|
|
180
|
+
}
|
|
178
181
|
}
|
|
179
182
|
}
|
|
180
183
|
function getHorizontalPositionValue(value) {
|
package/package.json
CHANGED
package/release-note.md
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
#
|
|
2
|
-
## [
|
|
3
|
-
##
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*
|
|
7
|
-
* ic_typeface_system(fill, line) 추가
|
|
8
|
-
* ic_logo_google(fill, line) 추가
|
|
1
|
+
# pds-dev-kit-web-test Release Notes
|
|
2
|
+
## [v0.2.46]
|
|
3
|
+
## 기준 pds-dev-kit-web 버전 @2.2.10
|
|
4
|
+
### sub
|
|
5
|
+
* DynamicLayout - custom section
|
|
6
|
+
* TEXT CB에 구글 폰트를 열어줌
|