@opentiny/tiny-robot 0.3.0-alpha.3 → 0.3.0-alpha.5

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 { ref as m, computed as H, watch as D, defineComponent as j, onMounted as Z, onBeforeUnmount as ne, createElementBlock as d, openBlock as i, normalizeClass as P, createElementVNode as t, withDirectives as le, Fragment as R, renderList as A, createVNode as T, unref as q, toDisplayString as S, vShow as ie, nextTick as ae, createCommentVNode as U, withModifiers as ce, normalizeStyle as ue, renderSlot as B, createTextVNode as ee, createBlock as K, withCtx as N } from "vue";
2
- import { L as X, P as te, k as se, l as de, n as re } from "../tiny-robot-svgs.js";
1
+ import { ref as m, computed as H, watch as D, defineComponent as K, onMounted as Z, onBeforeUnmount as ne, createElementBlock as d, openBlock as i, normalizeClass as V, createElementVNode as t, withDirectives as le, Fragment as L, renderList as R, createVNode as T, unref as q, toDisplayString as O, vShow as ie, nextTick as ae, createCommentVNode as Y, withModifiers as ce, normalizeStyle as ue, renderSlot as B, createTextVNode as ee, createBlock as J, withCtx as N } from "vue";
2
+ import { A as X, a as te, O as se, K as de, U as re } from "../tiny-robot-svgs.js";
3
3
  import { i as me } from "../close.js";
4
4
  import { B as ve } from "../index3.js";
5
5
  function he(v = m([])) {
@@ -46,7 +46,7 @@ function he(v = m([])) {
46
46
  toggleBodyScroll: b
47
47
  };
48
48
  }
