@soei/flyweight 0.3.9 → 0.3.11

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/Flyweight.js CHANGED
@@ -1,39 +1,39 @@
1
- import { runer as T, merge as B, isArray as nt, each as H, picker as O, isEmpty as ot, isSimplyType as J, isString as bt } from "@soei/util";
2
- import { openBlock as z, createElementBlock as M, normalizeClass as ht, normalizeStyle as I, createElementVNode as P, Fragment as at, renderList as ct, renderSlot as m, mergeProps as U, createCommentVNode as ut, createTextVNode as dt, toDisplayString as D, createBlock as xt, resolveDynamicComponent as vt, normalizeProps as St, guardReactiveProps as $t, withCtx as zt } from "vue";
3
- import { runer as p, each as K } from "@soei/tools";
4
- import kt from "@soei/picker";
5
- let Nt = /(\d+|[+\-\*/]|%)/g, Q = {
1
+ import { runer as T, merge as B, isArray as ht, each as P, picker as C, isEmpty as at, isSimplyType as K, isString as xt } from "@soei/util";
2
+ import { openBlock as z, createElementBlock as M, normalizeClass as dt, normalizeStyle as O, createElementVNode as R, Fragment as ut, renderList as ct, renderSlot as g, mergeProps as G, createCommentVNode as ft, createTextVNode as pt, toDisplayString as F, createBlock as St, resolveDynamicComponent as $t, normalizeProps as zt, guardReactiveProps as Nt, withCtx as kt } from "vue";
3
+ import { runer as p, isNil as Tt, each as Q } from "@soei/tools";
4
+ import Mt from "@soei/picker";
5
+ let Et = /(\d+|[+\-\*/]|%)/g, Z = {
6
6
  "+": (t, e) => t + e,
7
7
  "-": (t, e) => t - e,
8
8
  "*": (t, e) => t * e,
9
9
  "/": (t, e) => t / e,
10
10
  "%": (t, e, i) => parseFloat(t) / 100 * i
11
- }, Z = (t, e) => {
11
+ }, tt = (t, e) => {
12
12
  let i;
13
- if (i = T("match", t, Nt)) {
13
+ if (i = T("match", t, Et)) {
14
14
  let r = i.length, n, l = 0, s, h = [];
15
15
  for (; r--; )
16
- l = i.shift(), l in Q ? (n && h.push(n), l === "%" && (h.length = 2), s = l) : +l && h.push(+l), h.length == 2 && (h.push(e), n = Q[s].apply(null, h), h.length = 0);
16
+ l = i.shift(), l in Z ? (n && h.push(n), l === "%" && (h.length = 2), s = l) : +l && h.push(+l), h.length == 2 && (h.push(e), n = Z[s].apply(null, h), h.length = 0);
17
17
  +n || (n = +h.pop()), t = n >> 0;
18
18
  }
19
19
  return t;
20
- }, tt = {}, b = (t, e) => (t + "").replace(
20
+ }, et = {}, _ = (t, e) => (t + "").replace(
21
21
  /\w+\((.*)\)/g,
22
22
  "$1"
23
23
  ).replace(
24
- tt[e] || (tt[e] = new RegExp("(?=\\s+|^)(\\d+)(?:\\.\\d{1,})?(?!(?:\\.)*\\d|%|\\w)", "g")),
24
+ et[e] || (et[e] = new RegExp("(?=\\s+|^)(\\d+)(?:\\.\\d{1,})?(?!(?:\\.)*\\d|%|\\w)", "g")),
25
25
  "$1px"
26
26
  );
27
- const j = (t, e) => {
27
+ const I = (t, e) => {
28
28
  const i = t.__vccOpts || t;
29
29
  for (const [r, n] of e)
30
30
  i[r] = n;
31
31
  return i;
32
32
  };
33
- let et = (t) => t == null || t == null, Tt = (...t) => {
33
+ let it = (t) => t == null || t == null, Ht = (...t) => {
34
34
  console.info("::::FLYWEIGHT", ...t);
35
35
  };
36
- const Mt = {
36
+ const Lt = {
37
37
  name: "Flyweight",
38
38
  props: {
39
39
  flys: {
@@ -98,13 +98,13 @@ const Mt = {
98
98
  style() {
99
99
  var t = this.w, e = this.h, i = this.Size, r = {};
100
100
  return B(r, {
101
- "--width": b(this.realW),
102
- "--height": b(this.realH),
103
- "--flyweight-content": b(i)
101
+ "--width": _(this.realW),
102
+ "--height": _(this.realH),
103
+ "--flyweight-content": _(i)
104
104
  }, e && {
105
- "--flyweight-h": b(e)
105
+ "--flyweight-h": _(e)
106
106
  }, t && r, {
107
- "--flyweight-w": b(t)
107
+ "--flyweight-w": _(t)
108
108
  }, "mix"), r;
109
109
  }
110
110
  },
@@ -156,17 +156,17 @@ const Mt = {
156
156
  this.rebuild(), this.$emit("resize");
157
157
  }).observe(this.flyweight);
158
158
  } catch (t) {
159
- Tt(t);
159
+ Ht(t);
160
160
  }
161
161
  this.scrollx = T("hasAttribute", this.flyweight, "scroll-x"), this.BoxRule = /* this.scrollx ? 'clientHeight=>width,clientWidth=>height' : */
162
162
  "clientHeight=>height,clientWidth=>width", this.direction = this.scrollx ? "scrollLeft" : "scrollTop";
163
163
  },
164
164
  methods: {
165
- exec: b,
165
+ exec: _,
166
166
  trigger(t, e) {
167
- nt(t) || (t = t && e ? [[t, e]] : []), t.length && this.lazyrun(() => {
168
- H(t, (i, r) => {
169
- this.$emit(r[0], et(r[1]) ? !0 : r[1]);
167
+ ht(t) || (t = t && e ? [[t, e]] : []), t.length && this.lazyrun(() => {
168
+ P(t, (i, r) => {
169
+ this.$emit(r[0], it(r[1]) ? !0 : r[1]);
170
170
  });
171
171
  });
172
172
  },
@@ -177,11 +177,11 @@ const Mt = {
177
177
  setview(t) {
178
178
  T([this.cheackflys, (e) => {
179
179
  e = e || {};
180
- let i = e.index || H(this.flys, (r, n, l, s) => {
180
+ let i = e.index || P(this.flys, (r, n, l, s) => {
181
181
  if (n[l] == s)
182
182
  return r;
183
183
  }, e.picker, e.id);
184
- et(i) || this.setindex(i);
184
+ it(i) || this.setindex(i);
185
185
  }], this, t);
186
186
  },
187
187
  setindex(t) {
@@ -209,22 +209,22 @@ const Mt = {
209
209
  };
210
210
  B(r, this.space), t.from || e.push(["onscroll", r]);
211
211
  let n = !1;
212
- H(
212
+ P(
213
213
  this.flyweights,
214
- (l, s, h, o, u, c, d, f, a) => {
215
- if (h = l / u >> 0, f = h + o * /* 偏移量, 如果超出顶部 + 1轮,排列到列队后, 否则保持在当前*/
216
- (+(h < c % o) + (c / o >> 0)), a = f * u + l % u, a >= this.count) {
214
+ (l, s, h, o, d, u, c, f, a) => {
215
+ if (h = l / d >> 0, f = h + o * /* 偏移量, 如果超出顶部 + 1轮,排列到列队后, 否则保持在当前*/
216
+ (+(h < u % o) + (u / o >> 0)), a = f * d + l % d, a >= this.count) {
217
217
  n || (e.push(["onend"]), n = !0);
218
218
  return;
219
219
  }
220
220
  s.index = f, s.i = a, s.data = this.flys[a];
221
- let x = [
221
+ let v = [
222
222
  /* top */
223
223
  f * this.expand + s.x,
224
224
  /* left */
225
225
  s.space
226
226
  ];
227
- d && x.reverse(), s.top = x[0], s.left = x[1];
227
+ c && v.reverse(), s.top = v[0], s.left = v[1];
228
228
  },
229
229
  null,
230
230
  this.row,
@@ -242,67 +242,67 @@ const Mt = {
242
242
  if (!t)
243
243
  return e.length = t;
244
244
  this.count = t;
245
- let i = this.scrollx, r = this.flyweight, n = O(r, this.BoxRule);
245
+ let i = this.scrollx, r = this.flyweight, n = C(r, this.BoxRule);
246
246
  this.$nextTick(() => {
247
- let l = /true/.test(this.auto), [s, h] = this.offset, o = n.width, u = n.height, c = (Z(this.width, o) || o) + s, d = Z(this.height, u) + h, f = [o / c >> 0 || 1, u / d >> 0 || 1];
247
+ let l = /true/.test(this.auto), [s, h] = this.offset, o = n.width, d = n.height, u = (tt(this.width, o) || o) + s, c = tt(this.height, d) + h, f = [o / u >> 0 || 1, d / c >> 0 || 1];
248
248
  i && f.reverse();
249
- let [a, x] = f, v = this.padding, L, S = 0, g, y;
250
- i ? (g = c, c -= s, y = (_) => (
249
+ let [a, v] = f, x = this.padding, E, S = 0, y, w;
250
+ i ? (y = u, u -= s, w = ($) => (
251
251
  /* 计算top偏移量 */
252
- _ * (d - h) + (_ + 1) * h
253
- )) : (l ? (c = (o - s * (a + 2 * v - 1)) / a, L = !v * s, S = v * s) : (L = 0, S = (o % c + s * a) / (a + 1) >> 0, c -= s), y = (_) => _ * (c + L) + (_ + 1) * S, g = d), this.row = x + 2, this.column = a, this.realH = d - h, this.realW = c, this.expand = g, this.Size = Math.ceil(t / a) * g;
254
- let $ = Math.min(t, a * this.row), w = $ - 1, k;
255
- for (; $-- > 0; )
256
- k = w - $, this.$set(e, k, {
252
+ $ * (c - h) + ($ + 1) * h
253
+ )) : (l ? (u = (o - s * (a + 2 * x - 1)) / a, E = !x * s, S = x * s) : (E = 0, S = (o % u + s * a) / (a + 1) >> 0, u -= s), w = ($) => $ * (u + E) + ($ + 1) * S, y = c), this.row = v + 2, this.column = a, this.realH = c - h, this.realW = u, this.expand = y, this.Size = Math.ceil(t / a) * y;
254
+ let b = Math.min(t, a * this.row), m = b - 1, N;
255
+ for (; b-- > 0; )
256
+ N = m - b, this.$set(e, N, {
257
257
  x: s,
258
258
  y: h,
259
- width: c,
260
- height: d - h,
261
- space: y(k % a),
259
+ width: u,
260
+ height: c - h,
261
+ space: w(N % a),
262
262
  data: {}
263
263
  });
264
- e.length = w + 1;
265
- let N = [];
266
- u / g > w / a && N.push(["onend"]), this.flyweight && (this.flyweight[this.direction] = 0), this.$nextTick(() => {
264
+ e.length = m + 1;
265
+ let k = [];
266
+ d / y > m / a && k.push(["onend"]), this.flyweight && (this.flyweight[this.direction] = 0), this.$nextTick(() => {
267
267
  this.setindex(this.selectIndex || 0), this.scroll();
268
- }), N.push(["update:space", {
269
- row: (w / a >> 0) + 1,
268
+ }), k.push(["update:space", {
269
+ row: (m / a >> 0) + 1,
270
270
  column: a,
271
271
  showrow: this.row,
272
272
  showcolumn: this.column
273
- }]), this.trigger(N);
273
+ }]), this.trigger(k);
274
274
  });
275
275
  }
276
276
  }
277
- }, Lt = { class: "flyweight-all" };
278
- function Et(t, e, i, r, n, l) {
277
+ }, Pt = { class: "flyweight-all" };
278
+ function Rt(t, e, i, r, n, l) {
279
279
  return z(), M("div", {
280
280
  ref: "flyweight",
281
- class: ht(["flyweight", {
281
+ class: dt(["flyweight", {
282
282
  "flyweight-active": n.actice
283
283
  }]),
284
- style: I(l.style),
284
+ style: O(l.style),
285
285
  onScroll: e[0] || (e[0] = (...s) => l.scroll && l.scroll(...s))
286
286
  }, [
287
- P("div", Lt, [
288
- (z(!0), M(at, null, ct(n.flyweights, (s, h) => (z(), M("div", {
287
+ R("div", Pt, [
288
+ (z(!0), M(ut, null, ct(n.flyweights, (s, h) => (z(), M("div", {
289
289
  key: h,
290
- style: I({
290
+ style: O({
291
291
  top: s.top + "px",
292
292
  left: s.left + "px"
293
293
  })
294
294
  }, [
295
- m(t.$slots, "default", U({ ref_for: !0 }, s), void 0, !0)
295
+ g(t.$slots, "default", G({ ref_for: !0 }, s), void 0, !0)
296
296
  ], 4))), 128))
297
297
  ]),
298
- n.flyweights.length ? m(t.$slots, "end", { key: 0 }, void 0, !0) : ut("", !0)
298
+ n.flyweights.length ? g(t.$slots, "end", { key: 0 }, void 0, !0) : ft("", !0)
299
299
  ], 38);
300
300
  }
301
- const Ht = /* @__PURE__ */ j(Mt, [["render", Et], ["__scopeId", "data-v-35b94e9b"]]);
302
- function G(t, e) {
301
+ const Wt = /* @__PURE__ */ I(Lt, [["render", Rt], ["__scopeId", "data-v-35b94e9b"]]);
302
+ function D(t, e) {
303
303
  return e && (t = t.replace(/[a-z]/g, "")), t.toLowerCase();
304
304
  }
305
- let ft = {
305
+ let gt = {
306
306
  close: {
307
307
  handler(t) {
308
308
  this.change(t);
@@ -315,7 +315,7 @@ let ft = {
315
315
  },
316
316
  deep: !0
317
317
  }
318
- }, Pt = [
318
+ }, At = [
319
319
  "BackGround",
320
320
  "BordeR",
321
321
  "Height",
@@ -324,17 +324,17 @@ let ft = {
324
324
  "Right",
325
325
  "Bottom",
326
326
  "Left"
327
- ], pt = {};
328
- H(
329
- Pt,
327
+ ], yt = {};
328
+ P(
329
+ At,
330
330
  (t, e, i) => {
331
- t = G(e), pt["--" + G(e, !0)] = t, i[t] = function() {
331
+ t = D(e), yt["--" + D(e, !0)] = t, i[t] = function() {
332
332
  this.trigger++;
333
333
  };
334
334
  },
335
- ft
335
+ gt
336
336
  );
337
- const Wt = {
337
+ const Bt = {
338
338
  name: "Card",
339
339
  // inheritAttrs: false,
340
340
  props: {
@@ -393,24 +393,24 @@ const Wt = {
393
393
  return this.tr();
394
394
  }
395
395
  },
396
- watch: ft,
396
+ watch: gt,
397
397
  methods: {
398
- exec: b,
399
- isEmpty: ot,
400
- isSimplyType: J,
398
+ exec: _,
399
+ isEmpty: at,
400
+ isSimplyType: K,
401
401
  tr() {
402
402
  let t = {};
403
- return this.margin(this.offset), H(pt, (e, i) => {
403
+ return this.margin(this.offset), P(yt, (e, i) => {
404
404
  this.css(t, e, i);
405
405
  }), t;
406
406
  },
407
- tolower: G,
407
+ tolower: D,
408
408
  css(t, e, i) {
409
409
  let r = this[i] || this.default[i];
410
- !r || this.default[i] == r || (t[e] = b(r));
410
+ !r || this.default[i] == r || (t[e] = _(r));
411
411
  },
412
412
  change(t) {
413
- J(t) || (this.closecss = O(
413
+ K(t) || (this.closecss = C(
414
414
  t,
415
415
  "color=>--s-card-close-color,size=>--s-close-width,bold=>--s-close-height,*"
416
416
  ));
@@ -418,8 +418,8 @@ const Wt = {
418
418
  margin(t) {
419
419
  B(
420
420
  this,
421
- O(
422
- bt(t) ? t.split(/\s*(?:,|\s+)\s*/) : t,
421
+ C(
422
+ xt(t) ? t.split(/\s*(?:,|\s+)\s*/) : t,
423
423
  "0=>top,1|0=>right,2|0=>bottom,3|1|0=>left",
424
424
  !0
425
425
  ),
@@ -430,42 +430,42 @@ const Wt = {
430
430
  mounted() {
431
431
  this.change(this.close);
432
432
  }
433
- }, At = { class: "card-title" }, Ct = ["title"], Rt = { class: "card-content" };
434
- function Bt(t, e, i, r, n, l) {
433
+ }, Ct = { class: "card-title" }, Ot = ["title"], It = { class: "card-content" };
434
+ function jt(t, e, i, r, n, l) {
435
435
  return z(), M("div", {
436
436
  class: "card",
437
437
  key: n.trigger,
438
- style: I(l.isEmpty(l.style) ? l.tr() : l.style)
438
+ style: O(l.isEmpty(l.style) ? l.tr() : l.style)
439
439
  }, [
440
- m(t.$slots, "default", {}, () => [
441
- m(t.$slots, "title", {}, () => {
440
+ g(t.$slots, "default", {}, () => [
441
+ g(t.$slots, "title", {}, () => {
442
442
  var s;
443
443
  return [
444
- P("div", At, [
445
- dt(D(i.show || i.title) + " ", 1),
446
- P("div", {
447
- class: ht(["card-close", { hide: l.isSimplyType(i.close) ? !i.close : !1 }]),
448
- style: I(n.closecss),
444
+ R("div", Ct, [
445
+ pt(F(i.show || i.title) + " ", 1),
446
+ R("div", {
447
+ class: dt(["card-close", { hide: l.isSimplyType(i.close) ? !i.close : !1 }]),
448
+ style: O(n.closecss),
449
449
  onClick: e[0] || (e[0] = (h) => t.$emit("close")),
450
450
  title: (s = i.close) == null ? void 0 : s.tips
451
- }, null, 14, Ct)
451
+ }, null, 14, Ot)
452
452
  ])
453
453
  ];
454
454
  }, !0),
455
- m(t.$slots, "content", {}, () => [
456
- P("div", Rt, [
457
- m(t.$slots, "inner", {}, void 0, !0)
455
+ g(t.$slots, "content", {}, () => [
456
+ R("div", It, [
457
+ g(t.$slots, "inner", {}, void 0, !0)
458
458
  ])
459
459
  ], !0)
460
460
  ], !0)
461
461
  ], 4);
462
462
  }
463
- const Ot = /* @__PURE__ */ j(Wt, [["render", Bt], ["__scopeId", "data-v-2008eeb3"]]), It = {
463
+ const Ft = /* @__PURE__ */ I(Bt, [["render", jt], ["__scopeId", "data-v-2008eeb3"]]), Dt = {
464
464
  name: "Stream",
465
465
  computed: {
466
466
  column() {
467
467
  let { columns: t, T: e } = this, i = t || e;
468
- return ot(i) ? [] : nt(i) ? i : [i];
468
+ return at(i) ? [] : ht(i) ? i : [i];
469
469
  }
470
470
  },
471
471
  props: {
@@ -498,25 +498,25 @@ const Ot = /* @__PURE__ */ j(Wt, [["render", Bt], ["__scopeId", "data-v-2008eeb3
498
498
  }
499
499
  }
500
500
  };
501
- function jt(t, e, i, r, n, l) {
502
- return z(), xt(vt(i.type), St($t(t.$attrs)), {
503
- default: zt(() => [
504
- (z(!0), M(at, null, ct(l.column, (s) => m(t.$slots, l.trigger(s), U({
501
+ function Gt(t, e, i, r, n, l) {
502
+ return z(), St($t(i.type), zt(Nt(t.$attrs)), {
503
+ default: kt(() => [
504
+ (z(!0), M(ut, null, ct(l.column, (s) => g(t.$slots, l.trigger(s), G({
505
505
  key: s.type
506
506
  }, { ref_for: !0 }, s))), 128))
507
507
  ]),
508
508
  _: 3
509
509
  }, 16);
510
510
  }
511
- const Ft = /* @__PURE__ */ j(It, [["render", jt]]), it = /(?:\,|\|{2})/, C = "px", st = "";
512
- let gt = document.documentElement, rt, lt = ["s-left", "s-top", "s-right", "s-bottom"], Dt = { left: 0, top: 1, right: 2, bottom: 3 };
513
- const V = [];
514
- var Gt = kt(
511
+ const Ut = /* @__PURE__ */ I(Dt, [["render", Gt]]), st = /(?:\,|\|{2})/, rt = "px", lt = "";
512
+ let mt = document.documentElement, nt, ot = ["s-left", "s-top", "s-right", "s-bottom"], Vt = { left: 0, top: 1, right: 2, bottom: 3 };
513
+ const U = [];
514
+ var qt = Mt(
515
515
  window,
516
516
  "Reflect.defineProperty|Object.defineProperty=>Proxy"
517
517
  ).Proxy;
518
- let X = {}, yt = null;
519
- Gt(X, "delay", {
518
+ let V = {}, wt = null;
519
+ qt(V, "delay", {
520
520
  /**
521
521
  * 获取延迟时间值
522
522
  * @returns {number} 返回当前实例的延迟时间属性值
@@ -525,79 +525,77 @@ Gt(X, "delay", {
525
525
  return this._delay;
526
526
  },
527
527
  set(t) {
528
- yt = Ut(() => {
529
- p(V);
528
+ wt = Xt(() => {
529
+ p(U);
530
530
  }, t), this._delay = t;
531
531
  }
532
532
  });
533
- X.delay = 60;
534
- function Ut(t, e) {
533
+ V.delay = 60;
534
+ function Xt(t, e) {
535
535
  let i = 0;
536
536
  return function() {
537
537
  const r = Date.now();
538
538
  r - i >= e && (i = r, p(t, this, arguments));
539
539
  };
540
540
  }
541
- const R = () => {
542
- yt();
541
+ const A = () => {
542
+ wt();
543
543
  };
544
- function Vt(t) {
545
- V.push(t);
544
+ function Yt(t) {
545
+ U.push(t);
546
546
  }
547
- const E = new ResizeObserver(R);
548
- E.observe(gt);
549
- function mt(t) {
550
- t.onresize || (V.push([mt, null, t]), t.onresize = !0);
551
- var e = gt, i = e.clientHeight, r = t.offset || 15, n = t.target, l = t.room, s = t.index, h = t.position, o = n.getBoundingClientRect(), u = l.offsetHeight + r, c = l.offsetWidth + r, d = "3,0,2,1".split(it), f, a = (o.height == rt ? o.bottom - o.top : o.height) >> 0, x = (o.width == rt ? o.right - o.left : o.width) >> 0, v = e.clientWidth - c, L = i - u, S = [
547
+ const L = new ResizeObserver(A);
548
+ L.observe(mt);
549
+ function bt(t) {
550
+ t.onresize || (U.push([bt, null, t]), t.onresize = !0);
551
+ var e = mt, i = e.clientHeight, r = Tt(t.offset) ? 15 : t.offset, n = t.target, l = t.room, s = t.index, h = t.position, o = n.getBoundingClientRect(), d = l.offsetHeight + r, u = l.offsetWidth + r, c = "3,0,2,1".split(st), f, a = (o.height == nt ? o.bottom - o.top : o.height) >> 0, v = (o.width == nt ? o.right - o.left : o.width) >> 0, x = e.clientWidth - u, E = i - d, S = [
552
552
  /* left: 0 */
553
- o.left - c,
553
+ o.left - u,
554
554
  /* top: 1 */
555
- o.top - u,
555
+ o.top - d,
556
556
  /* right: 2 */
557
- v - o.right,
557
+ x - o.right,
558
558
  /* bottom: 3 */
559
- L - o.bottom
559
+ E - o.bottom
560
560
  ];
561
- h && (K(
562
- h.split(it),
563
- function(wt, A, F, _t) {
564
- _t.push(F[A]);
561
+ h && (Q(
562
+ h.split(st),
563
+ function(_t, W, j, vt) {
564
+ vt.push(j[W]);
565
565
  },
566
- Dt,
566
+ Vt,
567
567
  f = []
568
- ), d.unshift.apply(d, f)), s = K(
569
- d,
570
- function(wt, A, F) {
571
- if (F[A] > 0)
572
- return A;
568
+ ), c.unshift.apply(c, f)), s = Q(
569
+ c,
570
+ function(_t, W, j) {
571
+ if (j[W] > 0)
572
+ return W;
573
573
  },
574
574
  S
575
575
  );
576
- var g = 0, y = 0, $ = 0;
576
+ var y = 0, w = 0, b = 0;
577
577
  if (s != null) {
578
- var w = s == 0 || s == 2, k = s == 3 || s == 1;
579
- g = k ? Math.min(o.left, v) : s == 2 ? o.right + r : S[0], u -= r * +w;
580
- var N = Math.max(o.top, 0), _ = Math.min(
578
+ var m = s == 0 || s == 2, N = s == 3 || s == 1;
579
+ y = N ? Math.min(o.left, x) : s == 2 ? o.right + r : S[0], d -= r * +m;
580
+ var k = Math.max(o.top, 0), $ = Math.min(
581
581
  o.bottom,
582
582
  i
583
- ), Y = (_ - u + Math.min(i - u, N)) / 2;
584
- y = Math.max(
585
- w ? Y : s == 3 ? o.top + a + r : Math.min(Y, S[1]),
583
+ ), q = ($ - d + Math.min(i - d, k)) / 2;
584
+ w = Math.max(
585
+ m ? q : s == 3 ? o.top + a + r : Math.min(q, S[1]),
586
586
  0
587
- ), k && o.left > v && ($ = o.left - g - r + x / 2);
587
+ ), N && o.left > x && (b = o.left - y - r + v / 2);
588
588
  }
589
- let q = l.classList, W = t.css;
590
- q.remove(...lt), q.add(lt[s]), t.index = s, W.left = g + C, W.top = y + C, W["--tips-position-top"] = w ? Math.max(
591
- r,
592
- Math.min(
593
- /* 底边距 */
594
- (Math.min(y + u, _) + Math.max(y, N)) / 2 - y + r / 2,
595
- /* 容器高度 - offset / 2 */
596
- u - 0.5 * r
597
- )
598
- ) + C : st, W["--tips-position-left"] = $ ? Math.min($, c - 3 * r) + C : st;
589
+ let X = l.classList, H = t.css;
590
+ X.remove(...ot), X.add(ot[s]), t.index = s, H.left = y + rt, H.top = w + rt;
591
+ let Y = H["--tips-arrow-top"] = m ? Math.min(
592
+ /* 底边距 */
593
+ Math.max(w, k) - w,
594
+ d - r
595
+ ) : lt, J = u - 3 * r;
596
+ H["--tips-arrow"] = b > J - 10 || m && (Y + (d > 50 ? 15 : 0) > d || !Y) ? "hidden" : "visible", H["--tips-arrow-left"] = b ? Math.min(b, J) : lt;
599
597
  }
600
- const Xt = {
598
+ const Jt = {
601
599
  name: "Tips",
602
600
  props: {
603
601
  /* 是否显示 */
@@ -653,6 +651,11 @@ const Xt = {
653
651
  delay: {
654
652
  type: [String, Number],
655
653
  default: 10
654
+ },
655
+ /* 显示箭头 */
656
+ borderRadius: {
657
+ type: [String, Number],
658
+ default: 10
656
659
  }
657
660
  },
658
661
  watch: {
@@ -683,7 +686,7 @@ const Xt = {
683
686
  },
684
687
  /* 初始化 */
685
688
  init() {
686
- this.$el.nodeName != "#comment" && mt({
689
+ this.$el.nodeName != "#comment" && bt({
687
690
  onresize: !1,
688
691
  /* 监控的目标 */
689
692
  target: this.$el.parentNode,
@@ -694,58 +697,60 @@ const Xt = {
694
697
  /* CSS样式集合 */
695
698
  css: this.css,
696
699
  /* 偏移量 */
697
- offset: +this.offset
700
+ offset: +this.offset >> 0
698
701
  });
699
702
  },
700
703
  scrollListener() {
701
704
  this.static || this.parent((t, e, i) => {
702
- e ? p(t.addEventListener, t, "scroll", R) : (p(E.observe, E, t), (t.offsetHeight < t.scrollHeight || t.offsetWidth < t.scrollWidth) && (i = this.attr(t, "-tips-scroll"), i || (p(t.addEventListener, t, "scroll", R), this.attr(t, "-tips-scroll", "true"))));
705
+ e ? p(t.addEventListener, t, "scroll", A) : (p(L.observe, L, t), (t.offsetHeight < t.scrollHeight || t.offsetWidth < t.scrollWidth) && (i = this.attr(t, "-tips-scroll"), i || (p(t.addEventListener, t, "scroll", A), this.attr(t, "-tips-scroll", "true"))));
703
706
  });
704
707
  }
705
708
  },
706
709
  mounted() {
707
710
  B(
708
711
  this.css,
709
- O(
712
+ C(
710
713
  this.$props,
711
- "color=>--tips-color,background=>--tips-background-color,border=>--tips-border-width,fontSize=>--tips-font-size"
714
+ "color=>--tips-color,background=>--tips-background-color,border=>--tips-border-width,fontSize=>--tips-font-size,borderRadius=>--tips-border-radius"
712
715
  )
713
- ), this.init(), X.delay = +this.delay, Vt((t) => {
716
+ ), this.css["--arrow-size"] = Math.sqrt(2 * Math.pow((this.border || 3) * 2 + 2, 2)) / 2 >> 0, this.init(), V.delay = +this.delay, Yt((t) => {
714
717
  this.scrollListener();
715
718
  }), this.scrollListener();
716
719
  },
717
720
  unmounted() {
718
721
  this.parent(function(t, e) {
719
- p(t.removeEventListener, t, "scroll", R), p(t.removeAttribute, t, "-tips-scroll", void 0), e || p(E.unobserve, E, t);
722
+ p(t.removeEventListener, t, "scroll", A), p(t.removeAttribute, t, "-tips-scroll", void 0), e || p(L.unobserve, L, t);
720
723
  });
721
724
  }
722
- }, Yt = ["static"], qt = { class: "tips-title" };
723
- function Jt(t, e, i, r, n, l) {
724
- return i.visible ? (z(), M("div", U({
725
+ }, Kt = ["static"], Qt = { class: "tips-title" };
726
+ function Zt(t, e, i, r, n, l) {
727
+ return i.visible ? (z(), M("div", G({
725
728
  key: 0,
726
729
  class: "tips",
727
730
  style: i.static ? null : n.css,
728
731
  static: i.static ? "" : null
729
732
  }, t.$attrs), [
730
- m(t.$slots, "title", {}, () => [
731
- P("div", qt, D(i.title), 1)
732
- ], !0),
733
- m(t.$slots, "content", {}, () => [
734
- dt(D(i.content), 1)
733
+ g(t.$slots, "default", {}, () => [
734
+ g(t.$slots, "title", {}, () => [
735
+ R("div", Qt, F(i.title), 1)
736
+ ], !0),
737
+ g(t.$slots, "content", {}, () => [
738
+ pt(F(i.content), 1)
739
+ ], !0)
735
740
  ], !0)
736
- ], 16, Yt)) : ut("", !0);
741
+ ], 16, Kt)) : ft("", !0);
737
742
  }
738
- const Kt = /* @__PURE__ */ j(Xt, [["render", Jt], ["__scopeId", "data-v-660ad090"]]), Qt = [Ht, Ot, Ft, Kt], se = {
743
+ const te = /* @__PURE__ */ I(Jt, [["render", Zt], ["__scopeId", "data-v-8c83dee3"]]), ee = [Wt, Ft, Ut, te], ne = {
739
744
  install(t) {
740
- Qt.forEach((e) => {
745
+ ee.forEach((e) => {
741
746
  t.component("S" + e.name, e), t.component(e.name + "S", e);
742
747
  });
743
748
  }
744
749
  };
745
750
  export {
746
- Ot as Card,
747
- Ht as Flyweight,
748
- Ft as Stream,
749
- Kt as Tips,
750
- se as default
751
+ Ft as Card,
752
+ Wt as Flyweight,
753
+ Ut as Stream,
754
+ te as Tips,
755
+ ne as default
751
756
  };
package/README.md CHANGED
@@ -6,6 +6,19 @@
6
6
 
7
7
  [![安装](https://img.shields.io/badge/-@soei-ae8aff?style=flat-square)![NPM Downloads by package author](https://img.shields.io/npm-stat/dw/soeiz?style=flat-square)](https://npmjs.com/package/@soei/flyweight)
8
8
 
9
+ ```html
10
+ <!-- 版本 0.3.10 新增属Tips -->
11
+ <!-- arrow: 显示箭头 -->
12
+ <!-- [notice|warn|simply]: 内置样式, 不喜欢可以background="..." color="..." -->
13
+ <Tips
14
+ class="notice|warn|simply|arrow|animate"
15
+ ...
16
+ />
17
+ <Tips >
18
+ .....
19
+ </Tips>
20
+ ```
21
+
9
22
  ```html
10
23
  <!-- 版本 0.3.9 新增属Tips -->
11
24
  <Tips
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@soei/flyweight",
3
3
  "private": false,
4
4
  "description": "Vue组件, 列表de享元模式~减少DOM节点 flyweight, Card, Stream组件",
5
- "version": "0.3.9",
5
+ "version": "0.3.11",
6
6
  "type": "module",
7
7
  "main": "Flyweight.cjs",
8
8
  "module": "Flyweight.js",