@opentiny/tiny-robot 0.5.2-beta.0 → 0.5.2-rc.0

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/dist/index8.js CHANGED
@@ -1,50 +1,64 @@
1
- import { onMounted as W, nextTick as P, h as k, render as B, onBeforeUnmount as j, defineComponent as h, Teleport as D, ref as E, openBlock as x, createBlock as C, Transition as M, normalizeProps as Z, guardReactiveProps as q, withCtx as G, createElementBlock as J, renderSlot as K, createCommentVNode as L, useSlots as Q, computed as d, watch as X, useAttrs as Y, resolveDynamicComponent as ee, unref as T, mergeProps as R, createVNode as te } from "vue";
2
- import { d as oe, c as re } from "./index4.js";
3
- import { t as l } from "./utils.js";
4
- import { _ as F } from "./_plugin-vue_export-helper.js";
1
+ import { onMounted as U, nextTick as B, h as C, render as R, onBeforeUnmount as D, defineComponent as _, Teleport as W, computed as h, ref as E, openBlock as g, createBlock as F, Transition as j, normalizeProps as q, guardReactiveProps as L, withCtx as Z, createElementBlock as G, renderSlot as J, createCommentVNode as K, useSlots as Q, watch as X, useAttrs as Y, resolveDynamicComponent as ee, unref as S, mergeProps as k, createVNode as te } from "vue";
2
+ import { a as oe, d as re, c as ne } from "./index4.js";
3
+ import { t as u } from "./utils.js";
4
+ import { _ as N } from "./_plugin-vue_export-helper.js";
5
5
  import { u as se } from "./useSlotRefs.js";
