@zag-js/popover 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.
@@ -2,7 +2,7 @@ import {
2
2
  contains,
3
3
  dom,
4
4
  runIfFn
5
- } from "./chunk-2EVL5G6H.mjs";
5
+ } from "./chunk-Z2WON7A5.mjs";
6
6
 
7
7
  // src/popover.machine.ts
8
8
  import { ariaHidden } from "@zag-js/aria-hidden";
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-KTOPDXGV.mjs";
4
4
  import {
5
5
  dom
6
- } from "./chunk-2EVL5G6H.mjs";
6
+ } from "./chunk-Z2WON7A5.mjs";
7
7
 
8
8
  // ../../utilities/dom/src/attrs.ts
9
9
  var dataAttr = (guard) => {
@@ -27,7 +27,13 @@ function defineDomHelpers(helpers) {
27
27
  getDoc: (ctx) => getDocument(dom2.getRootNode(ctx)),
28
28
  getWin: (ctx) => dom2.getDoc(ctx).defaultView ?? window,
29
29
  getActiveElement: (ctx) => dom2.getDoc(ctx).activeElement,
30
- getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id)
30
+ getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id),
31
+ queryById: (ctx, id) => {
32
+ const el = dom2.getById(ctx, id);
33
+ if (!el)
34
+ throw new Error(`Element with id "${id}" not found.`);
35
+ return el;
36
+ }
31
37
  };
32
38
  return {
33
39
  ...dom2,
package/dist/index.js CHANGED
@@ -107,7 +107,13 @@ function defineDomHelpers(helpers) {
107
107
  getDoc: (ctx) => getDocument(dom2.getRootNode(ctx)),
108
108
  getWin: (ctx) => dom2.getDoc(ctx).defaultView ?? window,
109
109
  getActiveElement: (ctx) => dom2.getDoc(ctx).activeElement,
110
- getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id)
110
+ getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id),
111
+ queryById: (ctx, id) => {
112
+ const el = dom2.getById(ctx, id);
113
+ if (!el)
114
+ throw new Error(`Element with id "${id}" not found.`);
115
+ return el;
116
+ }
111
117
  };
112
118
  return {
113
119
  ...dom2,
package/dist/index.mjs CHANGED
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  connect
3
- } from "./chunk-JNFEFPEH.mjs";
3
+ } from "./chunk-JDSPKDIN.mjs";
4
4
  import {
5
5
  anatomy
6
6
  } from "./chunk-KTOPDXGV.mjs";
7
7
  import {
8
8
  machine
9
- } from "./chunk-NMCDKPIS.mjs";
10
- import "./chunk-2EVL5G6H.mjs";
9
+ } from "./chunk-FRFRU5PG.mjs";
10
+ import "./chunk-Z2WON7A5.mjs";
11
11
  export {
12
12
  anatomy,
13
13
  connect,
@@ -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,8 +1,8 @@
1
1
  import {
2
2
  connect
3
- } from "./chunk-JNFEFPEH.mjs";
3
+ } from "./chunk-JDSPKDIN.mjs";
4
4
  import "./chunk-KTOPDXGV.mjs";
5
- import "./chunk-2EVL5G6H.mjs";
5
+ import "./chunk-Z2WON7A5.mjs";
6
6
  export {
7
7
  connect
8
8
  };
@@ -20,6 +20,9 @@ declare const dom: {
20
20
  getById: <T = HTMLElement>(ctx: {
21
21
  getRootNode?: (() => Node | Document | ShadowRoot) | undefined;
22
22
  }, id: string) => T | null;
23
+ queryById: <T_1 = HTMLElement>(ctx: {
24
+ getRootNode?: (() => Node | Document | ShadowRoot) | undefined;
25
+ }, id: string) => T_1;
23
26
  } & {
24
27
  getActiveEl: (ctx: MachineContext) => Element | null;
25
28
  getAnchorId: (ctx: MachineContext) => string;
@@ -53,7 +53,13 @@ function defineDomHelpers(helpers) {
53
53
  getDoc: (ctx) => getDocument(dom2.getRootNode(ctx)),
54
54
  getWin: (ctx) => dom2.getDoc(ctx).defaultView ?? window,
55
55
  getActiveElement: (ctx) => dom2.getDoc(ctx).activeElement,
56
- getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id)
56
+ getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id),
57
+ queryById: (ctx, id) => {
58
+ const el = dom2.getById(ctx, id);
59
+ if (!el)
60
+ throw new Error(`Element with id "${id}" not found.`);
61
+ return el;
62
+ }
57
63
  };
58
64
  return {
59
65
  ...dom2,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  dom
3
- } from "./chunk-2EVL5G6H.mjs";
3
+ } from "./chunk-Z2WON7A5.mjs";
4
4
  export {
5
5
  dom
6
6
  };
@@ -88,7 +88,13 @@ function defineDomHelpers(helpers) {
88
88
  getDoc: (ctx) => getDocument(dom2.getRootNode(ctx)),
89
89
  getWin: (ctx) => dom2.getDoc(ctx).defaultView ?? window,
90
90
  getActiveElement: (ctx) => dom2.getDoc(ctx).activeElement,
91
- getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id)
91
+ getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id),
92
+ queryById: (ctx, id) => {
93
+ const el = dom2.getById(ctx, id);
94
+ if (!el)
95
+ throw new Error(`Element with id "${id}" not found.`);
96
+ return el;
97
+ }
92
98
  };
93
99
  return {
94
100
  ...dom2,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  machine
3
- } from "./chunk-NMCDKPIS.mjs";
4
- import "./chunk-2EVL5G6H.mjs";
3
+ } from "./chunk-FRFRU5PG.mjs";
4
+ import "./chunk-Z2WON7A5.mjs";
5
5
  export {
6
6
  machine
7
7
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/popover",
3
- "version": "0.0.0-dev-20230220134212",
3
+ "version": "0.0.0-dev-20230221113221",
4
4
  "description": "Core logic for the popover widget implemented as a state machine",
5
5
  "keywords": [
6
6
  "js",
@@ -29,9 +29,9 @@
29
29
  "focus-trap": "7.2.0",
30
30
  "@zag-js/anatomy": "0.1.4",
31
31
  "@zag-js/aria-hidden": "0.2.2",
32
- "@zag-js/core": "0.0.0-dev-20230220134212",
33
- "@zag-js/dismissable": "0.0.0-dev-20230220134212",
34
- "@zag-js/popper": "0.0.0-dev-20230220134212",
32
+ "@zag-js/core": "0.0.0-dev-20230221113221",
33
+ "@zag-js/dismissable": "0.0.0-dev-20230221113221",
34
+ "@zag-js/popper": "0.0.0-dev-20230221113221",
35
35
  "@zag-js/remove-scroll": "0.2.2",
36
36
  "@zag-js/types": "0.3.4"
37
37
  },