@sybz-components/utils 1.0.11 → 1.0.12

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/dist/base.cjs CHANGED
@@ -3,9 +3,10 @@
3
3
  require('vue');
4
4
  require('consola');
5
5
  require('es-toolkit');
6
- const format = require('./shared/utils.DfuweQgy.cjs');
6
+ const format = require('./shared/utils.-eWHeuS_.cjs');
7
7
  require('./confirmSemantic.cjs');
8
8
  require('element-plus');
9
+ require('axios');
9
10
  require('./is.cjs');
10
11
 
11
12
 
package/dist/base.d.cts CHANGED
@@ -1,7 +1,10 @@
1
1
  import * as vue from 'vue';
2
2
  import { VNode, AppContext, Ref } from 'vue';
3
+ import { SybzComponentTheme } from './theme.cjs';
3
4
  import { ConfirmVariant, ConfirmTarget } from './confirmSemantic.cjs';
4
5
  import { MessageOptions, ElMessageBoxOptions, ElMessageBox } from 'element-plus';
6
+ import { CreateHttpOptions } from './http.cjs';
7
+ import 'axios';
5
8
 
6
9
  type Func<Args extends any[] = any[], Return = any> = (...args: Args) => Return;
7
10
  type StorageValue = unknown;
@@ -26,12 +29,14 @@ type MockValueOptionItem<T = any> = {
26
29
  label: string;
27
30
  value: T;
28
31
  };
29
- type UtilsTheme = 'default' | 'chenghua' | 'shijingshan';
32
+ type UtilsTheme = SybzComponentTheme;
30
33
  interface SybzUtilsConfig {
31
34
  /**
32
35
  * 工具函数的默认主题。
33
36
  */
34
37
  theme?: UtilsTheme;
38
+ /** HTTP 客户端的全局配置,应用入口配置一次即可。 */
39
+ http?: CreateHttpOptions;
35
40
  }
36
41
  interface ToastOptions extends Partial<MessageOptions> {
37
42
  /**
package/dist/base.d.mts CHANGED
@@ -1,7 +1,10 @@
1
1
  import * as vue from 'vue';
2
2
  import { VNode, AppContext, Ref } from 'vue';
3
+ import { SybzComponentTheme } from './theme.mjs';
3
4
  import { ConfirmVariant, ConfirmTarget } from './confirmSemantic.mjs';
4
5
  import { MessageOptions, ElMessageBoxOptions, ElMessageBox } from 'element-plus';
6
+ import { CreateHttpOptions } from './http.mjs';
7
+ import 'axios';
5
8
 
6
9
  type Func<Args extends any[] = any[], Return = any> = (...args: Args) => Return;
7
10
  type StorageValue = unknown;
@@ -26,12 +29,14 @@ type MockValueOptionItem<T = any> = {
26
29
  label: string;
27
30
  value: T;
28
31
  };
29
- type UtilsTheme = 'default' | 'chenghua' | 'shijingshan';
32
+ type UtilsTheme = SybzComponentTheme;
30
33
  interface SybzUtilsConfig {
31
34
  /**
32
35
  * 工具函数的默认主题。
33
36
  */
34
37
  theme?: UtilsTheme;
38
+ /** HTTP 客户端的全局配置,应用入口配置一次即可。 */
39
+ http?: CreateHttpOptions;
35
40
  }
36
41
  interface ToastOptions extends Partial<MessageOptions> {
37
42
  /**
package/dist/base.d.ts CHANGED
@@ -1,7 +1,10 @@
1
1
  import * as vue from 'vue';
2
2
  import { VNode, AppContext, Ref } from 'vue';
3
+ import { SybzComponentTheme } from './theme.js';
3
4
  import { ConfirmVariant, ConfirmTarget } from './confirmSemantic.js';
4
5
  import { MessageOptions, ElMessageBoxOptions, ElMessageBox } from 'element-plus';
6
+ import { CreateHttpOptions } from './http.js';
7
+ import 'axios';
5
8
 
6
9
  type Func<Args extends any[] = any[], Return = any> = (...args: Args) => Return;
7
10
  type StorageValue = unknown;
@@ -26,12 +29,14 @@ type MockValueOptionItem<T = any> = {
26
29
  label: string;
27
30
  value: T;
28
31
  };
29
- type UtilsTheme = 'default' | 'chenghua' | 'shijingshan';
32
+ type UtilsTheme = SybzComponentTheme;
30
33
  interface SybzUtilsConfig {
31
34
  /**
32
35
  * 工具函数的默认主题。
33
36
  */
34
37
  theme?: UtilsTheme;
38
+ /** HTTP 客户端的全局配置,应用入口配置一次即可。 */
39
+ http?: CreateHttpOptions;
35
40
  }
