@pawover/kit 0.0.0-beta.5 → 0.0.0-beta.50

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.
Files changed (47) hide show
  1. package/package.json +61 -80
  2. package/packages/hooks/dist/alova.d.ts +31 -0
  3. package/packages/hooks/dist/alova.js +64 -0
  4. package/packages/hooks/dist/index.d.ts +1 -0
  5. package/packages/hooks/dist/index.js +0 -0
  6. package/packages/hooks/dist/metadata.json +16 -0
  7. package/packages/hooks/dist/react.d.ts +164 -0
  8. package/packages/hooks/dist/react.js +4419 -0
  9. package/packages/utils/dist/index.d.ts +4293 -0
  10. package/packages/utils/dist/index.js +1527 -0
  11. package/packages/utils/dist/math.d.ts +54 -0
  12. package/packages/utils/dist/math.js +56 -0
  13. package/packages/utils/dist/metadata.json +14 -0
  14. package/packages/utils/dist/string-CESQdidv.js +793 -0
  15. package/packages/utils/dist/vite.d.ts +16 -0
  16. package/packages/utils/dist/vite.js +26 -0
  17. package/packages/zod/dist/index.d.ts +58 -0
  18. package/packages/zod/dist/index.js +61 -0
  19. package/dist/enums.d.ts +0 -25
  20. package/dist/enums.d.ts.map +0 -1
  21. package/dist/enums.js +0 -25
  22. package/dist/enums.js.map +0 -1
  23. package/dist/hooks-alova.d.ts +0 -23
  24. package/dist/hooks-alova.d.ts.map +0 -1
  25. package/dist/hooks-alova.js +0 -39
  26. package/dist/hooks-alova.js.map +0 -1
  27. package/dist/hooks-react.d.ts +0 -89
  28. package/dist/hooks-react.d.ts.map +0 -1
  29. package/dist/hooks-react.js +0 -340
  30. package/dist/hooks-react.js.map +0 -1
  31. package/dist/index.d.ts +0 -2452
  32. package/dist/index.d.ts.map +0 -1
  33. package/dist/index.js +0 -1441
  34. package/dist/index.js.map +0 -1
  35. package/dist/patches-fetchEventSource.d.ts +0 -806
  36. package/dist/patches-fetchEventSource.d.ts.map +0 -1
  37. package/dist/patches-fetchEventSource.js +0 -315
  38. package/dist/patches-fetchEventSource.js.map +0 -1
  39. package/dist/vite.d.ts +0 -13
  40. package/dist/vite.d.ts.map +0 -1
  41. package/dist/vite.js +0 -23
  42. package/dist/vite.js.map +0 -1
  43. package/dist/zod.d.ts +0 -105
  44. package/dist/zod.d.ts.map +0 -1
  45. package/dist/zod.js +0 -138
  46. package/dist/zod.js.map +0 -1
  47. package/metadata.json +0 -161
