zartui 3.1.11 → 3.1.12

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 (54) hide show
  1. package/README.md +23 -23
  2. package/es/composables/use-touch.d.ts +1 -0
  3. package/es/composables/use-touch.mjs +8 -1
  4. package/es/config-provider/types.d.ts +1 -1
  5. package/es/floating-bubble/FloatingBubble.d.ts +81 -0
  6. package/es/floating-bubble/FloatingBubble.mjs +181 -0
  7. package/es/floating-bubble/index.css +1 -0
  8. package/es/floating-bubble/index.d.ts +63 -0
  9. package/es/floating-bubble/index.mjs +10 -0
  10. package/es/floating-bubble/style/index.d.ts +1 -0
  11. package/es/floating-bubble/style/index.mjs +4 -0
  12. package/es/floating-bubble/types.d.ts +20 -0
  13. package/es/floating-bubble/types.mjs +0 -0
  14. package/es/index.d.ts +2 -1
  15. package/es/index.mjs +4 -1
  16. package/es/lazyload/vue-lazyload/index.d.ts +55 -55
  17. package/es/utils/closest.d.ts +1 -0
  18. package/es/utils/closest.mjs +8 -0
  19. package/es/utils/constant.d.ts +1 -0
  20. package/es/utils/constant.mjs +3 -1
  21. package/es/utils/index.d.ts +1 -0
  22. package/es/utils/index.mjs +1 -0
  23. package/es/vue-sfc-shim.d.ts +6 -6
  24. package/es/vue-tsx-shim.d.ts +23 -23
  25. package/lib/composables/use-touch.d.ts +1 -0
  26. package/lib/composables/use-touch.js +8 -1
  27. package/lib/config-provider/types.d.ts +1 -1
  28. package/lib/floating-bubble/FloatingBubble.d.ts +81 -0
  29. package/lib/floating-bubble/FloatingBubble.js +210 -0
  30. package/lib/floating-bubble/index.css +1 -0
  31. package/lib/floating-bubble/index.d.ts +63 -0
  32. package/lib/floating-bubble/index.js +39 -0
  33. package/lib/floating-bubble/style/index.d.ts +1 -0
  34. package/lib/floating-bubble/style/index.js +4 -0
  35. package/lib/floating-bubble/types.d.ts +20 -0
  36. package/lib/floating-bubble/types.js +15 -0
  37. package/lib/index.css +1 -1
  38. package/lib/index.d.ts +2 -1
  39. package/lib/index.js +4 -1
  40. package/lib/lazyload/vue-lazyload/index.d.ts +55 -55
  41. package/lib/utils/closest.d.ts +1 -0
  42. package/lib/utils/closest.js +27 -0
  43. package/lib/utils/constant.d.ts +1 -0
  44. package/lib/utils/constant.js +3 -1
  45. package/lib/utils/index.d.ts +1 -0
  46. package/lib/utils/index.js +1 -0
  47. package/lib/vue-sfc-shim.d.ts +6 -6
  48. package/lib/vue-tsx-shim.d.ts +23 -23
  49. package/lib/web-types.json +1 -1
  50. package/lib/zartui.cjs.js +644 -457
  51. package/lib/zartui.es.js +644 -457
  52. package/lib/zartui.js +644 -457
  53. package/lib/zartui.min.js +1 -1
  54. package/package.json +3 -3