36
41
  interface ToastOptions extends Partial<MessageOptions> {
37
42
  /**
package/dist/base.mjs CHANGED
@@ -1,7 +1,8 @@
1
1
  import 'vue';
2
2
  import 'consola';
3
3
  import 'es-toolkit';
4
- export { $ as $toast, c as clearStorage, a as clone, b as configureUtils, d as confirm, e as copy, f as debounce, g as delay, h as getStorage, i as getType, j as getUtilsBuildTime, k as getVariable, l as isEmpty, m as log, n as merge, o as mockValue, p as processWidth, r as random, s as setStorage, t as test, q as throttle, u as toLine, v as tryCatch, w as validate, x as validateForm, y as validateOnSubmit } from './shared/utils.CJdEsMHi.mjs';
4
+ export { $ as $toast, c as clearStorage, a as clone, b as configureUtils, d as confirm, e as copy, f as debounce, g as delay, h as getStorage, i as getType, j as getUtilsBuildTime, k as getVariable, l as isEmpty, m as log, n as merge, o as mockValue, p as processWidth, r as random, s as setStorage, t as test, q as throttle, u as toLine, v as tryCatch, w as validate, x as validateForm, y as validateOnSubmit } from './shared/utils.S76wYqQ8.mjs';
5
5
  import './confirmSemantic.mjs';
6
6
  import 'element-plus';
7
+ import 'axios';
7
8
  import './is.mjs';
@@ -1,6 +1,8 @@
1
+ import { SybzComponentTheme } from './theme.cjs';
2
+
1
3
  type ConfirmVariant = 'default' | 'delete' | 'warning';
2
4
  type ConfirmTarget = string | number;
3
- type ConfirmSemanticTheme = 'default' | 'chenghua' | 'shijingshan';
5
+ type ConfirmSemanticTheme = SybzComponentTheme;
4
6
  type ConfirmSemanticButtonType = 'default' | 'primary' | 'success' | 'warning' | 'info' | 'danger' | 'text' | '';
5
7
  interface ConfirmSemanticOptions {
6
8
  variant?: ConfirmVariant;
@@ -1,6 +1,8 @@
1
+ import { SybzComponentTheme } from './theme.mjs';
2
+
1
3
  type ConfirmVariant = 'default' | 'delete' | 'warning';
2
4
  type ConfirmTarget = string | number;
3
- type ConfirmSemanticTheme = 'default' | 'chenghua' | 'shijingshan';
5
+ type ConfirmSemanticTheme = SybzComponentTheme;
4
6
  type ConfirmSemanticButtonType = 'default' | 'primary' | 'success' | 'warning' | 'info' | 'danger' | 'text' | '';
5
7
  interface ConfirmSemanticOptions {
6
8
  variant?: ConfirmVariant;
@@ -1,6 +1,8 @@
1
+ import { SybzComponentTheme } from './theme.js';
2
+
1
3
  type ConfirmVariant = 'default' | 'delete' | 'warning';
2
4
  type ConfirmTarget = string | number;
3
- type ConfirmSemanticTheme = 'default' | 'chenghua' | 'shijingshan';
5
+ type ConfirmSemanticTheme = SybzComponentTheme;
4
6
  type ConfirmSemanticButtonType = 'default' | 'primary' | 'success' | 'warning' | 'info' | 'danger' | 'text' | '';
5
7
  interface ConfirmSemanticOptions {
6
8
  variant?: ConfirmVariant;
package/dist/format.cjs CHANGED
@@ -1,12 +1,13 @@
1
1
  'use strict';
2
2
 
3
- const format = require('./shared/utils.DfuweQgy.cjs');
3
+ const format = require('./shared/utils.-eWHeuS_.cjs');
4
4
  require('./is.cjs');
5
5
  require('consola');
6
6
  require('vue');
7
7
  require('es-toolkit');
8
8
  require('./confirmSemantic.cjs');
9
9
  require('element-plus');
10
+ require('axios');
10
11
 
11
12
 
12
13
 
package/dist/format.mjs CHANGED
@@ -1,7 +1,8 @@
1
- export { z as formatBytes, A as formatBytesConvert, B as formatDurationTime, C as formatTextToHtml, D as formatThousands, E as formatTime, F as formatToFixed } from './shared/utils.CJdEsMHi.mjs';
1
+ export { z as formatBytes, A as formatBytesConvert, B as formatDurationTime, C as formatTextToHtml, D as formatThousands, E as formatTime, F as formatToFixed } from './shared/utils.S76wYqQ8.mjs';
2
2
  import './is.mjs';
3
3
  import 'consola';
4
4
  import 'vue';
5
5
  import 'es-toolkit';
6
6
  import './confirmSemantic.mjs';
7
7
  import 'element-plus';
8
+ import 'axios';
package/dist/http.cjs ADDED
@@ -0,0 +1,20 @@
1
+ 'use strict';
2
+
3
+ require('axios');
4
+ const format = require('./shared/utils.-eWHeuS_.cjs');
5
+ require('vue');
6
+ require('consola');
7
+ require('es-toolkit');
8
+ require('./confirmSemantic.cjs');
9
+ require('element-plus');
10
+ require('./is.cjs');
11
+
12
+
13
+
14
+ exports.HttpError = format.HttpError;
15
+ exports.configureHttp = format.configureHttp;
16
+ exports.createHttp = format.createHttp;
17
+ Object.defineProperty(exports, "http", {
18
+ enumerable: true,
19
+ get: function () { return format.http; }
20
+ });
@@ -0,0 +1,66 @@
1
+ import { CreateAxiosDefaults, AxiosResponse, AxiosRequestConfig, AxiosInstance } from 'axios';
2
+
3
+ interface HttpRequestConfig<D = unknown> extends AxiosRequestConfig<D> {
4
+ rawResponse?: boolean;
5
+ skipAuth?: boolean;
6
+ /** 是否显示当前请求的错误提示;默认继承全局配置。 */
7
+ showErrorToast?: boolean;
8
+ /** 当前请求的自定义错误文案。 */
9
+ message?: string | ((error: HttpError) => string);
10
+ }
11
+ declare class HttpError<T = unknown> extends Error {
12
+ readonly status?: number;
13
+ readonly code?: string;
14
+ readonly data?: T;
15
+ readonly cause?: unknown;
16
+ constructor(message: string, options?: {
17
+ status?: number;
18
+ code?: string;
19
+ data?: T;
20
+ cause?: unknown;
21
+ });
22
+ }
23
+ interface CreateHttpOptions<D = unknown> extends CreateAxiosDefaults<D> {
24
+ /** 返回 false 时视为业务失败;默认仅识别 success === false。 */
25
+ isBusinessSuccess?: (data: unknown, response: AxiosResponse<D>) => boolean;
26
+ /** 从后端返回体提取业务错误文案。 */
27
+ getBusinessMessage?: (data: unknown, fallback: string) => string;
28
+ /** 统一转换响应体,适用于 { data: ... } 等包装格式。 */
29
+ transformResponseData?: (data: D, response: AxiosResponse<D>) => unknown;
30
+ /** 是否自动使用 $toast.error 提示错误;默认 `true`。 */
31
+ showErrorToast?: boolean;
32
+ toast?: (message: string) => void;
33
+ normalizeError?: (error: unknown) => HttpError;
34
+ /** 统一获取请求令牌。 */
35
+ getToken?: () => string | undefined | null;
36
+ /** 请求发出前的统一处理。 */
37
+ onRequest?: (config: HttpRequestConfig) => HttpRequestConfig | void;
38
+ /** 响应成功后的统一处理。 */
39
+ onResponse?: (response: AxiosResponse) => void;
40
+ /** 响应失败后的统一处理,例如 401 跳转登录。 */
41
+ onError?: (error: HttpError, response?: AxiosResponse) => void | Promise<void>;
42
+ }
43
+ type HttpClient = Omit<AxiosInstance, 'get' | 'post' | 'put' | 'patch' | 'delete'> & {
44
+ <T = unknown, D = unknown>(url: string, config?: HttpRequestConfig<D>): Promise<T>;
45
+ <T = unknown, D = unknown>(url: string, params?: unknown, config?: HttpRequestConfig<D>): Promise<T>;
46
+ send<T = unknown, D = unknown>(config: HttpRequestConfig<D> & {
47
+ rawResponse: true;
48
+ }): Promise<AxiosResponse<T>>;
49
+ send<T = unknown, D = unknown>(config: HttpRequestConfig<D> & {
50
+ rawResponse?: false;
51
+ }): Promise<T>;
52
+ get<T = unknown>(url: string, config?: HttpRequestConfig): Promise<T>;
53
+ get<T = unknown>(url: string, params?: unknown, config?: HttpRequestConfig): Promise<T>;
54
+ post<T = unknown, D = unknown>(url: string, data?: D, config?: HttpRequestConfig<D>): Promise<T>;
55
+ put<T = unknown, D = unknown>(url: string, data?: D, config?: HttpRequestConfig<D>): Promise<T>;
56
+ patch<T = unknown, D = unknown>(url: string, data?: D, config?: HttpRequestConfig<D>): Promise<T>;
57
+ delete<T = unknown>(url: string, config?: HttpRequestConfig): Promise<T>;
58
+ download(url: string, params?: unknown, config?: HttpRequestConfig): Promise<Blob>;
59
+ };
60
+ declare function createHttp<D = unknown>(options?: CreateHttpOptions<D>): HttpClient;
61
+ /** 全局 HTTP 客户端;通过 configureUtils({ http: ... }) 配置一次。 */
62
+ declare let http: HttpClient;
63
+ declare function configureHttp(options?: CreateHttpOptions): HttpClient;
64
+
65
+ export { HttpError, configureHttp, createHttp, http };
66
+ export type { CreateHttpOptions, HttpClient, HttpRequestConfig };
@@ -0,0 +1,66 @@
1
+ import { CreateAxiosDefaults, AxiosResponse, AxiosRequestConfig, AxiosInstance } from 'axios';
2
+
3
+ interface HttpRequestConfig<D = unknown> extends AxiosRequestConfig<D> {
4
+ rawResponse?: boolean;
5
+ skipAuth?: boolean;
6
+ /** 是否显示当前请求的错误提示;默认继承全局配置。 */
7
+ showErrorToast?: boolean;
8
+ /** 当前请求的自定义错误文案。 */
9
+ message?: string | ((error: HttpError) => string);
10
+ }
11
+ declare class HttpError<T = unknown> extends Error {
12
+ readonly status?: number;
13
+ readonly code?: string;
14
+ readonly data?: T;
15
+ readonly cause?: unknown;
16
+ constructor(message: string, options?: {
17
+ status?: number;
18
+ code?: string;
19
+ data?: T;
20
+ cause?: unknown;
21
+ });
22
+ }
23
+ interface CreateHttpOptions<D = unknown> extends CreateAxiosDefaults<D> {
24
+ /** 返回 false 时视为业务失败;默认仅识别 success === false。 */
25
+ isBusinessSuccess?: (data: unknown, response: AxiosResponse<D>) => boolean;
26
+ /** 从后端返回体提取业务错误文案。 */
27
+ getBusinessMessage?: (data: unknown, fallback: string) => string;
28
+ /** 统一转换响应体,适用于 { data: ... } 等包装格式。 */
29
+ transformResponseData?: (data: D, response: AxiosResponse<D>) => unknown;
30
+ /** 是否自动使用 $toast.error 提示错误;默认 `true`。 */
31
+ showErrorToast?: boolean;
32
+ toast?: (message: string) => void;
33
+ normalizeError?: (error: unknown) => HttpError;
34
+ /** 统一获取请求令牌。 */
35
+ getToken?: () => string | undefined | null;
36
+ /** 请求发出前的统一处理。 */
37
+ onRequest?: (config: HttpRequestConfig) => HttpRequestConfig | void;
38
+ /** 响应成功后的统一处理。 */
39
+ onResponse?: (response: AxiosResponse) => void;
40
+ /** 响应失败后的统一处理,例如 401 跳转登录。 */
41
+ onError?: (error: HttpError, response?: AxiosResponse) => void | Promise<void>;
42
+ }
43
+ type HttpClient = Omit<AxiosInstance, 'get' | 'post' | 'put' | 'patch' | 'delete'> & {
44
+ <T = unknown, D = unknown>(url: string, config?: HttpRequestConfig<D>): Promise<T>;
45
+ <T = unknown, D = unknown>(url: string, params?: unknown, config?: HttpRequestConfig<D>): Promise<T>;
46
+ send<T = unknown, D = unknown>(config: HttpRequestConfig<D> & {
47
+ rawResponse: true;
48
+ }): Promise<AxiosResponse<T>>;
49
+ send<T = unknown, D = unknown>(config: HttpRequestConfig<D> & {
50
+ rawResponse?: false;
51
+ }): Promise<T>;
52
+ get<T = unknown>(url: string, config?: HttpRequestConfig): Promise<T>;
53
+ get<T = unknown>(url: string, params?: unknown, config?: HttpRequestConfig): Promise<T>;
54
+ post<T = unknown, D = unknown>(url: string, data?: D, config?: HttpRequestConfig<D>): Promise<T>;
55
+ put<T = unknown, D = unknown>(url: string, data?: D, config?: HttpRequestConfig<D>): Promise<T>;
56
+ patch<T = unknown, D = unknown>(url: string, data?: D, config?: HttpRequestConfig<D>): Promise<T>;
57
+ delete<T = unknown>(url: string, config?: HttpRequestConfig): Promise<T>;
58
+ download(url: string, params?: unknown, config?: HttpRequestConfig): Promise<Blob>;
59
+ };
60
+ declare function createHttp<D = unknown>(options?: CreateHttpOptions<D>): HttpClient;
61
+ /** 全局 HTTP 客户端;通过 configureUtils({ http: ... }) 配置一次。 */
62
+ declare let http: HttpClient;
63
+ declare function configureHttp(options?: CreateHttpOptions): HttpClient;
64
+
65
+ export { HttpError, configureHttp, createHttp, http };
66
+ export type { CreateHttpOptions, HttpClient, HttpRequestConfig };
package/dist/http.d.ts ADDED
@@ -0,0 +1,66 @@
1
+ import { CreateAxiosDefaults, AxiosResponse, AxiosRequestConfig, AxiosInstance } from 'axios';
2
+
3
+ interface HttpRequestConfig<D = unknown> extends AxiosRequestConfig<D> {
4
+ rawResponse?: boolean;
5
+ skipAuth?: boolean;
6
+ /** 是否显示当前请求的错误提示;默认继承全局配置。 */
7
+ showErrorToast?: boolean;
8
+ /** 当前请求的自定义错误文案。 */
9
+ message?: string | ((error: HttpError) => string);
10
+ }
11
+ declare class HttpError<T = unknown> extends Error {
12
+ readonly status?: number;
13
+ readonly code?: string;
14
+ readonly data?: T;
15
+ readonly cause?: unknown;
16
+ constructor(message: string, options?: {
17
+ status?: number;
18
+ code?: string;
19
+ data?: T;
20
+ cause?: unknown;
21
+ });
22
+ }
23
+ interface CreateHttpOptions<D = unknown> extends CreateAxiosDefaults<D> {
24
+ /** 返回 false 时视为业务失败;默认仅识别 success === false。 */
25
+ isBusinessSuccess?: (data: unknown, response: AxiosResponse<D>) => boolean;
26
+ /** 从后端返回体提取业务错误文案。 */
27
+ getBusinessMessage?: (data: unknown, fallback: string) => string;
28
+ /** 统一转换响应体,适用于 { data: ... } 等包装格式。 */
29
+ transformResponseData?: (data: D, response: AxiosResponse<D>) => unknown;
30
+ /** 是否自动使用 $toast.error 提示错误;默认 `true`。 */
31
+ showErrorToast?: boolean;
32
+ toast?: (message: string) => void;
33
+ normalizeError?: (error: unknown) => HttpError;
34
+ /** 统一获取请求令牌。 */
35
+ getToken?: () => string | undefined | null;
36
+ /** 请求发出前的统一处理。 */
37
+ onRequest?: (config: HttpRequestConfig) => HttpRequestConfig | void;
38
+ /** 响应成功后的统一处理。 */
39
+ onResponse?: (response: AxiosResponse) => void;
40
+ /** 响应失败后的统一处理,例如 401 跳转登录。 */
41
+ onError?: (error: HttpError, response?: AxiosResponse) => void | Promise<void>;
42
+ }
43
+ type HttpClient = Omit<AxiosInstance, 'get' | 'post' | 'put' | 'patch' | 'delete'> & {
44
+ <T = unknown, D = unknown>(url: string, config?: HttpRequestConfig<D>): Promise<T>;
45
+ <T = unknown, D = unknown>(url: string, params?: unknown, config?: HttpRequestConfig<D>): Promise<T>;
46
+ send<T = unknown, D = unknown>(config: HttpRequestConfig<D> & {
47
+ rawResponse: true;
48
+ }): Promise<AxiosResponse<T>>;
49
+ send<T = unknown, D = unknown>(config: HttpRequestConfig<D> & {
50
+ rawResponse?: false;
51
+ }): Promise<T>;
52
+ get<T = unknown>(url: string, config?: HttpRequestConfig): Promise<T>;
53
+ get<T = unknown>(url: string, params?: unknown, config?: HttpRequestConfig): Promise<T>;
54
+ post<T = unknown, D = unknown>(url: string, data?: D, config?: HttpRequestConfig<D>): Promise<T>;
55
+ put<T = unknown, D = unknown>(url: string, data?: D, config?: HttpRequestConfig<D>): Promise<T>;
56
+ patch<T = unknown, D = unknown>(url: string, data?: D, config?: HttpRequestConfig<D>): Promise<T>;
57
+ delete<T = unknown>(url: string, config?: HttpRequestConfig): Promise<T>;
58
+ download(url: string, params?: unknown, config?: HttpRequestConfig): Promise<Blob>;
59
+ };
60
+ declare function createHttp<D = unknown>(options?: CreateHttpOptions<D>): HttpClient;
61
+ /** 全局 HTTP 客户端;通过 configureUtils({ http: ... }) 配置一次。 */
62
+ declare let http: HttpClient;
63
+ declare function configureHttp(options?: CreateHttpOptions): HttpClient;
64
+
65
+ export { HttpError, configureHttp, createHttp, http };
66
+ export type { CreateHttpOptions, HttpClient, HttpRequestConfig };
package/dist/http.mjs ADDED
@@ -0,0 +1,8 @@
1
+ import 'axios';
2
+ export { H as HttpError, G as configureHttp, I as createHttp, J as http } from './shared/utils.S76wYqQ8.mjs';
3
+ import 'vue';
4
+ import 'consola';
5
+ import 'es-toolkit';
6
+ import './confirmSemantic.mjs';
7
+ import 'element-plus';
8
+ import './is.mjs';
package/dist/index.cjs CHANGED
@@ -1,21 +1,26 @@
1
1
  'use strict';
