@zag-js/number-input 0.0.0-dev-20230217074947 → 0.0.0-dev-20230221113221

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.
@@ -4,7 +4,7 @@ import {
4
4
  roundToDevicePixel,
5
5
  supportsPointerEvent,
6
6
  wrap
7
- } from "./chunk-EPCXXTFL.mjs";
7
+ } from "./chunk-VNG262MR.mjs";
8
8
 
9
9
  // ../../utilities/dom/src/constants.ts
10
10
  var MAX_Z_INDEX = 2147483647;
@@ -3,16 +3,16 @@ import {
3
3
  } from "./chunk-XHRILSH3.mjs";
4
4
  import {
5
5
  dom
6
- } from "./chunk-GQN3V2LU.mjs";
6
+ } from "./chunk-2R4UYFRG.mjs";
7
7
  import {
8
8
  utils
9
- } from "./chunk-6CS5P7OC.mjs";
9
+ } from "./chunk-T5KENC7Z.mjs";
10
10
  import {
11
11
  getNativeEvent,
12
12
  isLeftClick,
13
13
  isTouchEvent,
14
14
  roundToDevicePixel
15
- } from "./chunk-EPCXXTFL.mjs";
15
+ } from "./chunk-VNG262MR.mjs";
16
16
 
17
17
  // ../../utilities/dom/src/attrs.ts
18
18
  var dataAttr = (guard) => {
@@ -4,7 +4,7 @@ import {
4
4
  formatDecimal,
5
5
  increment,
6
6
  isModifiedEvent
7
- } from "./chunk-EPCXXTFL.mjs";
7
+ } from "./chunk-VNG262MR.mjs";
8
8
 
9
9
  // src/number-input.utils.ts
10
10
  var utils = {
@@ -32,7 +32,13 @@ function defineDomHelpers(helpers) {
32
32
  getDoc: (ctx) => getDocument(dom.getRootNode(ctx)),
33
33
  getWin: (ctx) => dom.getDoc(ctx).defaultView ?? window,
34
34
  getActiveElement: (ctx) => dom.getDoc(ctx).activeElement,
35
- getById: (ctx, id) => dom.getRootNode(ctx).getElementById(id)
35
+ getById: (ctx, id) => dom.getRootNode(ctx).getElementById(id),
36
+ queryById: (ctx, id) => {
37
+ const el = dom.getById(ctx, id);
38
+ if (!el)
39
+ throw new Error(`Element with id "${id}" not found.`);
40
+ return el;
41
+ }
36
42
  };
37
43
  return {
38
44
  ...dom,
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  dom
3
- } from "./chunk-GQN3V2LU.mjs";
3
+ } from "./chunk-2R4UYFRG.mjs";
4
4
  import {
5
5
  utils
6
- } from "./chunk-6CS5P7OC.mjs";
6
+ } from "./chunk-T5KENC7Z.mjs";
7
7
  import {
8
8
  getWindow,
9
9
  hasProp,
@@ -14,7 +14,7 @@ import {
14
14
  isWithinRange,
15
15
  supportsPointerEvent,
16
16
  valueOf
17
- } from "./chunk-EPCXXTFL.mjs";
17
+ } from "./chunk-VNG262MR.mjs";
18
18
 
19
19
  // src/number-input.machine.ts
20
20
  import { choose, createMachine, guards } from "@zag-js/core";
package/dist/index.js CHANGED
@@ -109,7 +109,13 @@ function defineDomHelpers(helpers) {
109
109
  getDoc: (ctx) => getDocument(dom2.getRootNode(ctx)),
110
110
  getWin: (ctx) => dom2.getDoc(ctx).defaultView ?? window,
111
111
  getActiveElement: (ctx) => dom2.getDoc(ctx).activeElement,
112
- getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id)
112
+ getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id),
113
+ queryById: (ctx, id) => {
114
+ const el = dom2.getById(ctx, id);
115
+ if (!el)
116
+ throw new Error(`Element with id "${id}" not found.`);
117
+ return el;
118
+ }
113
119
  };
114
120
  return {
115
121
  ...dom2,
package/dist/index.mjs CHANGED
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  connect
3
- } from "./chunk-4ASBTBA5.mjs";
3
+ } from "./chunk-HHNXW4VB.mjs";
4
4
  import {
5
5
  anatomy
6
6
  } from "./chunk-XHRILSH3.mjs";
7
7
  import {
8
8
  machine
9
- } from "./chunk-7Q7LBLXZ.mjs";
10
- import "./chunk-GQN3V2LU.mjs";
11
- import "./chunk-6CS5P7OC.mjs";
12
- import "./chunk-EPCXXTFL.mjs";
9
+ } from "./chunk-XD7R2NE6.mjs";
10
+ import "./chunk-2R4UYFRG.mjs";
11
+ import "./chunk-T5KENC7Z.mjs";
12
+ import "./chunk-VNG262MR.mjs";
13
13
  export {
14
14
  anatomy,
15
15
  connect,
@@ -71,7 +71,13 @@ function defineDomHelpers(helpers) {
71
71
  getDoc: (ctx) => getDocument(dom2.getRootNode(ctx)),
72
72
  getWin: (ctx) => dom2.getDoc(ctx).defaultView ?? window,
73
73
  getActiveElement: (ctx) => dom2.getDoc(ctx).activeElement,
74
- getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id)
74
+ getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id),
75
+ queryById: (ctx, id) => {
76
+ const el = dom2.getById(ctx, id);
77
+ if (!el)
78
+ throw new Error(`Element with id "${id}" not found.`);
79
+ return el;
80
+ }
75
81
  };
