@vrojs/base 0.0.6 → 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/index.d.ts CHANGED
@@ -5,4 +5,5 @@ export * from './vro-circle-progress';
5
5
  export * from './vro-icon';
6
6
  export * from './vro-input';
7
7
  export * from './vro-loading';
8
+ export * from './vro-safe-area';
8
9
  export * from './vro-vnr';
package/dist/index.js CHANGED
@@ -1,45 +1,51 @@
1
1
  import { addUnit as e } from "./utils/addUnit.js";
2
- import { ComponentManager as p } from "./utils/ComponentManager.js";
3
- import { parseDecimalString as n, parseNumberString as f } from "./utils/format.js";
2
+ import { ComponentManager as t } from "./utils/ComponentManager.js";
3
+ import { parseDecimalString as f, parseNumberString as n } from "./utils/format.js";
4
4
  import { getSlotEntries as s } from "./utils/getSlotEntries.js";
5
5
  import { mountComponent as i } from "./utils/mountComponent.js";
6
- import { parseType as P } from "./utils/parseType.js";
6
+ import { parseType as V } from "./utils/parseType.js";
7
7
  import { renderComponent as c } from "./utils/renderComponent.js";
8
8
  import { showComponent as v } from "./utils/showComponent.js";
9
9
  import { withInstall as d } from "./utils/withInstall.js";
10
- import { VroAspectRatio as u } from "./vro-aspect-ratio/index.js";
11
- import { VroCircleProgress as h } from "./vro-circle-progress/index.js";
12
- import { VroIcon as A } from "./vro-icon/index.js";
10
+ import { VroAspectRatio as I } from "./vro-aspect-ratio/index.js";
11
+ import { VroCircleProgress as A } from "./vro-circle-progress/index.js";
12
+ import { VroIcon as w } from "./vro-icon/index.js";
13
13
  import { VroInput as R } from "./vro-input/index.js";
14
14
  import { VroLoading as y } from "./vro-loading/index.js";
15
- import { VroVnr as E } from "./vro-vnr/index.js";
16
- import { vroAspectRatioProps as N } from "./vro-aspect-ratio/types.js";
17
- import { vroCircleProgressProps as U } from "./vro-circle-progress/types.js";
18
- import { vroIconProps as k } from "./vro-icon/types.js";
19
- import { vroInputProps as z } from "./vro-input/types.js";
20
- import { vroLoadingProps as F } from "./vro-loading/types.js";
21
- import { vroVnrProps as H } from "./vro-vnr/types.js";
15
+ import { VroSafeArea as E } from "./vro-safe-area/index.js";
16
+ import { VroVnr as N } from "./vro-vnr/index.js";
17
+ import { vroAspectRatioProps as U } from "./vro-aspect-ratio/types.js";
18
+ import { vroCircleProgressProps as k } from "./vro-circle-progress/types.js";
19
+ import { useVroCircleProgress as z } from "./vro-circle-progress/useVroCircleProgress.js";
20
+ import { vroIconProps as F } from "./vro-icon/types.js";
21
+ import { vroInputProps as H } from "./vro-input/types.js";
22
+ import { vroLoadingProps as K } from "./vro-loading/types.js";
23
+ import { vroSafeAreaProps as Q } from "./vro-safe-area/types.js";
24
+ import { vroVnrProps as X } from "./vro-vnr/types.js";
22
25
  export {
23
- p as ComponentManager,
24
- u as VroAspectRatio,
25
- h as VroCircleProgress,
26
- A as VroIcon,
26
+ t as ComponentManager,
27
+ I as VroAspectRatio,
28
+ A as VroCircleProgress,
29
+ w as VroIcon,
27
30
  R as VroInput,
28
31
  y as VroLoading,
29
- E as VroVnr,
32
+ E as VroSafeArea,
33
+ N as VroVnr,
30
34
  e as addUnit,
31
35
  s as getSlotEntries,
32
36
  i as mountComponent,
33
- n as parseDecimalString,
34
- f as parseNumberString,
35
- P as parseType,
37
+ f as parseDecimalString,
38
+ n as parseNumberString,
39
+ V as parseType,
36
40
  c as renderComponent,
37
41
  v as showComponent,
38
- N as vroAspectRatioProps,
39
- U as vroCircleProgressProps,
40
- k as vroIconProps,
41
- z as vroInputProps,
42
- F as vroLoadingProps,
43
- H as vroVnrProps,
42
+ z as useVroCircleProgress,
43
+ U as vroAspectRatioProps,
44
+ k as vroCircleProgressProps,
45
+ F as vroIconProps,
46
+ H as vroInputProps,
47
+ K as vroLoadingProps,
48
+ Q as vroSafeAreaProps,
49
+ X as vroVnrProps,
44
50
  d as withInstall
45
51
  };
