es-application-template 0.0.7

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.
Files changed (80) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/LICENSE +21 -0
  3. package/README.md +127 -0
  4. package/dist/api/index.d.ts +21 -0
  5. package/dist/components/input/index.d.ts +3 -0
  6. package/dist/components/input/input-switch/index.d.ts +24 -0
  7. package/dist/components/input/input-text/index.d.ts +35 -0
  8. package/dist/components/modal-header/index.d.ts +2 -0
  9. package/dist/components/notifications/index.d.ts +2 -0
  10. package/dist/components/select/select/index.d.ts +35 -0
  11. package/dist/components/sidebar/index.d.ts +14 -0
  12. package/dist/config/config-cache.d.ts +71 -0
  13. package/dist/config/config-document.d.ts +26 -0
  14. package/dist/config/config-storage.d.ts +15 -0
  15. package/dist/config/config-utils.d.ts +8 -0
  16. package/dist/config/mock-store.d.ts +41 -0
  17. package/dist/config/runtime-identity.d.ts +4 -0
  18. package/dist/config/use-runtime-config.d.ts +21 -0
  19. package/dist/domain/constants/index.d.ts +18 -0
  20. package/dist/domain/models/IConfig.d.ts +28 -0
  21. package/dist/domain/models/IProductsDeploy.d.ts +6 -0
  22. package/dist/index.d.ts +2 -0
  23. package/dist/index.js +6660 -0
  24. package/dist/index.js.map +1 -0
  25. package/dist/index.mjs +6641 -0
  26. package/dist/index.mjs.map +1 -0
  27. package/dist/infra/api/auth/index.d.ts +1 -0
  28. package/dist/infra/api/requester.d.ts +6 -0
  29. package/dist/management/components/admin-list-page.d.ts +15 -0
  30. package/dist/management/setting-keys/config-tree/ConfigTreeGridEditor.d.ts +14 -0
  31. package/dist/management/setting-keys/config-tree/ConfigTreeJsonDrawer.d.ts +13 -0
  32. package/dist/management/setting-keys/config-tree/ConfigTreeReviewChrome.d.ts +4 -0
  33. package/dist/management/setting-keys/config-tree/ConfigTreeRulesDrawer.d.ts +7 -0
  34. package/dist/management/setting-keys/config-tree/TreeSelect.d.ts +10 -0
  35. package/dist/management/setting-keys/config-tree/config-tree-value.d.ts +115 -0
  36. package/dist/management/setting-keys/index.d.ts +2 -0
  37. package/dist/management/shortcuts/index.d.ts +6 -0
  38. package/dist/management/shortcuts/shortcut-capture-cell.d.ts +9 -0
  39. package/dist/management/shortcuts/shortcut-management-utils.d.ts +17 -0
  40. package/dist/management/shortcuts/use-shortcut-settings-editor.d.ts +21 -0
  41. package/dist/package/index.d.ts +9 -0
  42. package/dist/runtime/AppProvider.d.ts +9 -0
  43. package/dist/settings/core/setting-reader.d.ts +10 -0
  44. package/dist/settings/core/setting.d.ts +5 -0
  45. package/dist/settings/core/types.d.ts +14 -0
  46. package/dist/settings/runtime/SettingRuntime.d.ts +4 -0
  47. package/dist/settings/runtime/use-setting-document.d.ts +5 -0
  48. package/dist/shortcuts/core/ShortcutProvider.d.ts +15 -0
  49. package/dist/shortcuts/core/ShortcutScopes.d.ts +16 -0
  50. package/dist/shortcuts/core/Shortcuts.d.ts +16 -0
  51. package/dist/shortcuts/core/advanced.d.ts +4 -0
  52. package/dist/shortcuts/core/conflict.d.ts +14 -0
  53. package/dist/shortcuts/core/constants.d.ts +58 -0
  54. package/dist/shortcuts/core/defaults.d.ts +8 -0
  55. package/dist/shortcuts/core/index.d.ts +8 -0
  56. package/dist/shortcuts/core/key-normalizer.d.ts +15 -0
  57. package/dist/shortcuts/core/migrate.d.ts +6 -0
  58. package/dist/shortcuts/core/registry.d.ts +134 -0
  59. package/dist/shortcuts/core/reserved-keys.d.ts +9 -0
  60. package/dist/shortcuts/core/resolve.d.ts +2 -0
  61. package/dist/shortcuts/core/runtime.d.ts +17 -0
  62. package/dist/shortcuts/core/shortcut-binding.d.ts +26 -0
  63. package/dist/shortcuts/core/shortcut-command.d.ts +44 -0
  64. package/dist/shortcuts/core/shortcut-config.d.ts +25 -0
  65. package/dist/shortcuts/core/shortcut-dom-policy.d.ts +13 -0
  66. package/dist/shortcuts/core/shortcut-platform.d.ts +7 -0
  67. package/dist/shortcuts/core/shortcut-runtime-context.d.ts +8 -0
  68. package/dist/shortcuts/core/types.d.ts +54 -0
  69. package/dist/shortcuts/core/use-shortcut-binding.d.ts +14 -0
  70. package/dist/shortcuts/core/use-shortcut-context.d.ts +35 -0
  71. package/dist/shortcuts/runtime/ShortcutGlobalActions.d.ts +7 -0
  72. package/dist/shortcuts/runtime/ShortcutRuntime.d.ts +9 -0
  73. package/dist/shortcuts/runtime/ShortcutTooltip.d.ts +11 -0
  74. package/dist/shortcuts/runtime/app-shortcut-dom-policy.d.ts +2 -0
  75. package/dist/shortcuts/runtime/constants.d.ts +2 -0
  76. package/dist/shortcuts/runtime/use-shortcut-runtime-config.d.ts +3 -0
  77. package/dist/styles/index.css +437 -0
  78. package/dist/utility/Utils.d.ts +4 -0
  79. package/dist/utility/hooks/isNullOrUndefined.d.ts +1 -0
  80. package/package.json +76 -0
