pds-dev-kit-web-test 0.2.50 → 0.2.52
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/DynamicLayout.d.ts +1 -1
- package/dist/src/sub/DynamicLayout/DynamicLayout.js +2 -3
- package/dist/src/sub/DynamicLayout/dynamicLayoutContext.js +1 -4
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Text/useGoogleFonts.js +1 -3
- package/dist/src/sub/DynamicLayout/types.d.ts +0 -3
- package/dist/src/sub/GoogleFontkit/GoogleFontApplyExample.js +1 -2
- package/dist/src/sub/GoogleFontkit/utils/callGoogleFontCSSAndApply.d.ts +1 -1
- package/dist/src/sub/GoogleFontkit/utils/callGoogleFontCSSAndApply.js +9 -20
- package/package.json +1 -1
- package/release-note.md +2 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { DynamicLayoutProps } from './types';
|
|
3
|
-
declare function DynamicLayout({ device, mode, isPreview, sections, scrollDownTargetSectionId, editingSectionId, navigationHandler, sectionActionHandler, onClickEditSection, programmedSectionComponents
|
|
3
|
+
declare function DynamicLayout({ device, mode, isPreview, sections, scrollDownTargetSectionId, editingSectionId, navigationHandler, sectionActionHandler, onClickEditSection, programmedSectionComponents }: DynamicLayoutProps): JSX.Element;
|
|
4
4
|
export default DynamicLayout;
|
|
@@ -25,7 +25,7 @@ var EditModeSectionMatcher_1 = require("./components/EditModeSectionMatcher");
|
|
|
25
25
|
var SectionMatcher_1 = require("./components/SectionMatcher");
|
|
26
26
|
var dynamicLayoutContext_1 = require("./dynamicLayoutContext");
|
|
27
27
|
function DynamicLayout(_a) {
|
|
28
|
-
var device = _a.device, _b = _a.mode, mode = _b === void 0 ? 'NORMAL' : _b, isPreview = _a.isPreview, sections = _a.sections, scrollDownTargetSectionId = _a.scrollDownTargetSectionId, editingSectionId = _a.editingSectionId, navigationHandler = _a.navigationHandler, sectionActionHandler = _a.sectionActionHandler, onClickEditSection = _a.onClickEditSection, programmedSectionComponents = _a.programmedSectionComponents
|
|
28
|
+
var device = _a.device, _b = _a.mode, mode = _b === void 0 ? 'NORMAL' : _b, isPreview = _a.isPreview, sections = _a.sections, scrollDownTargetSectionId = _a.scrollDownTargetSectionId, editingSectionId = _a.editingSectionId, navigationHandler = _a.navigationHandler, sectionActionHandler = _a.sectionActionHandler, onClickEditSection = _a.onClickEditSection, programmedSectionComponents = _a.programmedSectionComponents;
|
|
29
29
|
var filteredSortedSection = __spreadArray([], sections, true).filter(function (section) { return section.display; })
|
|
30
30
|
.sort(function (a, b) { return a.order - b.order; });
|
|
31
31
|
var iframeSection = filteredSortedSection.find(function (section) { return section.manifest.schema === 'EXP_IFRAME' && section.display; });
|
|
@@ -36,8 +36,7 @@ function DynamicLayout(_a) {
|
|
|
36
36
|
navigationHandler: navigationHandler,
|
|
37
37
|
sectionActionHandler: sectionActionHandler,
|
|
38
38
|
editingSectionId: editingSectionId,
|
|
39
|
-
programmedSectionComponents: programmedSectionComponents
|
|
40
|
-
config: config
|
|
39
|
+
programmedSectionComponents: programmedSectionComponents
|
|
41
40
|
} }, { children: [mode === 'EDIT' && onClickEditSection && ((0, jsx_runtime_1.jsx)(EditModeSectionMatcher_1.EditModeSectionMatcher, { editingSectionId: editingSectionId, scrollDownTargetSectionId: scrollDownTargetSectionId, filteredSortedSection: filteredSortedSection, onClickEditSection: onClickEditSection })), mode !== 'EDIT' &&
|
|
42
41
|
(iframeSection ? ((0, jsx_runtime_1.jsx)(SectionMatcher_1.SectionMatcher, __assign({}, iframeSection), iframeSection.id)) : (filteredSortedSection.map(function (section) { return (0, jsx_runtime_1.jsx)(SectionMatcher_1.SectionMatcher, __assign({}, section), section.id); })))] })));
|
|
43
42
|
}
|
|
@@ -4,15 +4,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
var react_1 = require("react");
|
|
7
|
-
var dynamicLayoutContext_1 = require("../../../../../../../DynamicLayout/dynamicLayoutContext");
|
|
8
7
|
var callGoogleFontCSSAndApply_1 = __importDefault(require("../../../../../../../GoogleFontkit/utils/callGoogleFontCSSAndApply"));
|
|
9
8
|
function useGoogleFonts(_a) {
|
|
10
9
|
var fonts = _a.fonts;
|
|
11
|
-
var googleFontsApiKey = (0, react_1.useContext)(dynamicLayoutContext_1.dynamicLayoutContext).config.googleFontsApiKey;
|
|
12
10
|
(0, react_1.useEffect)(function () {
|
|
13
11
|
fonts.forEach(function (fontFamily) {
|
|
14
12
|
var parsedFontFamily = fontFamily.substring(7);
|
|
15
|
-
(0, callGoogleFontCSSAndApply_1.default)(
|
|
13
|
+
(0, callGoogleFontCSSAndApply_1.default)(parsedFontFamily);
|
|
16
14
|
});
|
|
17
15
|
}, [fonts]);
|
|
18
16
|
}
|
|
@@ -224,9 +224,6 @@ export type DynamicLayoutProps = {
|
|
|
224
224
|
sectionActionHandler?: (action: TypeOfSectionAction) => void;
|
|
225
225
|
programmedSectionComponents?: IProgrammedSectionComponents;
|
|
226
226
|
width?: number;
|
|
227
|
-
config: {
|
|
228
|
-
googleFontsApiKey: string;
|
|
229
|
-
};
|
|
230
227
|
};
|
|
231
228
|
export type NavHandlerAction = {
|
|
232
229
|
openNewTab: boolean;
|
|
@@ -18,12 +18,11 @@ var jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
18
18
|
var react_1 = require("react");
|
|
19
19
|
var getGoogleFontDefaultText_1 = __importDefault(require("./api/getGoogleFontDefaultText"));
|
|
20
20
|
var callGoogleFontCSSAndApply_1 = __importDefault(require("./utils/callGoogleFontCSSAndApply"));
|
|
21
|
-
var GOOGLE_FONT_API_KEY = 'AIzaSyDvOkXcd-jqqD1z1P-RmIBM9RzGpEXRwV0';
|
|
22
21
|
function TextCB(_a) {
|
|
23
22
|
var text = _a.text, font = _a.font;
|
|
24
23
|
var _b = (0, react_1.useState)(text), defaultText = _b[0], setDefaultText = _b[1];
|
|
25
24
|
(0, react_1.useEffect)(function () {
|
|
26
|
-
(0, callGoogleFontCSSAndApply_1.default)(
|
|
25
|
+
(0, callGoogleFontCSSAndApply_1.default)(font);
|
|
27
26
|
(0, getGoogleFontDefaultText_1.default)(font).then(function (data) {
|
|
28
27
|
setDefaultText(data.sampleText.tester);
|
|
29
28
|
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare function callGoogleFontCSSAndApply(
|
|
1
|
+
declare function callGoogleFontCSSAndApply(fontFamily: string): Promise<void>;
|
|
2
2
|
export default callGoogleFontCSSAndApply;
|
|
@@ -40,41 +40,30 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
40
40
|
};
|
|
41
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
42
|
var getGoogleFontCss_1 = __importDefault(require("../api/getGoogleFontCss"));
|
|
43
|
-
var getGoogleWebFonts_1 = __importDefault(require("../api/getGoogleWebFonts"));
|
|
44
43
|
var createStyleSheet_1 = __importDefault(require("./createStyleSheet"));
|
|
45
44
|
var extractFontStyles_1 = __importDefault(require("./extractFontStyles"));
|
|
46
45
|
var fillStyleSheet_1 = __importDefault(require("./fillStyleSheet"));
|
|
47
46
|
var getFontId_1 = __importDefault(require("./getFontId"));
|
|
48
47
|
var isStyleSheetExists_1 = __importDefault(require("./isStyleSheetExists"));
|
|
49
|
-
|
|
50
|
-
function callGoogleFontCSSAndApply(key, fontFamily) {
|
|
48
|
+
function callGoogleFontCSSAndApply(fontFamily) {
|
|
51
49
|
return __awaiter(this, void 0, void 0, function () {
|
|
52
|
-
var
|
|
50
|
+
var fontId, css, fontStyles;
|
|
53
51
|
return __generator(this, function (_a) {
|
|
54
52
|
switch (_a.label) {
|
|
55
|
-
case 0:
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
})];
|
|
59
|
-
case 1:
|
|
60
|
-
items = (_a.sent()).items;
|
|
61
|
-
font = items[0];
|
|
62
|
-
font.id = (0, getFontId_1.default)(font.family);
|
|
63
|
-
if ((0, isStyleSheetExists_1.default)(font.id)) {
|
|
53
|
+
case 0:
|
|
54
|
+
fontId = (0, getFontId_1.default)(fontFamily);
|
|
55
|
+
if ((0, isStyleSheetExists_1.default)(fontId)) {
|
|
64
56
|
return [2 /*return*/];
|
|
65
57
|
}
|
|
66
|
-
(0, createStyleSheet_1.default)(
|
|
58
|
+
(0, createStyleSheet_1.default)(fontId, false);
|
|
67
59
|
return [4 /*yield*/, (0, getGoogleFontCss_1.default)({
|
|
68
|
-
family: "".concat(
|
|
69
|
-
prefix: ':wght@',
|
|
70
|
-
separator: ';'
|
|
71
|
-
})),
|
|
60
|
+
family: "".concat(fontFamily, ":wght@100;200;300;500;700;800;900"),
|
|
72
61
|
'font-display': 'swap'
|
|
73
62
|
})];
|
|
74
|
-
case
|
|
63
|
+
case 1:
|
|
75
64
|
css = _a.sent();
|
|
76
65
|
fontStyles = (0, extractFontStyles_1.default)(css);
|
|
77
|
-
(0, fillStyleSheet_1.default)(
|
|
66
|
+
(0, fillStyleSheet_1.default)(fontId, fontStyles[fontId]);
|
|
78
67
|
return [2 /*return*/];
|
|
79
68
|
}
|
|
80
69
|
});
|
package/package.json
CHANGED