bitboss-ui 2.0.31 → 2.0.32

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.
Files changed (142) hide show
  1. package/dist/index104.js +46 -50
  2. package/dist/index106.js +5 -5
  3. package/dist/index114.js +1 -1
  4. package/dist/index116.js +5 -5
  5. package/dist/index118.js +1 -1
  6. package/dist/index122.js +1 -1
  7. package/dist/index123.js +1 -1
  8. package/dist/index124.js +1 -1
  9. package/dist/index126.js +1 -1
  10. package/dist/index128.js +91 -87
  11. package/dist/index129.js +1 -1
  12. package/dist/index13.js +1 -1
  13. package/dist/index15.js +3 -3
  14. package/dist/index17.js +2 -2
  15. package/dist/index19.js +14 -14
  16. package/dist/index198.js +2 -81
  17. package/dist/index199.js +115 -2
  18. package/dist/index200.js +5 -2
  19. package/dist/index201.js +16 -4
  20. package/dist/index202.js +16 -2
  21. package/dist/index203.js +19 -8
  22. package/dist/index204.js +19 -3
  23. package/dist/index205.js +27 -3
  24. package/dist/index206.js +3 -35
  25. package/dist/index207.js +2 -6
  26. package/dist/index208.js +8 -7
  27. package/dist/index209.js +245 -277
  28. package/dist/index21.js +15 -15
  29. package/dist/index210.js +51 -15
  30. package/dist/index211.js +44 -16
  31. package/dist/index212.js +5 -19
  32. package/dist/index213.js +49 -19
  33. package/dist/index214.js +156 -25
  34. package/dist/index215.js +84 -3
  35. package/dist/index217.js +3 -249
  36. package/dist/index218.js +35 -52
  37. package/dist/index219.js +5 -43
  38. package/dist/index220.js +7 -5
  39. package/dist/index221.js +3 -49
  40. package/dist/index222.js +2 -126
  41. package/dist/index223.js +4 -123
  42. package/dist/index224.js +2 -2
  43. package/dist/index225.js +43 -174
  44. package/dist/index227.js +15 -0
  45. package/dist/index228.js +126 -13
  46. package/dist/index229.js +123 -5
  47. package/dist/index23.js +5 -5
  48. package/dist/index230.js +2 -369
  49. package/dist/index231.js +168 -152
  50. package/dist/index232.js +5 -84
  51. package/dist/index233.js +371 -0
  52. package/dist/index234.js +2 -2
  53. package/dist/index235.js +2 -18
  54. package/dist/index236.js +17 -105
  55. package/dist/index237.js +108 -0
  56. package/dist/{index238.js → index239.js} +1 -1
  57. package/dist/index243.js +281 -3
  58. package/dist/index244.js +6 -9
  59. package/dist/index245.js +2 -23
  60. package/dist/index246.js +2 -6
  61. package/dist/index247.js +2 -16
  62. package/dist/index248.js +2 -9
  63. package/dist/index249.js +2 -4
  64. package/dist/index25.js +1 -1
  65. package/dist/index250.js +2 -224
  66. package/dist/index251.js +2 -431
  67. package/dist/index252.js +2 -89
  68. package/dist/index253.js +2 -2
  69. package/dist/index254.js +2 -9
  70. package/dist/index255.js +27 -5
  71. package/dist/index256.js +22 -2
  72. package/dist/index258.js +7 -2
  73. package/dist/index259.js +3 -2
  74. package/dist/index260.js +12 -2
  75. package/dist/index261.js +9 -2
  76. package/dist/index262.js +9 -2
  77. package/dist/index263.js +17 -2
  78. package/dist/index264.js +224 -2
  79. package/dist/index265.js +431 -2
  80. package/dist/index266.js +85 -24
  81. package/dist/index267.js +4 -22
  82. package/dist/index268.js +8 -0
  83. package/dist/index269.js +16 -7
  84. package/dist/index27.js +3 -3
  85. package/dist/index270.js +3 -200
  86. package/dist/index271.js +8 -65
  87. package/dist/index272.js +23 -5
  88. package/dist/index273.js +9 -2
  89. package/dist/index274.js +196 -122
  90. package/dist/index275.js +1 -1
  91. package/dist/index277.js +2 -22
  92. package/dist/index278.js +128 -0
  93. package/dist/index279.js +22 -3
  94. package/dist/index281.js +434 -7
  95. package/dist/index282.js +126 -16
  96. package/dist/index283.js +3 -436
  97. package/dist/index284.js +3 -127
  98. package/dist/index285.js +211 -3
  99. package/dist/index286.js +2 -3
  100. package/dist/index287.js +15 -211
  101. package/dist/index288.js +5 -79
  102. package/dist/index29.js +2 -2
  103. package/dist/index290.js +7 -4
  104. package/dist/index291.js +19 -4
  105. package/dist/index292.js +64 -57
  106. package/dist/index293.js +10 -14
  107. package/dist/index294.js +4 -2
  108. package/dist/index295.js +4 -7
  109. package/dist/index296.js +57 -17
  110. package/dist/index297.js +79 -11
  111. package/dist/index299.js +34 -46
  112. package/dist/index300.js +46 -34
  113. package/dist/index301.js +2 -480
  114. package/dist/index302.js +482 -0
  115. package/dist/index304.js +416 -42
  116. package/dist/index305.js +47 -2
  117. package/dist/index31.js +2 -2
  118. package/dist/index33.js +3 -3
  119. package/dist/index35.js +13 -13
  120. package/dist/index37.js +4 -4
  121. package/dist/index39.js +2 -2
  122. package/dist/index41.js +2 -2
  123. package/dist/index43.js +6 -6
  124. package/dist/index45.js +2 -2
  125. package/dist/index47.js +2 -2
  126. package/dist/index53.js +1 -1
  127. package/dist/index55.js +1 -1
  128. package/dist/index71.js +3 -3
  129. package/dist/index75.js +2 -2
  130. package/dist/index77.js +1 -1
  131. package/dist/index80.js +2 -2
  132. package/dist/index82.js +1 -1
  133. package/dist/index84.js +3 -3
  134. package/dist/index86.js +1 -1
  135. package/package.json +1 -1
  136. package/dist/index216.js +0 -4
  137. package/dist/index226.js +0 -45
  138. package/dist/index240.js +0 -4
  139. package/dist/index280.js +0 -14
  140. package/dist/index303.js +0 -423
  141. /package/dist/{index298.js → index289.js} +0 -0
  142. /package/dist/{index257.js → index306.js} +0 -0
