pds-dev-kit-web-test 2.3.3 → 2.3.5
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/components/SectionMatcher/SectionMatcher.js +1 -7
- package/dist/src/sub/DynamicLayout/pagesPreviewMock.d.ts +403 -4
- package/dist/src/sub/DynamicLayout/pagesPreviewMock.js +585 -585
- package/dist/src/sub/DynamicLayout/sectionActionTypes.d.ts +0 -10
- package/dist/src/sub/DynamicLayout/sections/CustomSection/CustomSection.d.ts +0 -6
- package/dist/src/sub/DynamicLayout/sections/CustomSection/CustomSection.js +64 -77
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/ComponentBlockMatcher.d.ts +1 -2
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/ComponentBlockMatcher.js +3 -3
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Button/Button.js +1 -1
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Text/Text.d.ts +1 -3
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Text/Text.js +1 -60
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/components/S_CB_Box.js +1 -1
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/index.d.ts +1 -1
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/index.js +3 -3
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/index.d.ts +1 -1
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/index.js +2 -2
- package/dist/src/sub/DynamicLayout/sections/CustomSection/newUtils/textUtil.js +1 -12
- package/dist/src/sub/SandollFontKit/constants.d.ts +9 -0
- package/dist/src/sub/SandollFontKit/constants.js +33 -0
- package/dist/src/sub/SandollFontKit/headless/SandollFontItem.d.ts +13 -0
- package/dist/src/sub/SandollFontKit/headless/SandollFontItem.js +93 -0
- package/dist/src/sub/SandollFontKit/headless/SandollFontsList.d.ts +17 -0
- package/dist/src/sub/SandollFontKit/headless/SandollFontsList.js +145 -0
- package/dist/src/sub/SandollFontKit/index.d.ts +4 -0
- package/dist/src/sub/SandollFontKit/index.js +26 -0
- package/dist/src/sub/SandollFontKit/types.d.ts +22 -0
- package/dist/src/sub/SandollFontKit/types.js +2 -0
- package/dist/src/sub/SandollFontKit/utils/delay.d.ts +1 -0
- package/dist/src/sub/SandollFontKit/utils/delay.js +6 -0
- package/package.json +1 -4
- package/dist/src/sub/DynamicLayout/sections/CustomSection/NewCustomSection.d.ts +0 -3
- package/dist/src/sub/DynamicLayout/sections/CustomSection/NewCustomSection.js +0 -70
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Text/index.d.ts +0 -1
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Text/index.js +0 -8
- package/dist/src/sub/DynamicLayout/sections/CustomSection/customSectionContext.d.ts +0 -10
- package/dist/src/sub/DynamicLayout/sections/CustomSection/customSectionContext.js +0 -21
- package/dist/src/sub/DynamicLayout/sections/TempCustomSection/FlexGridItem.d.ts +0 -11
- package/dist/src/sub/DynamicLayout/sections/TempCustomSection/FlexGridItem.js +0 -60
- package/dist/src/sub/DynamicLayout/sections/TempCustomSection/TempCustomSection.d.ts +0 -7
- package/dist/src/sub/DynamicLayout/sections/TempCustomSection/TempCustomSection.js +0 -87
- package/dist/src/sub/DynamicLayout/sections/TempCustomSection/useIsMounted.d.ts +0 -1
- package/dist/src/sub/DynamicLayout/sections/TempCustomSection/useIsMounted.js +0 -15
- package/dist/src/sub/DynamicLayout/sections/TempCustomSection/useResizableObserver.d.ts +0 -12
- package/dist/src/sub/DynamicLayout/sections/TempCustomSection/useResizableObserver.js +0 -74
@@ -5,7 +5,6 @@ type Props = {
|
|
5
5
|
cbProps: ComponentBlock;
|
6
6
|
device: Device;
|
7
7
|
index: number;
|
8
|
-
id: number;
|
9
8
|
};
|
10
|
-
export default function ComponentBlockMatcher({ cbProps, device, index
|
9
|
+
export default function ComponentBlockMatcher({ cbProps, device, index }: Props): JSX.Element;
|
11
10
|
export {};
|
@@ -23,18 +23,18 @@ var Divider_1 = __importDefault(require("./componentBlocks/Divider/Divider"));
|
|
23
23
|
var Embed_1 = __importDefault(require("./componentBlocks/Embed/Embed"));
|
24
24
|
var Image_1 = __importDefault(require("./componentBlocks/Image/Image"));
|
25
25
|
var RichText_1 = require("./componentBlocks/RichText");
|
26
|
-
var Text_1 = require("./componentBlocks/Text");
|
26
|
+
var Text_1 = __importDefault(require("./componentBlocks/Text/Text"));
|
27
27
|
var Twitter_1 = __importDefault(require("./componentBlocks/Twitter/Twitter"));
|
28
28
|
var Youtube_1 = require("./componentBlocks/Youtube");
|
29
29
|
function ComponentBlockMatcher(_a) {
|
30
|
-
var cbProps = _a.cbProps, device = _a.device, index = _a.index
|
30
|
+
var cbProps = _a.cbProps, device = _a.device, index = _a.index;
|
31
31
|
var componentBlockCode = cbProps.componentBlockCode, data = cbProps.jsonProperties.data;
|
32
32
|
var propsWithValue = device === 'MOBILE' ? (0, newUtils_1.replaceUndefinedValues)(data) : data;
|
33
33
|
switch (componentBlockCode) {
|
34
34
|
case types_1.CB_ALL_CODES.CB_BTN:
|
35
35
|
return (0, jsx_runtime_1.jsx)(Button_1.default, __assign({}, propsWithValue, { index: index }));
|
36
36
|
case types_1.CB_ALL_CODES.CB_TEXT:
|
37
|
-
return (0, jsx_runtime_1.jsx)(Text_1.
|
37
|
+
return (0, jsx_runtime_1.jsx)(Text_1.default, __assign({}, propsWithValue, { index: index }));
|
38
38
|
case types_1.CB_ALL_CODES.CB_RICHTEXT:
|
39
39
|
return (0, jsx_runtime_1.jsx)(RichText_1.RichText, __assign({}, propsWithValue, { index: index }));
|
40
40
|
case types_1.CB_ALL_CODES.CB_DIVIDER:
|
@@ -66,7 +66,7 @@ function Button(props) {
|
|
66
66
|
? CB_EFFECT_PROP_ENTANIM.CB_EFFECT_PROP_ENTANIM_SPEC_TYPE === 'NONE'
|
67
67
|
: CB_EFFECT_PROP_ENTANIM['CB_EFFECT_PROP_ENTANIM_SPEC_TYPE:MOBILE'] === 'NONE';
|
68
68
|
var hasEffect = !isNoneEffectType;
|
69
|
-
var effectVisibleStyle = hasEffect ? { opacity: isVisible ? 1 :
|
69
|
+
var effectVisibleStyle = hasEffect ? { opacity: isVisible ? 1 : 0 } : {};
|
70
70
|
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: {
|
71
71
|
paddingLeft: paddingLeft,
|
72
72
|
paddingRight: paddingRight,
|
@@ -1,7 +1,5 @@
|
|
1
1
|
/// <reference types="react" />
|
2
2
|
import type { CB_TEXT_PROPERTIES_TYPE, IndexForIntersection } from '../../../../util/types';
|
3
|
-
type Props = CB_TEXT_PROPERTIES_TYPE & IndexForIntersection
|
4
|
-
id: number;
|
5
|
-
};
|
3
|
+
type Props = CB_TEXT_PROPERTIES_TYPE & IndexForIntersection;
|
6
4
|
declare function Text(props: Props): JSX.Element;
|
7
5
|
export default Text;
|
@@ -17,12 +17,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
18
18
|
/* eslint-disable no-console */
|
19
19
|
/* eslint-disable react/destructuring-assignment */
|
20
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
21
|
-
var lodash_1 = require("lodash");
|
22
20
|
var react_1 = require("react");
|
23
|
-
var react_measure_1 = __importDefault(require("react-measure"));
|
24
21
|
var DynamicLayout_1 = require("../../../../../../../DynamicLayout");
|
25
|
-
var customSectionContext_1 = require("../../../../../../../DynamicLayout/sections/CustomSection/customSectionContext");
|
26
22
|
var hooks_1 = require("../../../../hooks");
|
27
23
|
var getGoogleFonts_1 = require("../../../../hooks/useGoogleFonts/getGoogleFonts");
|
28
24
|
var useGoogleFonts_1 = __importDefault(require("../../../../hooks/useGoogleFonts/useGoogleFonts"));
|
@@ -60,52 +56,7 @@ function Text(props) {
|
|
60
56
|
: CB_EFFECT_PROP_ENTANIM['CB_EFFECT_PROP_ENTANIM_SPEC_TYPE:MOBILE'] === 'NONE';
|
61
57
|
var hasEffect = !isNoneEffectType;
|
62
58
|
var effectVisibleStyle = hasEffect ? { opacity: isVisible ? 1 : 0 } : {};
|
63
|
-
|
64
|
-
var debouncedSectionActionHandler = (0, react_1.useCallback)((0, lodash_1.debounce)(function (payload) {
|
65
|
-
sectionActionHandler &&
|
66
|
-
sectionActionHandler({
|
67
|
-
type: '@CUSTOMSECTION/AUTO_RESIZED_TO_FIT_CONTENT',
|
68
|
-
payload: payload
|
69
|
-
});
|
70
|
-
}, 1000), []);
|
71
|
-
var handleResize = function (contentRect) {
|
72
|
-
var _a, _b;
|
73
|
-
var breakpoint = device === 'DESKTOP' ? 'lg' : 'sm';
|
74
|
-
var scrollHeight = (_a = contentRect.scroll) === null || _a === void 0 ? void 0 : _a.height;
|
75
|
-
var clientHeight = (_b = contentRect.client) === null || _b === void 0 ? void 0 : _b.height;
|
76
|
-
if (!scrollHeight || !clientHeight) {
|
77
|
-
return;
|
78
|
-
}
|
79
|
-
if (clientHeight < scrollHeight) {
|
80
|
-
return;
|
81
|
-
}
|
82
|
-
var id = props.id;
|
83
|
-
// setLayouts((prev) => {
|
84
|
-
// const copy: any = JSON.parse(JSON.stringify(prev));
|
85
|
-
// const targetIndex = copy[breakpoint].findIndex((each: any) => each.i === id.toString());
|
86
|
-
// const newH = Math.ceil((clientHeight + 10) / (10 + rowHeight));
|
87
|
-
// copy[breakpoint][targetIndex].h = newH;
|
88
|
-
// copy[breakpoint][targetIndex].minH = newH;
|
89
|
-
// debouncedSectionActionHandler({
|
90
|
-
// layout: copy[breakpoint],
|
91
|
-
// cb: {
|
92
|
-
// i: id,
|
93
|
-
// h: newH,
|
94
|
-
// w: copy[breakpoint][targetIndex].w,
|
95
|
-
// x: copy[breakpoint][targetIndex].x,
|
96
|
-
// y: copy[breakpoint][targetIndex].y
|
97
|
-
// }
|
98
|
-
// });
|
99
|
-
// // console.log(copy[breakpoint][targetIndex]);
|
100
|
-
// return copy;
|
101
|
-
// });
|
102
|
-
};
|
103
|
-
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)(react_measure_1.default, __assign({ client: true, scroll: true, onResize: handleResize }, { children: function (_a) {
|
104
|
-
var measureRef = _a.measureRef;
|
105
|
-
return ((0, jsx_runtime_1.jsx)("div", __assign({ ref: measureRef }, { children: (0, jsx_runtime_1.jsx)(S_CB_Box_1.S_CB_Box, __assign({ className: "cb-layout-box", normalStyle: __assign(__assign(__assign(__assign(__assign({}, textStyle), propsStyle), layoutStyle), effectCssProperties), {
|
106
|
-
// width: cbRef.current ? calculateCh(cbRef.current, '1rem') : '100%',
|
107
|
-
width: '100%', whiteSpace: 'pre-wrap', wordBreak: 'break-word', cursor: CLINKCursor }), hoverStyle: __assign(__assign(__assign({}, textHoverStyle), propsHoverStyle), { whiteSpace: 'pre-wrap', wordBreak: 'break-word' }), onClick: onClickCLINK }, { children: props.CB_CONTENT_PROP_TEXT.CB_CONTENT_PROP_TEXT_SPEC_TEXT })) })));
|
108
|
-
} })) }))] }));
|
59
|
+
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_CB_Box_1.S_CB_Box, __assign({ className: "cb-layout-box", normalStyle: __assign(__assign(__assign(__assign(__assign({}, textStyle), propsStyle), layoutStyle), effectCssProperties), { whiteSpace: 'pre-wrap', wordBreak: 'break-word', cursor: CLINKCursor }), hoverStyle: __assign(__assign(__assign({}, textHoverStyle), propsHoverStyle), { whiteSpace: 'pre-wrap', wordBreak: 'break-word' }), onClick: onClickCLINK }, { children: props.CB_CONTENT_PROP_TEXT.CB_CONTENT_PROP_TEXT_SPEC_TEXT })) }))] }));
|
109
60
|
}
|
110
61
|
function getTextStyles(props, device) {
|
111
62
|
var availableSpecCodes = [
|
@@ -120,14 +71,4 @@ function getTextStyles(props, device) {
|
|
120
71
|
];
|
121
72
|
return (0, textUtil_1.parseStyleTextToCSSProp)({ availableSpecCodes: availableSpecCodes, props: props, device: device, propKey: 'TEXT' });
|
122
73
|
}
|
123
|
-
function calculateCh(element, fontSize) {
|
124
|
-
var zero = document.createElement('span');
|
125
|
-
zero.innerText = '0';
|
126
|
-
zero.style.position = 'absolute';
|
127
|
-
zero.style.fontSize = fontSize;
|
128
|
-
element.appendChild(zero);
|
129
|
-
var chPixels = zero.getBoundingClientRect().width;
|
130
|
-
element.removeChild(zero);
|
131
|
-
return "".concat(320 / chPixels, "ch");
|
132
|
-
}
|
133
74
|
exports.default = Text;
|
@@ -40,7 +40,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
40
40
|
Object.defineProperty(exports, "__esModule", { value: true });
|
41
41
|
exports.S_CB_Box = void 0;
|
42
42
|
var styled_components_1 = __importStar(require("styled-components"));
|
43
|
-
exports.S_CB_Box = styled_components_1.default.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n /*\n Introduced in IE 10.\n See http://ie.microsoft.com/testdrive/HTML5/msUserSelect/\n */\n\n
|
43
|
+
exports.S_CB_Box = styled_components_1.default.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n /*\n Introduced in IE 10.\n See http://ie.microsoft.com/testdrive/HTML5/msUserSelect/\n */\n\n height: 100%;\n width: 100%;\n\n ", ";\n\n &:hover {\n ", ";\n }\n"], ["\n /*\n Introduced in IE 10.\n See http://ie.microsoft.com/testdrive/HTML5/msUserSelect/\n */\n\n height: 100%;\n width: 100%;\n\n ", ";\n\n &:hover {\n ", ";\n }\n"])), function (_a) {
|
44
44
|
var normalStyle = _a.normalStyle;
|
45
45
|
return (0, styled_components_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n "], ["\n ", "\n "])), __assign(__assign({}, normalStyle), { boxShadow: '' }));
|
46
46
|
}, function (_a) {
|
package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/index.d.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export { default as
|
1
|
+
export { default as ComponentBlock } from './ComponentBlock';
|
package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/index.js
CHANGED
@@ -3,6 +3,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.
|
7
|
-
var
|
8
|
-
Object.defineProperty(exports, "
|
6
|
+
exports.ComponentBlock = void 0;
|
7
|
+
var ComponentBlock_1 = require("./ComponentBlock");
|
8
|
+
Object.defineProperty(exports, "ComponentBlock", { enumerable: true, get: function () { return __importDefault(ComponentBlock_1).default; } });
|
@@ -1 +1 @@
|
|
1
|
-
export {
|
1
|
+
export { ComponentBlock } from './ComponentBlock';
|
@@ -1,5 +1,5 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.ComponentBlock = void 0;
|
4
4
|
var ComponentBlock_1 = require("./ComponentBlock");
|
5
|
-
Object.defineProperty(exports, "
|
5
|
+
Object.defineProperty(exports, "ComponentBlock", { enumerable: true, get: function () { return ComponentBlock_1.ComponentBlock; } });
|
@@ -208,16 +208,5 @@ function getEmFontSize(device, size) {
|
|
208
208
|
if (device === 'DESKTOP') {
|
209
209
|
return "".concat((size / 16).toFixed(3), "em");
|
210
210
|
}
|
211
|
-
|
212
|
-
return value;
|
213
|
-
// return `${(size / 16).toFixed(3)}em`;
|
214
|
-
}
|
215
|
-
function clampBuilder(minWidthPx, maxWidthPx, minFontSize, maxFontSize) {
|
216
|
-
var root = document.querySelector('html');
|
217
|
-
var pixelsPerRem = Number(getComputedStyle(root).fontSize.slice(0, -2));
|
218
|
-
var minWidth = minWidthPx / pixelsPerRem;
|
219
|
-
var maxWidth = maxWidthPx / pixelsPerRem;
|
220
|
-
var slope = (maxFontSize - minFontSize) / (maxWidth - minWidth);
|
221
|
-
var yAxisIntersection = -minWidth * slope + minFontSize;
|
222
|
-
return "clamp( ".concat(minFontSize, "rem, ").concat(yAxisIntersection, "rem + ").concat(slope * 100, "vw, ").concat(maxFontSize, "rem )");
|
211
|
+
return "".concat((size / 16).toFixed(3), "em");
|
223
212
|
}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import type { SANDOLL_Category, SANDOLL_CategoryIconType, SANDOLL_SortOptionType } from './types';
|
2
|
+
export declare const SANDOLL_SORT_OPTIONS: SANDOLL_SortOptionType[];
|
3
|
+
export declare const SANDOLL_DEFAULT_SORT: {
|
4
|
+
text: string;
|
5
|
+
value: SANDOLL_SortOptionType;
|
6
|
+
};
|
7
|
+
export declare const SANDOLL_SORT_OPTION_KEY_MAP: Record<SANDOLL_SortOptionType, string>;
|
8
|
+
export declare const SANDOLL_CATEGORIES: SANDOLL_Category[];
|
9
|
+
export declare const SANDOLL_CATEGORY_ICONS: SANDOLL_CategoryIconType;
|
@@ -0,0 +1,33 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.SANDOLL_CATEGORY_ICONS = exports.SANDOLL_CATEGORIES = exports.SANDOLL_SORT_OPTION_KEY_MAP = exports.SANDOLL_DEFAULT_SORT = exports.SANDOLL_SORT_OPTIONS = void 0;
|
4
|
+
exports.SANDOLL_SORT_OPTIONS = ['date', 'alpha'];
|
5
|
+
exports.SANDOLL_DEFAULT_SORT = {
|
6
|
+
text: 'str_key_seller_scene_x00001pages_dleditor_modal_fontselect_section_sandoll_filter_viewoption_option_latest',
|
7
|
+
value: 'date'
|
8
|
+
};
|
9
|
+
exports.SANDOLL_SORT_OPTION_KEY_MAP = {
|
10
|
+
date: 'str_key_seller_scene_x00001pages_dleditor_modal_fontselect_section_sandoll_filter_viewoption_option_latest',
|
11
|
+
alpha: 'str_key_seller_scene_x00001pages_dleditor_modal_fontselect_section_sandoll_filter_viewoption_option_name'
|
12
|
+
};
|
13
|
+
exports.SANDOLL_CATEGORIES = [
|
14
|
+
'serif',
|
15
|
+
'san-serif',
|
16
|
+
'slab',
|
17
|
+
'blackLetter',
|
18
|
+
'deco',
|
19
|
+
'symbol',
|
20
|
+
'round',
|
21
|
+
'script'
|
22
|
+
];
|
23
|
+
// NOTE: remove as
|
24
|
+
exports.SANDOLL_CATEGORY_ICONS = {
|
25
|
+
serif: 'ic_typeface_sandoll_serif',
|
26
|
+
'san-serif': 'ic_typeface_sandoll_sanserif',
|
27
|
+
slab: 'ic_typeface_sandoll_slab',
|
28
|
+
round: 'ic_typeface_sandoll_round',
|
29
|
+
script: 'ic_typeface_sandoll_script',
|
30
|
+
deco: 'ic_typeface_sandoll_deco',
|
31
|
+
symbol: 'ic_typeface_sandoll_symbol',
|
32
|
+
blackLetter: 'ic_typeface_sandoll_blackletter'
|
33
|
+
};
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { type LegacyRef } from 'react';
|
2
|
+
import type { SANDOLL_Font } from '../types';
|
3
|
+
type HeadlessProps = {
|
4
|
+
isLoading: boolean;
|
5
|
+
isVisible: boolean;
|
6
|
+
ref: LegacyRef<HTMLElement>;
|
7
|
+
};
|
8
|
+
type Props = {
|
9
|
+
font: SANDOLL_Font;
|
10
|
+
children: (args: HeadlessProps) => JSX.Element;
|
11
|
+
};
|
12
|
+
declare function SandollFontItem({ font, children }: Props): JSX.Element;
|
13
|
+
export default SandollFontItem;
|
@@ -0,0 +1,93 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
+
});
|
10
|
+
};
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
15
|
+
function step(op) {
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
18
|
+
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;
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
20
|
+
switch (op[0]) {
|
21
|
+
case 0: case 1: t = op; break;
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
25
|
+
default:
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
30
|
+
if (t[2]) _.ops.pop();
|
31
|
+
_.trys.pop(); continue;
|
32
|
+
}
|
33
|
+
op = body.call(thisArg, _);
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
36
|
+
}
|
37
|
+
};
|
38
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
39
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
40
|
+
};
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
42
|
+
var react_1 = require("react");
|
43
|
+
var GoogleFontkit_1 = require("../../GoogleFontkit");
|
44
|
+
var delay_1 = __importDefault(require("../utils/delay"));
|
45
|
+
function SandollFontItem(_a) {
|
46
|
+
var font = _a.font, children = _a.children;
|
47
|
+
var _b = (0, react_1.useState)(false), isLoading = _b[0], setIsLoading = _b[1];
|
48
|
+
var ref = (0, react_1.useRef)(null);
|
49
|
+
var entry = (0, GoogleFontkit_1.useIntersectionObserver)(ref, {});
|
50
|
+
var isVisible = !!(entry === null || entry === void 0 ? void 0 : entry.isIntersecting);
|
51
|
+
(0, react_1.useEffect)(function () {
|
52
|
+
if (!isVisible) {
|
53
|
+
return;
|
54
|
+
}
|
55
|
+
function getCss() {
|
56
|
+
return __awaiter(this, void 0, void 0, function () {
|
57
|
+
return __generator(this, function (_a) {
|
58
|
+
switch (_a.label) {
|
59
|
+
case 0:
|
60
|
+
setIsLoading(true);
|
61
|
+
return [4 /*yield*/, (0, delay_1.default)(2000)];
|
62
|
+
case 1:
|
63
|
+
_a.sent();
|
64
|
+
// const css = await getGoogleFontCss({
|
65
|
+
// family: `${font.family}${parseVariants(font.variants, {
|
66
|
+
// prefix: ':wght@',
|
67
|
+
// separator: ';'
|
68
|
+
// })}`,
|
69
|
+
// 'font-display': 'swap'
|
70
|
+
// });
|
71
|
+
// const fontStyles = extractFontStyles(css);
|
72
|
+
// fillStylesheet(font.id, fontStyles[font.id]);
|
73
|
+
setIsLoading(false);
|
74
|
+
return [2 /*return*/];
|
75
|
+
}
|
76
|
+
});
|
77
|
+
});
|
78
|
+
}
|
79
|
+
// if (isStylesheetExists(font.id, false)) {
|
80
|
+
// applyActiveFont(font, '', '');
|
81
|
+
// setIsLoading(false);
|
82
|
+
// } else if (isStylesheetExists(font.id, true)) {
|
83
|
+
// setStylesheetType(font.id, false);
|
84
|
+
// setIsLoading(false);
|
85
|
+
// } else {
|
86
|
+
// createStylesheet(font.id, false);
|
87
|
+
// getCss();
|
88
|
+
// }
|
89
|
+
getCss();
|
90
|
+
}, [font, isVisible]);
|
91
|
+
return children({ isLoading: isLoading, isVisible: isVisible, ref: ref });
|
92
|
+
}
|
93
|
+
exports.default = SandollFontItem;
|
@@ -0,0 +1,17 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
import type { SANDOLL_Font, SANDOLL_SortOptionType, SANDOLL_FilterOptionType, SANDOLL_ChangeFilterOptionHandler } from '../types';
|
3
|
+
type HeadlessProps = {
|
4
|
+
isLoading: boolean;
|
5
|
+
fonts: SANDOLL_Font[];
|
6
|
+
filteredFonts: SANDOLL_Font[];
|
7
|
+
filterOptions: SANDOLL_FilterOptionType;
|
8
|
+
changeSort: (option: SANDOLL_SortOptionType) => void;
|
9
|
+
changeFilterOption: SANDOLL_ChangeFilterOptionHandler;
|
10
|
+
};
|
11
|
+
type Props = {
|
12
|
+
apiKey: string;
|
13
|
+
sort: SANDOLL_SortOptionType;
|
14
|
+
children: (args: HeadlessProps) => JSX.Element;
|
15
|
+
};
|
16
|
+
declare function GoogleFontsList({ apiKey, sort, children }: Props): JSX.Element;
|
17
|
+
export default GoogleFontsList;
|
@@ -0,0 +1,145 @@
|
|
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
|
+
// import getGoogleWebFonts from '../api/getGoogleWebFonts';
|
55
|
+
// import getFontId from '../utils/getFontId';
|
56
|
+
var delay_1 = __importDefault(require("../utils/delay"));
|
57
|
+
var DEFAULT_CATEGORIES = ['serif'];
|
58
|
+
function GoogleFontsList(_a) {
|
59
|
+
var apiKey = _a.apiKey, sort = _a.sort, children = _a.children;
|
60
|
+
var _b = (0, react_1.useState)(false), isLoading = _b[0], setIsLoading = _b[1];
|
61
|
+
var _c = (0, react_1.useState)([]), fonts = _c[0], setFonts = _c[1];
|
62
|
+
var _d = (0, react_1.useState)({
|
63
|
+
searchQuery: '',
|
64
|
+
categories: DEFAULT_CATEGORIES
|
65
|
+
}), filterOptions = _d[0], setFilterOptions = _d[1];
|
66
|
+
(0, react_1.useEffect)(function () {
|
67
|
+
function call() {
|
68
|
+
return __awaiter(this, void 0, void 0, function () {
|
69
|
+
var items;
|
70
|
+
return __generator(this, function (_a) {
|
71
|
+
switch (_a.label) {
|
72
|
+
case 0:
|
73
|
+
setIsLoading(true);
|
74
|
+
return [4 /*yield*/, (0, delay_1.default)(2000)];
|
75
|
+
case 1:
|
76
|
+
_a.sent();
|
77
|
+
items = [
|
78
|
+
{ id: '1', family: 'sandoll-test-1', category: 'san-serif' },
|
79
|
+
{ id: '2', family: 'sandoll-test-2', category: 'deco' },
|
80
|
+
{ id: '3', family: 'sandoll-test-3', category: 'round' }
|
81
|
+
];
|
82
|
+
// const { items } = await getGoogleWebFonts({
|
83
|
+
// key: apiKey,
|
84
|
+
// sort
|
85
|
+
// });
|
86
|
+
setFonts(items);
|
87
|
+
setIsLoading(false);
|
88
|
+
return [2 /*return*/];
|
89
|
+
}
|
90
|
+
});
|
91
|
+
});
|
92
|
+
}
|
93
|
+
call();
|
94
|
+
}, [apiKey, sort]);
|
95
|
+
function changeSort(sortOption) {
|
96
|
+
return __awaiter(this, void 0, void 0, function () {
|
97
|
+
var items;
|
98
|
+
return __generator(this, function (_a) {
|
99
|
+
switch (_a.label) {
|
100
|
+
case 0:
|
101
|
+
setIsLoading(true);
|
102
|
+
return [4 /*yield*/, (0, delay_1.default)(2000)];
|
103
|
+
case 1:
|
104
|
+
_a.sent();
|
105
|
+
items = [
|
106
|
+
{ id: '4', family: 'sandoll-test-4', category: 'san-serif' },
|
107
|
+
{ id: '5', family: 'sandoll-test-5', category: 'deco' },
|
108
|
+
{ id: '6', family: 'sandoll-test-6', category: 'round' }
|
109
|
+
];
|
110
|
+
setFonts(items);
|
111
|
+
return [2 /*return*/];
|
112
|
+
}
|
113
|
+
});
|
114
|
+
});
|
115
|
+
}
|
116
|
+
function changeFilterOption(arg) {
|
117
|
+
var name = arg.name, value = arg.value;
|
118
|
+
setFilterOptions(function (prev) {
|
119
|
+
var _a;
|
120
|
+
return (__assign(__assign({}, prev), (_a = {}, _a[name] = value, _a)));
|
121
|
+
});
|
122
|
+
}
|
123
|
+
var filteredFonts = fonts.filter(function (font) {
|
124
|
+
var categories = filterOptions.categories, searchQuery = filterOptions.searchQuery;
|
125
|
+
var isSelectedCategory = categories.includes(font.category);
|
126
|
+
var query = searchQuery.toLocaleLowerCase().trim();
|
127
|
+
var matchSearchQuery = font.family.toLocaleLowerCase().includes(query);
|
128
|
+
if (!matchSearchQuery) {
|
129
|
+
return false;
|
130
|
+
}
|
131
|
+
if (isSelectedCategory) {
|
132
|
+
return true;
|
133
|
+
}
|
134
|
+
return false;
|
135
|
+
});
|
136
|
+
return children({
|
137
|
+
isLoading: isLoading,
|
138
|
+
fonts: fonts,
|
139
|
+
filteredFonts: filteredFonts,
|
140
|
+
filterOptions: filterOptions,
|
141
|
+
changeSort: changeSort,
|
142
|
+
changeFilterOption: changeFilterOption
|
143
|
+
});
|
144
|
+
}
|
145
|
+
exports.default = GoogleFontsList;
|
@@ -0,0 +1,26 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
|
+
};
|
16
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
17
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
18
|
+
};
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
20
|
+
exports.SandollFontsList = exports.SandollFontItem = void 0;
|
21
|
+
var SandollFontItem_1 = require("./headless/SandollFontItem");
|
22
|
+
Object.defineProperty(exports, "SandollFontItem", { enumerable: true, get: function () { return __importDefault(SandollFontItem_1).default; } });
|
23
|
+
var SandollFontsList_1 = require("./headless/SandollFontsList");
|
24
|
+
Object.defineProperty(exports, "SandollFontsList", { enumerable: true, get: function () { return __importDefault(SandollFontsList_1).default; } });
|
25
|
+
__exportStar(require("./types"), exports);
|
26
|
+
__exportStar(require("./constants"), exports);
|
@@ -0,0 +1,22 @@
|
|
1
|
+
import type { PDSIconType } from '../../common/types';
|
2
|
+
export type SANDOLL_Font = {
|
3
|
+
family: string;
|
4
|
+
id: string;
|
5
|
+
category: SANDOLL_CategoryType;
|
6
|
+
};
|
7
|
+
export type SANDOLL_CategoryType = 'serif' | 'san-serif' | 'slab' | 'round' | 'script' | 'deco' | 'symbol' | 'blackLetter';
|
8
|
+
export type SANDOLL_SortOptionType = 'date' | 'alpha';
|
9
|
+
export type SANDOLL_CategoryIconType = Record<SANDOLL_Category, PDSIconType>;
|
10
|
+
export type SANDOLL_Category = 'serif' | 'san-serif' | 'slab' | 'round' | 'script' | 'deco' | 'symbol' | 'blackLetter';
|
11
|
+
export type SANDOLL_FilterOptionHandlerArgType = {
|
12
|
+
name: 'searchQuery';
|
13
|
+
value: string;
|
14
|
+
} | {
|
15
|
+
name: 'categories';
|
16
|
+
value: SANDOLL_CategoryType[];
|
17
|
+
};
|
18
|
+
export type SANDOLL_ChangeFilterOptionHandler = (arg: SANDOLL_FilterOptionHandlerArgType) => void;
|
19
|
+
export type SANDOLL_FilterOptionType = {
|
20
|
+
searchQuery: string;
|
21
|
+
categories: SANDOLL_CategoryType[];
|
22
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export default function delay(ms: number): Promise<unknown>;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "pds-dev-kit-web-test",
|
3
|
-
"version": "2.3.
|
3
|
+
"version": "2.3.5",
|
4
4
|
"license": "MIT",
|
5
5
|
"private": false,
|
6
6
|
"main": "dist/index.js",
|
@@ -25,7 +25,6 @@
|
|
25
25
|
"publ-echo": "^0.0.45",
|
26
26
|
"react-hook-form": "^7.28.1",
|
27
27
|
"react-i18next": "^11.12.0",
|
28
|
-
"react-measure": "^2.5.2",
|
29
28
|
"react-router-dom": "^5.2.0",
|
30
29
|
"react-scripts": "4.0.3",
|
31
30
|
"smoothscroll-polyfill": "^0.4.4",
|
@@ -86,8 +85,6 @@
|
|
86
85
|
"@storybook/react": "^6.3.12",
|
87
86
|
"@types/lodash": "^4.14.175",
|
88
87
|
"@types/node": "^16.10.2",
|
89
|
-
"@types/react-grid-layout": "^1.3.5",
|
90
|
-
"@types/react-measure": "^2.0.12",
|
91
88
|
"@types/react-router-dom": "^5.3.3",
|
92
89
|
"@types/smoothscroll-polyfill": "^0.3.1",
|
93
90
|
"@types/styled-components": "^5.1.9",
|