@zag-js/tooltip 0.0.0-dev-20230221113221 → 0.0.0-dev-20230222181847

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.
@@ -0,0 +1,17 @@
1
+ // src/tooltip.dom.ts
2
+ import { createScope, getScrollParent } from "@zag-js/dom-query";
3
+ var dom = createScope({
4
+ getTriggerId: (ctx) => ctx.ids?.trigger ?? `tooltip:${ctx.id}:trigger`,
5
+ getContentId: (ctx) => ctx.ids?.content ?? `tooltip:${ctx.id}:content`,
6
+ getArrowId: (ctx) => `tooltip:${ctx.id}:arrow`,
7
+ getPositionerId: (ctx) => `tooltip:${ctx.id}:popper`,
8
+ getTriggerEl: (ctx) => dom.getById(ctx, dom.getTriggerId(ctx)),
9
+ getContentEl: (ctx) => dom.getById(ctx, dom.getContentId(ctx)),
10
+ getPositionerEl: (ctx) => dom.getById(ctx, dom.getPositionerId(ctx)),
11
+ getArrowEl: (ctx) => dom.getById(ctx, dom.getArrowId(ctx)),
12
+ getScrollParent: (ctx) => getScrollParent(dom.getTriggerEl(ctx))
13
+ });
14
+
15
+ export {
16
+ dom
17
+ };
@@ -1,131 +1,16 @@
1
1
  import {
2
- dom,
3
- getScrollParents,
4
- isHTMLElement
5
- } from "./chunk-DYQY5P2O.mjs";
2
+ dom
3
+ } from "./chunk-3LXHM7BW.mjs";
6
4
  import {
7
5
  store
8
6
  } from "./chunk-GQYNO326.mjs";
9
7
 
10
8
  // src/tooltip.machine.ts
11
9
  import { createMachine, subscribe } from "@zag-js/core";
