@zag-js/toast 0.0.0-dev-20220709135250 → 0.0.0-dev-20220709181637

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.
package/dist/index.js CHANGED
@@ -98,7 +98,7 @@ function getDocument(el) {
98
98
  return el;
99
99
  return (_a = el == null ? void 0 : el.ownerDocument) != null ? _a : document;
100
100
  }
101
- function withRootHelpers(domUtils) {
101
+ function defineDomHelpers(domUtils) {
102
102
  const roots = {
103
103
  getRootNode: (ctx) => {
104
104
  var _a, _b;
@@ -108,7 +108,8 @@ function withRootHelpers(domUtils) {
108
108
  getWin: (ctx) => {
109
109
  var _a;
110
110
  return (_a = roots.getDoc(ctx).defaultView) != null ? _a : window;
111
- }
111
+ },
112
+ getActiveElement: (ctx) => roots.getDoc(ctx).activeElement
112
113
  };
113
114
  return __spreadValues2(__spreadValues2({}, roots), domUtils);
114
115
  }
@@ -152,7 +153,7 @@ function warn(...a) {
152
153
  var import_core = require("@zag-js/core");
153
154
 
154
155
  // src/toast.dom.ts
155
- var dom = withRootHelpers({
156
+ var dom = defineDomHelpers({
156
157
  getGroupId: (placement) => `toast-group:${placement}`,
157
158
  getContainerId: (ctx) => `toast:${ctx.id}`,
158
159
  getTitleId: (ctx) => `toast-title:${ctx.id}`,
package/dist/index.mjs CHANGED
@@ -72,7 +72,7 @@ function getDocument(el) {
72
72
  return el;
73
73
  return (_a = el == null ? void 0 : el.ownerDocument) != null ? _a : document;
74
74
  }
75
- function withRootHelpers(domUtils) {
75
+ function defineDomHelpers(domUtils) {
76
76
  const roots = {
77
77
  getRootNode: (ctx) => {
78
78
  var _a, _b;
@@ -82,7 +82,8 @@ function withRootHelpers(domUtils) {
82
82
  getWin: (ctx) => {
83
83
  var _a;
84
84
  return (_a = roots.getDoc(ctx).defaultView) != null ? _a : window;
85
- }
85
+ },
86
+ getActiveElement: (ctx) => roots.getDoc(ctx).activeElement
86
87
  };
87
88
  return __spreadValues2(__spreadValues2({}, roots), domUtils);
88
89
  }
@@ -126,7 +127,7 @@ function warn(...a) {
126
127
  import { subscribe } from "@zag-js/core";
127
128
 
128
129
  // src/toast.dom.ts
129
- var dom = withRootHelpers({
130
+ var dom = defineDomHelpers({
130
131
  getGroupId: (placement) => `toast-group:${placement}`,
131
132
  getContainerId: (ctx) => `toast:${ctx.id}`,
132
133
  getTitleId: (ctx) => `toast-title:${ctx.id}`,
@@ -9,6 +9,9 @@ export declare const dom: {
9
9
  getWin: (ctx: {
10
10
  getRootNode?: () => Node | Document | ShadowRoot;
11
11
  }) => Window & typeof globalThis;
12
+ getActiveElement: (ctx: {
13
+ getRootNode?: () => Node | Document | ShadowRoot;
14
+ }) => HTMLElement;
12
15
  } & {
13
16
  getGroupId: (placement: Placement) => string;
14
17
  getContainerId: (ctx: Ctx) => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/toast",
3
- "version": "0.0.0-dev-20220709135250",
3
+ "version": "0.0.0-dev-20220709181637",
4
4
  "description": "Core logic for the toast widget implemented as a state machine",
5
5
  "keywords": [
6
6
  "js",
@@ -30,8 +30,8 @@
30
30
  },
31
31
  "dependencies": {
32
32
  "@zag-js/core": "0.1.7",
33
- "@zag-js/dom-utils": "0.0.0-dev-20220709135250",
34
- "@zag-js/types": "0.0.0-dev-20220709135250",
33
+ "@zag-js/dom-utils": "0.0.0-dev-20220709181637",
34
+ "@zag-js/types": "0.0.0-dev-20220709181637",
35
35
  "@zag-js/utils": "0.1.2"
36
36
  },
37
37
  "scripts": {