bitboss-ui 2.1.127 → 2.1.128

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.
@@ -0,0 +1,142 @@
1
+ import { useId as e } from "./index12.js";
2
+ import { useElementSize as t } from "./index14.js";
3
+ import { extractDomContainer as n } from "./index45.js";
4
+ import { useUntil as r } from "./index50.js";
5
+ import i from "./index60.js";
6
+ import { parseWidthString as a } from "./index231.js";
7
+ import { Comment as o, Fragment as s, computed as c, createCommentVNode as l, createElementBlock as u, createElementVNode as d, createTextVNode as f, createVNode as p, defineComponent as m, mergeModels as h, mergeProps as g, normalizeProps as _, normalizeStyle as v, onBeforeUnmount as y, onMounted as b, openBlock as x, ref as S, renderSlot as C, toDisplayString as w, useModel as T, useSlots as E, useTemplateRef as D, watch as O, withCtx as k } from "vue";
8
+ //#region src/components/BbTooltip/BbTooltip.vue?vue&type=script&setup=true&lang.ts
9
+ var A = /* @__PURE__ */ m({
10
+ inheritAttrs: !1,
11
+ __name: "BbTooltip",
12
+ props: /* @__PURE__ */ h({
13
+ arrowPadding: { default: 10 },
14
+ block: { type: Boolean },
15
+ disabled: { type: Boolean },
16
+ eager: { type: Boolean },
17
+ id: {},
18
+ padding: { default: 10 },
19
+ placement: { default: "top" },
20
+ text: {},
21
+ theme: { default: "default" },
22
+ transitionDuration: { default: 250 },
23
+ activator: {},
24
+ boundary: {},
25
+ timeout: { default: 0 },
26
+ width: {}
27
+ }, {
28
+ modelValue: {
29
+ type: Boolean,
30
+ default: !1
31
+ },
32
+ modelModifiers: {}
33
+ }),
34
+ emits: ["update:modelValue"],
35
+ setup(m) {
36
+ let h = m, A = E(), j = `bb_${h.id ?? e().id.value}`, M = `${j}_desc`, N = (e) => {
37
+ if (!e) return "";
38
+ let t = "";
39
+ for (let n of e) {
40
+ if (n.type === o) continue;
41
+ let e = n.children;
42
+ typeof e == "string" ? t += e : Array.isArray(e) && (t += N(e));
43
+ }
44
+ return t;
45
+ }, P = S(!1), F = c(() => (h.text ?? (P.value ? N(A.default?.({})) : "")).replace(/\s+/g, " ").trim()), I = S(), L = c(() => h.activator != null), R = D("popover"), z = c(() => n(R.value)), B = T(m, "modelValue"), V = r(B), H = (e) => {
46
+ let t = n(e);
47
+ t && (I.value = t);
48
+ }, U, W, G = () => {
49
+ clearTimeout(W);
50
+ }, K = () => {
51
+ clearTimeout(U), clearTimeout(W), document.removeEventListener("keydown", Y), B.value = !1;
52
+ }, q = () => {
53
+ clearTimeout(U), clearTimeout(W), W = setTimeout(K, 50);
54
+ }, J = () => {
55
+ G(), !(B.value || h.disabled) && (U = setTimeout(() => {
56
+ B.value = !0, document.addEventListener("keydown", Y, { passive: !0 });
57
+ }, h.timeout));
58
+ }, Y = (e) => {
59
+ e.key === "Escape" && K();
60
+ };
61
+ O(() => h.activator, (e) => {
62
+ e && H(e);
63
+ }, { immediate: !0 });
64
+ let X = null;
65
+ O(I, (e) => {
66
+ X &&= (X(), null), e && (e.addEventListener("mouseenter", J, { passive: !0 }), e.addEventListener("mouseleave", q, { passive: !0 }), e.addEventListener("focus", J, { passive: !0 }), e.addEventListener("blur", K, { passive: !0 }), X = () => {
67
+ e.removeEventListener("mouseenter", J), e.removeEventListener("mouseleave", q), e.removeEventListener("focus", J), e.removeEventListener("blur", K);
68
+ });
69
+ }, { immediate: !0 });
70
+ let Z = null;
71
+ O(z, (e) => {
72
+ Z &&= (Z(), null), e && (e.addEventListener("mouseenter", G, { passive: !0 }), e.addEventListener("mouseleave", q, { passive: !0 }), Z = () => {
73
+ e.removeEventListener("mouseenter", G), e.removeEventListener("mouseleave", q);
74
+ });
75
+ }, { immediate: !0 });
76
+ let Q = () => {
77
+ let e = I.value;
78
+ e && (F.value ? e.setAttribute("aria-describedby", M) : V.value && e.setAttribute("aria-describedby", j));
79
+ };
80
+ b(() => {
81
+ Q(), P.value = !0;
82
+ }), O([
83
+ I,
84
+ V,
85
+ F
86
+ ], Q, { flush: "post" }), y(() => {
87
+ X?.(), Z?.(), I.value && I.value.removeAttribute("aria-describedby"), K();
88
+ });
89
+ let { width: $ } = t(I, {
90
+ width: 0,
91
+ height: 0
92
+ }, { box: "border-box" }), ee = c(() => {
93
+ if (h.width) {
94
+ let { value: e, unit: t } = a(h.width);
95
+ return t === "%" ? I.value ? `${$.value * (e / 100)}px` : "0px" : `${e}px`;
96
+ }
97
+ });
98
+ return (e, t) => (x(), u(s, null, [
99
+ F.value ? (x(), u("span", {
100
+ key: 0,
101
+ id: M,
102
+ class: "sr-only"
103
+ }, w(F.value), 1)) : l("", !0),
104
+ L.value ? l("", !0) : C(e.$slots, "activator", _(g({ key: 1 }, {
105
+ props: { ref: H },
106
+ disabled: e.disabled,
107
+ open: B.value,
108
+ placement: e.placement
109
+ }))),
110
+ p(i, g({
111
+ ref: "popover",
112
+ modelValue: B.value,
113
+ "onUpdate:modelValue": t[0] ||= (e) => B.value = e,
114
+ anchor: I.value,
115
+ "arrow-padding": e.arrowPadding,
116
+ boundary: e.boundary,
117
+ class: ["bb-tooltip", { [`bb-tooltip--${e.theme}`]: !0 }],
118
+ padding: e.padding,
119
+ placement: e.placement,
120
+ "transition-duration": e.transitionDuration
121
+ }, e.$attrs), {
122
+ default: k(() => [d("span", {
123
+ id: j,
124
+ class: "bb-tooltip__content",
125
+ style: v({ width: ee.value })
126
+ }, [C(e.$slots, "default", {}, () => [f(w(e.text), 1)])], 4)]),
127
+ _: 3
128
+ }, 16, [
129
+ "modelValue",
130
+ "anchor",
131
+ "arrow-padding",
132
+ "boundary",
133
+ "class",
134
+ "padding",
135
+ "placement",
136
+ "transition-duration"
137
+ ])
138
+ ], 64));
139
+ }
140
+ });
141
+ //#endregion
142
+ export { A as default };
package/dist/index346.js CHANGED
@@ -1,4 +1,6 @@
1
- //#region src/utilities/functions/flattenTree.ts
2
- var e = (t, n, r = (e) => e, i) => t.map((t) => Array.isArray(t[n]) ? [r(t, i), ...e(t[n], n, r, r(t, i))] : [r(t, i)]).flat();
1
+ import e from "./index344.js";
2
+ /* empty css */
3
+ //#region src/components/BbTooltip/BbTooltip.vue
4
+ var t = e;
3
5
  //#endregion