@@ -0,0 +1,13 @@
1
+ import { ConfigTreeRow } from './config-tree-value';
2
+ export type ConfigTreeJsonMode = 'VIEW' | 'IMPORT';
3
+ export type ConfigTreeImportMode = 'MERGE' | 'REPLACE';
4
+ type Props = {
5
+ open: boolean;
6
+ onClose: () => void;
7
+ rows: ConfigTreeRow[];
8
+ mode?: ConfigTreeJsonMode;
9
+ onApply?: (rows: ConfigTreeRow[]) => void;
10
+ fileName?: string;
11
+ };
12
+ declare const ConfigTreeJsonDrawer: ({ open, onClose, rows, mode, onApply, fileName }: Props) => import("react/jsx-runtime").JSX.Element;
13
+ export default ConfigTreeJsonDrawer;
@@ -0,0 +1,4 @@
1
+ import { ConfigTreeRow } from './config-tree-value';
2
+ export declare const ConfigTreeGridFooter: ({ rows }: {
3
+ rows: ConfigTreeRow[];
4
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,7 @@
1
+ import './ConfigTreeRulesDrawer.scss';
2
+ type Props = {
3
+ open: boolean;
4
+ onClose: () => void;
5
+ };
6
+ declare const ConfigTreeRulesDrawer: ({ open, onClose }: Props) => import("react/jsx-runtime").JSX.Element;
7
+ export default ConfigTreeRulesDrawer;
@@ -0,0 +1,10 @@
1
+ import { ConfigFeatureOption } from './config-tree-value';
2
+ import './select-tree.scss';
3
+ type Props = {
4
+ options: ConfigFeatureOption[];
5
+ value: string | null;
6
+ onChange: (value: string | null) => void;
7
+ placeholder?: string;
8
+ };
9
+ declare const TreeSelect: ({ options, value, onChange, placeholder }: Props) => import("react/jsx-runtime").JSX.Element;
10
+ export default TreeSelect;
@@ -0,0 +1,115 @@
1
+ export type ConfigLeafType = 'string' | 'boolean' | 'number' | 'date' | 'datetime' | 'guid' | 'json';
2
+ /**
3
+ * `feature` chỉ là metadata của Grid.
4
+ * Không ghi `feature` vào Config.Value.
5
+ */
6
+ export type ConfigGridType = ConfigLeafType | 'feature' | '';
7
+ export type ConfigTreeRow = {
8
+ rowId: string;
9
+ parentId?: string;
10
+ key: string;
11
+ type?: ConfigGridType;
12
+ value?: unknown;
13
+ description?: string;
14
+ children?: ConfigTreeRow[];
15
+ level?: number;
16
+ };
17
+ export type ConfigFeatureOption = {
18
+ value: string;
19
+ label: string;
20
+ children?: ConfigFeatureOption[];
21
+ };
22
+ export type ConfigTreeValidationError = {
23
+ rowId?: string;
24
+ path: string;
25
+ field: 'key' | 'type' | 'value' | 'tree';
26
+ message: string;
27
+ };
28
+ export type ParseConfigTreeResult = {
29
+ rows: ConfigTreeRow[];
30
+ error?: string;
31
+ };
32
+ export declare const CONFIG_TYPE_OPTIONS: Array<{
33
+ value: ConfigGridType;
34
+ label: string;
35
+ }>;
36
+ /**
37
+ * Khung rỗng tối thiểu của một Feature.
38
+ *
39
+ * Chỉ sinh các nhóm để người dùng thêm setting thật:
40
+ * - ui.list / ui.form
41
+ * - behavior
42
+ * - default
43
+ * - option
44
+ *
45
+ * Không sinh key mẫu hoặc value mặc định để tránh lưu nhầm placeholder
46
+ * hay vô tình thay đổi behavior của Feature. Các nhóm chuẩn là convention,
47
+ * không phải whitelist; custom key/namespace vẫn được phép.
48
+ */
49
+ export declare const createMinimalFeatureChildren: () => ConfigTreeRow[];
50
+ /**
51
+ * Parse riêng cho Import: chỉ nhận đúng document mà tree serializer có thể
52
+ * round-trip, tránh âm thầm biến primitive/array hoặc leaf sai schema thành {}.
53
+ */
54
+ export declare const parseConfigImportValueToRows: (value?: string | null) => ParseConfigTreeResult;
55
+ /**
56
+ * Edit:
57
+ * - root khác common => type=feature
58
+ * - group => children, type/value rỗng
59
+ * - leaf => giữ type/value/description
60
+ */
61
+ export declare const parseConfigValueToRows: (value?: string | null) => ParseConfigTreeResult;
62
+ export declare const cloneConfigRows: (rows: ConfigTreeRow[]) => ConfigTreeRow[];
63
+ /**
64
+ * Grid trả dữ liệu paste dưới dạng phẳng và không mang parentId/level.
65
+ * Khi paste một nhánh vừa copy từ chính Grid vào dòng trống, tìm lại nhánh
66
+ * nguồn theo các cột đã copy rồi ánh xạ cấu trúc đó sang các rowId mới.
67
+ */
68
+ export declare const restoreConfigTreePasteHierarchy: (sourceRows: ConfigTreeRow[], pastedRows: ConfigTreeRow[], pastedColumns: string[]) => ConfigTreeRow[];
69
+ /**
70
+ * Normalize metadata sau callback native của Grid.
71
+ * Không chứa logic ADD/DELETE/INSERT/DUPLICATE.
72
+ */
73
+ export declare const normalizeConfigTreeRows: (rows: ConfigTreeRow[]) => ConfigTreeRow[];
74
+ /**
75
+ * User chọn Type=feature cho một root row do Grid native ADD tạo ra.
76
+ * Chưa sinh template ở bước này.
77
+ */
78
+ export declare const markRowAsFeature: (rows: ConfigTreeRow[], rowId: string) => ConfigTreeRow[];
79
+ /**
80
+ * User chọn Resource.Code ở Key của root type=feature.
81
+ * Lúc này mới sinh minimal template nếu root chưa có children.
82
+ */
83
+ export declare const hydrateFeatureRow: (rows: ConfigTreeRow[], rowId: string, feature: ConfigFeatureOption) => ConfigTreeRow[];
84
+ export declare const hasFeatureRoot: (rows: ConfigTreeRow[], featureCode: string, exceptRowId?: string) => boolean;
85
+ /**
86
+ * Không làm mất root cũ khi Resource API không còn trả Feature đó.
87
+ */
88
+ export declare const mergeFeatureOptionsWithStoredRoots: (options: ConfigFeatureOption[], rows: ConfigTreeRow[]) => ConfigFeatureOption[];
89
+ export declare const flattenFeatureOptions: (options: ConfigFeatureOption[]) => ConfigFeatureOption[];
90
+ /**
91
+ * Serialize đúng storage:
92
+ * - root Feature chỉ là property JSON
93
+ * - không ghi type=feature
94
+ * - không schemaVersion
95
+ * - không settings wrapper
96
+ * - không ProductCode trong JSON
97
+ */
98
+ export declare const serializeConfigRowsObject: (rows: ConfigTreeRow[]) => Record<string, unknown>;
99
+ export declare const serializeConfigRows: (rows: ConfigTreeRow[]) => string;
100
+ export declare const serializeConfigRowsPretty: (rows: ConfigTreeRow[]) => string;
101
+ /**
102
+ * Merge JSON import theo key tree:
103
+ * - key mới => thêm
104
+ * - key trùng => dữ liệu import ghi đè node/leaf hiện tại
105
+ * - key không có trong file import => giữ nguyên
106
+ */
107
+ export declare const mergeConfigTreeRows: (currentRows: ConfigTreeRow[], importedRows: ConfigTreeRow[]) => ConfigTreeRow[];
108
+ export declare const countConfigNodes: (rows: ConfigTreeRow[]) => number;
109
+ export declare const validateConfigTreeRows: (rows: ConfigTreeRow[]) => ConfigTreeValidationError[];
110
+ export type ConfigTreeImportPreview = {
111
+ rows: ConfigTreeRow[];
112
+ errors: string[];
113
+ ready: boolean;
114
+ };
115
+ export declare const prepareConfigTreeImport: (currentRows: ConfigTreeRow[], importText: string, importMode: "MERGE" | "REPLACE") => ConfigTreeImportPreview;
@@ -0,0 +1,2 @@
1
+ declare const SettingsPage: () => import("react/jsx-runtime").JSX.Element;
2
+ export default SettingsPage;
@@ -0,0 +1,6 @@
1
+ import './shortcut.scss';
2
+ export type ShortcutsPageProps = {
3
+ active?: boolean;
4
+ };
5
+ declare const ShortcutsPage: ({ active }: ShortcutsPageProps) => import("react/jsx-runtime").JSX.Element;
6
+ export default ShortcutsPage;
@@ -0,0 +1,9 @@
1
+ import { ResolvedShortcutRow, ShortcutActionId, ShortcutBinding } from '../../shortcuts/core/runtime';
2
+ type ShortcutCaptureCellProps = {
3
+ row: ResolvedShortcutRow;
4
+ rows: ResolvedShortcutRow[];
5
+ disabled?: boolean;
6
+ onChange: (actionId: ShortcutActionId, binding: ShortcutBinding | null) => void;
7
+ };
8
+ declare const ShortcutCaptureCell: ({ row, rows, disabled, onChange }: ShortcutCaptureCellProps) => import("react/jsx-runtime").JSX.Element;
9
+ export default ShortcutCaptureCell;
@@ -0,0 +1,17 @@
1
+ import { ResolvedShortcutRow, ShortcutActionConfig, ShortcutActionId, ShortcutBinding, ShortcutConfigDocument, ShortcutGroup, ShortcutPlatform } from '../../shortcuts/core/runtime';
2
+ export type ShortcutManagementStatus = 'ALL' | 'ASSIGNED' | 'UNASSIGNED' | 'CUSTOMIZED' | 'INACTIVE' | 'LOCKED' | 'CONFLICT';
3
+ type ShortcutManagementFilters = {
4
+ keyword: string;
5
+ group: 'ALL' | ShortcutGroup;
6
+ status: ShortcutManagementStatus;
7
+ platform: ShortcutPlatform;
8
+ };
9
+ export declare const patchUserShortcutAction: (overrides: ShortcutConfigDocument["actions"] | undefined, row: ResolvedShortcutRow, patch: ShortcutActionConfig) => ShortcutConfigDocument["actions"];
10
+ export declare const removeUserShortcutAction: (overrides: ShortcutConfigDocument["actions"] | undefined, actionId: ShortcutActionId) => ShortcutConfigDocument["actions"];
11
+ export declare const findShortcutRowsValidationError: (rows: ResolvedShortcutRow[], platform: ShortcutPlatform) => string | null;
12
+ export declare const filterShortcutRows: (rows: ResolvedShortcutRow[], filters: ShortcutManagementFilters) => ResolvedShortcutRow[];
13
+ export type ShortcutBindingPatch = {
14
+ binding?: ShortcutBinding | null;
15
+ enabled?: boolean;
16
+ };
17
+ export {};
@@ -0,0 +1,21 @@
1
+ import { ShortcutConfigDocument } from '../../shortcuts/core/runtime';
2
+ import { IConfigIdentity } from '../../domain/models/IConfig';
3
+ export declare const useShortcutSettingsEditor: (identity: IConfigIdentity) => {
4
+ value: ShortcutConfigDocument;
5
+ setValue: (nextValue: ShortcutConfigDocument) => void;
6
+ save: (nextValue?: ShortcutConfigDocument) => Promise<boolean>;
7
+ resetAll: () => Promise<boolean>;
8
+ system: ShortcutConfigDocument;
9
+ inherited: ShortcutConfigDocument;
10
+ userStored: ShortcutConfigDocument;
11
+ effective: ShortcutConfigDocument;
12
+ ready: boolean;
13
+ loading: boolean;
14
+ fetching: boolean;
15
+ error: Error;
16
+ retry: () => Promise<void>;
17
+ saving: boolean;
18
+ resetting: boolean;
19
+ dirty: boolean;
20
+ dataMode: string;
21
+ };
@@ -0,0 +1,9 @@
1
+ import '../styles.scss';
2
+ export { AppProvider } from '../runtime/AppProvider';
3
+ export { SHORTCUT_ACTION, Shortcuts, useShortcutHint } from '../shortcuts/core';
4
+ export type { ShortcutActionId, ShortcutActions } from '../shortcuts/core';
5
+ export { ShortcutTooltip } from '../shortcuts/runtime/ShortcutTooltip';
6
+ export { ShortcutOverlayScope } from '../shortcuts/core/advanced';
7
+ export { setting } from '../settings/core/setting';
8
+ export { default as SettingsPage } from '../management/setting-keys';
9
+ export { default as ShortcutsPage } from '../management/shortcuts';
@@ -0,0 +1,9 @@
1
+ import { ReactNode } from 'react';
2
+ type AppProviderProps = {
3
+ children: ReactNode;
4
+ dashboardPath?: string;
5
+ shortcutSettingsPath?: string;
6
+ onSearch?: () => void;
7
+ };
8
+ export declare const AppProvider: ({ children, dashboardPath, shortcutSettingsPath, onSearch }: AppProviderProps) => import("react/jsx-runtime").JSX.Element;
9
+ export {};
@@ -0,0 +1,10 @@
1
+ import { SettingDocument, SettingReader } from './types';
2
+ type InternalSettingReader = SettingReader & {
3
+ has: (key: string) => boolean;
4
+ };
5
+ export type SettingRegistry = {
6
+ forResource: (resourceCode: string) => InternalSettingReader;
7
+ };
8
+ export declare const createSettingRegistry: (document?: SettingDocument) => SettingRegistry;
9
+ export declare const createSettingReader: (document: SettingDocument, resourceCode: string) => InternalSettingReader;
10
+ export type { InternalSettingReader };
@@ -0,0 +1,5 @@
1
+ import { SettingDocument, SettingReader } from './types';
2
+ export declare const setSettingDocument: (document?: SettingDocument) => void;
3
+ type SettingAccessor = Pick<SettingReader, 'get'>;
4
+ export declare const setting: SettingAccessor;
5
+ export {};
@@ -0,0 +1,14 @@
1
+ export type SettingLeafType = 'string' | 'boolean' | 'number' | 'date' | 'datetime' | 'guid' | 'json';
2
+ export type SettingLeaf<T = unknown> = {
3
+ type?: SettingLeafType | string;
4
+ value: T;
5
+ description?: string;
6
+ };
7
+ export type SettingDocument = Record<string, unknown>;
8
+ export type SettingReader = {
9
+ resourceCode: string;
10
+ get: {
11
+ <T>(key: string): T | undefined;
12
+ <T>(key: string, fallback: T): T;
13
+ };
14
+ };
@@ -0,0 +1,4 @@
1
+ import { ReactNode } from 'react';
2
+ export declare const SettingRuntime: ({ children }: {
3
+ children: ReactNode;
4
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { SettingDocument } from '../core/types';
2
+ export declare const useSettingDocument: () => {
3
+ document: SettingDocument;
4
+ ready: boolean;
5
+ };
@@ -0,0 +1,15 @@
1
+ import { ReactNode } from 'react';
2
+ import { ShortcutActionId } from './constants';
3
+ import { ShortcutDomPolicyOverride } from './shortcut-dom-policy';
4
+ import { ShortcutConfigDocument } from './types';
5
+ export type ShortcutProviderProps = {
6
+ children: ReactNode;
7
+ config?: ShortcutConfigDocument;
8
+ domPolicy?: ShortcutDomPolicyOverride;
9
+ fallbackExecutor?: (actionId: ShortcutActionId) => boolean;
10
+ };
11
+ /**
12
+ * Portable keyboard runtime. Loading config/identity belongs to the product
13
+ * product integration layer (for example the package ShortcutRuntime).
14
+ */
15
+ export declare const ShortcutProvider: ({ children, config, domPolicy, fallbackExecutor }: ShortcutProviderProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,16 @@
1
+ import { HTMLAttributes, ReactNode } from 'react';
2
+ import { ShortcutCommandMap } from './shortcut-command';
3
+ export type ShortcutLogicalScopeProps = {
4
+ children: ReactNode;
5
+ commands?: ShortcutCommandMap;
6
+ active?: boolean;
7
+ };
8
+ export type ShortcutDomScopeProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & ShortcutLogicalScopeProps;
9
+ export type ShortcutOverlayScopeProps = Omit<ShortcutLogicalScopeProps, 'active'> & {
10
+ active: boolean;
11
+ };
12
+ export declare const ShortcutPageScope: (props: ShortcutLogicalScopeProps) => import("react/jsx-runtime").JSX.Element;
13
+ export declare const ShortcutOverlayScope: (props: ShortcutOverlayScopeProps) => import("react/jsx-runtime").JSX.Element;
14
+ export declare const ShortcutGridScope: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement>, "children"> & ShortcutLogicalScopeProps & import("react").RefAttributes<HTMLDivElement>>;
15
+ export declare const ShortcutFormScope: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement>, "children"> & ShortcutLogicalScopeProps & import("react").RefAttributes<HTMLDivElement>>;
16
+ export declare const ShortcutControlScope: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement>, "children"> & ShortcutLogicalScopeProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,16 @@
1
+ import { ShortcutActionId } from './constants';
2
+ import { ShortcutCommand } from './shortcut-command';
3
+ import { ShortcutHandler } from './registry';
4
+ export type ShortcutActionHandler = ShortcutHandler | ShortcutCommand;
5
+ export type ShortcutActions = Partial<Record<ShortcutActionId, ShortcutActionHandler>>;
6
+ export type ShortcutsProps = {
7
+ actions?: ShortcutActions;
8
+ };
9
+ /**
10
+ * Feature-facing shortcut API.
11
+ *
12
+ * Feature code only declares semantic Action -> Handler (+ Enabled when needed).
13
+ * Keyboard bindings, context resolution, owner tracking and overlay barriers stay
14
+ * inside Shortcut Core.
15
+ */
16
+ export declare const Shortcuts: ({ actions }: ShortcutsProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,4 @@
1
+ export { ShortcutCommands, useGlobalShortcutCommand, useShortcutCommand } from './shortcut-command';
2
+ export type { ShortcutCommand, ShortcutCommandMap, UseShortcutCommandOptions } from './shortcut-command';
3
+ export { ShortcutControlScope, ShortcutFormScope, ShortcutGridScope, ShortcutOverlayScope, ShortcutPageScope } from './ShortcutScopes';
4
+ export type { ShortcutDomScopeProps, ShortcutLogicalScopeProps, ShortcutOverlayScopeProps } from './ShortcutScopes';
@@ -0,0 +1,14 @@
1
+ import { ShortcutActionId } from './constants';
2
+ import { ResolvedShortcutRow, ShortcutBinding } from './types';
3
+ export type ShortcutConflict = {
4
+ item: ResolvedShortcutRow;
5
+ severity: 'error';
6
+ };
7
+ /**
8
+ * Catalog shortcut là catalog ACTION CHUNG.
9
+ *
10
+ * Một tổ hợp chỉ được ánh xạ tới một actionId trên toàn hệ thống.
11
+ * `Primary` được kiểm tra trên Windows/macOS/Linux để cùng một config không
12
+ * trở nên mơ hồ khi người dùng đổi thiết bị.
13
+ */
14
+ export declare const findShortcutConflict: (rows: ResolvedShortcutRow[], actionId: ShortcutActionId, binding: ShortcutBinding) => ShortcutConflict | null;
@@ -0,0 +1,58 @@
1
+ export declare const SHORTCUT_SCHEMA_VERSION: 4;
2
+ export declare const SHORTCUT_ACTION: {
3
+ readonly GLOBAL_SEARCH: "global.search";
4
+ readonly GLOBAL_DASHBOARD: "global.dashboard";
5
+ readonly GLOBAL_SHORTCUTS: "global.shortcuts";
6
+ readonly RECORD_CREATE: "record.create";
7
+ readonly RECORD_VIEW: "record.view";
8
+ readonly RECORD_EDIT: "record.edit";
9
+ readonly RECORD_DELETE: "record.delete";
10
+ readonly RECORD_COPY: "record.copy";
11
+ readonly RECORD_SELECT_ALL: "record.select-all";
12
+ readonly LIST_SEARCH: "list.search";
13
+ readonly LIST_FILTER: "list.filter";
14
+ readonly LIST_CLEAR_FILTER: "list.clear-filter";
15
+ readonly GRID_REFRESH: "grid.refresh";
16
+ readonly HISTORY_VIEW: "history.view";
17
+ readonly GRID_INSERT_BEFORE: "grid.insert-before";
18
+ readonly GRID_INSERT_AFTER: "grid.insert-after";
19
+ readonly GRID_INSERT_CHILD: "grid.insert-child";
20
+ readonly GRID_DELETE_ALL: "grid.delete-all";
21
+ readonly GRID_MOVE_UP: "grid.move-up";
22
+ readonly GRID_MOVE_DOWN: "grid.move-down";
23
+ readonly GRID_COLUMN_CHOOSER: "grid.column-chooser";
24
+ readonly GRID_GROUP: "grid.group";
25
+ readonly GRID_FULLSCREEN: "grid.fullscreen";
26
+ readonly GRID_EXPAND_ALL: "grid.expand-all";
27
+ readonly GRID_COLLAPSE_ALL: "grid.collapse-all";
28
+ readonly FORM_SAVE: "form.save";
29
+ readonly FORM_SAVE_CLOSE: "form.save-close";
30
+ readonly FORM_RESET: "form.reset";
31
+ readonly OVERLAY_CLOSE: "overlay.close";
32
+ readonly DIALOG_CONFIRM: "dialog.confirm";
33
+ readonly DATA_IMPORT: "data.import";
34
+ readonly DATA_EXPORT: "data.export";
35
+ readonly EXPORT_EXCEL: "export.excel";
36
+ readonly EXPORT_PDF: "export.pdf";
37
+ readonly DOCUMENT_PRINT: "document.print";
38
+ readonly FILE_UPLOAD: "file.upload";
39
+ readonly FILE_DOWNLOAD: "file.download";
40
+ readonly FILE_ATTACH: "file.attach";
41
+ readonly DATA_DOWNLOAD_TEMPLATE: "data.download-template";
42
+ readonly WORKFLOW_SUBMIT: "workflow.submit";
43
+ readonly WORKFLOW_HANDLE: "workflow.handle";
44
+ readonly WORKFLOW_APPROVE: "workflow.approve";
45
+ readonly WORKFLOW_REJECT: "workflow.reject";
46
+ readonly WORKFLOW_CANCEL: "workflow.cancel";
47
+ readonly WORKFLOW_RECALL: "workflow.recall";
48
+ readonly WORKFLOW_VIEW_PROCESS: "workflow.view-process";
49
+ readonly WORKFLOW_RESET_PROCESS: "workflow.reset-process";
50
+ readonly WORKFLOW_COMMENT: "workflow.comment";
51
+ readonly WORKFLOW_VIEW_COMMENTS: "workflow.view-comments";
52
+ readonly WORKFLOW_LOCK: "workflow.lock";
53
+ readonly WORKFLOW_UNLOCK: "workflow.unlock";
54
+ readonly WORKFLOW_FINISH: "workflow.finish";
55
+ readonly WORKFLOW_TRANSFER: "workflow.transfer";
56
+ readonly COMMUNICATION_SEND_EMAIL: "communication.send-email";
57
+ };
58
+ export type ShortcutActionId = typeof SHORTCUT_ACTION[keyof typeof SHORTCUT_ACTION];
@@ -0,0 +1,8 @@
1
+ import { ShortcutAction, ShortcutConfigDocument, ShortcutGroup } from './types';
2
+ export declare const shortcutGroupLabels: Record<ShortcutGroup, string>;
3
+ export declare const shortcutGroupOptions: {
4
+ value: string;
5
+ label: string;
6
+ }[];
7
+ export declare const shortcutActions: ShortcutAction[];
8
+ export declare const shortcutConfigDefaults: ShortcutConfigDocument;
@@ -0,0 +1,8 @@
1
+ export { Shortcuts } from './Shortcuts';
2
+ export type { ShortcutActionHandler, ShortcutActions, ShortcutsProps } from './Shortcuts';
3
+ export { SHORTCUT_ACTION } from './constants';
4
+ export type { ShortcutActionId } from './constants';
5
+ export { formatShortcutBinding } from './shortcut-binding';
6
+ export { useShortcutBinding, useShortcutHint } from './use-shortcut-binding';
7
+ export type { ShortcutHint } from './use-shortcut-binding';
8
+ export type { ShortcutBinding, ShortcutModifier } from './types';
@@ -0,0 +1,15 @@
1
+ import { ShortcutBinding } from './types';
2
+ export declare const bindingKey: (binding?: ShortcutBinding | null) => string;
3
+ export declare const bindingEquals: (left?: ShortcutBinding | null, right?: ShortcutBinding | null) => boolean;
4
+ export declare const shortcutBindingFromEvent: (event: KeyboardEvent) => ShortcutBinding | null;
5
+ export declare const normalizeShortcutText: (value: string) => string;
6
+ export declare const shortcutFromKeyboardEvent: (event: KeyboardEvent) => string;
7
+ export declare const isEditableTarget: (target: EventTarget | null, productSelector?: string) => boolean;
8
+ export declare const isNativeInteractiveTarget: (target: EventTarget | null) => boolean;
9
+ export declare const isNativeInteractiveBinding: (binding: ShortcutBinding | null) => boolean;
10
+ /**
11
+ * Returns true when the focused control owns the key before the application
12
+ * shortcut layer. In particular, Esc must close an open select/menu popup
13
+ * before it is allowed to close the containing modal.
14
+ */
15
+ export declare const isNativeShortcutOwned: (target: EventTarget | null, binding: ShortcutBinding | null, productPopupSelector?: string) => boolean;
@@ -0,0 +1,6 @@
1
+ import { bindingEquals, bindingKey } from './key-normalizer';
2
+ import { ShortcutBinding, ShortcutCatalogItem, ShortcutConfigDocument } from './types';
3
+ export { bindingEquals, bindingKey };
4
+ export declare const normalizeShortcutBindingValue: (value: any) => ShortcutBinding | undefined;
5
+ export declare const legacyShortcutKeysToBinding: (value?: string | null) => ShortcutBinding | undefined;
6
+ export declare const normalizeShortcutDocument: (value: any, catalog: ShortcutCatalogItem[]) => ShortcutConfigDocument;
@@ -0,0 +1,134 @@
1
+ import { ShortcutActionId } from './constants';
2
+ import { ShortcutDomPolicy } from './shortcut-dom-policy';
3
+ export type ShortcutHandlerContext = 'global' | 'workspace' | 'page' | 'grid' | 'form' | 'control' | 'overlay';
4
+ export type ShortcutHandler = (event?: KeyboardEvent) => void | Promise<void>;
5
+ export declare const GLOBAL_SHORTCUT_CONTEXT_ID = "shortcut:global";
6
+ export type ShortcutContextRegistration = {
7
+ id: string;
8
+ type: ShortcutHandlerContext;
9
+ parentId?: string;
10
+ enabled?: boolean;
11
+ owner?: Element | null;
12
+ };
13
+ export type ShortcutRegistration = {
14
+ actionId: ShortcutActionId;
15
+ contextId: string;
16
+ priority?: number;
17
+ enabled?: () => boolean;
18
+ handler: ShortcutHandler;
19
+ };
20
+ export type ShortcutDispatchOptions = {
21
+ event?: Event;
22
+ target?: EventTarget | null;
23
+ path?: EventTarget[];
24
+ domPolicy?: ShortcutDomPolicy;
25
+ };
26
+ export type ShortcutDispatchResult = {
27
+ status: 'handled' | 'blocked' | 'unhandled';
28
+ consume: boolean;
29
+ reason?: 'disabled' | 'context-barrier' | 'ambiguous-context' | 'no-handler';
30
+ };
31
+ export type ShortcutRegistrySnapshot = {
32
+ activeContextIds: string[];
33
+ barrierContextId?: string;
34
+ contexts: Array<{
35
+ id: string;
36
+ type: ShortcutHandlerContext;
37
+ parentId?: string;
38
+ enabled: boolean;
39
+ activated: boolean;
40
+ hasOwner: boolean;
41
+ }>;
42
+ };
43
+ export type ShortcutOwnerContextLease = {
44
+ contextId: string;
45
+ release: () => void;
46
+ };
47
+ declare class ShortcutRegistry {
48
+ private contexts;
49
+ private entries;
50
+ private order;
51
+ private activationOrder;
52
+ private ownerContextOrder;
53
+ private ownerContexts;
54
+ private autoOwnerContextIds;
55
+ constructor();
56
+ registerContext(context: ShortcutContextRegistration): () => void;
57
+ setContextOwner(contextId: string, owner: Element | null): void;
58
+ activateContext(contextId: string, owner?: Element | null): void;
59
+ deactivateContext(contextId: string): void;
60
+ setContextEnabled(contextId: string, enabled: boolean): void;
61
+ /**
62
+ * Acquires one stable runtime context for one real DOM owner. Multiple command
63
+ * registrars inside the same owner share the same context and release it only
64
+ * when the last registrar unmounts.
65
+ */
66
+ acquireOwnerContext(type: Exclude<ShortcutHandlerContext, 'global' | 'workspace'>, owner: Element): ShortcutOwnerContextLease;
67
+ register(registration: ShortcutRegistration): () => void;
68
+ /**
69
+ * Keeps Grid/Control interaction memory in sync with the real DOM owner.
70
+ * Overlay lifetime is resolved from the visible UI at dispatch time, so a
71
+ * feature never has to maintain activeModal/activeContext state.
72
+ */
73
+ syncActiveContexts(event: Event, domPolicy?: ShortcutDomPolicy): void;
74
+ private isContextEnabled;
75
+ private isContextActivated;
76
+ private isSameOrDescendant;
77
+ private contextDepth;
78
+ private getDispatchTarget;
79
+ private ownerPathIndex;
80
+ private contextOwnsTarget;
81
+ private isDocumentRootTarget;
82
+ /**
83
+ * A mounted owner is not necessarily part of the active UI. Workspace tabs,
84
+ * collapsed branches and closed overlays can stay mounted while an ancestor
85
+ * hides them, so fallback resolution must validate the whole DOM ancestry.
86
+ */
87
+ private isVisibleOwner;
88
+ private isVisibleOverlayElement;
89
+ /**
90
+ * Resolves the active route/tab DOM branch from the actual keyboard target.
91
+ * Fallback is deliberately disabled for targets outside the configured page
92
+ * boundary (navbar, unrelated portal, etc.) unless a blocking overlay owns
93
+ * the action.
94
+ */
95
+ private pageElementForElement;
96
+ private pageElementForTarget;
97
+ private overlayZIndex;
98
+ /** Returns the blocking UI layer that is actually visible on screen now. */
99
+ private topVisibleOverlayElement;
100
+ /** Compatibility path for old semantic OverlayScope registrations. */
101
+ private topActivatedOverlay;
102
+ private overlayContextForElement;
103
+ private contextWithinBarrier;
104
+ private ownerLeaf;
105
+ private activeLeaf;
106
+ private branchNode;
107
+ private ownerContextsForNode;
108
+ private appendParentChain;
109
+ private activeBranch;
110
+ private resolve;
111
+ /**
112
+ * Action-aware fallback for auto DOM contexts. Exact focus/owner resolution
113
+ * always wins first. Fallback only runs when the active branch has no handler.
114
+ *
115
+ * Selection policy:
116
+ * - never cross the top visible overlay barrier;
117
+ * - stay inside the current configured page route/tab when the event has a
118
+ * concrete target;
119
+ * - ignore mounted-but-hidden owners;
120
+ * - prefer the most recently interacted eligible owner;
121
+ * - otherwise use one unique eligible owner;
122
+ * - never guess when multiple equally valid owners remain.
123
+ */
124
+ private resolveActionFallback;
125
+ private hasHandlerOutsideBranch;
126
+ private isEntryEnabled;
127
+ private execute;
128
+ dispatch(actionId: ShortcutActionId, options?: ShortcutDispatchOptions): ShortcutDispatchResult;
129
+ hasExecutableHandler(actionId: ShortcutActionId, options?: ShortcutDispatchOptions): boolean;
130
+ /** Read-only diagnostics for development tools and integration tests. */
131
+ getDebugSnapshot(options?: ShortcutDispatchOptions): ShortcutRegistrySnapshot;
132
+ }
133
+ export declare const shortcutRegistry: ShortcutRegistry;
134
+ export {};
@@ -0,0 +1,9 @@
1
+ import { ShortcutActionId } from './constants';
2
+ import { ShortcutPlatform } from './shortcut-platform';
3
+ import { ShortcutBinding } from './types';
4
+ export declare const getProtectedShortcutActionId: (binding?: ShortcutBinding | null, platform?: ShortcutPlatform) => ShortcutActionId | undefined;
5
+ export declare const isProtectedShortcutBinding: (binding?: ShortcutBinding | null, actionId?: ShortcutActionId, platform?: ShortcutPlatform) => boolean;
6
+ export declare const isReservedShortcutBinding: (binding?: ShortcutBinding | null, actionId?: ShortcutActionId) => boolean;
7
+ export declare const validateShortcutBinding: (binding: ShortcutBinding, actionId: ShortcutActionId) => string | null;
8
+ /** Legacy text validator retained for older callers/import surfaces. */
9
+ export declare const validateShortcutKeys: (value: string) => string | null;
@@ -0,0 +1,2 @@
1
+ import { ResolvedShortcutRow, ShortcutCatalogItem, ShortcutConfigDocument } from './types';
2
+ export declare const resolveShortcutRows: (catalog: ShortcutCatalogItem[], document: ShortcutConfigDocument, inheritedDocument?: ShortcutConfigDocument) => ResolvedShortcutRow[];
@@ -0,0 +1,17 @@
1
+ export { ShortcutProvider } from './ShortcutProvider';
2
+ export type { ShortcutProviderProps } from './ShortcutProvider';
3
+ export { DEFAULT_SHORTCUT_DOM_POLICY, resolveShortcutDomPolicy } from './shortcut-dom-policy';
4
+ export type { ShortcutDomPolicy, ShortcutDomPolicyOverride } from './shortcut-dom-policy';
5
+ export { SHORTCUT_SCHEMA_VERSION } from './constants';
6
+ export type { ShortcutActionId } from './constants';
7
+ export { findShortcutConflict } from './conflict';
8
+ export { shortcutActions, shortcutConfigDefaults, shortcutGroupLabels, shortcutGroupOptions } from './defaults';
9
+ export { bindingEquals, normalizeShortcutDocument } from './migrate';
10
+ export { resolveShortcutRows } from './resolve';
11
+ export { isReservedShortcutBinding, validateShortcutBinding, validateShortcutKeys } from './reserved-keys';
12
+ export { formatShortcutBinding, shortcutBindingFromCaptureEvent } from './shortcut-binding';
13
+ export { buildUserShortcutSaveDocument, extractUserOverrides, mergeShortcutActionMaps, mergeShortcutDocuments, parseShortcutConfigValue, parseShortcutImport, resolveRuntimeShortcutDocument } from './shortcut-config';
14
+ export type { ShortcutImportIssue, ShortcutImportIssueCode, ShortcutImportResult } from './shortcut-config';
15
+ export { getShortcutPlatform, SUPPORTED_SHORTCUT_PLATFORMS } from './shortcut-platform';
16
+ export type { ShortcutPlatform } from './shortcut-platform';
17
+ export type { ResolvedShortcutRow, ShortcutAction, ShortcutActionConfig, ShortcutCatalogItem, ShortcutConfigDocument, ShortcutCustomizeMode, ShortcutGroup, ShortcutBinding, ShortcutModifier } from './types';