@zag-js/tabs 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.
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-S2KW2DT4.mjs";
4
4
  import {
5
5
  dom
6
- } from "./chunk-4CROPD6E.mjs";
6
+ } from "./chunk-SDY32WSI.mjs";
7
7
 
8
8
  // ../../utilities/dom/src/attrs.ts
9
9
  var dataAttr = (guard) => {
@@ -25,7 +25,13 @@ function defineDomHelpers(helpers) {
25
25
  getDoc: (ctx) => getDocument(dom2.getRootNode(ctx)),
26
26
  getWin: (ctx) => dom2.getDoc(ctx).defaultView ?? window,
27
27
  getActiveElement: (ctx) => dom2.getDoc(ctx).activeElement,
28
- getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id)
28
+ getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id),
29
+ queryById: (ctx, id) => {
30
+ const el = dom2.getById(ctx, id);
31
+ if (!el)
32
+ throw new Error(`Element with id "${id}" not found.`);
33
+ return el;
34
+ }
29
35
  };
30
36
  return {
31
37
  ...dom2,
@@ -3,7 +3,7 @@ import {
3
3
  isFrame,
4
4
  isHTMLElement,
5
5
  isVisible
6
- } from "./chunk-4CROPD6E.mjs";
6
+ } from "./chunk-SDY32WSI.mjs";
7
7
 
8
8
  // src/tabs.machine.ts
9
9
  import { createMachine, guards } from "@zag-js/core";
package/dist/index.js CHANGED
@@ -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,
package/dist/index.mjs CHANGED
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  connect
3
- } from "./chunk-IVTIBLCN.mjs";
3
+ } from "./chunk-M5VIW7LC.mjs";
4
4
  import {
5
5
  anatomy
6
6
  } from "./chunk-S2KW2DT4.mjs";
7
7
  import {
8
8
  machine
9
- } from "./chunk-USN6AU56.mjs";
10
- import "./chunk-4CROPD6E.mjs";
9
+ } from "./chunk-ZMHFFJLR.mjs";
10
+ import "./chunk-SDY32WSI.mjs";
11
11
  export {
12
12
  anatomy,
13
13
  connect,
@@ -64,7 +64,13 @@ function defineDomHelpers(helpers) {
64
64
  getDoc: (ctx) => getDocument(dom2.getRootNode(ctx)),
65
65
  getWin: (ctx) => dom2.getDoc(ctx).defaultView ?? window,
66
66
  getActiveElement: (ctx) => dom2.getDoc(ctx).activeElement,
67
- getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id)
67
+ getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id),
68
+ queryById: (ctx, id) => {
69
+ const el = dom2.getById(ctx, id);
70
+ if (!el)
71
+ throw new Error(`Element with id "${id}" not found.`);
72
+ return el;
73
+ }
68
74
  };
69
75
  return {
70
76
  ...dom2,
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  connect
3
- } from "./chunk-IVTIBLCN.mjs";
3
+ } from "./chunk-M5VIW7LC.mjs";
4
4
  import "./chunk-S2KW2DT4.mjs";
5
- import "./chunk-4CROPD6E.mjs";
5
+ import "./chunk-SDY32WSI.mjs";
6
6
  export {
7
7
  connect
8
8
  };
@@ -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
  getTablistId: (ctx: MachineContext) => string;
package/dist/tabs.dom.js CHANGED
@@ -48,7 +48,13 @@ function defineDomHelpers(helpers) {
48
48
  getDoc: (ctx) => getDocument(dom2.getRootNode(ctx)),
49
49
  getWin: (ctx) => dom2.getDoc(ctx).defaultView ?? window,
50
50
  getActiveElement: (ctx) => dom2.getDoc(ctx).activeElement,
51
- getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id)
51
+ getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id),
52
+ queryById: (ctx, id) => {
53
+ const el = dom2.getById(ctx, id);
54
+ if (!el)
55
+ throw new Error(`Element with id "${id}" not found.`);
56
+ return el;
57
+ }
52
58
  };
53
59
  return {
54
60
  ...dom2,
package/dist/tabs.dom.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  dom
3
- } from "./chunk-4CROPD6E.mjs";
3
+ } from "./chunk-SDY32WSI.mjs";
4
4
  export {
5
5
  dom
6
6
  };
@@ -65,7 +65,13 @@ function defineDomHelpers(helpers) {
65
65
  getDoc: (ctx) => getDocument(dom2.getRootNode(ctx)),
66
66
  getWin: (ctx) => dom2.getDoc(ctx).defaultView ?? window,
67
67
  getActiveElement: (ctx) => dom2.getDoc(ctx).activeElement,
68
- getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id)
68
+ getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id),
69
+ queryById: (ctx, id) => {
70
+ const el = dom2.getById(ctx, id);
71
+ if (!el)
72
+ throw new Error(`Element with id "${id}" not found.`);
73
+ return el;
74
+ }
69
75
  };
70
76
  return {
71
77
  ...dom2,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  machine
3
- } from "./chunk-USN6AU56.mjs";
4
- import "./chunk-4CROPD6E.mjs";
3
+ } from "./chunk-ZMHFFJLR.mjs";
4
+ import "./chunk-SDY32WSI.mjs";
5
5
  export {
6
6
  machine
7
7
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/tabs",
3
- "version": "0.0.0-dev-20230220134212",
3
+ "version": "0.0.0-dev-20230221113221",
4
4
  "description": "Core logic for the tabs 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": {