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
@@ -9,6 +9,7 @@ const HAPTICS_FEEDBACK = "zt-haptics-feedback";
9
9
  const ELLIPSIS = "zt-ellipsis";
10
10
  const FORM_KEY = Symbol("zt-form");
11
11
  const LONG_PRESS_START_TIME = 500;
12
+ const TAP_OFFSET = 5;
12
13
  export {
13
14
  BORDER,
14
15
  BORDER_BOTTOM,
@@ -20,5 +21,6 @@ export {
20
21
  ELLIPSIS,
21
22
  FORM_KEY,
22
23
  HAPTICS_FEEDBACK,
23
- LONG_PRESS_START_TIME
24
+ LONG_PRESS_START_TIME,
25
+ TAP_OFFSET
24
26
  };
@@ -7,3 +7,4 @@ export * from './constant';
7
7
  export * from './validate';
8
8
  export * from './interceptor';
9
9
  export * from './with-install';
10
+ export * from './closest';
@@ -7,3 +7,4 @@ export * from "./constant.mjs";
7
7
  export * from "./validate.mjs";
8
8
  export * from "./interceptor.mjs";
9
9
  export * from "./with-install.mjs";
10
+ export * from "./closest.mjs";
@@ -1,6 +1,6 @@
1
- declare module '*.vue' {
2
- // eslint-disable-next-line
3
- import { DefineComponent } from 'vue';
4
- const Component: DefineComponent;
5
- export default Component;
6
- }
1
+ declare module '*.vue' {
2
+ // eslint-disable-next-line
3
+ import { DefineComponent } from 'vue';
4
+ const Component: DefineComponent;
5
+ export default Component;
6
+ }
@@ -1,23 +1,23 @@
1
- import 'vue';
2
-
3
- type EventHandler = (...args: any[]) => void;
4
-
5
- declare module 'vue' {
6
- interface ComponentCustomProps {
7
- id?: string;
8
- role?: string;
9
- tabindex?: number;
10
- onClick?: EventHandler;
11
- onTouchend?: EventHandler;
12
- onTouchmove?: EventHandler;
13
- onTouchstart?: EventHandler;
14
- onTouchcancel?: EventHandler;
15
- onTouchmovePassive?: EventHandler;
16
- onTouchstartPassive?: EventHandler;
17
- }
18
-
19
- interface HTMLAttributes {
20
- onTouchmovePassive?: EventHandler;
21
- onTouchstartPassive?: EventHandler;
22
- }
23
- }
1
+ import 'vue';
2
+
3
+ type EventHandler = (...args: any[]) => void;
4
+
5
+ declare module 'vue' {
6
+ interface ComponentCustomProps {
7
+ id?: string;
8
+ role?: string;
9
+ tabindex?: number;
10
+ onClick?: EventHandler;
11
+ onTouchend?: EventHandler;
12
+ onTouchmove?: EventHandler;
13
+ onTouchstart?: EventHandler;
14
+ onTouchcancel?: EventHandler;
15
+ onTouchmovePassive?: EventHandler;
16
+ onTouchstartPassive?: EventHandler;
17
+ }
18
+
19
+ interface HTMLAttributes {
20
+ onTouchmovePassive?: EventHandler;
21
+ onTouchstartPassive?: EventHandler;
22
+ }
23
+ }
@@ -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 {};
@@ -21,6 +21,7 @@ __export(stdin_exports, {
21
21
  });
22
22
  module.exports = __toCommonJS(stdin_exports);
23
23
  var import_vue = require("vue");
24
+ var import_utils = require("../utils");
24
25
  function getDirection(x, y) {
25
26
  if (x > y) {
26
27
  return "horizontal";
@@ -38,6 +39,7 @@ function useTouch() {
38
39
  const offsetX = (0, import_vue.ref)(0);
39
40
  const offsetY = (0, import_vue.ref)(0);
40
41
  const direction = (0, import_vue.ref)("");
42
+ const isTap = (0, import_vue.ref)(true);
41
43
  const isVertical = () => direction.value === "vertical";
42
44
  const isHorizontal = () => direction.value === "horizontal";
43
45
  const reset = () => {
@@ -46,6 +48,7 @@ function useTouch() {
46
48
  offsetX.value = 0;
47
49
  offsetY.value = 0;
48
50
  direction.value = "";
51
+ isTap.value = true;
49
52
  };
50
53
  const start = (event) => {
51
54
  reset();
@@ -62,6 +65,9 @@ function useTouch() {
62
65
  if (!direction.value || offsetX.value < LOCK_DIRECTION_DISTANCE && offsetY.value < LOCK_DIRECTION_DISTANCE) {
63
66
  direction.value = getDirection(offsetX.value, offsetY.value);
64
67
  }
68
+ if (isTap.value && (offsetX.value > import_utils.TAP_OFFSET || offsetY.value > import_utils.TAP_OFFSET)) {
69
+ isTap.value = false;
70
+ }
65
71
  };
66
72
  return {
67
73
  move,
@@ -75,6 +81,7 @@ function useTouch() {
75
81
  offsetY,
76
82
  direction,
77
83
  isVertical,
78
- isHorizontal
84
+ isHorizontal,
85
+ isTap
79
86
  };
80
87
  }
@@ -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,210 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name2 in all)
9
+ __defProp(target, name2, { get: all[name2], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+ var stdin_exports = {};
29
+ __export(stdin_exports, {
30
+ default: () => stdin_default,
31
+ floatingBubbleProps: () => floatingBubbleProps
32
+ });
33
+ module.exports = __toCommonJS(stdin_exports);
34
+ var import_vue = require("vue");
35
+ var import_vue2 = require("vue");
36
+ var import_utils = require("../utils");
37
+ var import_use = require("@zartui/use");
38
+ var import_use_touch = require("../composables/use-touch");
39
+ var import_icon = __toESM(require("../icon"));
40
+ const floatingBubbleProps = {
41
+ gap: (0, import_utils.makeNumberProp)(24),
42
+ icon: String,
43
+ axis: (0, import_utils.makeStringProp)("y"),
44
+ magnetic: String,
45
+ offset: {
46
+ type: Object,
47
+ default: () => ({
48
+ x: -1,
49
+ y: -1
50
+ })
51
+ },
52
+ teleport: {
53
+ type: [String, Object],
54
+ default: "body"
55
+ }
56
+ };
57
+ const [name, bem] = (0, import_utils.createNamespace)("floating-bubble");
58
+ var stdin_default = (0, import_vue2.defineComponent)({
59
+ name,
60
+ inheritAttrs: false,
61
+ props: floatingBubbleProps,
62
+ emits: ["click", "update:offset", "offsetChange"],
63
+ setup(props, {
64
+ slots,
65
+ emit,
66
+ attrs
67
+ }) {
68
+ const rootRef = (0, import_vue2.ref)();
69
+ const state = (0, import_vue2.ref)({
70
+ x: 0,
71
+ y: 0,
72
+ width: 0,
73
+ height: 0
74
+ });
75
+ const boundary = (0, import_vue2.computed)(() => ({
76
+ top: props.gap,
77
+ right: import_utils.windowWidth.value - state.value.width - props.gap,
78
+ bottom: import_utils.windowHeight.value - state.value.height - props.gap,
79
+ left: props.gap
80
+ }));
81
+ const dragging = (0, import_vue2.ref)(false);
82
+ let initialized = false;
83
+ const rootStyle = (0, import_vue2.computed)(() => {
84
+ const style = {};
85
+ const x = (0, import_utils.addUnit)(state.value.x);
86
+ const y = (0, import_utils.addUnit)(state.value.y);
87
+ style.transform = `translate3d(${x}, ${y}, 0)`;
88
+ if (dragging.value || !initialized) {
89
+ style.transition = "none";
90
+ }
91
+ return style;
92
+ });
93
+ const updateState = () => {
94
+ if (!show.value)
95
+ return;
96
+ const {
97
+ width,
98
+ height
99
+ } = (0, import_use.useRect)(rootRef.value);
100
+ const {
101
+ offset
102
+ } = props;
103
+ state.value = {
104
+ x: offset.x > -1 ? offset.x : import_utils.windowWidth.value - width - props.gap,
105
+ y: offset.y > -1 ? offset.y : import_utils.windowHeight.value - height - props.gap,
106
+ width,
107
+ height
108
+ };
109
+ };
110
+ const touch = (0, import_use_touch.useTouch)();
111
+ let prevX = 0;
112
+ let prevY = 0;
113
+ const onTouchStart = (e) => {
114
+ touch.start(e);
115
+ dragging.value = true;
116
+ prevX = state.value.x;
117
+ prevY = state.value.y;
118
+ };
119
+ const onTouchMove = (e) => {
120
+ e.preventDefault();
121
+ touch.move(e);
122
+ if (props.axis === "lock")
123
+ return;
124
+ if (!touch.isTap.value) {
125
+ if (props.axis === "x" || props.axis === "xy") {
126
+ let nextX = prevX + touch.deltaX.value;
127
+ if (nextX < boundary.value.left)
128
+ nextX = boundary.value.left;
129
+ if (nextX > boundary.value.right)
130
+ nextX = boundary.value.right;
131
+ state.value.x = nextX;
132
+ }
133
+ if (props.axis === "y" || props.axis === "xy") {
134
+ let nextY = prevY + touch.deltaY.value;
135
+ if (nextY < boundary.value.top)
136
+ nextY = boundary.value.top;
137
+ if (nextY > boundary.value.bottom)
138
+ nextY = boundary.value.bottom;
139
+ state.value.y = nextY;
140
+ }
141
+ const offset = (0, import_utils.pick)(state.value, ["x", "y"]);
142
+ emit("update:offset", offset);
143
+ }
144
+ };
145
+ (0, import_use.useEventListener)("touchmove", onTouchMove, {
146
+ target: rootRef
147
+ });
148
+ const onTouchEnd = () => {
149
+ dragging.value = false;
150
+ (0, import_vue2.nextTick)(() => {
151
+ if (props.magnetic === "x") {
152
+ const nextX = (0, import_utils.closest)([boundary.value.left, boundary.value.right], state.value.x);
153
+ state.value.x = nextX;
154
+ }
155
+ if (props.magnetic === "y") {
156
+ const nextY = (0, import_utils.closest)([boundary.value.top, boundary.value.bottom], state.value.y);
157
+ state.value.y = nextY;
158
+ }
159
+ if (!touch.isTap.value) {
160
+ const offset = (0, import_utils.pick)(state.value, ["x", "y"]);
161
+ emit("update:offset", offset);
162
+ if (prevX !== offset.x || prevY !== offset.y) {
163
+ emit("offsetChange", offset);
164
+ }
165
+ }
166
+ });
167
+ };
168
+ const onClick = (e) => {
169
+ if (touch.isTap.value)
170
+ emit("click", e);
171
+ else
172
+ e.stopPropagation();
173
+ };
174
+ (0, import_vue2.onMounted)(() => {
175
+ updateState();
176
+ (0, import_vue2.nextTick)(() => {
177
+ initialized = true;
178
+ });
179
+ });
180
+ (0, import_vue2.watch)([import_utils.windowWidth, import_utils.windowHeight, () => props.gap, () => props.offset], updateState);
181
+ const show = (0, import_vue2.ref)(true);
182
+ (0, import_vue2.onActivated)(() => {
183
+ show.value = true;
184
+ });
185
+ (0, import_vue2.onDeactivated)(() => {
186
+ if (props.teleport) {
187
+ show.value = false;
188
+ }
189
+ });
190
+ return () => {
191
+ const Content = (0, import_vue.withDirectives)((0, import_vue.createVNode)("div", (0, import_vue.mergeProps)({
192
+ "class": bem(),
193
+ "ref": rootRef,
194
+ "onTouchstartPassive": onTouchStart,
195
+ "onTouchend": onTouchEnd,
196
+ "onTouchcancel": onTouchEnd,
197
+ "onClick": onClick,
198
+ "style": rootStyle.value
199
+ }, attrs), [slots.default ? slots.default() : (0, import_vue.createVNode)(import_icon.default, {
200
+ "name": props.icon,
201
+ "class": bem("icon")
202
+ }, null)]), [[import_vue.vShow, show.value]]);
203
+ return props.teleport ? (0, import_vue.createVNode)(import_vue2.Teleport, {
204
+ "to": props.teleport
205
+ }, {
206
+ default: () => [Content]
207
+ }) : Content;
208
+ };
209
+ }
210
+ });
@@ -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,39 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+ var stdin_exports = {};
29
+ __export(stdin_exports, {
30
+ FloatingBubble: () => FloatingBubble,
31
+ default: () => stdin_default,
32
+ floatingBubbleProps: () => import_FloatingBubble2.floatingBubbleProps
33
+ });
34
+ module.exports = __toCommonJS(stdin_exports);
35
+ var import_utils = require("../utils");
36
+ var import_FloatingBubble = __toESM(require("./FloatingBubble"));
37
+ var import_FloatingBubble2 = require("./FloatingBubble");
38
+ const FloatingBubble = (0, import_utils.withInstall)(import_FloatingBubble.default);
39
+ var stdin_default = FloatingBubble;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ require("../../style/base.css");
2
+ require("../../badge/index.css");
3
+ require("../../icon/index.css");
4
+ require("../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
+ };
@@ -0,0 +1,15 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
+ var stdin_exports = {};
15
+ module.exports = __toCommonJS(stdin_exports);