package/dist/index47.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { defineComponent as i, computed as c, openBlock as m, createElementBlock as b, Fragment as f, createVNode as r, normalizeClass as y, withCtx as n, renderSlot as t, createElementVNode as p, mergeProps as h } from "vue";
2
- import g from "./index226.js";
2
+ import g from "./index225.js";
3
3
  /* empty css */
4
- import B from "./index228.js";
4
+ import B from "./index227.js";
5
5
  const k = ["id", "aria-describedby", "aria-invalid", "autocomplete", "autofocus", "disabled", "name", "placeholder", "readonly", "required", "type", "value"], w = /* @__PURE__ */ p("span", null, null, -1), q = /* @__PURE__ */ i({
6
6
  __name: "BaseTextInput",
7
7
  props: {
package/dist/index53.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as z, computed as b, ref as o, onMounted as g, openBlock as l, createElementBlock as i, normalizeProps as h, guardReactiveProps as k, renderSlot as y } from "vue";
2
- import { isCssColor as _ } from "./index200.js";
2
+ import { isCssColor as _ } from "./index222.js";
3
3
  import { wait as C } from "./index127.js";
4
4
  const w = ["alt", "sizes", "src", "srcset"], B = {
5
5
  key: 1,
package/dist/index55.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as p, useSlots as d, computed as n, openBlock as m, createElementBlock as u, normalizeClass as g, createElementVNode as s, renderSlot as l, mergeProps as f, createTextVNode as _, toDisplayString as y } from "vue";
2
- import { isCssColor as r } from "./index200.js";
2
+ import { isCssColor as r } from "./index222.js";
3
3
  import { isNil as B } from "./index125.js";
4
4
  const C = { class: "bb-badge__wrapper" }, h = { class: "bb-badge__content-inner" }, S = /* @__PURE__ */ p({
5
5
  __name: "BbBadge",
package/dist/index71.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import { defineComponent as Q, defineAsyncComponent as W, computed as A, ref as g, openBlock as $, createElementBlock as D, mergeProps as B, createElementVNode as O, renderSlot as w, normalizeProps as X, guardReactiveProps as Y, unref as h, createBlock as Z, withCtx as K, normalizeStyle as _, Fragment as P, renderList as x, createVNode as ee, createCommentVNode as te } from "vue";
2
- import { findRightIndex as H } from "./index244.js";
2
+ import { findRightIndex as H } from "./index271.js";
3
3
  import { useId as ne } from "./index8.js";
4
4
  import { wait as oe } from "./index127.js";
5
5
  import { useIntersectionObserver as ae } from "./index128.js";
6
6
  import le from "./index13.js";
7
7
  /* empty css */
8
- import N from "./index245.js";
8
+ import N from "./index272.js";
9
9
  const me = /* @__PURE__ */ Q({
10
10
  __name: "BbDropdown",
11
11
  props: {
@@ -24,7 +24,7 @@ const me = /* @__PURE__ */ Q({
24
24
  },
25
25
  setup(V) {
26
26
  const j = W(
27
- () => import("./index243.js")
27
+ () => import("./index270.js")
28
28
  ), r = V, d = r.id ?? `bb_${ne().id.value}`, m = A(() => {
29
29
  let e = r.items.findIndex((t) => !t.disabled), o = H(
30
30
  r.items,
package/dist/index75.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as j, ref as g, watch as x, computed as m, openBlock as V, createBlock as G, resolveDynamicComponent as K, normalizeClass as O, withCtx as M, createElementVNode as c, withModifiers as y, renderSlot as U, normalizeProps as Y, guardReactiveProps as Z, createTextVNode as J, unref as Q, createVNode as W, createElementBlock as F, Fragment as X, renderList as ee, toDisplayString as te } from "vue";
2
- import { findInTree as ae } from "./index247.js";
2
+ import { findInTree as ae } from "./index269.js";
3
3
  import { useId as re } from "./index8.js";
4
4
  import oe from "./index123.js";
5
5
  /* empty css */
@@ -56,7 +56,7 @@ const le = ["accept", "autofocus", "disabled", "multiple"], se = {
56
56
  const r = t.accept[a];
57
57
  if (r.includes("/")) e.push(r);
58
58
  else {
59
- b || (b = (await import("./index246.js")).default);
59
+ b || (b = (await import("./index268.js")).default);
60
60
  const o = b.getType(r);
61
61
  if (!o)
62
62
  throw new Error(
package/dist/index77.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as h, ref as t, onMounted as m, onBeforeUnmount as p, openBlock as g, createBlock as b, resolveDynamicComponent as w, withCtx as _, renderSlot as I } from "vue";
2
- import { throttle as c } from "./index205.js";
2
+ import { throttle as c } from "./index217.js";
3
3
  const M = /* @__PURE__ */ h({
4
4
  __name: "BbIntersection",
5
5
  props: {
package/dist/index80.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { defineComponent as te, ref as s, useAttrs as oe, getCurrentInstance as se, computed as v, nextTick as ae, onBeforeUnmount as x, onMounted as le, watch as ne, openBlock as _, createBlock as ie, Teleport as re, createElementVNode as a, mergeProps as O, createElementBlock as V, renderSlot as n, createTextVNode as ue, toDisplayString as S, createCommentVNode as z } from "vue";
2
- import { useFocusTrap as ce } from "./index206.js";
2
+ import { useFocusTrap as ce } from "./index218.js";
3
3
  import { useId as A } from "./index8.js";
4
4
  import { wait as E } from "./index127.js";
5
- import { useModalsState as p } from "./index208.js";
5
+ import { useModalsState as p } from "./index220.js";
6
6
  const de = ["inert"], fe = { class: "bb-offcanvas-close" }, ve = ["aria-label"], pe = /* @__PURE__ */ a("span", { class: "bb-offcanvas-close__icon" }, [
7
7
  /* @__PURE__ */ a("svg", {
8
8
  "aria-hidden": "true",
package/dist/index82.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as A, computed as f, ref as c, onMounted as E, onBeforeUnmount as P, openBlock as h, createElementBlock as y, normalizeClass as C, createElementVNode as i, createVNode as k, unref as V, withCtx as S, renderSlot as v, Fragment as W, renderList as R, toDisplayString as M, nextTick as $ } from "vue";
2
- import { debounce as F } from "./index248.js";
2
+ import { debounce as F } from "./index273.js";
3
3
  /* empty css */
4
4
  /* empty css */
5
5
  import w from "./index13.js";
package/dist/index84.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { defineComponent as F, defineAsyncComponent as S, ref as n, computed as w, openBlock as v, createElementBlock as H, mergeProps as q, createElementVNode as c, renderSlot as k, normalizeProps as A, guardReactiveProps as I, createBlock as y, unref as V, withCtx as _, createCommentVNode as C, nextTick as W } from "vue";
2
- import { useFocusTrap as z } from "./index206.js";
2
+ import { useFocusTrap as z } from "./index218.js";
3
3
  import { useId as R } from "./index8.js";
4
4
  import { useIntersectionObserver as j } from "./index128.js";
5
- import { waitFor as G } from "./index207.js";
5
+ import { waitFor as G } from "./index219.js";
6
6
  import J from "./index13.js";
7
7
  /* empty css */
8
8
  const K = /* @__PURE__ */ c("span", { class: "bb-popover__close-label sr-only" }, "Chiudi", -1), Q = /* @__PURE__ */ c("svg", {
@@ -35,7 +35,7 @@ const K = /* @__PURE__ */ c("span", { class: "bb-popover__close-label sr-only" }
35
35
  emits: ["shown", "hidden"],
36
36
  setup($, { emit: T }) {
37
37
  const B = S(
38
- () => import("./index243.js")
38
+ () => import("./index270.js")
39
39
  ), t = $, s = T, { id: P } = R(), p = `bbp_${P.value}`, r = n(), i = n(), { activate: N, deactivate: D } = z(i, {
40
40
  /**
41
41
  * This traps all clicks outside so we are pressing
package/dist/index86.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as r, computed as a, openBlock as l, createElementBlock as s, normalizeClass as m, createElementVNode as n, normalizeStyle as c } from "vue";
2
- import { clamp as p } from "./index199.js";
2
+ import { clamp as p } from "./index198.js";
3
3
  import { getAsPercentageBetween as i } from "./index126.js";
4
4
  const _ = /* @__PURE__ */ r({
5
5
  __name: "BbProgress",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bitboss-ui",
3
- "version": "2.0.31",
3
+ "version": "2.0.32",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "scripts": {
package/dist/index216.js DELETED
@@ -1,4 +0,0 @@
1
- const e = (t) => t[t.length - 1];
2
- export {
3
- e as last
4
- };
package/dist/index226.js DELETED
@@ -1,45 +0,0 @@
1
- import { defineComponent as m, openBlock as o, createElementBlock as a, renderSlot as e, createElementVNode as r, createBlock as t, unref as p, createCommentVNode as i, createVNode as s } from "vue";
2
- /* empty css */
3
- /* empty css */
4
- import c from "./index122.js";
5
- /* empty css */
6
- import l from "./index124.js";
7
- /* empty css */
8
- import d from "./index300.js";
9
- const u = { class: "bb-common-input-inner-container" }, f = { class: "bb-common-input-inner-container__prefix" }, _ = { class: "bb-common-input-inner-container__suffix" }, V = /* @__PURE__ */ m({
10
- __name: "CommonInputInnerContainer",
11
- props: {
12
- "append:icon": {},
13
- "prepend:icon": {}
14
- },
15
- setup($) {
16
- return (n, b) => (o(), a("span", u, [
17
- e(n.$slots, "prepend", {}, () => [
18
- r("span", f, [
19
- e(n.$slots, "prefix")
20
- ])
21
- ]),
22
- n.$props["prepend:icon"] ? (o(), t(p(c), {
23
- key: 0,
24
- class: "bb-common-input-inner-container__prepend-icon",
25
- type: n.$props["prepend:icon"]
26
- }, null, 8, ["type"])) : i("", !0),
27
- e(n.$slots, "default"),
28
- n.$props["append:icon"] ? (o(), t(p(c), {
29
- key: 1,
30
- class: "bb-common-input-inner-container__append-icon",
31
- type: n.$props["append:icon"]
32
- }, null, 8, ["type"])) : i("", !0),
33
- s(p(l)),
34
- s(d),
35
- e(n.$slots, "append", {}, () => [
36
- r("span", _, [
37
- e(n.$slots, "suffix")
38
- ])
39
- ])
40
- ]));
41
- }
42
- });
43
- export {
44
- V as default
45
- };
package/dist/index240.js DELETED
@@ -1,4 +0,0 @@
1
- const o = (e) => e[0];
2
- export {
3
- o as head
4
- };
package/dist/index280.js DELETED
@@ -1,14 +0,0 @@
1
- import { ref as t } from "vue";
2
- const n = () => {
3
- const e = t([]);
4
- return { array: e, set: (...r) => {
5
- e.value = r;
6
- }, add: (...r) => {
7
- e.value.push(...r);
8
- }, remove: (r) => {
9
- e.value = e.value.filter(r);
10
- } };
11
- };
12
- export {
13
- n as useArray
14
- };
package/dist/index303.js DELETED
@@ -1,423 +0,0 @@
1
- import { debounce as C, memo as f, notUndefined as b, approxEqual as y } from "./index304.js";
2
- const T = (r) => r, _ = (r) => {
3
- const h = Math.max(r.startIndex - r.overscan, 0), e = Math.min(r.endIndex + r.overscan, r.count - 1), s = [];
4
- for (let t = h; t <= e; t++)
5
- s.push(t);
6
- return s;
7
- }, A = (r, h) => {
8
- const e = r.scrollElement;
9
- if (!e)
10
- return;
11
- const s = r.targetWindow;
12
- if (!s)
13
- return;
14
- const t = (n) => {
15
- const { width: o, height: l } = n;
16
- h({ width: Math.round(o), height: Math.round(l) });
17
- };
18
- if (t(e.getBoundingClientRect()), !s.ResizeObserver)
19
- return () => {
20
- };
21
- const i = new s.ResizeObserver((n) => {
22
- const o = n[0];
23
- if (o != null && o.borderBoxSize) {
24
- const l = o.borderBoxSize[0];
25
- if (l) {
26
- t({ width: l.inlineSize, height: l.blockSize });
27
- return;
28
- }
29
- }
30
- t(e.getBoundingClientRect());
31
- });
32
- return i.observe(e, { box: "border-box" }), () => {
33
- i.unobserve(e);
34
- };
35
- }, M = {
36
- passive: !0
37
- }, R = typeof window > "u" ? !0 : "onscrollend" in window, F = (r, h) => {
38
- const e = r.scrollElement;
39
- if (!e)
40
- return;
41
- const s = r.targetWindow;
42
- if (!s)
43
- return;
44
- let t = 0;
45
- const i = R ? () => {
46
- } : C(
47
- s,
48
- () => {
49
- h(t, !1);
50
- },
51
- r.options.isScrollingResetDelay
52
- ), n = (c) => () => {
53
- t = e[r.options.horizontal ? "scrollLeft" : "scrollTop"], i(), h(t, c);
54
- }, o = n(!0), l = n(!1);
55
- return l(), e.addEventListener("scroll", o, M), e.addEventListener("scrollend", l, M), () => {
56
- e.removeEventListener("scroll", o), e.removeEventListener("scrollend", l);
57
- };
58
- }, k = (r, h, e) => {
59
- if (h != null && h.borderBoxSize) {
60
- const s = h.borderBoxSize[0];
61
- if (s)
62
- return Math.round(
63
- s[e.options.horizontal ? "inlineSize" : "blockSize"]
64
- );
65
- }
66
- return Math.round(
67
- r.getBoundingClientRect()[e.options.horizontal ? "width" : "height"]
68
- );
69
- }, N = (r, {
70
- adjustments: h = 0,
71
- behavior: e
72
- }, s) => {
73
- var t, i;
74
- const n = r + h;
75
- (i = (t = s.scrollElement) == null ? void 0 : t.scrollTo) == null || i.call(t, {
76
- [s.options.horizontal ? "left" : "top"]: n,
77
- behavior: e
78
- });
79
- };
80
- class j {
81
- constructor(h) {
82
- this.unsubs = [], this.scrollElement = null, this.targetWindow = null, this.isScrolling = !1, this.scrollToIndexTimeoutId = null, this.measurementsCache = [], this.itemSizeCache = /* @__PURE__ */ new Map(), this.pendingMeasuredCacheIndexes = [], this.scrollRect = null, this.scrollOffset = null, this.scrollDirection = null, this.scrollAdjustments = 0, this.elementsCache = /* @__PURE__ */ new Map(), this.observer = /* @__PURE__ */ (() => {
83
- let e = null;
84
- const s = () => e || (!this.targetWindow || !this.targetWindow.ResizeObserver ? null : e = new this.targetWindow.ResizeObserver((t) => {
85
- t.forEach((i) => {
86
- this._measureElement(i.target, i);
87
- });
88
- }));
89
- return {
90
- disconnect: () => {
91
- var t;
92
- return (t = s()) == null ? void 0 : t.disconnect();
93
- },
94
- observe: (t) => {
95
- var i;
96
- return (i = s()) == null ? void 0 : i.observe(t, { box: "border-box" });
97
- },
98
- unobserve: (t) => {
99
- var i;
100
- return (i = s()) == null ? void 0 : i.unobserve(t);
101
- }
102
- };
103
- })(), this.range = null, this.setOptions = (e) => {
104
- Object.entries(e).forEach(([s, t]) => {
105
- typeof t > "u" && delete e[s];
106
- }), this.options = {
107
- debug: !1,
108
- initialOffset: 0,
109
- overscan: 1,
110
- paddingStart: 0,
111
- paddingEnd: 0,
112
- scrollPaddingStart: 0,
113
- scrollPaddingEnd: 0,
114
- horizontal: !1,
115
- getItemKey: T,
116
- rangeExtractor: _,
117
- onChange: () => {
118
- },
119
- measureElement: k,
120
- initialRect: { width: 0, height: 0 },
121
- scrollMargin: 0,
122
- gap: 0,
123
- indexAttribute: "data-index",
124
- initialMeasurementsCache: [],
125
- lanes: 1,
126
- isScrollingResetDelay: 150,
127
- enabled: !0,
128
- ...e
129
- };
130
- }, this.notify = (e, s) => {
131
- var t, i;
132
- const { startIndex: n, endIndex: o } = this.range ?? {
133
- startIndex: void 0,
134
- endIndex: void 0
135
- }, l = this.calculateRange();
136
- (e || n !== (l == null ? void 0 : l.startIndex) || o !== (l == null ? void 0 : l.endIndex)) && ((i = (t = this.options).onChange) == null || i.call(t, this, s));
137
- }, this.cleanup = () => {
138
- this.unsubs.filter(Boolean).forEach((e) => e()), this.unsubs = [], this.scrollElement = null, this.targetWindow = null, this.observer.disconnect(), this.elementsCache.clear();
139
- }, this._didMount = () => () => {
140
- this.cleanup();
141
- }, this._willUpdate = () => {
142
- var e;
143
- const s = this.options.enabled ? this.options.getScrollElement() : null;
144
- if (this.scrollElement !== s) {
145
- if (this.cleanup(), !s) {
146
- this.notify(!1, !1);
147
- return;
148
- }
149
- this.scrollElement = s, this.scrollElement && "ownerDocument" in this.scrollElement ? this.targetWindow = this.scrollElement.ownerDocument.defaultView : this.targetWindow = ((e = this.scrollElement) == null ? void 0 : e.window) ?? null, this._scrollToOffset(this.getScrollOffset(), {
150
- adjustments: void 0,
151
- behavior: void 0
152
- }), this.unsubs.push(
153
- this.options.observeElementRect(this, (t) => {
154
- this.scrollRect = t, this.notify(!1, !1);
155
- })
156
- ), this.unsubs.push(
157
- this.options.observeElementOffset(this, (t, i) => {
158
- this.scrollAdjustments = 0, this.scrollDirection = i ? this.getScrollOffset() < t ? "forward" : "backward" : null, this.scrollOffset = t;
159
- const n = this.isScrolling;
160
- this.isScrolling = i, this.notify(n !== i, i);
161
- })
162
- );
163
- }
164
- }, this.getSize = () => this.options.enabled ? (this.scrollRect = this.scrollRect ?? this.options.initialRect, this.scrollRect[this.options.horizontal ? "width" : "height"]) : (this.scrollRect = null, 0), this.getScrollOffset = () => this.options.enabled ? (this.scrollOffset = this.scrollOffset ?? (typeof this.options.initialOffset == "function" ? this.options.initialOffset() : this.options.initialOffset), this.scrollOffset) : (this.scrollOffset = null, 0), this.getFurthestMeasurement = (e, s) => {
165
- const t = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
166
- for (let n = s - 1; n >= 0; n--) {
167
- const o = e[n];
168
- if (t.has(o.lane))
169
- continue;
170
- const l = i.get(
171
- o.lane
172
- );
173
- if (l == null || o.end > l.end ? i.set(o.lane, o) : o.end < l.end && t.set(o.lane, !0), t.size === this.options.lanes)
174
- break;
175
- }
176
- return i.size === this.options.lanes ? Array.from(i.values()).sort((n, o) => n.end === o.end ? n.index - o.index : n.end - o.end)[0] : void 0;
177
- }, this.getMeasurementOptions = f(
178
- () => [
179
- this.options.count,
180
- this.options.paddingStart,
181
- this.options.scrollMargin,
182
- this.options.getItemKey,
183
- this.options.enabled
184
- ],
185
- (e, s, t, i, n) => (this.pendingMeasuredCacheIndexes = [], {
186
- count: e,
187
- paddingStart: s,
188
- scrollMargin: t,
189
- getItemKey: i,
190
- enabled: n
191
- }),
192
- {
193
- key: !1
194
- }
195
- ), this.getMeasurements = f(
196
- () => [this.getMeasurementOptions(), this.itemSizeCache],
197
- ({ count: e, paddingStart: s, scrollMargin: t, getItemKey: i, enabled: n }, o) => {
198
- var l;
199
- if (!n)
200
- return this.measurementsCache = [], this.itemSizeCache.clear(), [];
201
- this.measurementsCache.length === 0 && (this.measurementsCache = this.options.initialMeasurementsCache, this.measurementsCache.forEach((a) => {
202
- this.itemSizeCache.set(a.key, a.size);
203
- }));
204
- const c = this.pendingMeasuredCacheIndexes.length > 0 ? Math.min(...this.pendingMeasuredCacheIndexes) : 0;
205
- this.pendingMeasuredCacheIndexes = [];
206
- const d = this.measurementsCache.slice(0, c);
207
- for (let a = c; a < e; a++) {
208
- let p = (l = this.measurementsCache[a]) == null ? void 0 : l.measureElement;
209
- p || (p = (u) => {
210
- const v = i(a), m = this.elementsCache.get(v);
211
- if (!u) {
212
- m && (this.observer.unobserve(m), this.elementsCache.delete(v));
213
- return;
214
- }
215
- m !== u && (m && this.observer.unobserve(m), this.observer.observe(u), this.elementsCache.set(v, u)), u.isConnected && this.resizeItem(
216
- a,
217
- this.options.measureElement(u, void 0, this)
218
- );
219
- });
220
- const x = i(a), g = this.options.lanes === 1 ? d[a - 1] : this.getFurthestMeasurement(d, a), E = g ? g.end + this.options.gap : s + t, I = o.get(x), S = typeof I == "number" ? I : this.options.estimateSize(a), O = E + S, w = g ? g.lane : a % this.options.lanes;
221
- d[a] = {
222
- index: a,
223
- start: E,
224
- size: S,
225
- end: O,
226
- key: x,
227
- lane: w,
228
- measureElement: p
229
- };
230
- }
231
- return this.measurementsCache = d, d;
232
- },
233
- {
234
- key: process.env.NODE_ENV !== "production" && "getMeasurements",
235
- debug: () => this.options.debug
236
- }
237
- ), this.calculateRange = f(
238
- () => [this.getMeasurements(), this.getSize(), this.getScrollOffset()],
239
- (e, s, t) => this.range = e.length > 0 && s > 0 ? D({
240
- measurements: e,
241
- outerSize: s,
242
- scrollOffset: t
243
- }) : null,
244
- {
245
- key: process.env.NODE_ENV !== "production" && "calculateRange",
246
- debug: () => this.options.debug
247
- }
248
- ), this.getIndexes = f(
249
- () => [
250
- this.options.rangeExtractor,
251
- this.calculateRange(),
252
- this.options.overscan,
253
- this.options.count
254
- ],
255
- (e, s, t, i) => s === null ? [] : e({
256
- startIndex: s.startIndex,
257
- endIndex: s.endIndex,
258
- overscan: t,
259
- count: i
260
- }),
261
- {
262
- key: process.env.NODE_ENV !== "production" && "getIndexes",
263
- debug: () => this.options.debug
264
- }
265
- ), this.indexFromElement = (e) => {
266
- const s = this.options.indexAttribute, t = e.getAttribute(s);
267
- return t ? parseInt(t, 10) : (console.warn(
268
- `Missing attribute name '${s}={index}' on measured element.`
269
- ), -1);
270
- }, this._measureElement = (e, s) => {
271
- const t = this.indexFromElement(e), i = this.getMeasurements()[t];
272
- if (!i || !e.isConnected) {
273
- this.elementsCache.forEach((o, l) => {
274
- o === e && (this.observer.unobserve(e), this.elementsCache.delete(l));
275
- });
276
- return;
277
- }
278
- const n = this.elementsCache.get(i.key);
279
- n !== e && (n && this.observer.unobserve(n), this.observer.observe(e), this.elementsCache.set(i.key, e)), this.resizeItem(t, this.options.measureElement(e, s, this));
280
- }, this.resizeItem = (e, s) => {
281
- const t = this.getMeasurements()[e];
282
- if (!t)
283
- return;
284
- const i = this.itemSizeCache.get(t.key) ?? t.size, n = s - i;
285
- n !== 0 && ((this.shouldAdjustScrollPositionOnItemSizeChange !== void 0 ? this.shouldAdjustScrollPositionOnItemSizeChange(t, n, this) : t.start < this.getScrollOffset() + this.scrollAdjustments) && (process.env.NODE_ENV !== "production" && this.options.debug && console.info("correction", n), this._scrollToOffset(this.getScrollOffset(), {
286
- adjustments: this.scrollAdjustments += n,
287
- behavior: void 0
288
- })), this.pendingMeasuredCacheIndexes.push(t.index), this.itemSizeCache = new Map(this.itemSizeCache.set(t.key, s)), this.notify(!0, !1));
289
- }, this.measureElement = (e) => {
290
- e && this._measureElement(e, void 0);
291
- }, this.getVirtualItems = f(
292
- () => [this.getIndexes(), this.getMeasurements()],
293
- (e, s) => {
294
- const t = [];
295
- for (let i = 0, n = e.length; i < n; i++) {
296
- const o = e[i], l = s[o];
297
- t.push(l);
298
- }
299
- return t;
300
- },
301
- {
302
- key: process.env.NODE_ENV !== "production" && "getIndexes",
303
- debug: () => this.options.debug
304
- }
305
- ), this.getVirtualItemForOffset = (e) => {
306
- const s = this.getMeasurements();
307
- if (s.length !== 0)
308
- return b(
309
- s[z(
310
- 0,
311
- s.length - 1,
312
- (t) => b(s[t]).start,
313
- e
314
- )]
315
- );
316
- }, this.getOffsetForAlignment = (e, s) => {
317
- const t = this.getSize(), i = this.getScrollOffset();
318
- s === "auto" && (e <= i ? s = "start" : e >= i + t ? s = "end" : s = "start"), s === "start" ? e = e : s === "end" ? e = e - t : s === "center" && (e = e - t / 2);
319
- const n = this.options.horizontal ? "scrollWidth" : "scrollHeight", l = (this.scrollElement ? "document" in this.scrollElement ? this.scrollElement.document.documentElement[n] : this.scrollElement[n] : 0) - t;
320
- return Math.max(Math.min(l, e), 0);
321
- }, this.getOffsetForIndex = (e, s = "auto") => {
322
- e = Math.max(0, Math.min(e, this.options.count - 1));
323
- const t = this.getMeasurements()[e];
324
- if (!t)
325
- return;
326
- const i = this.getSize(), n = this.getScrollOffset();
327
- if (s === "auto")
328
- if (t.end >= n + i - this.options.scrollPaddingEnd)
329
- s = "end";
330
- else if (t.start <= n + this.options.scrollPaddingStart)
331
- s = "start";
332
- else
333
- return [n, s];
334
- const o = s === "end" ? t.end + this.options.scrollPaddingEnd : t.start - this.options.scrollPaddingStart;
335
- return [this.getOffsetForAlignment(o, s), s];
336
- }, this.isDynamicMode = () => this.elementsCache.size > 0, this.cancelScrollToIndex = () => {
337
- this.scrollToIndexTimeoutId !== null && this.targetWindow && (this.targetWindow.clearTimeout(this.scrollToIndexTimeoutId), this.scrollToIndexTimeoutId = null);
338
- }, this.scrollToOffset = (e, { align: s = "start", behavior: t } = {}) => {
339
- this.cancelScrollToIndex(), t === "smooth" && this.isDynamicMode() && console.warn(
340
- "The `smooth` scroll behavior is not fully supported with dynamic size."
341
- ), this._scrollToOffset(this.getOffsetForAlignment(e, s), {
342
- adjustments: void 0,
343
- behavior: t
344
- });
345
- }, this.scrollToIndex = (e, { align: s = "auto", behavior: t } = {}) => {
346
- e = Math.max(0, Math.min(e, this.options.count - 1)), this.cancelScrollToIndex(), t === "smooth" && this.isDynamicMode() && console.warn(
347
- "The `smooth` scroll behavior is not fully supported with dynamic size."
348
- );
349
- const i = this.getOffsetForIndex(e, s);
350
- if (!i) return;
351
- const [n, o] = i;
352
- this._scrollToOffset(n, { adjustments: void 0, behavior: t }), t !== "smooth" && this.isDynamicMode() && this.targetWindow && (this.scrollToIndexTimeoutId = this.targetWindow.setTimeout(() => {
353
- if (this.scrollToIndexTimeoutId = null, this.elementsCache.has(
354
- this.options.getItemKey(e)
355
- )) {
356
- const [c] = b(
357
- this.getOffsetForIndex(e, o)
358
- );
359
- y(c, this.getScrollOffset()) || this.scrollToIndex(e, { align: o, behavior: t });
360
- } else
361
- this.scrollToIndex(e, { align: o, behavior: t });
362
- }));
363
- }, this.scrollBy = (e, { behavior: s } = {}) => {
364
- this.cancelScrollToIndex(), s === "smooth" && this.isDynamicMode() && console.warn(
365
- "The `smooth` scroll behavior is not fully supported with dynamic size."
366
- ), this._scrollToOffset(this.getScrollOffset() + e, {
367
- adjustments: void 0,
368
- behavior: s
369
- });
370
- }, this.getTotalSize = () => {
371
- var e;
372
- const s = this.getMeasurements();
373
- let t;
374
- return s.length === 0 ? t = this.options.paddingStart : t = this.options.lanes === 1 ? ((e = s[s.length - 1]) == null ? void 0 : e.end) ?? 0 : Math.max(
375
- ...s.slice(-this.options.lanes).map((i) => i.end)
376
- ), t - this.options.scrollMargin + this.options.paddingEnd;
377
- }, this._scrollToOffset = (e, {
378
- adjustments: s,
379
- behavior: t
380
- }) => {
381
- this.options.scrollToFn(e, { behavior: t, adjustments: s }, this);
382
- }, this.measure = () => {
383
- var e, s;
384
- this.itemSizeCache = /* @__PURE__ */ new Map(), (s = (e = this.options).onChange) == null || s.call(e, this, !1);
385
- }, this.setOptions(h);
386
- }
387
- }
388
- const z = (r, h, e, s) => {
389
- for (; r <= h; ) {
390
- const t = (r + h) / 2 | 0, i = e(t);
391
- if (i < s)
392
- r = t + 1;
393
- else if (i > s)
394
- h = t - 1;
395
- else
396
- return t;
397
- }
398
- return r > 0 ? r - 1 : 0;
399
- };
400
- function D({
401
- measurements: r,
402
- outerSize: h,
403
- scrollOffset: e
404
- }) {
405
- const s = r.length - 1, i = z(0, s, (o) => r[o].start, e);
406
- let n = i;
407
- for (; n < s && r[n].end < e + h; )
408
- n++;
409
- return { startIndex: i, endIndex: n };
410
- }
411
- export {
412
- j as Virtualizer,
413
- y as approxEqual,
414
- C as debounce,
415
- T as defaultKeyExtractor,
416
- _ as defaultRangeExtractor,
417
- N as elementScroll,
418
- k as measureElement,
419
- f as memo,
420
- b as notUndefined,
421
- F as observeElementOffset,
422
- A as observeElementRect
423
- };
File without changes
File without changes