@@ -0,0 +1,54 @@
1
+ import { BigNumber, MathExpression, MathJsInstance, Matrix } from "mathjs";
2
+
3
+ //#region src/math/mathUtil.d.ts
4
+ /**
5
+ * 数学工具类
6
+ * - 基于 [`mathjs`](https://mathjs.org)
7
+ */
8
+ declare class MathUtil {
9
+ /**
10
+ * 将任意类型的值转换为 `math.bignumber`
11
+ *
12
+ * @param mathJsInstance mathJs 实例
13
+ * @param value 任意类型的值
14
+ * @param fallback 回退值
15
+ * @returns 转换后的 BigNumber
16
+ * @example
17
+ * ```ts
18
+ * import { create, all } from "mathjs";
19
+ * const math = create(all);
20
+ * MathUtil.toBignumber(math, "0.1");
21
+ * ```
22
+ */
23
+ static toBignumber(mathJsInstance: MathJsInstance, value: unknown, fallback?: BigNumber | undefined): BigNumber;
24
+ /**
25
+ * 将任意类型的值转换为十进制数字字符串
26
+ *
27
+ * @param mathJsInstance mathJs 实例
28
+ * @param value 任意类型的值
29
+ * @param precision 精度
30
+ * @param isFormat 是否格式化为字符串
31
+ * @returns 格式化后的字符串或 BigNumber
32
+ * @example
33
+ * ```ts
34
+ * MathUtil.toDecimal(math, 0.12345, 2); // "0.12"
35
+ * ```
36
+ */
37
+ static toDecimal(mathJsInstance: MathJsInstance, value: unknown, precision?: number | undefined, isFormat?: true | undefined): string;
38
+ static toDecimal(mathJsInstance: MathJsInstance, value: unknown, precision?: number | undefined, isFormat?: false | undefined): BigNumber;
39
+ /**
40
+ * 数学表达式求值
41
+ *
42
+ * @param mathJsInstance mathJs 实例
43
+ * @param expr 表达式
44
+ * @param scope 键值映射
45
+ * @returns 计算结果的字符串表示
46
+ * @example
47
+ * ```ts
48
+ * MathUtil.toEvaluate(math, "a + b", { a: 1, b: 2 }); // "3"
49
+ * ```
50
+ */
51
+ static toEvaluate(mathJsInstance: MathJsInstance, expr: MathExpression | Matrix, scope?: Record<string, BigNumber> | undefined): string;
52
+ }
53
+ //#endregion
54
+ export { MathUtil };
@@ -0,0 +1,56 @@
1
+ import { n as TypeUtil, t as StringUtil } from "./string-CESQdidv.js";
2
+ //#region src/math/mathUtil.ts
3
+ /**
4
+ * 数学工具类
5
+ * - 基于 [`mathjs`](https://mathjs.org)
6
+ */
7
+ var MathUtil = class MathUtil {
8
+ /**
9
+ * 将任意类型的值转换为 `math.bignumber`
10
+ *
11
+ * @param mathJsInstance mathJs 实例
12
+ * @param value 任意类型的值
13
+ * @param fallback 回退值
14
+ * @returns 转换后的 BigNumber
15
+ * @example
16
+ * ```ts
17
+ * import { create, all } from "mathjs";
18
+ * const math = create(all);
19
+ * MathUtil.toBignumber(math, "0.1");
20
+ * ```
21
+ */
22
+ static toBignumber(mathJsInstance, value, fallback) {
23
+ const errorValue = fallback ?? mathJsInstance.bignumber(0);
24
+ if (TypeUtil.isFalsyLike(value) || TypeUtil.isInfinityLike(value)) return errorValue;
25
+ try {
26
+ return mathJsInstance.bignumber(StringUtil.toNumber(`${value}`));
27
+ } catch (error) {
28
+ return errorValue;
29
+ }
30
+ }
31
+ static toDecimal(mathJsInstance, value, precision, isFormat = true) {
32
+ const bigNumber = MathUtil.toBignumber(mathJsInstance, value);
33
+ return isFormat ? mathJsInstance.format(bigNumber, {
34
+ notation: "fixed",
35
+ precision
36
+ }) : bigNumber;
37
+ }
38
+ /**
39
+ * 数学表达式求值
40
+ *
41
+ * @param mathJsInstance mathJs 实例
42
+ * @param expr 表达式
43
+ * @param scope 键值映射
44
+ * @returns 计算结果的字符串表示
45
+ * @example
46
+ * ```ts
47
+ * MathUtil.toEvaluate(math, "a + b", { a: 1, b: 2 }); // "3"
48
+ * ```
49
+ */
50
+ static toEvaluate(mathJsInstance, expr, scope) {
51
+ const evaluateValue = `${mathJsInstance.evaluate(expr, scope || {})}`;
52
+ return mathJsInstance.format(MathUtil.toBignumber(mathJsInstance, evaluateValue), { notation: "fixed" });
53
+ }
54
+ };
55
+ //#endregion
56
+ export { MathUtil };
@@ -0,0 +1,14 @@
1
+ [
2
+ "ArrayUtil",
3
+ "DateTimeUtil",
4
+ "EnvUtil",
5
+ "FunctionUtil",
6
+ "MimeUtil",
7
+ "NumberUtil",
8
+ "ObjectUtil",
9
+ "StringUtil",
10
+ "ThemeUtil",
11
+ "TreeUtil",
12
+ "TypeUtil",
13
+ "ValidateUtil"
14
+ ]