@sybz-components/utils 0.0.7 → 0.0.8

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,7 +3,7 @@
3
3
  require('@vue/reactivity');
4
4
  require('consola');
5
5
  require('es-toolkit');
6
- const format = require('./shared/utils.Ck0CV9dy.cjs');
6
+ const format = require('./shared/utils.CDpXB2JP.cjs');
7
7
  require('element-plus');
8
8
  require('./is.cjs');
9
9
 
package/dist/base.d.cts CHANGED
@@ -112,12 +112,11 @@ interface CopyOptions extends ToastOptions {
112
112
  }
113
113
  type WidthInput = string | number | Ref<string | number>;
114
114
  type ConfirmMessage = string | VNode | (() => VNode);
115
- type ConfirmAppendTarget = string | HTMLElement | null;
116
115
  interface ConfirmOptions extends ElMessageBoxOptions {
117
116
  /**
118
- * 追加到的挂载节点。支持 css 选择器、DOM 节点或 `null`。
117
+ * 确认框主题。
119
118
  */
120
- appendTo?: ConfirmAppendTarget;
119
+ theme?: '' | 'chenghua';
121
120
  /**
122
121
  * 手动传入 appContext,处理多应用或嵌套弹窗场景。
123
122
  */
package/dist/base.d.mts CHANGED
@@ -112,12 +112,11 @@ interface CopyOptions extends ToastOptions {
112
112
  }
113
113
  type WidthInput = string | number | Ref<string | number>;
114
114
  type ConfirmMessage = string | VNode | (() => VNode);
115
- type ConfirmAppendTarget = string | HTMLElement | null;
116
115
  interface ConfirmOptions extends ElMessageBoxOptions {
117
116
  /**
118
- * 追加到的挂载节点。支持 css 选择器、DOM 节点或 `null`。
117
+ * 确认框主题。
119
118
  */
120
- appendTo?: ConfirmAppendTarget;
119
+ theme?: '' | 'chenghua';
121
120
  /**
122
121
  * 手动传入 appContext,处理多应用或嵌套弹窗场景。
123
122
  */
package/dist/base.d.ts CHANGED
@@ -112,12 +112,11 @@ interface CopyOptions extends ToastOptions {
112
112
  }
113
113
  type WidthInput = string | number | Ref<string | number>;
114
114
  type ConfirmMessage = string | VNode | (() => VNode);
115
- type ConfirmAppendTarget = string | HTMLElement | null;
116
115
  interface ConfirmOptions extends ElMessageBoxOptions {
117
116
  /**
118
- * 追加到的挂载节点。支持 css 选择器、DOM 节点或 `null`。
117
+ * 确认框主题。
119
118
  */
120
- appendTo?: ConfirmAppendTarget;
119
+ theme?: '' | 'chenghua';
121
120
  /**
122
121
  * 手动传入 appContext,处理多应用或嵌套弹窗场景。
123
122
  */
package/dist/base.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import '@vue/reactivity';
2
2
  import 'consola';
3
3
  import 'es-toolkit';
4
- export { $ as $toast, c as clearStorage, a as clone, b as confirm, d as copy, e as debounce, g as getStorage, f as getType, h as getUtilsBuildTime, i as getVariable, j as isEmpty, l as log, m as merge, p as processWidth, r as random, s as setStorage, k as sleep, t as test, n as throttle, o as toLine, q as tryCatch, u as uuid, v as validForm, w as validate, x as validateTrigger } from './shared/utils.DJGyatmd.mjs';
4
+ export { $ as $toast, c as clearStorage, a as clone, b as confirm, d as copy, e as debounce, g as getStorage, f as getType, h as getUtilsBuildTime, i as getVariable, j as isEmpty, l as log, m as merge, p as processWidth, r as random, s as setStorage, k as sleep, t as test, n as throttle, o as toLine, q as tryCatch, u as uuid, v as validForm, w as validate, x as validateTrigger } from './shared/utils.cf1aBGgC.mjs';
5
5
  import 'element-plus';
6
6
  import './is.mjs';
package/dist/format.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const format = require('./shared/utils.Ck0CV9dy.cjs');
3
+ const format = require('./shared/utils.CDpXB2JP.cjs');
4
4
  require('./is.cjs');
5
5
  require('@vue/reactivity');
6
6
  require('consola');
package/dist/format.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { y as formatBytes, z as formatBytesConvert, A as formatDurationTime, B as formatImg, C as formatTextToHtml, D as formatThousands, E as formatTime, F as formatToFixed } from './shared/utils.DJGyatmd.mjs';
1
+ export { y as formatBytes, z as formatBytesConvert, A as formatDurationTime, B as formatImg, C as formatTextToHtml, D as formatThousands, E as formatTime, F as formatToFixed } from './shared/utils.cf1aBGgC.mjs';
2
2
  import './is.mjs';
3
3
  import '@vue/reactivity';
4
4
  import 'consola';
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const format = require('./shared/utils.Ck0CV9dy.cjs');
3
+ const format = require('./shared/utils.CDpXB2JP.cjs');
4
4
  const day = require('./day.cjs');
5
5
  const is = require('./is.cjs');
6
6
  const ws = require('./ws.cjs');
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { $ as $toast, c as clearStorage, a as clone, b as confirm, d as copy, e as debounce, y as formatBytes, z as formatBytesConvert, A as formatDurationTime, B as formatImg, C as formatTextToHtml, D as formatThousands, E as formatTime, F as formatToFixed, g as getStorage, f as getType, h as getUtilsBuildTime, i as getVariable, j as isEmpty, l as log, m as merge, p as processWidth, r as random, s as setStorage, k as sleep, t as test, n as throttle, o as toLine, q as tryCatch, u as uuid, v as validForm, w as validate, x as validateTrigger } from './shared/utils.DJGyatmd.mjs';
1
+ export { $ as $toast, c as clearStorage, a as clone, b as confirm, d as copy, e as debounce, y as formatBytes, z as formatBytesConvert, A as formatDurationTime, B as formatImg, C as formatTextToHtml, D as formatThousands, E as formatTime, F as formatToFixed, g as getStorage, f as getType, h as getUtilsBuildTime, i as getVariable, j as isEmpty, l as log, m as merge, p as processWidth, r as random, s as setStorage, k as sleep, t as test, n as throttle, o as toLine, q as tryCatch, u as uuid, v as validForm, w as validate, x as validateTrigger } from './shared/utils.cf1aBGgC.mjs';
2
2
  export { diffDate, diffDateFromCurrent, formatDate, formatDateToDay, formatDateToMinute } from './day.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 { WS } from './ws.mjs';
@@ -189,7 +189,7 @@ function formatImg(photoName, addPath = "", { basePath = "assets/images" } = {})
189
189
  const addLastSlash = addPath.endsWith("/") || !addPath ? addPath : `${addPath}/`;
190
190
  const addLastBasePathSlash = basePath.endsWith("/") || !basePath ? basePath : `${basePath}/`;
191
191
  const mergeSrc = `${addLastSlash}${photoName}`;
192
- return new URL(`../${addLastBasePathSlash}${mergeSrc}`, (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('shared/utils.Ck0CV9dy.cjs', document.baseURI).href))).href;
192
+ return new URL(`../${addLastBasePathSlash}${mergeSrc}`, (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('shared/utils.CDpXB2JP.cjs', document.baseURI).href))).href;
193
193
  }
