@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.mjs
CHANGED
|
@@ -295,30 +295,6 @@ function getEventStep(event) {
|
|
|
295
295
|
return isSkipKey ? 10 : 1;
|
|
296
296
|
}
|
|
297
297
|
}
|
|
298
|
-
function itemById(v, id) {
|
|
299
|
-
return v.find((node) => node.id === id);
|
|
300
|
-
}
|
|
301
|
-
function indexOfId(v, id) {
|
|
302
|
-
const item = itemById(v, id);
|
|
303
|
-
return item ? v.indexOf(item) : -1;
|
|
304
|
-
}
|
|
305
|
-
var getValueText = (item) => {
|
|
306
|
-
var _a, _b;
|
|
307
|
-
return (_b = (_a = item.dataset.valuetext) != null ? _a : item.textContent) != null ? _b : "";
|
|
308
|
-
};
|
|
309
|
-
var match = (valueText, query2) => valueText.toLowerCase().startsWith(query2.toLowerCase());
|
|
310
|
-
var wrap = (v, idx) => {
|
|
311
|
-
return v.map((_, index) => v[(Math.max(idx, 0) + index) % v.length]);
|
|
312
|
-
};
|
|
313
|
-
function findByText(v, text, currentId) {
|
|
314
|
-
const index = currentId ? indexOfId(v, currentId) : -1;
|
|
315
|
-
let items = currentId ? wrap(v, index) : v;
|
|
316
|
-
const isSingleKey = text.length === 1;
|
|
317
|
-
if (isSingleKey) {
|
|
318
|
-
items = items.filter((item) => item.id !== currentId);
|
|
319
|
-
}
|
|
320
|
-
return items.find((item) => match(getValueText(item), text));
|
|
321
|
-
}
|
|
322
298
|
var state = "default";
|
|
323
299
|
var savedUserSelect = "";
|
|
324
300
|
var modifiedElementMap = /* @__PURE__ */ new WeakMap();
|
|
@@ -382,34 +358,6 @@ function trackPointerMove(opts) {
|
|
|
382
358
|
};
|
|
383
359
|
return pipe(addPointerEvent(doc, "pointermove", handlePointerMove, false), addPointerEvent(doc, "pointerup", onPointerUp, false), addPointerEvent(doc, "pointercancel", onPointerUp, false), addPointerEvent(doc, "contextmenu", onPointerUp, false), disableTextSelection({ doc }));
|
|
384
360
|
}
|
|
385
|
-
function findByTypeahead(_items, options) {
|
|
386
|
-
const { state: state2, activeId, key, timeout = 350 } = options;
|
|
387
|
-
const search = state2.keysSoFar + key;
|
|
388
|
-
const isRepeated = search.length > 1 && Array.from(search).every((char) => char === search[0]);
|
|
389
|
-
const query2 = isRepeated ? search[0] : search;
|
|
390
|
-
let items = _items.slice();
|
|
391
|
-
const next = findByText(items, query2, activeId);
|
|
392
|
-
function cleanup() {
|
|
393
|
-
clearTimeout(state2.timer);
|
|
394
|
-
state2.timer = -1;
|
|
395
|
-
}
|
|
396
|
-
function update(value) {
|
|
397
|
-
state2.keysSoFar = value;
|
|
398
|
-
cleanup();
|
|
399
|
-
if (value !== "") {
|
|
400
|
-
state2.timer = +setTimeout(() => {
|
|
401
|
-
update("");
|
|
402
|
-
cleanup();
|
|
403
|
-
}, timeout);
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
update(search);
|
|
407
|
-
return next;
|
|
408
|
-
}
|
|
409
|
-
findByTypeahead.defaultOptions = {
|
|
410
|
-
keysSoFar: "",
|
|
411
|
-
timer: -1
|
|
412
|
-
};
|
|
413
361
|
|
|
414
362
|
// ../../utilities/rect/dist/index.mjs
|
|
415
363
|
var isDom2 = () => typeof window !== "undefined";
|