@zag-js/tooltip 0.2.5 → 0.2.6
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/chunk-GQYNO326.mjs +14 -0
- package/dist/chunk-JWVFZJC7.mjs +359 -0
- package/dist/chunk-PFKIRGNP.mjs +146 -0
- package/dist/chunk-RRQRIZBA.mjs +9 -0
- package/dist/chunk-XZ6HXWV2.mjs +147 -0
- package/dist/index.d.ts +8 -946
- package/dist/index.js +36 -18
- package/dist/index.mjs +11 -619
- package/dist/tooltip.anatomy.d.ts +6 -0
- package/dist/tooltip.anatomy.js +34 -0
- package/dist/tooltip.anatomy.mjs +8 -0
- package/dist/tooltip.connect.d.ts +23 -0
- package/dist/tooltip.connect.js +308 -0
- package/dist/tooltip.connect.mjs +9 -0
- package/dist/tooltip.dom.d.ts +41 -0
- package/dist/tooltip.dom.js +156 -0
- package/dist/tooltip.dom.mjs +6 -0
- package/dist/tooltip.machine.d.ts +8 -0
- package/dist/tooltip.machine.js +528 -0
- package/dist/tooltip.machine.mjs +8 -0
- package/dist/tooltip.store.d.ts +9 -0
- package/dist/tooltip.store.js +38 -0
- package/dist/tooltip.store.mjs +6 -0
- package/dist/tooltip.types.d.ts +77 -0
- package/dist/tooltip.types.js +18 -0
- package/dist/tooltip.types.mjs +0 -0
- package/package.json +22 -12
package/dist/index.js
CHANGED
|
@@ -31,10 +31,12 @@ 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/
|
|
34
|
+
// ../../utilities/dom/src/attrs.ts
|
|
35
35
|
var dataAttr = (guard) => {
|
|
36
36
|
return guard ? "" : void 0;
|
|
37
37
|
};
|
|
38
|
+
|
|
39
|
+
// ../../utilities/dom/src/get-computed-style.ts
|
|
38
40
|
function getCache() {
|
|
39
41
|
const g = globalThis;
|
|
40
42
|
g.__styleCache = g.__styleCache || /* @__PURE__ */ new WeakMap();
|
|
@@ -53,13 +55,28 @@ function getComputedStyle(el) {
|
|
|
53
55
|
}
|
|
54
56
|
return style;
|
|
55
57
|
}
|
|
58
|
+
|
|
59
|
+
// ../../utilities/core/src/functions.ts
|
|
56
60
|
var runIfFn = (v, ...a) => {
|
|
57
61
|
const res = typeof v === "function" ? v(...a) : v;
|
|
58
62
|
return res != null ? res : void 0;
|
|
59
63
|
};
|
|
64
|
+
|
|
65
|
+
// ../../utilities/core/src/guard.ts
|
|
60
66
|
var isArray = (v) => Array.isArray(v);
|
|
61
67
|
var isObject = (v) => !(v == null || typeof v !== "object" || isArray(v));
|
|
62
68
|
var hasProp = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
|
|
69
|
+
|
|
70
|
+
// ../../utilities/core/src/object.ts
|
|
71
|
+
function compact(obj) {
|
|
72
|
+
if (obj === void 0)
|
|
73
|
+
return obj;
|
|
74
|
+
return Object.fromEntries(
|
|
75
|
+
Object.entries(obj).filter(([, value]) => value !== void 0).map(([key, value]) => [key, isObject(value) ? compact(value) : value])
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// ../../utilities/dom/src/platform.ts
|
|
63
80
|
var isDom = () => typeof window !== "undefined";
|
|
64
81
|
function getPlatform() {
|
|
65
82
|
var _a;
|
|
@@ -70,6 +87,8 @@ var pt = (v) => isDom() && v.test(getPlatform());
|
|
|
70
87
|
var vn = (v) => isDom() && v.test(navigator.vendor);
|
|
71
88
|
var isSafari = () => isApple() && vn(/apple/i);
|
|
72
89
|
var isApple = () => pt(/mac|iphone|ipad|ipod/i);
|
|
90
|
+
|
|
91
|
+
// ../../utilities/dom/src/query.ts
|
|
73
92
|
function isDocument(el) {
|
|
74
93
|
return el.nodeType === Node.DOCUMENT_NODE;
|
|
75
94
|
}
|
|
@@ -138,14 +157,18 @@ function defineDomHelpers(helpers) {
|
|
|
138
157
|
function isHTMLElement(v) {
|
|
139
158
|
return typeof v === "object" && (v == null ? void 0 : v.nodeType) === Node.ELEMENT_NODE && typeof (v == null ? void 0 : v.nodeName) === "string";
|
|
140
159
|
}
|
|
160
|
+
|
|
161
|
+
// ../../utilities/dom/src/event.ts
|
|
141
162
|
var supportsPointerEvent = () => isDom() && window.onpointerdown === null;
|
|
142
163
|
var supportsTouchEvent = () => isDom() && window.ontouchstart === null;
|
|
143
164
|
var supportsMouseEvent = () => isDom() && window.onmousedown === null;
|
|
144
165
|
var isTouchEvent = (v) => isObject(v) && hasProp(v, "touches");
|
|
166
|
+
|
|
167
|
+
// ../../utilities/dom/src/listener.ts
|
|
145
168
|
var isRef = (v) => hasProp(v, "current");
|
|
146
|
-
var
|
|
169
|
+
var fallback = { pageX: 0, pageY: 0, clientX: 0, clientY: 0 };
|
|
147
170
|
function extractInfo(event, type = "page") {
|
|
148
|
-
const point = isTouchEvent(event) ? event.touches[0] || event.changedTouches[0] ||
|
|
171
|
+
const point = isTouchEvent(event) ? event.touches[0] || event.changedTouches[0] || fallback : event;
|
|
149
172
|
return {
|
|
150
173
|
point: {
|
|
151
174
|
x: point[`${type}X`],
|
|
@@ -175,8 +198,8 @@ function filterPrimaryPointer(fn) {
|
|
|
175
198
|
return (event) => {
|
|
176
199
|
var _a;
|
|
177
200
|
const win = (_a = event.view) != null ? _a : window;
|
|
178
|
-
const
|
|
179
|
-
const isPrimary = !
|
|
201
|
+
const isMouseEvent = event instanceof win.MouseEvent;
|
|
202
|
+
const isPrimary = !isMouseEvent || isMouseEvent && event.button === 0;
|
|
180
203
|
if (isPrimary)
|
|
181
204
|
fn(event);
|
|
182
205
|
};
|
|
@@ -206,15 +229,21 @@ function getEventName(evt) {
|
|
|
206
229
|
return mouseEventNames[evt];
|
|
207
230
|
return evt;
|
|
208
231
|
}
|
|
232
|
+
|
|
233
|
+
// ../../utilities/dom/src/next-tick.ts
|
|
209
234
|
function raf(fn) {
|
|
210
235
|
const id = globalThis.requestAnimationFrame(fn);
|
|
211
236
|
return function cleanup() {
|
|
212
237
|
globalThis.cancelAnimationFrame(id);
|
|
213
238
|
};
|
|
214
239
|
}
|
|
240
|
+
|
|
241
|
+
// ../../utilities/dom/src/pointerlock.ts
|
|
215
242
|
function addPointerlockChangeListener(doc, fn) {
|
|
216
243
|
return addDomEvent(doc, "pointerlockchange", fn, false);
|
|
217
244
|
}
|
|
245
|
+
|
|
246
|
+
// ../../utilities/dom/src/scrollable.ts
|
|
218
247
|
function isScrollParent(el) {
|
|
219
248
|
const { overflow, overflowX, overflowY } = getComputedStyle(el);
|
|
220
249
|
return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
|
|
@@ -238,6 +267,8 @@ function getScrollParents(el, list = []) {
|
|
|
238
267
|
return parents;
|
|
239
268
|
return parents.concat(getScrollParents(getParent(target)));
|
|
240
269
|
}
|
|
270
|
+
|
|
271
|
+
// ../../utilities/dom/src/visually-hidden.ts
|
|
241
272
|
var visuallyHiddenStyle = {
|
|
242
273
|
border: "0",
|
|
243
274
|
clip: "rect(0 0 0 0)",
|
|
@@ -408,19 +439,6 @@ function connect(state, send, normalize) {
|
|
|
408
439
|
// src/tooltip.machine.ts
|
|
409
440
|
var import_core2 = require("@zag-js/core");
|
|
410
441
|
var import_popper2 = require("@zag-js/popper");
|
|
411
|
-
|
|
412
|
-
// ../../utilities/core/dist/index.mjs
|
|
413
|
-
var isArray2 = (v) => Array.isArray(v);
|
|
414
|
-
var isObject2 = (v) => !(v == null || typeof v !== "object" || isArray2(v));
|
|
415
|
-
function compact(obj) {
|
|
416
|
-
if (obj === void 0)
|
|
417
|
-
return obj;
|
|
418
|
-
return Object.fromEntries(
|
|
419
|
-
Object.entries(obj).filter(([, value]) => value !== void 0).map(([key, value]) => [key, isObject2(value) ? compact(value) : value])
|
|
420
|
-
);
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
// src/tooltip.machine.ts
|
|
424
442
|
function machine(userContext) {
|
|
425
443
|
const ctx = compact(userContext);
|
|
426
444
|
return (0, import_core2.createMachine)(
|