194
194
  function formatToFixed(value, options) {
195
195
  if (typeof options === "number") {
@@ -234,6 +234,9 @@ function formatTextToHtml(str) {
234
234
 
235
235
  const DEFAULT_CONFIRM_BUTTON_CLASS = "s-message-box__confirm-btn";
236
236
  const DEFAULT_CANCEL_BUTTON_CLASS = "s-message-box__cancel-btn";
237
+ const CHENGHUA_CONFIRM_BOX_CLASS = "s-message-box--chenghua";
238
+ const CHENGHUA_CONFIRM_BUTTON_CLASS = "s-message-box__confirm-btn--chenghua";
239
+ const CHENGHUA_CANCEL_BUTTON_CLASS = "s-message-box__cancel-btn--chenghua";
237
240
  function _getBrowserStorage(isSession = false) {
238
241
  if (typeof window === "undefined") {
239
242
  return null;
@@ -855,9 +858,19 @@ function debounce(func, delay = 500, immediate, resultCallback) {
855
858
  return _debounce;
856
859
  }
857
860
  function confirm(message, options = {}, appContext = null) {
861
+ const {
862
+ theme,
863
+ customClass,
864
+ confirmButtonClass,
865
+ cancelButtonClass,
866
+ appendTo,
867
+ appContext: optionAppContext,
868
+ ...messageBoxOptions
869
+ } = options;
858
870
  const resolvedMessage = typeof message === "function" ? message() : message;
859
- const resolvedAppendTo = _resolveAppendTarget(options?.appendTo);
860
- const resolvedAppContext = _resolveAppContext(options?.appContext || appContext);
871
+ const resolvedAppendTo = _resolveAppendTarget(appendTo);
872
+ const resolvedAppContext = _resolveAppContext(optionAppContext || appContext);
873
+ const isChenghuaTheme = theme === "chenghua";
861
874
  const mergeOptions = {
862
875
  title: "\u63D0\u793A",
863
876
  draggable: true,
@@ -865,11 +878,20 @@ function confirm(message, options = {}, appContext = null) {
865
878
  cancelButtonText: "\u53D6\u6D88",
866
879
  confirmButtonText: "\u786E\u5B9A",
867
880
  dangerouslyUseHTMLString: true,
881
+ ...messageBoxOptions,
868
882
  appendTo: resolvedAppendTo,
869
883
  appContext: resolvedAppContext,
870
- confirmButtonClass: _mergeClassNames(DEFAULT_CONFIRM_BUTTON_CLASS, options?.confirmButtonClass),
871
- cancelButtonClass: _mergeClassNames(DEFAULT_CANCEL_BUTTON_CLASS, options?.cancelButtonClass),
872
- ...options
884
+ customClass: _mergeClassNames(isChenghuaTheme && CHENGHUA_CONFIRM_BOX_CLASS, customClass),
885
+ confirmButtonClass: _mergeClassNames(
886
+ DEFAULT_CONFIRM_BUTTON_CLASS,
887
+ isChenghuaTheme && CHENGHUA_CONFIRM_BUTTON_CLASS,
888
+ confirmButtonClass
889
+ ),
890
+ cancelButtonClass: _mergeClassNames(
891
+ DEFAULT_CANCEL_BUTTON_CLASS,
892
+ isChenghuaTheme && CHENGHUA_CANCEL_BUTTON_CLASS,
893
+ cancelButtonClass
894
+ )
873
895
  };
874
896
  return elementPlus.ElMessageBox.confirm(resolvedMessage, mergeOptions);
875
897
  }
@@ -922,7 +944,7 @@ function getVariable(propertyName, fallback = "") {
922
944
  const DEFAULT_BUILD_TIME_FALLBACK = "\u672A\u6CE8\u5165";
923
945
  function getUtilsBuildTime(fallback = DEFAULT_BUILD_TIME_FALLBACK) {
924
946
  {
925
- return "2026-06-12 14:54:43";
947
+ return "2026-06-18 15:18:56";
926
948
  }
927
949
  }
928
950
  function test() {
@@ -231,6 +231,9 @@ function formatTextToHtml(str) {
231
231
 
232
232
  const DEFAULT_CONFIRM_BUTTON_CLASS = "s-message-box__confirm-btn";
233
233
  const DEFAULT_CANCEL_BUTTON_CLASS = "s-message-box__cancel-btn";
234
+ const CHENGHUA_CONFIRM_BOX_CLASS = "s-message-box--chenghua";
235
+ const CHENGHUA_CONFIRM_BUTTON_CLASS = "s-message-box__confirm-btn--chenghua";
236
+ const CHENGHUA_CANCEL_BUTTON_CLASS = "s-message-box__cancel-btn--chenghua";
234
237
  function _getBrowserStorage(isSession = false) {
235
238
  if (typeof window === "undefined") {
236
239
  return null;
@@ -852,9 +855,19 @@ function debounce(func, delay = 500, immediate, resultCallback) {
852
855
  return _debounce;
853
856
  }
854
857
  function confirm(message, options = {}, appContext = null) {
858
+ const {
859
+ theme,
860
+ customClass,
861
+ confirmButtonClass,
862
+ cancelButtonClass,
863
+ appendTo,
864
+ appContext: optionAppContext,
865
+ ...messageBoxOptions
866
+ } = options;
855
867
  const resolvedMessage = typeof message === "function" ? message() : message;
856
- const resolvedAppendTo = _resolveAppendTarget(options?.appendTo);
857
- const resolvedAppContext = _resolveAppContext(options?.appContext || appContext);
868
+ const resolvedAppendTo = _resolveAppendTarget(appendTo);
869
+ const resolvedAppContext = _resolveAppContext(optionAppContext || appContext);
870
+ const isChenghuaTheme = theme === "chenghua";
858
871
  const mergeOptions = {
859
872
  title: "\u63D0\u793A",
860
873
  draggable: true,
@@ -862,11 +875,20 @@ function confirm(message, options = {}, appContext = null) {
862
875
  cancelButtonText: "\u53D6\u6D88",
863
876
  confirmButtonText: "\u786E\u5B9A",
864
877
  dangerouslyUseHTMLString: true,
878
+ ...messageBoxOptions,
865
879
  appendTo: resolvedAppendTo,
866
880
  appContext: resolvedAppContext,
867
- confirmButtonClass: _mergeClassNames(DEFAULT_CONFIRM_BUTTON_CLASS, options?.confirmButtonClass),
868
- cancelButtonClass: _mergeClassNames(DEFAULT_CANCEL_BUTTON_CLASS, options?.cancelButtonClass),
869
- ...options
881
+ customClass: _mergeClassNames(isChenghuaTheme && CHENGHUA_CONFIRM_BOX_CLASS, customClass),
882
+ confirmButtonClass: _mergeClassNames(
883
+ DEFAULT_CONFIRM_BUTTON_CLASS,
884
+ isChenghuaTheme && CHENGHUA_CONFIRM_BUTTON_CLASS,
885
+ confirmButtonClass
886
+ ),
887
+ cancelButtonClass: _mergeClassNames(
888
+ DEFAULT_CANCEL_BUTTON_CLASS,
889
+ isChenghuaTheme && CHENGHUA_CANCEL_BUTTON_CLASS,
890
+ cancelButtonClass
891
+ )
870
892
  };
871
893
  return ElMessageBox.confirm(resolvedMessage, mergeOptions);
872
894
  }
@@ -919,7 +941,7 @@ function getVariable(propertyName, fallback = "") {
919
941
  const DEFAULT_BUILD_TIME_FALLBACK = "\u672A\u6CE8\u5165";
920
942
  function getUtilsBuildTime(fallback = DEFAULT_BUILD_TIME_FALLBACK) {
921
943
  {
922
- return "2026-06-12 14:54:43";
944
+ return "2026-06-18 15:18:56";
923
945
  }
924
946
  }
925
947
  function test() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sybz-components/utils",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "description": "utils of sybz-components",
5
5
  "license": "MIT",
6
6
  "type": "commonjs",