@vrojs/base 0.0.1 → 0.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.
Files changed (121) hide show
  1. package/dist/index.d.ts +6 -0
  2. package/dist/index.js +35 -0
  3. package/dist/style/css.js +4 -0
  4. package/dist/style/index.css +1 -0
  5. package/dist/style/index.d.ts +0 -0
  6. package/dist/style/index.js +4 -0
  7. package/dist/types/Arrayable.d.ts +1 -0
  8. package/dist/types/Arrayable.js +1 -0
  9. package/dist/types/DeepPartial.d.ts +3 -0
  10. package/dist/types/DeepPartial.js +1 -0
  11. package/dist/types/index.d.ts +2 -0
  12. package/dist/types/index.js +1 -0
  13. package/dist/utils/ComponentManager.d.ts +18 -0
  14. package/dist/utils/ComponentManager.js +21 -0
  15. package/dist/utils/format.d.ts +5 -0
  16. package/dist/utils/format.js +14 -0
  17. package/dist/utils/index.d.ts +8 -0
  18. package/dist/utils/index.js +19 -0
  19. package/dist/utils/mountComponent.d.ts +5 -0
  20. package/dist/utils/mountComponent.js +12 -0
  21. package/dist/utils/parseType.d.ts +1 -0
  22. package/dist/utils/parseType.js +4 -0
  23. package/dist/utils/props.d.ts +2 -0
  24. package/dist/utils/props.js +5 -0
  25. package/dist/utils/renderComponent.d.ts +5 -0
  26. package/dist/utils/renderComponent.js +17 -0
  27. package/dist/utils/showComponent.d.ts +6 -0
  28. package/dist/utils/showComponent.js +17 -0
  29. package/dist/utils/withInstall.d.ts +3 -0
  30. package/dist/utils/withInstall.js +6 -0
  31. package/dist/vro-aspect-ratio/index.d.ts +46 -0
  32. package/dist/vro-aspect-ratio/index.js +11 -0
  33. package/dist/vro-aspect-ratio/style/css.d.ts +0 -0
  34. package/dist/vro-aspect-ratio/style/css.js +4 -0
  35. package/dist/vro-aspect-ratio/style/index.css +1 -0
  36. package/dist/vro-aspect-ratio/style/index.d.ts +0 -0
  37. package/dist/vro-aspect-ratio/style/index.js +4 -0
  38. package/dist/vro-aspect-ratio/types.d.ts +13 -0
  39. package/dist/vro-aspect-ratio/types.js +14 -0
  40. package/dist/vro-aspect-ratio/vro-aspect-ratio.vue.d.ts +29 -0
  41. package/dist/vro-aspect-ratio/vro-aspect-ratio.vue.js +25 -0
  42. package/dist/vro-aspect-ratio/vro-aspect-ratio.vue2.js +4 -0
  43. package/dist/vro-input/index.d.ts +90 -0
  44. package/dist/vro-input/index.js +11 -0
  45. package/dist/vro-input/style/css.d.ts +0 -0
  46. package/dist/vro-input/style/css.js +3 -0
  47. package/dist/vro-input/style/index.d.ts +0 -0
  48. package/dist/vro-input/style/index.js +3 -0
  49. package/dist/vro-input/types.d.ts +95 -0
  50. package/{src/vro-input/types.ts → dist/vro-input/types.js} +17 -30
  51. package/dist/vro-input/vro-input.vue.d.ts +83 -0
  52. package/dist/vro-input/vro-input.vue.js +62 -0
  53. package/dist/vro-input/vro-input.vue2.js +4 -0
  54. package/dist/vro-loading/index.d.ts +91 -0
  55. package/dist/vro-loading/index.js +11 -0
  56. package/dist/vro-loading/style/css.d.ts +0 -0
  57. package/dist/vro-loading/style/css.js +4 -0
  58. package/dist/vro-loading/style/index.css +1 -0
  59. package/dist/vro-loading/style/index.d.ts +0 -0
  60. package/dist/vro-loading/style/index.js +4 -0
  61. package/dist/vro-loading/types.d.ts +33 -0
  62. package/dist/vro-loading/types.js +33 -0
  63. package/dist/vro-loading/vro-loading.vue.d.ts +56 -0
  64. package/dist/vro-loading/vro-loading.vue.js +50 -0
  65. package/dist/vro-loading/vro-loading.vue2.js +4 -0
  66. package/dist/vro-vnr/index.d.ts +25 -0
  67. package/dist/vro-vnr/index.js +11 -0
  68. package/dist/vro-vnr/style/css.d.ts +0 -0
  69. package/dist/vro-vnr/style/css.js +3 -0
  70. package/dist/vro-vnr/style/index.d.ts +0 -0
  71. package/dist/vro-vnr/style/index.js +3 -0
  72. package/dist/vro-vnr/types.d.ts +8 -0
  73. package/dist/vro-vnr/types.js +9 -0
  74. package/dist/vro-vnr/vro-vnr.vue.d.ts +18 -0
  75. package/dist/vro-vnr/vro-vnr.vue.js +12 -0
  76. package/dist/vro-vnr/vro-vnr.vue2.js +4 -0
  77. package/package.json +16 -10
  78. package/src/index.ts +0 -8
  79. package/src/style/base.scss +0 -2
  80. package/src/style/css.ts +0 -2
  81. package/src/style/index.scss +0 -7
  82. package/src/style/index.ts +0 -1
  83. package/src/types/Arrayable.ts +0 -1
  84. package/src/types/DeepPartial.ts +0 -3
  85. package/src/types/index.ts +0 -2
  86. package/src/utils/ComponentManager.ts +0 -39
  87. package/src/utils/format.ts +0 -31
  88. package/src/utils/index.ts +0 -8
  89. package/src/utils/mountComponent.ts +0 -16
  90. package/src/utils/parseType.ts +0 -6
  91. package/src/utils/props.ts +0 -3
  92. package/src/utils/renderComponent.ts +0 -24
  93. package/src/utils/showComponent.ts +0 -24
  94. package/src/utils/withInstall.ts +0 -10
  95. package/src/vro-aspect-ratio/README.md +0 -55
  96. package/src/vro-aspect-ratio/index.ts +0 -15
  97. package/src/vro-aspect-ratio/style/css.ts +0 -2
  98. package/src/vro-aspect-ratio/style/index.scss +0 -16
  99. package/src/vro-aspect-ratio/style/index.ts +0 -1
  100. package/src/vro-aspect-ratio/types.ts +0 -15
  101. package/src/vro-aspect-ratio/vro-aspect-ratio.vue +0 -23
  102. package/src/vro-input/README.md +0 -95
  103. package/src/vro-input/index.ts +0 -15
  104. package/src/vro-input/style/css.ts +0 -2
  105. package/src/vro-input/style/index.ts +0 -1
  106. package/src/vro-input/vro-input.vue +0 -122
  107. package/src/vro-loading/README.md +0 -77
  108. package/src/vro-loading/index.ts +0 -15
  109. package/src/vro-loading/style/css.ts +0 -2
  110. package/src/vro-loading/style/index.scss +0 -119
  111. package/src/vro-loading/style/index.ts +0 -1
  112. package/src/vro-loading/types.ts +0 -39
  113. package/src/vro-loading/vro-loading.vue +0 -39
  114. package/src/vro-vnr/README.md +0 -46
  115. package/src/vro-vnr/index.ts +0 -15
  116. package/src/vro-vnr/style/css.ts +0 -2
  117. package/src/vro-vnr/style/index.ts +0 -1
  118. package/src/vro-vnr/types.ts +0 -10
  119. package/src/vro-vnr/vro-vnr.vue +0 -13
  120. /package/{src/vro-input/style/index.scss → dist/style/base.css} +0 -0
  121. /package/{src/vro-vnr/style/index.scss → dist/style/css.d.ts} +0 -0
