@zag-js/number-input 0.0.0-dev-20220513103837 → 0.0.0-dev-20220514160702

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
@@ -370,6 +370,10 @@ var dom = {
370
370
  var _a;
371
371
  return (_a = dom.getDoc(ctx).defaultView) != null ? _a : window;
372
372
  },
373
+ getRootNode: (ctx) => {
374
+ var _a;
375
+ return (_a = ctx.rootNode) != null ? _a : dom.getDoc(ctx);
376
+ },
373
377
  getRootId: (ctx) => {
374
378
  var _a, _b;
375
379
  return (_b = (_a = ctx.ids) == null ? void 0 : _a.root) != null ? _b : `number-input:${ctx.uid}`;
@@ -395,11 +399,11 @@ var dom = {
395
399
  var _a, _b;
396
400
  return (_b = (_a = ctx.ids) == null ? void 0 : _a.label) != null ? _b : `number-input:${ctx.uid}:label`;
397
401
  },
398
- getInputEl: (ctx) => dom.getDoc(ctx).getElementById(dom.getInputId(ctx)),
399
- getIncButtonEl: (ctx) => dom.getDoc(ctx).getElementById(dom.getIncButtonId(ctx)),
400
- getDecButtonEl: (ctx) => dom.getDoc(ctx).getElementById(dom.getDecButtonId(ctx)),
401
- getScrubberEl: (ctx) => dom.getDoc(ctx).getElementById(dom.getScrubberId(ctx)),
402
- getCursorEl: (ctx) => dom.getDoc(ctx).getElementById(dom.getCursorId(ctx)),
402
+ getInputEl: (ctx) => dom.getRootNode(ctx).getElementById(dom.getInputId(ctx)),
403
+ getIncButtonEl: (ctx) => dom.getRootNode(ctx).getElementById(dom.getIncButtonId(ctx)),
404
+ getDecButtonEl: (ctx) => dom.getRootNode(ctx).getElementById(dom.getDecButtonId(ctx)),
405
+ getScrubberEl: (ctx) => dom.getRootNode(ctx).getElementById(dom.getScrubberId(ctx)),
406
+ getCursorEl: (ctx) => dom.getRootNode(ctx).getElementById(dom.getCursorId(ctx)),
403
407
  getMousementValue(ctx, event) {
404
408
  const x = roundToPx(event.movementX);
405
409
  const y = roundToPx(event.movementY);
@@ -944,6 +948,8 @@ function machine(ctx = {}) {
944
948
  setupDocument: (ctx2, evt) => {
945
949
  if (evt.doc)
946
950
  ctx2.doc = (0, import_core.ref)(evt.doc);
951
+ if (evt.root)
952
+ ctx2.rootNode = (0, import_core.ref)(evt.root);
947
953
  ctx2.uid = evt.id;
948
954
  },
949
955
  focusInput(ctx2) {