@@ -1 +1 @@
1
- @charset "UTF-8";.vro-aspect-ratio{position:relative}.vro-aspect-ratio-inner{position:relative;width:100%}.vro-aspect-ratio-content{position:absolute;top:0;left:0;width:100%;height:100%}:root,:host{--vro-circle-progress-size: 100px;--vro-circle-progress-color: currentColor;--vro-circle-progress-background-color: rgba(0, 0, 0, .08);--vro-circle-progress-duration: .3s;--vro-circle-progress-curve: ease;--vro-circle-progress-content-color: currentColor;--vro-circle-progress-content-font-size: 16px}.vro-circle-progress{position:relative;display:inline-flex;align-items:center;justify-content:center;width:var(--size);height:var(--size);color:var(--vro-circle-progress-content-color);font-size:var(--vro-circle-progress-content-font-size);line-height:1;vertical-align:middle}.vro-circle-progress-svg{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}.vro-circle-progress-track{stroke:var(--background-color)}.vro-circle-progress-line{stroke:var(--color);transition:stroke-dashoffset var(--duration) var(--curve),stroke var(--duration) var(--curve);transform:rotate(-90deg);transform-origin:50% 50%}:root,:host{--vro-icon-duration: 2s;--vro-icon-size: inherit;--vro-icon-color: inherit}.vro-icon{display:inline-flex;justify-content:center;align-items:center;position:relative;fill:currentColor;line-height:1em;font-size:var(--size);color:var(--color);text-rendering:auto;-webkit-font-smoothing:antialiased}.vro-icon img{display:block;width:1em;height:1em;object-fit:contain}.vro-icon svg{height:1em;width:1em;fill:currentColor;stroke:currentColor}.vro-icon.is-loading{animation:rotating var(--duration) linear infinite}@keyframes rotating{0%{transform:rotate(0)}to{transform:rotate(360deg)}}:root,:host{--vro-loading-size: 24px;--vro-loading-color: currentColor;--vro-loading-circular-duration: 1.6s;--vro-loading-spinner-duration: 1.2s;--vro-loading-dots-duration: 1s;--vro-loading-image-duration: 1.2s}.vro-loading{display:inline-flex;align-items:center;justify-content:center;color:var(--color);line-height:1;vertical-align:middle}.vro-loading-circular{width:var(--size);height:var(--size);animation:vro-loading-rotate var(--duration) 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 var(--duration) ease-in-out infinite}.vro-loading-spinner{width:var(--size);height:var(--size);animation:vro-loading-fade var(--duration) linear infinite}.vro-loading-dots{display:inline-flex;align-items:center;justify-content:center;gap:calc(var(--size) * .12);width:var(--size);height:var(--size)}.vro-loading-dots i{width:calc(var(--size) * .18);height:calc(var(--size) * .18);background:currentColor;border-radius:50%;animation:vro-loading-dot var(--duration) ease-in-out infinite}.vro-loading-dots i:nth-child(2){animation-delay:.15s}.vro-loading-dots i:nth-child(3){animation-delay:.3s}.vro-loading-image{display:grid;grid-template-columns:repeat(2,1fr);grid-template-rows:repeat(2,1fr);gap:max(1px,var(--size) * .14);width:var(--size);height:var(--size)}.vro-loading-image i{background:currentColor;opacity:.16}.vro-loading-image i:nth-child(1){animation:vro-loading-image-1 var(--duration) linear infinite}.vro-loading-image i:nth-child(2){animation:vro-loading-image-2 var(--duration) linear infinite}.vro-loading-image i:nth-child(3){animation:vro-loading-image-4 var(--duration) linear infinite}.vro-loading-image i:nth-child(4){animation:vro-loading-image-3 var(--duration) linear infinite}@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)}}@keyframes vro-loading-image-1{0%,12.5%,to{opacity:.86}25%,87.5%{opacity:.16}}@keyframes vro-loading-image-2{0%,to{opacity:.16}12.5%,37.5%{opacity:.86}50%{opacity:.16}}@keyframes vro-loading-image-3{0%,25%,to{opacity:.16}37.5%,62.5%{opacity:.86}75%{opacity:.16}}@keyframes vro-loading-image-4{0%,50%,to{opacity:.16}62.5%,87.5%{opacity:.86}}
1
+ @charset "UTF-8";.vro-aspect-ratio{position:relative}.vro-aspect-ratio-inner{position:relative;width:100%}.vro-aspect-ratio-content{position:absolute;top:0;left:0;width:100%;height:100%}:root,:host{--vro-circle-progress-size: 100px;--vro-circle-progress-color: currentColor;--vro-circle-progress-background-color: rgba(0, 0, 0, .08);--vro-circle-progress-duration: .3s;--vro-circle-progress-curve: ease;--vro-circle-progress-content-color: currentColor;--vro-circle-progress-content-font-size: 16px}.vro-circle-progress{position:relative;display:inline-flex;align-items:center;justify-content:center;width:var(--size);height:var(--size);color:var(--vro-circle-progress-content-color);font-size:var(--vro-circle-progress-content-font-size);line-height:1;vertical-align:middle}.vro-circle-progress-svg{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}.vro-circle-progress-track{stroke:var(--background-color)}.vro-circle-progress-line{stroke:var(--color);transition:stroke-dashoffset var(--duration) var(--curve);transform:rotate(-90deg);transform-origin:50% 50%}:root,:host{--vro-icon-duration: 2s;--vro-icon-size: inherit;--vro-icon-color: inherit}.vro-icon{display:inline-flex;justify-content:center;align-items:center;position:relative;fill:currentColor;line-height:1em;font-size:var(--size);color:var(--color);text-rendering:auto;-webkit-font-smoothing:antialiased}.vro-icon img{display:block;width:1em;height:1em;object-fit:contain}.vro-icon svg{height:1em;width:1em;fill:currentColor;stroke:currentColor}.vro-icon.is-loading{animation:rotating var(--duration) linear infinite}@keyframes rotating{0%{transform:rotate(0)}to{transform:rotate(360deg)}}:root,:host{--vro-loading-size: 24px;--vro-loading-color: currentColor;--vro-loading-circular-duration: 1.6s;--vro-loading-spinner-duration: 1.2s;--vro-loading-dots-duration: 1s;--vro-loading-image-duration: 1.2s}.vro-loading{display:inline-flex;align-items:center;justify-content:center;color:var(--color);line-height:1;vertical-align:middle}.vro-loading-circular{width:var(--size);height:var(--size);animation:vro-loading-rotate var(--duration) 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 var(--duration) ease-in-out infinite}.vro-loading-spinner{width:var(--size);height:var(--size);animation:vro-loading-fade var(--duration) linear infinite}.vro-loading-dots{display:inline-flex;align-items:center;justify-content:center;gap:calc(var(--size) * .12);width:var(--size);height:var(--size)}.vro-loading-dots i{width:calc(var(--size) * .18);height:calc(var(--size) * .18);background:currentColor;border-radius:50%;animation:vro-loading-dot var(--duration) ease-in-out infinite}.vro-loading-dots i:nth-child(2){animation-delay:.15s}.vro-loading-dots i:nth-child(3){animation-delay:.3s}.vro-loading-image{display:grid;grid-template-columns:repeat(2,1fr);grid-template-rows:repeat(2,1fr);gap:max(1px,var(--size) * .14);width:var(--size);height:var(--size)}.vro-loading-image i{background:currentColor;opacity:.16}.vro-loading-image i:nth-child(1){animation:vro-loading-image-1 var(--duration) linear infinite}.vro-loading-image i:nth-child(2){animation:vro-loading-image-2 var(--duration) linear infinite}.vro-loading-image i:nth-child(3){animation:vro-loading-image-4 var(--duration) linear infinite}.vro-loading-image i:nth-child(4){animation:vro-loading-image-3 var(--duration) linear infinite}@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)}}@keyframes vro-loading-image-1{0%,12.5%,to{opacity:.86}25%,87.5%{opacity:.16}}@keyframes vro-loading-image-2{0%,to{opacity:.16}12.5%,37.5%{opacity:.86}50%{opacity:.16}}@keyframes vro-loading-image-3{0%,25%,to{opacity:.16}37.5%,62.5%{opacity:.86}75%{opacity:.16}}@keyframes vro-loading-image-4{0%,50%,to{opacity:.16}62.5%,87.5%{opacity:.86}}.vro-safe-area{--vro-safe-area-padding-top: 0px;--vro-safe-area-padding-right: 0px;--vro-safe-area-padding-bottom: 0px;--vro-safe-area-padding-left: 0px;box-sizing:border-box;padding:var(--vro-safe-area-padding-top) var(--vro-safe-area-padding-right) var(--vro-safe-area-padding-bottom) var(--vro-safe-area-padding-left)}.vro-safe-area.is-top{padding-top:calc(var(--vro-safe-area-padding-top) + constant(safe-area-inset-top));padding-top:calc(var(--vro-safe-area-padding-top) + env(safe-area-inset-top))}.vro-safe-area.is-bottom{padding-bottom:calc(var(--vro-safe-area-padding-bottom) + constant(safe-area-inset-bottom));padding-bottom:calc(var(--vro-safe-area-padding-bottom) + env(safe-area-inset-bottom))}.vro-safe-area.is-left{padding-left:calc(var(--vro-safe-area-padding-left) + constant(safe-area-inset-left));padding-left:calc(var(--vro-safe-area-padding-left) + env(safe-area-inset-left))}.vro-safe-area.is-right{padding-right:calc(var(--vro-safe-area-padding-right) + constant(safe-area-inset-right));padding-right:calc(var(--vro-safe-area-padding-right) + env(safe-area-inset-right))}
@@ -1,4 +1,5 @@
1
1
  export * from './types';
