comfy-tool 1.0.4 → 1.0.5

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/es/index.mjs CHANGED
@@ -1,54 +1,54 @@
1
- var ie = Object.defineProperty, ae = Object.defineProperties;
2
- var le = Object.getOwnPropertyDescriptors;
1
+ var ae = Object.defineProperty, le = Object.defineProperties;
2
+ var ce = Object.getOwnPropertyDescriptors;
3
3
  var R = Object.getOwnPropertySymbols;
4
- var ue = Object.prototype.hasOwnProperty, ce = Object.prototype.propertyIsEnumerable;
5
- var W = (e, t, n) => t in e ? ie(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, f = (e, t) => {
4
+ var ue = Object.prototype.hasOwnProperty, fe = Object.prototype.propertyIsEnumerable;
5
+ var W = (e, t, n) => t in e ? ae(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, f = (e, t) => {
6
6
  for (var n in t || (t = {}))
7
7
  ue.call(t, n) && W(e, n, t[n]);
8
8
  if (R)
9
9
  for (var n of R(t))
10
- ce.call(t, n) && W(e, n, t[n]);
10
+ fe.call(t, n) && W(e, n, t[n]);
11
11
  return e;
12
- }, _ = (e, t) => ae(e, le(t));
13
- import { camelize as K, pick as q, keysOf as z, merge as G, pickEx as E, Fn as fe, addUnit as h, arrayToGroup as se, base64ToBlob as de, cloneJSON as me, dateGo as he, dealTime as pe, debounce as ye, decodeURIComponentSafe as ve, decodeURISafe as ge, deepClone as be, deleteItemForArr as Ce, emptyArray as xe, entriesOf as X, extend as P, formatDate as we, formatSelectedData as Se, formatToSelectData as Ee, getArrayDataIndex as Te, getDateConfig as Le, getFuzzyMatchRegExp as Ae, getPercentage as De, getProperty as Oe, getRandomElements as _e, getUniqueParam as Ie, getWeek as Pe, getWeekByNo as Ne, hasSameItem as ke, isArrayString as $e, isFullUrl as He, isNumber as Me, isObjectString as Re, isRegExpString as We, isWebUrl as Ve, kebabCase as Ue, methodApply as J, padZero as je, parseArray as Fe, parseDate as Ye, parseObject as Be, parseRegExp as Ke, parseUrl as qe, queryParse as ze, queryStringify as Ge, removeEmptyForArr as Xe, removeFalseForArr as Je, removeItemForArr as Ze, selectDataToObj as Qe, shuffleArray as et, throttle as tt, throttleAsync as nt, toFormData as ot, toSelectData as rt, typeOf as it, urlAddParams as at, valuesOf as lt } from "./utils.mjs";
14
- import { h as N, reactive as ut, unref as ct, defineComponent as L, createVNode as y, mergeProps as T, render as ft, shallowRef as V, ref as st, shallowReactive as dt, watch as mt, provide as ht, nextTick as pt } from "vue";
12
+ }, _ = (e, t) => le(e, ce(t));
13
+ import { camelize as q, pick as z, keysOf as G, merge as X, pickEx as b, Fn as se, addUnit as p, arrayToGroup as de, base64ToBlob as me, cloneJSON as he, dateGo as pe, dealTime as ye, debounce as ve, decodeURIComponentSafe as ge, decodeURISafe as be, deepClone as Ce, deleteItemForArr as xe, emptyArray as we, entriesOf as J, extend as P, formatDate as Se, formatSelectedData as Ee, formatToSelectData as Te, getArrayDataIndex as Le, getDateConfig as Ae, getFuzzyMatchRegExp as De, getPercentage as Oe, getProperty as _e, getRandomElements as Ie, getUniqueParam as Pe, getWeek as Ne, getWeekByNo as ke, hasSameItem as $e, isArrayString as He, isFullUrl as Me, isNumber as Re, isObjectString as We, isRegExpString as Ve, isWebUrl as je, kebabCase as Fe, methodApply as Z, padZero as Ue, parseArray as Ye, parseDate as Be, parseObject as Ke, parseRegExp as qe, parseUrl as ze, queryParse as Ge, queryStringify as Xe, removeEmptyForArr as Je, removeFalseForArr as Ze, removeItemForArr as Qe, selectDataToObj as et, shuffleArray as tt, throttle as nt, throttleAsync as ot, toFormData as rt, toSelectData as it, typeOf as at, urlAddParams as lt, valuesOf as ct } from "./utils.mjs";
14
+ import { h as N, reactive as ut, unref as ft, defineComponent as L, createVNode as h, mergeProps as T, render as V, shallowRef as j, ref as st, shallowReactive as dt, watch as mt, provide as ht, Fragment as pt, nextTick as yt } from "vue";
15
15
  function $(e) {
16
16
  return e.install = (t) => {
17
17
  let { name: n } = e;
18
- t.component(n, e), t.component(K("-" + n), e);
18
+ t.component(n, e), t.component(q("-" + n), e);
19
19
  }, e;
20
20
  }
21
- function yt(e, t = N("div"), n) {
21
+ function vt(e, t = N("div"), n) {
22
22
  return e ? typeof e == "function" ? e() || t : N(e, n && ut(n)) : t;
23
23
  }
24
- function vt(e) {
24
+ function gt(e) {
25
25
  return !!(e && e.$el && e.$props && e.$options && e.$emit);
26
26
  }
27
- function gt(e) {
28
- let t = Z(e);
27
+ function bt(e) {
28
+ let t = Q(e);
29
29
  t && (t.scrollTop = 0);
30
30
  }
31
- function Z(e) {
31
+ function Q(e) {
32
32
  return document.getElementById(e);
33
33
  }
34
- function Q(e) {
35
- let t = ct(e);
36
- return vt(t) ? t.$el : t instanceof HTMLElement ? t : null;
34
+ function ee(e) {
35
+ let t = ft(e);
36
+ return gt(t) ? t.$el : t instanceof HTMLElement ? t : null;
37
37
  }
38
- function bt(e, t) {
38
+ function Ct(e, t) {
39
39
  return getComputedStyle(e).getPropertyValue(t);
40
40
  }
41
- function Ct(e, t, n = !0) {
41
+ function xt(e, t, n = !0) {
42
42
  e.classList.remove(...t.split(" ")), n && e.classList.add(t);
43
43
  }
44
44
  const m = {
45
45
  rootId: "app",
46
46
  app: void 0
47
47
  };
48
- function xt(e = {}) {
48
+ function wt(e = {}) {
49
49
  e.rootId && (m.rootId = e.rootId), e.app && (m.app = e.app);
50
50
  }
51
- const b = {
51
+ const C = {
52
52
  toast(e) {
53
53
  },
54
54
  alert(e) {
@@ -59,32 +59,32 @@ const b = {
59
59
  hideLoading() {
60
60
  }
61
61
  };
62
- function wt(e) {
63
- let t = z(m);
64
- xt(q(e, t)), G(b, E(e, t), {
62
+ function St(e) {
63
+ let t = G(m);
64
+ wt(z(e, t)), X(C, b(e, t), {
65
65
  deepMerge: !0,
66
66
  arrayMergeStrategy: "concat"
67
67
  });
68
68
  }
69
- function St() {
70
- }
71
- function Et(e) {
69
+ function Et() {
72
70
  }
73
71
  function Tt(e) {
72
+ }
73
+ function Lt(e) {
74
74
  H(e);
75
75
  }
76
76
  function H(e) {
77
- b.toast(e);
77
+ C.toast(e);
78
78
  }
79
- function Lt(e) {
80
- b.alert(e);
79
+ function At(e) {
80
+ C.alert(e);
81
81
  }
82
- const S = {
82
+ const E = {
83
83
  show(e = "") {
84
- b.showLoading(e);
84
+ C.showLoading(e);
85
85
  },
86
86
  hide() {
87
- b.hideLoading();
87
+ C.hideLoading();
88
88
  }
89
89
  };
90
90
  let k;
@@ -92,138 +92,138 @@ try {
92
92
  k = document.createElement("a");
93
93
  } catch (e) {
94
94
  }
95
- function At(e, t = "未获取到联系电话") {
95
+ function Dt(e, t = "未获取到联系电话") {
96
96
  if (!e) return H(t);
97
97
  e = typeof e == "number" ? e.toString() : e, k.href = /^tel:.*/.test(e) ? e : "tel:" + e, k.click();
98
98
  }
99
- const Dt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
99
+ const Ot = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
100
100
  __proto__: null,
101
- $: Z,
102
- $alert: Lt,
103
- $loading: S,
104
- $refDOM: Q,
101
+ $: Q,
102
+ $alert: At,
103
+ $loading: E,
104
+ $refDOM: ee,
105
105
  $toast: H,
106
- Fn: fe,
107
- addUnit: h,
108
- arrayToGroup: se,
109
- base64ToBlob: de,
110
- camelize: K,
111
- cloneJSON: me,
112
- dateGo: he,
113
- dealTime: pe,
114
- debounce: ye,
115
- decodeURIComponentSafe: ve,
116
- decodeURISafe: ge,
117
- deepClone: be,
118
- deleteItemForArr: Ce,
119
- emptyArray: xe,
120
- entriesOf: X,
121
- errorCatch: Tt,
106
+ Fn: se,
107
+ addUnit: p,
108
+ arrayToGroup: de,
109
+ base64ToBlob: me,
110
+ camelize: q,
111
+ cloneJSON: he,
112
+ dateGo: pe,
113
+ dealTime: ye,
114
+ debounce: ve,
115
+ decodeURIComponentSafe: ge,
116
+ decodeURISafe: be,
117
+ deepClone: Ce,
118
+ deleteItemForArr: xe,
119
+ emptyArray: we,
120
+ entriesOf: J,
121
+ errorCatch: Lt,
122
122
  extend: P,
123
- formatDate: we,
124
- formatSelectedData: Se,
125
- formatToSelectData: Ee,
126
- getArrayDataIndex: Te,
127
- getDateConfig: Le,
128
- getElementPropertyValue: bt,
129
- getFuzzyMatchRegExp: Ae,
130
- getPercentage: De,
131
- getProperty: Oe,
132
- getRandomElements: _e,
133
- getUniqueParam: Ie,
134
- getWeek: Pe,
135
- getWeekByNo: Ne,
136
- hasSameItem: ke,
137
- isArrayString: $e,
138
- isFullUrl: He,
139
- isNumber: Me,
140
- isObjectString: Re,
141
- isRegExpString: We,
142
- isWebUrl: Ve,
143
- kebabCase: Ue,
144
- keysOf: z,
145
- merge: G,
146
- methodApply: J,
147
- noop: St,
148
- noopCatch: Et,
149
- padZero: je,
150
- parseArray: Fe,
151
- parseDate: Ye,
152
- parseObject: Be,
153
- parseRegExp: Ke,
154
- parseUrl: qe,
155
- pick: q,
156
- pickEx: E,
157
- queryParse: ze,
158
- queryStringify: Ge,
159
- removeEmptyForArr: Xe,
160
- removeFalseForArr: Je,
161
- removeItemForArr: Ze,
162
- scrollToTop: gt,
163
- selectDataToObj: Qe,
164
- shuffleArray: et,
165
- telephoneCall: At,
166
- throttle: tt,
167
- throttleAsync: nt,
168
- toFormData: ot,
169
- toSelectData: rt,
170
- toggleClass: Ct,
171
- typeOf: it,
172
- urlAddParams: at,
173
- valuesOf: lt
123
+ formatDate: Se,
124
+ formatSelectedData: Ee,
125
+ formatToSelectData: Te,
126
+ getArrayDataIndex: Le,
127
+ getDateConfig: Ae,
128
+ getElementPropertyValue: Ct,
129
+ getFuzzyMatchRegExp: De,
130
+ getPercentage: Oe,
131
+ getProperty: _e,
132
+ getRandomElements: Ie,
133
+ getUniqueParam: Pe,
134
+ getWeek: Ne,
135
+ getWeekByNo: ke,
136
+ hasSameItem: $e,
137
+ isArrayString: He,
138
+ isFullUrl: Me,
139
+ isNumber: Re,
140
+ isObjectString: We,
141
+ isRegExpString: Ve,
142
+ isWebUrl: je,
143
+ kebabCase: Fe,
144
+ keysOf: G,
145
+ merge: X,
146
+ methodApply: Z,
147
+ noop: Et,
148
+ noopCatch: Tt,
149
+ padZero: Ue,
150
+ parseArray: Ye,
151
+ parseDate: Be,
152
+ parseObject: Ke,
153
+ parseRegExp: qe,
154
+ parseUrl: ze,
155
+ pick: z,
156
+ pickEx: b,
157
+ queryParse: Ge,
158
+ queryStringify: Xe,
159
+ removeEmptyForArr: Je,
160
+ removeFalseForArr: Ze,
161
+ removeItemForArr: Qe,
162
+ scrollToTop: bt,
163
+ selectDataToObj: et,
164
+ shuffleArray: tt,
165
+ telephoneCall: Dt,
166
+ throttle: nt,
167
+ throttleAsync: ot,
168
+ toFormData: rt,
169
+ toSelectData: it,
170
+ toggleClass: xt,
171
+ typeOf: at,
172
+ urlAddParams: lt,
173
+ valuesOf: ct
174
174
  }, Symbol.toStringTag, { value: "Module" })), s = {};
175
- function U(e) {
175
+ function F(e) {
176
176
  return s[e.url] && s[e.url].status === 1 ? Promise.resolve("The resource is already loaded!") : s[e.url] && s[e.url].status === 2 ? new Promise((t, n) => {
177
177
  s[e.url].waiters.push(t);
178
- }) : e.production ? Promise.resolve("Ignored in development environment!") : (S.show("资源加载中"), s[e.url] ? s[e.url].status = 2 : s[e.url] = {
178
+ }) : e.production ? Promise.resolve("Ignored in development environment!") : (E.show("资源加载中"), s[e.url] ? s[e.url].status = 2 : s[e.url] = {
179
179
  status: 2,
180
180
  waiters: []
181
181
  }, new Promise((t, n) => {
182
182
  const r = () => {
183
- c(), d();
184
- }, o = () => {
185
183
  u(), d();
184
+ }, o = () => {
185
+ c(), d();
186
186
  };
187
187
  let i = null;
188
188
  e.type === "js" ? (i = document.createElement("script"), i.src = e.url, i.onload = r, i.onerror = o) : e.type === "css" && (i = document.createElement("link"), i.rel = "stylesheet", i.href = e.url, i.onload = r, i.onerror = o), i && document.head.appendChild(i);
189
- function c() {
190
- s[e.url].status = 1, S.hide(), t(e.url), J(s[e.url].waiters, [e.url]);
191
- }
192
189
  function u() {
193
- s[e.url].status = 0, S.hide(), n(new Error("Failed to load " + e.url));
190
+ s[e.url].status = 1, E.hide(), t(e.url), Z(s[e.url].waiters, [e.url]);
191
+ }
192
+ function c() {
193
+ s[e.url].status = 0, E.hide(), n(new Error("Failed to load " + e.url));
194
194
  }
195
195
  function d() {
196
196
  i && (i.onload = null, i.onerror = null);
197
197
  }
198
198
  }));
199
199
  }
200
- function Jt(e) {
201
- return Array.isArray(e) ? Promise.all(e.map((t) => U(t))) : U(e);
200
+ function Zt(e) {
201
+ return Array.isArray(e) ? Promise.all(e.map((t) => F(t))) : F(e);
202
202
  }
203
- const j = Symbol("INSTALLED_KEY"), F = Symbol("COMPONENT_INSTALLED_KEY"), Y = Symbol("DIRECTIVES_INSTALLED_KEY"), Ot = {
203
+ const U = Symbol("INSTALLED_KEY"), Y = Symbol("COMPONENT_INSTALLED_KEY"), B = Symbol("DIRECTIVES_INSTALLED_KEY"), _t = {
204
204
  mounted(e, t, n, r) {
205
205
  typeof t.value == "function" && t.value(e);
206
206
  },
207
207
  unmounted(e, t, n, r) {
208
208
  typeof t.value == "function" && t.value(null);
209
209
  }
210
- }, _t = {
210
+ }, It = {
211
211
  mounted(e, t, n, r) {
212
212
  e.focus();
213
213
  },
214
214
  updated(e, t, n, r) {
215
215
  }
216
- }, It = function(t, n, r, o) {
216
+ }, Pt = function(t, n, r, o) {
217
217
  t.style.height = t.parentElement.offsetHeight + "px", t.style.minHeight = "100%";
218
218
  };
219
- function Pt(e, t, n, r) {
219
+ function Nt(e, t, n, r) {
220
220
  if (t.value.__used) return;
221
221
  let o = f({}, t.value);
222
222
  if (o.behavior = o.behavior || "smooth", typeof o.right == "number" && (o.left = e.scrollWidth - o.right), typeof o.bottom == "number" && (o.top = e.scrollHeight - o.bottom), o.target) {
223
- let i = Q(o.target);
223
+ let i = ee(o.target);
224
224
  if (i) {
225
- let { offsetTop: c, offsetLeft: u } = i.offsetParent || { offsetTop: 0, offsetLeft: 0 };
226
- o.left = i.offsetLeft - e.offsetLeft + u, o.top = i.offsetTop - e.offsetTop + c;
225
+ let { offsetTop: u, offsetLeft: c } = i.offsetParent || { offsetTop: 0, offsetLeft: 0 };
226
+ o.left = i.offsetLeft - e.offsetLeft + c, o.top = i.offsetTop - e.offsetTop + u;
227
227
  }
228
228
  }
229
229
  o.left && typeof o.offsetX == "number" && (o.left += o.offsetX), o.top && typeof o.offsetY == "number" && (o.top += o.offsetY), Object.defineProperty(t.value, "__used", {
@@ -235,61 +235,63 @@ function Pt(e, t, n, r) {
235
235
  }, o, e) : e.scrollTo(o);
236
236
  }
237
237
  const I = {
238
- dom: Ot,
239
- focus: _t,
240
- maxHeight: It,
241
- scroll: Pt
238
+ dom: _t,
239
+ focus: It,
240
+ maxHeight: Pt,
241
+ scroll: Nt
242
242
  };
243
- function Nt(e) {
244
- if (!e[Y]) {
245
- e[Y] = !0;
243
+ function kt(e) {
244
+ if (!e[B]) {
245
+ e[B] = !0;
246
246
  for (const t of Object.keys(I))
247
247
  e.directive(I[t].name || t, I[t]);
248
248
  }
249
249
  }
250
- const kt = {
250
+ const $t = {
251
251
  reverse: Boolean
252
- }, $t = /* @__PURE__ */ L({
252
+ }, Ht = /* @__PURE__ */ L({
253
253
  name: "column",
254
254
  inheritAttrs: !1,
255
- props: kt,
255
+ props: $t,
256
256
  setup(e, {
257
257
  attrs: t,
258
258
  slots: n
259
259
  }) {
260
- var r, o, i, c, u;
261
- return y("div", T({
262
- class: {
263
- "comfy-tool--column": !0,
264
- reverse: e.reverse
265
- }
266
- }, t), [((r = n.before) == null ? void 0 : r.call(n)) || "", ((o = n["before-content"]) == null ? void 0 : o.call(n)) || "", y("div", {
267
- class: "main-content"
268
- }, [((i = n.default) == null ? void 0 : i.call(n)) || ""]), ((c = n["after-content"]) == null ? void 0 : c.call(n)) || "", ((u = n.after) == null ? void 0 : u.call(n)) || ""]);
260
+ return () => {
261
+ var r, o, i, u, c;
262
+ return h("div", T({
263
+ class: {
264
+ "comfy-tool--column": !0,
265
+ reverse: e.reverse
266
+ }
267
+ }, t), [((r = n.before) == null ? void 0 : r.call(n)) || "", ((o = n["before-content"]) == null ? void 0 : o.call(n)) || "", h("div", {
268
+ class: "main-content"
269
+ }, [((i = n.default) == null ? void 0 : i.call(n)) || ""]), ((u = n["after-content"]) == null ? void 0 : u.call(n)) || "", ((c = n.after) == null ? void 0 : c.call(n)) || ""]);
270
+ };
269
271
  }
270
- }), Ht = $($t), Mt = {
272
+ }), Mt = $(Ht), Rt = {
271
273
  reverse: Boolean
272
- }, Rt = /* @__PURE__ */ L({
274
+ }, Wt = /* @__PURE__ */ L({
273
275
  name: "row",
274
276
  inheritAttrs: !1,
275
- props: Mt,
277
+ props: Rt,
276
278
  setup(e, {
277
279
  attrs: t,
278
280
  slots: n
279
281
  }) {
280
282
  return () => {
281
- var r, o, i, c, u;
282
- return y("div", T({
283
+ var r, o, i, u, c;
284
+ return h("div", T({
283
285
  class: {
284
286
  "comfy-tool--row": !0,
285
287
  reverse: e.reverse
286
288
  }
287
- }, t), [((r = n.before) == null ? void 0 : r.call(n)) || "", ((o = n["before-content"]) == null ? void 0 : o.call(n)) || "", y("div", {
289
+ }, t), [((r = n.before) == null ? void 0 : r.call(n)) || "", ((o = n["before-content"]) == null ? void 0 : o.call(n)) || "", h("div", {
288
290
  class: "main-content"
289
- }, [((i = n.default) == null ? void 0 : i.call(n)) || ""]), ((c = n["after-content"]) == null ? void 0 : c.call(n)) || "", ((u = n.after) == null ? void 0 : u.call(n)) || ""]);
291
+ }, [((i = n.default) == null ? void 0 : i.call(n)) || ""]), ((u = n["after-content"]) == null ? void 0 : u.call(n)) || "", ((c = n.after) == null ? void 0 : c.call(n)) || ""]);
290
292
  };
291
293
  }
292
- }), Wt = $(Rt), Vt = {
294
+ }), Vt = $(Wt), jt = {
293
295
  /** 当需要设定宽高时可能需要设置为 `-`;需要撑满容器时设置为 `100%` */
294
296
  flex: {
295
297
  type: [Number, String],
@@ -309,10 +311,10 @@ const kt = {
309
311
  row: Boolean,
310
312
  /** 启用flexbox纵向布局 */
311
313
  column: Boolean
312
- }, Ut = /* @__PURE__ */ L({
314
+ }, Ft = /* @__PURE__ */ L({
313
315
  name: "expended",
314
316
  inheritAttrs: !1,
315
- props: Vt,
317
+ props: jt,
316
318
  setup(e, {
317
319
  attrs: t,
318
320
  slots: n
@@ -332,9 +334,9 @@ const kt = {
332
334
  r.flex = e.flex;
333
335
  break;
334
336
  }
335
- return e.minWidth && (r.minWidth = h(e.minWidth, "px")), e.minHeight && (r.minHeight = h(e.minHeight, "px")), e.maxWidth && (r.maxWidth = h(e.maxWidth, "px")), e.maxHeight && (r.maxHeight = h(e.maxHeight, "px")), e.width && (r.width = h(e.width, "px")), e.height && (r.height = h(e.height, "px")), e.column ? o.push("u-flex-nowrap u-box-flex-col") : e.row && o.push("u-flex-wrap"), () => {
337
+ return e.minWidth && (r.minWidth = p(e.minWidth, "px")), e.minHeight && (r.minHeight = p(e.minHeight, "px")), e.maxWidth && (r.maxWidth = p(e.maxWidth, "px")), e.maxHeight && (r.maxHeight = p(e.maxHeight, "px")), e.width && (r.width = p(e.width, "px")), e.height && (r.height = p(e.height, "px")), e.column ? o.push("u-flex-nowrap u-box-flex-col") : e.row && o.push("u-flex-wrap"), () => {
336
338
  var i;
337
- return y("div", T({
339
+ return h("div", T({
338
340
  style: r,
339
341
  class: T({
340
342
  class: ["comfy-tool--expended", ...o]
@@ -342,34 +344,40 @@ const kt = {
342
344
  }, t), [((i = n.default) == null ? void 0 : i.call(n)) || ""]);
343
345
  };
344
346
  }
345
- }), jt = $(Ut), Ft = {
346
- Column: Ht,
347
- Row: Wt,
348
- Expended: jt
347
+ }), Ut = $(Ft), Yt = {
348
+ Column: Mt,
349
+ Row: Vt,
350
+ Expanded: Ut
349
351
  };
350
- function Yt(e) {
351
- e[F] || (e[F] = !0, X(Ft).forEach(([t, n]) => {
352
+ function Bt(e) {
353
+ e[Y] || (e[Y] = !0, J(Yt).forEach(([t, n]) => {
352
354
  e.component(t, n);
353
355
  }));
354
356
  }
355
- function Bt(e) {
356
- wt({ app: e }), Nt(e), Yt(e);
357
+ function Kt(e) {
358
+ St({ app: e }), kt(e), Bt(e);
357
359
  }
358
- class Kt {
360
+ class qt {
359
361
  constructor(t, n) {
360
362
  this.properties = n, this.component = t, this.container = document.createElement("div");
361
- const r = y(t, this.properties);
362
- m.app && (r.appContext = m.app._context), ft(r, this.container), this.instance = r.component, this.appDOM = this.container.firstChild, this.init();
363
+ const r = h(t, this.properties);
364
+ m.app && (r.appContext = m.app._context), V(r, this.container), this.instance = r.component, this.appDOM = this.container, this.init();
363
365
  }
364
366
  init() {
365
- this.properties.teleport ? this.properties.teleport : m.rootId, this.appDOM && !this.appDOM.nodeName.startsWith("#") && document.body.appendChild(this.appDOM);
367
+ this.mount();
366
368
  }
367
369
  // 声明静态方法
368
370
  static use(t) {
369
371
  Object.assign(m, t);
370
372
  }
373
+ mount() {
374
+ if (this.properties.teleport ? this.properties.teleport : m.rootId, this.appDOM && !this.appDOM.isConnected)
375
+ for (const t of Array.from(this.appDOM.childNodes))
376
+ document.body.appendChild(t);
377
+ }
371
378
  unmount() {
372
- this.properties.teleport ? this.properties.teleport : m.rootId, document.body.removeChild(this.appDOM), this.instance.unmount();
379
+ var t;
380
+ this.properties.teleport ? this.properties.teleport : m.rootId, V(null, this.container), (t = this.appDOM.parentNode) == null || t.removeChild(this.appDOM);
373
381
  }
374
382
  close() {
375
383
  this.toggle(!1);
@@ -378,13 +386,20 @@ class Kt {
378
386
  t ? this.instance.open(n) : this.instance.close(n);
379
387
  }
380
388
  }
381
- const B = {
389
+ const K = {
382
390
  show: !1,
383
391
  // 扩展
384
392
  keepAlive: !1
385
- }, qt = /* @__PURE__ */ L({
393
+ }, zt = /* @__PURE__ */ L({
386
394
  name: "comfy-tool-layer",
395
+ inheritAttrs: !1,
387
396
  components: {},
397
+ props: {
398
+ baseContent: {
399
+ type: Object,
400
+ default: null
401
+ }
402
+ },
388
403
  emits: ["confirm", "close", "cancel"],
389
404
  setup(e, {
390
405
  attrs: t,
@@ -392,34 +407,34 @@ const B = {
392
407
  slots: r,
393
408
  expose: o
394
409
  }) {
395
- const i = V(null), c = V(null), u = st(!0);
410
+ const i = j(e.baseContent), u = j(null), c = st(!0);
396
411
  let d;
397
- const l = dt(f(f(f({}, B), t), e)), C = {
412
+ const l = dt(f(f(f({}, K), t), e)), x = {
398
413
  onConfirm() {
399
414
  },
400
415
  onClose() {
401
416
  }
402
- }, M = y("div", {
417
+ }, M = h("div", {
403
418
  style: {
404
419
  height: "150px"
405
420
  }
406
421
  }, null);
407
- function te(a) {
422
+ function ne(a) {
408
423
  l.show = a;
409
424
  }
410
- function ne() {
411
- return d = yt(c.value, M, _(f({}, l.contentProps), {
425
+ function oe() {
426
+ return d = vt(u.value, M, _(f({}, l.contentProps), {
412
427
  LAYERSHOW: l.show
413
428
  })), d;
414
429
  }
415
- function oe() {
430
+ function re() {
416
431
  let a;
417
- return !l.keepAlive && !l.show && !u.value ? a = () => M : a = r.default ? r.default : ne, () => a();
432
+ return !l.keepAlive && !l.show && !c.value ? a = () => M : a = r.default ? r.default : oe, () => a();
418
433
  }
419
- function re() {
434
+ function ie() {
420
435
  v.cancel();
421
436
  }
422
- function x(a) {
437
+ function w(a) {
423
438
  if (d && d.component) {
424
439
  let {
425
440
  ctx: g,
@@ -428,67 +443,67 @@ const B = {
428
443
  O && O[a] ? O[a]() : g && g[a] && g[a]();
429
444
  }
430
445
  }
431
- let w;
446
+ let S;
432
447
  function D(a) {
433
- l.show = a, l.show || l.keepAlive ? (u.value = !0, w && clearTimeout(w), w = null) : w = setTimeout(() => {
434
- u.value = !1;
435
- }, 500), pt(() => {
436
- l.show && (x("onLayerShow"), x("queryData"));
448
+ l.show = a, l.show || l.keepAlive ? (c.value = !0, S && clearTimeout(S), S = null) : S = setTimeout(() => {
449
+ c.value = !1;
450
+ }, 500), yt(() => {
451
+ l.show && (w("onLayerShow"), w("queryData"));
437
452
  });
438
453
  }
439
454
  const v = {
440
- init(a = {}, g = B) {
441
- P(l, g, a && E(a, ["content", "baseContent"])), a.onConfirm && (C.onConfirm = a.onConfirm), a.onClose && (C.onClose = a.onClose), a.baseContent && (i.value = a.baseContent), c.value = a.content;
455
+ init(a = {}, g = K) {
456
+ P(l, g, a && b(a, ["content", "baseContent"])), a.onConfirm && (x.onConfirm = a.onConfirm), a.onClose && (x.onClose = a.onClose), a.baseContent && (i.value = a.baseContent), u.value = a.content;
442
457
  },
443
458
  open(a) {
444
459
  v.init(a, {}), D(!0);
445
460
  },
446
461
  confirm(a) {
447
- n("confirm"), D(!!C.onConfirm(a, v.close));
462
+ n("confirm"), D(!!x.onConfirm(a, v.close));
448
463
  },
449
464
  close(a = "complete") {
450
- C.onClose(a), n("close"), D(!1), x("onClose");
465
+ x.onClose(a), n("close"), D(!1), w("onClose");
451
466
  },
452
467
  cancel() {
453
- v.close("cancel"), n("cancel"), x("onCancel");
468
+ v.close("cancel"), n("cancel"), w("onCancel");
454
469
  }
455
470
  };
456
471
  return mt(() => t, (a) => {
457
472
  P(l, {}, a);
458
473
  }), o(v), ht("Layer", v), () => {
459
474
  var a;
460
- return i.value ? N(i.value, _(f(f(f({
475
+ return h(pt, null, [i.value ? N(i.value, _(f(f(f({
461
476
  class: ["comfy-tool--layer", (a = l.class) != null ? a : ""],
462
477
  style: f({}, l.style)
463
- }, t), l.baseContentProps), E(l, ["content", "contentProps", "onClose", "width", "height", "class", "style", "baseContent", "baseContentProps"])), {
464
- "onUpdate:show": te,
465
- onClose: re
478
+ }, b(t, ["content", "contentProps", "baseContent", "baseContentProps"])), l.baseContentProps), b(l, ["content", "contentProps", "onClose", "width", "height", "class", "style", "baseContent", "baseContentProps"])), {
479
+ "onUpdate:show": ne,
480
+ onClose: ie
466
481
  }), {
467
- default: oe(),
482
+ default: re(),
468
483
  overlayContent: r.overlayContent
469
- }) : "";
484
+ }) : ""]);
470
485
  };
471
486
  }
472
487
  });
473
- var p;
474
- class A extends Kt {
488
+ var y;
489
+ class A extends qt {
475
490
  constructor(t, n) {
476
491
  super(t, n);
477
492
  }
478
493
  open(t) {
479
- return this.appDOM && document.body.appendChild(this.appDOM), this.instance.exposed.open(t);
494
+ return super.mount(), this.instance.exposed.open(t);
480
495
  }
481
496
  static create(t = {}, n = !0) {
482
- if (!p || n) {
483
- let r = new A(qt, t);
497
+ if (!y || n) {
498
+ let r = new A(zt, t);
484
499
  if (n) return r;
485
- p || (p = r);
500
+ y || (y = r);
486
501
  } else
487
- p.instance.exposed.init(t);
488
- return p;
502
+ y.instance.exposed.init(t);
503
+ return y;
489
504
  }
490
505
  }
491
- function ee(e, t = !1) {
506
+ function te(e, t = !1) {
492
507
  return new Promise((n, r) => {
493
508
  A.create({}, t).open(f({
494
509
  onConfirm(o, i) {
@@ -500,24 +515,24 @@ function ee(e, t = !1) {
500
515
  }, e));
501
516
  });
502
517
  }
503
- ee.create = A.create;
504
- ee.close = () => {
505
- p && p.close();
518
+ te.create = A.create;
519
+ te.close = () => {
520
+ y && y.close();
506
521
  };
507
- const Zt = "1.0.4", Qt = Dt, en = {
522
+ const Qt = "1.0.5", en = Ot, tn = {
508
523
  install(e) {
509
- e[j] || (e[j] = !0, Bt(e));
524
+ e[U] || (e[U] = !0, Kt(e));
510
525
  }
511
526
  };
512
527
  export {
513
- Ht as Column,
514
- Qt as ComfyTool,
515
- jt as Expended,
516
- ee as Layer,
517
- Wt as Row,
518
- wt as configComfyTool,
519
- en as default,
520
- Jt as resourceLoader,
521
- Bt as useComfyTool,
522
- Zt as version
528
+ Mt as Column,
529
+ en as ComfyTool,
530
+ Ut as Expanded,
531
+ te as Layer,
532
+ Vt as Row,
533
+ St as configComfyTool,
534
+ tn as default,
535
+ Zt as resourceLoader,
536
+ Kt as useComfyTool,
537
+ Qt as version
523
538
  };