@vef-framework/shared 1.0.99 → 1.0.100

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/lib/message.cjs CHANGED
@@ -1,305 +1,3 @@
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;
1
+ /*! VefFramework version: 1.0.100, build time: 2025-03-07T13:52:51.660Z, made by Venus. */
2
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@ant-design/icons"),n=require("antd"),e=require("react"),t=require("./icons.cjs");require("./lib.cjs");const i=require("radashi"),{confirm:r,info:s,success:c,warning:a,error:u}=n.Modal,l=e.createElement(o,{component:t.IconCheck}),f=e.createElement(o,{component:t.IconTickCircle}),w=e.createElement(o,{component:t.IconInfoCircle}),h=e.createElement(o,{component:t.IconAlertTriangle}),g=e.createElement(o,{component:t.IconAlertCircle}),p=e.createElement(o,{className:"vef-notification-notice-icon vef-notification-notice-icon-success",component:t.IconTickCircle}),m=e.createElement(o,{className:"vef-notification-notice-icon vef-notification-notice-icon-info",component:t.IconInfoCircle}),d=e.createElement(o,{className:"vef-notification-notice-icon vef-notification-notice-icon-warning",component:t.IconAlertTriangle}),x=e.createElement(o,{className:"vef-notification-notice-icon vef-notification-notice-icon-error",component:t.IconAlertCircle});const E="提示";const A={color:"default",variant:"text"},I={icon:l};const v={success:c,info:s,warning:a,error:u},C={success:f,info:w,warning:h,error:g},F="👍🏻 好的,知道了";function showAlert(o,n,e=E,t,r){const{okText:s=F,onCancel:c,onAfterOpen:a,onAfterClose:u}=r??{},{destroy:l}=v[o]({title:e,content:n,icon:C[o],centered:!0,onOk:t,okText:s,onCancel:c,afterOpenChange:i.isFunction(a)||i.isFunction(u)?o=>{o?a?.():u?.()}:void 0});return l}exports.checkIcon=l,exports.defaultMessageTitle=E,exports.errorIcon=g,exports.infoIcon=w,exports.showConfirmation=function showConfirmation(o,n,e,t){const s=arguments.length;if(s<2)throw new Error("showConfirmation requires at least two arguments");const c=s>2?o:"提示",a=2===s?o:n,u=2===s?n:e,{okText:l,cancelText:f,onCancel:w,onAfterOpen:h,onAfterClose:g}=t??{},{destroy:p}=r({title:c,content:a,cancelButtonProps:A,okButtonProps:I,centered:!0,onOk:u,okText:l,cancelText:f,onCancel:w,afterOpenChange:i.isFunction(h)||i.isFunction(g)?o=>{o?h?.():g?.()}:void 0});return p},exports.showErrorAlert=function showErrorAlert(o,n,e,t){const r=arguments.length;if(r<1)throw new Error("showErrorAlert requires at least one argument");const s=1===r||i.isFunction(n)?void 0:o;return showAlert("error",1===r||i.isFunction(n)?o:n,s,2===r||i.isFunction(n)?n:e,t)},exports.showErrorMessage=function showErrorMessage(o){n.message.open({type:"error",content:o,duration:4,icon:g})},exports.showErrorNotification=function showErrorNotification(o,e,t){const i=arguments.length;if(i<1)throw new Error("showErrorNotification requires at least one argument");const r=i>1?o:E,s=i>1?e:o,c=3===i?t:void 0;n.notification.open({type:"error",message:r,description:s,duration:10,closable:!0,btn:c,icon:x})},exports.showInfoAlert=function showInfoAlert(o,n,e,t){const r=arguments.length;if(r<1)throw new Error("showInfoAlert requires at least one argument");const s=1===r||i.isFunction(n)?void 0:o;return showAlert("info",1===r||i.isFunction(n)?o:n,s,2===r||i.isFunction(n)?n:e,t)},exports.showInfoMessage=function showInfoMessage(o){n.message.open({type:"info",content:o,duration:3,icon:w})},exports.showInfoNotification=function showInfoNotification(o,e,t){const i=arguments.length;if(i<1)throw new Error("showInfoNotification requires at least one argument");const r=i>1?o:E,s=i>1?e:o,c=3===i?t:void 0;n.notification.open({type:"info",message:r,description:s,duration:5,closable:!0,btn:c,icon:m})},exports.showLoadingMessage=function showLoadingMessage(o){const e=n.message.open({type:"loading",content:o,duration:0});return()=>e()},exports.showSuccessAlert=function showSuccessAlert(o,n,e,t){const r=arguments.length;if(r<1)throw new Error("showSuccessAlert requires at least one argument");const s=1===r||i.isFunction(n)?void 0:o;return showAlert("success",1===r||i.isFunction(n)?o:n,s,2===r||i.isFunction(n)?n:e,t)},exports.showSuccessMessage=function showSuccessMessage(o){n.message.open({type:"success",content:o,duration:2,icon:f})},exports.showSuccessNotification=function showSuccessNotification(o,e,t){const i=arguments.length;if(i<1)throw new Error("showSuccessNotification requires at least one argument");const r=i>1?o:E,s=i>1?e:o,c=3===i?t:void 0;n.notification.open({type:"success",message:r,description:s,duration:4,closable:!0,btn:c,icon:p})},exports.showWarningAlert=function showWarningAlert(o,n,e,t){const r=arguments.length;if(r<1)throw new Error("showWarningAlert requires at least one argument");const s=1===r||i.isFunction(n)?void 0:o;return showAlert("warning",1===r||i.isFunction(n)?o:n,s,2===r||i.isFunction(n)?n:e,t)},exports.showWarningMessage=function showWarningMessage(o){n.message.open({type:"warning",content:o,duration:3,icon:h})},exports.showWarningNotification=function showWarningNotification(o,e,t){const i=arguments.length;if(i<1)throw new Error("showWarningNotification requires at least one argument");const r=i>1?o:E,s=i>1?e:o,c=3===i?t:void 0;n.notification.open({type:"warning",message:r,description:s,duration:6,closable:!0,btn:c,icon:d})},exports.successIcon=f,exports.warningIcon=h;
305
3
  /*! 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,42 +1,3 @@
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;
1
+ /*! VefFramework version: 1.0.100, build time: 2025-03-07T13:52:51.660Z, made by Venus. */
2
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("path-browserify"),{basename:e,dirname:r,extname:n,isAbsolute:a,join:o,normalize:i}=t;exports.extractBaseName=function extractBaseName(t,r=!0){const a=r?void 0:n(t);return e(t,a)},exports.extractDirName=function extractDirName(t){return r(t)},exports.extractExtName=function extractExtName(t){return n(t)},exports.isAbsolutePath=function isAbsolutePath(t){return a(t)},exports.joinPaths=function joinPaths(...t){return o(...t)},exports.normalizePath=function normalizePath(t){return i(t)};
42
3
  /*! 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,35 +1,3 @@
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;
1
+ /*! VefFramework version: 1.0.100, build time: 2025-03-07T13:52:51.660Z, made by Venus. */
2
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("pinyin-pro");exports.parsePinyin=function parsePinyin(e){return n.pinyin(e,{pattern:"pinyin",toneType:"none",type:"array",mode:"normal",nonZh:"consecutive"})},exports.parsePinyinFirstLetter=function parsePinyinFirstLetter(e){return n.pinyin(e,{pattern:"first",toneType:"none",type:"array",mode:"normal",nonZh:"consecutive"})};
35
3
  /*! 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,29 +1,3 @@
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;
1
+ /*! VefFramework version: 1.0.100, build time: 2025-03-07T13:52:51.660Z, made by Venus. */
2
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("jsencrypt");exports.decryptRsa=function decryptRsa(t,r){const n=new e;n.setPrivateKey(r);const o=n.decrypt(t);if(!o)throw new Error(`Failed to decrypt value [${t}] using RSA`);return o},exports.encryptRsa=function encryptRsa(t,r){const n=new e;n.setPublicKey(r);const o=n.encrypt(t);if(!o)throw new Error(`Failed to encrypt value [${t}] using RSA`);return o};
29
3
  /*! 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,107 +1,3 @@
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;
1
+ /*! VefFramework version: 1.0.100, build time: 2025-03-07T13:52:51.660Z, made by Venus. */
2
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),t=require("zustand/middleware"),r=require("zustand/traditional"),o=require("zustand/vanilla");require("./lib.cjs");const n=require("./utils.cjs"),s=require("radashi"),u=require("zustand/shallow");function createUnboundStore(e){return o.createStore(t.subscribeWithSelector(e))}function useUnboundStore(e,t,o){return r.useStoreWithEqualityFn(e,t,o??u.shallow)}exports.createComponentStore=function createComponentStore(t,r){const o=e.createContext(null),useStoreApi=()=>{const r=e.useContext(o);if(!r)throw new Error(`${t}Store can be used only inside ${t}StoreProvider`);return r};return{StoreProvider:({initialState:t,children:n})=>{const[s]=e.useState((()=>createUnboundStore(r(t)))),u=e.useRef(!1);return e.useEffect((()=>()=>{u.current=!1}),[]),e.useEffect((()=>{u.current||(u.current=!0),t&&s.setState({...t})}),[t,s]),e.createElement(o.Provider,{value:s},n)},useStore:e=>useUnboundStore(useStoreApi(),e),useStoreApi:useStoreApi}},exports.createStore=function createStore(e,o){const a=o?.name??"UNKNOWN",i=o?.storage??"local",c=o?o.selector:()=>null,l=function createStorageProxy(e){const r=t.createJSONStorage((()=>"local"===e?localStorage:sessionStorage));return{getItem:r.getItem,setItem(e,t){s.isNullish(t.state)||r.setItem(e,t)},removeItem:r.removeItem}}(i);return r.createWithEqualityFn(t.persist(t.subscribeWithSelector(e),{name:`__VEF_STORE__${n.constantCase(a)}__`,storage:l,version:1,partialize:c}),u.shallow)},exports.createUnboundStore=createUnboundStore,exports.useUnboundStore=useUnboundStore;
107
3
  /*! 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,57 +1,3 @@
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;
1
+ /*! VefFramework version: 1.0.100, build time: 2025-03-07T13:52:51.660Z, made by Venus. */
2
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("@emotion/react"),t={xs:0,sm:576,md:768,lg:992,xl:1200,xxl:1400},s=Object.keys(t).reduce(((e,s)=>(e[s]=`@media (min-width: ${t[s]}px)`,e)),{}),r={flexCenter:e.css({display:"flex",justifyContent:"center",alignItems:"center"}),fullHeight:e.css({height:"100%"}),fullWidth:e.css({width:"100%"}),scrollbar:e.css({scrollbarWidth:"thin",scrollbarColor:"rgba(0, 0, 0, 0.3) transparent",scrollbarGutter:"stable"})};exports.bmq=s,exports.breakpoints=["xs","sm","md","lg","xl","xxl"],exports.styles=r;
57
3
  /*! 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,29 +1,3 @@
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;
1
+ /*! VefFramework version: 1.0.100, build time: 2025-03-07T13:52:51.660Z, made by Venus. */
2
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("@date-fns/tz"),e=require("date-fns"),a=require("date-fns/locale");function getNowDate(){return new Date}exports.getNowDate=getNowDate,exports.getNowDateString=function getNowDateString(){return e.format(getNowDate(),"yyyy-MM-dd",{locale:a.zhCN,in:t.tz("Asia/Shanghai")})},exports.getTodayString=function getTodayString(){return e.format(getNowDate(),"PPPPpp",{locale:a.zhCN,in:t.tz("Asia/Shanghai")})};
29
3
  /*! 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 */