@sybz-components/utils 1.0.1 → 1.0.2

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');
4
4
  require('consola');
5
5
  require('es-toolkit');
6
- const format = require('./shared/utils.q3_d_9Nx.cjs');
6
+ const format = require('./shared/utils.CJVcMXo1.cjs');
7
7
  require('element-plus');
8
8
  require('./is.cjs');
9
9
 
package/dist/base.d.cts CHANGED
@@ -136,8 +136,11 @@ interface TryCatchResult<T> {
136
136
  */
137
137
  error: any;
138
138
  }
139
+ type MessageType = 'success' | 'info' | 'error' | 'warning';
140
+ type ShortType = 's' | 'i' | 'e' | 'w';
141
+ type ToastType = MessageType | ShortType;
139
142
  /**
140
- * 显示消息提示。
143
+ * @description 显示消息提示。默认展示成功状态,并支持类型简写、完整配置和快捷调用。
141
144
  *
142
145
  * 支持三种常见写法:
143
146
  * 1. `$toast('保存成功')`
@@ -150,22 +153,22 @@ interface TryCatchResult<T> {
150
153
  * @returns 无返回值。
151
154
  *
152
155
  * @example
153
- * $toast('保存成功')
156
+ * ```ts
157
+ * import { $toast } from '@sybz-components/utils'
154
158
  *
155
- * @example
159
+ * $toast('保存成功')
156
160
  * $toast('保存失败', 'e')
157
- *
158
- * @example
159
161
  * $toast({
160
162
  * message: '自定义提示',
161
163
  * type: 'warning',
162
164
  * duration: 1000,
163
165
  * closeAll: true,
164
166
  * })
167
+ * $toast.error('接口请求失败', { showClose: true })
168
+ * ```
169
+ *
170
+ * @see {@link https://liulihao88.github.io/sybz-components/components/utils/$toast/home.html 详细文档}
165
171
  */
166
- type MessageType = 'success' | 'info' | 'error' | 'warning';
167
- type ShortType = 's' | 'i' | 'e' | 'w';
168
- type ToastType = MessageType | ShortType;
169
172
  declare function $toast(message: string | ToastOptions | VNode | (() => VNode), type?: ToastType | ToastOptions, otherParams?: ToastOptions): void;
