@fewangsit/wangsvue-fats 1.0.1-alpha.37 → 1.0.1-alpha.38

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/image/index.es.js CHANGED
@@ -1,11 +1,11 @@
1
- import { defineComponent as M, computed as I, onMounted as W, onUnmounted as Z, shallowRef as d, createBlock as q, openBlock as u, unref as D, withCtx as b, createElementBlock as g, normalizeStyle as k, Fragment as z, createElementVNode as $, renderList as O, withDirectives as x, vShow as H, withModifiers as P, createVNode as C, normalizeClass as _, mergeProps as T } from "vue";
2
- import { c as J } from "../vendor/@vueuse/core/index.es.js";
3
- import { u as K } from "../plugins/WangsVue.es.js";
4
- import { m as Q } from "../utils/mergePropsWithDefaults.util.es.js";
5
- import { s as X } from "../vendor/primevue/image/image.esm.es.js";
1
+ import { defineComponent as W, computed as I, onMounted as Z, onUnmounted as q, shallowRef as d, createBlock as x, openBlock as m, unref as $, withCtx as k, createElementBlock as g, normalizeStyle as z, Fragment as L, createElementVNode as j, renderList as D, withDirectives as H, vShow as J, withModifiers as P, createVNode as R, normalizeClass as U, mergeProps as T } from "vue";
2
+ import { c as K } from "../vendor/@vueuse/core/index.es.js";
3
+ import { u as Q } from "../plugins/WangsVue.es.js";
4
+ import { m as X } from "../utils/mergePropsWithDefaults.util.es.js";
5
+ import { s as Y } from "../vendor/primevue/image/image.esm.es.js";
6
6
  import { _ as E } from "../button/index.es.js";