49
- const pe = { class: "tr-common-questions_content" }, fe = { class: "tr-common-questions_expanded-wrapper" }, ge = { class: "tr-common-questions_expanded-area" }, ye = ["onClick"], ke = { class: "tr-common-questions_item_icon" }, _e = { class: "tr-common-questions_item_text" }, Ce = { class: "tr-common-questions_container" }, qe = ["onClick"], $e = { class: "tr-common-questions_item_icon" }, we = { class: "tr-common-questions_item_text" }, xe = /* @__PURE__ */ j({
49
+ const pe = { class: "tr-common-questions_content" }, fe = { class: "tr-common-questions_expanded-wrapper" }, ge = { class: "tr-common-questions_expanded-area" }, ye = ["onClick"], ke = { class: "tr-common-questions_item_icon" }, _e = { class: "tr-common-questions_item_text" }, Ce = { class: "tr-common-questions_container" }, qe = ["onClick"], $e = { class: "tr-common-questions_item_icon" }, we = { class: "tr-common-questions_item_text" }, xe = /* @__PURE__ */ K({
50
50
  __name: "CommonQuestions",
51
51
  props: {
52
52
  questions: {
@@ -70,31 +70,31 @@ const pe = { class: "tr-common-questions_content" }, fe = { class: "tr-common-qu
70
70
  if (h.length === 0) return 0;
71
71
  const E = e.clientWidth, W = 8, g = document.createElement("div");
72
72
  g.className = "tr-common-questions_item", g.style.visibility = "hidden", g.style.position = "absolute", e.appendChild(g);
73
- let L = 0;
73
+ let S = 0;
74
74
  const z = Math.min(3, h.length);
75
- for (let O = 0; O < z; O++) {
76
- g.innerHTML = `<span class="icon-placeholder"></span>${h[O].text}`;
77
- const G = g.offsetWidth + W + 24;
78
- L += G;
75
+ for (let A = 0; A < z; A++) {
76
+ g.innerHTML = `<span class="icon-placeholder"></span>${h[A].text}`;
77
+ const j = g.offsetWidth + W + 24;
78
+ S += j;
79
79
  }
80
- const M = L / z;
80
+ const M = S / z;
81
81
  return e.removeChild(g), {
82
82
  maxItemsCount: Math.max(1, Math.floor((E - $) / M))
83
83
  };
84
84
  }, l = (e, h, $, E = 40) => {
85
- const g = [], L = [];
85
+ const g = [], S = [];
86
86
  let z = 0;
87
87
  if (h.length === 0)
88
- return { visible: g, hidden: L };
88
+ return { visible: g, hidden: S };
89
89
  const M = document.createElement("div");
90
90
  M.className = "tr-common-questions_item", M.style.visibility = "hidden", M.style.position = "absolute", e.appendChild(M);
91
- for (let O = 0; O < h.length; O++) {
92
- const I = h[O];
91
+ for (let A = 0; A < h.length; A++) {
92
+ const I = h[A];
93
93
  M.innerHTML = `<span class="icon-placeholder"></span>${I.text}`;
94
- const J = M.offsetWidth + 8 + 24, oe = $ - E;
95
- z + J <= oe ? (z += J, g.push(I)) : L.push(I);
94
+ const G = M.offsetWidth + 8 + 24, oe = $ - E;
95
+ z + G <= oe ? (z += G, g.push(I)) : S.push(I);
96
96
  }
97
- return e.removeChild(M), { visible: g, hidden: L };
97
+ return e.removeChild(M), { visible: g, hidden: S };
98
98
  };
99
99
  D(
100
100
  () => y.isExpanded,
@@ -114,9 +114,9 @@ const pe = { class: "tr-common-questions_content" }, fe = { class: "tr-common-qu
114
114
  const { visible: W, hidden: g } = l(e, y.questions, h, $);
115
115
  _.value = W, c.value = g, c.value.length > 0 && _.value.push(c.value[0]), x.value = c.value.length > 0, y.isExpanded || (p.value = !1);
116
116
  }
117
- }, F = () => {
117
+ }, P = () => {
118
118
  f.value && (clearTimeout(f.value), f.value = null), k.value = !0, a("hover-change", !0);
119
- }, Y = () => {
119
+ }, U = () => {
120
120
  f.value = setTimeout(() => {
121
121
  k.value = !1, a("hover-change", !1), f.value = null;
122
122
  }, 500);
@@ -138,28 +138,28 @@ const pe = { class: "tr-common-questions_content" }, fe = { class: "tr-common-qu
138
138
  }), ne(() => {
139
139
  window.removeEventListener("resize", C), f.value && (window.clearTimeout(f.value), f.value = null);
140
140
  }), (e, h) => (i(), d("div", {
141
- class: P(["tr-common-questions", { expanded: p.value }]),
141
+ class: V(["tr-common-questions", { expanded: p.value }]),
142
142
  ref_key: "commonQuestionsRef",
143
143
  ref: r,
144
- onMouseenter: F,
145
- onMouseleave: Y
144
+ onMouseenter: P,
145
+ onMouseleave: U
146
146
  }, [
147
147
  t("div", pe, [
148
148
  t("div", fe, [
149
149
  le(t("div", ge, [
150
- (i(!0), d(R, null, A(u.value, ($, E) => (i(), d("div", {
150
+ (i(!0), d(L, null, R(u.value, ($, E) => (i(), d("div", {
151
151
  key: `row-${E}`,
152
152
  class: "tr-common-questions_row"
153
153
  }, [
154
- (i(!0), d(R, null, A($, (W, g) => (i(), d("div", {
154
+ (i(!0), d(L, null, R($, (W, g) => (i(), d("div", {
155
155
  key: `hidden-${W.id}-${g}`,
156
156
  class: "tr-common-questions_item",
157
- onClick: (L) => n(W)
157
+ onClick: (S) => n(W)
158
158
  }, [
159
159
  t("div", ke, [
160
160
  T(q(X))
161
161
  ]),
162
- t("div", _e, S(W.text), 1)
162
+ t("div", _e, O(W.text), 1)
163
163
  ], 8, ye))), 128))
164
164
  ]))), 128))
165
165
  ], 512), [
@@ -167,15 +167,15 @@ const pe = { class: "tr-common-questions_content" }, fe = { class: "tr-common-qu
167
167
  ])
168
168
  ]),
169
169
  t("div", Ce, [
170
- (i(!0), d(R, null, A(_.value, ($, E) => (i(), d("div", {
170
+ (i(!0), d(L, null, R(_.value, ($, E) => (i(), d("div", {
171
171
  key: `visible-${$.id}-${E}`,
172
- class: P(["tr-common-questions_item", { "last-item": !p.value && E === _.value.length - 1 && o.value }]),
172
+ class: V(["tr-common-questions_item", { "last-item": !p.value && E === _.value.length - 1 && o.value }]),
173
173
  onClick: (W) => n($)
174
174
  }, [
175
175
  t("div", $e, [
176
176
  T(q(X))
177
177
  ]),
178
- t("div", we, S($.text), 1)
178
+ t("div", we, O($.text), 1)
179
179
  ], 10, qe))), 128))
180
180
  ])
181
181
  ])
@@ -187,10 +187,10 @@ const pe = { class: "tr-common-questions_content" }, fe = { class: "tr-common-qu
187
187
  }, We = ["onClick"], Me = { class: "category-icon" }, Te = { class: "tr-question-content" }, Be = {
188
188
  key: 0,
189
189
  class: "tr-question-loading"
190
- }, Se = { key: 1 }, Le = ["onClick"], Oe = {
190
+ }, Oe = { key: 1 }, Se = ["onClick"], Ae = {
191
191
  key: 2,
192
192
  class: "tr-question-empty"
193
- }, ze = /* @__PURE__ */ j({
193
+ }, ze = /* @__PURE__ */ K({
194
194
  __name: "HotQuestions",
195
195
  props: {
196
196
  visible: {
@@ -272,26 +272,26 @@ const pe = { class: "tr-common-questions_content" }, fe = { class: "tr-common-qu
272
272
  ])
273
273
  ]),
274
274
  v.categories.length > 0 ? (i(), d("div", Qe, [
275
- (i(!0), d(R, null, A(v.categories, (s) => (i(), d("div", {
275
+ (i(!0), d(L, null, R(v.categories, (s) => (i(), d("div", {
276
276
  key: s.id,
277
- class: P(["tr-question-categories-item", { active: k.value === s.id }]),
277
+ class: V(["tr-question-categories-item", { active: k.value === s.id }]),
278
278
  onClick: (l) => _(s.id)
279
279
  }, [
280
280
  B(o.$slots, "category-label", { category: s }, () => [
281
281
  t("div", Me, [
282
282
  T(q(se))
283
283
  ]),
284
- t("span", null, S(s.label), 1)
284
+ t("span", null, O(s.label), 1)
285
285
  ])
286
286
  ], 10, We))), 128))
287
- ])) : U("", !0),
287
+ ])) : Y("", !0),
288
288
  t("div", Te, [
289
289
  v.loading ? (i(), d("div", Be, [
290
290
  B(o.$slots, "loading-indicator", {}, () => [
291
291
  u[2] || (u[2] = t("div", { class: "tr-question-loading-spinner" }, null, -1))
292
292
  ])
293
- ])) : x.value.length > 0 ? (i(), d("ul", Se, [
294
- (i(!0), d(R, null, A(x.value, (s, l) => (i(), d("li", {
293
+ ])) : x.value.length > 0 ? (i(), d("ul", Oe, [
294
+ (i(!0), d(L, null, R(x.value, (s, l) => (i(), d("li", {
295
295
  key: s.id,
296
296
  class: "tr-question-list-item",
297
297
  onClick: (Q) => c(s)
@@ -300,20 +300,20 @@ const pe = { class: "tr-common-questions_content" }, fe = { class: "tr-common-qu
300
300
  question: s,
301
301
  index: l
302
302
  }, () => [
303
- t("span", null, S(l + 1) + ".", 1),
304
- ee(" " + S(s.text), 1)
303
+ t("span", null, O(l + 1) + ".", 1),
304
+ ee(" " + O(s.text), 1)
305
305
  ])
306
- ], 8, Le))), 128))
307
- ])) : (i(), d("div", Oe, [
306
+ ], 8, Se))), 128))
307
+ ])) : (i(), d("div", Ae, [
308
308
  B(o.$slots, "empty-state", {}, () => [
309
309
  u[3] || (u[3] = t("p", null, "暂无相关问题", -1))
310
310
  ])
311
311
  ]))
312
312
  ])
313
313
  ], 36)
314
- ], 32)) : U("", !0);
314
+ ], 32)) : Y("", !0);
315
315
  }
316
- }), Re = ["data-theme"], Ae = { class: "tr-question__header" }, He = { class: "category-icon" }, V = /* @__PURE__ */ j({
316
+ }), Le = ["data-theme"], Re = { class: "tr-question__header" }, He = { class: "category-icon" }, F = /* @__PURE__ */ K({
317
317
  __name: "index",
318
318
  props: {
319
319
  categories: { default: () => [] },
@@ -337,9 +337,9 @@ const pe = { class: "tr-common-questions_content" }, fe = { class: "tr-common-qu
337
337
  );
338
338
  const Q = (n) => {
339
339
  u(), k("question-click", n);
340
- }, F = (n) => {
340
+ }, P = (n) => {
341
341
  _.value = n;
342
- }, Y = (n) => {
342
+ }, U = (n) => {
343
343
  n && (f(n.id), k("select-category", n));
344
344
  };
345
345
  return Z(() => {
@@ -351,10 +351,10 @@ const pe = { class: "tr-common-questions_content" }, fe = { class: "tr-common-qu
351
351
  setActiveCategory: f,
352
352
  refreshData: l
353
353
  }), (n, C) => (i(), d("div", {
354
- class: P(["tr-question-container", [`theme-${n.theme}`]]),
354
+ class: V(["tr-question-container", [`theme-${n.theme}`]]),
355
355
  "data-theme": n.theme
356
356
  }, [
357
- t("div", Ae, [
357
+ t("div", Re, [
358
358
  t("div", {
359
359
  class: "tr-question__trigger",
360
360
  onClick: C[0] || (C[0] = //@ts-ignore
@@ -366,15 +366,15 @@ const pe = { class: "tr-common-questions_content" }, fe = { class: "tr-common-qu
366
366
  questions: n.commonQuestions,
367
367
  isExpanded: p.value,
368
368
  onQuestionClick: Q,
369
- onHoverChange: F
369
+ onHoverChange: P
370
370
  }, null, 8, ["questions", "isExpanded"]),
371
371
  _.value ? (i(), d("div", {
372
372
  key: 0,
373
373
  class: "tr-question__expand-button",
374
374
  onClick: r
375
375
  }, [
376
- p.value ? (i(), K(q(re), { key: 1 })) : (i(), K(q(de), { key: 0 }))
377
- ])) : U("", !0)
376
+ p.value ? (i(), J(q(re), { key: 1 })) : (i(), J(q(de), { key: 0 }))
377
+ ])) : Y("", !0)
378
378
  ]),
379
379
  T(ze, {
380
380
  visible: q(c),
@@ -385,14 +385,14 @@ const pe = { class: "tr-common-questions_content" }, fe = { class: "tr-common-qu
385
385
  "onUpdate:visible": C[1] || (C[1] = (e) => c.value = e),
386
386
  onClose: C[2] || (C[2] = (e) => c.value = !1),
387
387
  onQuestionClick: Q,
388
- onSelectCategory: Y
388
+ onSelectCategory: U
389
389
  }, {
390
390
  "category-label": N(({ category: e }) => [
391
391
  B(n.$slots, "category-label", { category: e }, () => [
392
392
  t("div", He, [
393
393
  T(q(se))
394
394
  ]),
395
- t("span", null, S(e.label), 1)
395
+ t("span", null, O(e.label), 1)
396
396
  ])
397
397
  ]),
398
398
  "question-item": N(({ question: e, index: h }) => [
@@ -400,8 +400,8 @@ const pe = { class: "tr-common-questions_content" }, fe = { class: "tr-common-qu
400
400
  question: e,
401
401
  index: h
402
402
  }, () => [
403
- t("span", null, S(h + 1) + ".", 1),
404
- ee(" " + S(e.text), 1)
403
+ t("span", null, O(h + 1) + ".", 1),
404
+ ee(" " + O(e.text), 1)
405
405
  ])
406
406
  ]),
407
407
  "loading-indicator": N(() => [
@@ -416,14 +416,14 @@ const pe = { class: "tr-common-questions_content" }, fe = { class: "tr-common-qu
416
416
  ]),
417
417
  _: 3
418
418
  }, 8, ["visible", "categories", "modal-width", "loading", "close-on-click-outside"])
419
- ], 10, Re));
419
+ ], 10, Le));
420
420
  }
421
421
  });
422
- V.name = "TrQuestion";
422
+ F.name = "TrQuestion";
423
423
  const De = function(v) {
424
- v.component(V.name, V);
424
+ v.component(F.name, F);
425
425
  };
426
- V.install = De;
426
+ F.install = De;
427
427
  export {
428
- V as default
428
+ F as default
429
429
  };