vft 0.0.425 → 0.0.427

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.
@@ -1,7 +1,7 @@
1
1
  import { keysOf as f } from "@vft/utils";
2
2
  import "@vueuse/core";
3
3
  import { debugWarn as v } from "../../../utils/error.js";
4
- import { ref as g, getCurrentInstance as l, computed as i, unref as p, provide as C, inject as x } from "vue";
4
+ import { getCurrentInstance as l, computed as i, unref as p, provide as g, ref as C, inject as x } from "vue";
5
5
  import "lodash-es";
6
6
  import "../../form/index.js";
7
7
  import { namespaceContextKey as I, useNamespace as b, defaultNamespace as y } from "../../../hooks/use-namespace/index.js";
@@ -9,7 +9,7 @@ import "../../../hooks/use-model-toggle/index.js";
9
9
  import "@popperjs/core";
10
10
  import { zIndexContextKey as G, useZIndex as z, defaultInitialZIndex as K } from "../../../hooks/use-z-index/index.js";
11
11
  import { configProviderContextKey as m } from "../constants.js";
12
- const a = g();
12
+ const a = C();
13
13
  function d(o, e = void 0) {
14
14
  const n = l() ? x(m, a) : a;
15
15
  return o ? i(() => n?.value?.[o] ?? e) : n;
@@ -27,7 +27,7 @@ function B(o) {
27
27
  };
28
28
  }
