@rcarls/rc-common 0.4.1 → 0.5.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/CHANGELOG.md +17 -0
- package/dist/rc-common.js +135 -98
- package/dist/rc-common.umd.cjs +9 -9
- package/dist/types/ItemsCollectionController.d.ts +19 -0
- package/dist/types/KeyboardNavigationDirective.d.ts +4 -6
- package/package.json +1 -1
- /package/dist/types/{snapUtils.test.d.ts → snapUtils.unit.test.d.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @rcarls/rc-common
|
|
2
2
|
|
|
3
|
+
## 0.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 689340c: Remove pre-1.0 deprecated APIs: the boolean `keyNavigation` option, `rc-disclosure.fragment`,
|
|
8
|
+
`rc-textarea.listNumbers`, `rc-textarea.label`, and `decorationsFromHtml`.
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- 4ae2ef0: Fix `ItemsCollectionController` (used by `rc-listbox`, and transitively by
|
|
13
|
+
`rc-select` and `rc-combobox`) toggling an option on the first touch contact
|
|
14
|
+
instead of letting a scrollable options list scroll. Touch activation now
|
|
15
|
+
waits for `pointerup` within a 10px tap threshold; a larger move cancels the
|
|
16
|
+
pending activation. Mouse and pen still activate on `pointerdown`.
|
|
17
|
+
|
|
18
|
+
## 0.4.2
|
|
19
|
+
|
|
3
20
|
## 0.4.1
|
|
4
21
|
|
|
5
22
|
## 0.4.0
|
package/dist/rc-common.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { nothing as
|
|
1
|
+
import { nothing as v } from "lit";
|
|
2
2
|
import { PartType as b } from "lit/directive.js";
|
|
3
|
-
import { directive as
|
|
4
|
-
import { state as
|
|
5
|
-
let
|
|
6
|
-
class
|
|
3
|
+
import { directive as y, AsyncDirective as w } from "lit/async-directive.js";
|
|
4
|
+
import { state as T } from "lit/decorators.js";
|
|
5
|
+
let k = 0;
|
|
6
|
+
class K {
|
|
7
7
|
constructor(t, e) {
|
|
8
|
-
this._activeItem = null, this._activeIndex = -1, this._itemCounter = 0, this._opts = e, this._instanceId = `rc-adc-${++
|
|
8
|
+
this._activeItem = null, this._activeIndex = -1, this._itemCounter = 0, this._opts = e, this._instanceId = `rc-adc-${++k}`, t.addController(this);
|
|
9
9
|
}
|
|
10
10
|
hostConnected() {
|
|
11
11
|
}
|
|
@@ -86,23 +86,43 @@ class X {
|
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
|
-
class
|
|
89
|
+
const m = class m {
|
|
90
90
|
constructor(t, e) {
|
|
91
|
-
this._ul = null, this._options = [], this._liElements = [], this._createLi = null, this._createOption = null, this._selectedValues = /* @__PURE__ */ new Set(), this._filterText = "", this._filterStrategy = "contains", this._checkmark = !1, this._optionsInitialized = !1, this._onPointerDown = (i) => {
|
|
92
|
-
const s = i.target;
|
|
93
|
-
if (
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
91
|
+
this._ul = null, this._options = [], this._liElements = [], this._createLi = null, this._createOption = null, this._selectedValues = /* @__PURE__ */ new Set(), this._filterText = "", this._filterStrategy = "contains", this._checkmark = !1, this._optionsInitialized = !1, this._pendingTouchActivation = null, this._onPointerDown = (i) => {
|
|
92
|
+
const s = i, n = this._resolveOptionLi(s.target);
|
|
93
|
+
if (n) {
|
|
94
|
+
if (s.pointerType === "touch") {
|
|
95
|
+
if (this._pendingTouchActivation) return;
|
|
96
|
+
this._pendingTouchActivation = {
|
|
97
|
+
pointerId: s.pointerId,
|
|
98
|
+
li: n,
|
|
99
|
+
startX: s.clientX,
|
|
100
|
+
startY: s.clientY
|
|
101
|
+
};
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
this._activateLi(n, s);
|
|
105
|
+
}
|
|
106
|
+
}, this._onPointerMove = (i) => {
|
|
107
|
+
const s = this._pendingTouchActivation, n = i;
|
|
108
|
+
if (!s || n.pointerId !== s.pointerId) return;
|
|
109
|
+
Math.hypot(
|
|
110
|
+
n.clientX - s.startX,
|
|
111
|
+
n.clientY - s.startY
|
|
112
|
+
) > m._TOUCH_TAP_THRESHOLD && (this._pendingTouchActivation = null);
|
|
113
|
+
}, this._onPointerUp = (i) => {
|
|
114
|
+
const s = this._pendingTouchActivation, n = i;
|
|
115
|
+
!s || n.pointerId !== s.pointerId || (this._pendingTouchActivation = null, this._activateLi(s.li, n));
|
|
116
|
+
}, this._onPointerCancel = (i) => {
|
|
117
|
+
const s = i;
|
|
118
|
+
this._pendingTouchActivation?.pointerId === s.pointerId && (this._pendingTouchActivation = null);
|
|
99
119
|
}, this._host = t, this._idPrefix = e.idPrefix, this._onInitFromDom = e.onInitFromDom, this._onActivate = e.onActivate, t.addController(this);
|
|
100
120
|
}
|
|
101
121
|
hostConnected() {
|
|
102
|
-
this._host.addEventListener("pointerdown", this._onPointerDown), this._optionsInitialized || this._bootstrapFromDom();
|
|
122
|
+
this._host.addEventListener("pointerdown", this._onPointerDown), this._host.addEventListener("pointermove", this._onPointerMove), this._host.addEventListener("pointerup", this._onPointerUp), this._host.addEventListener("pointercancel", this._onPointerCancel), this._optionsInitialized || this._bootstrapFromDom();
|
|
103
123
|
}
|
|
104
124
|
hostDisconnected() {
|
|
105
|
-
this._host.removeEventListener("pointerdown", this._onPointerDown);
|
|
125
|
+
this._host.removeEventListener("pointerdown", this._onPointerDown), this._host.removeEventListener("pointermove", this._onPointerMove), this._host.removeEventListener("pointerup", this._onPointerUp), this._host.removeEventListener("pointercancel", this._onPointerCancel), this._pendingTouchActivation = null;
|
|
106
126
|
}
|
|
107
127
|
// -- Accessors --
|
|
108
128
|
get allOptions() {
|
|
@@ -267,8 +287,27 @@ class N {
|
|
|
267
287
|
const e = t.label.toLowerCase(), i = this._filterText.toLowerCase();
|
|
268
288
|
return typeof this._filterStrategy == "function" ? this._filterStrategy(e, i) : this._filterStrategy === "contains" ? e.includes(i) : e.startsWith(i);
|
|
269
289
|
}
|
|
270
|
-
|
|
271
|
-
|
|
290
|
+
_resolveOptionLi(t) {
|
|
291
|
+
if (!t) return null;
|
|
292
|
+
const e = t.closest("li[data-value]");
|
|
293
|
+
return !e || e.getAttribute("role") !== "option" || e.parentElement !== this._ul ? null : e;
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Claims a pointer event as an option activation: stops it from continuing
|
|
297
|
+
* to bubble/compose past this point (left unstopped, a composed event can
|
|
298
|
+
* still be observed by ancestors outside this component — e.g. a <label>
|
|
299
|
+
* wrapping an unrelated sibling control — and be reinterpreted as an
|
|
300
|
+
* interaction with something else entirely), then activates the option.
|
|
301
|
+
*/
|
|
302
|
+
_activateLi(t, e) {
|
|
303
|
+
e.preventDefault(), e.stopPropagation();
|
|
304
|
+
const i = this.optionForElement(t);
|
|
305
|
+
i && this._onActivate(i);
|
|
306
|
+
}
|
|
307
|
+
};
|
|
308
|
+
m._TOUCH_TAP_THRESHOLD = 10;
|
|
309
|
+
let x = m;
|
|
310
|
+
class P extends w {
|
|
272
311
|
constructor(t) {
|
|
273
312
|
if (super(t), this._options = {}, this._isPointerFocus = !1, this._onPointerdown = () => {
|
|
274
313
|
this._isPointerFocus = !0, this._target?.removeAttribute("data-interaction-mode");
|
|
@@ -287,7 +326,7 @@ class k extends y {
|
|
|
287
326
|
t instanceof HTMLElement && (t.addEventListener("pointerdown", this._onPointerdown, { capture: !0 }), t.addEventListener("focusin", this._onFocusin), t.addEventListener("keydown", this._onKeydown));
|
|
288
327
|
}
|
|
289
328
|
render(t) {
|
|
290
|
-
return
|
|
329
|
+
return v;
|
|
291
330
|
}
|
|
292
331
|
update(t, [e]) {
|
|
293
332
|
this.isConnected && this._element?.deref() === void 0 && (this._element = new WeakRef(t.element), this._init()), this._options = e ?? {};
|
|
@@ -300,8 +339,8 @@ class k extends y {
|
|
|
300
339
|
this._init();
|
|
301
340
|
}
|
|
302
341
|
}
|
|
303
|
-
const
|
|
304
|
-
class
|
|
342
|
+
const V = y(P);
|
|
343
|
+
class D extends w {
|
|
305
344
|
constructor(t) {
|
|
306
345
|
if (super(t), this._options = {}, t.type !== b.ELEMENT)
|
|
307
346
|
throw new Error(
|
|
@@ -352,15 +391,13 @@ class T extends y {
|
|
|
352
391
|
}
|
|
353
392
|
/**
|
|
354
393
|
* @param _cb - Callback function invoked with the navigation action
|
|
355
|
-
* @param _options -
|
|
356
|
-
* @deprecated Passing a boolean as the second parameter is deprecated.
|
|
357
|
-
* Use an options object instead.
|
|
394
|
+
* @param _options - Keyboard navigation behavior options.
|
|
358
395
|
*/
|
|
359
396
|
render(t, e) {
|
|
360
|
-
return
|
|
397
|
+
return v;
|
|
361
398
|
}
|
|
362
399
|
update(t, [e, i]) {
|
|
363
|
-
this.isConnected && this._element?.deref() === void 0 && (this._element = new WeakRef(t.element), this._init()), this._callback = e.bind(t.options?.host ?? t.element),
|
|
400
|
+
this.isConnected && this._element?.deref() === void 0 && (this._element = new WeakRef(t.element), this._init()), this._callback = e.bind(t.options?.host ?? t.element), this._options = { ...i };
|
|
364
401
|
}
|
|
365
402
|
disconnected() {
|
|
366
403
|
const t = this._element?.deref();
|
|
@@ -370,8 +407,8 @@ class T extends y {
|
|
|
370
407
|
this._init();
|
|
371
408
|
}
|
|
372
409
|
}
|
|
373
|
-
const
|
|
374
|
-
class
|
|
410
|
+
const U = y(D);
|
|
411
|
+
class S extends w {
|
|
375
412
|
constructor(t) {
|
|
376
413
|
if (super(t), this._activePointerId = null, t.type !== b.ELEMENT)
|
|
377
414
|
throw new Error("The `mouseMove` directive must be used on an element.");
|
|
@@ -418,7 +455,7 @@ class D extends y {
|
|
|
418
455
|
}
|
|
419
456
|
/** Render no DOM; this directive only wires pointer listeners. */
|
|
420
457
|
render(t) {
|
|
421
|
-
return
|
|
458
|
+
return v;
|
|
422
459
|
}
|
|
423
460
|
update(t, [e]) {
|
|
424
461
|
if (this._callback = e.bind(t.options?.host ?? t.element), !this.isConnected || !(t.element instanceof HTMLElement)) return;
|
|
@@ -433,8 +470,8 @@ class D extends y {
|
|
|
433
470
|
this._init();
|
|
434
471
|
}
|
|
435
472
|
}
|
|
436
|
-
const j =
|
|
437
|
-
class
|
|
473
|
+
const j = y(S);
|
|
474
|
+
class A {
|
|
438
475
|
constructor(t, e) {
|
|
439
476
|
this._$target = null, this._pointerId = null, this._startX = 0, this._startY = 0, this._startTime = 0, this._samples = [], this._activated = !1, this._rejected = !1, this._onPointerDown = (i) => {
|
|
440
477
|
if (this._pointerId !== null || !i.isPrimary && i.pointerId !== 1 || i.pointerType === "mouse" && i.button !== 0 || this._options.canStart?.(i) === !1)
|
|
@@ -563,7 +600,7 @@ class q {
|
|
|
563
600
|
handle: null,
|
|
564
601
|
bounds: "viewport",
|
|
565
602
|
...e
|
|
566
|
-
}, this._onKeyDown = this._handleKeyDown.bind(this), this._gesture = new
|
|
603
|
+
}, this._onKeyDown = this._handleKeyDown.bind(this), this._gesture = new A(t, {
|
|
567
604
|
target: () => this._handle(),
|
|
568
605
|
axis: this._opts.axis,
|
|
569
606
|
canStart: (i) => this._canStartGesture(i),
|
|
@@ -665,11 +702,11 @@ class q {
|
|
|
665
702
|
return [e.left, e.top, e.right, e.bottom];
|
|
666
703
|
}
|
|
667
704
|
}
|
|
668
|
-
function
|
|
705
|
+
function I(o) {
|
|
669
706
|
const t = o.getBoundingClientRect();
|
|
670
707
|
return getComputedStyle(o).position === "static" && (o.style.position = "fixed"), o.style.translate = "none", o.style.inset = "auto", o.style.margin = "0", o.style.boxSizing = "border-box", o.style.left = `${t.left}px`, o.style.top = `${t.top}px`, o.style.width = `${t.width}px`, o.style.height = `${t.height}px`, t;
|
|
671
708
|
}
|
|
672
|
-
class
|
|
709
|
+
class G {
|
|
673
710
|
constructor(t, e) {
|
|
674
711
|
this._resizing = null, this._startW = 0, this._startH = 0, this._startLeft = 0, this._startTop = 0, this._lastDeltaX = 0, this._lastDeltaY = 0, this._velocityX = 0, this._velocityY = 0, this._pendingEdge = null, this._effectiveMinW = 0, this._effectiveMinH = 0, this._effectiveMaxW = 1 / 0, this._effectiveMaxH = 1 / 0, this._cornerBtn = null, this._opts = {
|
|
675
712
|
direction: "none",
|
|
@@ -682,7 +719,7 @@ class U {
|
|
|
682
719
|
origin: "",
|
|
683
720
|
bounds: "viewport",
|
|
684
721
|
...e
|
|
685
|
-
}, this._onPointerMove = this._handlePointerMove.bind(this), this._onPointerLeave = this._handlePointerLeave.bind(this), this._onKeyDown = this._handleKeyDown.bind(this), this._gesture = new
|
|
722
|
+
}, this._onPointerMove = this._handlePointerMove.bind(this), this._onPointerLeave = this._handlePointerLeave.bind(this), this._onKeyDown = this._handleKeyDown.bind(this), this._gesture = new A(t, {
|
|
686
723
|
target: () => this._handle() ?? this._target(),
|
|
687
724
|
capture: !0,
|
|
688
725
|
stopPropagation: !0,
|
|
@@ -878,7 +915,7 @@ class U {
|
|
|
878
915
|
return null;
|
|
879
916
|
}
|
|
880
917
|
_pinPosition(t) {
|
|
881
|
-
return
|
|
918
|
+
return I(t);
|
|
882
919
|
}
|
|
883
920
|
_canStartGesture(t) {
|
|
884
921
|
if (this._opts.disabled)
|
|
@@ -1038,7 +1075,7 @@ function f(o, t) {
|
|
|
1038
1075
|
return `top: auto; bottom: anchor(bottom); left: anchor(right); right: auto; margin-left: ${e};`;
|
|
1039
1076
|
}
|
|
1040
1077
|
}
|
|
1041
|
-
const
|
|
1078
|
+
const E = {
|
|
1042
1079
|
top: "bottom",
|
|
1043
1080
|
"top-start": "bottom-start",
|
|
1044
1081
|
"top-end": "bottom-end",
|
|
@@ -1051,7 +1088,7 @@ const w = {
|
|
|
1051
1088
|
right: "left",
|
|
1052
1089
|
"right-start": "left-start",
|
|
1053
1090
|
"right-end": "left-end"
|
|
1054
|
-
},
|
|
1091
|
+
}, M = {
|
|
1055
1092
|
top: "top",
|
|
1056
1093
|
"top-start": "top-end",
|
|
1057
1094
|
"top-end": "top-start",
|
|
@@ -1064,15 +1101,15 @@ const w = {
|
|
|
1064
1101
|
right: "right",
|
|
1065
1102
|
"right-start": "right-end",
|
|
1066
1103
|
"right-end": "right-start"
|
|
1067
|
-
},
|
|
1068
|
-
let
|
|
1069
|
-
function
|
|
1070
|
-
return
|
|
1104
|
+
}, C = CSS.supports("position-try-fallbacks: flip-block") && CSS.supports("min-width: anchor-size(width)");
|
|
1105
|
+
let L = null, g = null;
|
|
1106
|
+
function H() {
|
|
1107
|
+
return C ? Promise.resolve(null) : (g || (g = import("./css-anchor-positioning-fn-hFYJeBk4.js").then((o) => (L = o.default, L)).catch(() => null)), g);
|
|
1071
1108
|
}
|
|
1072
|
-
let
|
|
1073
|
-
class
|
|
1109
|
+
let z = 0;
|
|
1110
|
+
class J {
|
|
1074
1111
|
constructor(t, e) {
|
|
1075
|
-
this._styleEl = null, this._adoptedSheet = null, this._opts = e, this._uid = `rc-anchor-${++
|
|
1112
|
+
this._styleEl = null, this._adoptedSheet = null, this._opts = e, this._uid = `rc-anchor-${++z}`, t.addController(this);
|
|
1076
1113
|
}
|
|
1077
1114
|
setOptions(t) {
|
|
1078
1115
|
Object.assign(this._opts, t), this._applyAndPolyfill();
|
|
@@ -1100,10 +1137,10 @@ class G {
|
|
|
1100
1137
|
return typeof t == "function" ? t() : t ?? null;
|
|
1101
1138
|
}
|
|
1102
1139
|
_applyAndPolyfill() {
|
|
1103
|
-
this._apply(),
|
|
1140
|
+
this._apply(), C || this._applyPolyfillOrFallback();
|
|
1104
1141
|
}
|
|
1105
1142
|
async _applyPolyfillOrFallback() {
|
|
1106
|
-
const t = await
|
|
1143
|
+
const t = await H(), e = this._shadowHost();
|
|
1107
1144
|
t ? await t({ roots: e ? [e] : void 0, useAnimationFrame: !1 }) : this._positionFallback();
|
|
1108
1145
|
}
|
|
1109
1146
|
_apply() {
|
|
@@ -1115,7 +1152,7 @@ class G {
|
|
|
1115
1152
|
if (!t || !e) return;
|
|
1116
1153
|
const i = this._opts.placement ?? "bottom-start", s = this._opts.offset ?? 4, n = this._opts.flip ?? !0, r = `--${this._uid}`, a = this._uid;
|
|
1117
1154
|
t.style.setProperty("anchor-name", r), e.setAttribute("data-rc-anchor", a);
|
|
1118
|
-
const l =
|
|
1155
|
+
const l = E[i], _ = M[i], h = E[_], u = n ? `
|
|
1119
1156
|
@position-try --${a}-end { ${f(_, s)} }
|
|
1120
1157
|
@position-try --${a}-flip { ${f(l, s)} }
|
|
1121
1158
|
@position-try --${a}-both { ${f(h, s)} }
|
|
@@ -1159,7 +1196,7 @@ class G {
|
|
|
1159
1196
|
), this._adoptedSheet = null);
|
|
1160
1197
|
}
|
|
1161
1198
|
}
|
|
1162
|
-
class
|
|
1199
|
+
class Q {
|
|
1163
1200
|
constructor(t, e) {
|
|
1164
1201
|
this._attached = null, this._scrolled = !1, this._onScroll = () => this._evaluate(), this._host = t, this._opts = e, t.addController(this);
|
|
1165
1202
|
}
|
|
@@ -1201,7 +1238,7 @@ class J {
|
|
|
1201
1238
|
i !== this._scrolled && (this._scrolled = i, this._opts.onChange?.(i, t), this._host.requestUpdate());
|
|
1202
1239
|
}
|
|
1203
1240
|
}
|
|
1204
|
-
class
|
|
1241
|
+
class Z {
|
|
1205
1242
|
constructor(t, e) {
|
|
1206
1243
|
this._attached = null, this._observer = null, this._options = e, t.addController(this);
|
|
1207
1244
|
}
|
|
@@ -1227,7 +1264,7 @@ class Q {
|
|
|
1227
1264
|
this._observer?.disconnect(), this._attached = null;
|
|
1228
1265
|
}
|
|
1229
1266
|
}
|
|
1230
|
-
class
|
|
1267
|
+
class tt {
|
|
1231
1268
|
constructor(t, e) {
|
|
1232
1269
|
this._frame = 0, this._links = [], this._host = t, this._options = e, t.addController(this);
|
|
1233
1270
|
}
|
|
@@ -1301,7 +1338,7 @@ class Z {
|
|
|
1301
1338
|
e.toggleAttribute("hidden", !1), e.style.inlineSize = `${r.width}px`, e.style.blockSize = `${r.height}px`, e.style.transform = `translate(${r.left - n.left}px, ${r.top - n.top}px)`;
|
|
1302
1339
|
}
|
|
1303
1340
|
}
|
|
1304
|
-
class
|
|
1341
|
+
class et {
|
|
1305
1342
|
constructor(t) {
|
|
1306
1343
|
this._callback = null, this._frame = 0, t?.addController(this);
|
|
1307
1344
|
}
|
|
@@ -1321,7 +1358,7 @@ class tt {
|
|
|
1321
1358
|
this.cancel();
|
|
1322
1359
|
}
|
|
1323
1360
|
}
|
|
1324
|
-
class
|
|
1361
|
+
class it {
|
|
1325
1362
|
constructor(t) {
|
|
1326
1363
|
this._buffer = "", this._timer = 0, this._options = t;
|
|
1327
1364
|
}
|
|
@@ -1353,7 +1390,7 @@ class et {
|
|
|
1353
1390
|
this._timer && (window.clearTimeout(this._timer), this._timer = 0);
|
|
1354
1391
|
}
|
|
1355
1392
|
}
|
|
1356
|
-
function
|
|
1393
|
+
function st(o) {
|
|
1357
1394
|
let t = o.parentElement;
|
|
1358
1395
|
for (; t && t !== document.documentElement; ) {
|
|
1359
1396
|
const { overflow: e, overflowY: i } = getComputedStyle(t);
|
|
@@ -1362,21 +1399,21 @@ function it(o) {
|
|
|
1362
1399
|
}
|
|
1363
1400
|
return document.scrollingElement ?? document.documentElement;
|
|
1364
1401
|
}
|
|
1365
|
-
function
|
|
1402
|
+
function $(o) {
|
|
1366
1403
|
return o == null || o.hasAttribute("disabled") ? !1 : !!((o instanceof HTMLAnchorElement || o instanceof HTMLAreaElement) && o.hasAttribute("href") || o instanceof HTMLButtonElement || o instanceof HTMLInputElement || o instanceof HTMLTextAreaElement || o instanceof HTMLSelectElement || o.hasAttribute("tabindex") || o.shadowRoot?.delegatesFocus === !0);
|
|
1367
1404
|
}
|
|
1368
|
-
function
|
|
1405
|
+
function F(o, t) {
|
|
1369
1406
|
return o.querySelector(t);
|
|
1370
1407
|
}
|
|
1371
|
-
function
|
|
1408
|
+
function O(o, t) {
|
|
1372
1409
|
return Array.from(o.querySelectorAll(t));
|
|
1373
1410
|
}
|
|
1374
|
-
function
|
|
1375
|
-
if (
|
|
1411
|
+
function nt(o, t) {
|
|
1412
|
+
if (O(o, t.selector).length >= (t.minimum ?? 1)) return !1;
|
|
1376
1413
|
const e = t.hostName ?? o.localName, i = t.childDescription ?? t.selector.replace(":scope > ", ""), s = t.message ?? `[${e}] No direct child ${i} found. Place ${i} inside <${e}>.`;
|
|
1377
1414
|
return console.warn(s, o), !0;
|
|
1378
1415
|
}
|
|
1379
|
-
class
|
|
1416
|
+
class ot {
|
|
1380
1417
|
constructor(t, e) {
|
|
1381
1418
|
this._observer = null, this._child = null, this._host = t, this._options = e, t.addController(this);
|
|
1382
1419
|
}
|
|
@@ -1394,22 +1431,22 @@ class nt {
|
|
|
1394
1431
|
}
|
|
1395
1432
|
/** Re-read the child from the host and invoke `onChange` when it changes. */
|
|
1396
1433
|
sync() {
|
|
1397
|
-
const t = this._child, e =
|
|
1434
|
+
const t = this._child, e = F(this._host, this._options.selector);
|
|
1398
1435
|
return this._child = e, e || this._options.onMissing?.(this._host), e !== t && this._options.onChange?.(e, t), e;
|
|
1399
1436
|
}
|
|
1400
1437
|
}
|
|
1401
|
-
var
|
|
1438
|
+
var R = Object.defineProperty, W = (o, t, e, i) => {
|
|
1402
1439
|
for (var s = void 0, n = o.length - 1, r; n >= 0; n--)
|
|
1403
1440
|
(r = o[n]) && (s = r(t, e, s) || s);
|
|
1404
|
-
return s &&
|
|
1441
|
+
return s && R(t, e, s), s;
|
|
1405
1442
|
};
|
|
1406
|
-
function
|
|
1443
|
+
function rt(o) {
|
|
1407
1444
|
class t extends o {
|
|
1408
1445
|
constructor() {
|
|
1409
1446
|
super(...arguments), this._items = [];
|
|
1410
1447
|
}
|
|
1411
1448
|
get items() {
|
|
1412
|
-
return this._items.map((i) => i.deref()).filter((i) =>
|
|
1449
|
+
return this._items.map((i) => i.deref()).filter((i) => $(i));
|
|
1413
1450
|
}
|
|
1414
1451
|
get firstItem() {
|
|
1415
1452
|
return this.items.at(0);
|
|
@@ -1476,27 +1513,27 @@ function ot(o) {
|
|
|
1476
1513
|
i && i.setAttribute("tabindex", "0");
|
|
1477
1514
|
}
|
|
1478
1515
|
}
|
|
1479
|
-
return
|
|
1480
|
-
|
|
1516
|
+
return W([
|
|
1517
|
+
T()
|
|
1481
1518
|
], t.prototype, "_lastFocused"), t;
|
|
1482
1519
|
}
|
|
1483
|
-
function
|
|
1520
|
+
function at(o, t, e, i) {
|
|
1484
1521
|
const s = Math.min(Math.max(o, t), e);
|
|
1485
1522
|
if (i <= 0) return s;
|
|
1486
1523
|
const n = Math.round((s - t) / i) * i + t;
|
|
1487
1524
|
return Math.min(Math.max(n, t), e);
|
|
1488
1525
|
}
|
|
1489
|
-
function
|
|
1526
|
+
function ht(o, t, e) {
|
|
1490
1527
|
return e === t ? 0 : Math.min(Math.max((o - t) / (e - t), 0), 1);
|
|
1491
1528
|
}
|
|
1492
|
-
function
|
|
1529
|
+
function lt(o, t) {
|
|
1493
1530
|
let e = -1, i = 1 / 0;
|
|
1494
1531
|
return o.forEach((s, n) => {
|
|
1495
1532
|
const r = Math.abs(s - t);
|
|
1496
1533
|
Number.isFinite(s) && r < i && (e = n, i = r);
|
|
1497
1534
|
}), e;
|
|
1498
1535
|
}
|
|
1499
|
-
function
|
|
1536
|
+
function ct(o, t, e) {
|
|
1500
1537
|
if (e > 0) {
|
|
1501
1538
|
const i = o.findIndex((s) => Number.isFinite(s) && s > t);
|
|
1502
1539
|
return i >= 0 ? i : o.length - 1;
|
|
@@ -1506,35 +1543,35 @@ function lt(o, t, e) {
|
|
|
1506
1543
|
return i;
|
|
1507
1544
|
return o.length > 0 ? 0 : -1;
|
|
1508
1545
|
}
|
|
1509
|
-
function
|
|
1546
|
+
function _t(o, t) {
|
|
1510
1547
|
return o.length === 0 ? -1 : t > 0 ? o.length - 1 : 0;
|
|
1511
1548
|
}
|
|
1512
1549
|
export {
|
|
1513
|
-
|
|
1514
|
-
|
|
1550
|
+
K as ActiveDescendantController,
|
|
1551
|
+
J as AnchorController,
|
|
1515
1552
|
q as DragController,
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1553
|
+
A as DragGestureController,
|
|
1554
|
+
x as ItemsCollectionController,
|
|
1555
|
+
Z as MutationObserverController,
|
|
1556
|
+
ot as NativeChildController,
|
|
1557
|
+
tt as NavigationIndicatorController,
|
|
1558
|
+
et as RafScheduler,
|
|
1559
|
+
G as ResizeController,
|
|
1560
|
+
rt as RovingTabIndexMixin,
|
|
1561
|
+
Q as ScrollObserverController,
|
|
1562
|
+
it as TypeaheadController,
|
|
1563
|
+
_t as findExtremeSnapIndex,
|
|
1564
|
+
st as findNearestScrollAncestor,
|
|
1565
|
+
lt as findNearestSnapIndex,
|
|
1566
|
+
ct as findNextSnapIndex,
|
|
1567
|
+
F as getDirectChild,
|
|
1568
|
+
O as getDirectChildren,
|
|
1569
|
+
$ as isFocusable,
|
|
1570
|
+
V as keyInteraction,
|
|
1571
|
+
U as keyNavigation,
|
|
1535
1572
|
j as mouseMove,
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1573
|
+
I as pinElementBox,
|
|
1574
|
+
at as snapToStep,
|
|
1575
|
+
ht as valueToPercent,
|
|
1576
|
+
nt as warnMissingDirectChild
|
|
1540
1577
|
};
|