@zag-js/tooltip 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.
@@ -49,7 +49,13 @@ function defineDomHelpers(helpers) {
49
49
  getDoc: (ctx) => getDocument(dom2.getRootNode(ctx)),
50
50
  getWin: (ctx) => dom2.getDoc(ctx).defaultView ?? window,
51
51
  getActiveElement: (ctx) => dom2.getDoc(ctx).activeElement,
52
- getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id)
52
+ getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id),
53
+ queryById: (ctx, id) => {
54
+ const el = dom2.getById(ctx, id);
55
+ if (!el)
56
+ throw new Error(`Element with id "${id}" not found.`);
57
+ return el;
58
+ }
53
59
  };
54
60
  return {
55
61
  ...dom2,
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-RRQRIZBA.mjs";
4
4
  import {
5
5
  dom
6
- } from "./chunk-W5WZYXHV.mjs";
6
+ } from "./chunk-DYQY5P2O.mjs";
7
7
  import {
8
8
  store
9
9
  } from "./chunk-GQYNO326.mjs";
@@ -2,7 +2,7 @@ import {
2
2
  dom,
3
3
  getScrollParents,
4
4
  isHTMLElement
5
- } from "./chunk-W5WZYXHV.mjs";
5
+ } from "./chunk-DYQY5P2O.mjs";
6
6
  import {
7
7
  store
8
8
  } from "./chunk-GQYNO326.mjs";
package/dist/index.js CHANGED
@@ -118,7 +118,13 @@ function defineDomHelpers(helpers) {
118
118
  getDoc: (ctx) => getDocument(dom2.getRootNode(ctx)),
119
119
  getWin: (ctx) => dom2.getDoc(ctx).defaultView ?? window,
120
120
  getActiveElement: (ctx) => dom2.getDoc(ctx).activeElement,
121
- getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id)
121
+ getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id),
122
+ queryById: (ctx, id) => {
123
+ const el = dom2.getById(ctx, id);
124
+ if (!el)
125
+ throw new Error(`Element with id "${id}" not found.`);
126
+ return el;
127
+ }
122
128
  };
123
129
  return {
124
130
  ...dom2,
package/dist/index.mjs CHANGED
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  connect
3
- } from "./chunk-V3RC3IDL.mjs";
3
+ } from "./chunk-VTDFWXSY.mjs";
4
4
  import {
5
5
  anatomy
6
6
  } from "./chunk-RRQRIZBA.mjs";
7
7
  import {
8
8
  machine
9
- } from "./chunk-ILEFGJ44.mjs";
10
- import "./chunk-W5WZYXHV.mjs";
9
+ } from "./chunk-YCQQKYLH.mjs";
10
+ import "./chunk-DYQY5P2O.mjs";
11
11
  import "./chunk-GQYNO326.mjs";
12
12
  export {
13
13
  anatomy,
@@ -77,7 +77,13 @@ function defineDomHelpers(helpers) {
77
77
  getDoc: (ctx) => getDocument(dom2.getRootNode(ctx)),
78
78
  getWin: (ctx) => dom2.getDoc(ctx).defaultView ?? window,
79
79
  getActiveElement: (ctx) => dom2.getDoc(ctx).activeElement,
80
- getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id)
80
+ getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id),
81
+ queryById: (ctx, id) => {
82
+ const el = dom2.getById(ctx, id);
83
+ if (!el)
84
+ throw new Error(`Element with id "${id}" not found.`);
85
+ return el;
86
+ }
81
87
  };
82
88
  return {
83
89
  ...dom2,
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  connect
3
- } from "./chunk-V3RC3IDL.mjs";
3
+ } from "./chunk-VTDFWXSY.mjs";
4
4
  import "./chunk-RRQRIZBA.mjs";
5
- import "./chunk-W5WZYXHV.mjs";
5
+ import "./chunk-DYQY5P2O.mjs";
6
6
  import "./chunk-GQYNO326.mjs";
7
7
  export {
8
8
  connect
@@ -19,6 +19,9 @@ declare const dom: {
19
19
  getById: <T = HTMLElement>(ctx: {
20
20
  getRootNode?: (() => Node | Document | ShadowRoot) | undefined;
21
21
  }, id: string) => T | null;
22
+ queryById: <T_1 = HTMLElement>(ctx: {
23
+ getRootNode?: (() => Node | Document | ShadowRoot) | undefined;
24
+ }, id: string) => T_1;
22
25
  } & {
23
26
  getTriggerId: (ctx: MachineContext) => string;
24
27
  getContentId: (ctx: MachineContext) => string;
@@ -72,7 +72,13 @@ function defineDomHelpers(helpers) {
72
72
  getDoc: (ctx) => getDocument(dom2.getRootNode(ctx)),
73
73
  getWin: (ctx) => dom2.getDoc(ctx).defaultView ?? window,
74
74
  getActiveElement: (ctx) => dom2.getDoc(ctx).activeElement,
75
- getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id)
75
+ getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id),
76
+ queryById: (ctx, id) => {
77
+ const el = dom2.getById(ctx, id);
78
+ if (!el)
79
+ throw new Error(`Element with id "${id}" not found.`);
80
+ return el;
81
+ }
76
82
  };
77
83
  return {
78
84
  ...dom2,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  dom
3
- } from "./chunk-W5WZYXHV.mjs";
3
+ } from "./chunk-DYQY5P2O.mjs";
4
4
  export {
5
5
  dom
6
6
  };
@@ -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,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  machine
3
- } from "./chunk-ILEFGJ44.mjs";
4
- import "./chunk-W5WZYXHV.mjs";
3
+ } from "./chunk-YCQQKYLH.mjs";
4
+ import "./chunk-DYQY5P2O.mjs";
5
5
  import "./chunk-GQYNO326.mjs";
6
6
  export {
7
7
  machine
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/tooltip",
3
- "version": "0.0.0-dev-20230220134212",
3
+ "version": "0.0.0-dev-20230221113221",
4
4
  "description": "Core logic for the tooltip widget implemented as a state machine",
5
5
  "keywords": [
6
6
  "js",
@@ -27,8 +27,8 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@zag-js/anatomy": "0.1.4",
30
- "@zag-js/core": "0.0.0-dev-20230220134212",
31
- "@zag-js/popper": "0.0.0-dev-20230220134212",
30
+ "@zag-js/core": "0.0.0-dev-20230221113221",
31
+ "@zag-js/popper": "0.0.0-dev-20230221113221",
32
32
  "@zag-js/types": "0.3.4"
33
33
  },
34
34
  "devDependencies": {