@vef-framework/shared 1.0.97 → 1.0.99
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/es/color.js +8 -2
- package/es/constants.js +30 -2
- package/es/context.js +33 -2
- package/es/dom.js +20 -2
- package/es/error.js +27 -2
- package/es/event.js +8 -2
- package/es/expression.js +22 -2
- package/es/function.js +13 -2
- package/es/icons.js +128 -2
- package/es/id.js +11 -2
- package/es/index.js +29 -2
- package/es/lib.js +5 -2
- package/es/message.js +281 -2
- package/es/path.js +32 -2
- package/es/pinyin.js +29 -2
- package/es/security.js +23 -2
- package/es/store.js +99 -2
- package/es/styles.js +50 -2
- package/es/temporal.js +22 -2
- package/es/theme-variables.js +351 -2
- package/es/utils.js +102 -2
- package/es/validation.js +150 -2
- package/es/yaml.js +8 -2
- package/lib/color.cjs +12 -2
- package/lib/constants.cjs +40 -2
- package/lib/context.cjs +37 -2
- package/lib/dom.cjs +24 -2
- package/lib/error.cjs +31 -2
- package/lib/event.cjs +12 -2
- package/lib/expression.cjs +28 -2
- package/lib/function.cjs +17 -2
- package/lib/icons.cjs +137 -2
- package/lib/id.cjs +15 -2
- package/lib/index.cjs +316 -2
- package/lib/lib.cjs +221 -2
- package/lib/message.cjs +304 -2
- package/lib/path.cjs +41 -2
- package/lib/pinyin.cjs +34 -2
- package/lib/security.cjs +28 -2
- package/lib/store.cjs +106 -2
- package/lib/styles.cjs +56 -2
- package/lib/temporal.cjs +28 -2
- package/lib/theme-variables.cjs +355 -2
- package/lib/types.cjs +4 -2
- package/lib/utils.cjs +111 -2
- package/lib/validation.cjs +190 -2
- package/lib/yaml.cjs +12 -2
- package/package.json +1 -1
package/lib/message.cjs
CHANGED
|
@@ -1,3 +1,305 @@
|
|
|
1
|
-
/*! VefFramework version: 1.0.
|
|
2
|
-
|
|
1
|
+
/*! VefFramework version: 1.0.99, build time: 2025-03-07T13:41:55.370Z, made by Venus. */
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
5
|
+
|
|
6
|
+
const Icon = require('@ant-design/icons');
|
|
7
|
+
const antd = require('antd');
|
|
8
|
+
const react = require('react');
|
|
9
|
+
const icons = require('./icons.cjs');
|
|
10
|
+
require('./lib.cjs');
|
|
11
|
+
const radashi = require('radashi');
|
|
12
|
+
|
|
13
|
+
const {
|
|
14
|
+
confirm,
|
|
15
|
+
info,
|
|
16
|
+
success,
|
|
17
|
+
warning,
|
|
18
|
+
error
|
|
19
|
+
} = antd.Modal;
|
|
20
|
+
const checkIcon = react.createElement(Icon, {
|
|
21
|
+
component: icons.IconCheck
|
|
22
|
+
});
|
|
23
|
+
const successIcon = react.createElement(Icon, {
|
|
24
|
+
component: icons.IconTickCircle
|
|
25
|
+
});
|
|
26
|
+
const infoIcon = react.createElement(Icon, {
|
|
27
|
+
component: icons.IconInfoCircle
|
|
28
|
+
});
|
|
29
|
+
const warningIcon = react.createElement(Icon, {
|
|
30
|
+
component: icons.IconAlertTriangle
|
|
31
|
+
});
|
|
32
|
+
const errorIcon = react.createElement(Icon, {
|
|
33
|
+
component: icons.IconAlertCircle
|
|
34
|
+
});
|
|
35
|
+
const notificationSuccessIcon = react.createElement(Icon, {
|
|
36
|
+
className: "vef-notification-notice-icon vef-notification-notice-icon-success",
|
|
37
|
+
component: icons.IconTickCircle
|
|
38
|
+
});
|
|
39
|
+
const notificationInfoIcon = react.createElement(Icon, {
|
|
40
|
+
className: "vef-notification-notice-icon vef-notification-notice-icon-info",
|
|
41
|
+
component: icons.IconInfoCircle
|
|
42
|
+
});
|
|
43
|
+
const notificationWarningIcon = react.createElement(Icon, {
|
|
44
|
+
className: "vef-notification-notice-icon vef-notification-notice-icon-warning",
|
|
45
|
+
component: icons.IconAlertTriangle
|
|
46
|
+
});
|
|
47
|
+
const notificationErrorIcon = react.createElement(Icon, {
|
|
48
|
+
className: "vef-notification-notice-icon vef-notification-notice-icon-error",
|
|
49
|
+
component: icons.IconAlertCircle
|
|
50
|
+
});
|
|
51
|
+
function showSuccessMessage(content) {
|
|
52
|
+
antd.message.open({
|
|
53
|
+
type: "success",
|
|
54
|
+
content,
|
|
55
|
+
duration: 2,
|
|
56
|
+
icon: successIcon
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
function showInfoMessage(content) {
|
|
60
|
+
antd.message.open({
|
|
61
|
+
type: "info",
|
|
62
|
+
content,
|
|
63
|
+
duration: 3,
|
|
64
|
+
icon: infoIcon
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
function showWarningMessage(content) {
|
|
68
|
+
antd.message.open({
|
|
69
|
+
type: "warning",
|
|
70
|
+
content,
|
|
71
|
+
duration: 3,
|
|
72
|
+
icon: warningIcon
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
function showErrorMessage(content) {
|
|
76
|
+
antd.message.open({
|
|
77
|
+
type: "error",
|
|
78
|
+
content,
|
|
79
|
+
duration: 4,
|
|
80
|
+
icon: errorIcon
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
function showLoadingMessage(content) {
|
|
84
|
+
const close = antd.message.open({
|
|
85
|
+
type: "loading",
|
|
86
|
+
content,
|
|
87
|
+
duration: 0
|
|
88
|
+
});
|
|
89
|
+
return () => close();
|
|
90
|
+
}
|
|
91
|
+
const defaultMessageTitle = "\u63D0\u793A";
|
|
92
|
+
function showSuccessNotification(titleOrContent, content, buttons) {
|
|
93
|
+
const argsLength = arguments.length;
|
|
94
|
+
if (argsLength < 1) {
|
|
95
|
+
throw new Error("showSuccessNotification requires at least one argument");
|
|
96
|
+
}
|
|
97
|
+
const titleToUse = argsLength > 1 ? titleOrContent : defaultMessageTitle;
|
|
98
|
+
const contentToUse = argsLength > 1 ? content : titleOrContent;
|
|
99
|
+
const buttonsToUse = argsLength === 3 ? buttons : void 0;
|
|
100
|
+
antd.notification.open({
|
|
101
|
+
type: "success",
|
|
102
|
+
message: titleToUse,
|
|
103
|
+
description: contentToUse,
|
|
104
|
+
duration: 4,
|
|
105
|
+
closable: true,
|
|
106
|
+
btn: buttonsToUse,
|
|
107
|
+
icon: notificationSuccessIcon
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
function showInfoNotification(titleOrContent, content, buttons) {
|
|
111
|
+
const argsLength = arguments.length;
|
|
112
|
+
if (argsLength < 1) {
|
|
113
|
+
throw new Error("showInfoNotification requires at least one argument");
|
|
114
|
+
}
|
|
115
|
+
const titleToUse = argsLength > 1 ? titleOrContent : defaultMessageTitle;
|
|
116
|
+
const contentToUse = argsLength > 1 ? content : titleOrContent;
|
|
117
|
+
const buttonsToUse = argsLength === 3 ? buttons : void 0;
|
|
118
|
+
antd.notification.open({
|
|
119
|
+
type: "info",
|
|
120
|
+
message: titleToUse,
|
|
121
|
+
description: contentToUse,
|
|
122
|
+
duration: 5,
|
|
123
|
+
closable: true,
|
|
124
|
+
btn: buttonsToUse,
|
|
125
|
+
icon: notificationInfoIcon
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
function showWarningNotification(titleOrContent, content, buttons) {
|
|
129
|
+
const argsLength = arguments.length;
|
|
130
|
+
if (argsLength < 1) {
|
|
131
|
+
throw new Error("showWarningNotification requires at least one argument");
|
|
132
|
+
}
|
|
133
|
+
const titleToUse = argsLength > 1 ? titleOrContent : defaultMessageTitle;
|
|
134
|
+
const contentToUse = argsLength > 1 ? content : titleOrContent;
|
|
135
|
+
const buttonsToUse = argsLength === 3 ? buttons : void 0;
|
|
136
|
+
antd.notification.open({
|
|
137
|
+
type: "warning",
|
|
138
|
+
message: titleToUse,
|
|
139
|
+
description: contentToUse,
|
|
140
|
+
duration: 6,
|
|
141
|
+
closable: true,
|
|
142
|
+
btn: buttonsToUse,
|
|
143
|
+
icon: notificationWarningIcon
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
function showErrorNotification(titleOrContent, content, buttons) {
|
|
147
|
+
const argsLength = arguments.length;
|
|
148
|
+
if (argsLength < 1) {
|
|
149
|
+
throw new Error("showErrorNotification requires at least one argument");
|
|
150
|
+
}
|
|
151
|
+
const titleToUse = argsLength > 1 ? titleOrContent : defaultMessageTitle;
|
|
152
|
+
const contentToUse = argsLength > 1 ? content : titleOrContent;
|
|
153
|
+
const buttonsToUse = argsLength === 3 ? buttons : void 0;
|
|
154
|
+
antd.notification.open({
|
|
155
|
+
type: "error",
|
|
156
|
+
message: titleToUse,
|
|
157
|
+
description: contentToUse,
|
|
158
|
+
duration: 10,
|
|
159
|
+
closable: true,
|
|
160
|
+
btn: buttonsToUse,
|
|
161
|
+
icon: notificationErrorIcon
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
const cancelButtonProps = {
|
|
165
|
+
color: "default",
|
|
166
|
+
variant: "text"
|
|
167
|
+
};
|
|
168
|
+
const okButtonProps = {
|
|
169
|
+
icon: checkIcon
|
|
170
|
+
};
|
|
171
|
+
function showConfirmation(title, content, onOk, options) {
|
|
172
|
+
const argsLength = arguments.length;
|
|
173
|
+
if (argsLength < 2) {
|
|
174
|
+
throw new Error("showConfirmation requires at least two arguments");
|
|
175
|
+
}
|
|
176
|
+
const titleToUse = argsLength > 2 ? title : "\u63D0\u793A";
|
|
177
|
+
const contentToUse = argsLength === 2 ? title : content;
|
|
178
|
+
const onOkToUse = argsLength === 2 ? content : onOk;
|
|
179
|
+
const {
|
|
180
|
+
okText,
|
|
181
|
+
cancelText,
|
|
182
|
+
onCancel,
|
|
183
|
+
onAfterOpen,
|
|
184
|
+
onAfterClose
|
|
185
|
+
} = options ?? {};
|
|
186
|
+
const { destroy } = confirm({
|
|
187
|
+
title: titleToUse,
|
|
188
|
+
content: contentToUse,
|
|
189
|
+
cancelButtonProps,
|
|
190
|
+
okButtonProps,
|
|
191
|
+
centered: true,
|
|
192
|
+
onOk: onOkToUse,
|
|
193
|
+
okText,
|
|
194
|
+
cancelText,
|
|
195
|
+
onCancel,
|
|
196
|
+
afterOpenChange: radashi.isFunction(onAfterOpen) || radashi.isFunction(onAfterClose) ? (open) => {
|
|
197
|
+
if (open) {
|
|
198
|
+
onAfterOpen?.();
|
|
199
|
+
} else {
|
|
200
|
+
onAfterClose?.();
|
|
201
|
+
}
|
|
202
|
+
} : void 0
|
|
203
|
+
});
|
|
204
|
+
return destroy;
|
|
205
|
+
}
|
|
206
|
+
const alertFnMap = {
|
|
207
|
+
success,
|
|
208
|
+
info,
|
|
209
|
+
warning,
|
|
210
|
+
error
|
|
211
|
+
};
|
|
212
|
+
const alertIconMap = {
|
|
213
|
+
success: successIcon,
|
|
214
|
+
info: infoIcon,
|
|
215
|
+
warning: warningIcon,
|
|
216
|
+
error: errorIcon
|
|
217
|
+
};
|
|
218
|
+
const defaultOkText = "\u{1F44D}\u{1F3FB} \u597D\u7684\uFF0C\u77E5\u9053\u4E86";
|
|
219
|
+
function showAlert(type, content, title = defaultMessageTitle, onOk, options) {
|
|
220
|
+
const {
|
|
221
|
+
okText = defaultOkText,
|
|
222
|
+
onCancel,
|
|
223
|
+
onAfterOpen,
|
|
224
|
+
onAfterClose
|
|
225
|
+
} = options ?? {};
|
|
226
|
+
const { destroy } = alertFnMap[type]({
|
|
227
|
+
title,
|
|
228
|
+
content,
|
|
229
|
+
icon: alertIconMap[type],
|
|
230
|
+
centered: true,
|
|
231
|
+
onOk,
|
|
232
|
+
okText,
|
|
233
|
+
onCancel,
|
|
234
|
+
afterOpenChange: radashi.isFunction(onAfterOpen) || radashi.isFunction(onAfterClose) ? (open) => {
|
|
235
|
+
if (open) {
|
|
236
|
+
onAfterOpen?.();
|
|
237
|
+
} else {
|
|
238
|
+
onAfterClose?.();
|
|
239
|
+
}
|
|
240
|
+
} : void 0
|
|
241
|
+
});
|
|
242
|
+
return destroy;
|
|
243
|
+
}
|
|
244
|
+
function showSuccessAlert(title, content, onOk, options) {
|
|
245
|
+
const argsLength = arguments.length;
|
|
246
|
+
if (argsLength < 1) {
|
|
247
|
+
throw new Error("showSuccessAlert requires at least one argument");
|
|
248
|
+
}
|
|
249
|
+
const titleToUse = argsLength === 1 || radashi.isFunction(content) ? void 0 : title;
|
|
250
|
+
const contentToUse = argsLength === 1 || radashi.isFunction(content) ? title : content;
|
|
251
|
+
const onOkToUse = argsLength === 2 || radashi.isFunction(content) ? content : onOk;
|
|
252
|
+
return showAlert("success", contentToUse, titleToUse, onOkToUse, options);
|
|
253
|
+
}
|
|
254
|
+
function showInfoAlert(title, content, onOk, options) {
|
|
255
|
+
const argsLength = arguments.length;
|
|
256
|
+
if (argsLength < 1) {
|
|
257
|
+
throw new Error("showInfoAlert requires at least one argument");
|
|
258
|
+
}
|
|
259
|
+
const titleToUse = argsLength === 1 || radashi.isFunction(content) ? void 0 : title;
|
|
260
|
+
const contentToUse = argsLength === 1 || radashi.isFunction(content) ? title : content;
|
|
261
|
+
const onOkToUse = argsLength === 2 || radashi.isFunction(content) ? content : onOk;
|
|
262
|
+
return showAlert("info", contentToUse, titleToUse, onOkToUse, options);
|
|
263
|
+
}
|
|
264
|
+
function showWarningAlert(title, content, onOk, options) {
|
|
265
|
+
const argsLength = arguments.length;
|
|
266
|
+
if (argsLength < 1) {
|
|
267
|
+
throw new Error("showWarningAlert requires at least one argument");
|
|
268
|
+
}
|
|
269
|
+
const titleToUse = argsLength === 1 || radashi.isFunction(content) ? void 0 : title;
|
|
270
|
+
const contentToUse = argsLength === 1 || radashi.isFunction(content) ? title : content;
|
|
271
|
+
const onOkToUse = argsLength === 2 || radashi.isFunction(content) ? content : onOk;
|
|
272
|
+
return showAlert("warning", contentToUse, titleToUse, onOkToUse, options);
|
|
273
|
+
}
|
|
274
|
+
function showErrorAlert(title, content, onOk, options) {
|
|
275
|
+
const argsLength = arguments.length;
|
|
276
|
+
if (argsLength < 1) {
|
|
277
|
+
throw new Error("showErrorAlert requires at least one argument");
|
|
278
|
+
}
|
|
279
|
+
const titleToUse = argsLength === 1 || radashi.isFunction(content) ? void 0 : title;
|
|
280
|
+
const contentToUse = argsLength === 1 || radashi.isFunction(content) ? title : content;
|
|
281
|
+
const onOkToUse = argsLength === 2 || radashi.isFunction(content) ? content : onOk;
|
|
282
|
+
return showAlert("error", contentToUse, titleToUse, onOkToUse, options);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
exports.checkIcon = checkIcon;
|
|
286
|
+
exports.defaultMessageTitle = defaultMessageTitle;
|
|
287
|
+
exports.errorIcon = errorIcon;
|
|
288
|
+
exports.infoIcon = infoIcon;
|
|
289
|
+
exports.showConfirmation = showConfirmation;
|
|
290
|
+
exports.showErrorAlert = showErrorAlert;
|
|
291
|
+
exports.showErrorMessage = showErrorMessage;
|
|
292
|
+
exports.showErrorNotification = showErrorNotification;
|
|
293
|
+
exports.showInfoAlert = showInfoAlert;
|
|
294
|
+
exports.showInfoMessage = showInfoMessage;
|
|
295
|
+
exports.showInfoNotification = showInfoNotification;
|
|
296
|
+
exports.showLoadingMessage = showLoadingMessage;
|
|
297
|
+
exports.showSuccessAlert = showSuccessAlert;
|
|
298
|
+
exports.showSuccessMessage = showSuccessMessage;
|
|
299
|
+
exports.showSuccessNotification = showSuccessNotification;
|
|
300
|
+
exports.showWarningAlert = showWarningAlert;
|
|
301
|
+
exports.showWarningMessage = showWarningMessage;
|
|
302
|
+
exports.showWarningNotification = showWarningNotification;
|
|
303
|
+
exports.successIcon = successIcon;
|
|
304
|
+
exports.warningIcon = warningIcon;
|
|
3
305
|
/*! VefFramework is a blazingly high-level, modern, flexible, easy-to-use UI framework made by Venus. Follow me on Github: https://github.com/ilxqx! @ilxqx */
|
package/lib/path.cjs
CHANGED
|
@@ -1,3 +1,42 @@
|
|
|
1
|
-
/*! VefFramework version: 1.0.
|
|
2
|
-
|
|
1
|
+
/*! VefFramework version: 1.0.99, build time: 2025-03-07T13:41:55.370Z, made by Venus. */
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
5
|
+
|
|
6
|
+
const path = require('path-browserify');
|
|
7
|
+
|
|
8
|
+
const {
|
|
9
|
+
basename,
|
|
10
|
+
dirname,
|
|
11
|
+
extname,
|
|
12
|
+
isAbsolute,
|
|
13
|
+
join,
|
|
14
|
+
normalize
|
|
15
|
+
} = path;
|
|
16
|
+
function extractBaseName(path2, keepExt = true) {
|
|
17
|
+
const ext = keepExt ? void 0 : extname(path2);
|
|
18
|
+
return basename(path2, ext);
|
|
19
|
+
}
|
|
20
|
+
function extractExtName(path2) {
|
|
21
|
+
return extname(path2);
|
|
22
|
+
}
|
|
23
|
+
function extractDirName(path2) {
|
|
24
|
+
return dirname(path2);
|
|
25
|
+
}
|
|
26
|
+
function joinPaths(...paths) {
|
|
27
|
+
return join(...paths);
|
|
28
|
+
}
|
|
29
|
+
function isAbsolutePath(path2) {
|
|
30
|
+
return isAbsolute(path2);
|
|
31
|
+
}
|
|
32
|
+
function normalizePath(path2) {
|
|
33
|
+
return normalize(path2);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
exports.extractBaseName = extractBaseName;
|
|
37
|
+
exports.extractDirName = extractDirName;
|
|
38
|
+
exports.extractExtName = extractExtName;
|
|
39
|
+
exports.isAbsolutePath = isAbsolutePath;
|
|
40
|
+
exports.joinPaths = joinPaths;
|
|
41
|
+
exports.normalizePath = normalizePath;
|
|
3
42
|
/*! VefFramework is a blazingly high-level, modern, flexible, easy-to-use UI framework made by Venus. Follow me on Github: https://github.com/ilxqx! @ilxqx */
|
package/lib/pinyin.cjs
CHANGED
|
@@ -1,3 +1,35 @@
|
|
|
1
|
-
/*! VefFramework version: 1.0.
|
|
2
|
-
|
|
1
|
+
/*! VefFramework version: 1.0.99, build time: 2025-03-07T13:41:55.370Z, made by Venus. */
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
5
|
+
|
|
6
|
+
const pinyinPro = require('pinyin-pro');
|
|
7
|
+
|
|
8
|
+
function parsePinyin(text) {
|
|
9
|
+
return pinyinPro.pinyin(
|
|
10
|
+
text,
|
|
11
|
+
{
|
|
12
|
+
pattern: "pinyin",
|
|
13
|
+
toneType: "none",
|
|
14
|
+
type: "array",
|
|
15
|
+
mode: "normal",
|
|
16
|
+
nonZh: "consecutive"
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
function parsePinyinFirstLetter(text) {
|
|
21
|
+
return pinyinPro.pinyin(
|
|
22
|
+
text,
|
|
23
|
+
{
|
|
24
|
+
pattern: "first",
|
|
25
|
+
toneType: "none",
|
|
26
|
+
type: "array",
|
|
27
|
+
mode: "normal",
|
|
28
|
+
nonZh: "consecutive"
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
exports.parsePinyin = parsePinyin;
|
|
34
|
+
exports.parsePinyinFirstLetter = parsePinyinFirstLetter;
|
|
3
35
|
/*! VefFramework is a blazingly high-level, modern, flexible, easy-to-use UI framework made by Venus. Follow me on Github: https://github.com/ilxqx! @ilxqx */
|
package/lib/security.cjs
CHANGED
|
@@ -1,3 +1,29 @@
|
|
|
1
|
-
/*! VefFramework version: 1.0.
|
|
2
|
-
|
|
1
|
+
/*! VefFramework version: 1.0.99, build time: 2025-03-07T13:41:55.370Z, made by Venus. */
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
5
|
+
|
|
6
|
+
const JSEncrypt = require('jsencrypt');
|
|
7
|
+
|
|
8
|
+
function encryptRsa(value, publicKey) {
|
|
9
|
+
const rsa = new JSEncrypt();
|
|
10
|
+
rsa.setPublicKey(publicKey);
|
|
11
|
+
const encrypted = rsa.encrypt(value);
|
|
12
|
+
if (!encrypted) {
|
|
13
|
+
throw new Error(`Failed to encrypt value [${value}] using RSA`);
|
|
14
|
+
}
|
|
15
|
+
return encrypted;
|
|
16
|
+
}
|
|
17
|
+
function decryptRsa(value, privateKey) {
|
|
18
|
+
const rsa = new JSEncrypt();
|
|
19
|
+
rsa.setPrivateKey(privateKey);
|
|
20
|
+
const decrypted = rsa.decrypt(value);
|
|
21
|
+
if (!decrypted) {
|
|
22
|
+
throw new Error(`Failed to decrypt value [${value}] using RSA`);
|
|
23
|
+
}
|
|
24
|
+
return decrypted;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
exports.decryptRsa = decryptRsa;
|
|
28
|
+
exports.encryptRsa = encryptRsa;
|
|
3
29
|
/*! VefFramework is a blazingly high-level, modern, flexible, easy-to-use UI framework made by Venus. Follow me on Github: https://github.com/ilxqx! @ilxqx */
|
package/lib/store.cjs
CHANGED
|
@@ -1,3 +1,107 @@
|
|
|
1
|
-
/*! VefFramework version: 1.0.
|
|
2
|
-
|
|
1
|
+
/*! VefFramework version: 1.0.99, build time: 2025-03-07T13:41:55.370Z, made by Venus. */
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
5
|
+
|
|
6
|
+
const react = require('react');
|
|
7
|
+
const middleware = require('zustand/middleware');
|
|
8
|
+
const traditional = require('zustand/traditional');
|
|
9
|
+
const vanilla = require('zustand/vanilla');
|
|
10
|
+
require('./lib.cjs');
|
|
11
|
+
const utils = require('./utils.cjs');
|
|
12
|
+
const radashi = require('radashi');
|
|
13
|
+
const shallow = require('zustand/shallow');
|
|
14
|
+
|
|
15
|
+
function createStorageProxy(storage) {
|
|
16
|
+
const delegate = middleware.createJSONStorage(() => storage === "local" ? localStorage : sessionStorage);
|
|
17
|
+
return {
|
|
18
|
+
getItem: delegate.getItem,
|
|
19
|
+
setItem(name, value) {
|
|
20
|
+
if (radashi.isNullish(value.state)) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
delegate.setItem(name, value);
|
|
24
|
+
},
|
|
25
|
+
removeItem: delegate.removeItem
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function createStore(stateCreator, persistenceOptions) {
|
|
29
|
+
const name = persistenceOptions?.name ?? "UNKNOWN";
|
|
30
|
+
const storage = persistenceOptions?.storage ?? "local";
|
|
31
|
+
const selector = persistenceOptions ? persistenceOptions.selector : () => null;
|
|
32
|
+
const storageInstance = createStorageProxy(storage);
|
|
33
|
+
return traditional.createWithEqualityFn(
|
|
34
|
+
middleware.persist(
|
|
35
|
+
middleware.subscribeWithSelector(stateCreator),
|
|
36
|
+
{
|
|
37
|
+
name: `__VEF_STORE__${utils.constantCase(name)}__`,
|
|
38
|
+
storage: storageInstance,
|
|
39
|
+
version: 1,
|
|
40
|
+
partialize: selector
|
|
41
|
+
}
|
|
42
|
+
),
|
|
43
|
+
shallow.shallow
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
function createUnboundStore(stateCreator) {
|
|
47
|
+
return vanilla.createStore(
|
|
48
|
+
middleware.subscribeWithSelector(stateCreator)
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
function useUnboundStore(store, selector, equalityFn) {
|
|
52
|
+
return traditional.useStoreWithEqualityFn(
|
|
53
|
+
store,
|
|
54
|
+
selector,
|
|
55
|
+
equalityFn ?? shallow.shallow
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
function createComponentStore(name, getStateCreator) {
|
|
59
|
+
const StoreContext = react.createContext(null);
|
|
60
|
+
const StoreProvider = ({ initialState, children }) => {
|
|
61
|
+
const [store] = react.useState(() => {
|
|
62
|
+
const creator = getStateCreator(initialState);
|
|
63
|
+
return createUnboundStore(creator);
|
|
64
|
+
});
|
|
65
|
+
const isMounted = react.useRef(false);
|
|
66
|
+
react.useEffect(() => () => {
|
|
67
|
+
isMounted.current = false;
|
|
68
|
+
}, []);
|
|
69
|
+
react.useEffect(() => {
|
|
70
|
+
if (!isMounted.current) {
|
|
71
|
+
isMounted.current = true;
|
|
72
|
+
}
|
|
73
|
+
if (initialState) {
|
|
74
|
+
store.setState({
|
|
75
|
+
...initialState
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
}, [initialState, store]);
|
|
79
|
+
return react.createElement(
|
|
80
|
+
StoreContext.Provider,
|
|
81
|
+
{ value: store },
|
|
82
|
+
children
|
|
83
|
+
);
|
|
84
|
+
};
|
|
85
|
+
const useStoreApi = () => {
|
|
86
|
+
const store = react.useContext(StoreContext);
|
|
87
|
+
if (!store) {
|
|
88
|
+
throw new Error(`${name}Store can be used only inside ${name}StoreProvider`);
|
|
89
|
+
}
|
|
90
|
+
return store;
|
|
91
|
+
};
|
|
92
|
+
const useStore = (selector) => useUnboundStore(
|
|
93
|
+
useStoreApi(),
|
|
94
|
+
selector
|
|
95
|
+
);
|
|
96
|
+
return {
|
|
97
|
+
StoreProvider,
|
|
98
|
+
useStore,
|
|
99
|
+
useStoreApi
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
exports.createComponentStore = createComponentStore;
|
|
104
|
+
exports.createStore = createStore;
|
|
105
|
+
exports.createUnboundStore = createUnboundStore;
|
|
106
|
+
exports.useUnboundStore = useUnboundStore;
|
|
3
107
|
/*! VefFramework is a blazingly high-level, modern, flexible, easy-to-use UI framework made by Venus. Follow me on Github: https://github.com/ilxqx! @ilxqx */
|
package/lib/styles.cjs
CHANGED
|
@@ -1,3 +1,57 @@
|
|
|
1
|
-
/*! VefFramework version: 1.0.
|
|
2
|
-
|
|
1
|
+
/*! VefFramework version: 1.0.99, build time: 2025-03-07T13:41:55.370Z, made by Venus. */
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
5
|
+
|
|
6
|
+
const react = require('@emotion/react');
|
|
7
|
+
|
|
8
|
+
const breakpointWidths = {
|
|
9
|
+
xs: 0,
|
|
10
|
+
sm: 576,
|
|
11
|
+
md: 768,
|
|
12
|
+
lg: 992,
|
|
13
|
+
xl: 1200,
|
|
14
|
+
xxl: 1400
|
|
15
|
+
};
|
|
16
|
+
const breakpoints = [
|
|
17
|
+
"xs",
|
|
18
|
+
"sm",
|
|
19
|
+
"md",
|
|
20
|
+
"lg",
|
|
21
|
+
"xl",
|
|
22
|
+
"xxl"
|
|
23
|
+
];
|
|
24
|
+
const bmq = Object.keys(breakpointWidths).reduce(
|
|
25
|
+
(acc, label) => {
|
|
26
|
+
acc[label] = `@media (min-width: ${breakpointWidths[label]}px)`;
|
|
27
|
+
return acc;
|
|
28
|
+
},
|
|
29
|
+
{}
|
|
30
|
+
);
|
|
31
|
+
const styles = {
|
|
32
|
+
// Flex center style
|
|
33
|
+
flexCenter: react.css({
|
|
34
|
+
display: "flex",
|
|
35
|
+
justifyContent: "center",
|
|
36
|
+
alignItems: "center"
|
|
37
|
+
}),
|
|
38
|
+
// Full height style
|
|
39
|
+
fullHeight: react.css({
|
|
40
|
+
height: "100%"
|
|
41
|
+
}),
|
|
42
|
+
// Full width style
|
|
43
|
+
fullWidth: react.css({
|
|
44
|
+
width: "100%"
|
|
45
|
+
}),
|
|
46
|
+
// Scrollbar style
|
|
47
|
+
scrollbar: react.css({
|
|
48
|
+
scrollbarWidth: "thin",
|
|
49
|
+
scrollbarColor: "rgba(0, 0, 0, 0.3) transparent",
|
|
50
|
+
scrollbarGutter: "stable"
|
|
51
|
+
})
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
exports.bmq = bmq;
|
|
55
|
+
exports.breakpoints = breakpoints;
|
|
56
|
+
exports.styles = styles;
|
|
3
57
|
/*! VefFramework is a blazingly high-level, modern, flexible, easy-to-use UI framework made by Venus. Follow me on Github: https://github.com/ilxqx! @ilxqx */
|
package/lib/temporal.cjs
CHANGED
|
@@ -1,3 +1,29 @@
|
|
|
1
|
-
/*! VefFramework version: 1.0.
|
|
2
|
-
|
|
1
|
+
/*! VefFramework version: 1.0.99, build time: 2025-03-07T13:41:55.370Z, made by Venus. */
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
5
|
+
|
|
6
|
+
const tz = require('@date-fns/tz');
|
|
7
|
+
const dateFns = require('date-fns');
|
|
8
|
+
const locale = require('date-fns/locale');
|
|
9
|
+
|
|
10
|
+
function getNowDate() {
|
|
11
|
+
return /* @__PURE__ */ new Date();
|
|
12
|
+
}
|
|
13
|
+
function getNowDateString() {
|
|
14
|
+
return dateFns.format(getNowDate(), "yyyy-MM-dd", {
|
|
15
|
+
locale: locale.zhCN,
|
|
16
|
+
in: tz.tz("Asia/Shanghai")
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
function getTodayString() {
|
|
20
|
+
return dateFns.format(getNowDate(), "PPPPpp", {
|
|
21
|
+
locale: locale.zhCN,
|
|
22
|
+
in: tz.tz("Asia/Shanghai")
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
exports.getNowDate = getNowDate;
|
|
27
|
+
exports.getNowDateString = getNowDateString;
|
|
28
|
+
exports.getTodayString = getTodayString;
|
|
3
29
|
/*! VefFramework is a blazingly high-level, modern, flexible, easy-to-use UI framework made by Venus. Follow me on Github: https://github.com/ilxqx! @ilxqx */
|