170
173
  declare namespace $toast {
171
174
  var success: (message: string | ToastOptions | VNode<vue.RendererNode, vue.RendererElement, {
package/dist/base.d.mts CHANGED
@@ -136,8 +136,11 @@ interface TryCatchResult<T> {
136
136
  */
137
137
  error: any;
138
138
  }
139
+ type MessageType = 'success' | 'info' | 'error' | 'warning';
140
+ type ShortType = 's' | 'i' | 'e' | 'w';
141
+ type ToastType = MessageType | ShortType;
139
142
  /**
140
- * 显示消息提示。
143
+ * @description 显示消息提示。默认展示成功状态,并支持类型简写、完整配置和快捷调用。
141
144
  *
142
145
  * 支持三种常见写法:
143
146
  * 1. `$toast('保存成功')`
@@ -150,22 +153,22 @@ interface TryCatchResult<T> {
150
153
  * @returns 无返回值。
151
154
  *
152
155
  * @example
153
- * $toast('保存成功')
156
+ * ```ts
157
+ * import { $toast } from '@sybz-components/utils'
154
158
  *
155
- * @example
159
+ * $toast('保存成功')
156
160
  * $toast('保存失败', 'e')
157
- *
158
- * @example
159
161
  * $toast({
160
162
  * message: '自定义提示',
161
163
  * type: 'warning',
162
164
  * duration: 1000,
163
165
  * closeAll: true,
164
166
  * })
167
+ * $toast.error('接口请求失败', { showClose: true })
168
+ * ```
169
+ *
170
+ * @see {@link https://liulihao88.github.io/sybz-components/components/utils/$toast/home.html 详细文档}
165
171
  */
166
- type MessageType = 'success' | 'info' | 'error' | 'warning';
167
- type ShortType = 's' | 'i' | 'e' | 'w';
168
- type ToastType = MessageType | ShortType;
169
172
  declare function $toast(message: string | ToastOptions | VNode | (() => VNode), type?: ToastType | ToastOptions, otherParams?: ToastOptions): void;
170
173
  declare namespace $toast {
171
174
  var success: (message: string | ToastOptions | VNode<vue.RendererNode, vue.RendererElement, {
package/dist/base.d.ts CHANGED
@@ -136,8 +136,11 @@ interface TryCatchResult<T> {
136
136
  */
137
137
  error: any;
138
138
  }
139
+ type MessageType = 'success' | 'info' | 'error' | 'warning';
140
+ type ShortType = 's' | 'i' | 'e' | 'w';
141
+ type ToastType = MessageType | ShortType;
139
142
  /**
140
- * 显示消息提示。
143
+ * @description 显示消息提示。默认展示成功状态,并支持类型简写、完整配置和快捷调用。
141
144
  *
142
145
  * 支持三种常见写法:
143
146
  * 1. `$toast('保存成功')`
@@ -150,22 +153,22 @@ interface TryCatchResult<T> {
150
153
  * @returns 无返回值。
151
154
  *
152
155
  * @example
153
- * $toast('保存成功')
156
+ * ```ts
157
+ * import { $toast } from '@sybz-components/utils'
154
158
  *
155
- * @example
159
+ * $toast('保存成功')
156
160
  * $toast('保存失败', 'e')
157
- *
158
- * @example
159
161
  * $toast({
160
162
  * message: '自定义提示',
161
163
  * type: 'warning',
162
164
  * duration: 1000,
163
165
  * closeAll: true,
164
166
  * })
167
+ * $toast.error('接口请求失败', { showClose: true })
168
+ * ```
169
+ *
170
+ * @see {@link https://liulihao88.github.io/sybz-components/components/utils/$toast/home.html 详细文档}
165
171
  */
166
- type MessageType = 'success' | 'info' | 'error' | 'warning';
167
- type ShortType = 's' | 'i' | 'e' | 'w';
168
- type ToastType = MessageType | ShortType;
169
172
  declare function $toast(message: string | ToastOptions | VNode | (() => VNode), type?: ToastType | ToastOptions, otherParams?: ToastOptions): void;
170
173
  declare namespace $toast {
171
174
  var success: (message: string | ToastOptions | VNode<vue.RendererNode, vue.RendererElement, {
package/dist/base.mjs CHANGED
@@ -1,6 +1,6 @@
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 confirm, d as copy, e as debounce, f as delay, g as getStorage, h as getType, i as getUtilsBuildTime, j as getVariable, k as isEmpty, l as log, m as merge, n as mockValue, p as processWidth, r as random, s as setStorage, t as test, o as throttle, q as toLine, u as tryCatch, v as validate, w as validateForm, x as validateOnSubmit } from './shared/utils.C6HkWKyE.mjs';
4
+ export { $ as $toast, c as clearStorage, a as clone, b as confirm, d as copy, e as debounce, f as delay, g as getStorage, h as getType, i as getUtilsBuildTime, j as getVariable, k as isEmpty, l as log, m as merge, n as mockValue, p as processWidth, r as random, s as setStorage, t as test, o as throttle, q as toLine, u as tryCatch, v as validate, w as validateForm, x as validateOnSubmit } from './shared/utils.D2T1ouSy.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.q3_d_9Nx.cjs');
3
+ const format = require('./shared/utils.CJVcMXo1.cjs');
4
4
  require('./is.cjs');
5
5
  require('consola');
6
6
  require('vue');
package/dist/format.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { y as formatBytes, z as formatBytesConvert, A as formatDurationTime, B as formatTextToHtml, C as formatThousands, D as formatTime, E as formatToFixed } from './shared/utils.C6HkWKyE.mjs';
1
+ export { y as formatBytes, z as formatBytesConvert, A as formatDurationTime, B as formatTextToHtml, C as formatThousands, D as formatTime, E as formatToFixed } from './shared/utils.D2T1ouSy.mjs';
2
2
  import './is.mjs';
3
3
  import 'consola';
4
4
  import 'vue';
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const format = require('./shared/utils.q3_d_9Nx.cjs');
3
+ const format = require('./shared/utils.CJVcMXo1.cjs');
4
4
  const is = require('./is.cjs');
5
5
  require('vue');
6
6
  require('consola');
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, f as delay, y as formatBytes, z as formatBytesConvert, A as formatDurationTime, B as formatTextToHtml, C as formatThousands, D as formatTime, E as formatToFixed, g as getStorage, h as getType, i as getUtilsBuildTime, j as getVariable, k as isEmpty, l as log, m as merge, n as mockValue, p as processWidth, r as random, s as setStorage, t as test, o as throttle, q as toLine, u as tryCatch, v as validate, w as validateForm, x as validateOnSubmit } from './shared/utils.C6HkWKyE.mjs';
1
+ export { $ as $toast, c as clearStorage, a as clone, b as confirm, d as copy, e as debounce, f as delay, y as formatBytes, z as formatBytesConvert, A as formatDurationTime, B as formatTextToHtml, C as formatThousands, D as formatTime, E as formatToFixed, g as getStorage, h as getType, i as getUtilsBuildTime, j as getVariable, k as isEmpty, l as log, m as merge, n as mockValue, p as processWidth, r as random, s as setStorage, t as test, o as throttle, q as toLine, u as tryCatch, v as validate, w as validateForm, x as validateOnSubmit } from './shared/utils.D2T1ouSy.mjs';
2
2
  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';
3
3
  import 'vue';
4
4
  import 'consola';
@@ -110,7 +110,7 @@ function formatTime(time = /* @__PURE__ */ new Date(), cFormat = "{y}-{m}-{d} {h
110
110
  } else if (dateOnlyRegex.test(timeStr)) {
111
111
  const [, year, month, day] = timeStr.match(dateOnlyRegex);
112
112
  date = new Date(Number(year), Number(month) - 1, Number(day));
113
- } else if (timeStr.includes(".") && !isNaN(parseFloat(timeStr))) {
113
+ } else if (/^[+-]?\d+\.\d+$/.test(timeStr)) {
114
114
  date = new Date(parseFloat(timeStr) * 1e3);
115
115
  } else if (/^\d{10}$/.test(timeStr)) {
116
116
  date = new Date(parseInt(timeStr) * 1e3);
@@ -366,7 +366,7 @@ function clearStorage(str = "") {
366
366
  function _isObjectWithExclude(obj) {
367
367
  return typeof obj === "object" && obj !== null && "exclude" in obj && Array.isArray(obj.exclude);
368
368
  }
369
- function validateForm(ref, { message = "\u8868\u5355\u6821\u9A8C\u9519\u8BEF, \u8BF7\u68C0\u67E5", detail = false, showMessage = true } = {}) {
369
+ function validateForm(ref, { message = "\u5B58\u5728\u5FC5\u586B\u9879\u672A\u586B\u5199\uFF0C\u8BF7\u8865\u5145\u5B8C\u6574", detail = false, showMessage = true } = {}) {
370
370
  return new Promise((resolve, reject) => {
371
371
  vue.unref(ref).validate((valid, status) => {
372
372
  if (valid) {
@@ -1035,7 +1035,7 @@ function getVariable(propertyName, fallback = "") {
1035
1035
  const DEFAULT_BUILD_TIME_FALLBACK = "\u672A\u6CE8\u5165";
1036
1036
  function getUtilsBuildTime(fallback = DEFAULT_BUILD_TIME_FALLBACK) {
1037
1037
  {
1038
- return "2026-07-10 15:30:17";
1038
+ return "2026-07-29 15:14:53";
1039
1039
  }
1040
1040
  }
1041
1041
  function test() {
@@ -108,7 +108,7 @@ function formatTime(time = /* @__PURE__ */ new Date(), cFormat = "{y}-{m}-{d} {h
108
108
  } else if (dateOnlyRegex.test(timeStr)) {
109
109
  const [, year, month, day] = timeStr.match(dateOnlyRegex);
110
110
  date = new Date(Number(year), Number(month) - 1, Number(day));
111
- } else if (timeStr.includes(".") && !isNaN(parseFloat(timeStr))) {
111
+ } else if (/^[+-]?\d+\.\d+$/.test(timeStr)) {
112
112
  date = new Date(parseFloat(timeStr) * 1e3);
113
113
  } else if (/^\d{10}$/.test(timeStr)) {
114
114
  date = new Date(parseInt(timeStr) * 1e3);
@@ -364,7 +364,7 @@ function clearStorage(str = "") {
364
364
  function _isObjectWithExclude(obj) {
365
365
  return typeof obj === "object" && obj !== null && "exclude" in obj && Array.isArray(obj.exclude);
366
366
  }
367
- function validateForm(ref, { message = "\u8868\u5355\u6821\u9A8C\u9519\u8BEF, \u8BF7\u68C0\u67E5", detail = false, showMessage = true } = {}) {
367
+ function validateForm(ref, { message = "\u5B58\u5728\u5FC5\u586B\u9879\u672A\u586B\u5199\uFF0C\u8BF7\u8865\u5145\u5B8C\u6574", detail = false, showMessage = true } = {}) {
368
368
  return new Promise((resolve, reject) => {
369
369
  unref(ref).validate((valid, status) => {
370
370
  if (valid) {
@@ -1033,7 +1033,7 @@ function getVariable(propertyName, fallback = "") {
1033
1033
  const DEFAULT_BUILD_TIME_FALLBACK = "\u672A\u6CE8\u5165";
1034
1034
  function getUtilsBuildTime(fallback = DEFAULT_BUILD_TIME_FALLBACK) {
1035
1035
  {
1036
- return "2026-07-10 15:30:17";
1036
+ return "2026-07-29 15:14:53";
1037
1037
  }
1038
1038
  }
1039
1039
  function test() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sybz-components/utils",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "utils of sybz-components",
5
5
  "license": "MIT",
6
6
  "type": "commonjs",