pds-dev-kit-web-test 0.3.51 → 0.3.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.
- package/dist/src/common/assets/icons/fill/Home.d.ts +4 -0
- package/dist/src/common/assets/icons/fill/Home.js +30 -0
- package/dist/src/common/assets/icons/fill/PappType.d.ts +4 -0
- package/dist/src/common/assets/icons/fill/PappType.js +30 -0
- package/dist/src/common/assets/icons/fill/Plan.d.ts +4 -0
- package/dist/src/common/assets/icons/fill/Plan.js +30 -0
- package/dist/src/common/assets/icons/fill/Sales.d.ts +4 -0
- package/dist/src/common/assets/icons/fill/Sales.js +30 -0
- package/dist/src/common/assets/icons/fill/SellerIntro.d.ts +4 -0
- package/dist/src/common/assets/icons/fill/SellerIntro.js +30 -0
- package/dist/src/common/assets/icons/fill/Shoppingbag.d.ts +4 -0
- package/dist/src/common/assets/icons/fill/Shoppingbag.js +30 -0
- package/dist/src/common/assets/icons/fill/Site.d.ts +4 -0
- package/dist/src/common/assets/icons/fill/Site.js +30 -0
- package/dist/src/common/assets/icons/fill/Target.d.ts +4 -0
- package/dist/src/common/assets/icons/fill/Target.js +30 -0
- package/dist/src/common/assets/icons/fill/User.d.ts +4 -0
- package/dist/src/common/assets/icons/fill/User.js +30 -0
- package/dist/src/common/assets/icons/fill/index.d.ts +9 -0
- package/dist/src/common/assets/icons/fill/index.js +18 -0
- package/dist/src/common/assets/icons/line/Site.d.ts +4 -0
- package/dist/src/common/assets/icons/line/Site.js +30 -0
- package/dist/src/common/assets/icons/line/User.d.ts +4 -0
- package/dist/src/common/assets/icons/line/User.js +30 -0
- package/dist/src/common/assets/icons/line/index.d.ts +2 -0
- package/dist/src/common/assets/icons/line/index.js +4 -0
- package/dist/src/common/hooks/index.d.ts +1 -0
- package/dist/src/common/hooks/index.js +5 -1
- package/dist/src/common/hooks/useShortcutKey/ShortcutKeyProvider.d.ts +27 -0
- package/dist/src/common/hooks/useShortcutKey/ShortcutKeyProvider.js +74 -0
- package/dist/src/common/hooks/useShortcutKey/constants.d.ts +2 -0
- package/dist/src/common/hooks/useShortcutKey/constants.js +25 -0
- package/dist/src/common/hooks/useShortcutKey/index.d.ts +3 -0
- package/dist/src/common/hooks/useShortcutKey/index.js +8 -0
- package/dist/src/common/hooks/useShortcutKey/types.d.ts +27 -0
- package/dist/src/common/hooks/useShortcutKey/types.js +2 -0
- package/dist/src/common/hooks/useShortcutKey/useShortcutKey.d.ts +3 -0
- package/dist/src/common/hooks/useShortcutKey/useShortcutKey.js +62 -0
- package/dist/src/common/hooks/useShortcutKey/validators.d.ts +20 -0
- package/dist/src/common/hooks/useShortcutKey/validators.js +150 -0
- package/dist/src/common/styles/colorSet/PaletteColor_Dark.json +9 -1
- package/dist/src/common/styles/colorSet/PaletteColor_light.json +10 -2
- package/dist/src/common/styles/colorSet/UIColor.json +10 -1
- package/dist/src/common/styles/colorSet/index.d.ts +145 -120
- package/dist/src/common/styles/colorSet/index.js +2 -2
- package/dist/src/common/styles/colorSet/ui-type.d.ts +9 -0
- package/dist/src/desktop/common/components/TextFieldBase/TextFieldBase.js +1 -1
- package/dist/src/desktop/components/BasicListItem/BasicListItem.d.ts +2 -1
- package/dist/src/desktop/components/BasicListItem/BasicListItem.js +2 -2
- package/dist/src/desktop/components/BasicListItem/RightBox/MainButton.d.ts +1 -0
- package/dist/src/desktop/components/BasicListItem/RightBox/MainButton.js +2 -2
- package/dist/src/desktop/components/ChatBubbleListItem/ChatBubbleListItem.d.ts +3 -1
- package/dist/src/desktop/components/ChatBubbleListItem/ChatBubbleListItem.js +20 -9
- package/dist/src/desktop/components/ChatList/ChatList.d.ts +8 -1
- package/dist/src/desktop/components/ChatList/ChatList.js +3 -3
- package/dist/src/desktop/components/ChatList/Header.d.ts +2 -2
- package/dist/src/desktop/components/ChatList/Header.js +18 -3
- package/dist/src/desktop/components/DesktopAlertDialog/DesktopAlertDialog.js +8 -1
- package/dist/src/desktop/components/DynamicDesktopNavBar/components/MenuItemNav/components/InternalLinkMenuItemNav.js +9 -18
- package/dist/src/desktop/components/DynamicDesktopNavBar/components/MenuItemNav/components/PAppMenuItemNav.js +2 -10
- package/dist/src/desktop/components/DynamicDesktopNavBar/components/MenuItemNav/components/PageMenuItemNav.js +2 -10
- package/dist/src/mobile/common/components/TextFieldBase/TextFieldBase.js +1 -1
- package/dist/src/mobile/components/BasicListItem/BasicListItem.d.ts +2 -1
- package/dist/src/mobile/components/BasicListItem/BasicListItem.js +2 -2
- package/dist/src/mobile/components/BasicListItem/RightBox/MainButton.d.ts +1 -0
- package/dist/src/mobile/components/BasicListItem/RightBox/MainButton.js +2 -2
- package/dist/src/mobile/components/ChatBubbleListItem/ChatBubbleListItem.d.ts +3 -1
- package/dist/src/mobile/components/ChatBubbleListItem/ChatBubbleListItem.js +20 -9
- package/dist/src/mobile/components/ChatList/ChatList.d.ts +8 -1
- package/dist/src/mobile/components/ChatList/ChatList.js +3 -3
- package/dist/src/mobile/components/ChatList/Header.d.ts +2 -2
- package/dist/src/mobile/components/ChatList/Header.js +15 -3
- package/dist/src/sub/DynamicLayout/sections/CustomSection/CustomSection.js +38 -10
- package/dist/src/sub/DynamicLayout/sections/CustomSection/hooks/useGroupDrag/useGroupDrag.d.ts +1 -0
- package/dist/src/sub/DynamicLayout/sections/CustomSection/hooks/useGroupDrag/useGroupDrag.js +30 -1
- package/package.json +1 -1
- package/release-note.md +7 -7
- package/webhook/node_modules/esrecurse/.babelrc +3 -0
|
@@ -3,7 +3,11 @@ 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.usePrevious = exports.useDetectOverflow = exports.useAbsolutePositioner = void 0;
|
|
6
|
+
exports.usePrevious = exports.useDetectOverflow = exports.useAbsolutePositioner = exports.useShortcutKeyContext = exports.ShortcutKeyProvider = exports.useShortcutKey = void 0;
|
|
7
|
+
var useShortcutKey_1 = require("./useShortcutKey");
|
|
8
|
+
Object.defineProperty(exports, "useShortcutKey", { enumerable: true, get: function () { return useShortcutKey_1.useShortcutKey; } });
|
|
9
|
+
Object.defineProperty(exports, "ShortcutKeyProvider", { enumerable: true, get: function () { return useShortcutKey_1.ShortcutKeyProvider; } });
|
|
10
|
+
Object.defineProperty(exports, "useShortcutKeyContext", { enumerable: true, get: function () { return useShortcutKey_1.useShortcutKeyContext; } });
|
|
7
11
|
var useAbsolutePositioner_1 = require("./useAbsolutePositioner");
|
|
8
12
|
Object.defineProperty(exports, "useAbsolutePositioner", { enumerable: true, get: function () { return __importDefault(useAbsolutePositioner_1).default; } });
|
|
9
13
|
var useDetectOverflow_1 = require("./useDetectOverflow");
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export type ShortcutKeyContextType = {
|
|
3
|
+
enabledScopes: string[];
|
|
4
|
+
enableScope: (scope: string) => void;
|
|
5
|
+
disableScope: (scope: string) => void;
|
|
6
|
+
};
|
|
7
|
+
type Props = {
|
|
8
|
+
initiallyActiveScopes?: string[];
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* @param enabledScopes 초기에 단축키가 가능한 scopes, "*" 인 경우 전체 scope에서 가능
|
|
13
|
+
* @param enableScope 가능한 scope 등록하는 함수
|
|
14
|
+
* @param disableScope 불가능한 scope 등록하는 함수
|
|
15
|
+
* @examples
|
|
16
|
+
* 1. 단축키 scope을 적용시킬 최상단 컴포넌트에 ShortcutKeyProvider로 감싸주기
|
|
17
|
+
* <ShortcutKeyProvider><App /></ShortcutKeyProvider>
|
|
18
|
+
* 2. 단축키를 사용하는 컴포넌트에 아래와 같이 코드 적용
|
|
19
|
+
* const { enableScope, disableScope } = useShortcutKeyContext();
|
|
20
|
+
* useShortcutKey('ctrl+d' , callback, { scopes: "Preview" });
|
|
21
|
+
* 컴포넌트 클릭 시 enableScope('Preview')로 가능한 scope 설정, disableScope('Sidebar')로 불가능한 scope 설정
|
|
22
|
+
*
|
|
23
|
+
* @todo 추후 작업이 필요
|
|
24
|
+
*/
|
|
25
|
+
export declare const useShortcutKeyContext: () => ShortcutKeyContextType;
|
|
26
|
+
export declare const ShortcutKeyProvider: ({ initiallyActiveScopes, children }: Props) => JSX.Element;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,74 @@
|
|
|
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 __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
14
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
15
|
+
if (ar || !(i in from)) {
|
|
16
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
17
|
+
ar[i] = from[i];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
21
|
+
};
|
|
22
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
+
exports.ShortcutKeyProvider = exports.useShortcutKeyContext = void 0;
|
|
24
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
25
|
+
var react_1 = require("react");
|
|
26
|
+
var ShortcutKeyContext = (0, react_1.createContext)({
|
|
27
|
+
enabledScopes: [],
|
|
28
|
+
enableScope: function () {
|
|
29
|
+
return;
|
|
30
|
+
},
|
|
31
|
+
disableScope: function () {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
/**
|
|
36
|
+
* @param enabledScopes 초기에 단축키가 가능한 scopes, "*" 인 경우 전체 scope에서 가능
|
|
37
|
+
* @param enableScope 가능한 scope 등록하는 함수
|
|
38
|
+
* @param disableScope 불가능한 scope 등록하는 함수
|
|
39
|
+
* @examples
|
|
40
|
+
* 1. 단축키 scope을 적용시킬 최상단 컴포넌트에 ShortcutKeyProvider로 감싸주기
|
|
41
|
+
* <ShortcutKeyProvider><App /></ShortcutKeyProvider>
|
|
42
|
+
* 2. 단축키를 사용하는 컴포넌트에 아래와 같이 코드 적용
|
|
43
|
+
* const { enableScope, disableScope } = useShortcutKeyContext();
|
|
44
|
+
* useShortcutKey('ctrl+d' , callback, { scopes: "Preview" });
|
|
45
|
+
* 컴포넌트 클릭 시 enableScope('Preview')로 가능한 scope 설정, disableScope('Sidebar')로 불가능한 scope 설정
|
|
46
|
+
*
|
|
47
|
+
* @todo 추후 작업이 필요
|
|
48
|
+
*/
|
|
49
|
+
var useShortcutKeyContext = function () {
|
|
50
|
+
return (0, react_1.useContext)(ShortcutKeyContext);
|
|
51
|
+
};
|
|
52
|
+
exports.useShortcutKeyContext = useShortcutKeyContext;
|
|
53
|
+
var ShortcutKeyProvider = function (_a) {
|
|
54
|
+
var _b = _a.initiallyActiveScopes, initiallyActiveScopes = _b === void 0 ? ['*'] : _b, children = _a.children;
|
|
55
|
+
var _c = (0, react_1.useState)((initiallyActiveScopes === null || initiallyActiveScopes === void 0 ? void 0 : initiallyActiveScopes.length) > 0 ? initiallyActiveScopes : ['*']), activeScopes = _c[0], setActiveScopes = _c[1];
|
|
56
|
+
var enableScope = (0, react_1.useCallback)(function (scope) {
|
|
57
|
+
setActiveScopes(function (prev) {
|
|
58
|
+
if (prev.includes('*')) {
|
|
59
|
+
return [scope];
|
|
60
|
+
}
|
|
61
|
+
return Array.from(new Set(__spreadArray(__spreadArray([], prev, true), [scope], false)));
|
|
62
|
+
});
|
|
63
|
+
}, []);
|
|
64
|
+
var disableScope = (0, react_1.useCallback)(function (scope) {
|
|
65
|
+
setActiveScopes(function (prev) {
|
|
66
|
+
if (prev.filter(function (s) { return s !== scope; }).length === 0) {
|
|
67
|
+
return ['*'];
|
|
68
|
+
}
|
|
69
|
+
return prev.filter(function (s) { return s !== scope; });
|
|
70
|
+
});
|
|
71
|
+
}, []);
|
|
72
|
+
return ((0, jsx_runtime_1.jsx)(ShortcutKeyContext.Provider, __assign({ value: { enabledScopes: activeScopes, enableScope: enableScope, disableScope: disableScope } }, { children: children })));
|
|
73
|
+
};
|
|
74
|
+
exports.ShortcutKeyProvider = ShortcutKeyProvider;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mappedKeys = exports.reservedModifierKeywords = void 0;
|
|
4
|
+
exports.reservedModifierKeywords = ['shift', 'alt', 'meta', 'mod', 'ctrl'];
|
|
5
|
+
exports.mappedKeys = {
|
|
6
|
+
esc: 'escape',
|
|
7
|
+
return: 'enter',
|
|
8
|
+
'.': 'period',
|
|
9
|
+
',': 'comma',
|
|
10
|
+
'-': 'slash',
|
|
11
|
+
' ': 'space',
|
|
12
|
+
'`': 'backquote',
|
|
13
|
+
'#': 'backslash',
|
|
14
|
+
'+': 'bracketright',
|
|
15
|
+
ShiftLeft: 'shift',
|
|
16
|
+
ShiftRight: 'shift',
|
|
17
|
+
AltLeft: 'alt',
|
|
18
|
+
AltRight: 'alt',
|
|
19
|
+
MetaLeft: 'meta',
|
|
20
|
+
MetaRight: 'meta',
|
|
21
|
+
OSLeft: 'meta',
|
|
22
|
+
OSRight: 'meta',
|
|
23
|
+
ControlLeft: 'ctrl',
|
|
24
|
+
ControlRight: 'ctrl'
|
|
25
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useShortcutKeyContext = exports.ShortcutKeyProvider = exports.useShortcutKey = void 0;
|
|
4
|
+
var ShortcutKeyProvider_1 = require("./ShortcutKeyProvider");
|
|
5
|
+
Object.defineProperty(exports, "ShortcutKeyProvider", { enumerable: true, get: function () { return ShortcutKeyProvider_1.ShortcutKeyProvider; } });
|
|
6
|
+
Object.defineProperty(exports, "useShortcutKeyContext", { enumerable: true, get: function () { return ShortcutKeyProvider_1.useShortcutKeyContext; } });
|
|
7
|
+
var useShortcutKey_1 = require("./useShortcutKey");
|
|
8
|
+
Object.defineProperty(exports, "useShortcutKey", { enumerable: true, get: function () { return useShortcutKey_1.useShortcutKey; } });
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { DependencyList } from 'react';
|
|
2
|
+
export type KeyboardModifiers = {
|
|
3
|
+
alt?: boolean;
|
|
4
|
+
ctrl?: boolean;
|
|
5
|
+
meta?: boolean;
|
|
6
|
+
shift?: boolean;
|
|
7
|
+
mod?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export type KeysEvent = KeyboardModifiers & {
|
|
10
|
+
keys?: readonly string[];
|
|
11
|
+
};
|
|
12
|
+
export type FormTags = 'input' | 'textarea' | 'select' | 'INPUT' | 'TEXTAREA' | 'SELECT';
|
|
13
|
+
export type Scopes = string | readonly string[];
|
|
14
|
+
export type Callback = (keyboardEvent: KeyboardEvent, keysEvent: KeysEvent) => void;
|
|
15
|
+
export type Options = {
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
splitKey?: string;
|
|
18
|
+
scopes?: Scopes;
|
|
19
|
+
enableOnFormTags?: readonly FormTags[] | boolean;
|
|
20
|
+
};
|
|
21
|
+
export type RefType<T> = T | null;
|
|
22
|
+
export type OptionsOrDependencyArray = Options | DependencyList;
|
|
23
|
+
type DuplicateKeyboardShortcut = 'ctrl+d, meta+d' | 'meta+d, ctrl+d';
|
|
24
|
+
type DeleteKeyboardShortcut = 'delete, backspace' | 'backspace, delete';
|
|
25
|
+
type AcceptKeyboardShortcut = 'enter';
|
|
26
|
+
export type TargetKeys = DuplicateKeyboardShortcut | DeleteKeyboardShortcut | AcceptKeyboardShortcut;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useShortcutKey = void 0;
|
|
4
|
+
var react_1 = require("react");
|
|
5
|
+
var ShortcutKeyProvider_1 = require("./ShortcutKeyProvider");
|
|
6
|
+
var validators_1 = require("./validators");
|
|
7
|
+
/**
|
|
8
|
+
* @param targetKeys 사용할 단축키
|
|
9
|
+
* @param callback 단축키를 눌렀을 때 실행시킬 콜백 함수
|
|
10
|
+
* @param deps 단축키가 실행될 때 호출되는 콜백 함수와 관련된 의존성으로 변경될 때마다 단축키 관련 동작을 다시 설정하도록 하기
|
|
11
|
+
* @param options disabled 단축키 비활성화 여부, scopes 해당 단축키 사용 범위 설정
|
|
12
|
+
* @example
|
|
13
|
+
* useKeyboardShortcut('ctrl+d, meta+d', handleDuplicate, [id]);
|
|
14
|
+
* useKeyboardShortcut('delete, backspace', handleDelete, [id], { disabled: true });
|
|
15
|
+
*/
|
|
16
|
+
var useSafeLayoutEffect = typeof window !== 'undefined' ? react_1.useLayoutEffect : react_1.useEffect;
|
|
17
|
+
function useShortcutKey(targetKeys, callback, options, deps) {
|
|
18
|
+
var cbRef = (0, react_1.useRef)(callback);
|
|
19
|
+
var memoisedCB = (0, react_1.useCallback)(callback, deps !== null && deps !== void 0 ? deps : []);
|
|
20
|
+
if (deps) {
|
|
21
|
+
cbRef.current = memoisedCB;
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
cbRef.current = callback;
|
|
25
|
+
}
|
|
26
|
+
var enabledScopes = (0, ShortcutKeyProvider_1.useShortcutKeyContext)().enabledScopes;
|
|
27
|
+
useSafeLayoutEffect(function () {
|
|
28
|
+
if ((options === null || options === void 0 ? void 0 : options.disabled) === false || !(0, validators_1.isScopeActive)(enabledScopes, options === null || options === void 0 ? void 0 : options.scopes))
|
|
29
|
+
return;
|
|
30
|
+
var listener = function (e) {
|
|
31
|
+
if ((0, validators_1.isKeyboardEventTriggeredByInput)(e) &&
|
|
32
|
+
!(0, validators_1.isShortcutkeyEnabledOnTag)(e, options === null || options === void 0 ? void 0 : options.enableOnFormTags)) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
(0, validators_1.parseMultipleShortcutKeys)(targetKeys).forEach(function (key) {
|
|
36
|
+
var keys = (0, validators_1.parseKey)(key);
|
|
37
|
+
if ((0, validators_1.isKeyMatchingKeyboardEvent)(e, keys)) {
|
|
38
|
+
e.preventDefault();
|
|
39
|
+
cbRef.current(e, keys);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
var handleKeyPress = function (e) {
|
|
44
|
+
if (e.key === undefined || e.repeat)
|
|
45
|
+
return;
|
|
46
|
+
(0, validators_1.pushToCurrentlyPressedKeys)((0, validators_1.mapKey)(e.code));
|
|
47
|
+
listener(e);
|
|
48
|
+
};
|
|
49
|
+
var handleKeyUp = function (e) {
|
|
50
|
+
if (e.key === undefined)
|
|
51
|
+
return;
|
|
52
|
+
(0, validators_1.removeFromCurrentlyPressedKeys)((0, validators_1.mapKey)(e.code));
|
|
53
|
+
};
|
|
54
|
+
document.addEventListener('keydown', handleKeyPress);
|
|
55
|
+
document.addEventListener('keyup', handleKeyUp);
|
|
56
|
+
return function () {
|
|
57
|
+
document.removeEventListener('keydown', handleKeyPress);
|
|
58
|
+
document.removeEventListener('keyup', handleKeyUp);
|
|
59
|
+
};
|
|
60
|
+
}, [targetKeys, options, enabledScopes]);
|
|
61
|
+
}
|
|
62
|
+
exports.useShortcutKey = useShortcutKey;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { FormTags, KeysEvent, Scopes } from './types';
|
|
2
|
+
export declare function mapKey(key: string): string;
|
|
3
|
+
export declare function parseKey(shortcutKey: string, combinationKey?: string): {
|
|
4
|
+
keys: string[];
|
|
5
|
+
alt?: boolean | undefined;
|
|
6
|
+
ctrl?: boolean | undefined;
|
|
7
|
+
meta?: boolean | undefined;
|
|
8
|
+
shift?: boolean | undefined;
|
|
9
|
+
mod?: boolean | undefined;
|
|
10
|
+
};
|
|
11
|
+
export declare function parseMultipleShortcutKeys(keys: string, splitKey?: string): string[];
|
|
12
|
+
export declare function isKeyMatchingKeyboardEvent(e: KeyboardEvent, key: KeysEvent): boolean;
|
|
13
|
+
export declare function isReadonlyArray(value: unknown): value is readonly unknown[];
|
|
14
|
+
export declare function isKeyPressed(shortcutKey: string | readonly string[], splitKey?: string): boolean;
|
|
15
|
+
export declare function isKeyModifier(key: string): boolean;
|
|
16
|
+
export declare function pushToCurrentlyPressedKeys(key: string | string[]): void;
|
|
17
|
+
export declare function removeFromCurrentlyPressedKeys(key: string | string[]): void;
|
|
18
|
+
export declare function isScopeActive(activeScopes: string[], scopes?: Scopes): boolean;
|
|
19
|
+
export declare function isKeyboardEventTriggeredByInput(e: KeyboardEvent): boolean;
|
|
20
|
+
export declare function isShortcutkeyEnabledOnTag({ target }: KeyboardEvent, enabledOnTags?: readonly FormTags[] | boolean): boolean;
|
|
@@ -0,0 +1,150 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.isShortcutkeyEnabledOnTag = exports.isKeyboardEventTriggeredByInput = exports.isScopeActive = exports.removeFromCurrentlyPressedKeys = exports.pushToCurrentlyPressedKeys = exports.isKeyModifier = exports.isKeyPressed = exports.isReadonlyArray = exports.isKeyMatchingKeyboardEvent = exports.parseMultipleShortcutKeys = exports.parseKey = exports.mapKey = void 0;
|
|
15
|
+
var constants_1 = require("./constants");
|
|
16
|
+
// NOTE - keydown된 key를 원하는 형태로 mapping해주는 함수입니다.
|
|
17
|
+
function mapKey(key) {
|
|
18
|
+
return (constants_1.mappedKeys[key] || key)
|
|
19
|
+
.trim()
|
|
20
|
+
.toLocaleLowerCase()
|
|
21
|
+
.replace(/key|digit|numpad|arrow/, '');
|
|
22
|
+
}
|
|
23
|
+
exports.mapKey = mapKey;
|
|
24
|
+
// NOTE - 단축키로 등록한 keys들을 key의 단위로 분리하여 parse해주는 함수입니다.
|
|
25
|
+
function parseKey(shortcutKey, combinationKey) {
|
|
26
|
+
if (combinationKey === void 0) { combinationKey = '+'; }
|
|
27
|
+
var keys = shortcutKey
|
|
28
|
+
.toLocaleLowerCase()
|
|
29
|
+
.split(combinationKey)
|
|
30
|
+
.map(function (k) { return mapKey(k); });
|
|
31
|
+
var modifiers = {
|
|
32
|
+
alt: keys.includes('alt'),
|
|
33
|
+
ctrl: keys.includes('ctrl') || keys.includes('control'),
|
|
34
|
+
shift: keys.includes('shift'),
|
|
35
|
+
meta: keys.includes('meta'),
|
|
36
|
+
mod: keys.includes('mod')
|
|
37
|
+
};
|
|
38
|
+
var singleCharKeys = keys.filter(function (k) { return !constants_1.reservedModifierKeywords.includes(k); });
|
|
39
|
+
return __assign(__assign({}, modifiers), { keys: singleCharKeys });
|
|
40
|
+
}
|
|
41
|
+
exports.parseKey = parseKey;
|
|
42
|
+
function parseMultipleShortcutKeys(keys, splitKey) {
|
|
43
|
+
if (splitKey === void 0) { splitKey = ','; }
|
|
44
|
+
return keys.split(splitKey);
|
|
45
|
+
}
|
|
46
|
+
exports.parseMultipleShortcutKeys = parseMultipleShortcutKeys;
|
|
47
|
+
// NOTE - 설정한 단축키와 사용자가 누르고 있는 key의 일치여부를 판단하는 함수입니다.
|
|
48
|
+
function isKeyMatchingKeyboardEvent(e, key) {
|
|
49
|
+
var alt = key.alt, meta = key.meta, mod = key.mod, shift = key.shift, ctrl = key.ctrl, shortcutKey = key.keys;
|
|
50
|
+
var pressedKeyUppercase = e.key, code = e.code, ctrlKey = e.ctrlKey, metaKey = e.metaKey, shiftKey = e.shiftKey, altKey = e.altKey;
|
|
51
|
+
var keyCode = mapKey(code);
|
|
52
|
+
var pressedKey = pressedKeyUppercase.toLowerCase();
|
|
53
|
+
if (alt === !altKey && pressedKey !== 'alt')
|
|
54
|
+
return false;
|
|
55
|
+
if (shift === !shiftKey && pressedKey !== 'shift')
|
|
56
|
+
return false;
|
|
57
|
+
// NOTE - mod는 macOS에 meta 그리고 다른 platform에서 ctrl을 확인하는 key name입니다.
|
|
58
|
+
if (mod) {
|
|
59
|
+
if (!metaKey && !ctrlKey) {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
if (meta === !metaKey && pressedKey !== 'meta' && pressedKey !== 'os') {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
if (ctrl === !ctrlKey && pressedKey !== 'ctrl' && pressedKey !== 'control') {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
if (shortcutKey &&
|
|
72
|
+
shortcutKey.length === 1 &&
|
|
73
|
+
(shortcutKey.includes(pressedKey) || shortcutKey.includes(keyCode))) {
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
if (shortcutKey)
|
|
77
|
+
return isKeyPressed(shortcutKey);
|
|
78
|
+
if (!shortcutKey)
|
|
79
|
+
return true;
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
exports.isKeyMatchingKeyboardEvent = isKeyMatchingKeyboardEvent;
|
|
83
|
+
// NOTE - 현재 누른 key를 추적하기 위해 중복 요소를 허용하지 않는 데이터 구조인 변수입니다.
|
|
84
|
+
var currentlyPressedKeys = new Set();
|
|
85
|
+
// NOTE - 배열이 초기 생성된 이후 불변성을 유지하고 우발적이거나 무단의 변경을 방지하고 배열인지를 판단하는 함수입니다.
|
|
86
|
+
function isReadonlyArray(value) {
|
|
87
|
+
return Array.isArray(value);
|
|
88
|
+
}
|
|
89
|
+
exports.isReadonlyArray = isReadonlyArray;
|
|
90
|
+
// NOTE - 설정된 단축키와 현재 누른 key의 일치여부를 판단하는 함수입니다.
|
|
91
|
+
function isKeyPressed(shortcutKey, splitKey) {
|
|
92
|
+
if (splitKey === void 0) { splitKey = ','; }
|
|
93
|
+
var keyArray = isReadonlyArray(shortcutKey) ? shortcutKey : shortcutKey.split(splitKey);
|
|
94
|
+
return keyArray.every(function (key) { return currentlyPressedKeys.has(key.trim().toLowerCase()); });
|
|
95
|
+
}
|
|
96
|
+
exports.isKeyPressed = isKeyPressed;
|
|
97
|
+
function isKeyModifier(key) {
|
|
98
|
+
return constants_1.reservedModifierKeywords.includes(key);
|
|
99
|
+
}
|
|
100
|
+
exports.isKeyModifier = isKeyModifier;
|
|
101
|
+
// NOTE - keydown시 누른 key 저장
|
|
102
|
+
function pushToCurrentlyPressedKeys(key) {
|
|
103
|
+
var keyArray = Array.isArray(key) ? key : [key];
|
|
104
|
+
if (currentlyPressedKeys.has('meta')) {
|
|
105
|
+
currentlyPressedKeys.forEach(function (key) { return !isKeyModifier(key) && currentlyPressedKeys.delete(key.toLowerCase()); });
|
|
106
|
+
}
|
|
107
|
+
keyArray.forEach(function (key) { return currentlyPressedKeys.add(key.toLowerCase()); });
|
|
108
|
+
}
|
|
109
|
+
exports.pushToCurrentlyPressedKeys = pushToCurrentlyPressedKeys;
|
|
110
|
+
// NOTE - keyup시 누른 key 삭제
|
|
111
|
+
function removeFromCurrentlyPressedKeys(key) {
|
|
112
|
+
var keyArray = Array.isArray(key) ? key : [key];
|
|
113
|
+
if (key === 'meta') {
|
|
114
|
+
currentlyPressedKeys.clear();
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
keyArray.forEach(function (key) { return currentlyPressedKeys.delete(key.toLowerCase()); });
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
exports.removeFromCurrentlyPressedKeys = removeFromCurrentlyPressedKeys;
|
|
121
|
+
// NOTE - 다른 컴포넌트에 동일한 단축키를 사용하는 경우에 서로 다른 scope을 주어 단축키가 가능한 scope인지 아닌지를 판단하는 함수입니다.
|
|
122
|
+
function isScopeActive(activeScopes, scopes) {
|
|
123
|
+
if (activeScopes.length === 0 && scopes) {
|
|
124
|
+
// eslint-disable-next-line no-console
|
|
125
|
+
console.warn('A shortcutKey has the "scopes" option set, however no active scopes were found. If you want to use the global scopes feature, you need to wrap your app in a <ShortcutKeyProvider>');
|
|
126
|
+
return true;
|
|
127
|
+
}
|
|
128
|
+
if (!scopes) {
|
|
129
|
+
return true;
|
|
130
|
+
}
|
|
131
|
+
return activeScopes.some(function (scope) { return scopes.includes(scope); }) || activeScopes.includes('*');
|
|
132
|
+
}
|
|
133
|
+
exports.isScopeActive = isScopeActive;
|
|
134
|
+
// NOTE - keydown 하는 tag의 위치가 input, textarea, select인 경우에는 단축키가 동작하지 않도록 판단하는 함수입니다.
|
|
135
|
+
function isKeyboardEventTriggeredByInput(e) {
|
|
136
|
+
return isShortcutkeyEnabledOnTag(e, ['input', 'textarea', 'select']);
|
|
137
|
+
}
|
|
138
|
+
exports.isKeyboardEventTriggeredByInput = isKeyboardEventTriggeredByInput;
|
|
139
|
+
function isShortcutkeyEnabledOnTag(_a, enabledOnTags) {
|
|
140
|
+
var target = _a.target;
|
|
141
|
+
if (enabledOnTags === void 0) { enabledOnTags = false; }
|
|
142
|
+
var targetTagName = target && target.tagName;
|
|
143
|
+
if (isReadonlyArray(enabledOnTags)) {
|
|
144
|
+
return Boolean(targetTagName &&
|
|
145
|
+
enabledOnTags &&
|
|
146
|
+
enabledOnTags.some(function (tag) { return tag.toLowerCase() === targetTagName.toLowerCase(); }));
|
|
147
|
+
}
|
|
148
|
+
return Boolean(targetTagName && enabledOnTags && enabledOnTags === true);
|
|
149
|
+
}
|
|
150
|
+
exports.isShortcutkeyEnabledOnTag = isShortcutkeyEnabledOnTag;
|
|
@@ -344,5 +344,13 @@
|
|
|
344
344
|
"sys_text_grey_05": "darkgrey400/opacity20",
|
|
345
345
|
"sys_text_white_02": "white/opacity50",
|
|
346
346
|
"sys_component_base_45": "darkgreen300",
|
|
347
|
-
"sys_component_base_46": "black/opacity90"
|
|
347
|
+
"sys_component_base_46": "black/opacity90",
|
|
348
|
+
"sys_cpnt_list_chatbubble_download_button_base": "white/opacity20",
|
|
349
|
+
"sys_cpnt_sheet_base_11": "darkgrey10",
|
|
350
|
+
"sys_cpnt_sheet_base_12": "white/opacity20",
|
|
351
|
+
"sys_sw_sidebar_item_text_emphasis": "darkgreen500",
|
|
352
|
+
"sys_sw_sidebar_item_icon_emphasis": "darkgreen500",
|
|
353
|
+
"sys_sw_sidebar_divider_vertical": "darkgrey100",
|
|
354
|
+
"sys_cpnt_sheet_base_13": "grey50",
|
|
355
|
+
"sys_cpnt_sheet_base_14": "grey900"
|
|
348
356
|
}
|
|
@@ -314,7 +314,7 @@
|
|
|
314
314
|
"sys_icon_grey_darktheme_03": "darkgrey400",
|
|
315
315
|
"sys_widget_grey_01_opacity_50": "grey900/opacity50",
|
|
316
316
|
"sys_editor_layout_header": "white",
|
|
317
|
-
"sys_editor_layout_navigation_panel": "
|
|
317
|
+
"sys_editor_layout_navigation_panel": "grey70",
|
|
318
318
|
"sys_editor_layout_canvas_area": "grey30",
|
|
319
319
|
"sys_editor_layout_control_panel": "white",
|
|
320
320
|
"sys_editor_layout_property_panel": "white",
|
|
@@ -344,5 +344,13 @@
|
|
|
344
344
|
"sys_text_grey_05": "grey400/opacity20",
|
|
345
345
|
"sys_text_white_02": "white/opacity50",
|
|
346
346
|
"sys_component_base_45": "green300",
|
|
347
|
-
"sys_component_base_46": "black/opacity90"
|
|
347
|
+
"sys_component_base_46": "black/opacity90",
|
|
348
|
+
"sys_cpnt_list_chatbubble_download_button_base": "black/opacity40",
|
|
349
|
+
"sys_cpnt_sheet_base_11": "grey10",
|
|
350
|
+
"sys_cpnt_sheet_base_12": "white/opacity20",
|
|
351
|
+
"sys_sw_sidebar_item_text_emphasis": "darkgreen500",
|
|
352
|
+
"sys_sw_sidebar_item_icon_emphasis": "darkgreen500",
|
|
353
|
+
"sys_sw_sidebar_divider_vertical": "darkgrey100",
|
|
354
|
+
"sys_cpnt_sheet_base_13": "grey50",
|
|
355
|
+
"sys_cpnt_sheet_base_14": "grey900"
|
|
348
356
|
}
|
|
@@ -841,5 +841,14 @@
|
|
|
841
841
|
"ui_110": "sys_component_base_black_opacity50",
|
|
842
842
|
"ui_contentscontainer03_background": "sys_container_background_01",
|
|
843
843
|
"ui_contents_dimmed": "sys_component_base_46",
|
|
844
|
-
"ui_cpnt_list_chatbubble_base_transparent": "sys_component_base_white_opacity00"
|
|
844
|
+
"ui_cpnt_list_chatbubble_base_transparent": "sys_component_base_white_opacity00",
|
|
845
|
+
"ui_cpnt_list_chatbubble_download_button_base": "sys_cpnt_list_chatbubble_download_button_base",
|
|
846
|
+
"ui_111": "sys_cpnt_sheet_base_11",
|
|
847
|
+
"ui_112": "sys_cpnt_sheet_base_12",
|
|
848
|
+
"ui_sw_sidebar_label_text_emphasis": "sys_sw_sidebar_item_text_emphasis",
|
|
849
|
+
"ui_cpnt_sidebar_label_icon_green": "sys_sw_sidebar_item_icon_emphasis",
|
|
850
|
+
"ui_sw_sidebar_divider_vertical": "sys_sw_sidebar_divider_vertical",
|
|
851
|
+
"ui_113": "sys_cpnt_sheet_base_13",
|
|
852
|
+
"ui_114": "sys_component_base_26",
|
|
853
|
+
"ui_115": "sys_cpnt_sheet_base_14"
|
|
845
854
|
}
|