29
29
  const S = (o, e, n = !1) => {
30
- const t = !!l(), r = t ? d() : void 0, u = e?.provide ?? (t ? C : void 0);
30
+ const t = !!l(), r = t ? d() : void 0, u = e?.provide ?? (t ? g : void 0);
31
31
  if (!u) {
32
32
  v(
33
33
  "provideGlobalConfig",
@@ -4,7 +4,9 @@ declare function __VLS_template(): {
4
4
  error?(_: {}): any;
5
5
  viewer?(_: {}): any;
6
6
  };
7
- declare const __VLS_component: import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<ImageProps>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
7
+ declare const __VLS_component: import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<ImageProps>>, {
8
+ isLoading: import("vue").Ref<boolean, boolean>;
9
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
8
10
  switch: (...args: any[]) => void;
9
11
  close: (...args: any[]) => void;
10
12
  error: (...args: any[]) => void;
@@ -1,20 +1,20 @@
1
- import { defineComponent as $, useAttrs as R, ref as o, computed as d, watch as W, onMounted as G, createElementBlock as f, openBlock as s, normalizeStyle as J, normalizeClass as y, unref as l, createCommentVNode as u, mergeProps as Q, renderSlot as L, createElementVNode as V, Fragment as U, createBlock as X, withCtx as Z, nextTick as _ } from "vue";
2
- import { useAttrs as ee } from "@vft/use";
3
- import { isInContainer as te, isElement as le, isString as re, getScrollContainer as ne } from "@vft/utils";
4
- import { VftImageViewer as ae } from "../image-viewer/index.js";
5
- import { isClient as v, useThrottleFn as ie, useEventListener as T } from "@vueuse/core";
1
+ import { defineComponent as $, useAttrs as W, ref as o, computed as d, watch as G, onMounted as J, createElementBlock as f, openBlock as s, normalizeStyle as Q, normalizeClass as y, unref as l, createCommentVNode as u, mergeProps as U, renderSlot as L, createElementVNode as V, Fragment as X, createBlock as Z, withCtx as _, nextTick as ee } from "vue";
2
+ import { useAttrs as te } from "@vft/use";
3
+ import { isInContainer as le, isElement as re, isString as ne, getScrollContainer as ae } from "@vft/utils";
4
+ import { VftImageViewer as ie } from "../image-viewer/index.js";
5
+ import { isClient as v, useThrottleFn as oe, useEventListener as T } from "@vueuse/core";
6
6
  import "../config-provider/hooks/use-global-config.js";
7
7
  import "lodash-es";
8
8
  import "../form/index.js";
9
- import { useNamespace as oe } from "../../hooks/use-namespace/index.js";
9
+ import { useNamespace as se } from "../../hooks/use-namespace/index.js";
10
10
  import "../../hooks/use-model-toggle/index.js";
11
11
  import "@popperjs/core";
12
12
  import "../../hooks/use-z-index/index.js";
13
- const se = ["src", "loading"], ue = { key: 0 }, ce = $({
13
+ const ue = ["src", "loading"], ce = { key: 0 }, de = $({
14
14
  name: "vft-image",
15
15
  inheritAttrs: !1
16
- }), Se = /* @__PURE__ */ $({
17
- ...ce,
16
+ }), Ie = /* @__PURE__ */ $({
17
+ ...de,
18
18
  props: {
19
19
  hideOnClickModal: { type: Boolean, default: !1 },
20
20
  src: { default: "" },
@@ -30,38 +30,38 @@ const se = ["src", "loading"], ue = { key: 0 }, ce = $({
30
30
  closeOnPressEscape: { type: Boolean, default: !0 }
31
31
  },
32
32
  emits: ["load", "error", "switch", "close", "show"],
33
- setup(t, { emit: b }) {
34
- const n = oe("image"), c = b;
33
+ setup(t, { expose: b, emit: M }) {
34
+ const a = se("image"), c = M;
35
35
  let k = "";
36
- const M = R(), O = ee(), w = o(), a = o(!1), i = o(!0), h = o(!1), m = o(), r = o(), H = v && "loading" in HTMLImageElement.prototype;
36
+ const O = W(), H = te(), w = o(), i = o(!1), r = o(!0), h = o(!1), m = o(), n = o(), x = v && "loading" in HTMLImageElement.prototype;
37
37
  let C, z;
38
- const F = d(() => M.style), N = d(() => v && t.fit ? { objectFit: t.fit } : {}), p = d(() => Array.isArray(t.previewSrcList) && t.previewSrcList.length > 0), P = d(() => {
38
+ const F = d(() => O.style), N = d(() => v && t.fit ? { objectFit: t.fit } : {}), p = d(() => Array.isArray(t.previewSrcList) && t.previewSrcList.length > 0), P = d(() => {
39
39
  let e = t.initialIndex;
40
40
  return t.initialIndex > t.previewSrcList.length - 1 && (e = 0), e;
41
- }), S = d(() => t.loading === "eager" ? !1 : !H && t.loading === "lazy" || t.lazy), g = () => {
42
- v && (i.value = !0, a.value = !1, w.value = t.src);
41
+ }), S = d(() => t.loading === "eager" ? !1 : !x && t.loading === "lazy" || t.lazy), g = () => {
42
+ v && (r.value = !0, i.value = !1, w.value = t.src);
43
43
  };
44
- function x(e) {
45
- i.value = !1, a.value = !1, c("load", e);
46
- }
47
44
  function D(e) {
48
- i.value = !1, a.value = !0, c("error", e);
45
+ r.value = !1, i.value = !1, c("load", e);
46
+ }
47
+ function Y(e) {
48
+ r.value = !1, i.value = !0, c("error", e);
49
49
  }
50
50
  function I() {
51
- te(m.value, r.value) && (g(), A());
51
+ le(m.value, n.value) && (g(), A());
52
52
  }
53
- const E = ie(I, 200);
53
+ const E = oe(I, 200);
54
54
  async function B() {
55
- v && (await _(), le(t.scrollContainer) ? r.value = t.scrollContainer : re(t.scrollContainer) && t.scrollContainer !== "" ? r.value = document.querySelector(t.scrollContainer) ?? void 0 : m.value && (r.value = ne(m.value)), r.value && (C = T(
56
- r,
55
+ v && (await ee(), re(t.scrollContainer) ? n.value = t.scrollContainer : ne(t.scrollContainer) && t.scrollContainer !== "" ? n.value = document.querySelector(t.scrollContainer) ?? void 0 : m.value && (n.value = ae(m.value)), n.value && (C = T(
56
+ n,
57
57
  "scroll",
58
58
  E
59
59
  ), setTimeout(() => I(), 100)));
60
60
  }
61
61
  function A() {
62
- !v || !r.value || !E || (C?.(), r.value = void 0);
62
+ !v || !n.value || !E || (C?.(), n.value = void 0);
63
63
  }
64
- function Y(e) {
64
+ function j(e) {
65
65
  if (e.ctrlKey) {
66
66
  if (e.deltaY < 0)
67
67
  return e.preventDefault(), !1;
@@ -69,60 +69,62 @@ const se = ["src", "loading"], ue = { key: 0 }, ce = $({
69
69
  return e.preventDefault(), !1;
70
70
  }
71
71
  }
72
- function j() {
73
- p.value && (z = T("wheel", Y, {
72
+ function q() {
73
+ p.value && (z = T("wheel", j, {
74
74
  passive: !1
75
75
  }), k = document.body.style.overflow, document.body.style.overflow = "hidden", h.value = !0, c("show"));
76
76
  }
77
- function q() {
77
+ function K() {
78
78
  z?.(), document.body.style.overflow = k, h.value = !1, c("close");
79
79
  }
80
- function K(e) {
80
+ function R(e) {
81
81
  c("switch", e);
82
82
  }
83
- return W(
83
+ return G(
84
84
  () => t.src,
85
85
  () => {
86
- S.value ? (i.value = !0, a.value = !1, A(), B()) : g();
86
+ S.value ? (r.value = !0, i.value = !1, A(), B()) : g();
87
87
  }
88
- ), G(() => {
88
+ ), J(() => {
89
89
  S.value ? B() : g();
90
- }), (e, de) => (s(), f("div", {
90
+ }), b({
91
+ isLoading: r
92
+ }), (e, fe) => (s(), f("div", {
91
93
  ref_key: "container",
92
94
  ref: m,
93
- class: y([l(n).b(), e.$attrs.class]),
94
- style: J(F.value)
95
+ class: y([l(a).b(), e.$attrs.class]),
96
+ style: Q(F.value)
95
97
  }, [
96
- w.value !== void 0 && !a.value ? (s(), f("img", Q({ key: 0 }, l(O), {
98
+ w.value !== void 0 && !i.value ? (s(), f("img", U({ key: 0 }, l(H), {
97
99
  src: w.value,
98
100
  loading: e.loading,
99
101
  style: N.value,
100
102
  class: [
101
- l(n).e("inner"),
102
- p.value && l(n).e("preview"),
103
- i.value && l(n).is("loading")
103
+ l(a).e("inner"),
104
+ p.value && l(a).e("preview"),
105
+ r.value && l(a).is("loading")
104
106
  ],
105
- onClick: j,
106
- onLoad: x,
107
- onError: D,
107
+ onClick: q,
108
+ onLoad: D,
109
+ onError: Y,
108
110
  alt: ""
109
- }), null, 16, se)) : u("", !0),
110
- i.value || a.value ? (s(), f("div", {
111
+ }), null, 16, ue)) : u("", !0),
112
+ r.value || i.value ? (s(), f("div", {
111
113
  key: 1,
112
- class: y(l(n).e("wrapper"))
114
+ class: y(l(a).e("wrapper"))
113
115
  }, [
114
- i.value ? L(e.$slots, "placeholder", { key: 0 }, () => [
116
+ r.value ? L(e.$slots, "placeholder", { key: 0 }, () => [
115
117
  V("div", {
116
- class: y(l(n).e("placeholder"))
118
+ class: y(l(a).e("placeholder"))
117
119
  }, null, 2)
118
- ]) : a.value ? L(e.$slots, "error", { key: 1 }, () => [
120
+ ]) : i.value ? L(e.$slots, "error", { key: 1 }, () => [
119
121
  V("div", {
120
- class: y(l(n).e("error"))
122
+ class: y(l(a).e("error"))
121
123
  }, "加载失败", 2)
122
124
  ]) : u("", !0)
123
125
  ], 2)) : u("", !0),
124
- p.value ? (s(), f(U, { key: 2 }, [
125
- h.value ? (s(), X(l(ae), {
126
+ p.value ? (s(), f(X, { key: 2 }, [
127
+ h.value ? (s(), Z(l(ie), {
126
128
  key: 0,
127
129
  "z-index": e.zIndex,
128
130
  "initial-index": P.value,
@@ -132,11 +134,11 @@ const se = ["src", "loading"], ue = { key: 0 }, ce = $({
132
134
  "hide-on-click-modal": e.hideOnClickModal,
133
135
  teleported: e.previewTeleported,
134
136
  "close-on-press-escape": e.closeOnPressEscape,
135
- onClose: q,
136
- onSwitch: K
137
+ onClose: K,
138
+ onSwitch: R
137
139
  }, {
138
- default: Z(() => [
139
- e.$slots.viewer ? (s(), f("div", ue, [
140
+ default: _(() => [
141
+ e.$slots.viewer ? (s(), f("div", ce, [
140
142
  L(e.$slots, "viewer")
141
143
  ])) : u("", !0)
142
144
  ]),
@@ -147,5 +149,5 @@ const se = ["src", "loading"], ue = { key: 0 }, ce = $({
147
149
  }
148
150
  });
149
151
  export {
150
- Se as default
152
+ Ie as default
151
153
  };
@@ -42,7 +42,9 @@ export declare const VftImage: import("vft/es/utils").SFCWithInstall<{
42
42
  onError?: ((...args: any[]) => any) | undefined;
43
43
  onLoad?: ((...args: any[]) => any) | undefined;
44
44
  onShow?: ((...args: any[]) => any) | undefined;
45
- }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
45
+ }>, {
46
+ isLoading: import("vue").Ref<boolean, boolean>;
47
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
46
48
  switch: (...args: any[]) => void;
47
49
  close: (...args: any[]) => void;
48
50
  error: (...args: any[]) => void;
@@ -98,7 +100,9 @@ export declare const VftImage: import("vft/es/utils").SFCWithInstall<{
98
100
  onError?: ((...args: any[]) => any) | undefined;
99
101
  onLoad?: ((...args: any[]) => any) | undefined;
100
102
  onShow?: ((...args: any[]) => any) | undefined;
101
- }>, {}, {}, {}, {}, {}>;
103
+ }>, {
104
+ isLoading: import("vue").Ref<boolean, boolean>;
105
+ }, {}, {}, {}, {}>;
102
106
  __isFragment?: never;
103
107
  __isTeleport?: never;
104
108
  __isSuspense?: never;
@@ -145,7 +149,9 @@ export declare const VftImage: import("vft/es/utils").SFCWithInstall<{
145
149
  onError?: ((...args: any[]) => any) | undefined;
146
150
  onLoad?: ((...args: any[]) => any) | undefined;
147
151
  onShow?: ((...args: any[]) => any) | undefined;
148
- }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
152
+ }>, {
153
+ isLoading: import("vue").Ref<boolean, boolean>;
154
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
149
155
  switch: (...args: any[]) => void;
150
156
  close: (...args: any[]) => void;
151
157
  error: (...args: any[]) => void;
@@ -1,6 +1,6 @@
1
1
  declare const _default: {
2
2
  "name": "vft",
3
- "version": "0.0.425",
3
+ "version": "0.0.427",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.cjs",
6
6
  "module": "es/index.js",
@@ -1,4 +1,4 @@
1
- const o = "0.0.425";
1
+ const o = "0.0.427";
2
2
  export {
3
3
  o as version
4
4
  };
@@ -4,7 +4,9 @@ declare function __VLS_template(): {
4
4
  error?(_: {}): any;
5
5
  viewer?(_: {}): any;
6
6
  };
7
- declare const __VLS_component: import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<ImageProps>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
7
+ declare const __VLS_component: import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<ImageProps>>, {
8
+ isLoading: import("vue").Ref<boolean, boolean>;
9
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
8
10
  switch: (...args: any[]) => void;
9
11
  close: (...args: any[]) => void;
10
12
  error: (...args: any[]) => void;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),$=require("@vft/use"),c=require("@vft/utils"),H=require("../image-viewer/index.cjs"),r=require("@vueuse/core");require("../config-provider/hooks/use-global-config.cjs");require("lodash-es");require("../form/index.cjs");const P=require("../../hooks/use-namespace/index.cjs");require("../../hooks/use-model-toggle/index.cjs");require("@popperjs/core");require("../../hooks/use-z-index/index.cjs");const x=["src","loading"],F={key:0},j=e.defineComponent({name:"vft-image",inheritAttrs:!1}),D=e.defineComponent({...j,props:{hideOnClickModal:{type:Boolean,default:!1},src:{default:""},fit:{default:""},loading:{},lazy:{type:Boolean},scrollContainer:{},previewSrcList:{default:()=>[]},previewTeleported:{type:Boolean,default:!1},zIndex:{},initialIndex:{default:0},infinite:{type:Boolean,default:!0},closeOnPressEscape:{type:Boolean,default:!0}},emits:["load","error","switch","close","show"],setup(l,{emit:z}){const o=P.useNamespace("image"),s=z;let y="";const S=e.useAttrs(),B=$.useAttrs(),d=e.ref(),i=e.ref(!1),a=e.ref(!0),f=e.ref(!1),u=e.ref(),n=e.ref(),E=r.isClient&&"loading"in HTMLImageElement.prototype;let w,C;const q=e.computed(()=>S.style),V=e.computed(()=>r.isClient&&l.fit?{objectFit:l.fit}:{}),v=e.computed(()=>Array.isArray(l.previewSrcList)&&l.previewSrcList.length>0),I=e.computed(()=>{let t=l.initialIndex;return l.initialIndex>l.previewSrcList.length-1&&(t=0),t}),h=e.computed(()=>l.loading==="eager"?!1:!E&&l.loading==="lazy"||l.lazy),m=()=>{r.isClient&&(a.value=!0,i.value=!1,d.value=l.src)};function N(t){a.value=!1,i.value=!1,s("load",t)}function b(t){a.value=!1,i.value=!0,s("error",t)}function g(){c.isInContainer(u.value,n.value)&&(m(),L())}const k=r.useThrottleFn(g,200);async function p(){r.isClient&&(await e.nextTick(),c.isElement(l.scrollContainer)?n.value=l.scrollContainer:c.isString(l.scrollContainer)&&l.scrollContainer!==""?n.value=document.querySelector(l.scrollContainer)??void 0:u.value&&(n.value=c.getScrollContainer(u.value)),n.value&&(w=r.useEventListener(n,"scroll",k),setTimeout(()=>g(),100)))}function L(){!r.isClient||!n.value||!k||(w?.(),n.value=void 0)}function M(t){if(t.ctrlKey){if(t.deltaY<0)return t.preventDefault(),!1;if(t.deltaY>0)return t.preventDefault(),!1}}function T(){v.value&&(C=r.useEventListener("wheel",M,{passive:!1}),y=document.body.style.overflow,document.body.style.overflow="hidden",f.value=!0,s("show"))}function A(){C?.(),document.body.style.overflow=y,f.value=!1,s("close")}function O(t){s("switch",t)}return e.watch(()=>l.src,()=>{h.value?(a.value=!0,i.value=!1,L(),p()):m()}),e.onMounted(()=>{h.value?p():m()}),(t,Y)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"container",ref:u,class:e.normalizeClass([e.unref(o).b(),t.$attrs.class]),style:e.normalizeStyle(q.value)},[d.value!==void 0&&!i.value?(e.openBlock(),e.createElementBlock("img",e.mergeProps({key:0},e.unref(B),{src:d.value,loading:t.loading,style:V.value,class:[e.unref(o).e("inner"),v.value&&e.unref(o).e("preview"),a.value&&e.unref(o).is("loading")],onClick:T,onLoad:N,onError:b,alt:""}),null,16,x)):e.createCommentVNode("",!0),a.value||i.value?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(e.unref(o).e("wrapper"))},[a.value?e.renderSlot(t.$slots,"placeholder",{key:0},()=>[e.createElementVNode("div",{class:e.normalizeClass(e.unref(o).e("placeholder"))},null,2)]):i.value?e.renderSlot(t.$slots,"error",{key:1},()=>[e.createElementVNode("div",{class:e.normalizeClass(e.unref(o).e("error"))},"加载失败",2)]):e.createCommentVNode("",!0)],2)):e.createCommentVNode("",!0),v.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[f.value?(e.openBlock(),e.createBlock(e.unref(H.VftImageViewer),{key:0,"z-index":t.zIndex,"initial-index":I.value,infinite:t.infinite,"zoom-rate":t.zoomRate,"url-list":t.previewSrcList,"hide-on-click-modal":t.hideOnClickModal,teleported:t.previewTeleported,"close-on-press-escape":t.closeOnPressEscape,onClose:A,onSwitch:O},{default:e.withCtx(()=>[t.$slots.viewer?(e.openBlock(),e.createElementBlock("div",F,[e.renderSlot(t.$slots,"viewer")])):e.createCommentVNode("",!0)]),_:3},8,["z-index","initial-index","infinite","zoom-rate","url-list","hide-on-click-modal","teleported","close-on-press-escape"])):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0)],6))}});exports.default=D;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),x=require("@vft/use"),c=require("@vft/utils"),H=require("../image-viewer/index.cjs"),o=require("@vueuse/core");require("../config-provider/hooks/use-global-config.cjs");require("lodash-es");require("../form/index.cjs");const P=require("../../hooks/use-namespace/index.cjs");require("../../hooks/use-model-toggle/index.cjs");require("@popperjs/core");require("../../hooks/use-z-index/index.cjs");const F=["src","loading"],j={key:0},D=e.defineComponent({name:"vft-image",inheritAttrs:!1}),Y=e.defineComponent({...D,props:{hideOnClickModal:{type:Boolean,default:!1},src:{default:""},fit:{default:""},loading:{},lazy:{type:Boolean},scrollContainer:{},previewSrcList:{default:()=>[]},previewTeleported:{type:Boolean,default:!1},zIndex:{},initialIndex:{default:0},infinite:{type:Boolean,default:!0},closeOnPressEscape:{type:Boolean,default:!0}},emits:["load","error","switch","close","show"],setup(l,{expose:z,emit:S}){const i=P.useNamespace("image"),s=S;let y="";const B=e.useAttrs(),E=x.useAttrs(),d=e.ref(),a=e.ref(!1),n=e.ref(!0),f=e.ref(!1),u=e.ref(),r=e.ref(),q=o.isClient&&"loading"in HTMLImageElement.prototype;let w,C;const V=e.computed(()=>B.style),I=e.computed(()=>o.isClient&&l.fit?{objectFit:l.fit}:{}),v=e.computed(()=>Array.isArray(l.previewSrcList)&&l.previewSrcList.length>0),N=e.computed(()=>{let t=l.initialIndex;return l.initialIndex>l.previewSrcList.length-1&&(t=0),t}),h=e.computed(()=>l.loading==="eager"?!1:!q&&l.loading==="lazy"||l.lazy),m=()=>{o.isClient&&(n.value=!0,a.value=!1,d.value=l.src)};function b(t){n.value=!1,a.value=!1,s("load",t)}function M(t){n.value=!1,a.value=!0,s("error",t)}function g(){c.isInContainer(u.value,r.value)&&(m(),L())}const k=o.useThrottleFn(g,200);async function p(){o.isClient&&(await e.nextTick(),c.isElement(l.scrollContainer)?r.value=l.scrollContainer:c.isString(l.scrollContainer)&&l.scrollContainer!==""?r.value=document.querySelector(l.scrollContainer)??void 0:u.value&&(r.value=c.getScrollContainer(u.value)),r.value&&(w=o.useEventListener(r,"scroll",k),setTimeout(()=>g(),100)))}function L(){!o.isClient||!r.value||!k||(w?.(),r.value=void 0)}function T(t){if(t.ctrlKey){if(t.deltaY<0)return t.preventDefault(),!1;if(t.deltaY>0)return t.preventDefault(),!1}}function A(){v.value&&(C=o.useEventListener("wheel",T,{passive:!1}),y=document.body.style.overflow,document.body.style.overflow="hidden",f.value=!0,s("show"))}function O(){C?.(),document.body.style.overflow=y,f.value=!1,s("close")}function $(t){s("switch",t)}return e.watch(()=>l.src,()=>{h.value?(n.value=!0,a.value=!1,L(),p()):m()}),e.onMounted(()=>{h.value?p():m()}),z({isLoading:n}),(t,K)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"container",ref:u,class:e.normalizeClass([e.unref(i).b(),t.$attrs.class]),style:e.normalizeStyle(V.value)},[d.value!==void 0&&!a.value?(e.openBlock(),e.createElementBlock("img",e.mergeProps({key:0},e.unref(E),{src:d.value,loading:t.loading,style:I.value,class:[e.unref(i).e("inner"),v.value&&e.unref(i).e("preview"),n.value&&e.unref(i).is("loading")],onClick:A,onLoad:b,onError:M,alt:""}),null,16,F)):e.createCommentVNode("",!0),n.value||a.value?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(e.unref(i).e("wrapper"))},[n.value?e.renderSlot(t.$slots,"placeholder",{key:0},()=>[e.createElementVNode("div",{class:e.normalizeClass(e.unref(i).e("placeholder"))},null,2)]):a.value?e.renderSlot(t.$slots,"error",{key:1},()=>[e.createElementVNode("div",{class:e.normalizeClass(e.unref(i).e("error"))},"加载失败",2)]):e.createCommentVNode("",!0)],2)):e.createCommentVNode("",!0),v.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[f.value?(e.openBlock(),e.createBlock(e.unref(H.VftImageViewer),{key:0,"z-index":t.zIndex,"initial-index":N.value,infinite:t.infinite,"zoom-rate":t.zoomRate,"url-list":t.previewSrcList,"hide-on-click-modal":t.hideOnClickModal,teleported:t.previewTeleported,"close-on-press-escape":t.closeOnPressEscape,onClose:O,onSwitch:$},{default:e.withCtx(()=>[t.$slots.viewer?(e.openBlock(),e.createElementBlock("div",j,[e.renderSlot(t.$slots,"viewer")])):e.createCommentVNode("",!0)]),_:3},8,["z-index","initial-index","infinite","zoom-rate","url-list","hide-on-click-modal","teleported","close-on-press-escape"])):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0)],6))}});exports.default=Y;
@@ -42,7 +42,9 @@ export declare const VftImage: import("vft/es/utils").SFCWithInstall<{
42
42
  onError?: ((...args: any[]) => any) | undefined;
43
43
  onLoad?: ((...args: any[]) => any) | undefined;
44
44
  onShow?: ((...args: any[]) => any) | undefined;
45
- }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
45
+ }>, {
46
+ isLoading: import("vue").Ref<boolean, boolean>;
47
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
46
48
  switch: (...args: any[]) => void;
47
49
  close: (...args: any[]) => void;
48
50
  error: (...args: any[]) => void;
@@ -98,7 +100,9 @@ export declare const VftImage: import("vft/es/utils").SFCWithInstall<{
98
100
  onError?: ((...args: any[]) => any) | undefined;
99
101
  onLoad?: ((...args: any[]) => any) | undefined;
100
102
  onShow?: ((...args: any[]) => any) | undefined;
101
- }>, {}, {}, {}, {}, {}>;
103
+ }>, {
104
+ isLoading: import("vue").Ref<boolean, boolean>;
105
+ }, {}, {}, {}, {}>;
102
106
  __isFragment?: never;
103
107
  __isTeleport?: never;
104
108
  __isSuspense?: never;
@@ -145,7 +149,9 @@ export declare const VftImage: import("vft/es/utils").SFCWithInstall<{
145
149
  onError?: ((...args: any[]) => any) | undefined;
146
150
  onLoad?: ((...args: any[]) => any) | undefined;
147
151
  onShow?: ((...args: any[]) => any) | undefined;
148
- }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
152
+ }>, {
153
+ isLoading: import("vue").Ref<boolean, boolean>;
154
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
149
155
  switch: (...args: any[]) => void;
150
156
  close: (...args: any[]) => void;
151
157
  error: (...args: any[]) => void;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="0.0.425";exports.version=e;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="0.0.427";exports.version=e;
@@ -1,6 +1,6 @@
1
1
  declare const _default: {
2
2
  "name": "vft",
3
- "version": "0.0.425",
3
+ "version": "0.0.427",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.cjs",
6
6
  "module": "es/index.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vft",
3
- "version": "0.0.425",
3
+ "version": "0.0.427",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.cjs",
6
6
  "module": "es/index.js",
@@ -55,12 +55,12 @@
55
55
  "resize-detector": "0.3.0",
56
56
  "sortablejs": "1.15.0",
57
57
  "photoswipe": "5.4.4",
58
- "@vft/constants": "0.0.72",
59
- "@vft/store": "0.0.54",
58
+ "@vft/constants": "0.0.74",
59
+ "@vft/use": "0.0.87",
60
60
  "@vft/router": "0.0.67",
61
- "@vft/use": "0.0.86",
62
- "@vft/utils": "0.0.143",
63
- "@vft/directives": "0.0.36"
61
+ "@vft/store": "0.0.54",
62
+ "@vft/directives": "0.0.36",
63
+ "@vft/utils": "0.0.143"
64
64
  },
65
65
  "vetur": {
66
66
  "tags": "tags.json",