7
- import { _ as Y } from "../icon/index.es.js";
8
- const ee = ["src"], te = ["src"], ae = ["src"], re = ["src", "onClick"], me = /* @__PURE__ */ M({
7
+ import { _ as ee } from "../icon/index.es.js";
8
+ const te = ["src"], ae = ["src"], oe = ["src"], le = ["src", "onClick"], ge = /* @__PURE__ */ W({
9
9
  __name: "Image",
10
10
  props: {
11
11
  src: {},
@@ -26,117 +26,123 @@ const ee = ["src"], te = ["src"], ae = ["src"], re = ["src", "onClick"], me = /*
26
26
  placeholder: {}
27
27
  },
28
28
  setup(F) {
29
- const a = F, { defaultProps: N } = K("Image"), i = I(() => Q(a, N));
30
- W(() => {
29
+ const a = F, { defaultProps: N } = Q("Image"), i = I(() => X(a, N));
30
+ Z(() => {
31
31
  setTimeout(() => {
32
- L();
32
+ _();
33
33
  }, 3e3);
34
- }), Z(() => {
35
- w();
34
+ }), q(() => {
35
+ h(), typeof n.value == "string" && n.value.includes("blob") && URL.revokeObjectURL(n.value);
36
+ for (const e of y) URL.revokeObjectURL(e);
36
37
  });
37
- const s = d(0), p = d(), S = d(), f = d(!1), V = I(() => {
38
+ const s = d(0), p = d(), C = d(), f = d(!1), y = [], V = I(() => {
38
39
  var e;
39
- return a.preview === !1 ? !1 : !f.value && !((e = m.value) != null && e.toString().includes("data:image/png;base64")) && m.value !== i.value.placeholder;
40
- }), j = () => {
40
+ return a.preview === !1 ? !1 : !f.value && !((e = n.value) != null && e.toString().includes("data:image/png;base64")) && n.value !== i.value.placeholder;
41
+ }), A = () => {
41
42
  const e = a.galleries ?? [];
42
- s.value = (s.value + 1) % e.length, h();
43
- }, A = () => {
43
+ s.value = (s.value + 1) % e.length, b();
44
+ }, G = () => {
44
45
  const e = a.galleries ?? [];
45
- s.value = (s.value - 1 + e.length) % e.length, h();
46
- }, L = () => {
46
+ s.value = (s.value - 1 + e.length) % e.length, b();
47
+ }, _ = () => {
47
48
  var e;
48
- w(), (e = a.galleries) != null && e.length && (p.value = window.setInterval(() => {
49
+ h(), (e = a.galleries) != null && e.length && (p.value = window.setInterval(() => {
49
50
  const t = a.galleries ?? [];
50
51
  s.value = (s.value + 1) % t.length;
51
52
  }, 3e3));
52
- }, w = () => {
53
+ }, h = () => {
53
54
  p.value && (window.clearInterval(p.value), p.value = void 0);
54
- }, R = I(() => a.width != null ? a.width : a.size === "small" ? 30 : a.size === "medium" ? 80 : 125), m = J(
55
+ }, S = I(() => a.width != null ? a.width : a.size === "small" ? 30 : a.size === "medium" ? 80 : 125), n = K(
55
56
  async () => {
56
57
  var e, t;
57
- return !a.src || f.value ? i.value.placeholder : typeof a.src == "string" ? (a.src.includes("http") || // From public image or ObjectURL from Blob e.g 'blob:http://localhost:5173/ca48705d-1fc1-4a74-af38-353ffce7e02a'
58
- /^data:image\/[a-zA-Z0-9.+-]+;base64,/.test(a.src) ? a.src : await ((t = (e = i.value).getImageURL) == null ? void 0 : t.call(e, a.src, R.value))) || i.value.placeholder : a.src;
58
+ if (!a.src || f.value) return i.value.placeholder;
59
+ if (typeof a.src == "string") {
60
+ const o = a.src.includes("http") || // From public image or ObjectURL from Blob e.g 'blob:http://localhost:5173/ca48705d-1fc1-4a74-af38-353ffce7e02a'
61
+ /^data:image\/[a-zA-Z0-9.+-]+;base64,/.test(a.src) ? a.src : await ((t = (e = i.value).getImageURL) == null ? void 0 : t.call(e, a.src, S.value));
62
+ return typeof o == "string" && o.includes("blob") && y.push(o), o || i.value.placeholder;
63
+ }
64
+ return a.src;
59
65
  },
60
66
  i.value.placeholder
61
67
  // Show placeholder while fetching image
62
- ), y = d(), G = async () => {
63
- var t, r, o, c;
64
- if (y.value != null) return;
65
- let e = m.value;
68
+ ), w = d(), M = async () => {
69
+ var t, o, l, u;
70
+ if (w.value != null) return;
71
+ let e = n.value;
66
72
  if (typeof e == "string") {
67
- const l = (r = (t = i.value).getImageURL) == null ? void 0 : r.call(
73
+ const r = (o = (t = i.value).getImageURL) == null ? void 0 : o.call(
68
74
  t,
69
75
  "preview",
70
76
  void 0,
71
77
  void 0,
72
78
  !0
73
- ), n = typeof l == "string" && !(l != null && l.includes("undefined")) ? new URL(l).origin : "", B = n && e.includes(n) || // For getImageURL that return the image full url
74
- l instanceof Promise;
79
+ ), c = typeof r == "string" && !(r != null && r.includes("undefined")) ? new URL(r).origin : "", B = c && e.includes(c) || // For getImageURL that return the image full url
80
+ r instanceof Promise;
75
81
  e = e.includes("http") && !B || // From public resource
76
- e.includes("data:image/svg+xml") ? e : await ((c = (o = i.value).getImageURL) == null ? void 0 : c.call(o, a.src));
82
+ e.includes("data:image/svg+xml") ? e : await ((u = (l = i.value).getImageURL) == null ? void 0 : u.call(l, a.src));
77
83
  }
78
- y.value = e || i.value.placeholder;
79
- }, h = (e) => {
80
- w(), typeof e == "number" && (s.value = e), S.value ? window.clearTimeout(S.value) : window.setTimeout(L, 3e3);
84
+ typeof e == "string" && e.includes("blob") && y.push(e), w.value = e || i.value.placeholder;
85
+ }, b = (e) => {
86
+ h(), typeof e == "number" && (s.value = e), C.value ? window.clearTimeout(C.value) : window.setTimeout(_, 3e3);
81
87
  }, v = (e) => {
82
- var r;
83
- const t = (r = e.target) == null ? void 0 : r.src;
84
- (t === m.value || t.includes(m.value.toString())) && (f.value = !0);
85
- }, U = (e) => {
86
- var r, o, c;
88
+ var o;
89
+ const t = (o = e.target) == null ? void 0 : o.src;
90
+ (t === n.value || t.includes(n.value.toString())) && (f.value = !0);
91
+ }, O = (e) => {
92
+ var o, l, u;
87
93
  const t = e;
88
- return typeof t == "string" ? t.includes("http") ? t : (c = (o = (r = i.value).getImageURL) == null ? void 0 : o.call(r, t)) == null ? void 0 : c.toString() : t;
94
+ return typeof t == "string" ? t.includes("http") ? t : (u = (l = (o = i.value).getImageURL) == null ? void 0 : l.call(o, t)) == null ? void 0 : u.toString() : t;
89
95
  };
90
96
  return (e, t) => {
91
- var r;
92
- return u(), q(D(X), {
97
+ var o;
98
+ return m(), x($(Y), {
93
99
  "image-class": e.imageClass,
94
100
  "image-style": e.imageStyle,
95
101
  preview: V.value,
96
- pt: { root: (r = e.$preset.image) == null ? void 0 : r.root({ props: e.$props }) },
102
+ pt: { root: (o = e.$preset.image) == null ? void 0 : o.root({ props: e.$props }) },
97
103
  "zoom-in-disabled": e.zoomInDisabled,
98
104
  "zoom-out-disabled": e.zoomOutDisabled,
99
- onShow: G
105
+ onShow: M
100
106
  }, {
101
- image: b(() => {
102
- var o;
107
+ image: k(() => {
108
+ var l;
103
109
  return [
104
- $("img", T((o = e.$preset.image) == null ? void 0 : o.image({ props: e.$props, context: { imageSize: R.value } }), {
110
+ j("img", T((l = e.$preset.image) == null ? void 0 : l.image({ props: e.$props, context: { imageSize: S.value } }), {
105
111
  onerror: v,
106
- src: D(m),
112
+ src: $(n),
107
113
  alt: ""
108
- }), null, 16, ee)
114
+ }), null, 16, te)
109
115
  ];
110
116
  }),
111
- indicatoricon: b(() => [
112
- C(Y, T(e.$preset.image.icon, { icon: "eye" }), null, 16)
117
+ indicatoricon: k(() => [
118
+ R(ee, T(e.$preset.image.icon, { icon: "eye" }), null, 16)
113
119
  ]),
114
- preview: b((o) => {
115
- var c;
120
+ preview: k((l) => {
121
+ var u;
116
122
  return [
117
- (c = e.galleries) != null && c.length ? (u(), g(z, { key: 1 }, [
118
- (u(!0), g(z, null, O(e.galleries, ({ src: l }, n) => x((u(), g("img", {
119
- key: n,
123
+ (u = e.galleries) != null && u.length ? (m(), g(L, { key: 1 }, [
124
+ (m(!0), g(L, null, D(e.galleries, ({ src: r }, c) => H((m(), g("img", {
125
+ key: c,
120
126
  onerror: v,
121
- src: U(l),
122
- style: k(o.style),
127
+ src: O(r),
128
+ style: z(l.style),
123
129
  alt: "",
124
130
  "data-wv-section": "image-gallery"
125
- }, null, 12, ae)), [
126
- [H, n === s.value]
131
+ }, null, 12, oe)), [
132
+ [J, c === s.value]
127
133
  ])), 128)),
128
- $("div", {
134
+ j("div", {
129
135
  onClick: t[0] || (t[0] = P(() => {
130
136
  }, ["stop"])),
131
137
  class: "fixed bottom-0 left-0 flex justify-center items-center w-full p-4 mx-auto flex-row bg-black/80",
132
138
  "data-wv-section": "gallery-thumbnail"
133
139
  }, [
134
- C(E, {
135
- class: _([
140
+ R(E, {
141
+ class: U([
136
142
  "text-surface-0 rotate-180 sticky left-0 !w-8 !h-8 [&_i]:w-5 [&_i]:h-5",
137
143
  "rounded-full mr-3"
138
144
  ]),
139
- onClick: A,
145
+ onClick: G,
140
146
  "aria-label": "Previous Image",
141
147
  "data-wv-section": "prev-button",
142
148
  icon: "arrow-right",
@@ -144,25 +150,25 @@ const ee = ["src"], te = ["src"], ae = ["src"], re = ["src", "onClick"], me = /*
144
150
  severity: "secondary",
145
151
  text: ""
146
152
  }),
147
- (u(!0), g(z, null, O(e.galleries, ({ src: l }, n) => (u(), g("img", {
148
- key: n,
149
- class: _([
153
+ (m(!0), g(L, null, D(e.galleries, ({ src: r }, c) => (m(), g("img", {
154
+ key: c,
155
+ class: U([
150
156
  "h-10 w-10 object-cover cursor-pointer opacity-50 hover:opacity-100 transition-opacity",
151
- { "!opacity-100": s.value == n }
157
+ { "!opacity-100": s.value == c }
152
158
  ]),
153
159
  onerror: v,
154
- src: U(l),
155
- style: k(o.style),
156
- onClick: P((B) => h(n), ["stop"]),
160
+ src: O(r),
161
+ style: z(l.style),
162
+ onClick: P((B) => b(c), ["stop"]),
157
163
  alt: "",
158
164
  "data-wv-section": "thumbnail-image"
159
- }, null, 14, re))), 128)),
160
- C(E, {
161
- class: _([
165
+ }, null, 14, le))), 128)),
166
+ R(E, {
167
+ class: U([
162
168
  "text-surface-0 sticky !w-8 !h-8 [&_i]:w-5 [&_i]:h-5",
163
169
  "rounded-full ml-3"
164
170
  ]),
165
- onClick: j,
171
+ onClick: A,
166
172
  "aria-label": "Next Image",
167
173
  "data-wv-section": "next-button",
168
174
  icon: "arrow-right",
@@ -170,13 +176,13 @@ const ee = ["src"], te = ["src"], ae = ["src"], re = ["src", "onClick"], me = /*
170
176
  text: ""
171
177
  })
172
178
  ])
173
- ], 64)) : (u(), g("img", {
179
+ ], 64)) : (m(), g("img", {
174
180
  key: 0,
175
181
  onerror: v,
176
- src: y.value,
177
- style: k(o.style),
182
+ src: w.value,
183
+ style: z(l.style),
178
184
  alt: ""
179
- }, null, 12, te))
185
+ }, null, 12, ae))
180
186
  ];
181
187
  }),
182
188
  _: 1
@@ -185,5 +191,5 @@ const ee = ["src"], te = ["src"], ae = ["src"], re = ["src", "onClick"], me = /*
185
191
  }
186
192
  });
187
193
  export {
188
- me as _
194
+ ge as _
189
195
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fewangsit/wangsvue-fats",
3
- "version": "1.0.1-alpha.37",
3
+ "version": "1.0.1-alpha.38",
4
4
  "author": "Wangsit FE Developer",
5
5
  "description": "Fixed Asset Tagsamurai VueJS Component Library",
6
6
  "type": "module",