@opentiny/tiny-robot 0.2.11 → 0.2.12

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.
@@ -10,26 +10,26 @@ const ce = { key: 0 }, me = /* @__PURE__ */ H({
10
10
  item: {}
11
11
  },
12
12
  setup(p) {
13
- const y = p, o = Z(), t = w(() => {
14
- var n;
15
- return !!(o.icon || (n = y.item) != null && n.icon);
13
+ const y = p, n = Z(), t = w(() => {
14
+ var o;
15
+ return !!(n.icon || (o = y.item) != null && o.icon);
16
16
  }), l = w(() => {
17
- var n;
18
- return !!(o.default || (n = y.item) != null && n.text);
17
+ var o;
18
+ return !!(n.default || (o = y.item) != null && o.text);
19
19
  }), v = w(() => t.value && !l.value);
20
- return (n, C) => (a(), k("button", {
20
+ return (o, C) => (a(), k("button", {
21
21
  class: P(["tr-suggestion-pills__item", { "only-icon": v.value }])
22
22
  }, [
23
- b(n.$slots, "icon", {}, () => {
23
+ b(o.$slots, "icon", {}, () => {
24
24
  var c;
25
25
  return [
26
- (a(), h(j((c = n.item) == null ? void 0 : c.icon), { class: "tr-suggestion-pills__item_icon" }))
26
+ (a(), h(j((c = o.item) == null ? void 0 : c.icon), { class: "tr-suggestion-pills__item_icon" }))
27
27
  ];
28
28
  }, !0),
29
- b(n.$slots, "default", {}, () => {
29
+ b(o.$slots, "default", {}, () => {
30
30
  var c;
31
31
  return [
32
- (c = n.item) != null && c.text ? (a(), k("span", ce, x(n.item.text), 1)) : R("", !0)
32
+ (c = o.item) != null && c.text ? (a(), k("span", ce, x(o.item.text), 1)) : R("", !0)
33
33
  ];
34
34
  }, !0)
35
35
  ], 2));
@@ -42,14 +42,14 @@ const ce = { key: 0 }, me = /* @__PURE__ */ H({
42
42
  },
43
43
  emits: ["click", "mouseenter"],
44
44
  setup(p, { emit: y }) {
45
- const o = y;
45
+ const n = y;
46
46
  return (t, l) => {
47
- var v, n, C, c, B, g, d, M, I;
47
+ var v, o, C, c, B, g, d, M, I;
48
48
  return ((v = t.item.action) == null ? void 0 : v.type) === "popover" ? (a(), h(_(ue), E({
49
49
  key: 0,
50
50
  style: t.style
51
51
  }, t.item.action.props, {
52
- onItemClick: (n = t.item.action.events) == null ? void 0 : n.itemClick,
52
+ onItemClick: (o = t.item.action.events) == null ? void 0 : o.itemClick,
53
53
  onGroupClick: (C = t.item.action.events) == null ? void 0 : C.groupClick,
54
54
  onOpen: (c = t.item.action.events) == null ? void 0 : c.open,
55
55
  onClose: (B = t.item.action.events) == null ? void 0 : B.close,
@@ -58,8 +58,8 @@ const ce = { key: 0 }, me = /* @__PURE__ */ H({
58
58
  default: A(() => [
59
59
  W(f, {
60
60
  item: t.item,
61
- onClick: l[0] || (l[0] = (r) => o("click", r)),
62
- onMouseenter: l[1] || (l[1] = (r) => o("mouseenter", r))
61
+ onClick: l[0] || (l[0] = (r) => n("click", r)),
62
+ onMouseenter: l[1] || (l[1] = (r) => n("mouseenter", r))
63
63
  }, null, 8, ["item"])
64
64
  ]),
65
65
  _: 2
@@ -80,8 +80,8 @@ const ce = { key: 0 }, me = /* @__PURE__ */ H({
80
80
  trigger: A(() => [
81
81
  W(f, {
82
82
  item: t.item,
83
- onClick: l[2] || (l[2] = (r) => o("click", r)),
84
- onMouseenter: l[3] || (l[3] = (r) => o("mouseenter", r))
83
+ onClick: l[2] || (l[2] = (r) => n("click", r)),
84
+ onMouseenter: l[3] || (l[3] = (r) => n("mouseenter", r))
85
85
  }, null, 8, ["item"])
86
86
  ]),
87
87
  _: 1
@@ -89,8 +89,8 @@ const ce = { key: 0 }, me = /* @__PURE__ */ H({
89
89
  key: 2,
90
90
  item: t.item,
91
91
  style: te(t.style),
92
- onClick: l[4] || (l[4] = (r) => o("click", r)),
93
- onMouseenter: l[5] || (l[5] = (r) => o("mouseenter", r))
92
+ onClick: l[4] || (l[4] = (r) => n("click", r)),
93
+ onMouseenter: l[5] || (l[5] = (r) => n("mouseenter", r))
94
94
  }, null, 8, ["item", "style"]));
95
95
  };
96
96
  }
@@ -108,18 +108,18 @@ const ce = { key: 0 }, me = /* @__PURE__ */ H({
108
108
  }),
109
109
  emits: /* @__PURE__ */ F(["item-click", "click-outside"], ["update:showAll"]),
110
110
  setup(p, { emit: y }) {
111
- const o = p, t = y, l = oe(p, "showAll"), v = S(null), n = S(null), C = S(null), { width: c } = se(n), B = S(0), g = w(() => o.overflowMode === "expand" && c.value < B.value), d = S(-1), M = w(() => {
111
+ const n = p, t = y, l = oe(p, "showAll"), v = S(null), o = S(null), C = S(null), { width: c } = se(o), B = S(0), g = w(() => n.overflowMode === "expand" && c.value < B.value), d = S(-1), M = w(() => {
112
112
  var e;
113
- return g.value && l.value ? ((e = o.items) == null ? void 0 : e.slice(0, d.value)) || [] : o.items || [];
113
+ return g.value && l.value ? ((e = n.items) == null ? void 0 : e.slice(0, d.value)) || [] : n.items || [];
114
114
  }), I = w(() => {
115
115
  var e;
116
- return g.value && l.value ? ((e = o.items) == null ? void 0 : e.slice(d.value)) || [] : [];
116
+ return g.value && l.value ? ((e = n.items) == null ? void 0 : e.slice(d.value)) || [] : [];
117
117
  }), r = () => {
118
- const e = n.value, s = C.value;
118
+ const e = o.value, s = C.value;
119
119
  return Array.from((e == null ? void 0 : e.children) || []).concat(Array.from((s == null ? void 0 : s.children) || []));
120
120
  }, O = () => {
121
121
  V(() => {
122
- const e = n.value;
122
+ const e = o.value;
123
123
  if (!e)
124
124
  return;
125
125
  const s = r(), i = parseFloat(getComputedStyle(e).rowGap) || 0;
@@ -136,20 +136,20 @@ const ce = { key: 0 }, me = /* @__PURE__ */ H({
136
136
  G(
137
137
  () => {
138
138
  var e;
139
- return [o.items, (e = o.items) == null ? void 0 : e.length];
139
+ return [n.items, (e = n.items) == null ? void 0 : e.length];
140
140
  },
141
141
  () => {
142
142
  V(() => {
143
- if (!n.value)
143
+ if (!o.value)
144
144
  return;
145
- const e = r(), s = parseFloat(getComputedStyle(n.value).rowGap) || 0;
145
+ const e = r(), s = parseFloat(getComputedStyle(o.value).rowGap) || 0;
146
146
  B.value = e.map((i) => i.offsetWidth).reduce((i, m) => i + m + s);
147
147
  });
148
148
  },
149
149
  { immediate: !0 }
150
150
  ), G(() => {
151
151
  var e;
152
- return [o.items, (e = o.items) == null ? void 0 : e.length];
152
+ return [n.items, (e = n.items) == null ? void 0 : e.length];
153
153
  }, O), ie(
154
154
  c,
155
155
  (e) => {
@@ -170,7 +170,7 @@ const ce = { key: 0 }, me = /* @__PURE__ */ H({
170
170
  l.value && t("click-outside", e);
171
171
  });
172
172
  const Q = (e) => {
173
- const s = n.value;
173
+ const s = o.value;
174
174
  if (!s)
175
175
  return;
176
176
  const i = e.offsetLeft, m = i + e.offsetWidth, u = s.scrollLeft, D = s.clientWidth, X = i < u, Y = m > u + D;
@@ -182,7 +182,7 @@ const ce = { key: 0 }, me = /* @__PURE__ */ H({
182
182
  behavior: "smooth"
183
183
  });
184
184
  }, U = (e) => {
185
- o.overflowMode === "scroll" && o.autoScrollOnHover && e.currentTarget && Q(e.currentTarget);
185
+ n.autoScrollOnHover && e.currentTarget && Q(e.currentTarget);
186
186
  };
187
187
  return (e, s) => (a(), k("div", {
188
188
  class: "tr-suggestion-pills__wrapper",
@@ -190,9 +190,9 @@ const ce = { key: 0 }, me = /* @__PURE__ */ H({
190
190
  ref: v
191
191
  }, [
192
192
  z("div", {
193
- class: P(["tr-suggestion-pills__container", { "overflow-scroll": o.overflowMode === "scroll" }]),
193
+ class: P(["tr-suggestion-pills__container", { "overflow-scroll": n.overflowMode === "scroll" }]),
194
194
  ref_key: "containerRef",
195
- ref: n
195
+ ref: o
196
196
  }, [
197
197
  b(e.$slots, "default", {}, () => [
198
198
  (a(!0), k(N, null, $(M.value, (i, m) => (a(), h(_(K), {
@@ -224,7 +224,7 @@ const ce = { key: 0 }, me = /* @__PURE__ */ H({
224
224
  ]),
225
225
  g.value ? (a(), k("button", {
226
226
  key: 0,
227
- class: P(["tr-suggestion-pills__expand", { "show-on-hover": o.showAllButtonOn === "hover" }]),
227
+ class: P(["tr-suggestion-pills__expand", { "show-on-hover": n.showAllButtonOn === "hover" }]),
228
228
  onClick: L
229
229
  }, [
230
230
  W(_(le), {
@@ -233,7 +233,7 @@ const ce = { key: 0 }, me = /* @__PURE__ */ H({
233
233
  ], 2)) : R("", !0)
234
234
  ], 512));
235
235
  }
236
- }), T = /* @__PURE__ */ q(de, [["__scopeId", "data-v-928190e1"]]);
236
+ }), T = /* @__PURE__ */ q(de, [["__scopeId", "data-v-68ee26f5"]]);
237
237
  T.name = "TrSuggestionPills";
238
238
  const fe = function(p) {
239
239
  p.component(T.name, T);
package/dist/utils.js CHANGED
@@ -1,19 +1,8 @@
1
- function e(t) {
1
+ function n(t) {
2
2
  if (typeof t == "number") return `${t}px`;
3
- const o = t == null ? void 0 : t.trim();
4
- return o ? /^-?\d+(\.\d+)?$/.test(o) ? `${o}px` : o : "0px";
5
- }
6
- function i(t) {
7
- var n;
8
- if (!t) return window.getSelection();
9
- const o = t.getRootNode();
10
- return o instanceof ShadowRoot && ((n = o.getSelection) == null ? void 0 : n.call(o)) || window.getSelection();
11
- }
12
- function r(t) {
13
- return t.getRootNode() instanceof ShadowRoot;
3
+ const r = t == null ? void 0 : t.trim();
4
+ return r ? /^-?\d+(\.\d+)?$/.test(r) ? `${r}px` : r : "0px";
14
5
  }
15
6
  export {
16
- i as g,
17
- r as i,
18
- e as t
7
+ n as t
19
8
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentiny/tiny-robot",
3
- "version": "0.2.11",
3
+ "version": "0.2.12",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -20,7 +20,7 @@
20
20
  "vue": "^3.3.11"
21
21
  },
22
22
  "dependencies": {
23
- "@opentiny/tiny-robot-svgs": "0.2.11",
23
+ "@opentiny/tiny-robot-svgs": "0.2.12",
24
24
  "@opentiny/vue": "^3.21.0",
25
25
  "@opentiny/vue-button": "^3.21.0",
26
26
  "@opentiny/vue-icon": "^3.22.0",
@@ -44,5 +44,5 @@
44
44
  "vue": "^3.3.11",
45
45
  "vue-tsc": "^2.2.8"
46
46
  },
47
- "gitHead": "7a6aaf67d2d28a4fef92d97abfef589ed11a21dd"
47
+ "gitHead": "33a96d417e1293e60b714ce4e333081446d672e4"
48
48
  }