4
- export { e as flattenTree };
6
+ export { t as default };
package/dist/index347.js CHANGED
@@ -1,109 +1,4 @@
1
- import { flattenTree as e } from "./index346.js";
2
- import { Fragment as t, computed as n, createElementBlock as r, createElementVNode as i, createSlots as a, createVNode as o, defineComponent as s, mergeProps as c, normalizeClass as l, openBlock as u, renderList as d, renderSlot as f, resolveComponent as p, withCtx as m } from "vue";
3
- //#region src/components/BbTree/BbTree.vue?vue&type=script&setup=true&lang.ts
4
- var h = { class: "bb-tree-row" }, g = { class: "bb-tree-main-content" }, _ = /* @__PURE__ */ s({
5
- __name: "BbTree",
6
- props: {
7
- items: { default: () => [] },
8
- parent: {},
9
- identifier: { default: "id" },
10
- depth: { default: 0 },
11
- expandable: { type: [Boolean, Function] }
12
- },
13
- setup(s) {
14
- let _ = s, v = (e) => e.open === void 0 ? !0 : e.open, y = n(() => {
15
- let t = 0;
16
- return _.items.map((n, r) => {
17
- let i = v(n), a = n.expandable ?? _.expandable, o = t + 1;
18
- t += e([n], "children").length;
19
- let s = !1;
20
- return a !== void 0 && (s = typeof a == "function" ? a(n, _.depth, _.parent) : a), {
21
- children: n.children,
22
- depth: _.depth,
23
- expandable: s,
24
- identifier: n[_.identifier],
25
- offset: o,
26
- index: r,
27
- open: i,
28
- original: n,
29
- parent: _.parent
30
- };
31
- });
32
- });
33
- return (e, n) => {
34
- let s = p("BbTree", !0);
35
- return u(!0), r(t, null, d(y.value, (t) => (u(), r("div", {
36
- key: t.identifier,
37
- class: l(["bb-tree", {
38
- [`bb-tree--depth-${t.depth}`]: !0,
39
- "bb-tree--open": t.open
40
- }])
41
- }, [i("div", h, [i("div", g, [e.$slots[t.identifier] ? f(e.$slots, t.identifier, {
42
- key: 0,
43
- depth: t.depth,
44
- expandable: t.expandable,
45
- identifier: t.identifier,
46
- index: t.index,
47
- item: t.original,
48
- offset: t.offset,
49
- open: t.open,
50
- parent: t.parent
51
- }) : e.$slots[t.depth] ? f(e.$slots, t.depth, {
52
- key: 1,
53
- depth: t.depth,
54
- expandable: t.expandable,
55
- identifier: t.identifier,
56
- index: t.index,
57
- item: t.original,
58
- offset: t.offset,
59
- open: t.open,
60
- parent: t.parent
61
- }) : f(e.$slots, "default", {
62
- key: 2,
63
- depth: t.depth,
64
- expandable: t.expandable,
65
- identifier: t.identifier,
66
- index: t.index,
67
- item: t.original,
68
- offset: t.offset,
69
- open: t.open,
70
- parent: t.parent
71
- })])]), i("div", { class: l(`bb-tree--depth-${t.depth}-children`) }, [f(e.$slots, `${t.identifier}-children`, {
72
- depth: t.depth,
73
- expandable: t.expandable,
74
- identifier: t.identifier,
75
- index: t.index,
76
- item: t.original,
77
- offset: t.offset,
78
- open: t.open,
79
- parent: t.parent
80
- }, () => [f(e.$slots, `${t.depth}-children`, {
81
- depth: t.depth,
82
- expandable: t.expandable,
83
- identifier: t.identifier,
84
- index: t.index,
85
- item: t.original,
86
- offset: t.offset,
87
- open: t.open,
88
- parent: t.parent
89
- }, () => [o(s, {
90
- depth: t.depth + 1,
91
- expandable: e.expandable,
92
- identifier: _.identifier,
93
- items: t.children,
94
- parent: t
95
- }, a({ _: 2 }, [d(e.$slots, (t, n) => ({
96
- name: n,
97
- fn: m((t) => [f(e.$slots, n, c({ ref_for: !0 }, t))])
98
- }))]), 1032, [
99
- "depth",
100
- "expandable",
101
- "identifier",
102
- "items",
103
- "parent"
104
- ])])])], 2)], 2))), 128);
105
- };
106
- }
107
- });
1
+ //#region src/utilities/functions/flattenTree.ts
2
+ var e = (t, n, r = (e) => e, i) => t.map((t) => Array.isArray(t[n]) ? [r(t, i), ...e(t[n], n, r, r(t, i))] : [r(t, i)]).flat();
108
3
  //#endregion
