@pgcorp/ui-kit 0.10.2 → 0.12.0
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.
- package/README.md +185 -11
- package/dist/assets/src/components/shared/_internal/{SDialogSurface.css_vue_type_style_index_0_src_979bf586_scoped_979bf586_lang.css → SDialogSurface.css_vue_type_style_index_0_src_d1b65adf_scoped_d1b65adf_lang.css} +1 -1
- package/dist/assets/src/components/shared/containers/SDrawer.css_vue_type_style_index_0_src_091d7325_scoped_091d7325_lang.css +2 -0
- package/dist/assets/src/components/shared/containers/{SModal.css_vue_type_style_index_0_src_dc3c799e_scoped_dc3c799e_lang.css → SModal.css_vue_type_style_index_0_src_23373daf_scoped_23373daf_lang.css} +1 -1
- package/dist/assets/src/components/shared/controls/SButton.css_vue_type_style_index_0_src_a5d8f7e0_scoped_a5d8f7e0_lang.css +2 -0
- package/dist/assets/src/components/shared/controls/SChoiceCards.css_vue_type_style_index_0_src_af9fa9d1_scoped_af9fa9d1_lang.css +2 -0
- package/dist/assets/src/components/shared/controls/{SInputText.css_vue_type_style_index_0_src_6d42d245_scoped_6d42d245_lang.css → SInputText.css_vue_type_style_index_0_src_a9c5f1aa_scoped_a9c5f1aa_lang.css} +1 -1
- package/dist/assets/src/components/shared/data-display/{SCodeEditor.css_vue_type_style_index_0_src_124ca461_scoped_124ca461_lang.css → SCodeEditor.css_vue_type_style_index_0_src_3ad533d9_scoped_3ad533d9_lang.css} +1 -1
- package/dist/assets/src/components/shared/data-display/SStatus.css_vue_type_style_index_0_src_3ce41a12_scoped_3ce41a12_lang.css +2 -0
- package/dist/assets/src/components/shared/data-display/SVirtualList.css_vue_type_style_index_0_src_cee8c247_scoped_cee8c247_lang.css +2 -0
- package/dist/src/components/layout/SSideMenuButton.vue.d.ts +1 -1
- package/dist/src/components/shared/_internal/SDialogSurface.vue.d.ts +2 -1
- package/dist/src/components/shared/_internal/SDialogSurface.vue.js +2 -2
- package/dist/src/components/shared/_internal/SDialogSurface.vue_vue_type_script_setup_true_lang.js +37 -36
- package/dist/src/components/shared/_internal/dialogSurface.d.ts +3 -0
- package/dist/src/components/shared/_internal/dialogSurface.js +23 -19
- package/dist/src/components/shared/containers/SDrawer.vue.d.ts +5 -1
- package/dist/src/components/shared/containers/SDrawer.vue.js +2 -2
- package/dist/src/components/shared/containers/SDrawer.vue_vue_type_script_setup_true_lang.js +48 -44
- package/dist/src/components/shared/containers/SModal.vue.d.ts +5 -1
- package/dist/src/components/shared/containers/SModal.vue.js +2 -2
- package/dist/src/components/shared/containers/SModal.vue_vue_type_script_setup_true_lang.js +47 -41
- package/dist/src/components/shared/controls/SButton.vue.d.ts +3 -0
- package/dist/src/components/shared/controls/SButton.vue.js +2 -2
- package/dist/src/components/shared/controls/SButton.vue_vue_type_script_setup_true_lang.js +103 -99
- package/dist/src/components/shared/controls/SChoiceCards.vue.d.ts +1 -0
- package/dist/src/components/shared/controls/SChoiceCards.vue.js +2 -2
- package/dist/src/components/shared/controls/SChoiceCards.vue_vue_type_script_setup_true_lang.js +53 -49
- package/dist/src/components/shared/controls/SInputText.vue.d.ts +6 -0
- package/dist/src/components/shared/controls/SInputText.vue.js +2 -2
- package/dist/src/components/shared/controls/SInputText.vue_vue_type_script_setup_true_lang.js +117 -97
- package/dist/src/components/shared/controls/SMenuSurface.vue.d.ts +2 -2
- package/dist/src/components/shared/controls/STextarea.vue.d.ts +4 -0
- package/dist/src/components/shared/controls/STextarea.vue_vue_type_script_setup_true_lang.js +5 -1
- package/dist/src/components/shared/data-display/SCodeEditor.vue.d.ts +90 -7
- package/dist/src/components/shared/data-display/SCodeEditor.vue.js +2 -2
- package/dist/src/components/shared/data-display/SStatus.vue.d.ts +7 -0
- package/dist/src/components/shared/data-display/SStatus.vue.js +2 -2
- package/dist/src/components/shared/data-display/SStatus.vue_vue_type_script_setup_true_lang.js +28 -21
- package/dist/src/components/shared/data-display/SVirtualList.vue.d.ts +2 -0
- package/dist/src/components/shared/data-display/SVirtualList.vue.js +2 -2
- package/dist/src/components/shared/data-display/SVirtualList.vue_vue_type_script_setup_true_lang.js +317 -210
- package/dist/src/internal/useBinaryInput.js +3 -2
- package/docs/accessibility.md +10 -0
- package/docs/public-api.md +12 -0
- package/package.json +1 -1
- package/src/components/shared/controls/SButton.css +28 -0
- package/src/components/shared/controls/SChoiceCards.css +10 -3
- package/src/components/shared/data-display/SStatus.css +4 -0
- package/src/components/shared/data-display/SVirtualList.css +12 -0
- package/dist/assets/src/components/shared/containers/SDrawer.css_vue_type_style_index_0_src_d0cace23_scoped_d0cace23_lang.css +0 -2
- package/dist/assets/src/components/shared/controls/SButton.css_vue_type_style_index_0_src_52ad38b1_scoped_52ad38b1_lang.css +0 -2
- package/dist/assets/src/components/shared/controls/SChoiceCards.css_vue_type_style_index_0_src_627a8628_scoped_627a8628_lang.css +0 -2
- package/dist/assets/src/components/shared/data-display/SStatus.css_vue_type_style_index_0_src_c76fa058_scoped_c76fa058_lang.css +0 -2
- package/dist/assets/src/components/shared/data-display/SVirtualList.css_vue_type_style_index_0_src_1717877d_scoped_1717877d_lang.css +0 -2
package/dist/src/components/shared/data-display/SVirtualList.vue_vue_type_script_setup_true_lang.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { findFocusableOwner as e } from "../../../internal/focusNavigation.js";
|
|
2
|
+
import { useOwnedAttrs as t } from "../../../internal/ownedAttrs.js";
|
|
3
|
+
import { validateBoolean as n, validateBoundedNumber as r, validateExactString as i } from "../../../internal/runtimeContract.js";
|
|
4
|
+
import { useInteractiveLeafRegistration as a } from "../../../internal/passiveContentContract.js";
|
|
5
|
+
import { Fragment as o, computed as s, createCommentVNode as ee, createElementBlock as c, createElementVNode as te, defineComponent as l, mergeProps as ne, nextTick as u, normalizeStyle as re, onBeforeUnmount as ie, onMounted as ae, openBlock as d, ref as f, renderList as oe, renderSlot as se, unref as ce, watch as p } from "vue";
|
|
5
6
|
//#region src/components/shared/data-display/SVirtualList.vue?vue&type=script&setup=true&lang.ts
|
|
6
|
-
var
|
|
7
|
+
var le = [
|
|
7
8
|
"data-item-size",
|
|
8
9
|
"data-viewport-height",
|
|
9
10
|
"role",
|
|
@@ -11,13 +12,13 @@ var ce = [
|
|
|
11
12
|
"aria-live",
|
|
12
13
|
"aria-busy",
|
|
13
14
|
"aria-relevant"
|
|
14
|
-
],
|
|
15
|
+
], ue = [
|
|
15
16
|
"data-virtual-index",
|
|
16
17
|
"role",
|
|
17
18
|
"aria-label",
|
|
18
19
|
"aria-posinset",
|
|
19
20
|
"aria-setsize"
|
|
20
|
-
],
|
|
21
|
+
], de = /*@__PURE__*/ l({
|
|
21
22
|
inheritAttrs: !1,
|
|
22
23
|
__name: "SVirtualList",
|
|
23
24
|
props: {
|
|
@@ -47,27 +48,27 @@ var ce = [
|
|
|
47
48
|
"viewport-change",
|
|
48
49
|
"near-start"
|
|
49
50
|
],
|
|
50
|
-
setup(
|
|
51
|
-
let
|
|
51
|
+
setup(l, { expose: de, emit: fe }) {
|
|
52
|
+
let m = l, pe = fe, h = f(null), g = f(null), _ = f(null), me = t({
|
|
52
53
|
component: "SVirtualList",
|
|
53
54
|
owner: "virtual list viewport"
|
|
54
55
|
});
|
|
55
|
-
|
|
56
|
-
let
|
|
56
|
+
a({ owner: "SVirtualList" });
|
|
57
|
+
let v = f(0), y = f(0), b = f(/* @__PURE__ */ new Map()), x = f(0), S = f(0), C = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new Map(), T = /* @__PURE__ */ new Map(), E = null, D = null, O = null, k = !1, he = !1, ge = "", A = null, _e = 0, j = !1, M = !1, N = null, P = 0, ve = null, F = null, I = f(m.followTail), L = s(() => i("SVirtualList", "semanticRole", m.semanticRole, ["list", "log"])), ye = s(() => i("SVirtualList", "live", m.live, [
|
|
57
58
|
"off",
|
|
58
59
|
"polite",
|
|
59
60
|
"assertive"
|
|
60
|
-
])),
|
|
61
|
+
])), be = s(() => n("SVirtualList", "busy", m.busy)), xe = s(() => r("SVirtualList", "nearStartThreshold", m.nearStartThreshold, {
|
|
61
62
|
minimum: 0,
|
|
62
63
|
maximum: 1e4
|
|
63
|
-
})),
|
|
64
|
+
})), Se = s(() => r("SVirtualList", "endThreshold", m.endThreshold, {
|
|
64
65
|
minimum: 0,
|
|
65
66
|
maximum: 1e4
|
|
66
|
-
})),
|
|
67
|
-
function
|
|
67
|
+
})), R = s(() => m.externalScrollTarget !== null);
|
|
68
|
+
function z(e) {
|
|
68
69
|
return `${typeof e}:${JSON.stringify(e)}`;
|
|
69
70
|
}
|
|
70
|
-
function
|
|
71
|
+
function Ce(e, t) {
|
|
71
72
|
if (typeof e == "string") {
|
|
72
73
|
if (e.trim().length === 0) throw TypeError(`SVirtualList itemKey returned an empty string for item at index ${t}`);
|
|
73
74
|
return;
|
|
@@ -78,309 +79,415 @@ var ce = [
|
|
|
78
79
|
}
|
|
79
80
|
throw TypeError(`SVirtualList itemKey returned unsupported ${typeof e} key for item at index ${t}`);
|
|
80
81
|
}
|
|
81
|
-
function
|
|
82
|
-
return
|
|
82
|
+
function we(e, t) {
|
|
83
|
+
return m.itemLabel(e, t);
|
|
83
84
|
}
|
|
84
|
-
let
|
|
85
|
+
let B = s(() => {
|
|
85
86
|
let e = /* @__PURE__ */ new Set();
|
|
86
|
-
return
|
|
87
|
-
let r =
|
|
88
|
-
if (
|
|
87
|
+
return m.items.map((t, n) => {
|
|
88
|
+
let r = m.itemKey(t);
|
|
89
|
+
if (Ce(r, n), e.has(r)) throw TypeError(`SVirtualList itemKey returned duplicate key ${z(r)} at index ${n}`);
|
|
89
90
|
return e.add(r), r;
|
|
90
91
|
});
|
|
91
|
-
}),
|
|
92
|
-
let e = Array(
|
|
92
|
+
}), V = s(() => new Map(B.value.map((e, t) => [e, t]))), Te = s(() => B.value.map((e) => b.value.get(e) ?? m.itemSize)), H = s(() => {
|
|
93
|
+
let e = Array(m.items.length + 1);
|
|
93
94
|
e[0] = 0;
|
|
94
|
-
for (let t = 0; t <
|
|
95
|
+
for (let t = 0; t < m.items.length; t += 1) e[t + 1] = (e[t] ?? 0) + (Te.value[t] ?? m.itemSize);
|
|
95
96
|
return e;
|
|
96
|
-
}),
|
|
97
|
+
}), U = s(() => H.value[m.items.length] ?? 0), Ee = s(() => x.value + U.value + S.value), De = s(() => R.value ? {
|
|
97
98
|
position: "relative",
|
|
98
99
|
overflow: "visible",
|
|
99
|
-
height: `${
|
|
100
|
+
height: `${Ee.value}px`
|
|
100
101
|
} : {
|
|
101
102
|
position: "relative",
|
|
102
103
|
overflowY: "auto",
|
|
103
|
-
height: typeof
|
|
104
|
-
}),
|
|
105
|
-
function
|
|
106
|
-
let t = 0, n =
|
|
104
|
+
height: typeof m.height == "number" && m.height > 0 ? `${m.height}px` : "100%"
|
|
105
|
+
}), Oe = s(() => ({ height: `${Ee.value}px` })), ke = s(() => ({ top: `${x.value + U.value}px` }));
|
|
106
|
+
function Ae(e) {
|
|
107
|
+
let t = 0, n = m.items.length;
|
|
107
108
|
for (; t < n;) {
|
|
108
109
|
let r = Math.floor((t + n) / 2);
|
|
109
|
-
(
|
|
110
|
+
(H.value[r + 1] ?? U.value) <= e ? t = r + 1 : n = r;
|
|
110
111
|
}
|
|
111
|
-
return Math.min(t, Math.max(
|
|
112
|
+
return Math.min(t, Math.max(m.items.length - 1, 0));
|
|
112
113
|
}
|
|
113
|
-
let
|
|
114
|
-
let n =
|
|
114
|
+
let je = s(() => Math.max(0, v.value - x.value)), Me = s(() => Math.max(0, v.value + y.value - x.value)), Ne = s(() => m.items.length === 0 ? 0 : Ae(je.value)), Pe = s(() => m.items.length === 0 ? -1 : Ae(Me.value)), Fe = s(() => Math.max(0, Ne.value - m.overscan)), Ie = s(() => Math.min(m.items.length, Pe.value + m.overscan + 1)), Le = s(() => m.items.slice(Fe.value, Ie.value).map((e, t) => {
|
|
115
|
+
let n = Fe.value + t;
|
|
115
116
|
return {
|
|
116
117
|
item: e,
|
|
117
118
|
index: n,
|
|
118
|
-
key:
|
|
119
|
+
key: B.value[n]
|
|
119
120
|
};
|
|
120
121
|
}));
|
|
121
|
-
function
|
|
122
|
+
function Re(e) {
|
|
122
123
|
return {
|
|
123
124
|
position: "absolute",
|
|
124
|
-
top: `${
|
|
125
|
+
top: `${x.value + (H.value[e] ?? 0)}px`,
|
|
125
126
|
left: "0",
|
|
126
|
-
right: "0"
|
|
127
|
-
minHeight: `${p.itemSize}px`
|
|
127
|
+
right: "0"
|
|
128
128
|
};
|
|
129
129
|
}
|
|
130
|
-
function
|
|
131
|
-
let e =
|
|
130
|
+
function W() {
|
|
131
|
+
let e = m.externalScrollTarget, t = h.value;
|
|
132
132
|
return !e || !t ? 0 : t.getBoundingClientRect().top - e.getBoundingClientRect().top + e.scrollTop;
|
|
133
133
|
}
|
|
134
|
-
function
|
|
135
|
-
return
|
|
134
|
+
function G() {
|
|
135
|
+
return m.externalScrollTarget ?? h.value;
|
|
136
136
|
}
|
|
137
|
-
function
|
|
138
|
-
return Math.max(0,
|
|
137
|
+
function K() {
|
|
138
|
+
return Math.max(0, Ee.value - y.value);
|
|
139
139
|
}
|
|
140
|
-
function
|
|
140
|
+
function q(e = B.value) {
|
|
141
141
|
if (e.length === 0) return null;
|
|
142
|
-
let t = e.map((e) =>
|
|
143
|
-
for (; r < t.length - 1 && n + (t[r] ??
|
|
142
|
+
let t = e.map((e) => b.value.get(e) ?? m.itemSize), n = 0, r = 0, i = Math.min(Math.max(0, v.value - x.value), Math.max(0, U.value - 1));
|
|
143
|
+
for (; r < t.length - 1 && n + (t[r] ?? m.itemSize) <= i;) n += t[r] ?? m.itemSize, r += 1;
|
|
144
144
|
let a = e[r];
|
|
145
145
|
return a === void 0 ? null : {
|
|
146
146
|
key: a,
|
|
147
147
|
offset: i - n
|
|
148
148
|
};
|
|
149
149
|
}
|
|
150
|
-
function
|
|
151
|
-
|
|
150
|
+
function ze() {
|
|
151
|
+
A = null;
|
|
152
|
+
}
|
|
153
|
+
function Be() {
|
|
154
|
+
P += 1, N !== null && typeof cancelAnimationFrame == "function" && cancelAnimationFrame(N), N = null;
|
|
155
|
+
}
|
|
156
|
+
function Ve() {
|
|
157
|
+
Be();
|
|
158
|
+
let e = P, t = () => {
|
|
159
|
+
if (e === P) {
|
|
160
|
+
if (N = null, j) {
|
|
161
|
+
Ve();
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
M = !1, ze();
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
if (typeof requestAnimationFrame != "function") {
|
|
168
|
+
u(() => u(t));
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
N = requestAnimationFrame(() => {
|
|
172
|
+
e === P && (N = requestAnimationFrame(t));
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
function He() {
|
|
176
|
+
M = !0, Ve();
|
|
177
|
+
}
|
|
178
|
+
function J(e = !1) {
|
|
179
|
+
_e += 1, e || (j = !1), Be(), M = !1, ze();
|
|
180
|
+
}
|
|
181
|
+
function Y() {
|
|
182
|
+
ve = null, F = null;
|
|
183
|
+
}
|
|
184
|
+
function Ue(e) {
|
|
185
|
+
ve = e, F = e.scrollTop;
|
|
186
|
+
}
|
|
187
|
+
function We(e) {
|
|
188
|
+
A = e;
|
|
189
|
+
}
|
|
190
|
+
function Ge() {
|
|
191
|
+
if (m.items.length === 0) return {
|
|
152
192
|
firstIndex: -1,
|
|
153
193
|
lastIndex: -1,
|
|
154
194
|
firstKey: null,
|
|
155
195
|
lastKey: null
|
|
156
196
|
};
|
|
157
|
-
let e =
|
|
197
|
+
let e = Ne.value, t = Math.max(e, Pe.value);
|
|
158
198
|
return {
|
|
159
199
|
firstIndex: e,
|
|
160
200
|
lastIndex: t,
|
|
161
|
-
firstKey:
|
|
162
|
-
lastKey:
|
|
201
|
+
firstKey: B.value[e] ?? null,
|
|
202
|
+
lastKey: B.value[t] ?? null
|
|
163
203
|
};
|
|
164
204
|
}
|
|
165
|
-
function
|
|
166
|
-
let e =
|
|
205
|
+
function Ke() {
|
|
206
|
+
let e = v.value <= xe.value, t = K() - v.value <= Se.value;
|
|
167
207
|
return {
|
|
168
|
-
anchor:
|
|
169
|
-
visibleRange:
|
|
208
|
+
anchor: q(),
|
|
209
|
+
visibleRange: Ge(),
|
|
170
210
|
nearStart: e,
|
|
171
211
|
atEnd: t,
|
|
172
|
-
pinnedToEnd:
|
|
212
|
+
pinnedToEnd: I.value
|
|
173
213
|
};
|
|
174
214
|
}
|
|
175
|
-
function
|
|
176
|
-
let e =
|
|
177
|
-
t !==
|
|
215
|
+
function qe() {
|
|
216
|
+
let e = Ke(), t = JSON.stringify(e);
|
|
217
|
+
t !== ge && (ge = t, pe("viewport-change", e)), e.nearStart && !he && pe("near-start", e), he = e.nearStart;
|
|
178
218
|
}
|
|
179
|
-
function
|
|
180
|
-
let
|
|
181
|
-
|
|
219
|
+
function X(e) {
|
|
220
|
+
let t = n("SVirtualList", "setFollowTail value", e);
|
|
221
|
+
t && J(), I.value !== t && (I.value = t, pe("update:followTail", t), qe());
|
|
182
222
|
}
|
|
183
|
-
function
|
|
184
|
-
let
|
|
185
|
-
|
|
223
|
+
function Z(e) {
|
|
224
|
+
let t = G();
|
|
225
|
+
if (!t) return;
|
|
226
|
+
let n = e !== void 0 && O === null && ve === t && F !== null && Math.abs(t.scrollTop - F) <= .5, r = e !== void 0 && O === null && M && A !== null, i = n || r, a = e !== void 0 && !i && j, o = r;
|
|
227
|
+
e !== void 0 && (i || (Y(), J()));
|
|
228
|
+
let s = O;
|
|
229
|
+
y.value = t.clientHeight;
|
|
230
|
+
let ee = Math.max(0, t.scrollTop - (R.value ? W() : 0)), c = Math.abs(ee - v.value) > .5;
|
|
231
|
+
if (v.value = ee, s === "up" && X(!1), s === "down" && K() - v.value <= Se.value && X(!0), (s !== null || e !== void 0 && !i && c) && !I.value) {
|
|
232
|
+
let e = q();
|
|
233
|
+
e && (We(e), He());
|
|
234
|
+
}
|
|
235
|
+
O = null, o ? Q(A, { protectAnchor: !0 }) : qe(), a && Q(I.value ? null : q(), { protectAnchor: !I.value });
|
|
186
236
|
}
|
|
187
|
-
function
|
|
188
|
-
e.deltaY < 0 ? (
|
|
237
|
+
function Je(e) {
|
|
238
|
+
Y(), J(!0), e.deltaY < 0 ? (O = "up", X(!1)) : e.deltaY > 0 && (O = "down");
|
|
189
239
|
}
|
|
190
|
-
function
|
|
191
|
-
|
|
240
|
+
function Ye(t) {
|
|
241
|
+
let n = e(t.target, G());
|
|
242
|
+
t.defaultPrevented || t.isComposing || n !== null && n !== h.value && n !== G() || ([
|
|
192
243
|
"ArrowUp",
|
|
193
244
|
"PageUp",
|
|
194
245
|
"Home"
|
|
195
|
-
].includes(
|
|
246
|
+
].includes(t.key) ? (Y(), J(!0), O = "up", X(!1)) : [
|
|
196
247
|
"ArrowDown",
|
|
197
248
|
"PageDown",
|
|
198
249
|
"End"
|
|
199
|
-
].includes(
|
|
250
|
+
].includes(t.key) && (Y(), J(!0), O = "down"));
|
|
200
251
|
}
|
|
201
|
-
function
|
|
202
|
-
let t =
|
|
252
|
+
function Xe(e) {
|
|
253
|
+
let t = G();
|
|
203
254
|
return !t || e.currentTarget !== t ? !1 : e.offsetX >= t.clientWidth || e.offsetY >= t.clientHeight;
|
|
204
255
|
}
|
|
205
|
-
function
|
|
206
|
-
|
|
256
|
+
function Ze(e) {
|
|
257
|
+
Y(), J(!0), k = Xe(e), k && (O = "unknown", X(!1));
|
|
207
258
|
}
|
|
208
|
-
function
|
|
209
|
-
|
|
259
|
+
function Qe() {
|
|
260
|
+
k && (k = !1, K() - v.value <= Se.value && X(!0), O = null);
|
|
261
|
+
}
|
|
262
|
+
function $e(e, t) {
|
|
263
|
+
let n = e.scrollTop;
|
|
264
|
+
e.scrollTop = t, Math.abs(e.scrollTop - n) > .5 && Ue(e), Z();
|
|
210
265
|
}
|
|
211
|
-
function
|
|
212
|
-
let n =
|
|
266
|
+
function et(e, t) {
|
|
267
|
+
let n = V.value.get(e.key);
|
|
213
268
|
if (n === void 0) {
|
|
214
|
-
if (t) throw RangeError(`SVirtualList cannot restore missing anchor key ${
|
|
269
|
+
if (t) throw RangeError(`SVirtualList cannot restore missing anchor key ${z(e.key)}`);
|
|
215
270
|
return !1;
|
|
216
271
|
}
|
|
217
|
-
let r =
|
|
272
|
+
let r = G();
|
|
218
273
|
if (!r) return !1;
|
|
219
|
-
let i =
|
|
220
|
-
if (!Number.isFinite(e.offset) || e.offset < 0 || t && e.offset >= i) throw RangeError(`SVirtualList anchor offset ${e.offset} is outside row ${
|
|
221
|
-
let a = Math.min(e.offset, Math.max(0, i - 1)), o = (
|
|
222
|
-
return r
|
|
274
|
+
let i = Te.value[n] ?? m.itemSize;
|
|
275
|
+
if (!Number.isFinite(e.offset) || e.offset < 0 || t && e.offset >= i) throw RangeError(`SVirtualList anchor offset ${e.offset} is outside row ${z(e.key)} size ${i}`);
|
|
276
|
+
let a = Math.min(e.offset, Math.max(0, i - 1)), o = x.value + (H.value[n] ?? 0) + a;
|
|
277
|
+
return $e(r, Math.max(0, o + (R.value ? W() : 0))), !0;
|
|
278
|
+
}
|
|
279
|
+
function tt(e) {
|
|
280
|
+
if (I.value) {
|
|
281
|
+
$({ follow: !0 });
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
let t = A ?? e;
|
|
285
|
+
t && et(t, !1) || Z();
|
|
286
|
+
}
|
|
287
|
+
function Q(e, t = {}) {
|
|
288
|
+
e && A === null && We(e), t.protectAnchor && He();
|
|
289
|
+
let n = _e + 1;
|
|
290
|
+
_e = n, j = !0, u(() => {
|
|
291
|
+
n === _e && (j = !1, tt(e));
|
|
292
|
+
});
|
|
223
293
|
}
|
|
224
|
-
function
|
|
225
|
-
let t =
|
|
294
|
+
function nt(e) {
|
|
295
|
+
let t = C.get(e);
|
|
226
296
|
if (!t) return;
|
|
227
|
-
let n =
|
|
228
|
-
if (n !== e) throw Error(`SVirtualList rendered item registry mismatch for key ${
|
|
229
|
-
|
|
230
|
-
}
|
|
231
|
-
function
|
|
232
|
-
let n =
|
|
233
|
-
if (n === void 0) throw Error(`SVirtualList received a rendered item ref for stale key ${
|
|
234
|
-
let r =
|
|
235
|
-
if (r && r !== t) throw Error(`SVirtualList rendered item key collision for ${
|
|
236
|
-
let i =
|
|
237
|
-
if (i !== void 0 && i !== e) throw Error(`SVirtualList rendered item element collision between ${
|
|
238
|
-
r !== t && (
|
|
239
|
-
}
|
|
240
|
-
function
|
|
241
|
-
let t =
|
|
297
|
+
let n = w.get(t);
|
|
298
|
+
if (n !== e) throw Error(`SVirtualList rendered item registry mismatch for key ${z(e)}: element belongs to ${n === void 0 ? "no key" : z(n)}`);
|
|
299
|
+
E?.unobserve(t), C.delete(e), w.delete(t);
|
|
300
|
+
}
|
|
301
|
+
function rt(e, t) {
|
|
302
|
+
let n = V.value.get(e);
|
|
303
|
+
if (n === void 0) throw Error(`SVirtualList received a rendered item ref for stale key ${z(e)}`);
|
|
304
|
+
let r = C.get(e);
|
|
305
|
+
if (r && r !== t) throw Error(`SVirtualList rendered item key collision for ${z(e)} at index ${n}`);
|
|
306
|
+
let i = w.get(t);
|
|
307
|
+
if (i !== void 0 && i !== e) throw Error(`SVirtualList rendered item element collision between ${z(i)} and ${z(e)}`);
|
|
308
|
+
r !== t && (C.set(e, t), w.set(t, e), E?.observe(t));
|
|
309
|
+
}
|
|
310
|
+
function it(e) {
|
|
311
|
+
let t = T.get(e);
|
|
242
312
|
if (t) return t;
|
|
243
313
|
let n = (t) => {
|
|
244
314
|
if (t === null) {
|
|
245
|
-
|
|
315
|
+
nt(e);
|
|
246
316
|
return;
|
|
247
317
|
}
|
|
248
|
-
if (!(t instanceof HTMLElement)) throw TypeError(`SVirtualList rendered item ref for ${
|
|
249
|
-
|
|
318
|
+
if (!(t instanceof HTMLElement)) throw TypeError(`SVirtualList rendered item ref for ${z(e)} must resolve to an HTMLElement`);
|
|
319
|
+
rt(e, t);
|
|
250
320
|
};
|
|
251
|
-
return
|
|
321
|
+
return T.set(e, n), n;
|
|
252
322
|
}
|
|
253
|
-
function
|
|
254
|
-
let t = !1, n =
|
|
323
|
+
function at(e) {
|
|
324
|
+
let t = !1, n = I.value ? null : A ?? q(), r = new Map(b.value), i = !1, a = !1;
|
|
255
325
|
for (let n of e) {
|
|
256
|
-
if (n.target === h.value || n.target ===
|
|
326
|
+
if (n.target === h.value || n.target === m.externalScrollTarget) {
|
|
257
327
|
t = !0;
|
|
258
328
|
continue;
|
|
259
329
|
}
|
|
330
|
+
let e = n.borderBoxSize[0]?.blockSize ?? n.contentRect.height;
|
|
331
|
+
if (n.target === g.value) {
|
|
332
|
+
Number.isFinite(e) && e >= 0 && x.value !== e && (x.value = e, a = !0);
|
|
333
|
+
continue;
|
|
334
|
+
}
|
|
335
|
+
if (n.target === _.value) {
|
|
336
|
+
Number.isFinite(e) && e >= 0 && S.value !== e && (S.value = e, a = !0);
|
|
337
|
+
continue;
|
|
338
|
+
}
|
|
260
339
|
if (!(n.target instanceof HTMLElement)) throw TypeError("SVirtualList received a ResizeObserver entry for a non-HTMLElement target");
|
|
261
|
-
let
|
|
262
|
-
if (
|
|
263
|
-
if (
|
|
264
|
-
|
|
265
|
-
!Number.isFinite(a) || a <= 0 || r.get(e) === a || (r.set(e, a), i = !0);
|
|
340
|
+
let o = w.get(n.target);
|
|
341
|
+
if (o === void 0 || C.get(o) !== n.target) throw Error("SVirtualList received a ResizeObserver entry for an unregistered rendered item");
|
|
342
|
+
if (V.value.get(o) === void 0) throw Error(`SVirtualList received a ResizeObserver entry for stale key ${z(o)}`);
|
|
343
|
+
!Number.isFinite(e) || e <= 0 || r.get(o) === e || (r.set(o, e), i = !0);
|
|
266
344
|
}
|
|
267
|
-
i && (
|
|
345
|
+
i && (b.value = r), i || a ? Q(n, { protectAnchor: n !== null }) : t && Z();
|
|
268
346
|
}
|
|
269
|
-
function
|
|
270
|
-
if (!Number.isInteger(e) || e < 0 || e >=
|
|
271
|
-
let n =
|
|
347
|
+
function ot(e, t = "auto") {
|
|
348
|
+
if (!Number.isInteger(e) || e < 0 || e >= m.items.length) throw RangeError(`SVirtualList index ${e} is outside 0..${Math.max(m.items.length - 1, 0)}`);
|
|
349
|
+
let n = m.externalScrollTarget ?? h.value;
|
|
272
350
|
if (!n) return;
|
|
273
|
-
|
|
274
|
-
|
|
351
|
+
J();
|
|
352
|
+
let r = x.value + (H.value[e] ?? 0), i = x.value + (H.value[e + 1] ?? (H.value[e] ?? 0) + m.itemSize), a = v.value, o = a + y.value, s = r;
|
|
353
|
+
t === "end" && (s = i - y.value), t === "center" && (s = r - (y.value - (i - r)) / 2), !(t === "auto" && r >= a && i <= o) && (t === "auto" && i > o && (s = i - y.value), $e(n, Math.max(0, s + (R.value ? W() : 0))));
|
|
275
354
|
}
|
|
276
|
-
function
|
|
277
|
-
let n =
|
|
278
|
-
if (n === void 0) throw RangeError(`SVirtualList cannot scroll to missing key ${
|
|
279
|
-
|
|
355
|
+
function st(e, t = "auto") {
|
|
356
|
+
let n = V.value.get(e);
|
|
357
|
+
if (n === void 0) throw RangeError(`SVirtualList cannot scroll to missing key ${z(e)}`);
|
|
358
|
+
ot(n, t);
|
|
280
359
|
}
|
|
281
|
-
function
|
|
282
|
-
let t =
|
|
283
|
-
t && ((e.follow ?? !0) &&
|
|
360
|
+
function $(e = {}) {
|
|
361
|
+
let t = G();
|
|
362
|
+
t && (J(), (e.follow ?? !0) && X(!0), $e(t, K() + (R.value ? W() : 0)));
|
|
284
363
|
}
|
|
285
|
-
function
|
|
364
|
+
function ct() {
|
|
286
365
|
return {
|
|
287
|
-
anchor:
|
|
288
|
-
followTail:
|
|
366
|
+
anchor: q(),
|
|
367
|
+
followTail: I.value
|
|
289
368
|
};
|
|
290
369
|
}
|
|
291
|
-
async function
|
|
370
|
+
async function lt(e) {
|
|
292
371
|
if (typeof e != "object" || !e || Array.isArray(e)) throw TypeError("SVirtualList restoreViewport snapshot must be an object");
|
|
293
|
-
let
|
|
294
|
-
if (await
|
|
295
|
-
|
|
372
|
+
let t = n("SVirtualList", "restoreViewport.followTail", e.followTail);
|
|
373
|
+
if (J(), await u(), t) {
|
|
374
|
+
$({ follow: !0 });
|
|
296
375
|
return;
|
|
297
376
|
}
|
|
298
377
|
if (e.anchor === null) {
|
|
299
|
-
|
|
378
|
+
X(!1);
|
|
300
379
|
return;
|
|
301
380
|
}
|
|
302
|
-
|
|
303
|
-
}
|
|
304
|
-
async function
|
|
305
|
-
let n =
|
|
306
|
-
if (
|
|
307
|
-
let r =
|
|
308
|
-
if (r !== e) throw Error(`SVirtualList focusItem key ${
|
|
309
|
-
let i =
|
|
310
|
-
if (!i) throw Error(`SVirtualList focusItem has no rendered item registration for key ${
|
|
311
|
-
if (
|
|
381
|
+
X(!1), We(e.anchor), He(), et(e.anchor, !0);
|
|
382
|
+
}
|
|
383
|
+
async function ut(e, t = "auto") {
|
|
384
|
+
let n = B.value[e];
|
|
385
|
+
if (ot(e, t), await u(), n === void 0 || V.value.get(n) === void 0) throw Error(`SVirtualList focusItem key ${n === void 0 ? `at index ${e}` : z(n)} became stale before focus`);
|
|
386
|
+
let r = V.value.get(n);
|
|
387
|
+
if (r !== e) throw Error(`SVirtualList focusItem key ${z(n)} moved from index ${e} to ${r} before focus`);
|
|
388
|
+
let i = C.get(n);
|
|
389
|
+
if (!i) throw Error(`SVirtualList focusItem has no rendered item registration for key ${z(n)} at index ${e}`);
|
|
390
|
+
if (w.get(i) !== n) throw Error(`SVirtualList focusItem found a stale rendered item registration for key ${z(n)}`);
|
|
312
391
|
i.focus();
|
|
313
392
|
}
|
|
314
|
-
|
|
315
|
-
captureViewport:
|
|
316
|
-
focusItem:
|
|
317
|
-
getViewportState:
|
|
318
|
-
restoreViewport:
|
|
319
|
-
scrollToEnd:
|
|
320
|
-
scrollToIndex:
|
|
321
|
-
scrollToKey:
|
|
322
|
-
setFollowTail:
|
|
393
|
+
de({
|
|
394
|
+
captureViewport: ct,
|
|
395
|
+
focusItem: ut,
|
|
396
|
+
getViewportState: Ke,
|
|
397
|
+
restoreViewport: lt,
|
|
398
|
+
scrollToEnd: $,
|
|
399
|
+
scrollToIndex: ot,
|
|
400
|
+
scrollToKey: st,
|
|
401
|
+
setFollowTail: X
|
|
323
402
|
});
|
|
324
|
-
function
|
|
325
|
-
|
|
403
|
+
function dt(e) {
|
|
404
|
+
D?.removeEventListener("scroll", Z), D?.removeEventListener("wheel", Je), D?.removeEventListener("keydown", Ye), D?.removeEventListener("pointerdown", Ze), D?.removeEventListener("pointerup", Qe), D && E?.unobserve(D), Y(), J(), D = e, D?.addEventListener("scroll", Z, { passive: !0 }), D?.addEventListener("wheel", Je, { passive: !0 }), D?.addEventListener("keydown", Ye), D?.addEventListener("pointerdown", Ze), D?.addEventListener("pointerup", Qe), D && E?.observe(D), Z();
|
|
326
405
|
}
|
|
327
|
-
return
|
|
406
|
+
return ae(() => {
|
|
328
407
|
if (typeof ResizeObserver < "u") {
|
|
329
|
-
|
|
330
|
-
for (let e of
|
|
408
|
+
E = new ResizeObserver((e) => at(e)), h.value && E.observe(h.value), g.value && E.observe(g.value), _.value && E.observe(_.value);
|
|
409
|
+
for (let e of C.values()) E.observe(e);
|
|
410
|
+
}
|
|
411
|
+
dt(m.externalScrollTarget), Z(), I.value && u(() => $({ follow: !0 }));
|
|
412
|
+
}), p(() => m.externalScrollTarget, dt), p(g, (e, t) => {
|
|
413
|
+
if (t && E?.unobserve(t), e && E?.observe(e), !e && t && x.value > 0) {
|
|
414
|
+
let e = I.value ? null : A ?? q();
|
|
415
|
+
x.value = 0, Q(e, { protectAnchor: !0 });
|
|
416
|
+
}
|
|
417
|
+
}), p(_, (e, t) => {
|
|
418
|
+
if (t && E?.unobserve(t), e && E?.observe(e), !e && t && S.value > 0) {
|
|
419
|
+
let e = I.value ? null : A ?? q();
|
|
420
|
+
S.value = 0, Q(e, { protectAnchor: !0 });
|
|
331
421
|
}
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
for (let e of
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
422
|
+
}), p(() => m.followTail, (e) => {
|
|
423
|
+
I.value = n("SVirtualList", "followTail", e), I.value ? (J(), u(() => $({ follow: !1 }))) : qe();
|
|
424
|
+
}), p(() => B.value, (e, t) => {
|
|
425
|
+
let n = I.value ? null : A ?? q(t);
|
|
426
|
+
n && We(n);
|
|
427
|
+
let r = new Set(e);
|
|
428
|
+
b.value = new Map([...b.value].filter(([e]) => r.has(e)));
|
|
429
|
+
for (let e of C.keys()) r.has(e) || nt(e);
|
|
430
|
+
for (let e of T.keys()) r.has(e) || T.delete(e);
|
|
431
|
+
Q(n, { protectAnchor: !0 });
|
|
432
|
+
}, { flush: "sync" }), ie(() => {
|
|
433
|
+
Y(), Be(), J(), D?.removeEventListener("scroll", Z), D?.removeEventListener("wheel", Je), D?.removeEventListener("keydown", Ye), D?.removeEventListener("pointerdown", Ze), D?.removeEventListener("pointerup", Qe), E?.disconnect(), C.clear(), w.clear(), T.clear();
|
|
434
|
+
}), (e, t) => (d(), c("div", ne(ce(me).bindings(), {
|
|
344
435
|
ref_key: "container",
|
|
345
436
|
ref: h,
|
|
346
437
|
class: "s-virtual-list",
|
|
347
|
-
style:
|
|
348
|
-
"data-item-size":
|
|
349
|
-
"data-viewport-height":
|
|
350
|
-
role:
|
|
351
|
-
"aria-label":
|
|
352
|
-
"aria-live":
|
|
353
|
-
"aria-busy":
|
|
354
|
-
"aria-relevant":
|
|
438
|
+
style: De.value,
|
|
439
|
+
"data-item-size": l.itemSize,
|
|
440
|
+
"data-viewport-height": l.height ?? void 0,
|
|
441
|
+
role: L.value,
|
|
442
|
+
"aria-label": l.accessibleLabel,
|
|
443
|
+
"aria-live": L.value === "log" ? ye.value : void 0,
|
|
444
|
+
"aria-busy": L.value === "log" ? be.value : void 0,
|
|
445
|
+
"aria-relevant": L.value === "log" ? "additions text" : void 0,
|
|
355
446
|
tabindex: "0",
|
|
356
|
-
onScrollPassive:
|
|
357
|
-
onWheelPassive:
|
|
358
|
-
onKeydown:
|
|
359
|
-
onPointerdown:
|
|
360
|
-
onPointerup:
|
|
361
|
-
}), [
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
447
|
+
onScrollPassive: Z,
|
|
448
|
+
onWheelPassive: Je,
|
|
449
|
+
onKeydown: Ye,
|
|
450
|
+
onPointerdown: Ze,
|
|
451
|
+
onPointerup: Qe
|
|
452
|
+
}), [
|
|
453
|
+
te("div", {
|
|
454
|
+
class: "s-virtual-list__spacer",
|
|
455
|
+
style: re(Oe.value),
|
|
456
|
+
"aria-hidden": "true"
|
|
457
|
+
}, null, 4),
|
|
458
|
+
e.$slots.header ? (d(), c("div", {
|
|
459
|
+
key: 0,
|
|
460
|
+
ref_key: "headerRegion",
|
|
461
|
+
ref: g,
|
|
462
|
+
class: "s-virtual-list__header"
|
|
463
|
+
}, [se(e.$slots, "header", {}, void 0, !0)], 512)) : ee("", !0),
|
|
464
|
+
(d(!0), c(o, null, oe(Le.value, (t) => (d(), c("div", {
|
|
465
|
+
key: t.key,
|
|
466
|
+
ref_for: !0,
|
|
467
|
+
ref: it(t.key),
|
|
468
|
+
class: "s-virtual-list__item",
|
|
469
|
+
style: re(Re(t.index)),
|
|
470
|
+
"data-virtual-index": t.index,
|
|
471
|
+
role: L.value === "list" ? "listitem" : "article",
|
|
472
|
+
"aria-label": we(t.item, t.index),
|
|
473
|
+
"aria-posinset": t.index + 1,
|
|
474
|
+
"aria-setsize": l.items.length,
|
|
475
|
+
tabindex: "-1"
|
|
476
|
+
}, [se(e.$slots, "default", {
|
|
477
|
+
item: t.item,
|
|
478
|
+
index: t.index,
|
|
479
|
+
position: t.index + 1,
|
|
480
|
+
setSize: l.items.length
|
|
481
|
+
}, void 0, !0)], 12, ue))), 128)),
|
|
482
|
+
e.$slots.footer ? (d(), c("div", {
|
|
483
|
+
key: 1,
|
|
484
|
+
ref_key: "footerRegion",
|
|
485
|
+
ref: _,
|
|
486
|
+
class: "s-virtual-list__footer",
|
|
487
|
+
style: re(ke.value)
|
|
488
|
+
}, [se(e.$slots, "footer", {}, void 0, !0)], 4)) : ee("", !0)
|
|
489
|
+
], 16, le));
|
|
383
490
|
}
|
|
384
491
|
});
|
|
385
492
|
//#endregion
|
|
386
|
-
export {
|
|
493
|
+
export { de as default };
|