76
82
  return {
77
83
  ...dom2,
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  connect
3
- } from "./chunk-4ASBTBA5.mjs";
3
+ } from "./chunk-HHNXW4VB.mjs";
4
4
  import "./chunk-XHRILSH3.mjs";
5
- import "./chunk-GQN3V2LU.mjs";
6
- import "./chunk-6CS5P7OC.mjs";
7
- import "./chunk-EPCXXTFL.mjs";
5
+ import "./chunk-2R4UYFRG.mjs";
6
+ import "./chunk-T5KENC7Z.mjs";
7
+ import "./chunk-VNG262MR.mjs";
8
8
  export {
9
9
  connect
10
10
  };
@@ -18,6 +18,9 @@ declare const dom: {
18
18
  getById: <T = HTMLElement>(ctx: {
19
19
  getRootNode?: (() => Node | Document | ShadowRoot) | undefined;
20
20
  }, id: string) => T | null;
21
+ queryById: <T_1 = HTMLElement>(ctx: {
22
+ getRootNode?: (() => Node | Document | ShadowRoot) | undefined;
23
+ }, id: string) => T_1;
21
24
  } & {
22
25
  getRootId: (ctx: MachineContext) => string;
23
26
  getInputId: (ctx: MachineContext) => string;
@@ -58,7 +58,13 @@ function defineDomHelpers(helpers) {
58
58
  getDoc: (ctx) => getDocument(dom2.getRootNode(ctx)),
59
59
  getWin: (ctx) => dom2.getDoc(ctx).defaultView ?? window,
60
60
  getActiveElement: (ctx) => dom2.getDoc(ctx).activeElement,
61
- getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id)
61
+ getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id),
62
+ queryById: (ctx, id) => {
63
+ const el = dom2.getById(ctx, id);
64
+ if (!el)
65
+ throw new Error(`Element with id "${id}" not found.`);
66
+ return el;
67
+ }
62
68
  };
63
69
  return {
64
70
  ...dom2,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  dom
3
- } from "./chunk-GQN3V2LU.mjs";
4
- import "./chunk-EPCXXTFL.mjs";
3
+ } from "./chunk-2R4UYFRG.mjs";
4
+ import "./chunk-VNG262MR.mjs";
5
5
  export {
6
6
  dom
7
7
  };
@@ -87,7 +87,13 @@ function defineDomHelpers(helpers) {
87
87
  getDoc: (ctx) => getDocument(dom2.getRootNode(ctx)),
88
88
  getWin: (ctx) => dom2.getDoc(ctx).defaultView ?? window,
89
89
  getActiveElement: (ctx) => dom2.getDoc(ctx).activeElement,
90
- getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id)
90
+ getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id),
91
+ queryById: (ctx, id) => {
92
+ const el = dom2.getById(ctx, id);
93
+ if (!el)
94
+ throw new Error(`Element with id "${id}" not found.`);
95
+ return el;
96
+ }
91
97
  };
92
98
  return {
93
99
  ...dom2,
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  machine
3
- } from "./chunk-7Q7LBLXZ.mjs";
4
- import "./chunk-GQN3V2LU.mjs";
5
- import "./chunk-6CS5P7OC.mjs";
6
- import "./chunk-EPCXXTFL.mjs";
3
+ } from "./chunk-XD7R2NE6.mjs";
4
+ import "./chunk-2R4UYFRG.mjs";
5
+ import "./chunk-T5KENC7Z.mjs";
6
+ import "./chunk-VNG262MR.mjs";
7
7
  export {
8
8
  machine
9
9
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  utils
3
- } from "./chunk-6CS5P7OC.mjs";
4
- import "./chunk-EPCXXTFL.mjs";
3
+ } from "./chunk-T5KENC7Z.mjs";
4
+ import "./chunk-VNG262MR.mjs";
5
5
  export {
6
6
  utils
7
7
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/number-input",
3
- "version": "0.0.0-dev-20230217074947",
3
+ "version": "0.0.0-dev-20230221113221",
4
4
  "description": "Core logic for the number-input widget implemented as a state machine",
5
5
  "keywords": [
6
6
  "js",
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@zag-js/anatomy": "0.1.4",
30
- "@zag-js/core": "0.0.0-dev-20230217074947",
30
+ "@zag-js/core": "0.0.0-dev-20230221113221",
31
31
  "@zag-js/types": "0.3.4"
32
32
  },
33
33
  "devDependencies": {