109
- export { _ as default };
4
+ export { e as flattenTree };
@@ -0,0 +1,109 @@
1
+ import { flattenTree as e } from "./index347.js";
2
+ import { Fragment as t, computed as n, createElementBlock as r, createElementVNode as i, createSlots as a, createVNode as o, defineComponent as s, mergeProps as c, normalizeClass as l, openBlock as u, renderList as d, renderSlot as f, resolveComponent as p, withCtx as m } from "vue";
3
+ //#region src/components/BbTree/BbTree.vue?vue&type=script&setup=true&lang.ts
4
+ var h = { class: "bb-tree-row" }, g = { class: "bb-tree-main-content" }, _ = /* @__PURE__ */ s({
5
+ __name: "BbTree",
6
+ props: {
7
+ items: { default: () => [] },
8
+ parent: {},
9
+ identifier: { default: "id" },
10
+ depth: { default: 0 },
11
+ expandable: { type: [Boolean, Function] }
12
+ },
13
+ setup(s) {
14
+ let _ = s, v = (e) => e.open === void 0 ? !0 : e.open, y = n(() => {
15
+ let t = 0;
16
+ return _.items.map((n, r) => {
17
+ let i = v(n), a = n.expandable ?? _.expandable, o = t + 1;
18
+ t += e([n], "children").length;
19
+ let s = !1;
20
+ return a !== void 0 && (s = typeof a == "function" ? a(n, _.depth, _.parent) : a), {
21
+ children: n.children,
22
+ depth: _.depth,
23
+ expandable: s,
24
+ identifier: n[_.identifier],
25
+ offset: o,
26
+ index: r,
27
+ open: i,
28
+ original: n,
29
+ parent: _.parent
30
+ };
31
+ });
32
+ });
33
+ return (e, n) => {
34
+ let s = p("BbTree", !0);
35
+ return u(!0), r(t, null, d(y.value, (t) => (u(), r("div", {
36
+ key: t.identifier,
37
+ class: l(["bb-tree", {
38
+ [`bb-tree--depth-${t.depth}`]: !0,
39
+ "bb-tree--open": t.open
40
+ }])
41
+ }, [i("div", h, [i("div", g, [e.$slots[t.identifier] ? f(e.$slots, t.identifier, {
42
+ key: 0,
43
+ depth: t.depth,
44
+ expandable: t.expandable,
45
+ identifier: t.identifier,
46
+ index: t.index,
47
+ item: t.original,
48
+ offset: t.offset,
49
+ open: t.open,
50
+ parent: t.parent
51
+ }) : e.$slots[t.depth] ? f(e.$slots, t.depth, {
52
+ key: 1,
53
+ depth: t.depth,
54
+ expandable: t.expandable,
55
+ identifier: t.identifier,
56
+ index: t.index,
57
+ item: t.original,
58
+ offset: t.offset,
59
+ open: t.open,
60
+ parent: t.parent
61
+ }) : f(e.$slots, "default", {
62
+ key: 2,
63
+ depth: t.depth,
64
+ expandable: t.expandable,
65
+ identifier: t.identifier,
66
+ index: t.index,
67
+ item: t.original,
68
+ offset: t.offset,
69
+ open: t.open,
70
+ parent: t.parent
71
+ })])]), i("div", { class: l(`bb-tree--depth-${t.depth}-children`) }, [f(e.$slots, `${t.identifier}-children`, {
72
+ depth: t.depth,
73
+ expandable: t.expandable,
74
+ identifier: t.identifier,
75
+ index: t.index,
76
+ item: t.original,
77
+ offset: t.offset,
78
+ open: t.open,
79
+ parent: t.parent
80
+ }, () => [f(e.$slots, `${t.depth}-children`, {
81
+ depth: t.depth,
82
+ expandable: t.expandable,
83
+ identifier: t.identifier,
84
+ index: t.index,
85
+ item: t.original,
86
+ offset: t.offset,
87
+ open: t.open,
88
+ parent: t.parent
89
+ }, () => [o(s, {
90
+ depth: t.depth + 1,
91
+ expandable: e.expandable,
92
+ identifier: _.identifier,
93
+ items: t.children,
94
+ parent: t
95
+ }, a({ _: 2 }, [d(e.$slots, (t, n) => ({
96
+ name: n,
97
+ fn: m((t) => [f(e.$slots, n, c({ ref_for: !0 }, t))])
98
+ }))]), 1032, [
99
+ "depth",
100
+ "expandable",
101
+ "identifier",
102
+ "items",
103
+ "parent"
104
+ ])])])], 2)], 2))), 128);
105
+ };
106
+ }
107
+ });
108
+ //#endregion
109
+ export { _ as default };
package/dist/index350.js CHANGED
@@ -1,55 +1,6 @@
1
- import { Fragment as e, h as t, render as n } from "vue";
2
- //#region src/directives/createPopoverDirective.ts
3
- var r = 0, i = (i) => {
4
- let a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new WeakMap(), s = (e) => {
5
- let t = a.get(e);
6
- if (!t) {
7
- let n = document.createElement("div");
8
- n.setAttribute(`data-${i.name}-host`, ""), document.body.appendChild(n), t = {
9
- host: n,
10
- entries: /* @__PURE__ */ new Map()
11
- }, a.set(e, t);
12
- }
13
- return t;
14
- }, c = (r, o) => {
15
- if (o.entries.size === 0) {
16
- n(null, o.host), o.host.remove(), a.delete(r);
17
- return;
18
- }
19
- let s = [];
20
- for (let e of o.entries.values()) {
21
- let t = i.build(e.id, e.el, e.options);
22
- t && s.push(t);
23
- }
24
- let c = t(e, s);
25
- c.appContext = r, n(c, o.host);
26
- };
27
- return {
28
- mounted(e, t) {
29
- let n = t.instance?.$.appContext ?? null, a = s(n), l = `${i.name}-${++r}`;
30
- a.entries.set(l, {
31
- id: l,
32
- el: e,
33
- options: i.resolve(t)
34
- }), o.set(e, {
35
- id: l,
36
- appContext: n
37
- }), c(n, a);
38
- },
39
- updated(e, t) {
40
- let n = o.get(e);
41
- if (!n) return;
42
- let r = a.get(n.appContext), s = r?.entries.get(n.id);
43
- !r || !s || (s.options = i.resolve(t), c(n.appContext, r));
44
- },
45
- beforeUnmount(e) {
46
- let t = o.get(e);
47
- if (!t) return;
48
- o.delete(e);
49
- let n = a.get(t.appContext);
50
- n && (n.entries.delete(t.id), c(t.appContext, n));
51
- }
52
- };
53
- };
1
+ import e from "./index348.js";
2
+ /* empty css */
3
+ //#region src/components/BbTree/BbTree.vue
4
+ var t = e;
54
5
  //#endregion
