es-application-template 0.0.8 → 0.0.15

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 (48) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +50 -9
  3. package/dist/api/index.d.ts +14 -0
  4. package/dist/appearance/core/contrast.d.ts +30 -0
  5. package/dist/appearance/core/defaults.d.ts +5 -0
  6. package/dist/appearance/core/grid.d.ts +7 -0
  7. package/dist/appearance/core/index.d.ts +14 -0
  8. package/dist/appearance/core/migrate.d.ts +2 -0
  9. package/dist/appearance/core/options.d.ts +125 -0
  10. package/dist/appearance/core/presets.d.ts +22 -0
  11. package/dist/appearance/core/ranges.d.ts +313 -0
  12. package/dist/appearance/core/runtime.d.ts +4 -0
  13. package/dist/appearance/core/theme-constants.d.ts +13 -0
  14. package/dist/appearance/core/theme-presets.d.ts +3 -0
  15. package/dist/appearance/core/theme-types.d.ts +37 -0
  16. package/dist/appearance/core/theme-utils.d.ts +8 -0
  17. package/dist/appearance/core/types.d.ts +231 -0
  18. package/dist/appearance/core/validate.d.ts +5 -0
  19. package/dist/appearance/runtime/AppearanceRuntime.d.ts +6 -0
  20. package/dist/appearance/runtime/bootstrap.d.ts +4 -0
  21. package/dist/components/sidebar/index.d.ts +1 -0
  22. package/dist/config/config-document.d.ts +3 -2
  23. package/dist/config/use-runtime-config.d.ts +2 -1
  24. package/dist/config/use-runtime-identity.d.ts +1 -0
  25. package/dist/domain/constants/index.d.ts +8 -0
  26. package/dist/index.js +5463 -1155
  27. package/dist/index.js.map +1 -1
  28. package/dist/index.mjs +5474 -1170
  29. package/dist/index.mjs.map +1 -1
  30. package/dist/management/appearance/appearance-mode-control.d.ts +8 -0
  31. package/dist/management/appearance/appearance-number-field.d.ts +15 -0
  32. package/dist/management/appearance/appearance-preview.d.ts +12 -0
  33. package/dist/management/appearance/appearance-primitives.d.ts +95 -0
  34. package/dist/management/appearance/appearance-theme-library.d.ts +22 -0
  35. package/dist/management/appearance/appearance-theme-modal.d.ts +27 -0
  36. package/dist/management/appearance/appearance-workspace.d.ts +16 -0
  37. package/dist/management/appearance/index.d.ts +3 -0
  38. package/dist/management/appearance/use-appearance-theme-library.d.ts +25 -0
  39. package/dist/management/setting-keys/config-tree/setting-key-convention.d.ts +56 -0
  40. package/dist/package/index.d.ts +6 -1
  41. package/dist/styles/index.css +4696 -233
  42. package/package.json +3 -3
  43. package/dist/index.cjs +0 -6743
  44. package/dist/index.cjs.map +0 -1
  45. package/dist/styles.css +0 -438
  46. package/dist/styles.css.map +0 -1
  47. package/dist/views/es-application-template/management/setting-keys/config-tree/ConfigTreeGridEditor.d.ts +0 -14
  48. package/dist/views/es-application-template/management/setting-keys/config-tree/TreeSelect.d.ts +0 -10
