@zag-js/slider 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.
@@ -11,7 +11,7 @@ import {
11
11
  } from "./chunk-3UP6QL6A.mjs";
12
12
  import {
13
13
  dom
14
- } from "./chunk-55KEN77D.mjs";
14
+ } from "./chunk-VPBBCP3T.mjs";
15
15
  import {
16
16
  constrainValue,
17
17
  decrement,
@@ -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,
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-3UP6QL6A.mjs";
10
10
  import {
11
11
  dom
12
- } from "./chunk-55KEN77D.mjs";
12
+ } from "./chunk-VPBBCP3T.mjs";
13
13
 
14
14
  // ../../utilities/dom/src/attrs.ts
15
15
  var dataAttr = (guard) => {
package/dist/index.js CHANGED
@@ -108,7 +108,13 @@ function defineDomHelpers(helpers) {
108
108
  getDoc: (ctx) => getDocument(dom2.getRootNode(ctx)),
109
109
  getWin: (ctx) => dom2.getDoc(ctx).defaultView ?? window,
110
110
  getActiveElement: (ctx) => dom2.getDoc(ctx).activeElement,
111
- getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id)
111
+ getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id),
112
+ queryById: (ctx, id) => {
113
+ const el = dom2.getById(ctx, id);
114
+ if (!el)
115
+ throw new Error(`Element with id "${id}" not found.`);
116
+ return el;
117
+ }
112
118
  };
113
119
  return {
114
120
  ...dom2,
package/dist/index.mjs CHANGED
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  connect
3
- } from "./chunk-X363CZYV.mjs";
3
+ } from "./chunk-YMQNUMTS.mjs";
4
4
  import {
5
5
  anatomy
6
6
  } from "./chunk-3Y7IIPR5.mjs";
7
7
  import {
8
8
  machine
9
- } from "./chunk-5XVLG734.mjs";
9
+ } from "./chunk-E2QSQCX6.mjs";
10
10
  import "./chunk-3UP6QL6A.mjs";
11
11
  import {
12
12
  dom
13
- } from "./chunk-55KEN77D.mjs";
13
+ } from "./chunk-VPBBCP3T.mjs";
14
14
  import "./chunk-IJAAAKZQ.mjs";
15
15
  import "./chunk-YGFSMEUO.mjs";
16
16
  export {
@@ -57,7 +57,13 @@ function defineDomHelpers(helpers) {
57
57
  getDoc: (ctx) => getDocument(dom2.getRootNode(ctx)),
58
58
  getWin: (ctx) => dom2.getDoc(ctx).defaultView ?? window,
59
59
  getActiveElement: (ctx) => dom2.getDoc(ctx).activeElement,
60
- getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id)
60
+ getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id),
61
+ queryById: (ctx, id) => {
62
+ const el = dom2.getById(ctx, id);
63
+ if (!el)
64
+ throw new Error(`Element with id "${id}" not found.`);
65
+ return el;
66
+ }
61
67
  };
62
68
  return {
63
69
  ...dom2,
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  connect
3
- } from "./chunk-X363CZYV.mjs";
3
+ } from "./chunk-YMQNUMTS.mjs";
4
4
  import "./chunk-3Y7IIPR5.mjs";
5
5
  import "./chunk-3UP6QL6A.mjs";
6
- import "./chunk-55KEN77D.mjs";
6
+ import "./chunk-VPBBCP3T.mjs";
7
7
  import "./chunk-IJAAAKZQ.mjs";
8
8
  export {
9
9
  connect
@@ -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
  getThumbId: (ctx: MachineContext) => string;
@@ -47,7 +47,13 @@ function defineDomHelpers(helpers) {
47
47
  getDoc: (ctx) => getDocument(dom2.getRootNode(ctx)),
48
48
  getWin: (ctx) => dom2.getDoc(ctx).defaultView ?? window,
49
49
  getActiveElement: (ctx) => dom2.getDoc(ctx).activeElement,
50
- getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id)
50
+ getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id),
51
+ queryById: (ctx, id) => {
52
+ const el = dom2.getById(ctx, id);
53
+ if (!el)
54
+ throw new Error(`Element with id "${id}" not found.`);
55
+ return el;
56
+ }
51
57
  };
52
58
  return {
53
59
  ...dom2,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  dom
3
- } from "./chunk-55KEN77D.mjs";
3
+ } from "./chunk-VPBBCP3T.mjs";
4
4
  import "./chunk-IJAAAKZQ.mjs";
5
5
  export {
6
6
  dom
@@ -85,7 +85,13 @@ function defineDomHelpers(helpers) {
85
85
  getDoc: (ctx) => getDocument(dom2.getRootNode(ctx)),
86
86
  getWin: (ctx) => dom2.getDoc(ctx).defaultView ?? window,
87
87
  getActiveElement: (ctx) => dom2.getDoc(ctx).activeElement,
88
- getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id)
88
+ getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id),
89
+ queryById: (ctx, id) => {
90
+ const el = dom2.getById(ctx, id);
91
+ if (!el)
92
+ throw new Error(`Element with id "${id}" not found.`);
93
+ return el;
94
+ }
89
95
  };
90
96
  return {
91
97
  ...dom2,
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  machine
3
- } from "./chunk-5XVLG734.mjs";
3
+ } from "./chunk-E2QSQCX6.mjs";
4
4
  import "./chunk-3UP6QL6A.mjs";
5
- import "./chunk-55KEN77D.mjs";
5
+ import "./chunk-VPBBCP3T.mjs";
6
6
  import "./chunk-IJAAAKZQ.mjs";
7
7
  import "./chunk-YGFSMEUO.mjs";
8
8
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/slider",
3
- "version": "0.0.0-dev-20230217074947",
3
+ "version": "0.0.0-dev-20230221113221",
4
4
  "description": "Core logic for the slider 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/element-size": "0.3.2",
32
32
  "@zag-js/numeric-range": "0.1.1",
33
33
  "@zag-js/types": "0.3.4"