12
-
13
- // ../../utilities/core/src/functions.ts
14
- var runIfFn = (v, ...a) => {
15
- const res = typeof v === "function" ? v(...a) : v;
16
- return res ?? void 0;
17
- };
18
-
19
- // ../../utilities/core/src/guard.ts
20
- var isArray = (v) => Array.isArray(v);
21
- var isObject = (v) => !(v == null || typeof v !== "object" || isArray(v));
22
- var hasProp = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
23
-
24
- // ../../utilities/core/src/object.ts
25
- function compact(obj) {
26
- if (obj === void 0)
27
- return obj;
28
- return Object.fromEntries(
29
- Object.entries(obj).filter(([, value]) => value !== void 0).map(([key, value]) => [key, isObject(value) ? compact(value) : value])
30
- );
31
- }
32
-
33
- // ../../utilities/dom/src/platform.ts
34
- var isDom = () => typeof window !== "undefined";
35
- function getPlatform() {
36
- const agent = navigator.userAgentData;
37
- return agent?.platform ?? navigator.platform;
38
- }
39
- var pt = (v) => isDom() && v.test(getPlatform());
40
- var vn = (v) => isDom() && v.test(navigator.vendor);
41
- var isSafari = () => isApple() && vn(/apple/i);
42
- var isApple = () => pt(/mac|iphone|ipad|ipod/i);
43
-
44
- // ../../utilities/dom/src/event.ts
45
- var supportsPointerEvent = () => isDom() && window.onpointerdown === null;
46
- var supportsTouchEvent = () => isDom() && window.ontouchstart === null;
47
- var supportsMouseEvent = () => isDom() && window.onmousedown === null;
48
- var isTouchEvent = (v) => isObject(v) && hasProp(v, "touches");
49
-
50
- // ../../utilities/dom/src/listener.ts
51
- var isRef = (v) => hasProp(v, "current");
52
- var fallback = { pageX: 0, pageY: 0, clientX: 0, clientY: 0 };
53
- function extractInfo(event, type = "page") {
54
- const point = isTouchEvent(event) ? event.touches[0] || event.changedTouches[0] || fallback : event;
55
- return {
56
- point: {
57
- x: point[`${type}X`],
58
- y: point[`${type}Y`]
59
- }
60
- };
61
- }
62
- function addDomEvent(target, eventName, handler, options) {
63
- const node = isRef(target) ? target.current : runIfFn(target);
64
- node?.addEventListener(eventName, handler, options);
65
- return () => {
66
- node?.removeEventListener(eventName, handler, options);
67
- };
68
- }
69
- function addPointerEvent(target, event, listener, options) {
70
- const type = getEventName(event) ?? event;
71
- return addDomEvent(target, type, wrapHandler(listener, event === "pointerdown"), options);
72
- }
73
- function wrapHandler(fn, filter = false) {
74
- const listener = (event) => {
75
- fn(event, extractInfo(event));
76
- };
77
- return filter ? filterPrimaryPointer(listener) : listener;
78
- }
79
- function filterPrimaryPointer(fn) {
80
- return (event) => {
81
- const win = event.view ?? window;
82
- const isMouseEvent = event instanceof win.MouseEvent;
83
- const isPrimary = !isMouseEvent || isMouseEvent && event.button === 0;
84
- if (isPrimary)
85
- fn(event);
86
- };
87
- }
88
- var mouseEventNames = {
89
- pointerdown: "mousedown",
90
- pointermove: "mousemove",
91
- pointerup: "mouseup",
92
- pointercancel: "mousecancel",
93
- pointerover: "mouseover",
94
- pointerout: "mouseout",
95
- pointerenter: "mouseenter",
96
- pointerleave: "mouseleave"
97
- };
98
- var touchEventNames = {
99
- pointerdown: "touchstart",
100
- pointermove: "touchmove",
101
- pointerup: "touchend",
102
- pointercancel: "touchcancel"
103
- };
104
- function getEventName(evt) {
105
- if (supportsPointerEvent())
106
- return evt;
107
- if (supportsTouchEvent())
108
- return touchEventNames[evt];
109
- if (supportsMouseEvent())
110
- return mouseEventNames[evt];
111
- return evt;
112
- }
113
-
114
- // ../../utilities/dom/src/next-tick.ts
115
- function raf(fn) {
116
- const id = globalThis.requestAnimationFrame(fn);
117
- return function cleanup() {
118
- globalThis.cancelAnimationFrame(id);
119
- };
120
- }
121
-
122
- // ../../utilities/dom/src/pointerlock.ts
123
- function addPointerlockChangeListener(doc, fn) {
124
- return addDomEvent(doc, "pointerlockchange", fn, false);
125
- }
126
-
127
- // src/tooltip.machine.ts
10
+ import { addDomEvent } from "@zag-js/dom-event";
11
+ import { getScrollParents, isHTMLElement, isSafari, raf } from "@zag-js/dom-query";
128
12
  import { getPlacement } from "@zag-js/popper";
