pds-dev-kit-web-test 0.2.50 → 0.2.53

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.
@@ -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, config }: DynamicLayoutProps): JSX.Element;
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, config = _a.config;
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,8 +4,5 @@ exports.dynamicLayoutContext = void 0;
4
4
  var react_1 = require("react");
5
5
  exports.dynamicLayoutContext = (0, react_1.createContext)({
6
6
  device: 'DESKTOP',
7
- mode: 'NORMAL',
8
- config: {
9
- googleFontsApiKey: ''
10
- }
7
+ mode: 'NORMAL'
11
8
  });
@@ -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)(googleFontsApiKey, parsedFontFamily);
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)(GOOGLE_FONT_API_KEY, font);
25
+ (0, callGoogleFontCSSAndApply_1.default)(font);
27
26
  (0, getGoogleFontDefaultText_1.default)(font).then(function (data) {
28
27
  setDefaultText(data.sampleText.tester);
29
28
  });
@@ -50,6 +50,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
50
50
  return (mod && mod.__esModule) ? mod : { "default": mod };
51
51
  };
52
52
  Object.defineProperty(exports, "__esModule", { value: true });
53
+ /* eslint-disable no-console */
53
54
  var react_1 = require("react");
54
55
  var getGoogleWebFonts_1 = __importDefault(require("../api/getGoogleWebFonts"));
55
56
  var getFontId_1 = __importDefault(require("../utils/getFontId"));
@@ -96,21 +97,26 @@ function GoogleFontsList(_a) {
96
97
  (0, react_1.useEffect)(function () {
97
98
  function getFilteredFontsAsync() {
98
99
  return new Promise(function (resolve) {
99
- var filteredFonts = fonts.filter(function (font) {
100
- var categories = filterOptions.categories, searchQuery = filterOptions.searchQuery, subsets = filterOptions.subsets;
101
- var isSelectedCategory = categories.includes(font.category);
102
- var query = searchQuery.toLocaleLowerCase().trim();
103
- var matchSearchQuery = font.family.toLocaleLowerCase().includes(query);
104
- if (!matchSearchQuery) {
100
+ console.log('filter start (1)');
101
+ setTimeout(function () {
102
+ var filteredFonts = fonts.filter(function (font) {
103
+ var categories = filterOptions.categories, searchQuery = filterOptions.searchQuery, subsets = filterOptions.subsets;
104
+ var isSelectedCategory = categories.includes(font.category);
105
+ var query = searchQuery.toLocaleLowerCase().trim();
106
+ var matchSearchQuery = font.family.toLocaleLowerCase().includes(query);
107
+ if (!matchSearchQuery) {
108
+ return false;
109
+ }
110
+ var hasSomeScript = subsets.length > 0 ? font.subsets.some(function (subset) { return subsets.includes(subset); }) : true;
111
+ if (isSelectedCategory && hasSomeScript) {
112
+ return true;
113
+ }
105
114
  return false;
106
- }
107
- var hasSomeScript = subsets.length > 0 ? font.subsets.some(function (subset) { return subsets.includes(subset); }) : true;
108
- if (isSelectedCategory && hasSomeScript) {
109
- return true;
110
- }
111
- return false;
112
- });
113
- resolve(filteredFonts);
115
+ });
116
+ resolve(filteredFonts);
117
+ console.log('filter resolved (3)');
118
+ }, 0);
119
+ console.log('after filter (2)');
114
120
  });
115
121
  }
116
122
  setIsLoading(true);
@@ -36,7 +36,7 @@ export type FilterOptionHandlerArgType = {
36
36
  name: 'subsets';
37
37
  value: Subset[];
38
38
  };
39
- export type ChangeFilterOptionHandler = (arg: FilterOptionHandlerArgType) => void;
39
+ export type ChangeFilterOptionHandler = (arg: FilterOptionHandlerArgType, setLoading?: boolean) => void;
40
40
  export type FilterOptionType = {
41
41
  searchQuery: string;
42
42
  categories: Category[];
@@ -1,2 +1,2 @@
1
- declare function callGoogleFontCSSAndApply(key: string, fontFamily: string): Promise<void>;
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
- var parseFontVariants_1 = __importDefault(require("./parseFontVariants"));
50
- function callGoogleFontCSSAndApply(key, fontFamily) {
48
+ function callGoogleFontCSSAndApply(fontFamily) {
51
49
  return __awaiter(this, void 0, void 0, function () {
52
- var items, font, css, fontStyles;
50
+ var fontId, css, fontStyles;
53
51
  return __generator(this, function (_a) {
54
52
  switch (_a.label) {
55
- case 0: return [4 /*yield*/, (0, getGoogleWebFonts_1.default)({
56
- key: key,
57
- family: fontFamily
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)(font.id, false);
58
+ (0, createStyleSheet_1.default)(fontId, false);
67
59
  return [4 /*yield*/, (0, getGoogleFontCss_1.default)({
68
- family: "".concat(font.family).concat((0, parseFontVariants_1.default)(font.variants, {
69
- prefix: ':wght@',
70
- separator: ';'
71
- })),
60
+ family: "".concat(fontFamily, ":wght@100;200;300;400;500;700;800;900"),
72
61
  'font-display': 'swap'
73
62
  })];
74
- case 2:
63
+ case 1:
75
64
  css = _a.sent();
76
65
  fontStyles = (0, extractFontStyles_1.default)(css);
77
- (0, fillStyleSheet_1.default)(font.id, fontStyles[font.id]);
66
+ (0, fillStyleSheet_1.default)(fontId, fontStyles[fontId]);
78
67
  return [2 /*return*/];
79
68
  }
80
69
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pds-dev-kit-web-test",
3
- "version": "0.2.50",
3
+ "version": "0.2.53",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "main": "dist/index.js",
package/release-note.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # pds-dev-kit-web-test Release Notes
2
- ## [v0.2.50]
2
+ ## [v0.2.53]
3
3
  ## 기준 pds-dev-kit-web 버전 @2.2.10
4
4
  ### sub
5
5
  * GoogleFontKit
6
- * DL에 API-KEY를 받도록 추가
6
+ * font weight 400 추가
7
7
  * 성능 개선 시도