@zag-js/number-input 0.1.10 → 0.1.13

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 CHANGED
@@ -1,25 +1,8 @@
1
1
  "use strict";
2
2
  var __defProp = Object.defineProperty;
3
- var __defProps = Object.defineProperties;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
10
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11
- var __spreadValues = (a, b) => {
12
- for (var prop in b || (b = {}))
13
- if (__hasOwnProp.call(b, prop))
14
- __defNormalProp(a, prop, b[prop]);
15
- if (__getOwnPropSymbols)
16
- for (var prop of __getOwnPropSymbols(b)) {
17
- if (__propIsEnum.call(b, prop))
18
- __defNormalProp(a, prop, b[prop]);
19
- }
20
- return a;
21
- };
22
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
23
6
  var __export = (target, all) => {
24
7
  for (var name in all)
25
8
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -49,36 +32,70 @@ var dataAttr = (guard) => {
49
32
  var ariaAttr = (guard) => {
50
33
  return guard ? "true" : void 0;
51
34
  };
52
- var hasProp = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
35
+ var MAX_Z_INDEX = 2147483647;
53
36
  var runIfFn = (v, ...a) => {
54
37
  const res = typeof v === "function" ? v(...a) : v;
55
- return res != null ? res : void 0;
38
+ return res ?? void 0;
56
39
  };
57
- var noop = () => {
40
+ var callAll = (...fns) => (...a) => {
41
+ fns.forEach(function(fn) {
42
+ fn == null ? void 0 : fn(...a);
43
+ });
58
44
  };
59
- var pipe = (...fns) => (v) => fns.reduce((a, b) => b(a), v);
60
- var isRef = (v) => hasProp(v, "current");
61
- function addDomEvent(target, eventName, handler, options) {
62
- const node = isRef(target) ? target.current : runIfFn(target);
63
- node == null ? void 0 : node.addEventListener(eventName, handler, options);
64
- return () => {
65
- node == null ? void 0 : node.removeEventListener(eventName, handler, options);
66
- };
45
+ var isArray = (v) => Array.isArray(v);
46
+ var isObject = (v) => !(v == null || typeof v !== "object" || isArray(v));
47
+ var hasProp = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
48
+ var isDom = () => typeof window !== "undefined";
49
+ function getPlatform() {
50
+ const agent = navigator.userAgentData;
51
+ return (agent == null ? void 0 : agent.platform) ?? navigator.platform;
67
52
  }
68
- function raf(fn) {
69
- const id = globalThis.requestAnimationFrame(fn);
70
- return function cleanup() {
71
- globalThis.cancelAnimationFrame(id);
53
+ var pt = (v) => isDom() && v.test(getPlatform());
54
+ var vn = (v) => isDom() && v.test(navigator.vendor);
55
+ var isTouchDevice = () => isDom() && !!navigator.maxTouchPoints;
56
+ var isMac = () => pt(/^Mac/) && !isTouchDevice;
57
+ var isSafari = () => isApple() && vn(/apple/i);
58
+ var isApple = () => pt(/mac|iphone|ipad|ipod/i);
59
+ var isIos = () => isApple() && !isMac();
60
+ function isDocument(el) {
61
+ return el.nodeType === Node.DOCUMENT_NODE;
62
+ }
63
+ function isWindow(value) {
64
+ return (value == null ? void 0 : value.toString()) === "[object Window]";
65
+ }
66
+ function getDocument(el) {
67
+ if (isWindow(el))
68
+ return el.document;
69
+ if (isDocument(el))
70
+ return el;
71
+ return (el == null ? void 0 : el.ownerDocument) ?? document;
72
+ }
73
+ function defineDomHelpers(helpers) {
74
+ const dom2 = {
75
+ getRootNode: (ctx) => {
76
+ var _a;
77
+ return ((_a = ctx.getRootNode) == null ? void 0 : _a.call(ctx)) ?? document;
78
+ },
79
+ getDoc: (ctx) => getDocument(dom2.getRootNode(ctx)),
80
+ getWin: (ctx) => dom2.getDoc(ctx).defaultView ?? window,
81
+ getActiveElement: (ctx) => dom2.getDoc(ctx).activeElement,
82
+ getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id)
83
+ };
84
+ return {
85
+ ...dom2,
86
+ ...helpers
72
87
  };
73
88
  }
74
- var MAX_Z_INDEX = 2147483647;
75
89
  function getNativeEvent(e) {
76
- var _a;
77
- return (_a = e.nativeEvent) != null ? _a : e;
90
+ return e.nativeEvent ?? e;
78
91
  }
92
+ var supportsPointerEvent = () => isDom() && window.onpointerdown === null;
93
+ var isTouchEvent = (v) => isObject(v) && hasProp(v, "touches");
94
+ var isLeftClick = (v) => v.button === 0;
95
+ var isModifiedEvent = (v) => v.ctrlKey || v.altKey || v.metaKey;
79
96
  function observeAttributes(node, attributes, fn) {
80
97
  if (!node)
81
- return noop;
98
+ return;
82
99
  const attrs = Array.isArray(attributes) ? attributes : [attributes];
83
100
  const win = node.ownerDocument.defaultView || window;
84
101
  const obs = new win.MutationObserver((changes) => {
@@ -91,6 +108,16 @@ function observeAttributes(node, attributes, fn) {
91
108
  obs.observe(node, { attributes: true, attributeFilter: attrs });
92
109
  return () => obs.disconnect();
93
110
  }
111
+ var fallback = {
112
+ pageX: 0,
113
+ pageY: 0,
114
+ clientX: 0,
115
+ clientY: 0
116
+ };
117
+ function getEventPoint(event, type = "page") {
118
+ const point = isTouchEvent(event) ? event.touches[0] ?? event.changedTouches[0] ?? fallback : event;
119
+ return { x: point[`${type}X`], y: point[`${type}Y`] };
120
+ }
94
121
  var PAGE_KEYS = /* @__PURE__ */ new Set(["PageUp", "PageDown"]);
95
122
  var ARROW_KEYS = /* @__PURE__ */ new Set(["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"]);
96
123
  function getEventStep(event) {
@@ -102,6 +129,20 @@ function getEventStep(event) {
102
129
  return isSkipKey ? 10 : 1;
103
130
  }
104
131
  }
132
+ var isRef = (v) => hasProp(v, "current");
133
+ function addDomEvent(target, eventName, handler, options) {
134
+ const node = isRef(target) ? target.current : runIfFn(target);
135
+ node == null ? void 0 : node.addEventListener(eventName, handler, options);
136
+ return () => {
137
+ node == null ? void 0 : node.removeEventListener(eventName, handler, options);
138
+ };
139
+ }
140
+ function raf(fn) {
141
+ const id = globalThis.requestAnimationFrame(fn);
142
+ return function cleanup() {
143
+ globalThis.cancelAnimationFrame(id);
144
+ };
145
+ }
105
146
  function addPointerlockChangeListener(doc, fn) {
106
147
  return addDomEvent(doc, "pointerlockchange", fn, false);
107
148
  }
@@ -134,7 +175,7 @@ function requestPointerLock(doc, handlers = {}) {
134
175
  if (!supported)
135
176
  return;
136
177
  body.requestPointerLock();
137
- const cleanup = pipe(addPointerlockChangeListener(doc, onPointerChange), addPointerlockErrorListener(doc, onPointerError));
178
+ const cleanup = callAll(addPointerlockChangeListener(doc, onPointerChange), addPointerlockErrorListener(doc, onPointerError));
138
179
  return function dispose() {
139
180
  if (!supported)
140
181
  return;
@@ -144,7 +185,6 @@ function requestPointerLock(doc, handlers = {}) {
144
185
  }
145
186
 
146
187
  // ../../utilities/number/dist/index.mjs
147
- var __pow = Math.pow;
148
188
  function wrap(num, max) {
149
189
  return (num % max + max) % max;
150
190
  }
@@ -198,7 +238,7 @@ function isWithinRange(v, o) {
198
238
  function decimalOperation(a, op, b) {
199
239
  let result = op === "+" ? a + b : a - b;
200
240
  if (a % 1 !== 0 || b % 1 !== 0) {
201
- const multiplier = __pow(10, Math.max(countDecimals(a), countDecimals(b)));
241
+ const multiplier = 10 ** Math.max(countDecimals(a), countDecimals(b));
202
242
  a = Math.round(a * multiplier);
203
243
  b = Math.round(b * multiplier);
204
244
  result = op === "+" ? a + b : a - b;
@@ -208,89 +248,37 @@ function decimalOperation(a, op, b) {
208
248
  }
209
249
  var nf = new Intl.NumberFormat("en-US", { style: "decimal", maximumFractionDigits: 20 });
210
250
 
211
- // ../../utilities/rect/dist/index.mjs
212
- var isArray = (v) => Array.isArray(v);
213
- var isObject = (v) => !(v == null || typeof v !== "object" || isArray(v));
214
- var hasProp2 = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
215
- var isTouchEvent = (v) => isObject(v) && hasProp2(v, "touches");
216
- var fallback = { pageX: 0, pageY: 0, clientX: 0, clientY: 0 };
217
- function getEventPoint(e, t = "page") {
218
- const p = isTouchEvent(e) ? e.touches[0] || e.changedTouches[0] || fallback : e;
219
- return { x: p[`${t}X`], y: p[`${t}Y`] };
220
- }
221
-
222
- // ../../types/dist/index.mjs
223
- function createNormalizer(fn) {
224
- return new Proxy({}, {
225
- get() {
226
- return fn;
227
- }
228
- });
229
- }
230
- var normalizeProp = createNormalizer((v) => v);
231
-
232
- // ../../utilities/core/dist/index.mjs
233
- var isDom = () => typeof window !== "undefined";
234
- function getPlatform() {
235
- var _a;
236
- const agent = navigator.userAgentData;
237
- return (_a = agent == null ? void 0 : agent.platform) != null ? _a : navigator.platform;
238
- }
239
- var pt = (v) => isDom() && v.test(getPlatform());
240
- var vn = (v) => isDom() && v.test(navigator.vendor);
241
- var isTouchDevice = () => isDom() && !!navigator.maxTouchPoints;
242
- var isMac = () => pt(/^Mac/) && !isTouchDevice;
243
- var isSafari = () => isApple() && vn(/apple/i);
244
- var isApple = () => pt(/mac|iphone|ipad|ipod/i);
245
- var isIos = () => isApple() && !isMac();
246
- var supportsPointerEvent = () => isDom() && window.onpointerdown === null;
247
- var isLeftClick = (v) => v.button === 0;
248
- var isModifiedEvent = (v) => v.ctrlKey || v.altKey || v.metaKey;
249
- var pipe2 = (...fns) => (v) => fns.reduce((a, b) => b(a), v);
250
-
251
251
  // src/number-input.dom.ts
252
- var dom = {
253
- getDoc: (ctx) => {
254
- var _a;
255
- return (_a = ctx.doc) != null ? _a : document;
256
- },
257
- getWin: (ctx) => {
258
- var _a;
259
- return (_a = dom.getDoc(ctx).defaultView) != null ? _a : window;
260
- },
261
- getRootNode: (ctx) => {
262
- var _a;
263
- return (_a = ctx.rootNode) != null ? _a : dom.getDoc(ctx);
264
- },
252
+ var dom = defineDomHelpers({
265
253
  getRootId: (ctx) => {
266
- var _a, _b;
267
- return (_b = (_a = ctx.ids) == null ? void 0 : _a.root) != null ? _b : `number-input:${ctx.uid}`;
254
+ var _a;
255
+ return ((_a = ctx.ids) == null ? void 0 : _a.root) ?? `number-input:${ctx.id}`;
268
256
  },
269
257
  getInputId: (ctx) => {
270
- var _a, _b;
271
- return (_b = (_a = ctx.ids) == null ? void 0 : _a.input) != null ? _b : `number-input:${ctx.uid}:input`;
258
+ var _a;
259
+ return ((_a = ctx.ids) == null ? void 0 : _a.input) ?? `number-input:${ctx.id}:input`;
272
260
  },
273
261
  getIncButtonId: (ctx) => {
274
- var _a, _b;
275
- return (_b = (_a = ctx.ids) == null ? void 0 : _a.incBtn) != null ? _b : `number-input:${ctx.uid}:inc-btn`;
262
+ var _a;
263
+ return ((_a = ctx.ids) == null ? void 0 : _a.incBtn) ?? `number-input:${ctx.id}:inc-btn`;
276
264
  },
277
265
  getDecButtonId: (ctx) => {
278
- var _a, _b;
279
- return (_b = (_a = ctx.ids) == null ? void 0 : _a.decBtn) != null ? _b : `number-input:${ctx.uid}:dec-btn`;
266
+ var _a;
267
+ return ((_a = ctx.ids) == null ? void 0 : _a.decBtn) ?? `number-input:${ctx.id}:dec-btn`;
280
268
  },
281
269
  getScrubberId: (ctx) => {
282
- var _a, _b;
283
- return (_b = (_a = ctx.ids) == null ? void 0 : _a.scrubber) != null ? _b : `number-input:${ctx.uid}:scrubber`;
270
+ var _a;
271
+ return ((_a = ctx.ids) == null ? void 0 : _a.scrubber) ?? `number-input:${ctx.id}:scrubber`;
284
272
  },
285
- getCursorId: (ctx) => `number-input:${ctx.uid}:cursor`,
273
+ getCursorId: (ctx) => `number-input:${ctx.id}:cursor`,
286
274
  getLabelId: (ctx) => {
287
- var _a, _b;
288
- return (_b = (_a = ctx.ids) == null ? void 0 : _a.label) != null ? _b : `number-input:${ctx.uid}:label`;
275
+ var _a;
276
+ return ((_a = ctx.ids) == null ? void 0 : _a.label) ?? `number-input:${ctx.id}:label`;
289
277
  },
290
- getInputEl: (ctx) => dom.getRootNode(ctx).getElementById(dom.getInputId(ctx)),
291
- getIncButtonEl: (ctx) => dom.getRootNode(ctx).getElementById(dom.getIncButtonId(ctx)),
292
- getDecButtonEl: (ctx) => dom.getRootNode(ctx).getElementById(dom.getDecButtonId(ctx)),
293
- getScrubberEl: (ctx) => dom.getRootNode(ctx).getElementById(dom.getScrubberId(ctx)),
278
+ getInputEl: (ctx) => dom.getById(ctx, dom.getInputId(ctx)),
279
+ getIncButtonEl: (ctx) => dom.getById(ctx, dom.getIncButtonId(ctx)),
280
+ getDecButtonEl: (ctx) => dom.getById(ctx, dom.getDecButtonId(ctx)),
281
+ getScrubberEl: (ctx) => dom.getById(ctx, dom.getScrubberId(ctx)),
294
282
  getCursorEl: (ctx) => dom.getDoc(ctx).getElementById(dom.getCursorId(ctx)),
295
283
  getMousementValue(ctx, event) {
296
284
  const x = roundToDevicePixel(event.movementX);
@@ -335,44 +323,43 @@ var dom = {
335
323
  </svg>`;
336
324
  doc.body.appendChild(el);
337
325
  }
338
- };
326
+ });
339
327
 
340
328
  // src/number-input.utils.ts
341
329
  var utils = {
342
330
  isValidNumericEvent: (ctx, event) => {
343
- var _a, _b;
331
+ var _a;
344
332
  if (event.key == null)
345
333
  return true;
346
334
  const isModifier = isModifiedEvent(event);
347
335
  const isSingleKey = event.key.length === 1;
348
336
  if (isModifier || !isSingleKey)
349
337
  return true;
350
- return (_b = (_a = ctx.validateCharacter) == null ? void 0 : _a.call(ctx, event.key)) != null ? _b : utils.isFloatingPoint(event.key);
338
+ return ((_a = ctx.validateCharacter) == null ? void 0 : _a.call(ctx, event.key)) ?? utils.isFloatingPoint(event.key);
351
339
  },
352
340
  isFloatingPoint: (v) => /^[Ee0-9+\-.]$/.test(v),
353
341
  sanitize: (ctx, value) => {
354
- var _a;
355
- return value.split("").filter((_a = ctx.validateCharacter) != null ? _a : utils.isFloatingPoint).join("");
342
+ return value.split("").filter(ctx.validateCharacter ?? utils.isFloatingPoint).join("");
356
343
  },
357
344
  increment: (ctx, step) => {
358
- const value = increment(ctx.value, step != null ? step : ctx.step);
345
+ const value = increment(ctx.value, step ?? ctx.step);
359
346
  return formatDecimal(clamp(value, ctx), ctx);
360
347
  },
361
348
  decrement: (ctx, step) => {
362
- const value = decrement(ctx.value, step != null ? step : ctx.step);
349
+ const value = decrement(ctx.value, step ?? ctx.step);
363
350
  return formatDecimal(clamp(value, ctx), ctx);
364
351
  },
365
352
  clamp: (ctx) => {
366
353
  return formatDecimal(clamp(ctx.value, ctx), ctx);
367
354
  },
368
355
  parse: (ctx, value) => {
369
- var _a, _b;
370
- return (_b = (_a = ctx.parse) == null ? void 0 : _a.call(ctx, value)) != null ? _b : value;
356
+ var _a;
357
+ return ((_a = ctx.parse) == null ? void 0 : _a.call(ctx, value)) ?? value;
371
358
  },
372
359
  format: (ctx, value) => {
373
- var _a, _b;
360
+ var _a;
374
361
  const _val = value.toString();
375
- return (_b = (_a = ctx.format) == null ? void 0 : _a.call(ctx, _val)) != null ? _b : _val;
362
+ return ((_a = ctx.format) == null ? void 0 : _a.call(ctx, _val)) ?? _val;
376
363
  },
377
364
  round: (ctx) => {
378
365
  return formatDecimal(ctx.value, ctx);
@@ -380,16 +367,18 @@ var utils = {
380
367
  };
381
368
 
382
369
  // src/number-input.connect.ts
383
- function connect(state, send, normalize = normalizeProp) {
370
+ function connect(state, send, normalize) {
384
371
  const isFocused = state.hasTag("focus");
385
372
  const isInvalid = state.context.isOutOfRange || !!state.context.invalid;
386
373
  const isDisabled = !!state.context.disabled;
374
+ const isValueEmpty = state.context.isValueEmpty;
387
375
  const isIncrementDisabled = isDisabled || !state.context.canIncrement;
388
376
  const isDecrementDisabled = isDisabled || !state.context.canDecrement;
389
377
  const messages = state.context.messages;
390
378
  return {
391
379
  isFocused,
392
380
  isInvalid,
381
+ isValueEmpty,
393
382
  value: state.context.formattedValue,
394
383
  valueAsNumber: state.context.valueAsNumber,
395
384
  setValue(value) {
@@ -569,13 +558,21 @@ function connect(state, send, normalize = normalizeProp) {
569
558
 
570
559
  // src/number-input.machine.ts
571
560
  var import_core = require("@zag-js/core");
561
+
562
+ // ../../utilities/core/dist/index.mjs
563
+ var callAll2 = (...fns) => (...a) => {
564
+ fns.forEach(function(fn) {
565
+ fn == null ? void 0 : fn(...a);
566
+ });
567
+ };
568
+
569
+ // src/number-input.machine.ts
572
570
  var { not, and } = import_core.guards;
573
- function machine(ctx = {}) {
571
+ function machine(ctx) {
574
572
  return (0, import_core.createMachine)({
575
573
  id: "number-input",
576
574
  initial: "unknown",
577
- context: __spreadProps(__spreadValues({
578
- uid: "",
575
+ context: {
579
576
  dir: "ltr",
580
577
  focusInputOnChange: true,
581
578
  clampValueOnBlur: true,
@@ -588,19 +585,21 @@ function machine(ctx = {}) {
588
585
  min: Number.MIN_SAFE_INTEGER,
589
586
  max: Number.MAX_SAFE_INTEGER,
590
587
  scrubberCursorPoint: null,
591
- invalid: false
592
- }, ctx), {
593
- messages: __spreadValues({
588
+ invalid: false,
589
+ ...ctx,
590
+ messages: {
594
591
  incrementLabel: "increment value",
595
- decrementLabel: "decrease value"
596
- }, ctx.messages)
597
- }),
592
+ decrementLabel: "decrease value",
593
+ ...ctx.messages
594
+ }
595
+ },
598
596
  computed: {
599
597
  isRtl: (ctx2) => ctx2.dir === "rtl",
600
598
  valueAsNumber: (ctx2) => valueOf(ctx2.value),
601
599
  isAtMin: (ctx2) => isAtMin(ctx2.value, ctx2),
602
600
  isAtMax: (ctx2) => isAtMax(ctx2.value, ctx2),
603
601
  isOutOfRange: (ctx2) => !isWithinRange(ctx2.value, ctx2),
602
+ isValueEmpty: (ctx2) => ctx2.value === "",
604
603
  canIncrement: (ctx2) => ctx2.allowOverflow || !ctx2.isAtMax,
605
604
  canDecrement: (ctx2) => ctx2.allowOverflow || !ctx2.isAtMin,
606
605
  valueText: (ctx2) => {
@@ -608,8 +607,8 @@ function machine(ctx = {}) {
608
607
  return (_b = (_a = ctx2.messages).valueText) == null ? void 0 : _b.call(_a, ctx2.value);
609
608
  },
610
609
  formattedValue: (ctx2) => {
611
- var _a, _b;
612
- return (_b = (_a = ctx2.format) == null ? void 0 : _a.call(ctx2, ctx2.value).toString()) != null ? _b : ctx2.value;
610
+ var _a;
611
+ return ((_a = ctx2.format) == null ? void 0 : _a.call(ctx2, ctx2.value).toString()) ?? ctx2.value;
613
612
  }
614
613
  },
615
614
  watch: {
@@ -635,7 +634,7 @@ function machine(ctx = {}) {
635
634
  on: {
636
635
  SETUP: {
637
636
  target: "idle",
638
- actions: ["setupDocument", "syncInputValue"]
637
+ actions: "syncInputValue"
639
638
  }
640
639
  }
641
640
  },
@@ -687,7 +686,7 @@ function machine(ctx = {}) {
687
686
  actions: ["clearValue", "clearHint"]
688
687
  },
689
688
  {
690
- guard: and("clampOnBlur", not("isInRange")),
689
+ guard: and("clampOnBlur", not("isInRange"), not("isEmptyValue")),
691
690
  target: "idle",
692
691
  actions: ["clampValue", "clearHint"]
693
692
  },
@@ -773,14 +772,9 @@ function machine(ctx = {}) {
773
772
  isAtMin: (ctx2) => ctx2.isAtMin,
774
773
  isAtMax: (ctx2) => ctx2.isAtMax,
775
774
  isInRange: (ctx2) => !ctx2.isOutOfRange,
776
- isDecrementHint: (ctx2, evt) => {
777
- var _a;
778
- return ((_a = evt.hint) != null ? _a : ctx2.hint) === "decrement";
779
- },
780
- isIncrementHint: (ctx2, evt) => {
781
- var _a;
782
- return ((_a = evt.hint) != null ? _a : ctx2.hint) === "increment";
783
- },
775
+ isDecrementHint: (ctx2, evt) => (evt.hint ?? ctx2.hint) === "decrement",
776
+ isEmptyValue: (ctx2) => ctx2.isValueEmpty,
777
+ isIncrementHint: (ctx2, evt) => (evt.hint ?? ctx2.hint) === "increment",
784
778
  isInvalidExponential: (ctx2) => ctx2.value.toString().startsWith("e")
785
779
  },
786
780
  activities: {
@@ -836,17 +830,10 @@ function machine(ctx = {}) {
836
830
  function onMouseup() {
837
831
  send("POINTER_UP_SCRUBBER");
838
832
  }
839
- return pipe2(addDomEvent(doc, "mousemove", onMousemove, false), addDomEvent(doc, "mouseup", onMouseup, false));
833
+ return callAll2(addDomEvent(doc, "mousemove", onMousemove, false), addDomEvent(doc, "mouseup", onMouseup, false));
840
834
  }
841
835
  },
842
836
  actions: {
843
- setupDocument: (ctx2, evt) => {
844
- if (evt.doc)
845
- ctx2.doc = (0, import_core.ref)(evt.doc);
846
- if (evt.root)
847
- ctx2.rootNode = (0, import_core.ref)(evt.root);
848
- ctx2.uid = evt.id;
849
- },
850
837
  focusInput(ctx2) {
851
838
  if (!ctx2.focusInputOnChange)
852
839
  return;
@@ -868,9 +855,9 @@ function machine(ctx = {}) {
868
855
  }
869
856
  },
870
857
  setValue(ctx2, evt) {
871
- var _a, _b;
872
- const value = (_b = (_a = evt.target) == null ? void 0 : _a.value) != null ? _b : evt.value;
873
- ctx2.value = utils.sanitize(ctx2, utils.parse(ctx2, value));
858
+ var _a;
859
+ const value = ((_a = evt.target) == null ? void 0 : _a.value) ?? evt.value;
860
+ ctx2.value = utils.sanitize(ctx2, utils.parse(ctx2, value.toString()));
874
861
  },
875
862
  clearValue(ctx2) {
876
863
  ctx2.value = "";
@@ -955,3 +942,8 @@ function machine(ctx = {}) {
955
942
  hookSync: true
956
943
  });
957
944
  }
945
+ // Annotate the CommonJS export names for ESM import in node:
946
+ 0 && (module.exports = {
947
+ connect,
948
+ machine
949
+ });