55
- export { i as createPopoverDirective };
6
+ export { t as default };
package/dist/index351.js CHANGED
@@ -1,24 +1,55 @@
1
- import e from "./index345.js";
2
- import { createPopoverDirective as t } from "./index350.js";
3
- import { h as n } from "vue";
4
- //#region src/directives/bbTooltip.ts
5
- var r = t({
6
- name: "bb-tooltip",
7
- resolve(e) {
8
- let t = e.value, n = t == null || typeof t == "string" || typeof t == "number" ? { text: t == null ? "" : String(t) } : { ...t };
9
- return e.arg && (n.placement = e.arg), n;
10
- },
11
- build(t, r, { text: i, ...a }) {
12
- return i ? n(e, {
13
- key: t,
14
- id: t,
15
- ...a,
16
- activator: r,
17
- text: i
18
- }) : null;
19
- }
20
- }), i = { install(e, t = "bb-tooltip") {
21
- e.directive(t, r);
22
- } };
1
+ import { Fragment as e, h as t, render as n } from "vue";
2
+ //#region src/directives/createPopoverDirective.ts
3
+ var r = 0, i = (i) => {
4
+ let a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new WeakMap(), s = (e) => {
5
+ let t = a.get(e);
6
+ if (!t) {
7
+ let n = document.createElement("div");
8
+ n.setAttribute(`data-${i.name}-host`, ""), document.body.appendChild(n), t = {
9
+ host: n,
10
+ entries: /* @__PURE__ */ new Map()
11
+ }, a.set(e, t);
12
+ }
13
+ return t;
14
+ }, c = (r, o) => {
15
+ if (o.entries.size === 0) {
16
+ n(null, o.host), o.host.remove(), a.delete(r);
17
+ return;
18
+ }
19
+ let s = [];
20
+ for (let e of o.entries.values()) {
21
+ let t = i.build(e.id, e.el, e.options);
22
+ t && s.push(t);
23
+ }
24
+ let c = t(e, s);
25
+ c.appContext = r, n(c, o.host);
26
+ };
27
+ return {
28
+ mounted(e, t) {
29
+ let n = t.instance?.$.appContext ?? null, a = s(n), l = `${i.name}-${++r}`;
30
+ a.entries.set(l, {
31
+ id: l,
32
+ el: e,
33
+ options: i.resolve(t)
34
+ }), o.set(e, {
35
+ id: l,
36
+ appContext: n
37
+ }), c(n, a);
38
+ },
39
+ updated(e, t) {
40
+ let n = o.get(e);
41
+ if (!n) return;
42
+ let r = a.get(n.appContext), s = r?.entries.get(n.id);
43
+ !r || !s || (s.options = i.resolve(t), c(n.appContext, r));
44
+ },
45
+ beforeUnmount(e) {
46
+ let t = o.get(e);
47
+ if (!t) return;
48
+ o.delete(e);
49
+ let n = a.get(t.appContext);
50
+ n && (n.entries.delete(t.id), c(t.appContext, n));
51
+ }
52
+ };
53
+ };
23
54
  //#endregion