2
2
 
3
- const format = require('./shared/utils.DfuweQgy.cjs');
3
+ const format = require('./shared/utils.-eWHeuS_.cjs');
4
4
  const confirmSemantic = require('./confirmSemantic.cjs');
5
5
  const is = require('./is.cjs');
6
+ const theme = require('./theme.cjs');
6
7
  require('vue');
7
8
  require('consola');
8
9
  require('es-toolkit');
9
10
  require('element-plus');
11
+ require('axios');
10
12
 
11
13
 
12
14
 
13
15
  exports.$toast = format.$toast;
16
+ exports.HttpError = format.HttpError;
14
17
  exports.clearStorage = format.clearStorage;
15
18
  exports.clone = format.clone;
19
+ exports.configureHttp = format.configureHttp;
16
20
  exports.configureUtils = format.configureUtils;
17
21
  exports.confirm = format.confirm;
18
22
  exports.copy = format.copy;
23
+ exports.createHttp = format.createHttp;
19
24
  exports.debounce = format.debounce;
20
25
  exports.delay = format.delay;
21
26
  exports.formatBytes = format.formatBytes;
@@ -29,6 +34,10 @@ exports.getStorage = format.getStorage;
29
34
  exports.getType = format.getType;
30
35
  exports.getUtilsBuildTime = format.getUtilsBuildTime;
