@zag-js/tooltip 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
@@ -125,7 +125,7 @@ function getParent(el) {
125
125
  return el;
126
126
  return el.assignedSlot || el.parentElement || doc.documentElement;
127
127
  }
128
- function withRootHelpers(domUtils) {
128
+ function defineDomHelpers(domUtils) {
129
129
  const roots = {
130
130
  getRootNode: (ctx) => {
131
131
  var _a, _b;
@@ -135,7 +135,8 @@ function withRootHelpers(domUtils) {
135
135
  getWin: (ctx) => {
136
136
  var _a;
137
137
  return (_a = roots.getDoc(ctx).defaultView) != null ? _a : window;
138
- }
138
+ },
139
+ getActiveElement: (ctx) => roots.getDoc(ctx).activeElement
139
140
  };
140
141
  return __spreadValues2(__spreadValues2({}, roots), domUtils);
141
142
  }
@@ -210,18 +211,6 @@ function getEventName(evt) {
210
211
  return mouseEventNames[evt];
211
212
  return evt;
212
213
  }
213
- var visuallyHiddenStyle = {
214
- border: "0",
215
- clip: "rect(0 0 0 0)",
216
- height: "1px",
217
- margin: "-1px",
218
- overflow: "hidden",
219
- padding: "0",
220
- position: "absolute",
221
- width: "1px",
222
- whiteSpace: "nowrap",
223
- wordWrap: "normal"
224
- };
225
214
  function raf(fn) {
226
215
  const id = globalThis.requestAnimationFrame(fn);
227
216
  return function cleanup() {
@@ -254,12 +243,24 @@ function getScrollParents(el, list = []) {
254
243
  return parents;
255
244
  return parents.concat(getScrollParents(getParent(target)));
256
245
  }
246
+ var visuallyHiddenStyle = {
247
+ border: "0",
248
+ clip: "rect(0 0 0 0)",
249
+ height: "1px",
250
+ margin: "-1px",
251
+ overflow: "hidden",
252
+ padding: "0",
253
+ position: "absolute",
254
+ width: "1px",
255
+ whiteSpace: "nowrap",
256
+ wordWrap: "normal"
257
+ };
257
258
 
258
259
  // src/tooltip.connect.ts
259
260
  var import_popper = require("@zag-js/popper");
260
261
 
261
262
  // src/tooltip.dom.ts
262
- var dom = withRootHelpers({
263
+ var dom = defineDomHelpers({
263
264
  getTriggerId: (ctx) => {
264
265
  var _a, _b;
265
266
  return (_b = (_a = ctx.ids) == null ? void 0 : _a.trigger) != null ? _b : `tooltip:${ctx.id}:trigger`;
package/dist/index.mjs CHANGED
@@ -101,7 +101,7 @@ function getParent(el) {
101
101
  return el;
102
102
  return el.assignedSlot || el.parentElement || doc.documentElement;
103
103
  }
104
- function withRootHelpers(domUtils) {
104
+ function defineDomHelpers(domUtils) {
105
105
  const roots = {
106
106
  getRootNode: (ctx) => {
107
107
  var _a, _b;
@@ -111,7 +111,8 @@ function withRootHelpers(domUtils) {
111
111
  getWin: (ctx) => {
112
112
  var _a;
113
113
  return (_a = roots.getDoc(ctx).defaultView) != null ? _a : window;
114
- }
114
+ },
115
+ getActiveElement: (ctx) => roots.getDoc(ctx).activeElement
115
116
  };
116
117
  return __spreadValues2(__spreadValues2({}, roots), domUtils);
117
118
  }
@@ -186,18 +187,6 @@ function getEventName(evt) {
186
187
  return mouseEventNames[evt];
187
188
  return evt;
188
189
  }
189
- var visuallyHiddenStyle = {
190
- border: "0",
191
- clip: "rect(0 0 0 0)",
192
- height: "1px",
193
- margin: "-1px",
194
- overflow: "hidden",
195
- padding: "0",
196
- position: "absolute",
197
- width: "1px",
198
- whiteSpace: "nowrap",
199
- wordWrap: "normal"
200
- };
201
190
  function raf(fn) {
202
191
  const id = globalThis.requestAnimationFrame(fn);
203
192
  return function cleanup() {
@@ -230,12 +219,24 @@ function getScrollParents(el, list = []) {
230
219
  return parents;
231
220
  return parents.concat(getScrollParents(getParent(target)));
232
221
  }
222
+ var visuallyHiddenStyle = {
223
+ border: "0",
224
+ clip: "rect(0 0 0 0)",
225
+ height: "1px",
226
+ margin: "-1px",
227
+ overflow: "hidden",
228
+ padding: "0",
229
+ position: "absolute",
230
+ width: "1px",
231
+ whiteSpace: "nowrap",
232
+ wordWrap: "normal"
233
+ };
233
234
 
234
235
  // src/tooltip.connect.ts
235
236
  import { getPlacementStyles } from "@zag-js/popper";
236
237
 
237
238
  // src/tooltip.dom.ts
238
- var dom = withRootHelpers({
239
+ var dom = defineDomHelpers({
239
240
  getTriggerId: (ctx) => {
240
241
  var _a, _b;
241
242
  return (_b = (_a = ctx.ids) == null ? void 0 : _a.trigger) != null ? _b : `tooltip:${ctx.id}:trigger`;
@@ -9,6 +9,9 @@ export declare const dom: {
9
9
  getWin: (ctx: {
10
10
  getRootNode?: () => Document | Node | ShadowRoot;
11
11
  }) => Window & typeof globalThis;
12
+ getActiveElement: (ctx: {
13
+ getRootNode?: () => Document | Node | ShadowRoot;
14
+ }) => HTMLElement;
12
15
  } & {
13
16
  getTriggerId: (ctx: Ctx) => string;
14
17
  getContentId: (ctx: Ctx) => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/tooltip",
3
- "version": "0.0.0-dev-20220709135250",
3
+ "version": "0.0.0-dev-20220709181637",
4
4
  "description": "Core logic for the tooltip widget implemented as a state machine",
5
5
  "keywords": [
6
6
  "js",
@@ -30,9 +30,9 @@
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/popper": "0.0.0-dev-20220709135250",
35
- "@zag-js/types": "0.0.0-dev-20220709135250"
33
+ "@zag-js/dom-utils": "0.0.0-dev-20220709181637",
34
+ "@zag-js/popper": "0.0.0-dev-20220709181637",
35
+ "@zag-js/types": "0.0.0-dev-20220709181637"
36
36
  },
37
37
  "scripts": {
38
38
  "build:fast": "zag build",