13
+ import { compact } from "@zag-js/utils";
129
14
  function machine(userContext) {
130
15
  const ctx = compact(userContext);
131
16
  return createMachine(
@@ -258,9 +143,8 @@ function machine(userContext) {
258
143
  return cleanup;
259
144
  },
260
145
  trackPointerlockChange(ctx2, _evt, { send }) {
261
- return addPointerlockChangeListener(dom.getDoc(ctx2), () => {
262
- send("POINTER_LOCK_CHANGE");
263
- });
146
+ const onChange = () => send("POINTER_LOCK_CHANGE");
147
+ return addDomEvent(dom.getDoc(ctx2), "pointerlockchange", onChange, false);
264
148
  },
265
149
  trackScroll(ctx2, _evt, { send }) {
266
150
  const trigger = dom.getTriggerEl(ctx2);
@@ -285,7 +169,7 @@ function machine(userContext) {
285
169
  if (!isSafari())
286
170
  return;
287
171
  const doc = dom.getDoc(ctx2);
288
- return addPointerEvent(doc, "pointermove", (event) => {
172
+ return addDomEvent(doc, "pointermove", (event) => {
289
173
  const selector = "[data-part=trigger][data-expanded]";
290
174
  if (isHTMLElement(event.target) && event.target.closest(selector))
291
175
  return;
@@ -3,32 +3,15 @@ import {
3
3
  } from "./chunk-RRQRIZBA.mjs";
4
4
  import {
5
5
  dom
6
- } from "./chunk-DYQY5P2O.mjs";
6
+ } from "./chunk-3LXHM7BW.mjs";
7
7
  import {
8
8
  store
9
9
  } from "./chunk-GQYNO326.mjs";
10
10
 
11
- // ../../utilities/dom/src/attrs.ts
12
- var dataAttr = (guard) => {
13
- return guard ? "" : void 0;
14
- };
15
-
16
- // ../../utilities/dom/src/visually-hidden.ts
17
- var visuallyHiddenStyle = {
18
- border: "0",
19
- clip: "rect(0 0 0 0)",
20
- height: "1px",
21
- margin: "-1px",
22
- overflow: "hidden",
23
- padding: "0",
24
- position: "absolute",
25
- width: "1px",
26
- whiteSpace: "nowrap",
27
- wordWrap: "normal"
28
- };
29
-
30
11
  // src/tooltip.connect.ts
12
+ import { dataAttr } from "@zag-js/dom-query";
31
13
  import { getPlacementStyles } from "@zag-js/popper";
14
+ import { visuallyHiddenStyle } from "@zag-js/visually-hidden";
32
15
  function connect(state, send, normalize) {
33
16
  const id = state.context.id;
34
17
  const hasAriaLabel = state.context.hasAriaLabel;
@@ -41,13 +24,25 @@ function connect(state, send, normalize) {
41
24
  placement: state.context.currentPlacement
42
25
  });
43
26
  return {
27
+ /**
28
+ * Whether the tooltip is open.
29
+ */
44
30
  isOpen,
31
+ /**
32
+ * Function to open the tooltip.
33
+ */
45
34
  open() {
46
35
  send("OPEN");
47
36
  },
37
+ /**
38
+ * Function to close the tooltip.
39
+ */
48
40
  close() {
49
41
  send("CLOSE");
50
42
  },
43
+ /**
44
+ * Returns the animation state of the tooltip.
45
+ */
51
46
  getAnimationState() {
52
47
  return {
53
48
  enter: store.prevId === null && id === store.id,
package/dist/index.js CHANGED
@@ -31,237 +31,14 @@ var import_anatomy = require("@zag-js/anatomy");
31
31
  var anatomy = (0, import_anatomy.createAnatomy)("tooltip").parts("trigger", "arrow", "arrowTip", "positioner", "content", "label");
32
32
  var parts = anatomy.build();
33
33
 
34
- // ../../utilities/dom/src/attrs.ts
35
- var dataAttr = (guard) => {
36
- return guard ? "" : void 0;
37
- };
38
-
39
- // ../../utilities/dom/src/get-computed-style.ts
40
- function getCache() {
41
- const g = globalThis;
42
- g.__styleCache = g.__styleCache || /* @__PURE__ */ new WeakMap();
43
- return g.__styleCache;
44
- }
45
- function getComputedStyle(el) {
46
- if (!el)
47
- return {};
48
- const cache = getCache();
49
- let style = cache.get(el);
50
- if (!style) {
51
- const win = el?.ownerDocument.defaultView ?? window;
52
- style = win.getComputedStyle(el);
53
- cache.set(el, style);
54
- }
55
- return style;
56
- }
57
-
58
- // ../../utilities/core/src/functions.ts
59
- var runIfFn = (v, ...a) => {
60
- const res = typeof v === "function" ? v(...a) : v;
61
- return res ?? void 0;
62
- };
63
-
64
- // ../../utilities/core/src/guard.ts
65
- var isArray = (v) => Array.isArray(v);
66
- var isObject = (v) => !(v == null || typeof v !== "object" || isArray(v));
67
- var hasProp = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
68
-
69
- // ../../utilities/core/src/object.ts
70
- function compact(obj) {
71
- if (obj === void 0)
72
- return obj;
73
- return Object.fromEntries(
74
- Object.entries(obj).filter(([, value]) => value !== void 0).map(([key, value]) => [key, isObject(value) ? compact(value) : value])
75
- );
76
- }
77
-
78
- // ../../utilities/dom/src/platform.ts
79
- var isDom = () => typeof window !== "undefined";
80
- function getPlatform() {
81
- const agent = navigator.userAgentData;
82
- return agent?.platform ?? navigator.platform;
83
- }
84
- var pt = (v) => isDom() && v.test(getPlatform());
85
- var vn = (v) => isDom() && v.test(navigator.vendor);
86
- var isSafari = () => isApple() && vn(/apple/i);
87
- var isApple = () => pt(/mac|iphone|ipad|ipod/i);
88
-
89
- // ../../utilities/dom/src/query.ts
90
- function isDocument(el) {
91
- return el.nodeType === Node.DOCUMENT_NODE;
92
- }
93
- function isWindow(value) {
94
- return value?.toString() === "[object Window]";
95
- }
96
- function getDocument(el) {
97
- if (isWindow(el))
98
- return el.document;
99
- if (isDocument(el))
100
- return el;
101
- return el?.ownerDocument ?? document;
102
- }
103
- function getWindow(el) {
104
- return el?.ownerDocument.defaultView ?? window;
105
- }
106
- function getNodeName(node) {
107
- return isWindow(node) ? "" : node?.localName ?? "";
108
- }
109
- function getParent(el) {
110
- const doc = getDocument(el);
111
- if (getNodeName(el) === "html")
112
- return el;
113
- return el.assignedSlot || el.parentElement || doc.documentElement;
114
- }
115
- function defineDomHelpers(helpers) {
116
- const dom2 = {
117
- getRootNode: (ctx) => ctx.getRootNode?.() ?? document,
118
- getDoc: (ctx) => getDocument(dom2.getRootNode(ctx)),
119
- getWin: (ctx) => dom2.getDoc(ctx).defaultView ?? window,
120
- getActiveElement: (ctx) => dom2.getDoc(ctx).activeElement,
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
- }
128
- };
129
- return {
130
- ...dom2,
131
- ...helpers
132
- };
133
- }
134
- function isHTMLElement(v) {
135
- return typeof v === "object" && v?.nodeType === Node.ELEMENT_NODE && typeof v?.nodeName === "string";
136
- }
137
-
138
- // ../../utilities/dom/src/event.ts
139
- var supportsPointerEvent = () => isDom() && window.onpointerdown === null;
140
- var supportsTouchEvent = () => isDom() && window.ontouchstart === null;
141
- var supportsMouseEvent = () => isDom() && window.onmousedown === null;
142
- var isTouchEvent = (v) => isObject(v) && hasProp(v, "touches");
143
-
144
- // ../../utilities/dom/src/listener.ts
145
- var isRef = (v) => hasProp(v, "current");
146
- var fallback = { pageX: 0, pageY: 0, clientX: 0, clientY: 0 };
147
- function extractInfo(event, type = "page") {
148
- const point = isTouchEvent(event) ? event.touches[0] || event.changedTouches[0] || fallback : event;
149
- return {
150
- point: {
151
- x: point[`${type}X`],
152
- y: point[`${type}Y`]
153
- }
154
- };
155
- }
156
- function addDomEvent(target, eventName, handler, options) {
157
- const node = isRef(target) ? target.current : runIfFn(target);
158
- node?.addEventListener(eventName, handler, options);
159
- return () => {
160
- node?.removeEventListener(eventName, handler, options);
161
- };
162
- }
163
- function addPointerEvent(target, event, listener, options) {
164
- const type = getEventName(event) ?? event;
165
- return addDomEvent(target, type, wrapHandler(listener, event === "pointerdown"), options);
166
- }
167
- function wrapHandler(fn, filter = false) {
168
- const listener = (event) => {
169
- fn(event, extractInfo(event));
170
- };
171
- return filter ? filterPrimaryPointer(listener) : listener;
172
- }
173
- function filterPrimaryPointer(fn) {
174
- return (event) => {
175
- const win = event.view ?? window;
176
- const isMouseEvent = event instanceof win.MouseEvent;
177
- const isPrimary = !isMouseEvent || isMouseEvent && event.button === 0;
178
- if (isPrimary)
179
- fn(event);
180
- };
181
- }
182
- var mouseEventNames = {
183
- pointerdown: "mousedown",
184
- pointermove: "mousemove",
185
- pointerup: "mouseup",
186
- pointercancel: "mousecancel",
187
- pointerover: "mouseover",
188
- pointerout: "mouseout",
189
- pointerenter: "mouseenter",
190
- pointerleave: "mouseleave"
191
- };
192
- var touchEventNames = {
193
- pointerdown: "touchstart",
194
- pointermove: "touchmove",
195
- pointerup: "touchend",
196
- pointercancel: "touchcancel"
197
- };
198
- function getEventName(evt) {
199
- if (supportsPointerEvent())
200
- return evt;
201
- if (supportsTouchEvent())
202
- return touchEventNames[evt];
203
- if (supportsMouseEvent())
204
- return mouseEventNames[evt];
205
- return evt;
206
- }
207
-
208
- // ../../utilities/dom/src/next-tick.ts
209
- function raf(fn) {
210
- const id = globalThis.requestAnimationFrame(fn);
211
- return function cleanup() {
212
- globalThis.cancelAnimationFrame(id);
213
- };
214
- }
215
-
216
- // ../../utilities/dom/src/pointerlock.ts
217
- function addPointerlockChangeListener(doc, fn) {
218
- return addDomEvent(doc, "pointerlockchange", fn, false);
219
- }
220
-
221
- // ../../utilities/dom/src/scrollable.ts
222
- function isScrollParent(el) {
223
- const { overflow, overflowX, overflowY } = getComputedStyle(el);
224
- return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
225
- }
226
- function getScrollParent(el) {
227
- if (["html", "body", "#document"].includes(getNodeName(el))) {
228
- return getDocument(el).body;
229
- }
230
- if (isHTMLElement(el) && isScrollParent(el)) {
231
- return el;
232
- }
233
- return getScrollParent(getParent(el));
234
- }
235
- function getScrollParents(el, list = []) {
236
- const scrollParent = getScrollParent(el);
237
- const isBody = scrollParent === getDocument(el).body;
238
- const win = getWindow(scrollParent);
239
- const target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
240
- const parents = list.concat(target);
241
- if (isBody)
242
- return parents;
243
- return parents.concat(getScrollParents(getParent(target)));
244
- }
245
-
246
- // ../../utilities/dom/src/visually-hidden.ts
247
- var visuallyHiddenStyle = {
248
- border: "0",
249
- clip: "rect(0 0 0 0)",
250
- height: "1px",
251
- margin: "-1px",
252
- overflow: "hidden",
253
- padding: "0",
254
- position: "absolute",
255
- width: "1px",
256
- whiteSpace: "nowrap",
257
- wordWrap: "normal"
258
- };
259
-
260
34
  // src/tooltip.connect.ts
35
+ var import_dom_query2 = require("@zag-js/dom-query");
261
36
  var import_popper = require("@zag-js/popper");
37
+ var import_visually_hidden = require("@zag-js/visually-hidden");
262
38
 
263
39
  // src/tooltip.dom.ts
264
- var dom = defineDomHelpers({
40
+ var import_dom_query = require("@zag-js/dom-query");
41
+ var dom = (0, import_dom_query.createScope)({
265
42
  getTriggerId: (ctx) => ctx.ids?.trigger ?? `tooltip:${ctx.id}:trigger`,
266
43
  getContentId: (ctx) => ctx.ids?.content ?? `tooltip:${ctx.id}:content`,
267
44
  getArrowId: (ctx) => `tooltip:${ctx.id}:arrow`,
@@ -270,7 +47,7 @@ var dom = defineDomHelpers({
270
47
  getContentEl: (ctx) => dom.getById(ctx, dom.getContentId(ctx)),
271
48
  getPositionerEl: (ctx) => dom.getById(ctx, dom.getPositionerId(ctx)),
272
49
  getArrowEl: (ctx) => dom.getById(ctx, dom.getArrowId(ctx)),
273
- getScrollParent: (ctx) => getScrollParent(dom.getTriggerEl(ctx))
50
+ getScrollParent: (ctx) => (0, import_dom_query.getScrollParent)(dom.getTriggerEl(ctx))
274
51
  });
275
52
 
276
53
  // src/tooltip.store.ts
@@ -297,13 +74,25 @@ function connect(state, send, normalize) {
297
74
  placement: state.context.currentPlacement
298
75
  });
299
76
  return {
77
+ /**
78
+ * Whether the tooltip is open.
79
+ */
300
80
  isOpen,
81
+ /**
82
+ * Function to open the tooltip.
83
+ */
301
84
  open() {
302
85
  send("OPEN");
303
86
  },
87
+ /**
88
+ * Function to close the tooltip.
89
+ */
304
90
  close() {
305
91
  send("CLOSE");
306
92
  },
93
+ /**
94
+ * Returns the animation state of the tooltip.
95
+ */
307
96
  getAnimationState() {
308
97
  return {
309
98
  enter: store.prevId === null && id === store.id,
@@ -313,7 +102,7 @@ function connect(state, send, normalize) {
313
102
  triggerProps: normalize.button({
314
103
  ...parts.trigger.attrs,
315
104
  id: triggerId,
316
- "data-expanded": dataAttr(isOpen),
105
+ "data-expanded": (0, import_dom_query2.dataAttr)(isOpen),
317
106
  "aria-describedby": isOpen ? contentId : void 0,
318
107
  onClick() {
319
108
  send("CLICK");
@@ -383,7 +172,7 @@ function connect(state, send, normalize) {
383
172
  ...parts.label.attrs,
384
173
  id: contentId,
385
174
  role: "tooltip",
386
- style: visuallyHiddenStyle,
175
+ style: import_visually_hidden.visuallyHiddenStyle,
387
176
  children: state.context["aria-label"]
388
177
  })
389
178
  };
@@ -391,9 +180,12 @@ function connect(state, send, normalize) {
391
180
 
392
181
  // src/tooltip.machine.ts
393
182
  var import_core2 = require("@zag-js/core");
183
+ var import_dom_event = require("@zag-js/dom-event");
184
+ var import_dom_query3 = require("@zag-js/dom-query");
394
185
  var import_popper2 = require("@zag-js/popper");
186
+ var import_utils = require("@zag-js/utils");
395
187
  function machine(userContext) {
396
- const ctx = compact(userContext);
188
+ const ctx = (0, import_utils.compact)(userContext);
397
189
  return (0, import_core2.createMachine)(
398
190
  {
399
191
  id: "tooltip",
@@ -508,7 +300,7 @@ function machine(userContext) {
508
300
  computePlacement(ctx2) {
509
301
  ctx2.currentPlacement = ctx2.positioning.placement;
510
302
  let cleanup;
511
- raf(() => {
303
+ (0, import_dom_query3.raf)(() => {
512
304
  cleanup = (0, import_popper2.getPlacement)(dom.getTriggerEl(ctx2), dom.getPositionerEl(ctx2), {
513
305
  ...ctx2.positioning,
514
306
  onComplete(data) {
@@ -524,17 +316,16 @@ function machine(userContext) {
524
316
  return cleanup;
525
317
  },
526
318
  trackPointerlockChange(ctx2, _evt, { send }) {
527
- return addPointerlockChangeListener(dom.getDoc(ctx2), () => {
528
- send("POINTER_LOCK_CHANGE");
529
- });
319
+ const onChange = () => send("POINTER_LOCK_CHANGE");
320
+ return (0, import_dom_event.addDomEvent)(dom.getDoc(ctx2), "pointerlockchange", onChange, false);
530
321
  },
531
322
  trackScroll(ctx2, _evt, { send }) {
532
323
  const trigger = dom.getTriggerEl(ctx2);
533
324
  if (!trigger)
534
325
  return;
535
- const cleanups = getScrollParents(trigger).map((el) => {
326
+ const cleanups = (0, import_dom_query3.getScrollParents)(trigger).map((el) => {
536
327
  const opts = { passive: true, capture: true };
537
- return addDomEvent(el, "scroll", () => send("SCROLL"), opts);
328
+ return (0, import_dom_event.addDomEvent)(el, "scroll", () => send("SCROLL"), opts);
538
329
  });
539
330
  return () => {
540
331
  cleanups.forEach((fn) => fn?.());
@@ -548,12 +339,12 @@ function machine(userContext) {
548
339
  });
549
340
  },
550
341
  trackDisabledTriggerOnSafari(ctx2, _evt, { send }) {
551
- if (!isSafari())
342
+ if (!(0, import_dom_query3.isSafari)())
552
343
  return;
553
344
  const doc = dom.getDoc(ctx2);
554
- return addPointerEvent(doc, "pointermove", (event) => {
345
+ return (0, import_dom_event.addDomEvent)(doc, "pointermove", (event) => {
555
346
  const selector = "[data-part=trigger][data-expanded]";
556
- if (isHTMLElement(event.target) && event.target.closest(selector))
347
+ if ((0, import_dom_query3.isHTMLElement)(event.target) && event.target.closest(selector))
557
348
  return;
558
349
  send("POINTER_LEAVE");
559
350
  });
@@ -562,7 +353,7 @@ function machine(userContext) {
562
353
  if (!ctx2.closeOnEsc)
563
354
  return;
564
355
  const doc = dom.getDoc(ctx2);
565
- return addDomEvent(doc, "keydown", (event) => {
356
+ return (0, import_dom_event.addDomEvent)(doc, "keydown", (event) => {
566
357
  if (event.key === "Escape") {
567
358
  send("ESCAPE");
568
359
  }
package/dist/index.mjs CHANGED
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  connect
3
- } from "./chunk-VTDFWXSY.mjs";
3
+ } from "./chunk-W3OSVXCZ.mjs";
4
4
  import {
5
5
  anatomy
6
6
  } from "./chunk-RRQRIZBA.mjs";
7
7
  import {
8
8
  machine
9
- } from "./chunk-YCQQKYLH.mjs";
10
- import "./chunk-DYQY5P2O.mjs";
9
+ } from "./chunk-463EFHFN.mjs";
10
+ import "./chunk-3LXHM7BW.mjs";
11
11
  import "./chunk-GQYNO326.mjs";
12
12
  export {
13
13
  anatomy,
@@ -4,9 +4,21 @@ import '@zag-js/core';
4
4
  import '@zag-js/popper';
5
5
 
6
6
  declare function connect<T extends PropTypes>(state: State, send: Send, normalize: NormalizeProps<T>): {
7
+ /**
8
+ * Whether the tooltip is open.
9
+ */
7
10
  isOpen: boolean;
11
+ /**
12
+ * Function to open the tooltip.
13
+ */
8
14
  open(): void;
15
+ /**
16
+ * Function to close the tooltip.
17
+ */
9
18
  close(): void;
19
+ /**
20
+ * Returns the animation state of the tooltip.
21
+ */
10
22
  getAnimationState(): {
11
23
  enter: boolean;
12
24
  exit: boolean;