@opentiny/tiny-robot 0.3.0-alpha.15 → 0.3.0-alpha.16

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,7 +1,7 @@
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 V, 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 { y as X, d as te, s as se, g as de, a as re } from "../tiny-robot-svgs.js";
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";
3
3
  import { i as me } from "../close.js";
4
- import { B as ve } from "../index5.js";
4
+ import { B as ve } from "../index3.js";
5
5
  function he(v = m([])) {
6
6
  const w = m(""), y = m(!1), a = m(!1), r = m("light"), k = H(() => {
7
7
  if (!w.value && v.value.length > 0)
@@ -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 O = 0;
74
- const L = Math.min(3, h.length);
75
- for (let z = 0; z < L; z++) {
76
- g.innerHTML = `<span class="icon-placeholder"></span>${h[z].text}`;
73
+ let L = 0;
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
77
  const G = g.offsetWidth + W + 24;
78
- O += G;
78
+ L += G;
79
79
  }
80
- const M = O / L;
80
+ const M = L / 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 = [], O = [];
86
- let L = 0;
85
+ const g = [], L = [];
86
+ let z = 0;
87
87
  if (h.length === 0)
88
- return { visible: g, hidden: O };
88
+ return { visible: g, hidden: L };
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 z = 0; z < h.length; z++) {
92
- const I = h[z];
91
+ for (let O = 0; O < h.length; O++) {
92
+ const I = h[O];
93
93
  M.innerHTML = `<span class="icon-placeholder"></span>${I.text}`;
94
94
  const J = M.offsetWidth + 8 + 24, oe = $ - E;
95
- L + J <= oe ? (L += J, g.push(I)) : O.push(I);
95
+ z + J <= oe ? (z += J, g.push(I)) : L.push(I);
96
96
  }
97
- return e.removeChild(M), { visible: g, hidden: O };
97
+ return e.removeChild(M), { visible: g, hidden: L };
98
98
  };
99
99
  D(
100
100
  () => y.isExpanded,
@@ -114,7 +114,7 @@ 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
- }, P = () => {
117
+ }, F = () => {
118
118
  f.value && (clearTimeout(f.value), f.value = null), k.value = !0, a("hover-change", !0);
119
119
  }, Y = () => {
120
120
  f.value = setTimeout(() => {
@@ -138,10 +138,10 @@ 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: V(["tr-common-questions", { expanded: p.value }]),
141
+ class: P(["tr-common-questions", { expanded: p.value }]),
142
142
  ref_key: "commonQuestionsRef",
143
143
  ref: r,
144
- onMouseenter: P,
144
+ onMouseenter: F,
145
145
  onMouseleave: Y
146
146
  }, [
147
147
  t("div", pe, [
@@ -154,7 +154,7 @@ const pe = { class: "tr-common-questions_content" }, fe = { class: "tr-common-qu
154
154
  (i(!0), d(R, null, A($, (W, g) => (i(), d("div", {
155
155
  key: `hidden-${W.id}-${g}`,
156
156
  class: "tr-common-questions_item",
157
- onClick: (O) => n(W)
157
+ onClick: (L) => n(W)
158
158
  }, [
159
159
  t("div", ke, [
160
160
  T(q(X))
@@ -169,7 +169,7 @@ const pe = { class: "tr-common-questions_content" }, fe = { class: "tr-common-qu
169
169
  t("div", Ce, [
170
170
  (i(!0), d(R, null, A(_.value, ($, E) => (i(), d("div", {
171
171
  key: `visible-${$.id}-${E}`,
172
- class: V(["tr-common-questions_item", { "last-item": !p.value && E === _.value.length - 1 && o.value }]),
172
+ class: P(["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, [
@@ -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 }, Oe = ["onClick"], ze = {
190
+ }, Se = { key: 1 }, Le = ["onClick"], Oe = {
191
191
  key: 2,
192
192
  class: "tr-question-empty"
193
- }, Le = /* @__PURE__ */ j({
193
+ }, ze = /* @__PURE__ */ j({
194
194
  __name: "HotQuestions",
195
195
  props: {
196
196
  visible: {
@@ -274,7 +274,7 @@ const pe = { class: "tr-common-questions_content" }, fe = { class: "tr-common-qu
274
274
  v.categories.length > 0 ? (i(), d("div", Qe, [
275
275
  (i(!0), d(R, null, A(v.categories, (s) => (i(), d("div", {
276
276
  key: s.id,
277
- class: V(["tr-question-categories-item", { active: k.value === s.id }]),
277
+ class: P(["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 }, () => [
@@ -303,8 +303,8 @@ const pe = { class: "tr-common-questions_content" }, fe = { class: "tr-common-qu
303
303
  t("span", null, S(l + 1) + ".", 1),
304
304
  ee(" " + S(s.text), 1)
305
305
  ])
306
- ], 8, Oe))), 128))
307
- ])) : (i(), d("div", ze, [
306
+ ], 8, Le))), 128))
307
+ ])) : (i(), d("div", Oe, [
308
308
  B(o.$slots, "empty-state", {}, () => [
309
309
  u[3] || (u[3] = t("p", null, "暂无相关问题", -1))
310
310
  ])
@@ -313,7 +313,7 @@ const pe = { class: "tr-common-questions_content" }, fe = { class: "tr-common-qu
313
313
  ], 36)
314
314
  ], 32)) : U("", !0);
315
315
  }
316
- }), Re = ["data-theme"], Ae = { class: "tr-question__header" }, He = { class: "category-icon" }, F = /* @__PURE__ */ j({
316
+ }), Re = ["data-theme"], Ae = { class: "tr-question__header" }, He = { class: "category-icon" }, V = /* @__PURE__ */ j({
317
317
  __name: "index",
318
318
  props: {
319
319
  categories: { default: () => [] },
@@ -337,7 +337,7 @@ 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
- }, P = (n) => {
340
+ }, F = (n) => {
341
341
  _.value = n;
342
342
  }, Y = (n) => {
343
343
  n && (f(n.id), k("select-category", n));
@@ -351,7 +351,7 @@ 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: V(["tr-question-container", [`theme-${n.theme}`]]),
354
+ class: P(["tr-question-container", [`theme-${n.theme}`]]),
355
355
  "data-theme": n.theme
356
356
  }, [
357
357
  t("div", Ae, [
@@ -366,7 +366,7 @@ 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: P
369
+ onHoverChange: F
370
370
  }, null, 8, ["questions", "isExpanded"]),
371
371
  _.value ? (i(), d("div", {
372
372
  key: 0,
@@ -376,7 +376,7 @@ const pe = { class: "tr-common-questions_content" }, fe = { class: "tr-common-qu
376
376
  p.value ? (i(), K(q(re), { key: 1 })) : (i(), K(q(de), { key: 0 }))
377
377
  ])) : U("", !0)
378
378
  ]),
379
- T(Le, {
379
+ T(ze, {
380
380
  visible: q(c),
381
381
  categories: x.value,
382
382
  "modal-width": n.modalWidth,
@@ -419,11 +419,11 @@ const pe = { class: "tr-common-questions_content" }, fe = { class: "tr-common-qu
419
419
  ], 10, Re));
420
420
  }
421
421
  });
422
- F.name = "TrQuestion";
422
+ V.name = "TrQuestion";
423
423
  const De = function(v) {
424
- v.component(F.name, F);
424
+ v.component(V.name, V);
425
425
  };
426
- F.install = De;
426
+ V.install = De;
427
427
  export {
428
- F as default
428
+ V as default
429
429
  };