31
36
  exports.getVariable = format.getVariable;
37
+ Object.defineProperty(exports, "http", {
38
+ enumerable: true,
39
+ get: function () { return format.http; }
40
+ });
32
41
  exports.isEmpty = format.isEmpty;
33
42
  exports.log = format.log;
34
43
  exports.merge = format.merge;
@@ -66,3 +75,5 @@ exports.isUrl = is.isUrl;
66
75
  exports.objectToString = is.objectToString;
67
76
  exports.toRawType = is.toRawType;
68
77
  exports.toTypeString = is.toTypeString;
78
+ exports.SYBZ_THEME_PREFIX = theme.SYBZ_THEME_PREFIX;
79
+ exports.isSybzTheme = theme.isSybzTheme;
package/dist/index.d.cts CHANGED
@@ -2,5 +2,8 @@ export { $toast, ConfirmCustomOptions, ConfirmMessage, ConfirmOptions, ConfirmTh
2
2
  export { ConfirmSemanticButtonType, ConfirmSemanticOptions, ConfirmSemanticResult, ConfirmSemanticTheme, ConfirmTarget, ConfirmVariant, resolveConfirmSemantic } from './confirmSemantic.cjs';
3
3
  export { isArray, isBoolean, isComponent, isDate, isEmptyObject, isFunction, isIOS, isMap, isNumber, isObject, isPlainObject, isPromise, isRegExp, isSVGElement, isSet, isString, isStringNumber, isSymbol, isUrl, objectToString, toRawType, toTypeString } from './is.cjs';
4
4
  export { FormatBytesConvertOptions, FormatBytesOptions, FormatTimeFallback, FormatTimeInput, FormatToFixedOptions, formatBytes, formatBytesConvert, formatDurationTime, formatTextToHtml, formatThousands, formatTime, formatToFixed } from './format.cjs';
5
+ export { SYBZ_THEME_PREFIX, SybzComponentTheme, SybzThemeName, isSybzTheme } from './theme.cjs';
6
+ export { CreateHttpOptions, HttpClient, HttpError, HttpRequestConfig, configureHttp, createHttp, http } from './http.cjs';
5
7
  import 'vue';
6
8
  import 'element-plus';
9
+ import 'axios';
package/dist/index.d.mts CHANGED
@@ -2,5 +2,8 @@ export { $toast, ConfirmCustomOptions, ConfirmMessage, ConfirmOptions, ConfirmTh
2
2
  export { ConfirmSemanticButtonType, ConfirmSemanticOptions, ConfirmSemanticResult, ConfirmSemanticTheme, ConfirmTarget, ConfirmVariant, resolveConfirmSemantic } from './confirmSemantic.mjs';
3
3
  export { isArray, isBoolean, isComponent, isDate, isEmptyObject, isFunction, isIOS, isMap, isNumber, isObject, isPlainObject, isPromise, isRegExp, isSVGElement, isSet, isString, isStringNumber, isSymbol, isUrl, objectToString, toRawType, toTypeString } from './is.mjs';
4
4
  export { FormatBytesConvertOptions, FormatBytesOptions, FormatTimeFallback, FormatTimeInput, FormatToFixedOptions, formatBytes, formatBytesConvert, formatDurationTime, formatTextToHtml, formatThousands, formatTime, formatToFixed } from './format.mjs';
5
+ export { SYBZ_THEME_PREFIX, SybzComponentTheme, SybzThemeName, isSybzTheme } from './theme.mjs';
6
+ export { CreateHttpOptions, HttpClient, HttpError, HttpRequestConfig, configureHttp, createHttp, http } from './http.mjs';
5
7
  import 'vue';
6
8
  import 'element-plus';
9
+ import 'axios';
package/dist/index.d.ts CHANGED
@@ -2,5 +2,8 @@ export { $toast, ConfirmCustomOptions, ConfirmMessage, ConfirmOptions, ConfirmTh
2
2
  export { ConfirmSemanticButtonType, ConfirmSemanticOptions, ConfirmSemanticResult, ConfirmSemanticTheme, ConfirmTarget, ConfirmVariant, resolveConfirmSemantic } from './confirmSemantic.js';
3
3
  export { isArray, isBoolean, isComponent, isDate, isEmptyObject, isFunction, isIOS, isMap, isNumber, isObject, isPlainObject, isPromise, isRegExp, isSVGElement, isSet, isString, isStringNumber, isSymbol, isUrl, objectToString, toRawType, toTypeString } from './is.js';
4
4
  export { FormatBytesConvertOptions, FormatBytesOptions, FormatTimeFallback, FormatTimeInput, FormatToFixedOptions, formatBytes, formatBytesConvert, formatDurationTime, formatTextToHtml, formatThousands, formatTime, formatToFixed } from './format.js';
5
+ export { SYBZ_THEME_PREFIX, SybzComponentTheme, SybzThemeName, isSybzTheme } from './theme.js';
6
+ export { CreateHttpOptions, HttpClient, HttpError, HttpRequestConfig, configureHttp, createHttp, http } from './http.js';
5
7
  import 'vue';
6
8
  import 'element-plus';
9
+ import 'axios';
package/dist/index.mjs CHANGED
@@ -1,7 +1,9 @@
1
- export { $ as $toast, c as clearStorage, a as clone, b as configureUtils, d as confirm, e as copy, f as debounce, g as delay, z as formatBytes, A as formatBytesConvert, B as formatDurationTime, C as formatTextToHtml, D as formatThousands, E as formatTime, F as formatToFixed, h as getStorage, i as getType, j as getUtilsBuildTime, k as getVariable, l as isEmpty, m as log, n as merge, o as mockValue, p as processWidth, r as random, s as setStorage, t as test, q as throttle, u as toLine, v as tryCatch, w as validate, x as validateForm, y as validateOnSubmit } from './shared/utils.CJdEsMHi.mjs';
1
+ export { $ as $toast, H as HttpError, c as clearStorage, a as clone, G as configureHttp, b as configureUtils, d as confirm, e as copy, I as createHttp, f as debounce, g as delay, z as formatBytes, A as formatBytesConvert, B as formatDurationTime, C as formatTextToHtml, D as formatThousands, E as formatTime, F as formatToFixed, h as getStorage, i as getType, j as getUtilsBuildTime, k as getVariable, J as http, l as isEmpty, m as log, n as merge, o as mockValue, p as processWidth, r as random, s as setStorage, t as test, q as throttle, u as toLine, v as tryCatch, w as validate, x as validateForm, y as validateOnSubmit } from './shared/utils.S76wYqQ8.mjs';
2
2
  export { resolveConfirmSemantic } from './confirmSemantic.mjs';
3
3
  export { isArray, isBoolean, isComponent, isDate, isEmptyObject, isFunction, isIOS, isMap, isNumber, isObject, isPlainObject, isPromise, isRegExp, isSVGElement, isSet, isString, isStringNumber, isSymbol, isUrl, objectToString, toRawType, toTypeString } from './is.mjs';
4
+ export { SYBZ_THEME_PREFIX, isSybzTheme } from './theme.mjs';
4
5
  import 'vue';
5
6
  import 'consola';
6
7
  import 'es-toolkit';
7
8
  import 'element-plus';
9
+ import 'axios';
@@ -5,8 +5,13 @@ const consola = require('consola');
5
5
  const esToolkit = require('es-toolkit');
6
6
  const confirmSemantic = require('../confirmSemantic.cjs');
7
7
  const elementPlus = require('element-plus');
8
+ const axios = require('axios');
8
9
  const is = require('../is.cjs');
9
10
 
11
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
12
+
13
+ const axios__default = /*#__PURE__*/_interopDefaultCompat(axios);
14
+
10
15
  function formatBytes(bytes, options = {}) {
11
16
  let { digit = 2, thousands = false, prefix = "", suffix = "", roundType = "floor" } = options;
12
17
  if (is.isStringNumber(bytes) || is.isNumber(bytes)) {
@@ -220,21 +225,141 @@ function formatTextToHtml(str) {
220
225
  return withBreaks.replace(/\t/g, "&nbsp;&nbsp;&nbsp;&nbsp;");
221
226
  }
222
227
 
228
+ class HttpError extends Error {
229
+ status;
230
+ code;
231
+ data;
232
+ cause;
233
+ constructor(message, options = {}) {
234
+ super(message);
235
+ this.name = "HttpError";
236
+ Object.assign(this, options);
237
+ }
238
+ }
239
+ const record = (value) => typeof value === "object" && value !== null;
240
+ const defaultMessage = (data, fallback) => {
241
+ if (!record(data)) return fallback;
242
+ for (const key of ["detail", "error", "message"])
243
+ if (typeof data[key] === "string" && data[key]) return data[key];
244
+ return fallback;
245
+ };
246
+ function createHttp(options = {}) {
247
+ const {
248
+ isBusinessSuccess = (data) => !(record(data) && data.success === false),
249
+ getBusinessMessage = defaultMessage,
250
+ transformResponseData,
251
+ showErrorToast = true,
252
+ toast = (message) => $toast.error(message),
253
+ normalizeError,
254
+ getToken,
255
+ onRequest,
256
+ onResponse,
257
+ onError,
258
+ ...axiosOptions
259
+ } = options;
260
+ const instance = axios__default.create(axiosOptions);
261
+ const normalize = (error) => {
262
+ if (error instanceof HttpError) return error;
263
+ if (!axios__default.isAxiosError(error))
264
+ return new HttpError(error instanceof Error ? error.message : "\u8BF7\u6C42\u5931\u8D25", { cause: error });
265
+ const response = error.response;
266
+ const message = error.code === axios.AxiosError.ECONNABORTED || error.code === "ETIMEDOUT" ? "\u8BF7\u6C42\u8D85\u65F6\uFF0C\u8BF7\u91CD\u8BD5" : error.code === axios.AxiosError.ERR_CANCELED ? "\u8BF7\u6C42\u5DF2\u53D6\u6D88" : response ? `\u8BF7\u6C42\u5931\u8D25\uFF08${response.status}\uFF09` : "\u7F51\u7EDC\u8FDE\u63A5\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u540E\u91CD\u8BD5";
267
+ return new HttpError(getBusinessMessage(response?.data, message), {
268
+ status: response?.status,
269
+ code: error.code,
270
+ data: response?.data,
271
+ cause: error
272
+ });
273
+ };
274
+ instance.interceptors.request.use((config) => {
275
+ const requestConfig = config;
276
+ requestConfig.headers = axios.AxiosHeaders.from(requestConfig.headers);
277
+ if (!requestConfig.skipAuth) {
278
+ const token = getToken?.();
279
+ if (token && !requestConfig.headers.has("Authorization"))
280
+ requestConfig.headers.set("Authorization", `Bearer ${token}`);
281
+ }
282
+ return onRequest?.(requestConfig) || requestConfig;
283
+ });
284
+ instance.interceptors.response.use(
285
+ (response) => {
286
+ const config = response.config;
287
+ if (!isBusinessSuccess(response.data, response))
288
+ throw new HttpError(getBusinessMessage(response.data, "\u8BF7\u6C42\u5931\u8D25"), {
289
+ status: response.status,
290
+ data: response.data
291
+ });
292
+ if (transformResponseData && !config.rawResponse)
293
+ response.data = transformResponseData(
294
+ response.data,
295
+ response
296
+ );
297
+ onResponse?.(response);
298
+ return response;
299
+ },
300
+ async (error) => {
301
+ const normalized = normalizeError ? normalizeError(error) : normalize(error);
302
+ const response = axios__default.isAxiosError(error) ? error.response : void 0;
303
+ const requestConfig = response?.config;
304
+ const customMessage = requestConfig?.message;
305
+ const message = typeof customMessage === "function" ? customMessage(normalized) : customMessage || normalized.message;
306
+ if (requestConfig?.showErrorToast ?? showErrorToast) toast?.(message);
307
+ await onError?.(normalized, response);
308
+ throw normalized;
309
+ }
310
+ );
311
+ const send = async (config) => {
312
+ const response = await instance.request(config);
313
+ return config.rawResponse ? response : response.data;
314
+ };
315
+ const isRequestConfig = (value) => record(value) && ["url", "method", "headers", "timeout", "rawResponse", "skipAuth", "showErrorToast", "message"].some(
316
+ (key) => key in value
317
+ );
318
+ const request = (url, paramsOrConfig, config = {}) => {
319
+ const params = isRequestConfig(paramsOrConfig) ? void 0 : paramsOrConfig;
320
+ const requestConfig = isRequestConfig(paramsOrConfig) ? paramsOrConfig : config;
321
+ return send({ ...requestConfig, method: "GET", url, params, rawResponse: false });
322
+ };
323
+ const client = Object.assign(request, instance, {
324
+ send,
325
+ get: (url, paramsOrConfig, config) => request(url, paramsOrConfig, config),
326
+ post: (url, data, config) => send({ ...config, method: "POST", url, data, rawResponse: false }),
327
+ put: (url, data, config) => send({ ...config, method: "PUT", url, data, rawResponse: false }),
328
+ patch: (url, data, config) => send({ ...config, method: "PATCH", url, data, rawResponse: false }),
329
+ delete: (url, config) => send({ ...config, method: "DELETE", url, rawResponse: false }),
330
+ download: (url, params, config) => send({ ...config, method: "GET", url, params, responseType: "blob", rawResponse: false })
331
+ });
332
+ return client;
333
+ }
334
+ exports.http = createHttp();
335
+ function configureHttp(options = {}) {
336
+ exports.http = createHttp(options);
337
+ return exports.http;
338
+ }
339
+
223
340
  const DEFAULT_CONFIRM_BUTTON_CLASS = "s-message-box__confirm-btn";
224
341
  const DEFAULT_CANCEL_BUTTON_CLASS = "s-message-box__cancel-btn";
225
342
  const CHENGHUA_CONFIRM_BOX_CLASS = "s-message-box--chenghua";
226
343
  const CHENGHUA_CONFIRM_BUTTON_CLASS = "s-message-box__confirm-btn--chenghua";
227
344
  const CHENGHUA_CANCEL_BUTTON_CLASS = "s-message-box__cancel-btn--chenghua";
228
345
  const SHIJINGSHAN_CONFIRM_BOX_CLASS = "s-message-box--shijingshan";
346
+ const SYBZ_CONFIRM_BOX_CLASS = "s-message-box--sybz";
229
347
  const SHIJINGSHAN_CONFIRM_BUTTON_CLASS = "s-message-box__confirm-btn--shijingshan";
348
+ const SYBZ_CONFIRM_BUTTON_CLASS = "s-message-box__confirm-btn--sybz";
230
349
  const SHIJINGSHAN_CANCEL_BUTTON_CLASS = "s-message-box__cancel-btn--shijingshan";
350
+ const SYBZ_CANCEL_BUTTON_CLASS = "s-message-box__cancel-btn--sybz";
231
351
  const utilsConfig = {
232
- theme: "default"
352
+ theme: "default",
353
+ http: {}
233
354
  };
234
355
  function configureUtils(config) {
235
356
  if (config.theme !== void 0) {
236
357
  utilsConfig.theme = config.theme;
237
358
  }
359
+ if (config.http !== void 0) {
360
+ utilsConfig.http = config.http;
361
+ configureHttp(config.http);
362
+ }
238
363
  return { ...utilsConfig };
239
364
  }
240
365
  function _getBrowserStorage(isSession = false) {
@@ -976,6 +1101,7 @@ function confirm(messageOrOptions, optionsOrAppContext = null, appContext = null
976
1101
  const resolvedAppContext = _resolveAppContext(optionAppContext || argumentAppContext);
977
1102
  const isChenghuaTheme = theme === "chenghua";
978
1103
  const isShijingshanTheme = theme === "shijingshan";
1104
+ const isSybzTheme = theme === "sybz";
979
1105
  const mergeOptions = {
980
1106
  title: semantic.title,
981
1107
  draggable: true,
@@ -989,6 +1115,7 @@ function confirm(messageOrOptions, optionsOrAppContext = null, appContext = null
989
1115
  customClass: _mergeClassNames(
990
1116
  isChenghuaTheme && CHENGHUA_CONFIRM_BOX_CLASS,
991
1117
  isShijingshanTheme && SHIJINGSHAN_CONFIRM_BOX_CLASS,
1118
+ isSybzTheme && SYBZ_CONFIRM_BOX_CLASS,
992
1119
  variant !== "default" && `s-message-box--${variant}`,
993
1120
  customClass
994
1121
  ),
@@ -996,12 +1123,14 @@ function confirm(messageOrOptions, optionsOrAppContext = null, appContext = null
996
1123
  DEFAULT_CONFIRM_BUTTON_CLASS,
997
1124
  isChenghuaTheme && CHENGHUA_CONFIRM_BUTTON_CLASS,
998
1125
  isShijingshanTheme && SHIJINGSHAN_CONFIRM_BUTTON_CLASS,
1126
+ isSybzTheme && SYBZ_CONFIRM_BUTTON_CLASS,
999
1127
  confirmButtonClass
1000
1128
  ),
1001
1129
  cancelButtonClass: _mergeClassNames(
1002
1130
  DEFAULT_CANCEL_BUTTON_CLASS,
1003
1131
  isChenghuaTheme && CHENGHUA_CANCEL_BUTTON_CLASS,
1004
1132
  isShijingshanTheme && SHIJINGSHAN_CANCEL_BUTTON_CLASS,
1133
+ isSybzTheme && SYBZ_CANCEL_BUTTON_CLASS,
1005
1134
  cancelButtonClass
1006
1135
  )
1007
1136
  };
@@ -1072,7 +1201,7 @@ function getVariable(propertyName, fallback = "") {
1072
1201
  const DEFAULT_BUILD_TIME_FALLBACK = "\u672A\u6CE8\u5165";
1073
1202
  function getUtilsBuildTime(fallback = DEFAULT_BUILD_TIME_FALLBACK) {
1074
1203
  {
1075
- return "2026-09-04 17:01:04";
1204
+ return "2026-09-12 22:29:37";
1076
1205
  }
1077
1206
  }
1078
1207
  function test() {
@@ -1080,11 +1209,14 @@ function test() {
1080
1209
  }
1081
1210
 
1082
1211
  exports.$toast = $toast;
1212
+ exports.HttpError = HttpError;
1083
1213
  exports.clearStorage = clearStorage;
1084
1214
  exports.clone = clone;
1215
+ exports.configureHttp = configureHttp;
1085
1216
  exports.configureUtils = configureUtils;
1086
1217
  exports.confirm = confirm;
1087
1218
  exports.copy = copy;
1219
+ exports.createHttp = createHttp;
1088
1220
  exports.debounce = debounce;
1089
1221
  exports.delay = delay;
1090
1222
  exports.formatBytes = formatBytes;
@@ -2,7 +2,8 @@ import { isRef, unref, isVNode, toRaw } from 'vue';
2
2
  import { consola } from 'consola';
3
3
  import { cloneDeep } from 'es-toolkit';
4
4
  import { resolveConfirmSemantic } from '../confirmSemantic.mjs';
5
- import { ElMessageBox, ElMessage } from 'element-plus';
5
+ import { ElMessage, ElMessageBox } from 'element-plus';
6
+ import axios, { AxiosHeaders, AxiosError } from 'axios';
6
7
  import { isStringNumber, isNumber } from '../is.mjs';
7
8
 
8
9
  function formatBytes(bytes, options = {}) {
@@ -218,21 +219,141 @@ function formatTextToHtml(str) {
218
219
  return withBreaks.replace(/\t/g, "&nbsp;&nbsp;&nbsp;&nbsp;");
219
220
  }
220
221
 
222
+ class HttpError extends Error {
223
+ status;
224
+ code;
225
+ data;
226
+ cause;
227
+ constructor(message, options = {}) {
228
+ super(message);
229
+ this.name = "HttpError";
230
+ Object.assign(this, options);
231
+ }
232
+ }
233
+ const record = (value) => typeof value === "object" && value !== null;
234
+ const defaultMessage = (data, fallback) => {
235
+ if (!record(data)) return fallback;
236
+ for (const key of ["detail", "error", "message"])
237
+ if (typeof data[key] === "string" && data[key]) return data[key];
238
+ return fallback;
239
+ };
240
+ function createHttp(options = {}) {
241
+ const {
242
+ isBusinessSuccess = (data) => !(record(data) && data.success === false),
243
+ getBusinessMessage = defaultMessage,
244
+ transformResponseData,
245
+ showErrorToast = true,
246
+ toast = (message) => $toast.error(message),
247
+ normalizeError,
248
+ getToken,
249
+ onRequest,
250
+ onResponse,
251
+ onError,
252
+ ...axiosOptions
253
+ } = options;
254
+ const instance = axios.create(axiosOptions);
255
+ const normalize = (error) => {
256
+ if (error instanceof HttpError) return error;
257
+ if (!axios.isAxiosError(error))
258
+ return new HttpError(error instanceof Error ? error.message : "\u8BF7\u6C42\u5931\u8D25", { cause: error });
259
+ const response = error.response;
260
+ const message = error.code === AxiosError.ECONNABORTED || error.code === "ETIMEDOUT" ? "\u8BF7\u6C42\u8D85\u65F6\uFF0C\u8BF7\u91CD\u8BD5" : error.code === AxiosError.ERR_CANCELED ? "\u8BF7\u6C42\u5DF2\u53D6\u6D88" : response ? `\u8BF7\u6C42\u5931\u8D25\uFF08${response.status}\uFF09` : "\u7F51\u7EDC\u8FDE\u63A5\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u540E\u91CD\u8BD5";
261
+ return new HttpError(getBusinessMessage(response?.data, message), {
262
+ status: response?.status,
263
+ code: error.code,
264
+ data: response?.data,
265
+ cause: error
266
+ });
267
+ };
268
+ instance.interceptors.request.use((config) => {
269
+ const requestConfig = config;
270
+ requestConfig.headers = AxiosHeaders.from(requestConfig.headers);
271
+ if (!requestConfig.skipAuth) {
272
+ const token = getToken?.();
273
+ if (token && !requestConfig.headers.has("Authorization"))
274
+ requestConfig.headers.set("Authorization", `Bearer ${token}`);
275
+ }
276
+ return onRequest?.(requestConfig) || requestConfig;
277
+ });
278
+ instance.interceptors.response.use(
279
+ (response) => {
280
+ const config = response.config;
281
+ if (!isBusinessSuccess(response.data, response))
282
+ throw new HttpError(getBusinessMessage(response.data, "\u8BF7\u6C42\u5931\u8D25"), {
283
+ status: response.status,
284
+ data: response.data
285
+ });
286
+ if (transformResponseData && !config.rawResponse)
287
+ response.data = transformResponseData(
288
+ response.data,
289
+ response
290
+ );
291
+ onResponse?.(response);
292
+ return response;
293
+ },
294
+ async (error) => {
295
+ const normalized = normalizeError ? normalizeError(error) : normalize(error);
296
+ const response = axios.isAxiosError(error) ? error.response : void 0;
297
+ const requestConfig = response?.config;
298
+ const customMessage = requestConfig?.message;
299
+ const message = typeof customMessage === "function" ? customMessage(normalized) : customMessage || normalized.message;
300
+ if (requestConfig?.showErrorToast ?? showErrorToast) toast?.(message);
301
+ await onError?.(normalized, response);
302
+ throw normalized;
303
+ }
304
+ );
305
+ const send = async (config) => {
306
+ const response = await instance.request(config);
307
+ return config.rawResponse ? response : response.data;
308
+ };
309
+ const isRequestConfig = (value) => record(value) && ["url", "method", "headers", "timeout", "rawResponse", "skipAuth", "showErrorToast", "message"].some(
310
+ (key) => key in value
311
+ );
312
+ const request = (url, paramsOrConfig, config = {}) => {
313
+ const params = isRequestConfig(paramsOrConfig) ? void 0 : paramsOrConfig;
314
+ const requestConfig = isRequestConfig(paramsOrConfig) ? paramsOrConfig : config;
315
+ return send({ ...requestConfig, method: "GET", url, params, rawResponse: false });
316
+ };
317
+ const client = Object.assign(request, instance, {
318
+ send,
319
+ get: (url, paramsOrConfig, config) => request(url, paramsOrConfig, config),
320
+ post: (url, data, config) => send({ ...config, method: "POST", url, data, rawResponse: false }),
321
+ put: (url, data, config) => send({ ...config, method: "PUT", url, data, rawResponse: false }),
322
+ patch: (url, data, config) => send({ ...config, method: "PATCH", url, data, rawResponse: false }),
323
+ delete: (url, config) => send({ ...config, method: "DELETE", url, rawResponse: false }),
324
+ download: (url, params, config) => send({ ...config, method: "GET", url, params, responseType: "blob", rawResponse: false })
325
+ });
326
+ return client;
327
+ }
328
+ let http = createHttp();
329
+ function configureHttp(options = {}) {
330
+ http = createHttp(options);
331
+ return http;
332
+ }
333
+
221
334
  const DEFAULT_CONFIRM_BUTTON_CLASS = "s-message-box__confirm-btn";
222
335
  const DEFAULT_CANCEL_BUTTON_CLASS = "s-message-box__cancel-btn";
223
336
  const CHENGHUA_CONFIRM_BOX_CLASS = "s-message-box--chenghua";
224
337
  const CHENGHUA_CONFIRM_BUTTON_CLASS = "s-message-box__confirm-btn--chenghua";
225
338
  const CHENGHUA_CANCEL_BUTTON_CLASS = "s-message-box__cancel-btn--chenghua";
226
339
  const SHIJINGSHAN_CONFIRM_BOX_CLASS = "s-message-box--shijingshan";
340
+ const SYBZ_CONFIRM_BOX_CLASS = "s-message-box--sybz";
227
341
  const SHIJINGSHAN_CONFIRM_BUTTON_CLASS = "s-message-box__confirm-btn--shijingshan";
342
+ const SYBZ_CONFIRM_BUTTON_CLASS = "s-message-box__confirm-btn--sybz";
228
343
  const SHIJINGSHAN_CANCEL_BUTTON_CLASS = "s-message-box__cancel-btn--shijingshan";
344
+ const SYBZ_CANCEL_BUTTON_CLASS = "s-message-box__cancel-btn--sybz";
229
345
  const utilsConfig = {
230
- theme: "default"
346
+ theme: "default",
347
+ http: {}
231
348
  };
232
349
  function configureUtils(config) {
233
350
  if (config.theme !== void 0) {
234
351
  utilsConfig.theme = config.theme;
235
352
  }
353
+ if (config.http !== void 0) {
354
+ utilsConfig.http = config.http;
355
+ configureHttp(config.http);
356
+ }
236
357
  return { ...utilsConfig };
237
358
  }
238
359
  function _getBrowserStorage(isSession = false) {
@@ -974,6 +1095,7 @@ function confirm(messageOrOptions, optionsOrAppContext = null, appContext = null
974
1095
  const resolvedAppContext = _resolveAppContext(optionAppContext || argumentAppContext);
975
1096
  const isChenghuaTheme = theme === "chenghua";
976
1097
  const isShijingshanTheme = theme === "shijingshan";
1098
+ const isSybzTheme = theme === "sybz";
977
1099
  const mergeOptions = {
978
1100
  title: semantic.title,
979
1101
  draggable: true,
@@ -987,6 +1109,7 @@ function confirm(messageOrOptions, optionsOrAppContext = null, appContext = null
987
1109
  customClass: _mergeClassNames(
988
1110
  isChenghuaTheme && CHENGHUA_CONFIRM_BOX_CLASS,
989
1111
  isShijingshanTheme && SHIJINGSHAN_CONFIRM_BOX_CLASS,
1112
+ isSybzTheme && SYBZ_CONFIRM_BOX_CLASS,
990
1113
  variant !== "default" && `s-message-box--${variant}`,
991
1114
  customClass
992
1115
  ),
@@ -994,12 +1117,14 @@ function confirm(messageOrOptions, optionsOrAppContext = null, appContext = null
994
1117
  DEFAULT_CONFIRM_BUTTON_CLASS,
995
1118
  isChenghuaTheme && CHENGHUA_CONFIRM_BUTTON_CLASS,
996
1119
  isShijingshanTheme && SHIJINGSHAN_CONFIRM_BUTTON_CLASS,
1120
+ isSybzTheme && SYBZ_CONFIRM_BUTTON_CLASS,
997
1121
  confirmButtonClass
998
1122
  ),
999
1123
  cancelButtonClass: _mergeClassNames(
1000
1124
  DEFAULT_CANCEL_BUTTON_CLASS,
1001
1125
  isChenghuaTheme && CHENGHUA_CANCEL_BUTTON_CLASS,
1002
1126
  isShijingshanTheme && SHIJINGSHAN_CANCEL_BUTTON_CLASS,
1127
+ isSybzTheme && SYBZ_CANCEL_BUTTON_CLASS,
1003
1128
  cancelButtonClass
1004
1129
  )
1005
1130
  };
@@ -1070,11 +1195,11 @@ function getVariable(propertyName, fallback = "") {
1070
1195
  const DEFAULT_BUILD_TIME_FALLBACK = "\u672A\u6CE8\u5165";
1071
1196
  function getUtilsBuildTime(fallback = DEFAULT_BUILD_TIME_FALLBACK) {
1072
1197
  {
1073
- return "2026-09-04 17:01:04";
1198
+ return "2026-09-12 22:29:37";
1074
1199
  }
1075
1200
  }
1076
1201
  function test() {
1077
1202
  return `build time: ${getUtilsBuildTime()}`;
1078
1203
  }
1079
1204
 
1080
- export { $toast as $, formatBytesConvert as A, formatDurationTime as B, formatTextToHtml as C, formatThousands as D, formatTime as E, formatToFixed as F, clone as a, configureUtils as b, clearStorage as c, confirm as d, copy as e, debounce as f, delay as g, getStorage as h, getType as i, getUtilsBuildTime as j, getVariable as k, isEmpty as l, log as m, merge as n, mockValue as o, processWidth as p, throttle as q, random as r, setStorage as s, test as t, toLine as u, tryCatch as v, validate as w, validateForm as x, validateOnSubmit as y, formatBytes as z };
1205
+ export { $toast as $, formatBytesConvert as A, formatDurationTime as B, formatTextToHtml as C, formatThousands as D, formatTime as E, formatToFixed as F, configureHttp as G, HttpError as H, createHttp as I, http as J, clone as a, configureUtils as b, clearStorage as c, confirm as d, copy as e, debounce as f, delay as g, getStorage as h, getType as i, getUtilsBuildTime as j, getVariable as k, isEmpty as l, log as m, merge as n, mockValue as o, processWidth as p, throttle as q, random as r, setStorage as s, test as t, toLine as u, tryCatch as v, validate as w, validateForm as x, validateOnSubmit as y, formatBytes as z };
package/dist/theme.cjs ADDED
@@ -0,0 +1,11 @@
1
+ 'use strict';
2
+
3
+ const SYBZ_THEME_PREFIX = {
4
+ chenghua: "--s-ch-",
5
+ shijingshan: "--s-sjs-",
6
+ sybz: "--s-sybz-"
7
+ };
8
+ const isSybzTheme = (theme) => typeof theme === "string" && Object.prototype.hasOwnProperty.call(SYBZ_THEME_PREFIX, theme);
9
+
10
+ exports.SYBZ_THEME_PREFIX = SYBZ_THEME_PREFIX;
11
+ exports.isSybzTheme = isSybzTheme;
@@ -0,0 +1,12 @@
1
+ /** 内置主题注册表:新增主题名称和颜色前缀只在这里维护。 */
2
+ declare const SYBZ_THEME_PREFIX: {
3
+ readonly chenghua: "--s-ch-";
4
+ readonly shijingshan: "--s-sjs-";
5
+ readonly sybz: "--s-sybz-";
6
+ };
7
+ type SybzThemeName = keyof typeof SYBZ_THEME_PREFIX;
8
+ type SybzComponentTheme = 'default' | SybzThemeName;
9
+ declare const isSybzTheme: (theme: unknown) => theme is "chenghua" | "shijingshan" | "sybz";
10
+
11
+ export { SYBZ_THEME_PREFIX, isSybzTheme };
12
+ export type { SybzComponentTheme, SybzThemeName };
@@ -0,0 +1,12 @@
1
+ /** 内置主题注册表:新增主题名称和颜色前缀只在这里维护。 */
2
+ declare const SYBZ_THEME_PREFIX: {
3
+ readonly chenghua: "--s-ch-";
4
+ readonly shijingshan: "--s-sjs-";
5
+ readonly sybz: "--s-sybz-";
6
+ };
7
+ type SybzThemeName = keyof typeof SYBZ_THEME_PREFIX;
8
+ type SybzComponentTheme = 'default' | SybzThemeName;
9
+ declare const isSybzTheme: (theme: unknown) => theme is "chenghua" | "shijingshan" | "sybz";
10
+
11
+ export { SYBZ_THEME_PREFIX, isSybzTheme };
12
+ export type { SybzComponentTheme, SybzThemeName };
@@ -0,0 +1,12 @@
1
+ /** 内置主题注册表:新增主题名称和颜色前缀只在这里维护。 */
2
+ declare const SYBZ_THEME_PREFIX: {
3
+ readonly chenghua: "--s-ch-";
4
+ readonly shijingshan: "--s-sjs-";
5
+ readonly sybz: "--s-sybz-";
6
+ };
7
+ type SybzThemeName = keyof typeof SYBZ_THEME_PREFIX;
8
+ type SybzComponentTheme = 'default' | SybzThemeName;
9
+ declare const isSybzTheme: (theme: unknown) => theme is "chenghua" | "shijingshan" | "sybz";
10
+
11
+ export { SYBZ_THEME_PREFIX, isSybzTheme };
12
+ export type { SybzComponentTheme, SybzThemeName };
package/dist/theme.mjs ADDED
@@ -0,0 +1,8 @@
1
+ const SYBZ_THEME_PREFIX = {
2
+ chenghua: "--s-ch-",
3
+ shijingshan: "--s-sjs-",
4
+ sybz: "--s-sybz-"
5
+ };
6
+ const isSybzTheme = (theme) => typeof theme === "string" && Object.prototype.hasOwnProperty.call(SYBZ_THEME_PREFIX, theme);
7
+
8
+ export { SYBZ_THEME_PREFIX, isSybzTheme };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sybz-components/utils",
3
- "version": "1.0.11",
3
+ "version": "1.0.12",
4
4
  "description": "utils of sybz-components",
5
5
  "license": "MIT",
6
6
  "type": "commonjs",
@@ -54,6 +54,7 @@
54
54
  },
55
55
  "author": "",
56
56
  "dependencies": {
57
+ "axios": "^1.19.0",
57
58
  "@eslint/js": "9.39.4",
58
59
  "@tailwindcss/vite": "^4.3.3",
59
60
  "@typescript-eslint/eslint-plugin": "8.62.0",