@opentiny/tiny-robot 0.3.0-alpha.6 → 0.3.0-alpha.8

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,5 +1,5 @@
1
- import { defineComponent as H, ref as p, computed as P, watch as W, watchEffect as ne, onMounted as Y, onBeforeUnmount as Z, createElementBlock as v, openBlock as g, normalizeClass as j, createElementVNode as u, withDirectives as oe, Fragment as z, renderList as M, createVNode as E, unref as w, toDisplayString as T, vShow as le, nextTick as ie, renderSlot as $, createCommentVNode as N, createBlock as L, normalizeStyle as ae, resolveComponent as ce, withCtx as O } from "vue";
2
- import { A as Q, a as G, t as re, K as ue, U as ge } from "../tiny-robot-svgs.js";
1
+ import { defineComponent as H, ref as p, computed as P, watch as K, watchEffect as ne, onMounted as Y, onBeforeUnmount as Z, createElementBlock as v, openBlock as g, normalizeClass as j, createElementVNode as u, withDirectives as oe, Fragment as z, renderList as M, createVNode as E, unref as w, toDisplayString as T, vShow as le, nextTick as ie, renderSlot as $, createCommentVNode as N, createBlock as L, normalizeStyle as ae, resolveComponent as ce, withCtx as O } from "vue";
2
+ import { m as Q, U as G, a as re, v as ue, A as ge } from "../tiny-robot-svgs.js";
3
3
  function de(l, c = "") {
4
4
  const s = document.createElement("div");
5
5
  c && (s.className = c), s.style.visibility = "hidden", s.style.position = "absolute", s.style.whiteSpace = "nowrap", s.textContent = l, document.body.appendChild(s);
@@ -59,7 +59,7 @@ const ve = { class: "tr-common-suggestions_content" }, me = { class: "tr-common-
59
59
  }, y = (i) => {
60
60
  o("suggestion-click", i);
61
61
  };
62
- return W(
62
+ return K(
63
63
  () => s.isExpanded,
64
64
  (i) => {
65
65
  t.value = i;
@@ -150,7 +150,7 @@ const ve = { class: "tr-common-suggestions_content" }, me = { class: "tr-common-
150
150
  });
151
151
  function Ee(l, c = {}) {
152
152
  const s = p(c.initialIndex || -1);
153
- W(l, (t) => {
153
+ K(l, (t) => {
154
154
  t.length > 0 && s.value === -1 ? s.value = 0 : t.length === 0 ? s.value = -1 : s.value >= t.length && (s.value = t.length - 1);
155
155
  });
156
156
  const o = (t) => {
@@ -189,10 +189,10 @@ function Ee(l, c = {}) {
189
189
  }
190
190
  };
191
191
  }
192
- const Te = { class: "tr-suggestion-panel" }, Be = { class: "tr-suggestion-header" }, De = { class: "tr-suggestion-header-left" }, Oe = { class: "tr-suggestion-header-icon" }, Re = { class: "tr-suggestion-header-title" }, Ae = { class: "close-icon" }, Ke = {
192
+ const Te = { class: "tr-suggestion-panel" }, Be = { class: "tr-suggestion-header" }, De = { class: "tr-suggestion-header-left" }, Oe = { class: "tr-suggestion-header-icon" }, Re = { class: "tr-suggestion-header-title" }, Ae = { class: "close-icon" }, Ve = {
193
193
  key: 0,
194
194
  class: "tr-suggestion-loading"
195
- }, Ve = { key: 1 }, We = ["onClick", "onMouseenter"], ze = { class: "item-content" }, Me = { class: "item-label" }, Ne = {
195
+ }, We = { key: 1 }, Ke = ["onClick", "onMouseenter"], ze = { class: "item-content" }, Me = { class: "item-label" }, Ne = {
196
196
  key: 0,
197
197
  class: "item-description"
198
198
  }, qe = {
@@ -275,11 +275,11 @@ const Te = { class: "tr-suggestion-panel" }, Be = { class: "tr-suggestion-header
275
275
  class: "tr-suggestion-content",
276
276
  style: ae({ "max-height": h.value.length > l.maxVisibleItems ? `${l.maxVisibleItems * 56}px` : "auto" })
277
277
  }, [
278
- l.loading ? (g(), v("div", Ke, [
278
+ l.loading ? (g(), v("div", Ve, [
279
279
  $(i.$slots, "loading-indicator", {}, () => [
280
280
  d[0] || (d[0] = u("div", { class: "tr-suggestion-loading-spinner" }, null, -1))
281
281
  ])
282
- ])) : h.value.length > 0 ? (g(), v("ul", Ve, [
282
+ ])) : h.value.length > 0 ? (g(), v("ul", We, [
283
283
  (g(!0), v(z, null, M(h.value, (r, _) => (g(), v("li", {
284
284
  key: r.id,
285
285
  class: j(["tr-suggestion-list-item", { "tr-suggestion-item-active": _ === w(m) }]),
@@ -295,7 +295,7 @@ const Te = { class: "tr-suggestion-panel" }, Be = { class: "tr-suggestion-header
295
295
  r.description ? (g(), v("div", Ne, T(r.description), 1)) : N("", !0)
296
296
  ])
297
297
  ])
298
- ], 42, We))), 128))
298
+ ], 42, Ke))), 128))
299
299
  ])) : (g(), v("div", qe, [
300
300
  $(i.$slots, "empty", {}, () => [
301
301
  d[1] || (d[1] = u("p", null, "无匹配结果", -1))
@@ -347,11 +347,11 @@ const Te = { class: "tr-suggestion-panel" }, Be = { class: "tr-suggestion-header
347
347
  const e = o.categories.find((x) => x.id === b.value);
348
348
  return e ? e.items : [];
349
349
  });
350
- W(r, (e) => {
350
+ K(r, (e) => {
351
351
  e ? y.value = _.value.length > 0 ? 0 : -1 : y.value = -1;
352
- }), W(_, (e) => {
352
+ }), K(_, (e) => {
353
353
  e.length > 0 && y.value === -1 ? y.value = 0 : e.length === 0 ? y.value = -1 : y.value >= e.length && (y.value = e.length - 1);
354
- }), W(
354
+ }), K(
355
355
  () => o.categories,
356
356
  (e) => {
357
357
  e.length > 0 && !b.value && (b.value = e[0].id);
@@ -366,28 +366,28 @@ const Te = { class: "tr-suggestion-panel" }, Be = { class: "tr-suggestion-header
366
366
  position: 0
367
367
  }), e.template && n("fill-template", e.template);
368
368
  }, C = (e) => {
369
- e === !1 ? K() : (typeof e == "object" && e !== null && (m.value = {
369
+ e === !1 ? V() : (typeof e == "object" && e !== null && (m.value = {
370
370
  text: e.text || "",
371
371
  position: e.position || 0
372
372
  }), k(), f.value = !0, n("update:open", !0));
373
373
  }, I = (e, x) => {
374
- const V = B(e, x);
375
- return V ? (m.value = V, C(V), !0) : r.value && x === "" ? (C(!1), !0) : !1;
374
+ const W = B(e, x);
375
+ return W ? (m.value = W, C(W), !0) : r.value && x === "" ? (C(!1), !0) : !1;
376
376
  }, A = (e) => {
377
377
  if (r.value && d.value) {
378
378
  d.value.handleKeyDown(e);
379
379
  return;
380
380
  }
381
- }, K = () => {
381
+ }, V = () => {
382
382
  o.open === void 0 && (f.value = !1), n("update:open", !1), n("close");
383
383
  }, ee = (e) => {
384
384
  b.value = e.id, y.value = 0, n("category-select", e);
385
385
  }, te = (e, x) => {
386
- n("select", e.text, x), e.template && n("fill-template", e.template), K();
386
+ n("select", e.text, x), e.template && n("fill-template", e.template), V();
387
387
  }, J = (e) => {
388
- o.closeOnOutsideClick && r.value && i.value && !i.value.contains(e.target) && K();
388
+ o.closeOnOutsideClick && r.value && i.value && !i.value.contains(e.target) && V();
389
389
  }, se = () => {
390
- r.value ? K() : (k(), f.value = !0, n("update:open", !0));
390
+ r.value ? V() : (k(), f.value = !0, n("update:open", !0));
391
391
  };
392
392
  return Y(() => {
393
393
  o.closeOnOutsideClick && document.addEventListener("click", J);
@@ -399,7 +399,7 @@ const Te = { class: "tr-suggestion-panel" }, Be = { class: "tr-suggestion-header
399
399
  input: I,
400
400
  toggleExpand: S
401
401
  }), (e, x) => {
402
- const V = ce("IconEdit");
402
+ const W = ce("IconEdit");
403
403
  return g(), v("div", {
404
404
  ref_key: "rootRef",
405
405
  ref: i,
@@ -422,7 +422,7 @@ const Te = { class: "tr-suggestion-panel" }, Be = { class: "tr-suggestion-header
422
422
  $(e.$slots, "capsule-icon", {
423
423
  suggestion: D.suggestion
424
424
  }, () => [
425
- E(V)
425
+ E(W)
426
426
  ])
427
427
  ]),
428
428
  _: 3
@@ -451,7 +451,7 @@ const Te = { class: "tr-suggestion-panel" }, Be = { class: "tr-suggestion-header
451
451
  title: e.title,
452
452
  maxVisibleItems: e.maxVisibleItems,
453
453
  triggerContext: m.value,
454
- onClose: K,
454
+ onClose: V,
455
455
  onSelect: te,
456
456
  onCategorySelect: ee
457
457
  }, {
@@ -1,20 +1,20 @@
1
- import { defineComponent as J, useSlots as Q, computed as a, createElementBlock as m, openBlock as r, normalizeClass as w, renderSlot as H, createBlock as S, resolveDynamicComponent as b, createCommentVNode as M, toDisplayString as ne, mergeModels as N, useModel as le, ref as d, watch as R, nextTick as $, createElementVNode as D, Fragment as z, renderList as G, isVNode as K, createVNode as j, Transition as se, withCtx as re, unref as ae } from "vue";
2
- import { K as ie } from "../tiny-robot-svgs.js";
3
- import { c as ce, d as q, w as ue, o as fe, e as de } from "../index2.js";
1
+ import { defineComponent as K, useSlots as Q, computed as a, createElementBlock as m, openBlock as r, normalizeClass as w, renderSlot as H, createBlock as S, resolveDynamicComponent as b, createCommentVNode as M, toDisplayString as ne, mergeModels as N, useModel as le, ref as d, watch as R, nextTick as $, createElementVNode as D, Fragment as z, renderList as G, isVNode as j, createVNode as q, Transition as se, withCtx as re, unref as ae } from "vue";
2
+ import { v as ie } from "../tiny-robot-svgs.js";
3
+ import { e as ce, f as J, w as ue, o as fe, g as de } from "../index3.js";
4
4
  import { u as me } from "../useSlotRefs.js";
5
5
  import { _ as U } from "../_plugin-vue_export-helper.js";
6
- const pe = { key: 0 }, ge = /* @__PURE__ */ J({
6
+ const pe = { key: 0 }, ve = /* @__PURE__ */ K({
7
7
  __name: "PillButton",
8
8
  props: {
9
9
  item: {}
10
10
  },
11
11
  setup(i) {
12
- const v = i, _ = Q(), p = a(() => {
12
+ const h = i, _ = Q(), p = a(() => {
13
13
  var o;
14
- return !!(_.icon || (o = v.item) != null && o.icon);
14
+ return !!(_.icon || (o = h.item) != null && o.icon);
15
15
  }), I = a(() => {
16
16
  var o;
17
- return !!(_.default || (o = v.item) != null && o.text);
17
+ return !!(_.default || (o = h.item) != null && o.text);
18
18
  }), x = a(() => p.value && !I.value);
19
19
  return (o, u) => (r(), m("button", {
20
20
  class: w(["tr-suggestion-pills__item", { "only-icon": x.value }])
@@ -33,7 +33,7 @@ const pe = { key: 0 }, ge = /* @__PURE__ */ J({
33
33
  }, !0)
34
34
  ], 2));
35
35
  }
36
- }), h = /* @__PURE__ */ U(ge, [["__scopeId", "data-v-5c433c31"]]), he = { class: "tr-suggestion-pills__more-wrapper" }, ve = /* @__PURE__ */ J({
36
+ }), g = /* @__PURE__ */ U(ve, [["__scopeId", "data-v-5c433c31"]]), ge = { class: "tr-suggestion-pills__more-wrapper" }, he = /* @__PURE__ */ K({
37
37
  __name: "index",
38
38
  props: /* @__PURE__ */ N({
39
39
  showAll: { type: Boolean },
@@ -45,11 +45,11 @@ const pe = { key: 0 }, ge = /* @__PURE__ */ J({
45
45
  showAllModifiers: {}
46
46
  }),
47
47
  emits: /* @__PURE__ */ N(["click-outside"], ["update:showAll"]),
48
- setup(i, { expose: v, emit: _ }) {
49
- const p = i, I = Q(), x = _, { vnodes: o } = me(I.default, !0), u = le(i, "showAll"), c = d(null), f = d(null), A = d(null), { width: W } = ce(f), C = d(0), B = a(() => p.overflowMode === "expand" && W.value < C.value), g = d(-1), X = a(() => B.value && u.value ? o.value.slice(0, g.value) : o.value), T = a(() => B.value && u.value ? o.value.slice(g.value).map((e, t) => ({
48
+ setup(i, { expose: h, emit: _ }) {
49
+ const p = i, I = Q(), x = _, { vnodes: o } = me(I.default, !0), u = le(i, "showAll"), c = d(null), f = d(null), A = d(null), { width: W } = ce(f), C = d(0), B = a(() => p.overflowMode === "expand" && W.value < C.value), v = d(-1), X = a(() => B.value && u.value ? o.value.slice(0, v.value) : o.value), T = a(() => B.value && u.value ? o.value.slice(v.value).map((e, t) => ({
50
50
  vnode: e,
51
- index: t + g.value
52
- })) : []), E = d([]), P = d([]), V = a(() => E.value.map((e) => q(e)).filter((e) => e instanceof Element)), Y = a(() => P.value.map((e) => q(e)).filter((e) => e instanceof Element)), L = () => {
51
+ index: t + v.value
52
+ })) : []), E = d([]), P = d([]), V = a(() => E.value.map((e) => J(e)).filter((e) => e instanceof Element)), Y = a(() => P.value.map((e) => J(e)).filter((e) => e instanceof Element)), L = () => {
53
53
  const e = f.value, t = A.value;
54
54
  return Array.from((e == null ? void 0 : e.children) || []).concat(Array.from((t == null ? void 0 : t.children) || []));
55
55
  }, O = () => {
@@ -58,11 +58,11 @@ const pe = { key: 0 }, ge = /* @__PURE__ */ J({
58
58
  if (!e)
59
59
  return;
60
60
  const t = L(), n = parseFloat(getComputedStyle(e).rowGap) || 0;
61
- g.value = -1;
61
+ v.value = -1;
62
62
  let l = 0;
63
63
  for (let s = 0; s < t.length; s++)
64
64
  if (l += t[s].offsetWidth, s > 0 && (l += n), l > e.clientWidth) {
65
- g.value = s;
65
+ v.value = s;
66
66
  break;
67
67
  }
68
68
  });
@@ -109,7 +109,7 @@ const pe = { key: 0 }, ge = /* @__PURE__ */ J({
109
109
  {
110
110
  immediate: !0
111
111
  }
112
- ), v({
112
+ ), h({
113
113
  children: a(() => V.value.concat(Y.value))
114
114
  }), (e, t) => (r(), m("div", {
115
115
  class: "tr-suggestion-pills__wrapper",
@@ -122,14 +122,14 @@ const pe = { key: 0 }, ge = /* @__PURE__ */ J({
122
122
  ref: f
123
123
  }, [
124
124
  (r(!0), m(z, null, G(X.value, (n, l) => (r(), S(b(n), {
125
- key: K(n) ? n.key : l,
125
+ key: j(n) ? n.key : l,
126
126
  ref_for: !0,
127
127
  ref_key: "staticMaybeItemRefs",
128
128
  ref: E
129
129
  }))), 128))
130
130
  ], 2),
131
- D("div", he, [
132
- j(se, { name: "tr-suggestion-pills__more" }, {
131
+ D("div", ge, [
132
+ q(se, { name: "tr-suggestion-pills__more" }, {
133
133
  default: re(() => [
134
134
  T.value.length ? (r(), m("div", {
135
135
  key: 0,
@@ -138,7 +138,7 @@ const pe = { key: 0 }, ge = /* @__PURE__ */ J({
138
138
  ref: A
139
139
  }, [
140
140
  (r(!0), m(z, null, G(T.value, ({ vnode: n, index: l }) => (r(), S(b(n), {
141
- key: K(n) ? n.key : l,
141
+ key: j(n) ? n.key : l,
142
142
  ref_for: !0,
143
143
  ref_key: "floatingMaybeItemRefs",
144
144
  ref: P
@@ -153,24 +153,24 @@ const pe = { key: 0 }, ge = /* @__PURE__ */ J({
153
153
  class: w(["tr-suggestion-pills__expand", { "show-on-hover": p.showAllButtonOn === "hover" }]),
154
154
  onClick: Z
155
155
  }, [
156
- j(ae(ie), {
156
+ q(ae(ie), {
157
157
  class: w(["tr-suggestion-pills__expand-icon", { rotate: u.value }])
158
158
  }, null, 8, ["class"])
159
159
  ], 2)) : M("", !0)
160
160
  ], 512));
161
161
  }
162
- }), k = /* @__PURE__ */ U(ve, [["__scopeId", "data-v-ebbd7a00"]]);
162
+ }), k = /* @__PURE__ */ U(he, [["__scopeId", "data-v-ebbd7a00"]]);
163
163
  k.name = "TrSuggestionPills";
164
164
  const _e = function(i) {
165
165
  i.component(k.name, k);
166
166
  };
167
167
  k.install = _e;
168
- h.name = "TrSuggestionPillButton";
168
+ g.name = "TrSuggestionPillButton";
169
169
  const ye = function(i) {
170
- i.component(h.name, h);
170
+ i.component(g.name, g);
171
171
  };
172
- h.install = ye;
173
- const Re = h;
172
+ g.install = ye;
173
+ const Re = g;
174
174
  export {
175
175
  Re as SuggestionPillButton,
176
176
  k as default