@zag-js/pin-input 0.0.0-dev-20230220134212 → 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.
@@ -21,7 +21,13 @@ function defineDomHelpers(helpers) {
21
21
  getDoc: (ctx) => getDocument(dom2.getRootNode(ctx)),
22
22
  getWin: (ctx) => dom2.getDoc(ctx).defaultView ?? window,
23
23
  getActiveElement: (ctx) => dom2.getDoc(ctx).activeElement,
24
- getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id)
24
+ getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id),
25
+ queryById: (ctx, id) => {
26
+ const el = dom2.getById(ctx, id);
27
+ if (!el)
28
+ throw new Error(`Element with id "${id}" not found.`);
29
+ return el;
30
+ }
25
31
  };
26
32
  return {
27
33
  ...dom2,
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-BJXKBZJG.mjs";
4
4
  import {
5
5
  dom
6
- } from "./chunk-Y7IZ6OAH.mjs";
6
+ } from "./chunk-33MIXMUC.mjs";
7
7
 
8
8
  // ../../utilities/dom/src/attrs.ts
9
9
  var dataAttr = (guard) => {
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  dom,
6
6
  getWindow
7
- } from "./chunk-Y7IZ6OAH.mjs";
7
+ } from "./chunk-33MIXMUC.mjs";
8
8
 
9
9
  // src/pin-input.machine.ts
10
10
  import { createMachine, guards } from "@zag-js/core";
package/dist/index.js CHANGED
@@ -84,7 +84,13 @@ function defineDomHelpers(helpers) {
84
84
  getDoc: (ctx) => getDocument(dom2.getRootNode(ctx)),
85
85
  getWin: (ctx) => dom2.getDoc(ctx).defaultView ?? window,
86
86
  getActiveElement: (ctx) => dom2.getDoc(ctx).activeElement,
87
- getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id)
87
+ getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id),
88
+ queryById: (ctx, id) => {
89
+ const el = dom2.getById(ctx, id);
90
+ if (!el)
91
+ throw new Error(`Element with id "${id}" not found.`);
92
+ return el;
93
+ }
88
94
  };
89
95
  return {
90
96
  ...dom2,
package/dist/index.mjs CHANGED
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  connect
3
- } from "./chunk-IGE2OJGQ.mjs";
3
+ } from "./chunk-RRQHVZIR.mjs";
4
4
  import {
5
5
  anatomy
6
6
  } from "./chunk-BJXKBZJG.mjs";
7
7
  import {
8
8
  machine
9
- } from "./chunk-VZQYAAIE.mjs";
9
+ } from "./chunk-WLNKIOPV.mjs";
10
10
  import "./chunk-NT4W6JYX.mjs";
11
- import "./chunk-Y7IZ6OAH.mjs";
11
+ import "./chunk-33MIXMUC.mjs";
12
12
  export {
13
13
  anatomy,
14
14
  connect,
@@ -61,7 +61,13 @@ function defineDomHelpers(helpers) {
61
61
  getDoc: (ctx) => getDocument(dom2.getRootNode(ctx)),
62
62
  getWin: (ctx) => dom2.getDoc(ctx).defaultView ?? window,
63
63
  getActiveElement: (ctx) => dom2.getDoc(ctx).activeElement,
64
- getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id)
64
+ getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id),
65
+ queryById: (ctx, id) => {
66
+ const el = dom2.getById(ctx, id);
67
+ if (!el)
68
+ throw new Error(`Element with id "${id}" not found.`);
69
+ return el;
70
+ }
65
71
  };
66
72
  return {
67
73
  ...dom2,
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  connect
3
- } from "./chunk-IGE2OJGQ.mjs";
3
+ } from "./chunk-RRQHVZIR.mjs";
4
4
  import "./chunk-BJXKBZJG.mjs";
5
5
  import "./chunk-NT4W6JYX.mjs";
6
- import "./chunk-Y7IZ6OAH.mjs";
6
+ import "./chunk-33MIXMUC.mjs";
7
7
  export {
8
8
  connect
9
9
  };
@@ -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, id: string) => string;
@@ -44,7 +44,13 @@ function defineDomHelpers(helpers) {
44
44
  getDoc: (ctx) => getDocument(dom2.getRootNode(ctx)),
45
45
  getWin: (ctx) => dom2.getDoc(ctx).defaultView ?? window,
46
46
  getActiveElement: (ctx) => dom2.getDoc(ctx).activeElement,
47
- getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id)
47
+ getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id),
48
+ queryById: (ctx, id) => {
49
+ const el = dom2.getById(ctx, id);
50
+ if (!el)
51
+ throw new Error(`Element with id "${id}" not found.`);
52
+ return el;
53
+ }
48
54
  };
49
55
  return {
50
56
  ...dom2,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  dom
3
- } from "./chunk-Y7IZ6OAH.mjs";
3
+ } from "./chunk-33MIXMUC.mjs";
4
4
  export {
5
5
  dom
6
6
  };
@@ -61,7 +61,13 @@ function defineDomHelpers(helpers) {
61
61
  getDoc: (ctx) => getDocument(dom2.getRootNode(ctx)),
62
62
  getWin: (ctx) => dom2.getDoc(ctx).defaultView ?? window,
63
63
  getActiveElement: (ctx) => dom2.getDoc(ctx).activeElement,
64
- getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id)
64
+ getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id),
65
+ queryById: (ctx, id) => {
66
+ const el = dom2.getById(ctx, id);
67
+ if (!el)
68
+ throw new Error(`Element with id "${id}" not found.`);
69
+ return el;
70
+ }
65
71
  };
66
72
  return {
67
73
  ...dom2,
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  machine
3
- } from "./chunk-VZQYAAIE.mjs";
3
+ } from "./chunk-WLNKIOPV.mjs";
4
4
  import "./chunk-NT4W6JYX.mjs";
5
- import "./chunk-Y7IZ6OAH.mjs";
5
+ import "./chunk-33MIXMUC.mjs";
6
6
  export {
7
7
  machine
8
8
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/pin-input",
3
- "version": "0.0.0-dev-20230220134212",
3
+ "version": "0.0.0-dev-20230221113221",
4
4
  "description": "Core logic for the pin-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-20230220134212",
30
+ "@zag-js/core": "0.0.0-dev-20230221113221",
31
31
  "@zag-js/types": "0.3.4"
32
32
  },
33
33
  "devDependencies": {