@vef-framework/shared 1.0.121 → 1.0.123

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 (100) hide show
  1. package/cjs/color.cjs +11 -0
  2. package/cjs/constants.cjs +39 -0
  3. package/cjs/context.cjs +36 -0
  4. package/cjs/dom.cjs +23 -0
  5. package/cjs/error.cjs +30 -0
  6. package/cjs/event.cjs +11 -0
  7. package/cjs/expression.cjs +27 -0
  8. package/cjs/function.cjs +16 -0
  9. package/cjs/icons.cjs +136 -0
  10. package/cjs/id.cjs +14 -0
  11. package/cjs/index.cjs +317 -0
  12. package/cjs/json.cjs +18 -0
  13. package/cjs/lib.cjs +232 -0
  14. package/cjs/message.cjs +303 -0
  15. package/cjs/path.cjs +40 -0
  16. package/cjs/pinyin.cjs +33 -0
  17. package/cjs/security.cjs +27 -0
  18. package/cjs/store.cjs +105 -0
  19. package/cjs/styles.cjs +55 -0
  20. package/cjs/temporal.cjs +27 -0
  21. package/cjs/theme-variables.cjs +354 -0
  22. package/cjs/types.cjs +4 -0
  23. package/cjs/utils.cjs +117 -0
  24. package/cjs/validation.cjs +189 -0
  25. package/cjs/yaml.cjs +11 -0
  26. package/esm/color.js +9 -0
  27. package/esm/constants.js +31 -0
  28. package/esm/context.js +34 -0
  29. package/esm/dom.js +21 -0
  30. package/esm/error.js +28 -0
  31. package/esm/event.js +9 -0
  32. package/esm/expression.js +23 -0
  33. package/esm/function.js +14 -0
  34. package/esm/icons.js +129 -0
  35. package/esm/id.js +12 -0
  36. package/esm/index.js +32 -0
  37. package/esm/json.js +16 -0
  38. package/esm/lib.js +21 -0
  39. package/esm/message.js +282 -0
  40. package/esm/path.js +33 -0
  41. package/esm/pinyin.js +30 -0
  42. package/esm/security.js +24 -0
  43. package/esm/store.js +100 -0
  44. package/esm/styles.js +51 -0
  45. package/esm/temporal.js +23 -0
  46. package/esm/theme-variables.js +352 -0
  47. package/esm/types.js +2 -0
  48. package/esm/utils.js +109 -0
  49. package/esm/validation.js +151 -0
  50. package/esm/yaml.js +9 -0
  51. package/package.json +11 -10
  52. package/es/color.js +0 -1
  53. package/es/constants.js +0 -1
  54. package/es/context.js +0 -1
  55. package/es/dom.js +0 -1
  56. package/es/error.js +0 -1
  57. package/es/event.js +0 -1
  58. package/es/expression.js +0 -1
  59. package/es/function.js +0 -1
  60. package/es/icons.js +0 -1
  61. package/es/id.js +0 -1
  62. package/es/index.js +0 -1
  63. package/es/json.js +0 -1
  64. package/es/lib.js +0 -1
  65. package/es/message.js +0 -1
  66. package/es/path.js +0 -1
  67. package/es/pinyin.js +0 -1
  68. package/es/security.js +0 -1
  69. package/es/store.js +0 -1
  70. package/es/styles.js +0 -1
  71. package/es/temporal.js +0 -1
  72. package/es/theme-variables.js +0 -1
  73. package/es/utils.js +0 -1
  74. package/es/validation.js +0 -1
  75. package/es/yaml.js +0 -1
  76. package/lib/color.cjs +0 -1
  77. package/lib/constants.cjs +0 -1
  78. package/lib/context.cjs +0 -1
  79. package/lib/dom.cjs +0 -1
  80. package/lib/error.cjs +0 -1
  81. package/lib/event.cjs +0 -1
  82. package/lib/expression.cjs +0 -1
  83. package/lib/function.cjs +0 -1
  84. package/lib/icons.cjs +0 -1
  85. package/lib/id.cjs +0 -1
  86. package/lib/index.cjs +0 -1
  87. package/lib/json.cjs +0 -1
  88. package/lib/lib.cjs +0 -1
  89. package/lib/message.cjs +0 -1
  90. package/lib/path.cjs +0 -1
  91. package/lib/pinyin.cjs +0 -1
  92. package/lib/security.cjs +0 -1
  93. package/lib/store.cjs +0 -1
  94. package/lib/styles.cjs +0 -1
  95. package/lib/temporal.cjs +0 -1
  96. package/lib/theme-variables.cjs +0 -1
  97. package/lib/types.cjs +0 -1
  98. package/lib/utils.cjs +0 -1
  99. package/lib/validation.cjs +0 -1
  100. package/lib/yaml.cjs +0 -1