24
- export { i as BbTooltipDirectivePlugin, r as default };
55
+ export { i as createPopoverDirective };
package/dist/index352.js CHANGED
@@ -1,23 +1,24 @@
1
- import e from "./index234.js";
2
- import { createPopoverDirective as t } from "./index350.js";
1
+ import e from "./index346.js";
2
+ import { createPopoverDirective as t } from "./index351.js";
3
3
  import { h as n } from "vue";
4
- //#region src/directives/bbDropdown.ts
4
+ //#region src/directives/bbTooltip.ts
5
5
  var r = t({
6
- name: "bb-dropdown",
6
+ name: "bb-tooltip",
7
7
  resolve(e) {
8
- let t = e.value, n = Array.isArray(t) ? { items: t } : { ...t };
8
+ let t = e.value, n = t == null || typeof t == "string" || typeof t == "number" ? { text: t == null ? "" : String(t) } : { ...t };
9
9
  return e.arg && (n.placement = e.arg), n;
10
10
  },
11
- build(t, r, i) {
12
- return i.items?.length ? n(e, {
11
+ build(t, r, { text: i, ...a }) {
12
+ return i ? n(e, {
13
13
  key: t,
14
14
  id: t,
15
- ...i,
16
- activator: r
15
+ ...a,
16
+ activator: r,
17
+ text: i
17
18
  }) : null;
18
19
  }
19
- }), i = { install(e, t = "bb-dropdown") {
20
+ }), i = { install(e, t = "bb-tooltip") {
20
21
  e.directive(t, r);
21
22
  } };
22
23
  //#endregion
23
- export { i as BbDropdownDirectivePlugin, r as default };
24
+ export { i as BbTooltipDirectivePlugin, r as default };