@zag-js/number-input 0.0.0-dev-20220605192656 → 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.mjs CHANGED
@@ -139,30 +139,6 @@ function getEventStep(event) {
139
139
  return isSkipKey ? 10 : 1;
140
140
  }
141
141
  }
142
- function itemById(v, id) {
143
- return v.find((node) => node.id === id);
144
- }
145
- function indexOfId(v, id) {
146
- const item = itemById(v, id);
147
- return item ? v.indexOf(item) : -1;
148
- }
149
- var getValueText = (item) => {
150
- var _a, _b;
151
- return (_b = (_a = item.dataset.valuetext) != null ? _a : item.textContent) != null ? _b : "";
152
- };
153
- var match = (valueText, query2) => valueText.toLowerCase().startsWith(query2.toLowerCase());
154
- var wrap = (v, idx) => {
155
- return v.map((_, index) => v[(Math.max(idx, 0) + index) % v.length]);
156
- };
157
- function findByText(v, text, currentId) {
158
- const index = currentId ? indexOfId(v, currentId) : -1;
159
- let items = currentId ? wrap(v, index) : v;
160
- const isSingleKey = text.length === 1;
161
- if (isSingleKey) {
162
- items = items.filter((item) => item.id !== currentId);
163
- }
164
- return items.find((item) => match(getValueText(item), text));
165
- }
166
142
  function addPointerlockChangeListener(doc, fn) {
167
143
  return addDomEvent(doc, "pointerlockchange", fn, false);
168
144
  }
@@ -203,38 +179,10 @@ function requestPointerLock(doc, handlers = {}) {
203
179
  exit();
204
180
  };
205
181
  }
206
- function findByTypeahead(_items, options) {
207
- const { state: state2, activeId, key, timeout = 350 } = options;
208
- const search = state2.keysSoFar + key;
209
- const isRepeated = search.length > 1 && Array.from(search).every((char) => char === search[0]);
210
- const query2 = isRepeated ? search[0] : search;
211
- let items = _items.slice();
212
- const next = findByText(items, query2, activeId);
213
- function cleanup() {
214
- clearTimeout(state2.timer);
215
- state2.timer = -1;
216
- }
217
- function update(value) {
218
- state2.keysSoFar = value;
219
- cleanup();
220
- if (value !== "") {
221
- state2.timer = +setTimeout(() => {
222
- update("");
223
- cleanup();
224
- }, timeout);
225
- }
226
- }
227
- update(search);
228
- return next;
229
- }
230
- findByTypeahead.defaultOptions = {
231
- keysSoFar: "",
232
- timer: -1
233
- };
234
182
 
235
183
  // ../../utilities/number/dist/index.mjs
236
184
  var __pow = Math.pow;
237
- function wrap2(num, max) {
185
+ function wrap(num, max) {
238
186
  return (num % max + max) % max;
239
187
  }
240
188
  function roundToDevicePixel(num) {
@@ -398,7 +346,7 @@ var dom = {
398
346
  const win = dom.getWin(ctx);
399
347
  const width = win.innerWidth;
400
348
  const half = roundToDevicePixel(7.5);
401
- point.x = wrap2(point.x + half, width) - half;
349
+ point.x = wrap(point.x + half, width) - half;
402
350
  return { hint, point };
403
351
  },
404
352
  createVirtualCursor(ctx) {