@@ -0,0 +1,95 @@
1
+ import { ExtractPropTypes, InputTypeHTMLAttribute } from 'vue';
2
+ export declare const vroInputProps: {
3
+ /**
4
+ * 输入框类型。
5
+ *
6
+ * 在原生 input type 的基础上扩展了 decimal:
7
+ * - number:只允许输入数字,移动端使用数字键盘
8
+ * - decimal:只允许输入小数,移动端使用小数键盘
9
+ *
10
+ * @default text
11
+ */
12
+ type: {
13
+ type: import('vue').PropType<InputTypeHTMLAttribute | "decimal">;
14
+ default: string;
15
+ };
16
+ /**
17
+ * 输入框绑定值。
18
+ */
19
+ modelValue: {
20
+ type: import('vue').PropType<string | number | null | undefined>;
21
+ default: string;
22
+ };
23
+ /**
24
+ * 最大值,仅当 type 为 decimal 时作为输入值上限使用。
25
+ *
26
+ * @default Number.MAX_SAFE_INTEGER
27
+ */
28
+ max: {
29
+ type: (NumberConstructor | StringConstructor)[];
30
+ default: number;
31
+ };
32
+ /**
33
+ * 最小值,仅当 type 为 decimal 时作为输入值下限使用。
34
+ *
35
+ * @default Number.MIN_SAFE_INTEGER
36
+ */
37
+ min: {
38
+ type: (NumberConstructor | StringConstructor)[];
39
+ default: number;
40
+ };
41
+ /**
42
+ * 输入值超出 min/max 后是否自动修正到边界值,仅当 type 为 decimal 时有效。
43
+ *
44
+ * 为 false 时,超出边界会回退到上一次合法值。
45
+ *
46
+ * @default false
47
+ */
48
+ autoFix: BooleanConstructor;
49
+ /**
50
+ * 原生 maxlength 属性。
51
+ */
52
+ maxlength: (NumberConstructor | StringConstructor)[];
53
+ /**
54
+ * 原生 placeholder 属性。
55
+ */
56
+ placeholder: StringConstructor;
57
+ /**
58
+ * 原生 disabled 属性。
59
+ */
60
+ disabled: BooleanConstructor;
61
+ /**
62
+ * 小数精度,仅当 type 为 decimal 时有效。
63
+ *
64
+ * @default 2
65
+ */
66
+ precision: {
67
+ type: (NumberConstructor | StringConstructor)[];
68
+ default: number;
69
+ };
70
+ /**
71
+ * 输入值格式化函数,在内置 number/decimal 处理之后执行。
72
+ *
73
+ * value 为当前输入值,preValue 为上一次 modelValue。
74
+ */
75
+ formatter: import('vue').PropType<(value: string, preValue: string) => string>;
76
+ /**
77
+ * 原生 id 属性。未传入时会自动生成一个 id。
78
+ */
79
+ id: StringConstructor;
80
+ /**
81
+ * 原生 name 属性。
82
+ */
83
+ name: StringConstructor;
84
+ /**
85
+ * 原生 readonly 属性。
86
+ */
87
+ readonly: BooleanConstructor;
88
+ /**
89
+ * 原生 inputmode 属性。
90
+ *
91
+ * 当 type 为 number 或 decimal 时,组件会自动设置更适合移动端的键盘类型。
92
+ */
93
+ inputmode: import('vue').PropType<"search" | "text" | "email" | "tel" | "url" | "decimal" | "none" | "numeric" | undefined>;
94
+ };
95
+ export type VroInputProps = ExtractPropTypes<typeof vroInputProps>;
@@ -1,8 +1,7 @@
1
- import type { ExtractPropTypes, HTMLAttributes, InputTypeHTMLAttribute } from 'vue'
2
-
3
- import { definePropType } from '../utils'
4
-
5
- export const vroInputProps = {
1
+ import "@daysnap/utils";
2
+ import "vue";
3
+ import { definePropType as e } from "../utils/props.js";
4
+ const o = {
6
5
  /**
7
6
  * 输入框类型。
8
7
  *
@@ -13,18 +12,16 @@ export const vroInputProps = {
13
12
  * @default text
14
13
  */
15
14
  type: {
16
- type: definePropType<InputTypeHTMLAttribute | 'decimal'>(String),
17
- default: 'text',
15
+ type: e(String),
16
+ default: "text"
18
17
  },
19
-
20
18
  /**
21
19
  * 输入框绑定值。
22
20
  */
23
21
  modelValue: {
24
- type: definePropType<string | number | null | undefined>([String, Number]),
25
- default: '',
22
+ type: e([String, Number]),
23
+ default: ""
26
24
  },
27
-
28
25
  /**
29
26
  * 最大值,仅当 type 为 decimal 时作为输入值上限使用。
30
27
  *
@@ -32,9 +29,8 @@ export const vroInputProps = {
32
29
  */
33
30
  max: {
34
31
  type: [String, Number],
35
- default: Number.MAX_SAFE_INTEGER,
32
+ default: Number.MAX_SAFE_INTEGER
36
33
  },
37
-
38
34
  /**
39
35
  * 最小值,仅当 type 为 decimal 时作为输入值下限使用。
40
36
  *
@@ -42,9 +38,8 @@ export const vroInputProps = {
42
38
  */
43
39
  min: {
44
40
  type: [String, Number],
45
- default: Number.MIN_SAFE_INTEGER,
41
+ default: Number.MIN_SAFE_INTEGER
46
42
  },
47
-
48
43
  /**
49
44
  * 输入值超出 min/max 后是否自动修正到边界值,仅当 type 为 decimal 时有效。
50
45
  *
@@ -53,22 +48,18 @@ export const vroInputProps = {
53
48
  * @default false
54
49
  */
55
50
  autoFix: Boolean,
56
-
57
51
  /**
58
52
  * 原生 maxlength 属性。
59
53
  */
60
54
  maxlength: [String, Number],
61
-
62
55
  /**
63
56
  * 原生 placeholder 属性。
64
57
  */
65
58
  placeholder: String,
66
-
67
59
  /**
68
60
  * 原生 disabled 属性。
69
61
  */
70
62
  disabled: Boolean,
71
-
72
63
  /**
73
64
  * 小数精度,仅当 type 为 decimal 时有效。
74
65
  *
@@ -76,37 +67,33 @@ export const vroInputProps = {
76
67
  */
77
68
  precision: {
78
69
  type: [String, Number],
79
- default: 2,
70
+ default: 2
80
71
  },
81
-
82
72
  /**
83
73
  * 输入值格式化函数,在内置 number/decimal 处理之后执行。
84
74
  *
85
75
  * value 为当前输入值,preValue 为上一次 modelValue。
86
76
  */
87
- formatter: definePropType<(value: string, preValue: string) => string>(Function),
88
-
77
+ formatter: e(Function),
89
78
  /**
90
79
  * 原生 id 属性。未传入时会自动生成一个 id。
91
80
  */
92
81
  id: String,
93
-
94
82
  /**
95
83
  * 原生 name 属性。
96
84
  */
97
85
  name: String,
98
-
99
86
  /**
100
87
  * 原生 readonly 属性。
101
88
  */
102
89
  readonly: Boolean,
103
-
104
90
  /**
105
91
  * 原生 inputmode 属性。
106
92
  *
107
93
  * 当 type 为 number 或 decimal 时,组件会自动设置更适合移动端的键盘类型。
108
94
  */
109
- inputmode: definePropType<HTMLAttributes['inputmode']>(String),
110
- }
111
-
112
- export type VroInputProps = ExtractPropTypes<typeof vroInputProps>
95
+ inputmode: e(String)
96
+ };
97
+ export {
98
+ o as vroInputProps
99
+ };
@@ -0,0 +1,83 @@
1
+ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
2
+ type: {
3
+ type: import('vue').PropType<import('vue').InputTypeHTMLAttribute | "decimal">;
4
+ default: string;
5
+ };
6
+ modelValue: {
7
+ type: import('vue').PropType<string | number | null | undefined>;
8
+ default: string;
9
+ };
10
+ max: {
11
+ type: (NumberConstructor | StringConstructor)[];
12
+ default: number;
13
+ };
14
+ min: {
15
+ type: (NumberConstructor | StringConstructor)[];
16
+ default: number;
17
+ };
18
+ autoFix: BooleanConstructor;
19
+ maxlength: (NumberConstructor | StringConstructor)[];
20
+ placeholder: StringConstructor;
21
+ disabled: BooleanConstructor;
22
+ precision: {
23
+ type: (NumberConstructor | StringConstructor)[];
24
+ default: number;
25
+ };
26
+ formatter: import('vue').PropType<(value: string, preValue: string) => string>;
27
+ id: StringConstructor;
28
+ name: StringConstructor;
29
+ readonly: BooleanConstructor;
30
+ inputmode: import('vue').PropType<"search" | "text" | "email" | "tel" | "url" | "decimal" | "none" | "numeric" | undefined>;
31
+ }>, {
32
+ input: HTMLInputElement;
33
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
34
+ input: (value: InputEvent) => any;
35
+ blur: (value: FocusEvent) => any;
36
+ "update:modelValue": (value: string) => any;
37
+ }, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
38
+ type: {
39
+ type: import('vue').PropType<import('vue').InputTypeHTMLAttribute | "decimal">;
40
+ default: string;
41
+ };
42
+ modelValue: {
43
+ type: import('vue').PropType<string | number | null | undefined>;
44
+ default: string;
45
+ };
46
+ max: {
47
+ type: (NumberConstructor | StringConstructor)[];
48
+ default: number;
49
+ };
50
+ min: {
51
+ type: (NumberConstructor | StringConstructor)[];
52
+ default: number;
53
+ };
54
+ autoFix: BooleanConstructor;
55
+ maxlength: (NumberConstructor | StringConstructor)[];
56
+ placeholder: StringConstructor;
57
+ disabled: BooleanConstructor;
58
+ precision: {
59
+ type: (NumberConstructor | StringConstructor)[];
60
+ default: number;
61
+ };
62
+ formatter: import('vue').PropType<(value: string, preValue: string) => string>;
63
+ id: StringConstructor;
64
+ name: StringConstructor;
65
+ readonly: BooleanConstructor;
66
+ inputmode: import('vue').PropType<"search" | "text" | "email" | "tel" | "url" | "decimal" | "none" | "numeric" | undefined>;
67
+ }>> & Readonly<{
68
+ onInput?: ((value: InputEvent) => any) | undefined;
69
+ onBlur?: ((value: FocusEvent) => any) | undefined;
70
+ "onUpdate:modelValue"?: ((value: string) => any) | undefined;
71
+ }>, {
72
+ precision: string | number;
73
+ type: import('vue').InputTypeHTMLAttribute | "decimal";
74
+ disabled: boolean;
75
+ modelValue: string | number | null | undefined;
76
+ max: string | number;
77
+ min: string | number;
78
+ autoFix: boolean;
79
+ readonly: boolean;
80
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {
81
+ inputRef: HTMLInputElement;
82
+ }, HTMLInputElement>;
83
+ export default _default;
@@ -0,0 +1,62 @@
1
+ import { defineComponent as k, ref as B, computed as _, createElementBlock as F, openBlock as P, mergeProps as E, unref as a } from "vue";
2
+ import { omit as R, isNumber as w } from "@daysnap/utils";
3
+ import { useId as D, useComposition as W } from "@vrojs/use";
4
+ import { parseNumberString as j, parseDecimalString as q } from "../utils/format.js";
5
+ import { vroInputProps as z } from "./types.js";
6
+ const A = ["value"], O = /* @__PURE__ */ k({
7
+ name: "VroInput",
8
+ __name: "vro-input",
9
+ props: z,
10
+ emits: ["update:modelValue", "blur", "input"],
11
+ setup(N, { expose: V, emit: x }) {
12
+ const m = N, r = x, p = B(), C = D(), S = _(() => {
13
+ let { type: o, inputmode: e, ...n } = m;
14
+ return o === "decimal" ? (o = "text", e = "decimal") : o === "number" && (o = "tel", e = "numeric"), {
15
+ ...R(n, ["autoFix", "formatter", "modelValue", "precision", "max", "min"]),
16
+ id: m.id ?? C,
17
+ type: o,
18
+ inputmode: e
19
+ };
20
+ }), { handleCompositionStart: d, handleCompositionEnd: c } = W(), I = (o) => {
21
+ const { type: e, modelValue: n } = m;
22
+ if (e === "decimal") {
23
+ const i = n?.toString() ?? "";
24
+ i === "-" ? r("update:modelValue", "") : i.endsWith(".") ? r("update:modelValue", i.substring(0, i.length - 1)) : i !== "" && +i == 0 && r("update:modelValue", "0");
25
+ }
26
+ r("blur", o);
27
+ }, y = (o) => {
28
+ const e = o.target;
29
+ if (e?.composing)
30
+ return;
31
+ const { type: n, precision: i, min: s, max: f, formatter: b, modelValue: l, autoFix: h } = m;
32
+ let t = e.value;
33
+ if (n === "number")
34
+ t = j(t);
35
+ else if (n === "decimal") {
36
+ t = q(t, { precision: +i, allowNegativeNumber: +s < 0 });
37
+ const u = Number(t), g = Number(s), v = Number(f);
38
+ t !== "" && t !== "-" && Number.isFinite(u) && (u < g || u > v) && (h ? u < g ? t = s.toString() : u > v && (t = f.toString()) : t = l?.toString() ?? "");
39
+ }
40
+ b && (t = b(t, w(l) ? l.toString() : l ?? "")), e.value !== t && (e.value = t), r("update:modelValue", t), r("input", o);
41
+ };
42
+ return V({
43
+ get input() {
44
+ return p.value;
45
+ }
46
+ }), (o, e) => (P(), F("input", E(S.value, {
47
+ class: "vro-input",
48
+ ref_key: "inputRef",
49
+ ref: p,
50
+ value: o.modelValue ?? "",
51
+ onCompositionstart: e[0] || (e[0] = //@ts-ignore
52
+ (...n) => a(d) && a(d)(...n)),
53
+ onCompositionend: e[1] || (e[1] = //@ts-ignore
54
+ (...n) => a(c) && a(c)(...n)),
55
+ onInput: y,
56
+ onBlur: I
57
+ }), null, 16, A));
58
+ }
59
+ });
60
+ export {
61
+ O as default
62
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./vro-input.vue.js";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,91 @@
1
+ export * from './types';
2
+ export declare const VroLoading: import('..').WithInstall<{
3
+ new (...args: any[]): import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('vue').ExtractPropTypes<{
4
+ type: {
5
+ type: import('vue').PropType<import('./types').VroLoadingType>;
6
+ default: string;
7
+ };
8
+ size: {
9
+ type: import('vue').PropType<string | number>;
10
+ default: number;
11
+ };
12
+ color: {
13
+ type: StringConstructor;
14
+ default: string;
15
+ };
16
+ ariaLabel: {
17
+ type: StringConstructor;
18
+ default: string;
19
+ };
20
+ }>> & Readonly<{}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, import('vue').PublicProps, {
21
+ size: string | number;
22
+ type: import('./types').VroLoadingType;
23
+ ariaLabel: string;
24
+ color: string;
25
+ }, true, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, HTMLDivElement, import('vue').ComponentProvideOptions, {
26
+ P: {};
27
+ B: {};
28
+ D: {};
29
+ C: {};
30
+ M: {};
31
+ Defaults: {};
32
+ }, Readonly<import('vue').ExtractPropTypes<{
33
+ type: {
34
+ type: import('vue').PropType<import('./types').VroLoadingType>;
35
+ default: string;
36
+ };
37
+ size: {
38
+ type: import('vue').PropType<string | number>;
39
+ default: number;
40
+ };
41
+ color: {
42
+ type: StringConstructor;
43
+ default: string;
44
+ };
45
+ ariaLabel: {
46
+ type: StringConstructor;
47
+ default: string;
48
+ };
49
+ }>> & Readonly<{}>, {}, {}, {}, {}, {
50
+ size: string | number;
51
+ type: import('./types').VroLoadingType;
52
+ ariaLabel: string;
53
+ color: string;
54
+ }>;
55
+ __isFragment?: never;
56
+ __isTeleport?: never;
57
+ __isSuspense?: never;
58
+ } & import('vue').ComponentOptionsBase<Readonly<import('vue').ExtractPropTypes<{
59
+ type: {
60
+ type: import('vue').PropType<import('./types').VroLoadingType>;
61
+ default: string;
62
+ };
63
+ size: {
64
+ type: import('vue').PropType<string | number>;
65
+ default: number;
66
+ };
67
+ color: {
68
+ type: StringConstructor;
69
+ default: string;
70
+ };
71
+ ariaLabel: {
72
+ type: StringConstructor;
73
+ default: string;
74
+ };
75
+ }>> & Readonly<{}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, {
76
+ size: string | number;
77
+ type: import('./types').VroLoadingType;
78
+ ariaLabel: string;
79
+ color: string;
80
+ }, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & (new () => {
81
+ $slots: {
82
+ icon?(_: {}): any;
83
+ };
84
+ })>;
85
+ export default VroLoading;
86
+ export type VroLoadingInstance = InstanceType<typeof VroLoading>;
87
+ declare module 'vue' {
88
+ interface GlobalComponents {
89
+ VroLoading: typeof VroLoading;
90
+ }
91
+ }
@@ -0,0 +1,11 @@
1
+ import "@daysnap/utils";
2
+ import "vue";
3
+ import { withInstall as o } from "../utils/withInstall.js";
4
+ import r from "./vro-loading.vue.js";
5
+ import { vroLoadingProps as s } from "./types.js";
6
+ const a = o(r);
7
+ export {
8
+ a as VroLoading,
9
+ a as default,
10
+ s as vroLoadingProps
11
+ };
File without changes
@@ -0,0 +1,4 @@
1
+ import '../../style/base.css';
2
+ import './index.css';
3
+ /* empty css */
4
+ /* empty css */
@@ -0,0 +1 @@
1
+ .vro-loading{--vro-loading-size: 32px;--vro-loading-color: currentColor;display:inline-flex;align-items:center;justify-content:center;color:var(--vro-loading-color);line-height:1;vertical-align:middle}.vro-loading__circular{width:var(--vro-loading-size);height:var(--vro-loading-size);animation:vro-loading-rotate 1.6s linear infinite}.vro-loading__circular circle{stroke:currentColor;stroke-width:4;stroke-linecap:round;stroke-dasharray:90,150;stroke-dashoffset:0;animation:vro-loading-circular 1.6s ease-in-out infinite}.vro-loading__spinner{position:relative;width:var(--vro-loading-size);height:var(--vro-loading-size);animation:vro-loading-fade 1.2s linear infinite}.vro-loading__spinner i{position:absolute;left:50%;top:0;width:2px;height:28%;background:currentColor;border-radius:999px;transform-origin:center calc(var(--vro-loading-size) / 2)}.vro-loading__spinner i:nth-child(1){opacity:calc(1 / 12);transform:translate(-50%) rotate(0)}.vro-loading__spinner i:nth-child(2){opacity:calc(2 / 12);transform:translate(-50%) rotate(30deg)}.vro-loading__spinner i:nth-child(3){opacity:.25;transform:translate(-50%) rotate(60deg)}.vro-loading__spinner i:nth-child(4){opacity:calc(4 / 12);transform:translate(-50%) rotate(90deg)}.vro-loading__spinner i:nth-child(5){opacity:calc(5 / 12);transform:translate(-50%) rotate(120deg)}.vro-loading__spinner i:nth-child(6){opacity:.5;transform:translate(-50%) rotate(150deg)}.vro-loading__spinner i:nth-child(7){opacity:calc(7 / 12);transform:translate(-50%) rotate(180deg)}.vro-loading__spinner i:nth-child(8){opacity:calc(8 / 12);transform:translate(-50%) rotate(210deg)}.vro-loading__spinner i:nth-child(9){opacity:.75;transform:translate(-50%) rotate(240deg)}.vro-loading__spinner i:nth-child(10){opacity:calc(10 / 12);transform:translate(-50%) rotate(270deg)}.vro-loading__spinner i:nth-child(11){opacity:calc(11 / 12);transform:translate(-50%) rotate(300deg)}.vro-loading__spinner i:nth-child(12){opacity:1;transform:translate(-50%) rotate(330deg)}.vro-loading__dots{display:inline-flex;align-items:center;justify-content:center;gap:calc(var(--vro-loading-size) * .12);width:var(--vro-loading-size);height:var(--vro-loading-size)}.vro-loading__dots i{width:calc(var(--vro-loading-size) * .18);height:calc(var(--vro-loading-size) * .18);background:currentColor;border-radius:50%;animation:vro-loading-dot 1s ease-in-out infinite}.vro-loading__dots i:nth-child(2){animation-delay:.15s}.vro-loading__dots i:nth-child(3){animation-delay:.3s}@keyframes vro-loading-rotate{to{transform:rotate(360deg)}}@keyframes vro-loading-circular{0%{stroke-dasharray:1,200;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-40}to{stroke-dasharray:90,150;stroke-dashoffset:-120}}@keyframes vro-loading-fade{to{transform:rotate(360deg)}}@keyframes vro-loading-dot{0%,80%,to{opacity:.35;transform:scale(.72)}40%{opacity:1;transform:scale(1)}}
File without changes
@@ -0,0 +1,4 @@
1
+ import '../../style/base.css';
2
+ import './index.css';
3
+ /* empty css */
4
+ /* empty css */
@@ -0,0 +1,33 @@
1
+ import { ExtractPropTypes, PropType } from 'vue';
2
+ export type VroLoadingType = 'circular' | 'spinner' | 'dots';
3
+ export declare const vroLoadingProps: {
4
+ /**
5
+ * 加载图标类型。
6
+ */
7
+ type: {
8
+ type: PropType<VroLoadingType>;
9
+ default: string;
10
+ };
11
+ /**
12
+ * 加载图标尺寸,传入数字时单位为 px。
13
+ */
14
+ size: {
15
+ type: PropType<string | number>;
16
+ default: number;
17
+ };
18
+ /**
19
+ * 加载图标颜色。
20
+ */
21
+ color: {
22
+ type: StringConstructor;
23
+ default: string;
24
+ };
25
+ /**
26
+ * 无障碍标签。
27
+ */
28
+ ariaLabel: {
29
+ type: StringConstructor;
30
+ default: string;
31
+ };
32
+ };
33
+ export type VroLoadingProps = ExtractPropTypes<typeof vroLoadingProps>;
@@ -0,0 +1,33 @@
1
+ const t = {
2
+ /**
3
+ * 加载图标类型。
4
+ */
5
+ type: {
6
+ type: String,
7
+ default: "circular"
8
+ },
9
+ /**
10
+ * 加载图标尺寸,传入数字时单位为 px。
11
+ */
12
+ size: {
13
+ type: [String, Number],
14
+ default: 24
15
+ },
16
+ /**
17
+ * 加载图标颜色。
18
+ */
19
+ color: {
20
+ type: String,
21
+ default: "currentColor"
22
+ },
23
+ /**
24
+ * 无障碍标签。
25
+ */
26
+ ariaLabel: {
27
+ type: String,
28
+ default: "加载中"
29
+ }
30
+ };
31
+ export {
32
+ t as vroLoadingProps
33
+ };
@@ -0,0 +1,56 @@
1
+ declare function __VLS_template(): {
2
+ attrs: Partial<{}>;
3
+ slots: {
4
+ icon?(_: {}): any;
5
+ };
6
+ refs: {};
7
+ rootEl: HTMLDivElement;
8
+ };
9
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
10
+ declare const __VLS_component: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
11
+ type: {
12
+ type: import('vue').PropType<import('./types').VroLoadingType>;
13
+ default: string;
14
+ };
15
+ size: {
16
+ type: import('vue').PropType<string | number>;
17
+ default: number;
18
+ };
19
+ color: {
20
+ type: StringConstructor;
21
+ default: string;
22
+ };
23
+ ariaLabel: {
24
+ type: StringConstructor;
25
+ default: string;
26
+ };
27
+ }>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
28
+ type: {
29
+ type: import('vue').PropType<import('./types').VroLoadingType>;
30
+ default: string;
31
+ };
32
+ size: {
33
+ type: import('vue').PropType<string | number>;
34
+ default: number;
35
+ };
36
+ color: {
37
+ type: StringConstructor;
38
+ default: string;
39
+ };
40
+ ariaLabel: {
41
+ type: StringConstructor;
42
+ default: string;
43
+ };
44
+ }>> & Readonly<{}>, {
45
+ size: string | number;
46
+ type: import('./types').VroLoadingType;
47
+ ariaLabel: string;
48
+ color: string;
49
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
50
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
51
+ export default _default;
52
+ type __VLS_WithTemplateSlots<T, S> = T & {
53
+ new (): {
54
+ $slots: S;
55
+ };
56
+ };
@@ -0,0 +1,50 @@
1
+ import { defineComponent as u, computed as m, createElementBlock as o, openBlock as r, normalizeStyle as _, renderSlot as g, Fragment as s, renderList as l, createElementVNode as i } from "vue";
2
+ import { vroLoadingProps as y } from "./types.js";
3
+ const v = ["aria-label"], f = {
4
+ key: 0,
5
+ class: "vro-loading__spinner",
6
+ "aria-hidden": "true"
7
+ }, k = {
8
+ key: 1,
9
+ class: "vro-loading__dots",
10
+ "aria-hidden": "true"
11
+ }, h = {
12
+ key: 2,
13
+ class: "vro-loading__circular",
14
+ viewBox: "0 0 50 50",
15
+ "aria-hidden": "true"
16
+ }, z = /* @__PURE__ */ u({
17
+ name: "VroLoading",
18
+ __name: "vro-loading",
19
+ props: y,
20
+ setup(d) {
21
+ const t = d, c = (e) => typeof e == "number" ? `${e}px` : e || void 0, p = m(() => ({
22
+ "--vro-loading-size": c(t.size),
23
+ "--vro-loading-color": t.color
24
+ }));
25
+ return (e, a) => (r(), o("div", {
26
+ class: "vro-loading",
27
+ style: _(p.value),
28
+ role: "status",
29
+ "aria-label": e.ariaLabel
30
+ }, [
31
+ g(e.$slots, "icon", {}, () => [
32
+ e.type === "spinner" ? (r(), o("span", f, [
33
+ (r(), o(s, null, l(12, (n) => i("i", { key: n })), 64))
34
+ ])) : e.type === "dots" ? (r(), o("span", k, [
35
+ (r(), o(s, null, l(3, (n) => i("i", { key: n })), 64))
36
+ ])) : (r(), o("svg", h, [...a[0] || (a[0] = [
37
+ i("circle", {
38
+ cx: "25",
39
+ cy: "25",
40
+ r: "20",
41
+ fill: "none"
42
+ }, null, -1)
43
+ ])]))
44
+ ])
45
+ ], 12, v));
46
+ }
47
+ });
48
+ export {
49
+ z as default
50
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./vro-loading.vue.js";
2
+ export {
3
+ f as default
4
+ };