package/cjs/store.cjs ADDED
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+ 'use strict';
3
+
4
+ var react = require('react');
5
+ var middleware = require('zustand/middleware');
6
+ var traditional = require('zustand/traditional');
7
+ var vanilla = require('zustand/vanilla');
8
+ require('./lib.cjs');
9
+ var utils = require('./utils.cjs');
10
+ var radashi = require('radashi');
11
+ var shallow = require('zustand/shallow');
12
+
13
+ "use strict";
14
+ function createStorageProxy(storage) {
15
+ const delegate = middleware.createJSONStorage(() => storage === "local" ? localStorage : sessionStorage);
16
+ return {
17
+ getItem: delegate.getItem,
18
+ setItem(name, value) {
19
+ if (radashi.isNullish(value.state)) {
20
+ return;
21
+ }
22
+ delegate.setItem(name, value);
23
+ },
24
+ removeItem: delegate.removeItem
25
+ };
26
+ }
27
+ function createStore(stateCreator, persistenceOptions) {
28
+ const name = persistenceOptions?.name ?? "UNKNOWN";
29
+ const storage = persistenceOptions?.storage ?? "local";
30
+ const selector = persistenceOptions ? persistenceOptions.selector : () => null;
31
+ const storageInstance = createStorageProxy(storage);
32
+ return traditional.createWithEqualityFn(
33
+ middleware.persist(
34
+ middleware.subscribeWithSelector(stateCreator),
35
+ {
36
+ name: `__VEF_STORE__${utils.constantCase(name)}__`,
37
+ storage: storageInstance,
38
+ version: 1,
39
+ partialize: selector
40
+ }
41
+ ),
42
+ shallow.shallow
43
+ );
44
+ }
45
+ function createUnboundStore(stateCreator) {
46
+ return vanilla.createStore(
47
+ middleware.subscribeWithSelector(stateCreator)
48
+ );
49
+ }
50
+ function useUnboundStore(store, selector, equalityFn) {
51
+ return traditional.useStoreWithEqualityFn(
52
+ store,
53
+ selector,
54
+ equalityFn ?? shallow.shallow
55
+ );
56
+ }
57
+ function createComponentStore(name, getStateCreator) {
58
+ const StoreContext = react.createContext(null);
59
+ const StoreProvider = ({ initialState, children }) => {
60
+ const [store] = react.useState(() => {
61
+ const creator = getStateCreator(initialState);
62
+ return createUnboundStore(creator);
63
+ });
64
+ const isMounted = react.useRef(false);
65
+ react.useEffect(() => () => {
66
+ isMounted.current = false;
67
+ }, []);
68
+ react.useEffect(() => {
69
+ if (!isMounted.current) {
70
+ isMounted.current = true;
71
+ }
72
+ if (initialState) {
73
+ store.setState({
74
+ ...initialState
75
+ });
76
+ }
77
+ }, [initialState, store]);
78
+ return react.createElement(
79
+ StoreContext.Provider,
80
+ { value: store },
81
+ children
82
+ );
83
+ };
84
+ const useStoreApi = () => {
85
+ const store = react.useContext(StoreContext);
86
+ if (!store) {
87
+ throw new Error(`${name}Store can be used only inside ${name}StoreProvider`);
88
+ }
89
+ return store;
90
+ };
91
+ const useStore = (selector) => useUnboundStore(
92
+ useStoreApi(),
93
+ selector
94
+ );
95
+ return {
96
+ StoreProvider,
97
+ useStore,
98
+ useStoreApi
99
+ };
100
+ }
101
+
102
+ exports.createComponentStore = createComponentStore;
103
+ exports.createStore = createStore;
104
+ exports.createUnboundStore = createUnboundStore;
105
+ exports.useUnboundStore = useUnboundStore;
package/cjs/styles.cjs ADDED
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ 'use strict';
3
+
4
+ var react = require('@emotion/react');
5
+
6
+ "use strict";
7
+ const breakpointWidths = {
8
+ xs: 0,
9
+ sm: 576,
10
+ md: 768,
11
+ lg: 992,
12
+ xl: 1200,
13
+ xxl: 1400
14
+ };
15
+ const breakpoints = [
16
+ "xs",
17
+ "sm",
18
+ "md",
19
+ "lg",
20
+ "xl",
21
+ "xxl"
22
+ ];
23
+ const bmq = Object.keys(breakpointWidths).reduce(
24
+ (acc, label) => {
25
+ acc[label] = `@media (min-width: ${breakpointWidths[label]}px)`;
26
+ return acc;
27
+ },
28
+ {}
29
+ );
30
+ const styles = {
31
+ // Flex center style
32
+ flexCenter: react.css({
33
+ display: "flex",
34
+ justifyContent: "center",
35
+ alignItems: "center"
36
+ }),
37
+ // Full height style
38
+ fullHeight: react.css({
39
+ height: "100%"
40
+ }),
41
+ // Full width style
42
+ fullWidth: react.css({
43
+ width: "100%"
44
+ }),
45
+ // Scrollbar style
46
+ scrollbar: react.css({
47
+ scrollbarWidth: "thin",
48
+ scrollbarColor: "rgba(0, 0, 0, 0.3) transparent",
49
+ scrollbarGutter: "stable"
50
+ })
51
+ };
52
+
53
+ exports.bmq = bmq;
54
+ exports.breakpoints = breakpoints;
55
+ exports.styles = styles;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ 'use strict';
3
+
4
+ var tz = require('@date-fns/tz');
5
+ var dateFns = require('date-fns');
6
+ var locale = require('date-fns/locale');
7
+
8
+ "use strict";
9
+ function getNowDate() {
10
+ return /* @__PURE__ */ new Date();
11
+ }
12
+ function getNowDateString() {
13
+ return dateFns.format(getNowDate(), "yyyy-MM-dd", {
14
+ locale: locale.zhCN,
15
+ in: tz.tz("Asia/Shanghai")
16
+ });
17
+ }
18
+ function getTodayString() {
19
+ return dateFns.format(getNowDate(), "PPPPpp", {
20
+ locale: locale.zhCN,
21
+ in: tz.tz("Asia/Shanghai")
22
+ });
23
+ }
24
+
25
+ exports.getNowDate = getNowDate;
26
+ exports.getNowDateString = getNowDateString;
27
+ exports.getTodayString = getTodayString;
@@ -0,0 +1,354 @@
1
+ "use strict";
2
+ 'use strict';
3
+
4
+ "use strict";
5
+ const themeVariables = {
6
+ colorChart1: "hsl(221.2 83.2% 53.3%)",
7
+ colorChart2: "hsl(216 92% 60%)",
8
+ colorChart3: "hsl(212 95% 68%)",
9
+ colorChart4: "hsl(210 98% 78%)",
10
+ colorChart5: "hsl(212 97% 87%)",
11
+ blue: "var(--vef-blue)",
12
+ purple: "var(--vef-purple)",
13
+ cyan: "var(--vef-cyan)",
14
+ green: "var(--vef-green)",
15
+ magenta: "var(--vef-magenta)",
16
+ pink: "var(--vef-pink)",
17
+ red: "var(--vef-red)",
18
+ orange: "var(--vef-orange)",
19
+ yellow: "var(--vef-yellow)",
20
+ volcano: "var(--vef-volcano)",
21
+ geekblue: "var(--vef-geekblue)",
22
+ gold: "var(--vef-gold)",
23
+ lime: "var(--vef-lime)",
24
+ colorPrimary: "var(--vef-color-primary)",
25
+ colorSuccess: "var(--vef-color-success)",
26
+ colorWarning: "var(--vef-color-warning)",
27
+ colorError: "var(--vef-color-error)",
28
+ colorInfo: "var(--vef-color-info)",
29
+ colorLink: "var(--vef-color-link)",
30
+ colorTextBase: "var(--vef-color-text-base)",
31
+ colorBgBase: "var(--vef-color-bg-base)",
32
+ fontFamily: "var(--vef-font-family)",
33
+ fontFamilyCode: "var(--vef-font-family-code)",
34
+ fontSize: "var(--vef-font-size)",
35
+ lineWidth: "var(--vef-line-width)",
36
+ lineType: "var(--vef-line-type)",
37
+ motionEaseOutCirc: "var(--vef-motion-ease-out-circ)",
38
+ motionEaseInOutCirc: "var(--vef-motion-ease-in-out-circ)",
39
+ motionEaseOut: "var(--vef-motion-ease-out)",
40
+ motionEaseInOut: "var(--vef-motion-ease-in-out)",
41
+ motionEaseOutBack: "var(--vef-motion-ease-out-back)",
42
+ motionEaseInBack: "var(--vef-motion-ease-in-back)",
43
+ motionEaseInQuint: "var(--vef-motion-ease-in-quint)",
44
+ motionEaseOutQuint: "var(--vef-motion-ease-out-quint)",
45
+ borderRadius: "var(--vef-border-radius)",
46
+ sizePopupArrow: "var(--vef-size-popup-arrow)",
47
+ controlHeight: "var(--vef-control-height)",
48
+ zIndexBase: "var(--vef-z-index-base)",
49
+ zIndexPopupBase: "var(--vef-z-index-popup-base)",
50
+ opacityImage: "var(--vef-opacity-image)",
51
+ colorBgLayout: "var(--vef-color-bg-layout)",
52
+ colorBgSpotlight: "var(--vef-color-bg-spotlight)",
53
+ blue1: "var(--vef-blue-1)",
54
+ blue2: "var(--vef-blue-2)",
55
+ blue3: "var(--vef-blue-3)",
56
+ blue4: "var(--vef-blue-4)",
57
+ blue5: "var(--vef-blue-5)",
58
+ blue6: "var(--vef-blue-6)",
59
+ blue7: "var(--vef-blue-7)",
60
+ blue8: "var(--vef-blue-8)",
61
+ blue9: "var(--vef-blue-9)",
62
+ blue10: "var(--vef-blue-10)",
63
+ purple1: "var(--vef-purple-1)",
64
+ purple2: "var(--vef-purple-2)",
65
+ purple3: "var(--vef-purple-3)",
66
+ purple4: "var(--vef-purple-4)",
67
+ purple5: "var(--vef-purple-5)",
68
+ purple6: "var(--vef-purple-6)",
69
+ purple7: "var(--vef-purple-7)",
70
+ purple8: "var(--vef-purple-8)",
71
+ purple9: "var(--vef-purple-9)",
72
+ purple10: "var(--vef-purple-10)",
73
+ cyan1: "var(--vef-cyan-1)",
74
+ cyan2: "var(--vef-cyan-2)",
75
+ cyan3: "var(--vef-cyan-3)",
76
+ cyan4: "var(--vef-cyan-4)",
77
+ cyan5: "var(--vef-cyan-5)",
78
+ cyan6: "var(--vef-cyan-6)",
79
+ cyan7: "var(--vef-cyan-7)",
80
+ cyan8: "var(--vef-cyan-8)",
81
+ cyan9: "var(--vef-cyan-9)",
82
+ cyan10: "var(--vef-cyan-10)",
83
+ green1: "var(--vef-green-1)",
84
+ green2: "var(--vef-green-2)",
85
+ green3: "var(--vef-green-3)",
86
+ green4: "var(--vef-green-4)",
87
+ green5: "var(--vef-green-5)",
88
+ green6: "var(--vef-green-6)",
89
+ green7: "var(--vef-green-7)",
90
+ green8: "var(--vef-green-8)",
91
+ green9: "var(--vef-green-9)",
92
+ green10: "var(--vef-green-10)",
93
+ magenta1: "var(--vef-magenta-1)",
94
+ magenta2: "var(--vef-magenta-2)",
95
+ magenta3: "var(--vef-magenta-3)",
96
+ magenta4: "var(--vef-magenta-4)",
97
+ magenta5: "var(--vef-magenta-5)",
98
+ magenta6: "var(--vef-magenta-6)",
99
+ magenta7: "var(--vef-magenta-7)",
100
+ magenta8: "var(--vef-magenta-8)",
101
+ magenta9: "var(--vef-magenta-9)",
102
+ magenta10: "var(--vef-magenta-10)",
103
+ pink1: "var(--vef-pink-1)",
104
+ pink2: "var(--vef-pink-2)",
105
+ pink3: "var(--vef-pink-3)",
106
+ pink4: "var(--vef-pink-4)",
107
+ pink5: "var(--vef-pink-5)",
108
+ pink6: "var(--vef-pink-6)",
109
+ pink7: "var(--vef-pink-7)",
110
+ pink8: "var(--vef-pink-8)",
111
+ pink9: "var(--vef-pink-9)",
112
+ pink10: "var(--vef-pink-10)",
113
+ red1: "var(--vef-red-1)",
114
+ red2: "var(--vef-red-2)",
115
+ red3: "var(--vef-red-3)",
116
+ red4: "var(--vef-red-4)",
117
+ red5: "var(--vef-red-5)",
118
+ red6: "var(--vef-red-6)",
119
+ red7: "var(--vef-red-7)",
120
+ red8: "var(--vef-red-8)",
121
+ red9: "var(--vef-red-9)",
122
+ red10: "var(--vef-red-10)",
123
+ orange1: "var(--vef-orange-1)",
124
+ orange2: "var(--vef-orange-2)",
125
+ orange3: "var(--vef-orange-3)",
126
+ orange4: "var(--vef-orange-4)",
127
+ orange5: "var(--vef-orange-5)",
128
+ orange6: "var(--vef-orange-6)",
129
+ orange7: "var(--vef-orange-7)",
130
+ orange8: "var(--vef-orange-8)",
131
+ orange9: "var(--vef-orange-9)",
132
+ orange10: "var(--vef-orange-10)",
133
+ yellow1: "var(--vef-yellow-1)",
134
+ yellow2: "var(--vef-yellow-2)",
135
+ yellow3: "var(--vef-yellow-3)",
136
+ yellow4: "var(--vef-yellow-4)",
137
+ yellow5: "var(--vef-yellow-5)",
138
+ yellow6: "var(--vef-yellow-6)",
139
+ yellow7: "var(--vef-yellow-7)",
140
+ yellow8: "var(--vef-yellow-8)",
141
+ yellow9: "var(--vef-yellow-9)",
142
+ yellow10: "var(--vef-yellow-10)",
143
+ volcano1: "var(--vef-volcano-1)",
144
+ volcano2: "var(--vef-volcano-2)",
145
+ volcano3: "var(--vef-volcano-3)",
146
+ volcano4: "var(--vef-volcano-4)",
147
+ volcano5: "var(--vef-volcano-5)",
148
+ volcano6: "var(--vef-volcano-6)",
149
+ volcano7: "var(--vef-volcano-7)",
150
+ volcano8: "var(--vef-volcano-8)",
151
+ volcano9: "var(--vef-volcano-9)",
152
+ volcano10: "var(--vef-volcano-10)",
153
+ geekblue1: "var(--vef-geekblue-1)",
154
+ geekblue2: "var(--vef-geekblue-2)",
155
+ geekblue3: "var(--vef-geekblue-3)",
156
+ geekblue4: "var(--vef-geekblue-4)",
157
+ geekblue5: "var(--vef-geekblue-5)",
158
+ geekblue6: "var(--vef-geekblue-6)",
159
+ geekblue7: "var(--vef-geekblue-7)",
160
+ geekblue8: "var(--vef-geekblue-8)",
161
+ geekblue9: "var(--vef-geekblue-9)",
162
+ geekblue10: "var(--vef-geekblue-10)",
163
+ gold1: "var(--vef-gold-1)",
164
+ gold2: "var(--vef-gold-2)",
165
+ gold3: "var(--vef-gold-3)",
166
+ gold4: "var(--vef-gold-4)",
167
+ gold5: "var(--vef-gold-5)",
168
+ gold6: "var(--vef-gold-6)",
169
+ gold7: "var(--vef-gold-7)",
170
+ gold8: "var(--vef-gold-8)",
171
+ gold9: "var(--vef-gold-9)",
172
+ gold10: "var(--vef-gold-10)",
173
+ lime1: "var(--vef-lime-1)",
174
+ lime2: "var(--vef-lime-2)",
175
+ lime3: "var(--vef-lime-3)",
176
+ lime4: "var(--vef-lime-4)",
177
+ lime5: "var(--vef-lime-5)",
178
+ lime6: "var(--vef-lime-6)",
179
+ lime7: "var(--vef-lime-7)",
180
+ lime8: "var(--vef-lime-8)",
181
+ lime9: "var(--vef-lime-9)",
182
+ lime10: "var(--vef-lime-10)",
183
+ colorText: "var(--vef-color-text)",
184
+ colorTextSecondary: "var(--vef-color-text-secondary)",
185
+ colorTextTertiary: "var(--vef-color-text-tertiary)",
186
+ colorTextQuaternary: "var(--vef-color-text-quaternary)",
187
+ colorTextSlate: "#64748b",
188
+ colorFill: "var(--vef-color-fill)",
189
+ colorFillSecondary: "var(--vef-color-fill-secondary)",
190
+ colorFillTertiary: "var(--vef-color-fill-tertiary)",
191
+ colorFillQuaternary: "var(--vef-color-fill-quaternary)",
192
+ colorBgSolid: "var(--vef-color-bg-solid)",
193
+ colorBgSolidHover: "var(--vef-color-bg-solid-hover)",
194
+ colorBgSolidActive: "var(--vef-color-bg-solid-active)",
195
+ colorBgContainer: "var(--vef-color-bg-container)",
196
+ colorBgElevated: "var(--vef-color-bg-elevated)",
197
+ colorBgBlur: "var(--vef-color-bg-blur)",
198
+ colorBorder: "var(--vef-color-border)",
199
+ colorBorderSecondary: "var(--vef-color-border-secondary)",
200
+ colorPrimaryBg: "var(--vef-color-primary-bg)",
201
+ colorPrimaryBgHover: "var(--vef-color-primary-bg-hover)",
202
+ colorPrimaryBorder: "var(--vef-color-primary-border)",
203
+ colorPrimaryBorderHover: "var(--vef-color-primary-border-hover)",
204
+ colorPrimaryHover: "var(--vef-color-primary-hover)",
205
+ colorPrimaryActive: "var(--vef-color-primary-active)",
206
+ colorPrimaryTextHover: "var(--vef-color-primary-text-hover)",
207
+ colorPrimaryText: "var(--vef-color-primary-text)",
208
+ colorPrimaryTextActive: "var(--vef-color-primary-text-active)",
209
+ colorSuccessBg: "var(--vef-color-success-bg)",
210
+ colorSuccessBgHover: "var(--vef-color-success-bg-hover)",
211
+ colorSuccessBorder: "var(--vef-color-success-border)",
212
+ colorSuccessBorderHover: "var(--vef-color-success-border-hover)",
213
+ colorSuccessHover: "var(--vef-color-success-hover)",
214
+ colorSuccessActive: "var(--vef-color-success-active)",
215
+ colorSuccessTextHover: "var(--vef-color-success-text-hover)",
216
+ colorSuccessText: "var(--vef-color-success-text)",
217
+ colorSuccessTextActive: "var(--vef-color-success-text-active)",
218
+ colorErrorBg: "var(--vef-color-error-bg)",
219
+ colorErrorBgHover: "var(--vef-color-error-bg-hover)",
220
+ colorErrorBgFilledHover: "var(--vef-color-error-bg-filled-hover)",
221
+ colorErrorBgActive: "var(--vef-color-error-bg-active)",
222
+ colorErrorBorder: "var(--vef-color-error-border)",
223
+ colorErrorBorderHover: "var(--vef-color-error-border-hover)",
224
+ colorErrorHover: "var(--vef-color-error-hover)",
225
+ colorErrorActive: "var(--vef-color-error-active)",
226
+ colorErrorTextHover: "var(--vef-color-error-text-hover)",
227
+ colorErrorText: "var(--vef-color-error-text)",
228
+ colorErrorTextActive: "var(--vef-color-error-text-active)",
229
+ colorWarningBg: "var(--vef-color-warning-bg)",
230
+ colorWarningBgHover: "var(--vef-color-warning-bg-hover)",
231
+ colorWarningBorder: "var(--vef-color-warning-border)",
232
+ colorWarningBorderHover: "var(--vef-color-warning-border-hover)",
233
+ colorWarningHover: "var(--vef-color-warning-hover)",
234
+ colorWarningActive: "var(--vef-color-warning-active)",
235
+ colorWarningTextHover: "var(--vef-color-warning-text-hover)",
236
+ colorWarningText: "var(--vef-color-warning-text)",
237
+ colorWarningTextActive: "var(--vef-color-warning-text-active)",
238
+ colorInfoBg: "var(--vef-color-info-bg)",
239
+ colorInfoBgHover: "var(--vef-color-info-bg-hover)",
240
+ colorInfoBorder: "var(--vef-color-info-border)",
241
+ colorInfoBorderHover: "var(--vef-color-info-border-hover)",
242
+ colorInfoHover: "var(--vef-color-info-hover)",
243
+ colorInfoActive: "var(--vef-color-info-active)",
244
+ colorInfoTextHover: "var(--vef-color-info-text-hover)",
245
+ colorInfoText: "var(--vef-color-info-text)",
246
+ colorInfoTextActive: "var(--vef-color-info-text-active)",
247
+ colorLinkHover: "var(--vef-color-link-hover)",
248
+ colorLinkActive: "var(--vef-color-link-active)",
249
+ colorBgMask: "var(--vef-color-bg-mask)",
250
+ colorWhite: "var(--vef-color-white)",
251
+ fontSizeSm: "var(--vef-font-size-sm)",
252
+ fontSizeLg: "var(--vef-font-size-lg)",
253
+ fontSizeXl: "var(--vef-font-size-xl)",
254
+ fontSizeHeading1: "var(--vef-font-size-heading-1)",
255
+ fontSizeHeading2: "var(--vef-font-size-heading-2)",
256
+ fontSizeHeading3: "var(--vef-font-size-heading-3)",
257
+ fontSizeHeading4: "var(--vef-font-size-heading-4)",
258
+ fontSizeHeading5: "var(--vef-font-size-heading-5)",
259
+ lineHeight: "var(--vef-line-height)",
260
+ lineHeightLg: "var(--vef-line-height-lg)",
261
+ lineHeightSm: "var(--vef-line-height-sm)",
262
+ fontHeight: "var(--vef-font-height)",
263
+ fontHeightLg: "var(--vef-font-height-lg)",
264
+ fontHeightSm: "var(--vef-font-height-sm)",
265
+ lineHeightHeading1: "var(--vef-line-height-heading-1)",
266
+ lineHeightHeading2: "var(--vef-line-height-heading-2)",
267
+ lineHeightHeading3: "var(--vef-line-height-heading-3)",
268
+ lineHeightHeading4: "var(--vef-line-height-heading-4)",
269
+ lineHeightHeading5: "var(--vef-line-height-heading-5)",
270
+ controlHeightSm: "var(--vef-control-height-sm)",
271
+ controlHeightXs: "var(--vef-control-height-xs)",
272
+ controlHeightLg: "var(--vef-control-height-lg)",
273
+ motionDurationFast: "var(--vef-motion-duration-fast)",
274
+ motionDurationMid: "var(--vef-motion-duration-mid)",
275
+ motionDurationSlow: "var(--vef-motion-duration-slow)",
276
+ lineWidthBold: "var(--vef-line-width-bold)",
277
+ borderRadiusXs: "var(--vef-border-radius-xs)",
278
+ borderRadiusSm: "var(--vef-border-radius-sm)",
279
+ borderRadiusLg: "var(--vef-border-radius-lg)",
280
+ borderRadiusOuter: "var(--vef-border-radius-outer)",
281
+ colorFillContent: "var(--vef-color-fill-content)",
282
+ colorFillContentHover: "var(--vef-color-fill-content-hover)",
283
+ colorFillAlt: "var(--vef-color-fill-alter)",
284
+ colorBgContainerDisabled: "var(--vef-color-bg-container-disabled)",
285
+ colorBorderBg: "var(--vef-color-border-bg)",
286
+ colorSplit: "var(--vef-color-split)",
287
+ colorTextPlaceholder: "var(--vef-color-text-placeholder)",
288
+ colorTextDisabled: "var(--vef-color-text-disabled)",
289
+ colorTextHeading: "var(--vef-color-text-heading)",
290
+ colorTextLabel: "var(--vef-color-text-label)",
291
+ colorTextDescription: "var(--vef-color-text-description)",
292
+ colorTextLightSolid: "var(--vef-color-text-light-solid)",
293
+ colorHighlight: "var(--vef-color-highlight)",
294
+ colorBgTextHover: "var(--vef-color-bg-text-hover)",
295
+ colorBgTextActive: "var(--vef-color-bg-text-active)",
296
+ colorIcon: "var(--vef-color-icon)",
297
+ colorIconHover: "var(--vef-color-icon-hover)",
298
+ colorErrorOutline: "var(--vef-color-error-outline)",
299
+ colorWarningOutline: "var(--vef-color-warning-outline)",
300
+ fontSizeIcon: "var(--vef-font-size-icon)",
301
+ lineWidthFocus: "var(--vef-line-width-focus)",
302
+ controlOutlineWidth: "var(--vef-control-outline-width)",
303
+ controlInteractiveSize: "var(--vef-control-interactive-size)",
304
+ controlItemBgHover: "var(--vef-control-item-bg-hover)",
305
+ controlItemBgActive: "var(--vef-control-item-bg-active)",
306
+ controlItemBgActiveHover: "var(--vef-control-item-bg-active-hover)",
307
+ controlItemBgActiveDisabled: "var(--vef-control-item-bg-active-disabled)",
308
+ controlTmpOutline: "var(--vef-control-tmp-outline)",
309
+ controlOutline: "var(--vef-control-outline)",
310
+ fontWeightStrong: "var(--vef-font-weight-strong)",
311
+ opacityLoading: "var(--vef-opacity-loading)",
312
+ linkDecoration: "var(--vef-link-decoration)",
313
+ linkHoverDecoration: "var(--vef-link-hover-decoration)",
314
+ linkFocusDecoration: "var(--vef-link-focus-decoration)",
315
+ controlPaddingHorizontal: "var(--vef-control-padding-horizontal)",
316
+ controlPaddingHorizontalSm: "var(--vef-control-padding-horizontal-sm)",
317
+ paddingXxs: "var(--vef-padding-xxs)",
318
+ paddingXs: "var(--vef-padding-xs)",
319
+ paddingSm: "var(--vef-padding-sm)",
320
+ padding: "var(--vef-padding)",
321
+ paddingMd: "var(--vef-padding-md)",
322
+ paddingLg: "var(--vef-padding-lg)",
323
+ paddingXl: "var(--vef-padding-xl)",
324
+ paddingContentHorizontalLg: "var(--vef-padding-content-horizontal-lg)",
325
+ paddingContentVerticalLg: "var(--vef-padding-content-vertical-lg)",
326
+ paddingContentHorizontal: "var(--vef-padding-content-horizontal)",
327
+ paddingContentVertical: "var(--vef-padding-content-vertical)",
328
+ paddingContentHorizontalSm: "var(--vef-padding-content-horizontal-sm)",
329
+ paddingContentVerticalSm: "var(--vef-padding-content-vertical-sm)",
330
+ marginXxs: "var(--vef-margin-xxs)",
331
+ marginXs: "var(--vef-margin-xs)",
332
+ marginSm: "var(--vef-margin-sm)",
333
+ margin: "var(--vef-margin)",
334
+ marginMd: "var(--vef-margin-md)",
335
+ marginLg: "var(--vef-margin-lg)",
336
+ marginXl: "var(--vef-margin-xl)",
337
+ marginXxl: "var(--vef-margin-xxl)",
338
+ boxShadow: "var(--vef-box-shadow)",
339
+ boxShadowSecondary: "var(--vef-box-shadow-secondary)",
340
+ boxShadowTertiary: "var(--vef-box-shadow-tertiary)",
341
+ boxShadowPopoverArrow: "var(--vef-box-shadow-popover-arrow)",
342
+ boxShadowCard: "var(--vef-box-shadow-card)",
343
+ boxShadowDrawerRight: "var(--vef-box-shadow-drawer-right)",
344
+ boxShadowDrawerLeft: "var(--vef-box-shadow-drawer-left)",
345
+ boxShadowDrawerUp: "var(--vef-box-shadow-drawer-up)",
346
+ boxShadowDrawerDown: "var(--vef-box-shadow-drawer-down)",
347
+ boxShadowTabsOverflowLeft: "var(--vef-box-shadow-tabs-overflow-left)",
348
+ boxShadowTabsOverflowRight: "var(--vef-box-shadow-tabs-overflow-right)",
349
+ boxShadowTabsOverflowTop: "var(--vef-box-shadow-tabs-overflow-top)",
350
+ boxShadowTabsOverflowBottom: "var(--vef-box-shadow-tabs-overflow-bottom)",
351
+ boxShadowElevated: "0 0 1px rgb(0 0 0 / 30%), 0 4px 14px rgb(0 0 0 / 10%)"
352
+ };
353
+
354
+ exports.themeVariables = themeVariables;
package/cjs/types.cjs ADDED
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ 'use strict';
3
+
4
+ "use strict";
package/cjs/utils.cjs ADDED
@@ -0,0 +1,117 @@
1
+ "use strict";
2
+ 'use strict';
3
+
4
+ require('./lib.cjs');
5
+ var radashi = require('radashi');
6
+
7
+ "use strict";
8
+ function isAsyncFunction(fn) {
9
+ if (!radashi.isFunction(fn)) {
10
+ return false;
11
+ }
12
+ return fn.constructor.name === "AsyncFunction" || Object.prototype.toString.call(fn) === "[object AsyncFunction]" || fn.toString().startsWith("async ");
13
+ }
14
+ async function invokeMaybeAsyncFn(fn, {
15
+ beforeInvoke,
16
+ onSuccess,
17
+ onFinally
18
+ }, ...args) {
19
+ if (isAsyncFunction(fn)) {
20
+ try {
21
+ beforeInvoke?.();
22
+ const result = await fn(...args);
23
+ onSuccess?.(result);
24
+ return result;
25
+ } finally {
26
+ onFinally?.();
27
+ }
28
+ } else {
29
+ const returned = fn(...args);
30
+ if (returned instanceof Promise) {
31
+ try {
32
+ beforeInvoke?.();
33
+ const result = await returned;
34
+ onSuccess?.(result);
35
+ return result;
36
+ } finally {
37
+ onFinally?.();
38
+ }
39
+ } else {
40
+ return returned;
41
+ }
42
+ }
43
+ }
44
+ function difference(oldValues, newValues) {
45
+ return Object.keys(newValues).filter((key) => oldValues[key] !== newValues[key]).reduce(
46
+ (acc, key) => {
47
+ acc[key] = newValues[key];
48
+ return acc;
49
+ },
50
+ {}
51
+ );
52
+ }
53
+ function constantCase(value) {
54
+ return radashi.snake(value).toUpperCase();
55
+ }
56
+ function isInternalFunction(fn) {
57
+ if (isAsyncFunction(fn) && Reflect.has(fn, "name") && Reflect.has(fn, "key") && Reflect.get(fn, "name") === "apiFn") {
58
+ return true;
59
+ }
60
+ return false;
61
+ }
62
+ function getStringLength(value) {
63
+ if (radashi.isNumber(value)) {
64
+ return `${value}px`;
65
+ }
66
+ return value;
67
+ }
68
+ function buildRouteParentMenusMappings(menus) {
69
+ return new Map(doBuildRouteParentMenusMappings(menus));
70
+ }
71
+ function doBuildRouteParentMenusMappings(menus, parents = []) {
72
+ return menus.flatMap((menu) => {
73
+ if (menu.type === "item") {
74
+ return [[menu.key, [menu, parents]]];
75
+ } else if (menu.type === "submenu" || menu.type === "group") {
76
+ const { children, ...parent } = menu;
77
+ return [
78
+ [
79
+ parent.key,
80
+ [
81
+ {
82
+ ...parent,
83
+ children: []
84
+ },
85
+ parents
86
+ ]
87
+ ],
88
+ ...doBuildRouteParentMenusMappings(children, [
89
+ ...parents,
90
+ {
91
+ ...parent,
92
+ children: children.filter((child) => child.type !== "divider").map((child) => {
93
+ if (child.type === "item") {
94
+ return {
95
+ ...child
96
+ };
97
+ }
98
+ return {
99
+ ...child,
100
+ children: []
101
+ };
102
+ })
103
+ }
104
+ ])
105
+ ];
106
+ }
107
+ return [];
108
+ });
109
+ }
110
+
111
+ exports.buildRouteParentMenusMappings = buildRouteParentMenusMappings;
112
+ exports.constantCase = constantCase;
113
+ exports.difference = difference;
114
+ exports.getStringLength = getStringLength;
115
+ exports.invokeMaybeAsyncFn = invokeMaybeAsyncFn;
116
+ exports.isAsyncFunction = isAsyncFunction;
117
+ exports.isInternalFunction = isInternalFunction;