bitboss-ui 2.0.29 → 2.0.30

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 (131) hide show
  1. package/dist/index104.js +68 -61
  2. package/dist/index106.js +4 -4
  3. package/dist/index114.js +1 -1
  4. package/dist/index116.js +4 -4
  5. package/dist/index118.js +1 -1
  6. package/dist/index121.js +4 -4
  7. package/dist/index122.js +1 -1
  8. package/dist/index124.js +1 -1
  9. package/dist/index126.js +1 -1
  10. package/dist/index128.js +2 -2
  11. package/dist/index129.js +1 -1
  12. package/dist/index13.js +1 -1
  13. package/dist/index15.js +3 -3
  14. package/dist/index19.js +14 -14
  15. package/dist/index198.js +7 -80
  16. package/dist/index199.js +2 -281
  17. package/dist/index200.js +4 -16
  18. package/dist/index201.js +2 -16
  19. package/dist/index202.js +124 -17
  20. package/dist/index203.js +5 -19
  21. package/dist/index204.js +119 -23
  22. package/dist/index205.js +19 -3
  23. package/dist/index206.js +16 -2
  24. package/dist/index207.js +16 -8
  25. package/dist/index208.js +2 -249
  26. package/dist/index209.js +2 -52
  27. package/dist/index21.js +15 -15
  28. package/dist/index210.js +35 -44
  29. package/dist/index211.js +174 -5
  30. package/dist/index212.js +5 -48
  31. package/dist/index213.js +43 -2
  32. package/dist/index215.js +13 -2
  33. package/dist/index216.js +5 -3
  34. package/dist/index217.js +369 -2
  35. package/dist/index218.js +72 -117
  36. package/dist/index219.js +2 -123
  37. package/dist/index220.js +19 -2
  38. package/dist/index221.js +26 -34
  39. package/dist/index222.js +3 -174
  40. package/dist/index223.js +248 -5
  41. package/dist/index224.js +46 -37
  42. package/dist/index225.js +46 -0
  43. package/dist/index226.js +4 -12
  44. package/dist/index227.js +49 -5
  45. package/dist/index228.js +3 -369
  46. package/dist/index229.js +1 -1
  47. package/dist/index23.js +3 -3
  48. package/dist/index231.js +7 -7
  49. package/dist/index234.js +1 -1
  50. package/dist/index236.js +1 -1
  51. package/dist/index238.js +1 -1
  52. package/dist/index243.js +3 -4
  53. package/dist/index244.js +4 -6
  54. package/dist/index245.js +6 -2
  55. package/dist/index246.js +16 -2
  56. package/dist/index247.js +9 -2
  57. package/dist/index248.js +23 -2
  58. package/dist/index249.js +9 -2
  59. package/dist/index25.js +1 -1
  60. package/dist/index250.js +281 -2
  61. package/dist/index251.js +6 -2
  62. package/dist/index252.js +2 -2
  63. package/dist/index253.js +2 -2
  64. package/dist/index254.js +2 -2
  65. package/dist/index255.js +2 -28
  66. package/dist/index256.js +2 -22
  67. package/dist/index257.js +128 -0
  68. package/dist/index258.js +429 -5
  69. package/dist/index259.js +3 -6
  70. package/dist/index261.js +7 -224
  71. package/dist/index262.js +22 -3
  72. package/dist/index264.js +2 -23
  73. package/dist/index265.js +2 -9
  74. package/dist/index266.js +2 -2
  75. package/dist/index267.js +2 -126
  76. package/dist/index268.js +2 -431
  77. package/dist/index269.js +2 -3
  78. package/dist/index27.js +3 -3
  79. package/dist/index270.js +30 -0
  80. package/dist/index271.js +6 -6
  81. package/dist/index273.js +218 -83
  82. package/dist/index274.js +436 -3
  83. package/dist/index275.js +126 -11
  84. package/dist/index276.js +199 -8
  85. package/dist/index277.js +89 -9
  86. package/dist/index278.js +3 -17
  87. package/dist/index279.js +11 -435
  88. package/dist/index280.js +7 -125
  89. package/dist/index281.js +8 -199
  90. package/dist/index282.js +17 -3
  91. package/dist/index283.js +5 -3
  92. package/dist/index284.js +2 -211
  93. package/dist/index285.js +66 -2
  94. package/dist/index286.js +3 -5
  95. package/dist/index287.js +3 -15
  96. package/dist/index288.js +205 -60
  97. package/dist/index289.js +14 -6
  98. package/dist/index29.js +2 -2
  99. package/dist/index290.js +79 -7
  100. package/dist/index295.js +35 -79
  101. package/dist/index296.js +9 -0
  102. package/dist/index297.js +18 -34
  103. package/dist/index298.js +6 -46
  104. package/dist/index299.js +46 -10
  105. package/dist/index300.js +1 -1
  106. package/dist/index301.js +10 -479
  107. package/dist/index302.js +482 -0
  108. package/dist/index304.js +416 -42
  109. package/dist/index305.js +47 -2
  110. package/dist/index306.js +4 -0
  111. package/dist/index33.js +3 -3
  112. package/dist/index35.js +8 -8
  113. package/dist/index37.js +3 -3
  114. package/dist/index39.js +2 -2
  115. package/dist/index43.js +3 -3
  116. package/dist/index45.js +2 -2
  117. package/dist/index47.js +2 -2
  118. package/dist/index53.js +1 -1
  119. package/dist/index55.js +1 -1
  120. package/dist/index71.js +3 -3
  121. package/dist/index75.js +2 -2
  122. package/dist/index80.js +1 -1
  123. package/dist/index82.js +1 -1
  124. package/dist/index84.js +3 -3
  125. package/dist/index86.js +1 -1
  126. package/package.json +1 -1
  127. package/dist/index214.js +0 -6
  128. package/dist/index260.js +0 -18
  129. package/dist/index263.js +0 -11
  130. package/dist/index291.js +0 -21
  131. package/dist/index303.js +0 -423
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 "./index263.js";
2
+ import { findRightIndex as H } from "./index247.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 "./index264.js";
8
+ import N from "./index248.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("./index262.js")
27
+ () => import("./index243.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 "./index260.js";
2
+ import { findInTree as ae } from "./index246.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("./index259.js")).default);
59
+ b || (b = (await import("./index245.js")).default);
60
60
  const o = b.getType(r);
61
61
  if (!o)
62
62
  throw new Error(
package/dist/index80.js CHANGED
@@ -1,5 +1,5 @@
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 "./index221.js";
2
+ import { useFocusTrap as ce } from "./index210.js";
3
3
  import { useId as A } from "./index8.js";
4
4
  import { wait as E } from "./index127.js";
5
5
  import { useModalsState as p } from "./index230.js";
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 "./index265.js";
2
+ import { debounce as F } from "./index249.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 "./index221.js";
2
+ import { useFocusTrap as z } from "./index210.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 "./index223.js";
5
+ import { waitFor as G } from "./index212.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("./index262.js")
38
+ () => import("./index243.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 "./index215.js";
2
+ import { clamp as p } from "./index219.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.29",
3
+ "version": "2.0.30",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "scripts": {
package/dist/index214.js DELETED
@@ -1,6 +0,0 @@
1
- import { curry as e } from "./index243.js";
2
- const t = (n, o, r) => n(r) ? o(r) : r, s = e(t);
3
- export {
4
- t as baseWhen,
5
- s as when
6
- };
package/dist/index260.js DELETED
@@ -1,18 +0,0 @@
1
- const e = (o, r, f) => o.reduce((t, n) => {
2
- if (t) return t;
3
- if (f(n))
4
- return n;
5
- if (r in n) {
6
- const i = e(
7
- [].concat(n[r]),
8
- r,
9
- f
10
- );
11
- if (i)
12
- return i;
13
- }
14
- return t;
15
- }, null);
16
- export {
17
- e as findInTree
18
- };
package/dist/index263.js DELETED
@@ -1,11 +0,0 @@
1
- const o = (n, t) => {
2
- for (let e = n.length - 1; e >= 0; e--) {
3
- const i = n[e];
4
- if (t(i, e, n))
5
- return e;
6
- }
7
- return -1;
8
- };
9
- export {
10
- o as findRightIndex
11
- };
package/dist/index291.js DELETED
@@ -1,21 +0,0 @@
1
- function l(t, ...e) {
2
- if (t.length) {
3
- const o = t[0];
4
- if (typeof o == "string") return [...t].sort(r);
5
- if (typeof o == "number") return [...t].sort(r);
6
- if (e && e.length)
7
- return [...t].sort((f, u) => {
8
- for (let n = 0; n < e.length; n++) {
9
- const i = e[n], s = r(f[i], u[i]);
10
- if (s) return s;
11
- }
12
- return 0;
13
- });
14
- throw new Error("Invalid comparison");
15
- }
16
- return t;
17
- }
18
- const r = (t, e) => t < e ? -1 : t > e ? 1 : 0;
19
- export {
20
- l as sort
21
- };
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
- };