@@ -0,0 +1,8 @@
1
+ import { AppearanceMode } from '../../appearance/core';
2
+ type AppearanceModeControlProps = {
3
+ value: AppearanceMode;
4
+ onChange: (value: AppearanceMode) => void;
5
+ disabled?: boolean;
6
+ };
7
+ declare const AppearanceModeControl: ({ value, onChange, disabled }: AppearanceModeControlProps) => import("react/jsx-runtime").JSX.Element;
8
+ export default AppearanceModeControl;
@@ -0,0 +1,15 @@
1
+ import { AppearanceOption } from '../../appearance/core';
2
+ type AppearanceNumberFieldProps = {
3
+ label: string;
4
+ value: number;
5
+ min: number;
6
+ max: number;
7
+ step?: number;
8
+ suffix?: string;
9
+ specialValues?: readonly number[];
10
+ options: Array<AppearanceOption<number>>;
11
+ onChange: (_value: number) => void;
12
+ onPreviewFocus?: () => void;
13
+ };
14
+ declare const AppearanceNumberField: ({ label, value, min, max, step, suffix, specialValues, options, onChange, onPreviewFocus }: AppearanceNumberFieldProps) => import("react/jsx-runtime").JSX.Element;
15
+ export default AppearanceNumberField;
@@ -0,0 +1,12 @@
1
+ import { AppearanceConfig } from '../../appearance/core';
2
+ import { Dispatch, ReactNode } from 'react';
3
+ type AppearancePreviewProps = {
4
+ config: AppearanceConfig;
5
+ mode: 'colors' | 'typography' | 'components' | 'layout';
6
+ activeSection?: string;
7
+ colorMode: 'light' | 'dark';
8
+ onColorModeChange: Dispatch<'light' | 'dark'>;
9
+ workspaceActions?: ReactNode;
10
+ };
11
+ declare const AppearancePreview: ({ config, mode, activeSection, colorMode, onColorModeChange, workspaceActions }: AppearancePreviewProps) => import("react/jsx-runtime").JSX.Element;
12
+ export default AppearancePreview;
@@ -0,0 +1,95 @@
1
+ import { ShortcutActionId } from '../../shortcuts/core';
2
+ import { ReactNode } from 'react';
3
+ export declare const StandardActions: ({ onCancel, onReset, onSave, cancelLabel, saveLabel, loading, extra, size, buttonClassName }: {
4
+ onCancel?: () => void;
5
+ onReset?: () => void;
6
+ onSave?: () => void;
7
+ cancelLabel?: string;
8
+ saveLabel?: string;
9
+ loading?: boolean;
10
+ extra?: ReactNode;
11
+ size?: "sm" | "lg";
12
+ buttonClassName?: string;
13
+ }) => import("react/jsx-runtime").JSX.Element;
14
+ export declare const SectionCard: ({ title, description, icon, actions, children, className, tone, headerClassName, bodyClassName, titleClassName, collapsible, collapsed, onToggleCollapsed }: {
15
+ title?: string;
16
+ description?: string;
17
+ icon?: ReactNode;
18
+ actions?: ReactNode;
19
+ children: ReactNode;
20
+ className?: string;
21
+ tone?: "default" | "info" | "success" | "warning" | "danger";
22
+ headerClassName?: string;
23
+ bodyClassName?: string;
24
+ titleClassName?: string;
25
+ collapsible?: boolean;
26
+ collapsed?: boolean;
27
+ onToggleCollapsed?: () => void;
28
+ }) => import("react/jsx-runtime").JSX.Element;
29
+ export declare const NoteBox: ({ children, tone, title }: {
30
+ children: ReactNode;
31
+ tone?: "info" | "success" | "warning" | "danger";
32
+ title?: string;
33
+ }) => import("react/jsx-runtime").JSX.Element;
34
+ export declare const FormField: ({ label, required, help, children, className, labelClassName }: {
35
+ label: string;
36
+ required?: boolean;
37
+ help?: string;
38
+ children: ReactNode;
39
+ className?: string;
40
+ labelClassName?: string;
41
+ }) => import("react/jsx-runtime").JSX.Element;
42
+ export declare const IconButton: ({ label, children, onClick, tone, disabled }: {
43
+ label: string;
44
+ children: ReactNode;
45
+ onClick?: () => void;
46
+ tone?: "default" | "danger" | "primary";
47
+ disabled?: boolean;
48
+ }) => import("react/jsx-runtime").JSX.Element;
49
+ export declare const SideDrawer: ({ open, title, subtitle, onClose, children, footer, width }: {
50
+ open: boolean;
51
+ title: string;
52
+ subtitle?: string;
53
+ onClose: () => void;
54
+ children: ReactNode;
55
+ footer?: ReactNode;
56
+ width?: number;
57
+ }) => import("react/jsx-runtime").JSX.Element;
58
+ export declare const ToolbarButton: ({ children, icon, onClick, variant, disabled, size, className, shortcutAction }: {
59
+ children: ReactNode;
60
+ icon?: ReactNode;
61
+ onClick?: () => void;
62
+ variant?: "outline" | "primary" | "danger";
63
+ disabled?: boolean;
64
+ size?: "sm" | "lg";
65
+ className?: string;
66
+ shortcutAction?: ShortcutActionId;
67
+ }) => import("react/jsx-runtime").JSX.Element;
68
+ type ColorFieldProps = {
69
+ value: string;
70
+ onChange: (value: string) => void;
71
+ };
72
+ export declare const ColorField: ({ value, onChange }: ColorFieldProps) => import("react/jsx-runtime").JSX.Element;
73
+ export type AdminSettingsTab = {
74
+ id: string;
75
+ label: string;
76
+ icon?: ReactNode;
77
+ badge?: ReactNode;
78
+ };
79
+ type AdminSettingsPageProps = {
80
+ title: string;
81
+ description?: string;
82
+ actions?: ReactNode;
83
+ tabs: AdminSettingsTab[];
84
+ activeTab: string;
85
+ onTabChange: (tabId: string) => void;
86
+ children: ReactNode;
87
+ className?: string;
88
+ headerClassName?: string;
89
+ titleClassName?: string;
90
+ descriptionClassName?: string;
91
+ tabClassName?: string;
92
+ fitContent?: boolean;
93
+ };
94
+ export declare const AdminSettingsPage: ({ title, description, actions, tabs, activeTab, onTabChange, children, className, headerClassName, titleClassName, descriptionClassName, tabClassName }: AdminSettingsPageProps) => import("react/jsx-runtime").JSX.Element;
95
+ export {};
@@ -0,0 +1,22 @@
1
+ import { AppearanceThemeRecord } from '../../appearance/core';
2
+ type AppearanceThemeLibraryProps = {
3
+ open: boolean;
4
+ themes: AppearanceThemeRecord[];
5
+ loading: boolean;
6
+ error?: unknown;
7
+ saving: boolean;
8
+ scopeLabel: string;
9
+ canApply: boolean;
10
+ activeThemeKey?: string;
11
+ customized?: boolean;
12
+ onClose: () => void;
13
+ onUse: (theme: AppearanceThemeRecord) => void;
14
+ onApply: (theme: AppearanceThemeRecord) => void;
15
+ onEdit: (theme: AppearanceThemeRecord) => void;
16
+ onCreate: () => void;
17
+ onDuplicate: (theme: AppearanceThemeRecord) => void;
18
+ onDelete: (theme: AppearanceThemeRecord) => void;
19
+ onRestore: (theme: AppearanceThemeRecord) => void;
20
+ };
21
+ declare const AppearanceThemeLibrary: ({ open, themes, loading, error, saving, scopeLabel, canApply, activeThemeKey, customized, onClose, onUse, onApply, onEdit, onCreate, onDuplicate, onDelete, onRestore }: AppearanceThemeLibraryProps) => import("react/jsx-runtime").JSX.Element;
22
+ export default AppearanceThemeLibrary;
@@ -0,0 +1,27 @@
1
+ import { AppearanceThemeRecord } from '../../appearance/core';
2
+ type ThemeMetaValue = {
3
+ name: string;
4
+ key: string;
5
+ description: string;
6
+ sourceThemeKey?: string;
7
+ };
8
+ type AppearanceThemeModalProps = {
9
+ open: boolean;
10
+ mode: 'create' | 'saveAs' | 'duplicate' | 'editInfo';
11
+ themes: AppearanceThemeRecord[];
12
+ initial?: Partial<ThemeMetaValue>;
13
+ currentCode?: string;
14
+ keyLocked?: boolean;
15
+ sourceLabel?: string;
16
+ sourceOptions?: Array<{
17
+ value: string;
18
+ label: string;
19
+ }>;
20
+ loading?: boolean;
21
+ onClose: () => void;
22
+ onSubmit: (value: ThemeMetaValue) => void;
23
+ onSubmitAndApply?: (value: ThemeMetaValue) => void;
24
+ };
25
+ declare const AppearanceThemeModal: ({ open, mode, themes, initial, currentCode, keyLocked, sourceLabel, sourceOptions, loading, onClose, onSubmit, onSubmitAndApply }: AppearanceThemeModalProps) => import("react/jsx-runtime").JSX.Element;
26
+ export type { ThemeMetaValue };
27
+ export default AppearanceThemeModal;
@@ -0,0 +1,16 @@
1
+ import { Dispatch, ReactNode } from 'react';
2
+ export type AppearanceWorkspaceMode = 'default' | 'settings-expanded' | 'preview-expanded' | 'settings-collapsed' | 'preview-collapsed';
3
+ type PanelSide = 'settings' | 'preview';
4
+ export declare const AppearanceWorkspaceActions: ({ side, mode, onModeChange }: {
5
+ side: PanelSide;
6
+ mode: AppearanceWorkspaceMode;
7
+ onModeChange: Dispatch<AppearanceWorkspaceMode>;
8
+ }) => import("react/jsx-runtime").JSX.Element;
9
+ type AppearanceWorkspaceProps = {
10
+ mode: AppearanceWorkspaceMode;
11
+ onModeChange: Dispatch<AppearanceWorkspaceMode>;
12
+ settings: ReactNode;
13
+ preview: ReactNode;
14
+ };
15
+ declare const AppearanceWorkspace: ({ mode, onModeChange, settings, preview }: AppearanceWorkspaceProps) => import("react/jsx-runtime").JSX.Element;
16
+ export default AppearanceWorkspace;
@@ -0,0 +1,3 @@
1
+ import './appearance.scss';
2
+ declare const AppearanceSettingsPage: () => import("react/jsx-runtime").JSX.Element;
3
+ export default AppearanceSettingsPage;
@@ -0,0 +1,25 @@
1
+ import { AppearanceThemeRecord, AppearanceThemeValue } from '../../appearance/core';
2
+ import { IConfig } from '../../domain/models/IConfig';
3
+ export declare const appearanceThemeQueryKey: readonly [string, "APPEARANCE_THEMES"];
4
+ export type SaveAppearanceThemeInput = {
5
+ key: string;
6
+ name: string;
7
+ description?: string;
8
+ value: AppearanceThemeValue;
9
+ displayOrder?: number;
10
+ /** Code hiện tại chỉ được truyền khi đang sửa đúng Theme đã tồn tại. */
11
+ currentCode?: string;
12
+ /** Config id hiện tại để loại chính record đang Edit khi kiểm tra trùng raw Code. */
13
+ currentConfigId?: string;
14
+ };
15
+ export declare const hasDuplicateAppearanceThemeCode: (configs: IConfig[], targetCode: string, editingConfigId?: string) => boolean;
16
+ export declare const useAppearanceThemeLibrary: () => {
17
+ themes: AppearanceThemeRecord[];
18
+ loading: boolean;
19
+ fetching: boolean;
20
+ error: Error;
21
+ saving: boolean;
22
+ saveTheme: (input: SaveAppearanceThemeInput) => Promise<boolean>;
23
+ deleteTheme: (theme: AppearanceThemeRecord, successMessage?: string) => Promise<boolean>;
24
+ refresh: () => Promise<void>;
25
+ };
@@ -0,0 +1,56 @@
1
+ export type SettingKeyValueType = 'boolean' | 'number' | 'string' | 'json' | 'date' | 'datetime' | 'guid';
2
+ export type SettingKeyDefaultValue = boolean | number | string | null;
3
+ export type SettingKeyRule = {
4
+ id: string;
5
+ section: string;
6
+ category: string;
7
+ pattern: string;
8
+ type: SettingKeyValueType;
9
+ defaultValue?: SettingKeyDefaultValue;
10
+ sampleValue?: unknown;
11
+ examples: string[];
12
+ description: string;
13
+ };
14
+ export type SettingKeyRuleSection = {
15
+ id: string;
16
+ title: string;
17
+ description: string;
18
+ };
19
+ export type SettingKeyCategory = {
20
+ value: string;
21
+ label: string;
22
+ };
23
+ export type SettingConventionSection = {
24
+ title: string;
25
+ paragraphs?: string[];
26
+ items?: string[];
27
+ examples?: string[];
28
+ };
29
+ export type SettingKeyConvention = {
30
+ id: string;
31
+ version: number;
32
+ title: string;
33
+ objective: string[];
34
+ keyStructure: {
35
+ pattern: string;
36
+ explanation: string[];
37
+ examples: string[];
38
+ };
39
+ categories: SettingKeyCategory[];
40
+ ruleSections: SettingKeyRuleSection[];
41
+ rules: SettingKeyRule[];
42
+ guidance: SettingConventionSection[];
43
+ };
44
+ export declare const SETTING_KEY_RULES: SettingKeyRule[];
45
+ export declare const SETTING_KEY_CONVENTION: SettingKeyConvention;
46
+ export declare const formatSettingKeyConvention: (convention?: SettingKeyConvention) => string;
47
+ export declare const serializeSettingKeyConvention: (convention?: SettingKeyConvention) => string;
48
+ export type SettingImportLeaf = {
49
+ type: SettingKeyValueType;
50
+ value: unknown;
51
+ description: string;
52
+ };
53
+ export type SettingImportDocument = Record<string, Record<string, unknown>>;
54
+ export declare const buildSettingImportExample: (resourceCode?: string, convention?: SettingKeyConvention) => SettingImportDocument;
55
+ export declare const serializeSettingImportExample: (resourceCode?: string, convention?: SettingKeyConvention) => string;
56
+ export declare const filterSettingKeyRules: (rows: SettingKeyRule[], searchTerm: string, category?: string, type?: string) => SettingKeyRule[];
@@ -5,5 +5,10 @@ export type { ShortcutActionId, ShortcutActions } from '../shortcuts/core';
5
5
  export { ShortcutTooltip } from '../shortcuts/runtime/ShortcutTooltip';
6
6
  export { ShortcutOverlayScope } from '../shortcuts/core/advanced';
7
7
  export { setting } from '../settings/core/setting';
8
- export { default as SettingsPage } from '../management/setting-keys';
9
8
  export { default as ShortcutsPage } from '../management/shortcuts';
9
+ export { default as SettingsPage } from '../management/setting-keys';
10
+ export { bootstrapAppearance } from '../appearance/runtime/bootstrap';
11
+ export { useAppearance } from '../appearance/runtime/AppearanceRuntime';
12
+ export { default as AppearanceSettingsPage } from '../management/appearance';
13
+ export { appearanceDefaults } from '../appearance/core/defaults';
14
+ export type { AppearanceConfig } from '../appearance/core/types';