package/README.md CHANGED
@@ -1,23 +1,23 @@
1
- # ZartUI
2
-
3
- [ZartUI](https://zartui.egova.com.cn) 是数字政通基于 Vue 研发的一款面向政务场景的移动端组件库。
4
-
5
- Zart(读音 /zɑːt/)的命名,灵感源自数字政通秉承的理念:让城市治理变得更智慧。Zart = zt + smart, zt是政通的首字母缩写,smart代表公司理念中的“智慧”,将smart中间的“ar”字母包裹于zt之间,体现了ZartUI的核心目标:追求极致的用户体验,致力于做灵活智能的组件库。
6
-
7
- ## 特性
8
-
9
- 1)【组件重构】【组件审核】提供50多个高质量组件,覆盖移动端各类场景;
10
-
11
- 2)【UI重构】基于全新的视觉规范;
12
-
13
- 3)【在线网站】完善的文档、示例、演示效果;
14
-
15
- 4)支持主题定制、按需引入;
16
-
17
- 5)支持Vue3.0、TypeScript;
18
-
19
- 6)性能佳,组件平均体积小(min+gzip);
20
-
21
- ## 浏览器支持
22
-
23
- ZartUI 3 支持现代浏览器以及 Chrome >= 51、iOS >= 10.0(与 Vue 3 一致)。
1
+ # ZartUI
2
+
3
+ [ZartUI](https://zartui.egova.com.cn) 是数字政通基于 Vue 研发的一款面向政务场景的移动端组件库。
4
+
5
+ Zart(读音 /zɑːt/)的命名,灵感源自数字政通秉承的理念:让城市治理变得更智慧。Zart = zt + smart, zt是政通的首字母缩写,smart代表公司理念中的“智慧”,将smart中间的“ar”字母包裹于zt之间,体现了ZartUI的核心目标:追求极致的用户体验,致力于做灵活智能的组件库。
6
+
7
+ ## 特性
8
+
9
+ 1)【组件重构】【组件审核】提供50多个高质量组件,覆盖移动端各类场景;
10
+
11
+ 2)【UI重构】基于全新的视觉规范;
12
+
13
+ 3)【在线网站】完善的文档、示例、演示效果;
14
+
15
+ 4)支持主题定制、按需引入;
16
+
17
+ 5)支持Vue3.0、TypeScript;
18
+
19
+ 6)性能佳,组件平均体积小(min+gzip);
20
+
21
+ ## 浏览器支持
22
+
23
+ ZartUI 3 支持现代浏览器以及 Chrome >= 51、iOS >= 10.0(与 Vue 3 一致)。
@@ -12,5 +12,6 @@ export declare function useTouch(): {
12
12
  direction: import("vue").Ref<Direction>;
13
13
  isVertical: () => boolean;
14
14
  isHorizontal: () => boolean;
15
+ isTap: import("vue").Ref<boolean>;
15
16
  };
16
17
  export {};
@@ -1,4 +1,5 @@
1
1
  import { ref } from "vue";
