@opentiny/tiny-robot 0.2.0 → 0.2.2

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
1
  import { defineComponent as $, useSlots as H, computed as i, ref as f, watch as N, nextTick as W, createElementBlock as _, openBlock as n, createBlock as v, createCommentVNode as R, Fragment as G, renderList as I, unref as h, withCtx as S, createElementVNode as w, resolveDynamicComponent as x, renderSlot as L, createVNode as E, Transition as j, withDirectives as q, normalizeClass as J, withModifiers as K, toDisplayString as Q, vShow as U } from "vue";
2
- import { o as Y } from "../tiny-robot-svgs.js";
2
+ import { c as Y } from "../tiny-robot-svgs.js";
3
3
  import { T as M } from "../index4.js";
4
4
  import { o as Z, a as ee } from "../index2.js";
5
5
  import te from "../icon-button/index.js";
@@ -3182,9 +3182,8 @@ const Ir = {
3182
3182
  ref: t
3183
3183
  }, [
3184
3184
  (S(!0), L(U0, null, Ou(e.items, (s, f) => (S(), yu(J, Nu({
3185
- key: s.id || f,
3186
- ref_for: !0
3187
- }, c(s)), Z0({ _: 2 }, [
3185
+ key: s.id || f
3186
+ }, { ref_for: !0 }, c(s)), Z0({ _: 2 }, [
3188
3187
  Ou(o(s), (d, h) => ({
3189
3188
  name: h,
3190
3189
  fn: H0((b) => [
package/dist/close.js CHANGED
@@ -1,4 +1,4 @@
1
- import { l as o } from "./index6.js";
1
+ import { s as o } from "./index6.js";
2
2
  import { createElementBlock as n, openBlock as r, createElementVNode as t } from "vue";
3
3
  var c = {
4
4
  viewBox: "0 0 16 16",
@@ -1,8 +1,8 @@
1
- import { defineComponent as S, useCssVars as T, unref as M, ref as m, computed as R, watch as V, createElementBlock as o, openBlock as r, Fragment as p, createElementVNode as f, createVNode as B, renderSlot as E, Transition as N, withCtx as O, createCommentVNode as W, normalizeStyle as I, renderList as b, toDisplayString as z } from "vue";
2
- import { c as _, o as F } from "../index2.js";
1
+ import { defineComponent as B, useCssVars as E, unref as f, useAttrs as N, computed as _, ref as m, watch as O, createElementBlock as o, openBlock as s, Fragment as w, createElementVNode as h, createVNode as W, normalizeStyle as v, normalizeClass as z, renderSlot as I, Transition as A, withCtx as F, createCommentVNode as H, renderList as L, toDisplayString as P } from "vue";
2
+ import { c as g, o as U } from "../index2.js";
3
3
  import { t as n } from "../utils.js";
4
- import { _ as H } from "../_plugin-vue_export-helper.js";
5
- const L = { class: "tr-dropdown-menu__list" }, P = ["onClick"], U = /* @__PURE__ */ S({
4
+ import { _ as b } from "../_plugin-vue_export-helper.js";
5
+ const j = { class: "tr-dropdown-menu__list" }, q = ["onClick"], G = /* @__PURE__ */ B({
6
6
  __name: "index",
7
7
  props: {
8
8
  items: {},
@@ -10,62 +10,63 @@ const L = { class: "tr-dropdown-menu__list" }, P = ["onClick"], U = /* @__PURE__
10
10
  topOffset: { default: 0 }
11
11
  },
12
12
  emits: ["item-click"],
13
- setup(l, { emit: w }) {
14
- T((e) => ({
15
- "90b2d29e": M(n)(a.minWidth)
13
+ setup(l, { emit: k }) {
14
+ E((e) => ({
15
+ d82a8430: f(n)(a.minWidth)
16
16
  }));
17
- const a = l, t = m(!1), h = w, i = m(null), d = m(null), { x: v, y: g, update: k } = _(i), { width: x, height: C } = _(d), y = R(() => ({
18
- left: `min(${n(v.value)}, 100% - ${n(x.value)})`,
19
- top: `max(${n(g.value)} - ${n(C.value)} + ${n(a.topOffset)} - 8px, 0px)`
17
+ const a = l, p = N(), y = _(() => p.style), t = m(!1), C = k, i = m(null), d = m(null), { x, y: $, update: S } = g(i), { width: D, height: T } = g(d), M = _(() => ({
18
+ left: `min(${n(x.value)}, 100% - ${n(D.value)})`,
19
+ top: `max(${n($.value)} - ${n(T.value)} + ${n(a.topOffset)} - 8px, 0px)`
20
20
  }));
21
- F(d, (e) => {
22
- var c;
23
- (c = i.value) != null && c.contains(e.target) && e.stopPropagation(), t.value = !1;
24
- }), V(t, (e) => {
25
- e && k();
21
+ U(d, (e) => {
22
+ var u;
23
+ (u = i.value) != null && u.contains(e.target) && e.stopPropagation(), t.value = !1;
24
+ }), O(t, (e) => {
25
+ e && S();
26
26
  });
27
- const $ = () => {
27
+ const R = () => {
28
28
  t.value = !t.value;
29
- }, D = (e) => {
30
- t.value = !1, h("item-click", e);
29
+ }, V = (e) => {
30
+ t.value = !1, C("item-click", e);
31
31
  };
32
- return (e, c) => (r(), o(p, null, [
33
- f("div", {
34
- class: "tr-dropdown-menu__wrapper",
32
+ return (e, u) => (s(), o(w, null, [
33
+ h("div", {
34
+ class: z(["tr-dropdown-menu__wrapper", f(p).class]),
35
+ style: v(y.value),
35
36
  ref_key: "dropDownTriggerRef",
36
37
  ref: i,
37
- onClick: $
38
+ onClick: R
38
39
  }, [
39
- E(e.$slots, "default", {}, void 0, !0)
40
- ], 512),
41
- B(N, { name: "tr-dropdown-menu" }, {
42
- default: O(() => [
43
- t.value ? (r(), o("div", {
40
+ I(e.$slots, "default", {}, void 0, !0)
41
+ ], 6),
42
+ W(A, { name: "tr-dropdown-menu" }, {
43
+ default: F(() => [
44
+ t.value ? (s(), o("div", {
44
45
  key: 0,
45
46
  class: "tr-dropdown-menu",
46
- style: I(y.value),
47
+ style: v(M.value),
47
48
  ref_key: "dropdownMenuRef",
48
49
  ref: d
49
50
  }, [
50
- f("ul", L, [
51
- (r(!0), o(p, null, b(a.items, (u) => (r(), o("li", {
51
+ h("ul", j, [
52
+ (s(!0), o(w, null, L(a.items, (c) => (s(), o("li", {
52
53
  class: "tr-dropdown-menu__list-item",
53
- key: u.id,
54
- onClick: (q) => D(u)
55
- }, z(u.text), 9, P))), 128))
54
+ key: c.id,
55
+ onClick: (K) => V(c)
56
+ }, P(c.text), 9, q))), 128))
56
57
  ])
57
- ], 4)) : W("", !0)
58
+ ], 4)) : H("", !0)
58
59
  ]),
59
60
  _: 1
60
61
  })
61
62
  ], 64));
62
63
  }
63
- }), s = /* @__PURE__ */ H(U, [["__scopeId", "data-v-ce90a07c"]]);
64
- s.name = "TrDropdownMenu";
65
- const j = function(l) {
66
- l.component(s.name, s);
64
+ }), r = /* @__PURE__ */ b(G, [["__scopeId", "data-v-620f91f9"]]);
65
+ r.name = "TrDropdownMenu";
66
+ const J = function(l) {
67
+ l.component(r.name, r);
67
68
  };
68
- s.install = j;
69
+ r.install = J;
69
70
  export {
70
- s as default
71
+ r as default
71
72
  };
@@ -102,7 +102,8 @@ const W = { class: "tr-feedback__source-list" }, Y = ["href"], Z = /* @__PURE__
102
102
  o[0] || (o[0] = d("span", null, "更多", -1)),
103
103
  h(l(N))
104
104
  ]),
105
- _: 1
105
+ _: 1,
106
+ __: [0]
106
107
  })
107
108
  ]),
108
109
  default: f(() => [
@@ -1,6 +1,6 @@
1
- import { defineComponent as V, mergeModels as E, useModel as q, watch as g, ref as i, computed as $, createElementBlock as a, openBlock as l, createElementVNode as C, Fragment as I, renderList as S, createCommentVNode as _, normalizeClass as b, createBlock as x, resolveDynamicComponent as B, toDisplayString as D, nextTick as G } from "vue";
2
- import { U as H } from "../tiny-robot-svgs.js";
3
- import { b as X, o as j } from "../index2.js";
1
+ import { defineComponent as V, mergeModels as E, useModel as j, watch as g, ref as i, computed as $, createElementBlock as a, openBlock as l, createElementVNode as b, Fragment as C, renderList as F, createCommentVNode as _, normalizeClass as I, createBlock as x, resolveDynamicComponent as B, toDisplayString as S, nextTick as q } from "vue";
2
+ import { U as G } from "../tiny-robot-svgs.js";
3
+ import { b as H, o as X } from "../index2.js";
4
4
  import { _ as J } from "../_plugin-vue_export-helper.js";
5
5
  const K = ["onClick"], P = {
6
6
  key: 0,
@@ -11,15 +11,15 @@ const K = ["onClick"], P = {
11
11
  items: {},
12
12
  selected: {},
13
13
  linesLimit: { default: Number.MAX_SAFE_INTEGER },
14
- moreIcon: { default: H },
14
+ moreIcon: { type: [Object, Function], default: G },
15
15
  showMoreTrigger: { default: "click" }
16
16
  }, {
17
17
  selected: {},
18
18
  selectedModifiers: {}
19
19
  }),
20
20
  emits: /* @__PURE__ */ E(["item-click"], ["update:selected"]),
21
- setup(d, { emit: F }) {
22
- const n = d, u = q(d, "selected");
21
+ setup(d, { emit: D }) {
22
+ const n = d, u = j(d, "selected");
23
23
  g(
24
24
  () => n.items,
25
25
  (t) => {
@@ -27,10 +27,10 @@ const K = ["onClick"], P = {
27
27
  },
28
28
  { immediate: !0 }
29
29
  );
30
- const N = F, y = i(null), w = i(null), k = i(null), M = i([]), s = i(null), m = i(!1), c = i(!1), A = (t, o) => {
30
+ const N = D, y = i(null), w = i(null), k = i(null), M = i([]), s = i(null), m = i(!1), c = i(!1), A = (t, o) => {
31
31
  t && (M.value[o] = t);
32
32
  }, L = () => {
33
- s.value = null, m.value = !1, G(() => {
33
+ s.value = null, m.value = !1, q(() => {
34
34
  const t = y.value, o = w.value;
35
35
  if (!t || !o)
36
36
  return;
@@ -43,18 +43,18 @@ const K = ["onClick"], P = {
43
43
  });
44
44
  };
45
45
  g(() => n.items, L);
46
- const { width: W } = X(y);
47
- g(W, (t) => {
46
+ const { width: O } = H(y);
47
+ g(O, (t) => {
48
48
  t > 0 && L();
49
49
  });
50
- const z = $(() => s.value !== null ? n.items.slice(s.value) : []), O = $(() => s.value === null ? !1 : n.items.findIndex((o) => o.id === u.value) >= s.value), R = (t) => {
50
+ const W = $(() => s.value !== null ? n.items.slice(s.value) : []), z = $(() => s.value === null ? !1 : n.items.findIndex((o) => o.id === u.value) >= s.value), R = (t) => {
51
51
  u.value = t, c.value = !1, N("item-click", t);
52
52
  }, U = () => {
53
53
  n.showMoreTrigger === "click" && (c.value = !c.value);
54
54
  }, v = (t) => {
55
55
  n.showMoreTrigger === "hover" && (c.value = t);
56
56
  };
57
- return j(k, (t) => {
57
+ return X(k, (t) => {
58
58
  var o, e;
59
59
  (o = k.value) != null && o.contains(t.target) || (e = w.value) != null && e.contains(t.target) || (c.value = !1);
60
60
  }), (t, o) => (l(), a("div", {
@@ -62,24 +62,24 @@ const K = ["onClick"], P = {
62
62
  ref_key: "containerRef",
63
63
  ref: y
64
64
  }, [
65
- (l(!0), a(I, null, S(n.items, (e, f) => (l(), a(I, {
65
+ (l(!0), a(C, null, F(n.items, (e, f) => (l(), a(C, {
66
66
  key: e.id
67
67
  }, [
68
68
  s.value === null || f < s.value ? (l(), a("button", {
69
69
  key: 0,
70
- class: b(["tr-flow-layout__item", { "icon-only": !e.label }, { selected: e.id === u.value }]),
70
+ class: I(["tr-flow-layout__item", { "icon-only": !e.label }, { selected: e.id === u.value }]),
71
71
  ref_for: !0,
72
72
  ref: (r) => A(r, f),
73
73
  onClick: (r) => R(e.id)
74
74
  }, [
75
75
  (l(), x(B(e.icon), { class: "tr-flow-layout__item-icon" })),
76
- e.label ? (l(), a("span", P, D(e.label), 1)) : _("", !0)
76
+ e.label ? (l(), a("span", P, S(e.label), 1)) : _("", !0)
77
77
  ], 10, K)) : _("", !0)
78
78
  ], 64))), 128)),
79
- C("div", Q, [
79
+ b("div", Q, [
80
80
  m.value ? _("", !0) : (l(), a("button", {
81
81
  key: 0,
82
- class: b(["tr-flow-layout__item", "icon-only", { selected: O.value }]),
82
+ class: I(["tr-flow-layout__item", "icon-only", { selected: z.value }]),
83
83
  ref_key: "moreButtonRef",
84
84
  ref: w,
85
85
  onClick: U,
@@ -88,7 +88,7 @@ const K = ["onClick"], P = {
88
88
  }, [
89
89
  (l(), x(B(n.moreIcon), { class: "tr-flow-layout__item-icon" }))
90
90
  ], 34)),
91
- C("div", {
91
+ b("div", {
92
92
  class: "tr-flow-layout__dropdown-container",
93
93
  onMouseenter: o[2] || (o[2] = (e) => v(!0)),
94
94
  onMouseleave: o[3] || (o[3] = (e) => v(!1))
@@ -99,13 +99,13 @@ const K = ["onClick"], P = {
99
99
  ref_key: "dropDownRef",
100
100
  ref: k
101
101
  }, [
102
- (l(!0), a(I, null, S(z.value, (e) => (l(), a("button", {
103
- class: b(["tr-flow-layout__dropdown_item", { selected: e.id === u.value }]),
102
+ (l(!0), a(C, null, F(W.value, (e) => (l(), a("button", {
103
+ class: I(["tr-flow-layout__dropdown_item", { selected: e.id === u.value }]),
104
104
  key: e.id,
105
105
  onClick: (f) => R(e.id)
106
106
  }, [
107
107
  (l(), x(B(e.icon), { class: "tr-flow-layout__item-icon" })),
108
- C("span", Z, D(e.label), 1)
108
+ b("span", Z, S(e.label), 1)
109
109
  ], 10, Y))), 128))
110
110
  ], 512)) : _("", !0)
111
111
  ], 32)
@@ -156,9 +156,8 @@ const ue = /* @__PURE__ */ V({
156
156
  p("span", Ie, k(d.title), 1),
157
157
  d.tag ? (n(), R(e(de), te({
158
158
  key: 0,
159
- class: "tr-history__item-tag",
160
- ref_for: !0
161
- }, d.tag), null, 16)) : E("", !0),
159
+ class: "tr-history__item-tag"
160
+ }, { ref_for: !0 }, d.tag), null, 16)) : E("", !0),
162
161
  p("div", we, [
163
162
  m(e(S), {
164
163
  content: "编辑",
package/dist/index.d.ts CHANGED
@@ -69,15 +69,15 @@ theme: ThemeType_2;
69
69
  declare const __VLS_component_11: DefineComponent<__VLS_PublicProps_3, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
70
70
  "update:selectedGroup": (value: string) => any;
71
71
  } & {
72
- "item-click": (item: SuggestionItem_2) => any;
72
+ "item-click": (item: SuggestionItem_2<Record<string, unknown>>) => any;
73
73
  close: () => any;
74
74
  open: () => any;
75
- "group-click": (group: SuggestionGroup) => any;
75
+ "group-click": (group: SuggestionGroup<Record<string, unknown>>) => any;
76
76
  }, string, PublicProps, Readonly<__VLS_PublicProps_3> & Readonly<{
77
- "onItem-click"?: ((item: SuggestionItem_2) => any) | undefined;
77
+ "onItem-click"?: ((item: SuggestionItem_2<Record<string, unknown>>) => any) | undefined;
78
78
  onClose?: (() => any) | undefined;
79
79
  onOpen?: (() => any) | undefined;
80
- "onGroup-click"?: ((group: SuggestionGroup) => any) | undefined;
80
+ "onGroup-click"?: ((group: SuggestionGroup<Record<string, unknown>>) => any) | undefined;
81
81
  "onUpdate:selectedGroup"?: ((value: string) => any) | undefined;
82
82
  }>, {
83
83
  title: string;
@@ -394,20 +394,20 @@ disabled: boolean;
394
394
  type: string;
395
395
  ellipsis: boolean;
396
396
  mask: boolean;
397
+ vertical: boolean;
398
+ customClass: string;
397
399
  tiny_mode_root: boolean;
398
400
  _constants: Record<string, any>;
399
401
  tabindex: string;
400
- contentStyle: Record<string, any>;
401
- customClass: string;
402
402
  showTitle: boolean;
403
403
  readonly: boolean;
404
404
  hoverExpand: boolean;
405
405
  memorySpace: number;
406
- vertical: boolean;
407
406
  selectMenu: {
408
407
  id: string;
409
408
  label: string;
410
409
  }[];
410
+ contentStyle: Record<string, any>;
411
411
  isSelect: boolean;
412
412
  counter: boolean;
413
413
  autosize: boolean | Record<string, any>;
@@ -621,20 +621,20 @@ disabled: boolean;
621
621
  type: string;
622
622
  ellipsis: boolean;
623
623
  mask: boolean;
624
+ vertical: boolean;
625
+ customClass: string;
624
626
  tiny_mode_root: boolean;
625
627
  _constants: Record<string, any>;
626
628
  tabindex: string;
627
- contentStyle: Record<string, any>;
628
- customClass: string;
629
629
  showTitle: boolean;
630
630
  readonly: boolean;
631
631
  hoverExpand: boolean;
632
632
  memorySpace: number;
633
- vertical: boolean;
634
633
  selectMenu: {
635
634
  id: string;
636
635
  label: string;
637
636
  }[];
637
+ contentStyle: Record<string, any>;
638
638
  isSelect: boolean;
639
639
  counter: boolean;
640
640
  autosize: boolean | Record<string, any>;
@@ -1176,20 +1176,20 @@ declare function __VLS_template_5(): {
1176
1176
  type: string;
1177
1177
  ellipsis: boolean;
1178
1178
  mask: boolean;
1179
+ vertical: boolean;
1180
+ customClass: string;
1179
1181
  tiny_mode_root: boolean;
1180
1182
  _constants: Record<string, any>;
1181
1183
  tabindex: string;
1182
- contentStyle: Record<string, any>;
1183
- customClass: string;
1184
1184
  showTitle: boolean;
1185
1185
  readonly: boolean;
1186
1186
  hoverExpand: boolean;
1187
1187
  memorySpace: number;
1188
- vertical: boolean;
1189
1188
  selectMenu: {
1190
1189
  id: string;
1191
1190
  label: string;
1192
1191
  }[];
1192
+ contentStyle: Record<string, any>;
1193
1193
  isSelect: boolean;
1194
1194
  counter: boolean;
1195
1195
  autosize: boolean | Record<string, any>;
@@ -1403,20 +1403,20 @@ declare function __VLS_template_5(): {
1403
1403
  type: string;
1404
1404
  ellipsis: boolean;
1405
1405
  mask: boolean;
1406
+ vertical: boolean;
1407
+ customClass: string;
1406
1408
  tiny_mode_root: boolean;
1407
1409
  _constants: Record<string, any>;
1408
1410
  tabindex: string;
1409
- contentStyle: Record<string, any>;
1410
- customClass: string;
1411
1411
  showTitle: boolean;
1412
1412
  readonly: boolean;
1413
1413
  hoverExpand: boolean;
1414
1414
  memorySpace: number;
1415
- vertical: boolean;
1416
1415
  selectMenu: {
1417
1416
  id: string;
1418
1417
  label: string;
1419
1418
  }[];
1419
+ contentStyle: Record<string, any>;
1420
1420
  isSelect: boolean;
1421
1421
  counter: boolean;
1422
1422
  autosize: boolean | Record<string, any>;
@@ -2313,7 +2313,12 @@ export declare interface SpeechState {
2313
2313
 
2314
2314
  export declare type SubmitTrigger = 'enter' | 'ctrlEnter' | 'shiftEnter';
2315
2315
 
2316
- declare type SuggestionData = (SuggestionItem_2 | SuggestionGroup)[];
2316
+ declare interface SuggestionBaseItem {
2317
+ id: string;
2318
+ text: string;
2319
+ }
2320
+
2321
+ declare type SuggestionData<T = Record<string, unknown>> = (SuggestionItem_2<T> | SuggestionGroup<T>)[];
2317
2322
 
2318
2323
  /**
2319
2324
  * 组件事件
@@ -2337,11 +2342,11 @@ export declare interface SuggestionEmits {
2337
2342
  (e: 'fill-template', template: string): void;
2338
2343
  }
2339
2344
 
2340
- declare interface SuggestionGroup {
2345
+ declare interface SuggestionGroup<T = Record<string, unknown>> {
2341
2346
  group: string;
2342
2347
  label: string;
2343
2348
  icon?: VNode | Component;
2344
- items: SuggestionItem_2[];
2349
+ items: SuggestionItem_2<T>[];
2345
2350
  }
2346
2351
 
2347
2352
  /**
@@ -2364,10 +2369,7 @@ export declare interface SuggestionItem {
2364
2369
  template?: string;
2365
2370
  }
2366
2371
 
2367
- declare interface SuggestionItem_2 {
2368
- id: string;
2369
- text: string;
2370
- }
2372
+ declare type SuggestionItem_2<T = Record<string, unknown>> = SuggestionBaseItem & T;
2371
2373
 
2372
2374
  export declare type SuggestionPillAction = {
2373
2375
  type: 'popover';
@@ -2433,8 +2435,8 @@ declare interface SuggestionPopoverEvents {
2433
2435
  close?: () => void;
2434
2436
  }
2435
2437
 
2436
- declare interface SuggestionPopoverProps {
2437
- data: SuggestionData;
2438
+ declare interface SuggestionPopoverProps<T = Record<string, unknown>> {
2439
+ data: SuggestionData<T>;
2438
2440
  title?: string;
2439
2441
  icon?: VNode | Component;
2440
2442
  /**