@opentiny/tiny-robot 0.3.0-alpha.19 → 0.3.0-alpha.20

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,68 +1,69 @@
1
- import { defineComponent as z, createElementBlock as m, createCommentVNode as W, openBlock as n, createBlock as L, createElementVNode as v, resolveDynamicComponent as u0, createVNode as $, unref as h, toDisplayString as R, renderSlot as g, mergeModels as E, useModel as j, ref as i, computed as p, watch as N, Transition as c0, withCtx as I, normalizeStyle as A, normalizeClass as V, Fragment as p0, renderList as d0, createTextVNode as f0 } from "vue";
2
- import { IconSparkles as v0, IconClose as g0 } from "@opentiny/tiny-robot-svgs";
3
- import { a as m0, h as _0, u as h0, w as C0, e as y0, o as L0 } from "../index2.js";
4
- import { u as w0, c as k0, B as M0 } from "../index3.js";
5
- import F0 from "../flow-layout-buttons/index.js";
6
- import T0 from "../icon-button/index.js";
7
- import { _ as w } from "../_plugin-vue_export-helper.js";
8
- import { _ as $0 } from "../loading.js";
9
- import { t as S } from "../utils.js";
10
- const I0 = {
1
+ import { defineComponent as z, createElementBlock as g, createCommentVNode as U, openBlock as n, createBlock as k, createElementVNode as v, resolveDynamicComponent as ue, createVNode as M, unref as h, toDisplayString as O, renderSlot as m, mergeModels as V, useModel as A, ref as i, computed as p, watch as W, Transition as ce, withCtx as S, normalizeStyle as J, normalizeClass as D, Fragment as pe, renderList as de, createTextVNode as fe } from "vue";
2
+ import { IconSparkles as ve, IconClose as me } from "@opentiny/tiny-robot-svgs";
3
+ import { a as ge, h as _e, u as he, w as ye, e as we, o as ke } from "../index2.js";
4
+ import { u as Te, c as $e, B as Ce } from "../index3.js";
5
+ import Ie from "../flow-layout-buttons/index.js";
6
+ import qe from "../icon-button/index.js";
7
+ import { _ as T } from "../_plugin-vue_export-helper.js";
8
+ import { _ as Me } from "../loading.js";
9
+ import { _ as Se } from "../no-data.js";
10
+ import { t as G } from "../utils.js";
11
+ const Be = {
11
12
  key: 0,
12
13
  class: "tr-question-popover__backdrop"
13
- }, q0 = /* @__PURE__ */ z({
14
+ }, Re = /* @__PURE__ */ z({
14
15
  __name: "Backdrop",
15
16
  props: {
16
17
  show: { type: Boolean }
17
18
  },
18
- setup(s) {
19
- return (t, C) => t.show ? (n(), m("div", I0)) : W("", !0);
19
+ setup(l) {
20
+ return (t, y) => t.show ? (n(), g("div", Be)) : U("", !0);
20
21
  }
21
- }), x0 = /* @__PURE__ */ w(q0, [["__scopeId", "data-v-50205eaf"]]), B0 = { class: "tr-question__header" }, S0 = {
22
+ }), be = /* @__PURE__ */ T(Re, [["__scopeId", "data-v-50205eaf"]]), Ge = { class: "tr-question__header" }, Oe = {
22
23
  key: 1,
23
24
  class: "tr-question__header-icon"
24
- }, R0 = { class: "tr-question__header-title" }, b0 = /* @__PURE__ */ z({
25
+ }, xe = { class: "tr-question__header-title" }, ze = /* @__PURE__ */ z({
25
26
  __name: "Header",
26
27
  props: {
27
28
  icon: {},
28
29
  title: {}
29
30
  },
30
- setup(s) {
31
- const t = s;
32
- return (C, o) => (n(), m("div", B0, [
33
- t.icon ? (n(), L(u0(t.icon), { key: 0 })) : (n(), m("span", S0, [
34
- $(h(v0), { style: { color: "#1476ff" } })
31
+ setup(l) {
32
+ const t = l;
33
+ return (y, o) => (n(), g("div", Ge, [
34
+ t.icon ? (n(), k(ue(t.icon), { key: 0 })) : (n(), g("span", Oe, [
35
+ M(h(ve), { style: { color: "#1476ff" } })
35
36
  ])),
36
- v("h3", R0, R(t.title), 1)
37
+ v("h3", xe, O(t.title), 1)
37
38
  ]));
38
39
  }
39
- }), z0 = /* @__PURE__ */ w(b0, [["__scopeId", "data-v-76bef623"]]), Z0 = {}, G0 = { class: "tr-question__loading-wrapper" };
40
- function O0(s, t) {
41
- return n(), m("div", G0, [
42
- g(s.$slots, "default", {}, () => [
40
+ }), Ee = /* @__PURE__ */ T(ze, [["__scopeId", "data-v-76bef623"]]), Le = {}, Ne = { class: "tr-question__loading-wrapper" };
41
+ function Pe(l, t) {
42
+ return n(), g("div", Ne, [
43
+ m(l.$slots, "default", {}, () => [
43
44
  t[0] || (t[0] = v("img", {
44
45
  class: "tr-question__loading",
45
- src: $0
46
+ src: Me
46
47
  }, null, -1)),
47
48
  t[1] || (t[1] = v("span", { class: "tr-question__loading-text" }, "正在加载", -1))
48
49
  ], !0)
49
50
  ]);
50
51
  }
51
- const P0 = /* @__PURE__ */ w(Z0, [["render", O0], ["__scopeId", "data-v-5cdf0688"]]), E0 = "data:image/svg+xml,%3csvg%20width='120.000000'%20height='120.000000'%20viewBox='0%200%20120%20120'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3cdesc%3e%20Created%20with%20Pixso.%20%3c/desc%3e%3cdefs%20/%3e%3crect%20width='120.000000'%20height='120.000000'%20fill='%23FFFFFF'%20fill-opacity='0'%20/%3e%3cpath%20d='M18.75%2037.31L104.52%2037.31C107.68%2037.31%20110.25%2039.87%20110.25%2043.04L110.25%20105.15C110.25%20108.28%20107.71%20110.81%20104.59%20110.81L24.4%20110.81C21.28%20110.81%2018.75%20108.28%2018.75%20105.15L18.75%2037.31Z'%20fill='%23F0F0F0'%20fill-opacity='1.000000'%20fill-rule='evenodd'%20/%3e%3cpath%20d='M13.22%2038.06L84.75%2038.06L84.75%20105.15C84.75%20108.28%2082.21%20110.81%2079.09%20110.81L16.9%20110.81C13.78%20110.81%2011.25%20108.12%2011.25%20105L11.25%2059.25L0.75%2059.25C0.75%2058.15%2012.13%2038.06%2013.22%2038.06Z'%20fill='%23FFFFFF'%20fill-opacity='1.000000'%20fill-rule='evenodd'%20/%3e%3cpath%20d='M84.44%2038.06L105.13%2038.06C106.16%2038.06%20107.41%2037.86%20107.91%2038.76L118.07%2056.96C118.45%2057.64%20119.18%2058.68%20118.5%2059.06C118.28%2059.17%20117.08%2059.06%20116.84%2059.06L99.33%2059.06C97.21%2059.06%2095.27%2057.87%2094.3%2055.98L84.44%2038.06Z'%20fill='%23FFFFFF'%20fill-opacity='1.000000'%20fill-rule='evenodd'%20/%3e%3cpath%20d='M110.42%2059.08L110.42%20105.09C110.42%20108.35%20107.78%20111%20104.51%20111L78.89%20111L78.89%20109.68L104.51%20109.68C107.05%20109.68%20109.11%20107.63%20109.11%20105.09L109.11%2059.08L110.42%2059.08Z'%20fill='%23808080'%20fill-opacity='1.000000'%20fill-rule='nonzero'%20/%3e%3cpath%20d='M85.38%2037.5L85.38%20105.09C85.38%20108.35%2082.73%20111%2079.46%20111L16.42%20111C13.15%20111%2010.51%20108.35%2010.51%20105.09L10.51%2059.08L11.82%2059.08L11.82%20105.09C11.82%20107.63%2013.88%20109.68%2016.42%20109.68L79.46%20109.68C82%20109.68%2084.06%20107.63%2084.06%20105.09L84.06%2038.81L16%2038.81L16%2037.5L85.38%2037.5Z'%20fill='%23808080'%20fill-opacity='1.000000'%20fill-rule='nonzero'%20/%3e%3cpath%20d='M14.14%2037.5C13.25%2037.5%2012.42%2037.96%2011.95%2038.74L0.19%2057.97C-0.19%2058.59%200%2059.41%200.6%2059.79C0.81%2059.92%201.05%2060%201.29%2060L68.53%2060C70.28%2060%2071.92%2059.08%2072.87%2057.58L85.56%2037.5L14.14%2037.5ZM14.47%2039L82.76%2039L71.48%2056.71C70.78%2057.82%2069.56%2058.5%2068.26%2058.5L1.76%2058.5L13.39%2039.61C13.62%2039.23%2014.03%2039%2014.47%2039Z'%20fill='%23808080'%20fill-opacity='1.000000'%20fill-rule='nonzero'%20/%3e%3cpath%20d='M106.12%2037.5C106.97%2037.5%20107.75%2037.95%20108.21%2038.7L119.8%2057.79C120.17%2058.4%20120%2059.21%20119.43%2059.6C119.22%2059.74%20118.99%2059.81%20118.75%2059.81L99.22%2059.81C97.46%2059.81%2095.83%2058.82%2094.94%2057.22L83.97%2037.5L106.12%2037.5ZM106.09%2039L86.69%2039L96.27%2056.57C96.92%2057.76%2098.11%2058.5%2099.39%2058.5L118.35%2058.5L107.1%2039.59C106.88%2039.22%20106.5%2039%20106.09%2039Z'%20fill='%23808080'%20fill-opacity='1.000000'%20fill-rule='nonzero'%20/%3e%3crect%20x='20.250000'%20y='84.000000'%20rx='1.886225'%20width='20.999998'%20height='6.000000'%20fill='%231476FF'%20fill-opacity='1.000000'%20/%3e%3cpath%20d='M35.34%2094.5C35.7%2094.5%2036%2094.83%2036%2095.25C36%2095.66%2035.7%2096%2035.34%2096L20.9%2096C20.54%2096%2020.25%2095.66%2020.25%2095.25C20.25%2094.83%2020.54%2094.5%2020.9%2094.5L35.34%2094.5Z'%20fill='%23808080'%20fill-opacity='1.000000'%20fill-rule='nonzero'%20/%3e%3crect%20x='20.250000'%20y='99.000000'%20rx='0.750000'%20width='7.500000'%20height='1.500000'%20fill='%23808080'%20fill-opacity='1.000000'%20/%3e%3cpath%20d='M60%209C60.41%209%2060.75%209.29%2060.75%209.66L60.75%2018.91C60.75%2019.27%2060.41%2019.57%2060%2019.57C59.58%2019.57%2059.24%2019.27%2059.24%2018.91L59.24%209.66C59.24%209.29%2059.58%209%2060%209Z'%20fill='%23808080'%20fill-opacity='1.000000'%20fill-rule='nonzero'%20/%3e%3cpath%20d='M84.83%2012.96C85.19%2013.17%2085.33%2013.59%2085.15%2013.91L80.52%2021.92C80.34%2022.24%2079.9%2022.33%2079.54%2022.12C79.18%2021.91%2079.03%2021.48%2079.21%2021.17L83.84%2013.16C84.02%2012.84%2084.46%2012.75%2084.83%2012.96Z'%20fill='%23808080'%20fill-opacity='1.000000'%20fill-rule='nonzero'%20/%3e%3cpath%20d='M35.17%2012.96C35.53%2012.75%2035.97%2012.84%2036.15%2013.16L40.78%2021.17C40.96%2021.48%2040.81%2021.91%2040.45%2022.12C40.09%2022.33%2039.65%2022.24%2039.47%2021.92L34.84%2013.91C34.66%2013.59%2034.81%2013.17%2035.17%2012.96Z'%20fill='%23808080'%20fill-opacity='1.000000'%20fill-rule='nonzero'%20/%3e%3c/svg%3e", N0 = {}, V0 = { class: "tr-question__no-data-wrapper" };
52
- function W0(s, t) {
53
- return n(), m("div", V0, [
54
- g(s.$slots, "default", {}, () => [
52
+ const Ve = /* @__PURE__ */ T(Le, [["render", Pe], ["__scopeId", "data-v-5cdf0688"]]), We = {}, De = { class: "tr-question__no-data-wrapper" };
53
+ function Ue(l, t) {
54
+ return n(), g("div", De, [
55
+ m(l.$slots, "default", {}, () => [
55
56
  t[0] || (t[0] = v("img", {
56
57
  class: "tr-question__no-data",
57
- src: E0
58
+ src: Se
58
59
  }, null, -1)),
59
60
  t[1] || (t[1] = v("span", { class: "tr-question__no-data-text" }, "暂时没有内容", -1))
60
61
  ], !0)
61
62
  ]);
62
63
  }
63
- const D0 = /* @__PURE__ */ w(N0, [["render", W0], ["__scopeId", "data-v-a33638dd"]]), U0 = { class: "tr-tooltip-content" }, H0 = /* @__PURE__ */ z({
64
+ const Fe = /* @__PURE__ */ T(We, [["render", Ue], ["__scopeId", "data-v-a33638dd"]]), He = { class: "tr-tooltip-content" }, Qe = /* @__PURE__ */ z({
64
65
  __name: "Tooltip",
65
- props: /* @__PURE__ */ E({
66
+ props: /* @__PURE__ */ V({
66
67
  show: { type: Boolean },
67
68
  content: {},
68
69
  trigger: {},
@@ -75,48 +76,48 @@ const D0 = /* @__PURE__ */ w(N0, [["render", W0], ["__scopeId", "data-v-a33638dd
75
76
  showModifiers: {}
76
77
  }),
77
78
  emits: ["update:show"],
78
- setup(s) {
79
- const t = s, C = j(s, "show"), o = i(t.show), k = p(() => t.trigger), { x: u, y: d, width: _, height: M } = m0(k), Z = p(() => t.trigger ? {
80
- left: S(u.value),
81
- top: t.placement === "top" ? S(d.value) : S(d.value + M.value),
82
- width: S(_.value)
79
+ setup(l) {
80
+ const t = l, y = A(l, "show"), o = i(t.show), $ = p(() => t.trigger), { x: u, y: d, width: _, height: C } = ge($), E = p(() => t.trigger ? {
81
+ left: G(u.value),
82
+ top: t.placement === "top" ? G(d.value) : G(d.value + C.value),
83
+ width: G(_.value)
83
84
  } : {});
84
85
  let f;
85
- N(
86
- () => C.value,
86
+ W(
87
+ () => y.value,
87
88
  (r) => {
88
89
  const c = r ? t.delayOpen : t.delayClose;
89
90
  f && (clearTimeout(f), f = void 0, r || (o.value = !1)), c ? f = setTimeout(() => o.value = r || !1, c) : o.value = r || !1;
90
91
  }
91
- ), N(
92
+ ), W(
92
93
  () => t.disabled,
93
94
  (r) => {
94
95
  r && (f && clearTimeout(f), o.value = !1);
95
96
  }
96
97
  );
97
- const y = (r) => {
98
+ const w = (r) => {
98
99
  var c;
99
- (c = k.value) != null && c.contains(r.relatedTarget) || (C.value = !1);
100
+ (c = $.value) != null && c.contains(r.relatedTarget) || (y.value = !1);
100
101
  };
101
- return (r, c) => (n(), L(c0, { name: "tr-tooltip" }, {
102
- default: I(() => [
103
- o.value ? (n(), m("div", {
102
+ return (r, c) => (n(), k(ce, { name: "tr-tooltip" }, {
103
+ default: S(() => [
104
+ o.value ? (n(), g("div", {
104
105
  key: 0,
105
- class: V(["tr-tooltip", `placement-${t.placement}`]),
106
+ class: D(["tr-tooltip", `placement-${t.placement}`]),
106
107
  role: "tooltip",
107
- style: A(Z.value),
108
- onMouseleave: y
108
+ style: J(E.value),
109
+ onMouseleave: w
109
110
  }, [
110
111
  c[0] || (c[0] = v("div", { class: "tr-tooltip-arrow" }, null, -1)),
111
- v("span", U0, R(t.content), 1)
112
- ], 38)) : W("", !0)
112
+ v("span", He, O(t.content), 1)
113
+ ], 38)) : U("", !0)
113
114
  ]),
114
115
  _: 1
115
116
  }));
116
117
  }
117
- }), Q0 = /* @__PURE__ */ w(H0, [["__scopeId", "data-v-72e44084"]]), j0 = ["onClick", "onMouseenter", "onMouseleave"], A0 = /* @__PURE__ */ z({
118
+ }), je = /* @__PURE__ */ T(Qe, [["__scopeId", "data-v-72e44084"]]), Ae = ["onClick", "onMouseenter", "onMouseleave"], Je = /* @__PURE__ */ z({
118
119
  __name: "index",
119
- props: /* @__PURE__ */ E({
120
+ props: /* @__PURE__ */ V({
120
121
  appendTo: {},
121
122
  data: {},
122
123
  title: {
@@ -143,180 +144,180 @@ const D0 = /* @__PURE__ */ w(N0, [["render", W0], ["__scopeId", "data-v-a33638dd
143
144
  selectedGroup: {},
144
145
  selectedGroupModifiers: {}
145
146
  }),
146
- emits: /* @__PURE__ */ E(["item-click", "group-click", "open", "close", "click-outside"], ["update:selectedGroup"]),
147
- setup(s, {
147
+ emits: /* @__PURE__ */ V(["item-click", "group-click", "open", "close", "click-outside"], ["update:selectedGroup"]),
148
+ setup(l, {
148
149
  expose: t,
149
- emit: C
150
+ emit: y
150
151
  }) {
151
- const o = s, k = i(!1), u = p({
152
- get: () => o.trigger === "manual" ? o.show : k.value,
152
+ const o = l, $ = i(!1), u = p({
153
+ get: () => o.trigger === "manual" ? o.show : $.value,
153
154
  set: (e) => {
154
- o.trigger !== "manual" && (k.value = e);
155
+ o.trigger !== "manual" && ($.value = e);
155
156
  }
156
- }), d = C, _ = j(s, "selectedGroup"), M = p(() => {
157
+ }), d = y, _ = A(l, "selectedGroup"), C = p(() => {
157
158
  var e;
158
159
  return typeof ((e = o.data.at(0)) == null ? void 0 : e.group) == "string";
159
160
  });
160
- !_.value && M.value && o.data.length && (_.value = o.data[0].group);
161
- const Z = p(() => {
161
+ !_.value && C.value && o.data.length && (_.value = o.data[0].group);
162
+ const E = p(() => {
162
163
  var e;
163
- return M.value ? ((e = o.data.find((l) => l.group === _.value)) == null ? void 0 : e.items) || [] : o.data;
164
- }), f = p(() => M.value ? o.data.map((e) => ({
164
+ return C.value ? ((e = o.data.find((s) => s.group === _.value)) == null ? void 0 : e.items) || [] : o.data;
165
+ }), f = p(() => C.value ? o.data.map((e) => ({
165
166
  ...e,
166
167
  id: e.group
167
- })) : []), y = i(null), r = p(() => {
168
+ })) : []), w = i(null), r = p(() => {
168
169
  var e;
169
- return (e = y.value) == null ? void 0 : e.triggerRef;
170
+ return (e = w.value) == null ? void 0 : e.triggerRef;
170
171
  }), c = p(() => {
171
172
  var e;
172
- return (e = y.value) == null ? void 0 : e.popperRef;
173
- }), q = _0("(max-width: 767px)"), D = i(null), G = i(!1), {
174
- isScrolling: J
175
- } = h0(D);
176
- C0(J, (e) => {
177
- G.value = e;
173
+ return (e = w.value) == null ? void 0 : e.popperRef;
174
+ }), B = _e("(max-width: 767px)"), F = i(null), L = i(!1), {
175
+ isScrolling: K
176
+ } = he(F);
177
+ ye(K, (e) => {
178
+ L.value = e;
178
179
  }, {
179
180
  throttle: 100,
180
181
  leading: !0,
181
182
  trailing: !0
182
183
  });
183
- const x = i([]), K = p(() => x.value.at(0)), X = (e, l) => {
184
- x.value[l] = e;
185
- }, O = i([]), Y = () => {
186
- O.value = x.value.map((e) => e ? e.scrollWidth > e.clientWidth : !1);
187
- }, U = i(null), H = i(null), B = i(!1), Q = i(""), {
188
- width: e0
189
- } = y0(K);
190
- N(e0, () => {
191
- Y();
184
+ const R = i([]), X = p(() => R.value.at(0)), Y = (e, s) => {
185
+ R.value[s] = e;
186
+ }, N = i([]), Z = () => {
187
+ N.value = R.value.map((e) => e ? e.scrollWidth > e.clientWidth : !1);
188
+ }, H = i(null), Q = i(null), b = i(!1), j = i(""), {
189
+ width: ee
190
+ } = we(X);
191
+ W(ee, () => {
192
+ Z();
192
193
  });
193
- const t0 = p(() => q.value ? {
194
+ const te = p(() => B.value ? {
194
195
  left: 0,
195
196
  right: 0,
196
197
  bottom: 0,
197
198
  top: "unset",
198
199
  minWidth: "100%"
199
- } : {}), o0 = w0(r, o.appendTo);
200
- k0(() => ({
201
- to: o0.value
202
- }), () => $(x0, {
203
- show: u.value && q.value
200
+ } : {}), oe = Te(r, o.appendTo);
201
+ $e(() => ({
202
+ to: oe.value
203
+ }), () => M(be, {
204
+ show: u.value && B.value
204
205
  }, null));
205
206
  const P = () => {
206
207
  o.trigger === "click" && (u.value ? d("open") : d("close"));
207
208
  };
208
- L0(c, (e) => {
209
+ ke(c, (e) => {
209
210
  d("click-outside", e), u.value = !1, P();
210
211
  }, {
211
212
  ignore: [r]
212
213
  });
213
- const l0 = () => {
214
+ const se = () => {
214
215
  u.value = !u.value, P();
215
- }, s0 = () => {
216
+ }, le = () => {
216
217
  u.value = !1, d("close");
217
- }, n0 = (e) => {
218
+ }, ne = (e) => {
218
219
  d("item-click", e), u.value = !1, P();
219
- }, r0 = (e) => {
220
- const l = o.data.find((a) => a.group === e);
221
- l && d("group-click", l);
222
- }, a0 = (e, l) => {
223
- H.value = x.value[l], B.value = !0, Q.value = e.text;
224
- }, i0 = (e) => {
225
- var l;
226
- ((l = U.value) == null ? void 0 : l.$el).contains(e.relatedTarget) || (B.value = !1);
220
+ }, re = (e) => {
221
+ const s = o.data.find((a) => a.group === e);
222
+ s && d("group-click", s);
223
+ }, ae = (e, s) => {
224
+ Q.value = R.value[s], b.value = !0, j.value = e.text;
225
+ }, ie = (e) => {
226
+ var s;
227
+ ((s = H.value) == null ? void 0 : s.$el).contains(e.relatedTarget) || (b.value = !1);
227
228
  };
228
229
  return t({
229
230
  update: () => {
230
231
  var e;
231
- (e = y.value) == null || e.update();
232
+ (e = w.value) == null || e.update();
232
233
  }
233
- }), (e, l) => (n(), L(h(M0), {
234
+ }), (e, s) => (n(), k(h(Ce), {
234
235
  show: u.value,
235
- class: V(["tr-question-popover", {
236
- mobile: h(q)
236
+ class: D(["tr-question-popover", {
237
+ mobile: h(B)
237
238
  }]),
238
- style: A(t0.value),
239
+ style: J(te.value),
239
240
  ref_key: "basePopperRef",
240
- ref: y,
241
+ ref: w,
241
242
  placement: "top-left",
242
243
  "append-to": o.appendTo,
243
244
  offset: o.topOffset,
244
245
  "transition-props": {
245
- name: h(q) ? "tr-question-popover-mobile" : "tr-question-popover"
246
+ name: h(B) ? "tr-question-popover-mobile" : "tr-question-popover"
246
247
  },
247
248
  "prevent-overflow": !0,
248
249
  "trigger-events": {
249
- onClick: l0
250
+ onClick: se
250
251
  }
251
252
  }, {
252
- trigger: I(() => [g(e.$slots, "trigger", {}, void 0, !0)]),
253
- content: I(() => [g(e.$slots, "header", {}, () => [$(z0, {
253
+ trigger: S(() => [m(e.$slots, "trigger", {}, void 0, !0)]),
254
+ content: S(() => [m(e.$slots, "header", {}, () => [M(Ee, {
254
255
  icon: o.icon,
255
256
  title: o.title
256
- }, null, 8, ["icon", "title"])], !0), o.loading ? (n(), L(P0, {
257
+ }, null, 8, ["icon", "title"])], !0), o.loading ? (n(), k(Ve, {
257
258
  key: 0
258
259
  }, {
259
- default: I(() => [g(e.$slots, "loading", {}, void 0, !0)]),
260
+ default: S(() => [m(e.$slots, "loading", {}, void 0, !0)]),
260
261
  _: 3
261
- })) : o.data.length === 0 ? (n(), L(D0, {
262
+ })) : o.data.length === 0 ? (n(), k(Fe, {
262
263
  key: 1
263
264
  }, {
264
- default: I(() => [g(e.$slots, "empty", {}, void 0, !0)]),
265
+ default: S(() => [m(e.$slots, "empty", {}, void 0, !0)]),
265
266
  _: 3
266
- })) : g(e.$slots, "body", {
267
+ })) : m(e.$slots, "body", {
267
268
  key: 2
268
- }, () => [f.value.length > 0 ? (n(), L(h(F0), {
269
+ }, () => [f.value.length > 0 ? (n(), k(h(Ie), {
269
270
  key: 0,
270
271
  class: "tr-question__group",
271
272
  items: f.value,
272
273
  selected: _.value,
273
- "onUpdate:selected": l[0] || (l[0] = (a) => _.value = a),
274
+ "onUpdate:selected": s[0] || (s[0] = (a) => _.value = a),
274
275
  "lines-limit": 2,
275
276
  "show-more-trigger": o.groupShowMoreTrigger,
276
- onItemClick: r0
277
- }, null, 8, ["items", "selected", "show-more-trigger"])) : W("", !0), v("ul", {
278
- class: V(["tr-question__list", {
279
- scrolling: G.value
277
+ onItemClick: re
278
+ }, null, 8, ["items", "selected", "show-more-trigger"])) : U("", !0), v("ul", {
279
+ class: D(["tr-question__list", {
280
+ scrolling: L.value
280
281
  }]),
281
282
  ref_key: "listRef",
282
- ref: D
283
- }, [(n(!0), m(p0, null, d0(Z.value, (a, F) => (n(), m("li", {
283
+ ref: F
284
+ }, [(n(!0), g(pe, null, de(E.value, (a, I) => (n(), g("li", {
284
285
  class: "tr-question__list-item",
285
286
  key: a.id,
286
287
  ref_for: !0,
287
- ref: (T) => X(T, F),
288
- onClick: (T) => n0(a),
289
- onMouseenter: (T) => O.value[F] && a0(a, F),
290
- onMouseleave: (T) => O.value[F] && i0(T)
291
- }, [g(e.$slots, "item", {
288
+ ref: (q) => Y(q, I),
289
+ onClick: (q) => ne(a),
290
+ onMouseenter: (q) => N.value[I] && ae(a, I),
291
+ onMouseleave: (q) => N.value[I] && ie(q)
292
+ }, [m(e.$slots, "item", {
292
293
  item: a
293
- }, () => [v("span", null, R(F + 1) + ". ", 1), f0(R(a.text), 1)], !0)], 40, j0))), 128))], 2)], !0), $(Q0, {
294
+ }, () => [v("span", null, O(I + 1) + ". ", 1), fe(O(a.text), 1)], !0)], 40, Ae))), 128))], 2)], !0), M(je, {
294
295
  ref_key: "tooltipRef",
295
- ref: U,
296
- show: B.value,
297
- "onUpdate:show": l[1] || (l[1] = (a) => B.value = a),
298
- content: Q.value,
299
- trigger: H.value,
300
- disabled: G.value,
296
+ ref: H,
297
+ show: b.value,
298
+ "onUpdate:show": s[1] || (s[1] = (a) => b.value = a),
299
+ content: j.value,
300
+ trigger: Q.value,
301
+ disabled: L.value,
301
302
  placement: "top",
302
303
  "delay-open": 300,
303
304
  "delay-close": 300
304
- }, null, 8, ["show", "content", "trigger", "disabled"]), $(h(T0), {
305
+ }, null, 8, ["show", "content", "trigger", "disabled"]), M(h(qe), {
305
306
  class: "tr-question-popover__close",
306
- icon: h(g0),
307
+ icon: h(me),
307
308
  size: "32",
308
309
  "svg-size": "20",
309
- onClick: s0
310
+ onClick: le
310
311
  }, null, 8, ["icon"])]),
311
312
  _: 3
312
313
  }, 8, ["show", "class", "style", "append-to", "offset", "transition-props", "trigger-events"]));
313
314
  }
314
- }), b = /* @__PURE__ */ w(A0, [["__scopeId", "data-v-8cc35579"]]);
315
- b.name = "TrSuggestionPopover";
316
- const J0 = function(s) {
317
- s.component(b.name, b);
315
+ }), x = /* @__PURE__ */ T(Je, [["__scopeId", "data-v-8cc35579"]]);
316
+ x.name = "TrSuggestionPopover";
317
+ const Ke = function(l) {
318
+ l.component(x.name, x);
318
319
  };
319
- b.install = J0;
320
+ x.install = Ke;
320
321
  export {
321
- b as default
322
+ x as default
322
323
  };
@@ -0,0 +1,82 @@
1
+ import { defineComponent as p, mergeModels as y, useModel as g, ref as C, onUnmounted as D, computed as O, provide as m, watchEffect as S, watch as M, renderSlot as w, inject as i } from "vue";
2
+ const _ = "data-tr-theme", A = "data-tr-color-mode", v = Symbol("theme"), T = Symbol("colorMode"), E = Symbol("resolvedColorMode"), d = /* @__PURE__ */ p({
3
+ __name: "index",
4
+ props: /* @__PURE__ */ y({
5
+ colorMode: {},
6
+ targetElement: { default: "html" },
7
+ theme: {},
8
+ storage: {},
9
+ storageKey: { default: "tiny-robot-theme-data" }
10
+ }, {
11
+ theme: { default: "" },
12
+ themeModifiers: {},
13
+ colorMode: {
14
+ default: "auto",
15
+ validator: (o) => ["light", "dark", "auto"].includes(o)
16
+ },
17
+ colorModeModifiers: {}
18
+ }),
19
+ emits: ["update:theme", "update:colorMode"],
20
+ setup(o) {
21
+ const t = o, n = () => {
22
+ if (!t.storage) return {};
23
+ let e = {};
24
+ try {
25
+ e = JSON.parse(t.storage.getItem(t.storageKey) || "{}");
26
+ } catch {
27
+ }
28
+ return e;
29
+ }, c = (e) => {
30
+ if (!t.storage) return;
31
+ const u = { ...n(), ...e };
32
+ t.storage.setItem(t.storageKey, JSON.stringify(u));
33
+ }, s = g(o, "theme"), r = g(o, "colorMode");
34
+ if (t.storage) {
35
+ const e = n();
36
+ s.value = typeof e.theme == "string" ? e.theme : s.value, r.value = e.colorMode || r.value;
37
+ }
38
+ const a = C("light");
39
+ if (typeof window < "u") {
40
+ const e = window.matchMedia("(prefers-color-scheme: dark)");
41
+ a.value = e.matches ? "dark" : "light";
42
+ const l = (u) => {
43
+ a.value = u.matches ? "dark" : "light";
44
+ };
45
+ e.addEventListener("change", l), D(() => {
46
+ e.removeEventListener("change", l);
47
+ });
48
+ }
49
+ const f = O(() => r.value === "auto" ? a.value : r.value);
50
+ return m(v, s), m(T, r), m(E, f), S(
51
+ () => {
52
+ if (typeof document > "u") return;
53
+ const e = document.querySelector(t.targetElement);
54
+ e && (e.setAttribute(_, s.value), e.setAttribute(A, f.value));
55
+ },
56
+ { flush: "post" }
57
+ ), M(s, (e) => {
58
+ c({ theme: e });
59
+ }), M(r, (e) => {
60
+ c({ colorMode: e });
61
+ }), (e, l) => w(e.$slots, "default");
62
+ }
63
+ }), h = "Theme context not available, cannot set theme data. Condisder using ThemeProvider to wrap your app.", R = () => {
64
+ const o = i(v), t = i(T), n = i(E);
65
+ return {
66
+ theme: o,
67
+ colorMode: t,
68
+ resolvedColorMode: n,
69
+ setTheme: (a) => o ? (o.value = a, !0) : (console.warn(h), !1),
70
+ toggleColorMode: () => !t || !n ? (console.warn(h), !1) : (t.value = n.value === "light" ? "dark" : "light", !0),
71
+ setColorMode: (a) => t ? (t.value = a, !0) : (console.warn(h), !1)
72
+ };
73
+ };
74
+ d.name = "TrThemeProvider";
75
+ const b = function(o) {
76
+ o.component(d.name, d);
77
+ };
78
+ d.install = b;
79
+ export {
80
+ d as default,
81
+ R as useTheme
82
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentiny/tiny-robot",
3
- "version": "0.3.0-alpha.19",
3
+ "version": "0.3.0-alpha.20",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -20,8 +20,8 @@
20
20
  "vue": "^3.3.11"
21
21
  },
22
22
  "dependencies": {
23
- "@opentiny/tiny-robot-svgs": "0.3.0-alpha.19",
24
- "@opentiny/vue": "^3.21.0",
23
+ "@opentiny/tiny-robot-svgs": "0.3.0-alpha.20",
24
+ "@opentiny/vue": "^3.20.0",
25
25
  "@vueuse/core": "^13.1.0",
26
26
  "dompurify": "^3.2.6",
27
27
  "markdown-it": "^14.1.0"
@@ -40,5 +40,5 @@
40
40
  "vue": "^3.3.11",
41
41
  "vue-tsc": "^2.2.8"
42
42
  },
43
- "gitHead": "6bc75d6fda380f9867352b91e6717c06ccafcefb"
43
+ "gitHead": "77b72de8c49bee23fef030439841cd07bb3e054a"
44
44
  }