6
- import { u as ne } from "./useTeleportTarget.js";
7
- const pe = h({
8
- setup: (r) => () => k(D, r.propsFactory(), r.vnodeFactory()),
6
+ const pe = _({
7
+ setup: (r) => () => C(W, r.propsFactory(), r.vnodeFactory()),
9
8
  props: ["propsFactory", "vnodeFactory"]
10
9
  });
11
- function ae(r, i) {
12
- let t = null, o = null, c = !1;
13
- W(() => {
14
- P(() => {
15
- c || (o = document.createElement("div"), t = k(pe, { propsFactory: r, vnodeFactory: i }), B(t, o));
10
+ function ae(r, n) {
11
+ let e = null, t = null, s = !1;
12
+ U(() => {
13
+ B(() => {
14
+ s || (t = document.createElement("div"), e = C(pe, { propsFactory: r, vnodeFactory: n }), R(e, t));
16
15
  });
17
- }), j(() => {
18
- c = !0, P(() => {
19
- o && (B(null, o), o.remove(), t = null, o = null);
16
+ }), D(() => {
17
+ s = !0, B(() => {
18
+ t && (R(null, t), t.remove(), e = null, t = null);
20
19
  });
21
20
  });
22
21
  }
23
- const le = /* @__PURE__ */ h({
22
+ function ce(r, n) {
23
+ return h(() => {
24
+ var v;
25
+ if (n instanceof HTMLElement)
26
+ return n;
27
+ const e = n, t = oe(r), s = (v = t == null ? void 0 : t.getRootNode) == null ? void 0 : v.call(t), i = s instanceof ShadowRoot, d = i ? s : document.body;
28
+ if (e) {
29
+ if (!i && e === "body")
30
+ return document.body;
31
+ const f = d.querySelector(e);
32
+ if (f instanceof Node) return f;
33
+ }
34
+ return d;
35
+ });
36
+ }
37
+ const ie = /* @__PURE__ */ _({
24
38
  __name: "Popper",
25
39
  props: {
26
40
  show: { type: Boolean },
27
41
  transitionProps: {}
28
42
  },
29
- setup(r, { expose: i }) {
30
- const t = E(null);
31
- return i({
32
- popperRef: t
33
- }), (o, c) => (x(), C(M, Z(q(r.transitionProps)), {
34
- default: G(() => [
35
- r.show ? (x(), J("div", {
43
+ setup(r, { expose: n }) {
44
+ const e = E(null);
45
+ return n({
46
+ popperRef: e
47
+ }), (t, s) => (g(), F(j, q(L(r.transitionProps)), {
48
+ default: Z(() => [
49
+ r.show ? (g(), G("div", {
36
50
  key: 0,
37
51
  class: "tr-base-popper",
38
52
  ref_key: "popperRef",
39
- ref: t
53
+ ref: e
40
54
  }, [
41
- K(o.$slots, "default", {}, void 0, !0)
42
- ], 512)) : L("", !0)
55
+ J(t.$slots, "default", {}, void 0, !0)
56
+ ], 512)) : K("", !0)
43
57
  ]),
44
58
  _: 3
45
59
  }, 16));
46
60
  }
47
- }), ie = /* @__PURE__ */ F(le, [["__scopeId", "data-v-25c13ab7"]]), ce = /* @__PURE__ */ h({
61
+ }), le = /* @__PURE__ */ N(ie, [["__scopeId", "data-v-25c13ab7"]]), ue = /* @__PURE__ */ _({
48
62
  inheritAttrs: !1,
49
63
  __name: "index",
50
64
  props: {
@@ -63,84 +77,85 @@ const le = /* @__PURE__ */ h({
63
77
  triggerEvents: {}
64
78
  },
65
79
  setup(r, {
66
- expose: i
80
+ expose: n
67
81
  }) {
68
- const t = r, o = Q(), {
69
- vnodes: c,
70
- ref: f,
71
- setRef: $
72
- } = se(o.trigger), S = (e = {}) => {
73
- const s = {};
74
- for (const [p, n] of Object.entries(e))
75
- /^on[A-Z]/.test(p) && typeof n == "function" && (s[p] = n);
76
- return s;
77
- }, g = E(null), y = d(() => {
78
- var e;
79
- return ((e = g.value) == null ? void 0 : e.popperRef) || null;
80
- }), u = d(() => {
81
- var e, s;
82
- return typeof t.offset == "number" ? {
83
- mainAxis: t.offset,
82
+ const e = r, t = Q(), {
83
+ vnodes: s,
84
+ ref: i,
85
+ setRef: d
86
+ } = se(t.trigger), v = (o = {}) => {
87
+ const p = {};
88
+ for (const [c, a] of Object.entries(o))
89
+ /^on[A-Z]/.test(c) && typeof a == "function" && (p[c] = a);
90
+ return p;
91
+ }, f = E(null), b = h(() => {
92
+ var o;
93
+ return ((o = f.value) == null ? void 0 : o.popperRef) || null;
94
+ }), m = h(() => {
95
+ var o, p;
96
+ return typeof e.offset == "number" ? {
97
+ mainAxis: e.offset,
84
98
  crossAxis: 0
85
99
  } : {
86
- mainAxis: ((e = t.offset) == null ? void 0 : e.mainAxis) ?? 0,
87
- crossAxis: ((s = t.offset) == null ? void 0 : s.crossAxis) ?? 0
100
+ mainAxis: ((o = e.offset) == null ? void 0 : o.mainAxis) ?? 0,
101
+ crossAxis: ((p = e.offset) == null ? void 0 : p.crossAxis) ?? 0
88
102
  };
89
103
  }), {
90
- top: V,
104
+ top: $,
91
105
  bottom: O,
92
- left: _,
93
- right: z,
94
- width: I,
95
- update: b
96
- } = oe(f), {
97
- width: m,
98
- height: A
99
- } = re(y, void 0, {
106
+ left: w,
107
+ right: V,
108
+ width: z,
109
+ update: A
110
+ } = re(i), {
111
+ width: x,
112
+ height: P
113
+ } = ne(b, void 0, {
100
114
  box: "border-box"
101
- }), N = d(() => {
115
+ }), H = h(() => {
102
116
  const {
103
- placement: e,
104
- preventOverflow: s
105
- } = t, p = {}, n = (a, v) => {
106
- if (!s) {
107
- p[a] = v;
117
+ placement: o,
118
+ preventOverflow: p
119
+ } = e, c = {}, a = (l, y) => {
120
+ if (!p) {
121
+ c[l] = y;
108
122
  return;
109
123
  }
110
- const w = l(a === "top" ? A.value : m.value);
111
- a === "top" ? p[a] = `clamp(var(--tr-base-popper-min-top), ${v}, calc(var(--tr-base-popper-max-bottom) - ${w}))` : a === "left" && (p[a] = `clamp(var(--tr-base-popper-min-left), ${v}, calc(var(--tr-base-popper-max-right) - ${w}))`);
124
+ const T = u(l === "top" ? P.value : x.value);
125
+ l === "top" ? c[l] = `clamp(var(--tr-base-popper-min-top), ${y}, calc(var(--tr-base-popper-max-bottom) - ${T}))` : l === "left" && (c[l] = `clamp(var(--tr-base-popper-min-left), ${y}, calc(var(--tr-base-popper-max-right) - ${T}))`);
112
126
  };
113
- return e.includes("top") && n("top", l(V.value - A.value - u.value.mainAxis)), e.includes("bottom") && n("top", l(O.value + u.value.mainAxis)), e.includes("left") && n("left", l(_.value + u.value.crossAxis)), e.includes("right") && n("left", l(z.value - m.value + u.value.crossAxis)), e.includes("center") && n("left", l(_.value + I.value / 2 - m.value / 2 + u.value.crossAxis)), p;
127
+ return o.includes("top") && a("top", u($.value - P.value - m.value.mainAxis)), o.includes("bottom") && a("top", u(O.value + m.value.mainAxis)), o.includes("left") && a("left", u(w.value + m.value.crossAxis)), o.includes("right") && a("left", u(V.value - x.value + m.value.crossAxis)), o.includes("center") && a("left", u(w.value + z.value / 2 - x.value / 2 + m.value.crossAxis)), c;
114
128
  });
115
- X(() => t.show, (e) => {
116
- e && b();
129
+ X(() => e.show, (o) => {
130
+ o && A();
117
131
  }, {
118
132
  flush: "post"
119
133
  });
120
- const U = ne(f, t.appendTo), H = Y();
134
+ const I = ce(i, e.appendTo), M = Y();
121
135
  return ae(() => ({
122
- to: U.value
123
- }), () => te(ie, R({
124
- ref: g,
125
- show: t.show,
126
- transitionProps: t.transitionProps,
127
- style: N.value
128
- }, H), {
136
+ to: I.value
137
+ }), () => te(le, k({
138
+ ref: f,
139
+ show: e.show,
140
+ transitionProps: e.transitionProps,
141
+ style: H.value
142
+ }, M), {
129
143
  default: () => {
130
- var e;
131
- return [(e = o.content) == null ? void 0 : e.call(o)];
144
+ var o;
145
+ return [(o = t.content) == null ? void 0 : o.call(t)];
132
146
  }
133
- })), i({
134
- triggerRef: f,
135
- popperRef: y,
136
- update: b
137
- }), (e, s) => (x(), C(ee(T(c)[0]), R({
138
- ref: T($)
139
- }, S(t.triggerEvents)), null, 16));
147
+ })), n({
148
+ triggerRef: i,
149
+ popperRef: b,
150
+ update: A
151
+ }), (o, p) => (g(), F(ee(S(s)[0]), k({
152
+ ref: S(d)
153
+ }, v(e.triggerEvents)), null, 16));
140
154
  }
141
- }), ue = /* @__PURE__ */ F(ce, [["__scopeId", "data-v-f1e25842"]]);
142
- ue.name = "TrBasePopper";
155
+ }), fe = /* @__PURE__ */ N(ue, [["__scopeId", "data-v-f1e25842"]]);
156
+ fe.name = "TrBasePopper";
143
157
  export {
144
- ue as B,
145
- ae as c
158
+ fe as B,
159
+ ae as c,
160
+ ce as u
146
161
  };
@@ -1,5 +1,5 @@
1
1
  import { toValue as q, shallowRef as A, computed as c, provide as ke, inject as Pe, defineComponent as k, openBlock as E, createElementBlock as I, normalizeClass as K, createElementVNode as B, ref as te, createBlock as G, createCommentVNode as N, renderSlot as $, Fragment as Me, renderList as Ne, useAttrs as $e, watch as _e, Teleport as Be, mergeProps as Ye, unref as Z, createVNode as Xe, useSlots as Ve, isRef as Ge, normalizeStyle as be, withCtx as pe, normalizeProps as Ue, guardReactiveProps as qe, createTextVNode as Ze, toDisplayString as je, onBeforeUnmount as Ke } from "vue";
2
- import { g as V, t as Je, m as Qe, b as et, u as tt, j as Se, n as nt } from "../index4.js";
2
+ import { g as V, t as Je, m as Qe, b as et, a as tt, j as Se, n as nt } from "../index4.js";
3
3
  import { _ as Y } from "../_plugin-vue_export-helper.js";
4
4
  function ze(e) {
5
5
  const t = q(e.value) !== void 0, n = A(q(e.defaultValue));