2
+ import { TAP_OFFSET } from "../utils/index.mjs";
2
3
  function getDirection(x, y) {
3
4
  if (x > y) {
4
5
  return "horizontal";
@@ -16,6 +17,7 @@ function useTouch() {
16
17
  const offsetX = ref(0);
17
18
  const offsetY = ref(0);
18
19
  const direction = ref("");
20
+ const isTap = ref(true);
19
21
  const isVertical = () => direction.value === "vertical";
20
22
  const isHorizontal = () => direction.value === "horizontal";
21
23
  const reset = () => {
@@ -24,6 +26,7 @@ function useTouch() {
24
26
  offsetX.value = 0;
25
27
  offsetY.value = 0;
26
28
  direction.value = "";
29
+ isTap.value = true;
27
30
  };
28
31
  const start = (event) => {
29
32
  reset();
@@ -40,6 +43,9 @@ function useTouch() {
40
43
  if (!direction.value || offsetX.value < LOCK_DIRECTION_DISTANCE && offsetY.value < LOCK_DIRECTION_DISTANCE) {
41
44
  direction.value = getDirection(offsetX.value, offsetY.value);
42
45
  }
46
+ if (isTap.value && (offsetX.value > TAP_OFFSET || offsetY.value > TAP_OFFSET)) {
47
+ isTap.value = false;
48
+ }
43
49
  };
44
50
  return {
45
51
  move,
@@ -53,7 +59,8 @@ function useTouch() {
53
59
  offsetY,
54
60
  direction,
55
61
  isVertical,
56
- isHorizontal
62
+ isHorizontal,
63
+ isTap
57
64
  };
58
65
  }
59
66
  export {
@@ -135,4 +135,4 @@ export type BaseThemeVars = {
135
135
  radiusGt?: string;
136
136
  radiusMax?: string;
137
137
  };
138
- export type ConfigProviderThemeVars = BaseThemeVars & import('../action-sheet').ActionSheetThemeVars & import('../avatar').AvatarThemeVars & import('../badge').BadgeThemeVars & import('../button').ButtonThemeVars & import('../calendar').CalendarThemeVars & import('../cascader').CascaderThemeVars & import('../cell').CellThemeVars & import('../checkbox').CheckboxThemeVars & import('../collapse-item').CollapseItemThemeVars & import('../dialog').DialogThemeVars & import('../divider').DividerThemeVars & import('../dropdown-item').DropdownItemThemeVars & import('../dropdown-menu').DropdownMenuThemeVars & import('../empty').EmptyThemeVars & import('../field').FieldThemeVars & import('../grid-item').GridItemThemeVars & import('../hierarchy-select').HierarchySelectThemeVars & import('../image').ImageThemeVars & import('../image-preview').ImagePreviewThemeVars & import('../index-anchor').IndexAnchorThemeVars & import('../index-bar').IndexBarThemeVars & import('../list').ListThemeVars & import('../loading').LoadingThemeVars & import('../media-picker').MediaPickerThemeVars & import('../multiple-picker').MultiplePickerThemeVars & import('../nav-bar').NavBarThemeVars & import('../notice-bar').NoticeBarThemeVars & import('../notify').NotifyThemeVars & import('../number-keyboard').NumberKeyboardThemeVars & import('../overlay').OverlayThemeVars & import('../password-input').PasswordInputThemeVars & import('../picker').PickerThemeVars & import('../popover').PopoverThemeVars & import('../popup').PopupThemeVars & import('../pull-refresh').PullRefreshThemeVars & import('../radio').RadioThemeVars & import('../radio-picker').RadioPickerThemeVars & import('../rate').RateThemeVars & import('../search').SearchThemeVars & import('../signature').SignatureThemeVars & import('../skeleton').SkeletonThemeVars & import('../step').StepThemeVars & import('../stepper').StepperThemeVars & import('../steps').StepsThemeVars & import('../sticky').StickyThemeVars & import('../swipe').SwipeThemeVars & import('../switch').SwitchThemeVars & import('../tabbar').TabbarThemeVars & import('../tabbar-item').TabbarItemThemeVars & import('../table').TableThemeVars & import('../tabs').TabsThemeVars & import('../tag').TagThemeVars & import('../text-ellipsis').TextEllipsisThemeVars & import('../time-picker').TimePickerThemeVars & import('../timeline').TimelineThemeVars & import('../toast').ToastThemeVars & import('../uploader').UploaderThemeVars;
138
+ export type ConfigProviderThemeVars = BaseThemeVars & import('../action-sheet').ActionSheetThemeVars & import('../avatar').AvatarThemeVars & import('../badge').BadgeThemeVars & import('../button').ButtonThemeVars & import('../calendar').CalendarThemeVars & import('../cascader').CascaderThemeVars & import('../cell').CellThemeVars & import('../checkbox').CheckboxThemeVars & import('../collapse-item').CollapseItemThemeVars & import('../dialog').DialogThemeVars & import('../divider').DividerThemeVars & import('../dropdown-item').DropdownItemThemeVars & import('../dropdown-menu').DropdownMenuThemeVars & import('../empty').EmptyThemeVars & import('../field').FieldThemeVars & import('../floating-bubble').FloatingBubbleThemeVars & import('../grid-item').GridItemThemeVars & import('../hierarchy-select').HierarchySelectThemeVars & import('../image').ImageThemeVars & import('../image-preview').ImagePreviewThemeVars & import('../index-anchor').IndexAnchorThemeVars & import('../index-bar').IndexBarThemeVars & import('../list').ListThemeVars & import('../loading').LoadingThemeVars & import('../media-picker').MediaPickerThemeVars & import('../multiple-picker').MultiplePickerThemeVars & import('../nav-bar').NavBarThemeVars & import('../notice-bar').NoticeBarThemeVars & import('../notify').NotifyThemeVars & import('../number-keyboard').NumberKeyboardThemeVars & import('../overlay').OverlayThemeVars & import('../password-input').PasswordInputThemeVars & import('../picker').PickerThemeVars & import('../popover').PopoverThemeVars & import('../popup').PopupThemeVars & import('../pull-refresh').PullRefreshThemeVars & import('../radio').RadioThemeVars & import('../radio-picker').RadioPickerThemeVars & import('../rate').RateThemeVars & import('../search').SearchThemeVars & import('../signature').SignatureThemeVars & import('../skeleton').SkeletonThemeVars & import('../step').StepThemeVars & import('../stepper').StepperThemeVars & import('../steps').StepsThemeVars & import('../sticky').StickyThemeVars & import('../swipe').SwipeThemeVars & import('../switch').SwitchThemeVars & import('../tabbar').TabbarThemeVars & import('../tabbar-item').TabbarItemThemeVars & import('../table').TableThemeVars & import('../tabs').TabsThemeVars & import('../tag').TagThemeVars & import('../text-ellipsis').TextEllipsisThemeVars & import('../time-picker').TimePickerThemeVars & import('../timeline').TimelineThemeVars & import('../toast').ToastThemeVars & import('../uploader').UploaderThemeVars;
@@ -0,0 +1,81 @@
1
+ import { PropType, type ExtractPropTypes } from 'vue';
2
+ import { FloatingBubbleAxis, FloatingBubbleMagnetic, FloatingBubbleOffset } from './types';
3
+ export declare const floatingBubbleProps: {
4
+ gap: {
5
+ type: NumberConstructor;
6
+ default: number;
7
+ };
8
+ icon: StringConstructor;
9
+ axis: {
10
+ type: PropType<FloatingBubbleAxis>;
11
+ default: FloatingBubbleAxis;
12
+ };
13
+ magnetic: PropType<FloatingBubbleMagnetic>;
14
+ offset: {
15
+ type: PropType<FloatingBubbleOffset>;
16
+ default: () => {
17
+ x: number;
18
+ y: number;
19
+ };
20
+ };
21
+ teleport: {
22
+ type: PropType<string | import("vue").RendererElement | null | undefined>;
23
+ default: string;
24
+ };
25
+ };
26
+ export type FloatingBubbleProps = ExtractPropTypes<typeof floatingBubbleProps>;
27
+ declare const _default: import("vue").DefineComponent<{
28
+ gap: {
29
+ type: NumberConstructor;
30
+ default: number;
31
+ };
32
+ icon: StringConstructor;
33
+ axis: {
34
+ type: PropType<FloatingBubbleAxis>;
35
+ default: FloatingBubbleAxis;
36
+ };
37
+ magnetic: PropType<FloatingBubbleMagnetic>;
38
+ offset: {
39
+ type: PropType<FloatingBubbleOffset>;
40
+ default: () => {
41
+ x: number;
42
+ y: number;
43
+ };
44
+ };
45
+ teleport: {
46
+ type: PropType<string | import("vue").RendererElement | null | undefined>;
47
+ default: string;
48
+ };
49
+ }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("click" | "update:offset" | "offsetChange")[], "click" | "update:offset" | "offsetChange", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<ExtractPropTypes<{
50
+ gap: {
51
+ type: NumberConstructor;
52
+ default: number;
53
+ };
54
+ icon: StringConstructor;
55
+ axis: {
56
+ type: PropType<FloatingBubbleAxis>;
57
+ default: FloatingBubbleAxis;
58
+ };
59
+ magnetic: PropType<FloatingBubbleMagnetic>;
60
+ offset: {
61
+ type: PropType<FloatingBubbleOffset>;
62
+ default: () => {
63
+ x: number;
64
+ y: number;
65
+ };
66
+ };
67
+ teleport: {
68
+ type: PropType<string | import("vue").RendererElement | null | undefined>;
69
+ default: string;
70
+ };
71
+ }>> & {
72
+ onClick?: ((...args: any[]) => any) | undefined;
73
+ "onUpdate:offset"?: ((...args: any[]) => any) | undefined;
74
+ onOffsetChange?: ((...args: any[]) => any) | undefined;
75
+ }, {
76
+ offset: FloatingBubbleOffset;
77
+ teleport: string | import("vue").RendererElement | null | undefined;
78
+ gap: number;
79
+ axis: FloatingBubbleAxis;
80
+ }, {}>;
81
+ export default _default;
@@ -0,0 +1,181 @@
1
+ import { withDirectives as _withDirectives, mergeProps as _mergeProps, vShow as _vShow, createVNode as _createVNode } from "vue";
2
+ import { Teleport, computed, defineComponent, nextTick, onMounted, ref, watch, onActivated, onDeactivated } from "vue";
3
+ import { pick, addUnit, closest, createNamespace, makeNumberProp, makeStringProp, windowWidth, windowHeight } from "../utils/index.mjs";
4
+ import { useRect, useEventListener } from "@zartui/use";
5
+ import { useTouch } from "../composables/use-touch.mjs";
6
+ import Icon from "../icon/index.mjs";
7
+ const floatingBubbleProps = {
8
+ gap: makeNumberProp(24),
9
+ icon: String,
10
+ axis: makeStringProp("y"),
11
+ magnetic: String,
12
+ offset: {
13
+ type: Object,
14
+ default: () => ({
15
+ x: -1,
16
+ y: -1
17
+ })
18
+ },
19
+ teleport: {
20
+ type: [String, Object],
21
+ default: "body"
22
+ }
23
+ };
24
+ const [name, bem] = createNamespace("floating-bubble");
25
+ var stdin_default = defineComponent({
26
+ name,
27
+ inheritAttrs: false,
28
+ props: floatingBubbleProps,
29
+ emits: ["click", "update:offset", "offsetChange"],
30
+ setup(props, {
31
+ slots,
32
+ emit,
33
+ attrs
34
+ }) {
35
+ const rootRef = ref();
36
+ const state = ref({
37
+ x: 0,
38
+ y: 0,
39
+ width: 0,
40
+ height: 0
41
+ });
42
+ const boundary = computed(() => ({
43
+ top: props.gap,
44
+ right: windowWidth.value - state.value.width - props.gap,
45
+ bottom: windowHeight.value - state.value.height - props.gap,
46
+ left: props.gap
47
+ }));
48
+ const dragging = ref(false);
49
+ let initialized = false;
50
+ const rootStyle = computed(() => {
51
+ const style = {};
52
+ const x = addUnit(state.value.x);
53
+ const y = addUnit(state.value.y);
54
+ style.transform = `translate3d(${x}, ${y}, 0)`;
55
+ if (dragging.value || !initialized) {
56
+ style.transition = "none";
57
+ }
58
+ return style;
59
+ });
60
+ const updateState = () => {
61
+ if (!show.value)
62
+ return;
63
+ const {
64
+ width,
65
+ height
66
+ } = useRect(rootRef.value);
67
+ const {
68
+ offset
69
+ } = props;
70
+ state.value = {
71
+ x: offset.x > -1 ? offset.x : windowWidth.value - width - props.gap,
72
+ y: offset.y > -1 ? offset.y : windowHeight.value - height - props.gap,
73
+ width,
74
+ height
75
+ };
76
+ };
77
+ const touch = useTouch();
78
+ let prevX = 0;
79
+ let prevY = 0;
80
+ const onTouchStart = (e) => {
81
+ touch.start(e);
82
+ dragging.value = true;
83
+ prevX = state.value.x;
84
+ prevY = state.value.y;
85
+ };
86
+ const onTouchMove = (e) => {
87
+ e.preventDefault();
88
+ touch.move(e);
89
+ if (props.axis === "lock")
90
+ return;
91
+ if (!touch.isTap.value) {
92
+ if (props.axis === "x" || props.axis === "xy") {
93
+ let nextX = prevX + touch.deltaX.value;
94
+ if (nextX < boundary.value.left)
95
+ nextX = boundary.value.left;
96
+ if (nextX > boundary.value.right)
97
+ nextX = boundary.value.right;
98
+ state.value.x = nextX;
99
+ }
100
+ if (props.axis === "y" || props.axis === "xy") {
101
+ let nextY = prevY + touch.deltaY.value;
102
+ if (nextY < boundary.value.top)
103
+ nextY = boundary.value.top;
104
+ if (nextY > boundary.value.bottom)
105
+ nextY = boundary.value.bottom;
106
+ state.value.y = nextY;
107
+ }
108
+ const offset = pick(state.value, ["x", "y"]);
109
+ emit("update:offset", offset);
110
+ }
111
+ };
112
+ useEventListener("touchmove", onTouchMove, {
113
+ target: rootRef
114
+ });
115
+ const onTouchEnd = () => {
116
+ dragging.value = false;
117
+ nextTick(() => {
118
+ if (props.magnetic === "x") {
119
+ const nextX = closest([boundary.value.left, boundary.value.right], state.value.x);
120
+ state.value.x = nextX;
121
+ }
122
+ if (props.magnetic === "y") {
123
+ const nextY = closest([boundary.value.top, boundary.value.bottom], state.value.y);
124
+ state.value.y = nextY;
125
+ }
126
+ if (!touch.isTap.value) {
127
+ const offset = pick(state.value, ["x", "y"]);
128
+ emit("update:offset", offset);
129
+ if (prevX !== offset.x || prevY !== offset.y) {
130
+ emit("offsetChange", offset);
131
+ }
132
+ }
133
+ });
134
+ };
135
+ const onClick = (e) => {
136
+ if (touch.isTap.value)
137
+ emit("click", e);
138
+ else
139
+ e.stopPropagation();
140
+ };
141
+ onMounted(() => {
142
+ updateState();
143
+ nextTick(() => {
144
+ initialized = true;
145
+ });
146
+ });
147
+ watch([windowWidth, windowHeight, () => props.gap, () => props.offset], updateState);
148
+ const show = ref(true);
149
+ onActivated(() => {
150
+ show.value = true;
151
+ });
152
+ onDeactivated(() => {
153
+ if (props.teleport) {
154
+ show.value = false;
155
+ }
156
+ });
157
+ return () => {
158
+ const Content = _withDirectives(_createVNode("div", _mergeProps({
159
+ "class": bem(),
160
+ "ref": rootRef,
161
+ "onTouchstartPassive": onTouchStart,
162
+ "onTouchend": onTouchEnd,
163
+ "onTouchcancel": onTouchEnd,
164
+ "onClick": onClick,
165
+ "style": rootStyle.value
166
+ }, attrs), [slots.default ? slots.default() : _createVNode(Icon, {
167
+ "name": props.icon,
168
+ "class": bem("icon")
169
+ }, null)]), [[_vShow, show.value]]);
170
+ return props.teleport ? _createVNode(Teleport, {
171
+ "to": props.teleport
172
+ }, {
173
+ default: () => [Content]
174
+ }) : Content;
175
+ };
176
+ }
177
+ });
178
+ export {
179
+ stdin_default as default,
180
+ floatingBubbleProps
181
+ };
@@ -0,0 +1 @@
1
+ :root{--zt-floating-bubble-size: 48px;--zt-floating-bubble-initial-gap: 24px;--zt-floating-bubble-icon-size: 28px;--zt-floating-bubble-background: var(--zt-primary-color);--zt-floating-bubble-color: var(--zt-background-2);--zt-floating-bubble-z-index: 999;--zt-floating-bubble-border-radius: var(--zt-radius-max)}.zt-floating-bubble{position:fixed;left:0;top:0;right:var(--zt-floating-bubble-initial-gap);bottom:var(--zt-floating-bubble-initial-gap);width:var(--zt-floating-bubble-size);height:var(--zt-floating-bubble-size);box-sizing:border-box;display:flex;justify-content:center;align-items:center;overflow:hidden;cursor:pointer;touch-action:none;background:var(--zt-floating-bubble-background);color:var(--zt-floating-bubble-color);border-radius:var(--zt-floating-bubble-border-radius);z-index:var(--zt-floating-bubble-z-index);transition:transform var(--zt-duration-base);-webkit-user-select:none;user-select:none}.zt-floating-bubble:active{opacity:.7}.zt-floating-bubble__icon{font-size:var(--zt-floating-bubble-icon-size)}
@@ -0,0 +1,63 @@
1
+ export declare const FloatingBubble: import("../utils").WithInstall<import("vue").DefineComponent<{
2
+ gap: {
3
+ type: NumberConstructor;
4
+ default: number;
5
+ };
6
+ icon: StringConstructor;
7
+ axis: {
8
+ type: import("vue").PropType<import("./types").FloatingBubbleAxis>;
9
+ default: import("./types").FloatingBubbleAxis;
10
+ };
11
+ magnetic: import("vue").PropType<import("./types").FloatingBubbleMagnetic>;
12
+ offset: {
13
+ type: import("vue").PropType<import("./types").FloatingBubbleOffset>;
14
+ default: () => {
15
+ x: number;
16
+ y: number;
17
+ };
18
+ };
19
+ teleport: {
20
+ type: import("vue").PropType<string | import("vue").RendererElement | null | undefined>;
21
+ default: string;
22
+ };
23
+ }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("click" | "update:offset" | "offsetChange")[], "click" | "update:offset" | "offsetChange", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
24
+ gap: {
25
+ type: NumberConstructor;
26
+ default: number;
27
+ };
28
+ icon: StringConstructor;
29
+ axis: {
30
+ type: import("vue").PropType<import("./types").FloatingBubbleAxis>;
31
+ default: import("./types").FloatingBubbleAxis;
32
+ };
33
+ magnetic: import("vue").PropType<import("./types").FloatingBubbleMagnetic>;
34
+ offset: {
35
+ type: import("vue").PropType<import("./types").FloatingBubbleOffset>;
36
+ default: () => {
37
+ x: number;
38
+ y: number;
39
+ };
40
+ };
41
+ teleport: {
42
+ type: import("vue").PropType<string | import("vue").RendererElement | null | undefined>;
43
+ default: string;
44
+ };
45
+ }>> & {
46
+ onClick?: ((...args: any[]) => any) | undefined;
47
+ "onUpdate:offset"?: ((...args: any[]) => any) | undefined;
48
+ onOffsetChange?: ((...args: any[]) => any) | undefined;
49
+ }, {
50
+ offset: import("./types").FloatingBubbleOffset;
51
+ teleport: string | import("vue").RendererElement | null | undefined;
52
+ gap: number;
53
+ axis: import("./types").FloatingBubbleAxis;
54
+ }, {}>>;
55
+ export default FloatingBubble;
56
+ export { floatingBubbleProps } from './FloatingBubble';
57
+ export type { FloatingBubbleProps } from './FloatingBubble';
58
+ export type { FloatingBubbleThemeVars, FloatingBubbleAxis, FloatingBubbleMagnetic, FloatingBubbleOffset, } from './types';
59
+ declare module 'vue' {
60
+ interface GlobalComponents {
61
+ ZtFloatingBubble: typeof FloatingBubble;
62
+ }
63
+ }
@@ -0,0 +1,10 @@
1
+ import { withInstall } from "../utils/index.mjs";
2
+ import _FloatingBubble from "./FloatingBubble.mjs";
3
+ const FloatingBubble = withInstall(_FloatingBubble);
4
+ var stdin_default = FloatingBubble;
5
+ import { floatingBubbleProps } from "./FloatingBubble.mjs";
6
+ export {
7
+ FloatingBubble,
8
+ stdin_default as default,
9
+ floatingBubbleProps
10
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ import "../../style/base.css";
2
+ import "../../badge/index.css";
3
+ import "../../icon/index.css";
4
+ import "../index.css";
@@ -0,0 +1,20 @@
1
+ export type FloatingBubbleThemeVars = {
2
+ floatingBubbleSize?: string;
3
+ floatingBubbleInitialGap?: string;
4
+ floatingBubbleIconSize?: string;
5
+ floatingBubbleBackground?: string;
6
+ floatingBubbleColor?: string;
7
+ floatingBubbleZIndex?: number | string;
8
+ };
9
+ export type FloatingBubbleAxis = 'x' | 'y' | 'xy' | 'lock';
10
+ export type FloatingBubbleMagnetic = 'x' | 'y';
11
+ export type FloatingBubbleOffset = {
12
+ x: number;
13
+ y: number;
14
+ };
15
+ export type FloatingBubbleBoundary = {
16
+ top: number;
17
+ right: number;
18
+ bottom: number;
19
+ left: number;
20
+ };
File without changes
package/es/index.d.ts CHANGED
@@ -19,6 +19,7 @@ export * from "./dropdown-item";
19
19
  export * from "./dropdown-menu";
20
20
  export * from "./empty";
21
21
  export * from "./field";
22
+ export * from "./floating-bubble";
22
23
  export * from "./form";
23
24
  export * from "./grid";
24
25
  export * from "./grid-item";
@@ -78,4 +79,4 @@ declare namespace _default {
78
79
  }
79
80
  export default _default;
80
81
  export function install(app: any): void;
81
- export const version: "3.1.11";
82
+ export const version: "3.1.12";
package/es/index.mjs CHANGED
@@ -19,6 +19,7 @@ import { DropdownItem } from "./dropdown-item/index.mjs";
19
19
  import { DropdownMenu } from "./dropdown-menu/index.mjs";
20
20
  import { Empty } from "./empty/index.mjs";
21
21
  import { Field } from "./field/index.mjs";
22
+ import { FloatingBubble } from "./floating-bubble/index.mjs";
22
23
  import { Form } from "./form/index.mjs";
23
24
  import { Grid } from "./grid/index.mjs";
24
25
  import { GridItem } from "./grid-item/index.mjs";
@@ -71,7 +72,7 @@ import { TimePicker } from "./time-picker/index.mjs";
71
72
  import { Timeline } from "./timeline/index.mjs";
72
73
  import { Toast } from "./toast/index.mjs";
73
74
  import { Uploader } from "./uploader/index.mjs";
74
- const version = "3.1.11";
75
+ const version = "3.1.12";
75
76
  function install(app) {
76
77
  const components = [
77
78
  ActionSheet,
@@ -95,6 +96,7 @@ function install(app) {
95
96
  DropdownMenu,
96
97
  Empty,
97
98
  Field,
99
+ FloatingBubble,
98
100
  Form,
99
101
  Grid,
100
102
  GridItem,
@@ -177,6 +179,7 @@ export * from "./dropdown-item/index.mjs";
177
179
  export * from "./dropdown-menu/index.mjs";
178
180
  export * from "./empty/index.mjs";
179
181
  export * from "./field/index.mjs";
182
+ export * from "./floating-bubble/index.mjs";
180
183
  export * from "./form/index.mjs";
181
184
  export * from "./grid/index.mjs";
182
185
  export * from "./grid-item/index.mjs";
@@ -1,55 +1,55 @@
1
- import type { App } from 'vue';
2
-
3
- declare type ListenEvent =
4
- | 'scroll'
5
- | 'wheel'
6
- | 'mousewheel'
7
- | 'resize'
8
- | 'animationend'
9
- | 'transitionend'
10
- | 'touchmove';
11
-
12
- // eslint-disable-next-line
13
- declare type Callback = (listener: any, options: LazyloadOptions) => void;
14
-
15
- declare type Filter = {
16
- webp?: Callback;
17
- progressive?: Callback;
18
- };
19
-
20
- declare type Adapter = {
21
- error?: Callback;
22
- loaded?: Callback;
23
- loading?: Callback;
24
- };
25
-
26
- export declare type LazyloadOptions = {
27
- error?: string;
28
- filter?: Filter;
29
- silent?: boolean;
30
- adapter?: Adapter;
31
- loading?: string;
32
- attempt?: number;
33
- preLoad?: number;
34
- observer?: boolean;
35
- lazyImage?: boolean;
36
- throttleWait?: number;
37
- listenEvents?: ListenEvent[];
38
- dispatchEvent?: boolean;
39
- lazyComponent?: boolean;
40
- observerOptions?: IntersectionObserverInit;
41
- };
42
-
43
- export declare const Lazyload: {
44
- install(app: App, options?: LazyloadOptions): void;
45
- };
46
-
47
- declare module '@vue/runtime-core' {
48
- interface ComponentCustomProperties {
49
- $Lazyload: {
50
- $on: (event: string, handler: Callback) => void;
51
- $off: (event: string, handler?: Callback) => void;
52
- $once: (event: string, handler: Callback) => void;
53
- };
54
- }
55
- }
1
+ import type { App } from 'vue';
2
+
3
+ declare type ListenEvent =
4
+ | 'scroll'
5
+ | 'wheel'
6
+ | 'mousewheel'
7
+ | 'resize'
8
+ | 'animationend'
9
+ | 'transitionend'
10
+ | 'touchmove';
11
+
12
+ // eslint-disable-next-line
13
+ declare type Callback = (listener: any, options: LazyloadOptions) => void;
14
+
15
+ declare type Filter = {
16
+ webp?: Callback;
17
+ progressive?: Callback;
18
+ };
19
+
20
+ declare type Adapter = {
21
+ error?: Callback;
22
+ loaded?: Callback;
23
+ loading?: Callback;
24
+ };
25
+
26
+ export declare type LazyloadOptions = {
27
+ error?: string;
28
+ filter?: Filter;
29
+ silent?: boolean;
30
+ adapter?: Adapter;
31
+ loading?: string;
32
+ attempt?: number;
33
+ preLoad?: number;
34
+ observer?: boolean;
35
+ lazyImage?: boolean;
36
+ throttleWait?: number;
37
+ listenEvents?: ListenEvent[];
38
+ dispatchEvent?: boolean;
39
+ lazyComponent?: boolean;
40
+ observerOptions?: IntersectionObserverInit;
41
+ };
42
+
43
+ export declare const Lazyload: {
44
+ install(app: App, options?: LazyloadOptions): void;
45
+ };
46
+
47
+ declare module '@vue/runtime-core' {
48
+ interface ComponentCustomProperties {
49
+ $Lazyload: {
50
+ $on: (event: string, handler: Callback) => void;
51
+ $off: (event: string, handler?: Callback) => void;
52
+ $once: (event: string, handler: Callback) => void;
53
+ };
54
+ }
55
+ }
@@ -0,0 +1 @@
1
+ export declare function closest(arr: number[], target: number): number;
@@ -0,0 +1,8 @@
1
+ function closest(arr, target) {
2
+ return arr.reduce(
3
+ (pre, cur) => Math.abs(pre - target) < Math.abs(cur - target) ? pre : cur
4
+ );
5
+ }
6
+ export {
7
+ closest
8
+ };
@@ -11,3 +11,4 @@ export declare const HAPTICS_FEEDBACK = "zt-haptics-feedback";
11
11
  export declare const ELLIPSIS = "zt-ellipsis";
12
12
  export declare const FORM_KEY: InjectionKey<FormProvide>;
13
13
  export declare const LONG_PRESS_START_TIME = 500;
14
+ export declare const TAP_OFFSET = 5;