@zag-js/slider 0.0.0-dev-20220609054635 → 0.0.0-dev-20220612194202
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/dist/index.js +0 -52
- package/dist/index.js.map +2 -2
- package/dist/index.mjs +0 -52
- package/dist/index.mjs.map +2 -2
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -319,30 +319,6 @@ function getEventStep(event) {
|
|
|
319
319
|
return isSkipKey ? 10 : 1;
|
|
320
320
|
}
|
|
321
321
|
}
|
|
322
|
-
function itemById(v, id) {
|
|
323
|
-
return v.find((node) => node.id === id);
|
|
324
|
-
}
|
|
325
|
-
function indexOfId(v, id) {
|
|
326
|
-
const item = itemById(v, id);
|
|
327
|
-
return item ? v.indexOf(item) : -1;
|
|
328
|
-
}
|
|
329
|
-
var getValueText = (item) => {
|
|
330
|
-
var _a, _b;
|
|
331
|
-
return (_b = (_a = item.dataset.valuetext) != null ? _a : item.textContent) != null ? _b : "";
|
|
332
|
-
};
|
|
333
|
-
var match = (valueText, query2) => valueText.toLowerCase().startsWith(query2.toLowerCase());
|
|
334
|
-
var wrap = (v, idx) => {
|
|
335
|
-
return v.map((_, index) => v[(Math.max(idx, 0) + index) % v.length]);
|
|
336
|
-
};
|
|
337
|
-
function findByText(v, text, currentId) {
|
|
338
|
-
const index = currentId ? indexOfId(v, currentId) : -1;
|
|
339
|
-
let items = currentId ? wrap(v, index) : v;
|
|
340
|
-
const isSingleKey = text.length === 1;
|
|
341
|
-
if (isSingleKey) {
|
|
342
|
-
items = items.filter((item) => item.id !== currentId);
|
|
343
|
-
}
|
|
344
|
-
return items.find((item) => match(getValueText(item), text));
|
|
345
|
-
}
|
|
346
322
|
var state = "default";
|
|
347
323
|
var savedUserSelect = "";
|
|
348
324
|
var modifiedElementMap = /* @__PURE__ */ new WeakMap();
|
|
@@ -406,34 +382,6 @@ function trackPointerMove(opts) {
|
|
|
406
382
|
};
|
|
407
383
|
return pipe(addPointerEvent(doc, "pointermove", handlePointerMove, false), addPointerEvent(doc, "pointerup", onPointerUp, false), addPointerEvent(doc, "pointercancel", onPointerUp, false), addPointerEvent(doc, "contextmenu", onPointerUp, false), disableTextSelection({ doc }));
|
|
408
384
|
}
|
|
409
|
-
function findByTypeahead(_items, options) {
|
|
410
|
-
const { state: state2, activeId, key, timeout = 350 } = options;
|
|
411
|
-
const search = state2.keysSoFar + key;
|
|
412
|
-
const isRepeated = search.length > 1 && Array.from(search).every((char) => char === search[0]);
|
|
413
|
-
const query2 = isRepeated ? search[0] : search;
|
|
414
|
-
let items = _items.slice();
|
|
415
|
-
const next = findByText(items, query2, activeId);
|
|
416
|
-
function cleanup() {
|
|
417
|
-
clearTimeout(state2.timer);
|
|
418
|
-
state2.timer = -1;
|
|
419
|
-
}
|
|
420
|
-
function update(value) {
|
|
421
|
-
state2.keysSoFar = value;
|
|
422
|
-
cleanup();
|
|
423
|
-
if (value !== "") {
|
|
424
|
-
state2.timer = +setTimeout(() => {
|
|
425
|
-
update("");
|
|
426
|
-
cleanup();
|
|
427
|
-
}, timeout);
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
update(search);
|
|
431
|
-
return next;
|
|
432
|
-
}
|
|
433
|
-
findByTypeahead.defaultOptions = {
|
|
434
|
-
keysSoFar: "",
|
|
435
|
-
timer: -1
|
|
436
|
-
};
|
|
437
385
|
|
|
438
386
|
// ../../utilities/rect/dist/index.mjs
|
|
439
387
|
var isDom2 = () => typeof window !== "undefined";
|