2
+ export * from './useVroCircleProgress';
2
3
  export declare const VroCircleProgress: import('..').WithInstall<{
3
4
  new (...args: any[]): import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('vue').ExtractPropTypes<{
4
5
  modelValue: {
@@ -10,7 +11,7 @@ export declare const VroCircleProgress: import('..').WithInstall<{
10
11
  default: number;
11
12
  };
12
13
  strokeWidth: {
13
- type: NumberConstructor;
14
+ type: import('vue').PropType<string | number>;
14
15
  default: number;
15
16
  };
16
17
  strokeLinecap: {
@@ -24,10 +25,14 @@ export declare const VroCircleProgress: import('..').WithInstall<{
24
25
  color: StringConstructor;
25
26
  backgroundColor: StringConstructor;
26
27
  curve: StringConstructor;
27
- }>> & Readonly<{}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, import('vue').PublicProps, {
28
+ }>> & Readonly<{
29
+ onFinish?: ((value: number) => any) | undefined;
30
+ }>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
31
+ finish: (value: number) => any;
32
+ }, import('vue').PublicProps, {
28
33
  size: string | number;
29
34
  modelValue: number;
30
- strokeWidth: number;
35
+ strokeWidth: string | number;
31
36
  strokeLinecap: import('./types').VroCircleProgressStrokeLinecap;
32
37
  duration: string | number;
33
38
  }, true, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, HTMLDivElement, import('vue').ComponentProvideOptions, {
@@ -47,7 +52,7 @@ export declare const VroCircleProgress: import('..').WithInstall<{
47
52
  default: number;
48
53
  };
49
54
  strokeWidth: {
50
- type: NumberConstructor;
55
+ type: import('vue').PropType<string | number>;
51
56
  default: number;
52
57
  };
53
58
  strokeLinecap: {
@@ -61,10 +66,12 @@ export declare const VroCircleProgress: import('..').WithInstall<{
61
66
  color: StringConstructor;
62
67
  backgroundColor: StringConstructor;
63
68
  curve: StringConstructor;
64
- }>> & Readonly<{}>, {}, {}, {}, {}, {
69
+ }>> & Readonly<{
70
+ onFinish?: ((value: number) => any) | undefined;
71
+ }>, {}, {}, {}, {}, {
65
72
  size: string | number;
66
73
  modelValue: number;
67
- strokeWidth: number;
74
+ strokeWidth: string | number;
68
75
  strokeLinecap: import('./types').VroCircleProgressStrokeLinecap;
69
76
  duration: string | number;
70
77
  }>;
@@ -81,7 +88,7 @@ export declare const VroCircleProgress: import('..').WithInstall<{
81
88
  default: number;
82
89
  };
83
90
  strokeWidth: {
84
- type: NumberConstructor;
91
+ type: import('vue').PropType<string | number>;
85
92
  default: number;
86
93
  };
87
94
  strokeLinecap: {
@@ -95,10 +102,14 @@ export declare const VroCircleProgress: import('..').WithInstall<{
95
102
  color: StringConstructor;
96
103
  backgroundColor: StringConstructor;
97
104
  curve: StringConstructor;
98
- }>> & Readonly<{}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, {
105
+ }>> & Readonly<{
106
+ onFinish?: ((value: number) => any) | undefined;
107
+ }>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
108
+ finish: (value: number) => any;
109
+ }, string, {
99
110
  size: string | number;
100
111
  modelValue: number;
101
- strokeWidth: number;
112
+ strokeWidth: string | number;
102
113
  strokeLinecap: import('./types').VroCircleProgressStrokeLinecap;
103
114
  duration: string | number;
104
115
  }, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & (new () => {
@@ -3,9 +3,11 @@ import "vue";
3
3
  import { withInstall as r } from "../utils/withInstall.js";
4
4
  import o from "./vro-circle-progress.vue.js";
5
5
  import { vroCircleProgressProps as l } from "./types.js";
6
- const e = r(o);
6
+ import { useVroCircleProgress as a } from "./useVroCircleProgress.js";
7
+ const m = r(o);
7
8
  export {
8
- e as VroCircleProgress,
9
- e as default,
9
+ m as VroCircleProgress,
10
+ m as default,
11
+ a as useVroCircleProgress,
10
12
  l as vroCircleProgressProps
11
13
  };
@@ -1 +1 @@
1
- :root,:host{--vro-circle-progress-size: 100px;--vro-circle-progress-color: currentColor;--vro-circle-progress-background-color: rgba(0, 0, 0, .08);--vro-circle-progress-duration: .3s;--vro-circle-progress-curve: ease;--vro-circle-progress-content-color: currentColor;--vro-circle-progress-content-font-size: 16px}.vro-circle-progress{position:relative;display:inline-flex;align-items:center;justify-content:center;width:var(--size);height:var(--size);color:var(--vro-circle-progress-content-color);font-size:var(--vro-circle-progress-content-font-size);line-height:1;vertical-align:middle}.vro-circle-progress-svg{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}.vro-circle-progress-track{stroke:var(--background-color)}.vro-circle-progress-line{stroke:var(--color);transition:stroke-dashoffset var(--duration) var(--curve),stroke var(--duration) var(--curve);transform:rotate(-90deg);transform-origin:50% 50%}
1
+ :root,:host{--vro-circle-progress-size: 100px;--vro-circle-progress-color: currentColor;--vro-circle-progress-background-color: rgba(0, 0, 0, .08);--vro-circle-progress-duration: .3s;--vro-circle-progress-curve: ease;--vro-circle-progress-content-color: currentColor;--vro-circle-progress-content-font-size: 16px}.vro-circle-progress{position:relative;display:inline-flex;align-items:center;justify-content:center;width:var(--size);height:var(--size);color:var(--vro-circle-progress-content-color);font-size:var(--vro-circle-progress-content-font-size);line-height:1;vertical-align:middle}.vro-circle-progress-svg{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}.vro-circle-progress-track{stroke:var(--background-color)}.vro-circle-progress-line{stroke:var(--color);transition:stroke-dashoffset var(--duration) var(--curve);transform:rotate(-90deg);transform-origin:50% 50%}
@@ -19,7 +19,7 @@ export declare const vroCircleProgressProps: {
19
19
  * 进度条宽度。
20
20
  */
21
21
  strokeWidth: {
22
- type: NumberConstructor;
22
+ type: PropType<string | number>;
23
23
  default: number;
24
24
  };
25
25
  /**
@@ -54,4 +54,7 @@ export interface VroCircleProgressSlots {
54
54
  value: number;
55
55
  }) => any;
56
56
  }
57
+ export interface VroCircleProgressEmits {
58
+ finish: [value: number];
59
+ }
57
60
  export type VroCircleProgressProps = ExtractPropTypes<typeof vroCircleProgressProps>;
@@ -1,4 +1,4 @@
1
- const e = {
1
+ const r = {
2
2
  /**
3
3
  * 当前进度,取值范围为 0 ~ 100。
4
4
  */
@@ -17,7 +17,7 @@ const e = {
17
17
  * 进度条宽度。
18
18
  */
19
19
  strokeWidth: {
20
- type: Number,
20
+ type: [Number, String],
21
21
  default: 10
22
22
  },
23
23
  /**
@@ -48,5 +48,5 @@ const e = {
48
48
  curve: String
49
49
  };
50
50
  export {
51
- e as vroCircleProgressProps
51
+ r as vroCircleProgressProps
52
52
  };
@@ -0,0 +1,10 @@
1
+ export interface UseVroCircleProgressOptions {
2
+ duration?: number;
3
+ progress?: number;
4
+ }
5
+ export declare function useVroCircleProgress(options?: UseVroCircleProgressOptions): {
6
+ progress: import('vue').Ref<number, number>;
7
+ duration: import('vue').Ref<number, number>;
8
+ start: (options?: UseVroCircleProgressOptions) => void;
9
+ reset: () => void;
10
+ };
@@ -0,0 +1,24 @@
1
+ import { ref as o, nextTick as u } from "vue";
2
+ const i = 100, l = 10 * 1e3, m = async (r) => {
3
+ await u(), requestAnimationFrame(() => {
4
+ requestAnimationFrame(r);
5
+ });
6
+ };
7
+ function f(r = {}) {
8
+ const c = r.progress ?? i, s = r.duration ?? l, t = o(c), e = o(s), n = () => {
9
+ e.value = 0, t.value = i;
10
+ };
11
+ return {
12
+ progress: t,
13
+ duration: e,
14
+ start: (a = {}) => {
15
+ n(), m(() => {
16
+ e.value = a.duration ?? s, t.value = a.progress ?? 0;
17
+ });
18
+ },
19
+ reset: n
20
+ };
21
+ }
22
+ export {
23
+ f as useVroCircleProgress
24
+ };
@@ -16,7 +16,7 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
16
16
  default: number;
17
17
  };
18
18
  strokeWidth: {
19
- type: NumberConstructor;
19
+ type: import('vue').PropType<string | number>;
20
20
  default: number;
21
21
  };
22
22
  strokeLinecap: {
@@ -30,7 +30,9 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
30
30
  color: StringConstructor;
31
31
  backgroundColor: StringConstructor;
32
32
  curve: StringConstructor;
33
- }>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
33
+ }>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
34
+ finish: (value: number) => any;
35
+ }, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
34
36
  modelValue: {
35
37
  type: NumberConstructor;
36
38
  default: number;
@@ -40,7 +42,7 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
40
42
  default: number;
41
43
  };
42
44
  strokeWidth: {
43
- type: NumberConstructor;
45
+ type: import('vue').PropType<string | number>;
44
46
  default: number;
45
47
  };
46
48
  strokeLinecap: {
@@ -54,10 +56,12 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
54
56
  color: StringConstructor;
55
57
  backgroundColor: StringConstructor;
56
58
  curve: StringConstructor;
57
- }>> & Readonly<{}>, {
59
+ }>> & Readonly<{
60
+ onFinish?: ((value: number) => any) | undefined;
61
+ }>, {
58
62
  size: string | number;
59
63
  modelValue: number;
60
- strokeWidth: number;
64
+ strokeWidth: string | number;
61
65
  strokeLinecap: import('./types').VroCircleProgressStrokeLinecap;
62
66
  duration: string | number;
63
67
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
@@ -1,70 +1,83 @@
1
- import { defineComponent as p, computed as k, createElementBlock as l, openBlock as i, normalizeStyle as m, renderSlot as h, createElementVNode as n, createTextVNode as f, toDisplayString as g } from "vue";
2
- import { clamp as u } from "@daysnap/utils";
3
- import { addUnit as v } from "../utils/addUnit.js";
4
- import { vroCircleProgressProps as _ } from "./types.js";
5
- const y = ["aria-valuenow"], w = {
6
- class: "vro-circle-progress-svg",
7
- viewBox: "0 0 100 100"
8
- }, x = ["r", "stroke-width"], b = ["r", "stroke-width", "stroke-linecap", "stroke-dasharray", "stroke-dashoffset"], s = 50, W = /* @__PURE__ */ p({
1
+ import { defineComponent as y, computed as x, createElementBlock as l, openBlock as u, normalizeStyle as _, renderSlot as b, createElementVNode as v, createTextVNode as w, toDisplayString as N } from "vue";
2
+ import { clamp as d } from "@daysnap/utils";
3
+ import { addUnit as m } from "../utils/addUnit.js";
4
+ import { vroCircleProgressProps as z } from "./types.js";
5
+ const B = ["aria-valuenow"], V = ["viewBox"], W = ["cx", "cy", "r", "stroke-width"], C = ["cx", "cy", "r", "stroke-width", "stroke-linecap", "stroke-dasharray", "stroke-dashoffset"], F = /* @__PURE__ */ y({
9
6
  name: "VroCircleProgress",
10
7
  __name: "vro-circle-progress",
11
- props: _,
12
- setup(d) {
13
- const e = d, r = k(() => {
14
- const o = u(0, e.modelValue, 100), t = u(0, e.strokeWidth, 100), a = s - t / 2, c = 2 * Math.PI * a;
8
+ props: z,
9
+ emits: ["finish"],
10
+ setup(p, { emit: f }) {
11
+ const s = p, h = f, a = (r) => {
12
+ const o = Number(r);
13
+ return Number.isFinite(o) ? o : void 0;
14
+ }, k = (r) => {
15
+ if (typeof r == "number") return r;
16
+ const o = Number.parseFloat(r);
17
+ return Number.isFinite(o) ? r.trim().endsWith("ms") ? o : o * 1e3 : 0;
18
+ }, e = x(() => {
19
+ const r = a(s.size) || 100, o = r / 2, t = d(0, s.modelValue, 100), c = d(0, a(s.strokeWidth) || 0, r), i = o - c / 2, n = 2 * Math.PI * i;
15
20
  return {
16
- value: o,
17
- strokeWidth: t,
18
- radius: a,
19
- circumference: c,
20
- strokeDashoffset: c * (1 - o / 100),
21
- text: `${Math.round(o)}%`,
21
+ center: o,
22
+ value: t,
23
+ strokeWidth: c,
24
+ radius: i,
25
+ circumference: n,
26
+ viewBox: `0 0 ${r} ${r}`,
27
+ strokeDashoffset: n * (1 - t / 100),
28
+ text: `${Math.round(t)}%`,
22
29
  style: {
23
- "--size": v(e.size) || "var(--vro-circle-progress-size)",
24
- "--color": e.color || "var(--vro-circle-progress-color)",
25
- "--background-color": e.backgroundColor || "var(--vro-circle-progress-background-color)",
26
- "--duration": v(e.duration, "ms") || "var(--vro-circle-progress-duration)",
27
- "--curve": e.curve || "var(--vro-circle-progress-curve)"
30
+ "--size": m(s.size) || "var(--vro-circle-progress-size)",
31
+ "--color": s.color || "var(--vro-circle-progress-color)",
32
+ "--background-color": s.backgroundColor || "var(--vro-circle-progress-background-color)",
33
+ "--duration": m(s.duration, "ms") || "var(--vro-circle-progress-duration)",
34
+ "--curve": s.curve || "var(--vro-circle-progress-curve)"
28
35
  }
29
36
  };
30
- });
31
- return (o, t) => (i(), l("div", {
37
+ }), g = (r) => {
38
+ r.propertyName !== "stroke-dashoffset" || k(s.duration) <= 0 || h("finish", e.value.value);
39
+ };
40
+ return (r, o) => (u(), l("div", {
32
41
  class: "vro-circle-progress",
33
- style: m(r.value.style),
42
+ style: _(e.value.style),
34
43
  role: "progressbar",
35
- "aria-valuenow": r.value.value,
44
+ "aria-valuenow": e.value.value,
36
45
  "aria-valuemin": "0",
37
46
  "aria-valuemax": "100"
38
47
  }, [
39
- (i(), l("svg", w, [
40
- n("circle", {
48
+ (u(), l("svg", {
49
+ class: "vro-circle-progress-svg",
50
+ viewBox: e.value.viewBox
51
+ }, [
52
+ v("circle", {
41
53
  class: "vro-circle-progress-track",
42
- cx: s,
43
- cy: s,
44
- r: r.value.radius,
54
+ cx: e.value.center,
55
+ cy: e.value.center,
56
+ r: e.value.radius,
45
57
  fill: "none",
46
- "stroke-width": r.value.strokeWidth
47
- }, null, 8, x),
48
- n("circle", {
58
+ "stroke-width": e.value.strokeWidth
59
+ }, null, 8, W),
60
+ v("circle", {
49
61
  class: "vro-circle-progress-line",
50
- cx: s,
51
- cy: s,
52
- r: r.value.radius,
62
+ cx: e.value.center,
63
+ cy: e.value.center,
64
+ r: e.value.radius,
53
65
  fill: "none",
54
- "stroke-width": r.value.strokeWidth,
55
- "stroke-linecap": o.strokeLinecap,
56
- "stroke-dasharray": r.value.circumference,
57
- "stroke-dashoffset": r.value.strokeDashoffset
58
- }, null, 8, b)
59
- ])),
60
- h(o.$slots, "default", {
61
- value: r.value.value
66
+ "stroke-width": e.value.strokeWidth,
67
+ "stroke-linecap": r.strokeLinecap,
68
+ "stroke-dasharray": e.value.circumference,
69
+ "stroke-dashoffset": e.value.strokeDashoffset,
70
+ onTransitionend: g
71
+ }, null, 40, C)
72
+ ], 8, V)),
73
+ b(r.$slots, "default", {
74
+ value: e.value.value
62
75
  }, () => [
63
- f(g(r.value.text), 1)
76
+ w(N(e.value.text), 1)
64
77
  ])
65
- ], 12, y));
78
+ ], 12, B));
66
79
  }
67
80
  });
68
81
  export {
69
- W as default
82
+ F as default
70
83
  };
@@ -0,0 +1,53 @@
1
+ export * from './types';
2
+ export declare const VroSafeArea: import('..').WithInstall<{
3
+ new (...args: any[]): import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('vue').ExtractPropTypes<{
4
+ top: BooleanConstructor;
5
+ bottom: BooleanConstructor;
6
+ left: BooleanConstructor;
7
+ right: BooleanConstructor;
8
+ }>> & Readonly<{}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, import('vue').PublicProps, {
9
+ top: boolean;
10
+ bottom: boolean;
11
+ left: boolean;
12
+ right: boolean;
13
+ }, true, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, HTMLDivElement, import('vue').ComponentProvideOptions, {
14
+ P: {};
15
+ B: {};
16
+ D: {};
17
+ C: {};
18
+ M: {};
19
+ Defaults: {};
20
+ }, Readonly<import('vue').ExtractPropTypes<{
21
+ top: BooleanConstructor;
22
+ bottom: BooleanConstructor;
23
+ left: BooleanConstructor;
24
+ right: BooleanConstructor;
25
+ }>> & Readonly<{}>, {}, {}, {}, {}, {
26
+ top: boolean;
27
+ bottom: boolean;
28
+ left: boolean;
29
+ right: boolean;
30
+ }>;
31
+ __isFragment?: never;
32
+ __isTeleport?: never;
33
+ __isSuspense?: never;
34
+ } & import('vue').ComponentOptionsBase<Readonly<import('vue').ExtractPropTypes<{
35
+ top: BooleanConstructor;
36
+ bottom: BooleanConstructor;
37
+ left: BooleanConstructor;
38
+ right: BooleanConstructor;
39
+ }>> & Readonly<{}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, {
40
+ top: boolean;
41
+ bottom: boolean;
42
+ left: boolean;
43
+ right: boolean;
44
+ }, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & (new () => {
45
+ $slots: Readonly<import('./types').VroSafeAreaSlots> & import('./types').VroSafeAreaSlots;
46
+ })>;
47
+ export default VroSafeArea;
48
+ export type VroSafeAreaInstance = InstanceType<typeof VroSafeArea>;
49
+ declare module 'vue' {
50
+ interface GlobalComponents {
51
+ VroSafeArea: typeof VroSafeArea;
52
+ }
53
+ }
@@ -0,0 +1,11 @@
1
+ import "@daysnap/utils";
2
+ import "vue";
3
+ import { withInstall as r } from "../utils/withInstall.js";
4
+ import o from "./vro-safe-area.vue.js";
5
+ import { vroSafeAreaProps as s } from "./types.js";
6
+ const f = r(o);
7
+ export {
8
+ f as VroSafeArea,
9
+ f as default,
10
+ s as vroSafeAreaProps
11
+ };
File without changes
@@ -0,0 +1,2 @@
1
+ import '../../style/base.css';
2
+ import './index.css';
@@ -0,0 +1 @@
1
+ .vro-safe-area{--vro-safe-area-padding-top: 0px;--vro-safe-area-padding-right: 0px;--vro-safe-area-padding-bottom: 0px;--vro-safe-area-padding-left: 0px;box-sizing:border-box;padding:var(--vro-safe-area-padding-top) var(--vro-safe-area-padding-right) var(--vro-safe-area-padding-bottom) var(--vro-safe-area-padding-left)}.vro-safe-area.is-top{padding-top:calc(var(--vro-safe-area-padding-top) + constant(safe-area-inset-top));padding-top:calc(var(--vro-safe-area-padding-top) + env(safe-area-inset-top))}.vro-safe-area.is-bottom{padding-bottom:calc(var(--vro-safe-area-padding-bottom) + constant(safe-area-inset-bottom));padding-bottom:calc(var(--vro-safe-area-padding-bottom) + env(safe-area-inset-bottom))}.vro-safe-area.is-left{padding-left:calc(var(--vro-safe-area-padding-left) + constant(safe-area-inset-left));padding-left:calc(var(--vro-safe-area-padding-left) + env(safe-area-inset-left))}.vro-safe-area.is-right{padding-right:calc(var(--vro-safe-area-padding-right) + constant(safe-area-inset-right));padding-right:calc(var(--vro-safe-area-padding-right) + env(safe-area-inset-right))}
File without changes
@@ -0,0 +1 @@
1
+ import './css.js';
@@ -0,0 +1,27 @@
1
+ import { ExtractPropTypes } from 'vue';
2
+ import { VroSlot } from '../types';
3
+ export declare const vroSafeAreaProps: {
4
+ /**
5
+ * 是否适配顶部安全区。
6
+ */
7
+ top: BooleanConstructor;
8
+ /**
9
+ * 是否适配底部安全区。
10
+ */
11
+ bottom: BooleanConstructor;
12
+ /**
13
+ * 是否适配左侧安全区。
14
+ */
15
+ left: BooleanConstructor;
16
+ /**
17
+ * 是否适配右侧安全区。
18
+ */
19
+ right: BooleanConstructor;
20
+ };
21
+ export type VroSafeAreaProps = ExtractPropTypes<typeof vroSafeAreaProps>;
22
+ export interface VroSafeAreaSlots {
23
+ /**
24
+ * 默认内容。
25
+ */
26
+ default?: VroSlot;
27
+ }
@@ -0,0 +1,21 @@
1
+ const o = {
2
+ /**
3
+ * 是否适配顶部安全区。
4
+ */
5
+ top: Boolean,
6
+ /**
7
+ * 是否适配底部安全区。
8
+ */
9
+ bottom: Boolean,
10
+ /**
11
+ * 是否适配左侧安全区。
12
+ */
13
+ left: Boolean,
14
+ /**
15
+ * 是否适配右侧安全区。
16
+ */
17
+ right: Boolean
18
+ };
19
+ export {
20
+ o as vroSafeAreaProps
21
+ };
@@ -0,0 +1,31 @@
1
+ import { VroSafeAreaSlots } from './types';
2
+ declare function __VLS_template(): {
3
+ attrs: Partial<{}>;
4
+ slots: Readonly<VroSafeAreaSlots> & VroSafeAreaSlots;
5
+ refs: {};
6
+ rootEl: HTMLDivElement;
7
+ };
8
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
9
+ declare const __VLS_component: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
10
+ top: BooleanConstructor;
11
+ bottom: BooleanConstructor;
12
+ left: BooleanConstructor;
13
+ right: BooleanConstructor;
14
+ }>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
15
+ top: BooleanConstructor;
16
+ bottom: BooleanConstructor;
17
+ left: BooleanConstructor;
18
+ right: BooleanConstructor;
19
+ }>> & Readonly<{}>, {
20
+ top: boolean;
21
+ bottom: boolean;
22
+ left: boolean;
23
+ right: boolean;
24
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
25
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
26
+ export default _default;
27
+ type __VLS_WithTemplateSlots<T, S> = T & {
28
+ new (): {
29
+ $slots: S;
30
+ };
31
+ };
@@ -0,0 +1,22 @@
1
+ import { defineComponent as o, createElementBlock as r, openBlock as a, normalizeClass as t, renderSlot as s } from "vue";
2
+ import { vroSafeAreaProps as n } from "./types.js";
3
+ const m = /* @__PURE__ */ o({
4
+ name: "VroSafeArea",
5
+ __name: "vro-safe-area",
6
+ props: n,
7
+ setup(p) {
8
+ return (e, f) => (a(), r("div", {
9
+ class: t(["vro-safe-area", {
10
+ "is-top": e.top,
11
+ "is-bottom": e.bottom,
12
+ "is-left": e.left,
13
+ "is-right": e.right
14
+ }])
15
+ }, [
16
+ s(e.$slots, "default")
17
+ ], 2));
18
+ }
19
+ });
20
+ export {
21
+ m as default
22
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./vro-safe-area.vue.js";
2
+ export {
3
+ f as default
4
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vrojs/base",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "description": "vrojs ui",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",