@zag-js/tooltip 0.0.0-dev-20220703123907 → 0.0.0-dev-20220704094417
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 +52 -52
- package/dist/index.mjs +52 -52
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -46,6 +46,50 @@ module.exports = __toCommonJS(src_exports);
|
|
|
46
46
|
var dataAttr = (guard) => {
|
|
47
47
|
return guard ? "" : void 0;
|
|
48
48
|
};
|
|
49
|
+
function getCache() {
|
|
50
|
+
const g = globalThis;
|
|
51
|
+
g.__styleCache__ = g.__styleCache__ || /* @__PURE__ */ new WeakMap();
|
|
52
|
+
return g.__styleCache__;
|
|
53
|
+
}
|
|
54
|
+
function getComputedStyle(el) {
|
|
55
|
+
var _a;
|
|
56
|
+
if (!el)
|
|
57
|
+
return {};
|
|
58
|
+
const cache = getCache();
|
|
59
|
+
let style = cache.get(el);
|
|
60
|
+
if (!style) {
|
|
61
|
+
const win = (_a = el == null ? void 0 : el.ownerDocument.defaultView) != null ? _a : window;
|
|
62
|
+
style = win.getComputedStyle(el);
|
|
63
|
+
cache.set(el, style);
|
|
64
|
+
}
|
|
65
|
+
return style;
|
|
66
|
+
}
|
|
67
|
+
function isWindow(value) {
|
|
68
|
+
return (value == null ? void 0 : value.toString()) === "[object Window]";
|
|
69
|
+
}
|
|
70
|
+
function getDocument(el) {
|
|
71
|
+
var _a;
|
|
72
|
+
if (isWindow(el))
|
|
73
|
+
return el.document;
|
|
74
|
+
return (_a = el == null ? void 0 : el.ownerDocument) != null ? _a : document;
|
|
75
|
+
}
|
|
76
|
+
function getWindow(el) {
|
|
77
|
+
var _a;
|
|
78
|
+
return (_a = el == null ? void 0 : el.ownerDocument.defaultView) != null ? _a : window;
|
|
79
|
+
}
|
|
80
|
+
function getNodeName(node) {
|
|
81
|
+
var _a;
|
|
82
|
+
return isWindow(node) ? "" : (_a = node == null ? void 0 : node.localName) != null ? _a : "";
|
|
83
|
+
}
|
|
84
|
+
function getParent(el) {
|
|
85
|
+
const doc = getDocument(el);
|
|
86
|
+
if (getNodeName(el) === "html")
|
|
87
|
+
return el;
|
|
88
|
+
return el.assignedSlot || el.parentElement || doc.documentElement;
|
|
89
|
+
}
|
|
90
|
+
function isHTMLElement(v) {
|
|
91
|
+
return typeof v === "object" && (v == null ? void 0 : v.nodeType) === Node.ELEMENT_NODE && typeof (v == null ? void 0 : v.nodeName) === "string";
|
|
92
|
+
}
|
|
49
93
|
var isDom = () => typeof window !== "undefined";
|
|
50
94
|
var isArray = (v) => Array.isArray(v);
|
|
51
95
|
var isObject = (v) => !(v == null || typeof v !== "object" || isArray(v));
|
|
@@ -59,9 +103,9 @@ var runIfFn = (v, ...a) => {
|
|
|
59
103
|
return res != null ? res : void 0;
|
|
60
104
|
};
|
|
61
105
|
var isRef = (v) => hasProp(v, "current");
|
|
62
|
-
var
|
|
106
|
+
var fallback2 = { pageX: 0, pageY: 0, clientX: 0, clientY: 0 };
|
|
63
107
|
function extractInfo(event, type = "page") {
|
|
64
|
-
const point = isTouchEvent(event) ? event.touches[0] || event.changedTouches[0] ||
|
|
108
|
+
const point = isTouchEvent(event) ? event.touches[0] || event.changedTouches[0] || fallback2 : event;
|
|
65
109
|
return {
|
|
66
110
|
point: {
|
|
67
111
|
x: point[`${type}X`],
|
|
@@ -122,56 +166,6 @@ function getEventName(evt) {
|
|
|
122
166
|
return mouseEventNames[evt];
|
|
123
167
|
return evt;
|
|
124
168
|
}
|
|
125
|
-
function raf(fn) {
|
|
126
|
-
const id = globalThis.requestAnimationFrame(fn);
|
|
127
|
-
return function cleanup() {
|
|
128
|
-
globalThis.cancelAnimationFrame(id);
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
function getCache() {
|
|
132
|
-
const g = globalThis;
|
|
133
|
-
g.__styleCache__ = g.__styleCache__ || /* @__PURE__ */ new WeakMap();
|
|
134
|
-
return g.__styleCache__;
|
|
135
|
-
}
|
|
136
|
-
function getComputedStyle(el) {
|
|
137
|
-
var _a;
|
|
138
|
-
if (!el)
|
|
139
|
-
return {};
|
|
140
|
-
const cache = getCache();
|
|
141
|
-
let style = cache.get(el);
|
|
142
|
-
if (!style) {
|
|
143
|
-
const win = (_a = el == null ? void 0 : el.ownerDocument.defaultView) != null ? _a : window;
|
|
144
|
-
style = win.getComputedStyle(el);
|
|
145
|
-
cache.set(el, style);
|
|
146
|
-
}
|
|
147
|
-
return style;
|
|
148
|
-
}
|
|
149
|
-
function isWindow(value) {
|
|
150
|
-
return (value == null ? void 0 : value.toString()) === "[object Window]";
|
|
151
|
-
}
|
|
152
|
-
function getDocument(el) {
|
|
153
|
-
var _a;
|
|
154
|
-
if (isWindow(el))
|
|
155
|
-
return el.document;
|
|
156
|
-
return (_a = el == null ? void 0 : el.ownerDocument) != null ? _a : document;
|
|
157
|
-
}
|
|
158
|
-
function getWindow(el) {
|
|
159
|
-
var _a;
|
|
160
|
-
return (_a = el == null ? void 0 : el.ownerDocument.defaultView) != null ? _a : window;
|
|
161
|
-
}
|
|
162
|
-
function getNodeName(node) {
|
|
163
|
-
var _a;
|
|
164
|
-
return isWindow(node) ? "" : (_a = node == null ? void 0 : node.localName) != null ? _a : "";
|
|
165
|
-
}
|
|
166
|
-
function getParent(el) {
|
|
167
|
-
const doc = getDocument(el);
|
|
168
|
-
if (getNodeName(el) === "html")
|
|
169
|
-
return el;
|
|
170
|
-
return el.assignedSlot || el.parentElement || doc.documentElement;
|
|
171
|
-
}
|
|
172
|
-
function isHTMLElement(v) {
|
|
173
|
-
return typeof v === "object" && (v == null ? void 0 : v.nodeType) === Node.ELEMENT_NODE && typeof (v == null ? void 0 : v.nodeName) === "string";
|
|
174
|
-
}
|
|
175
169
|
var visuallyHiddenStyle = {
|
|
176
170
|
border: "0",
|
|
177
171
|
clip: "rect(0 0 0 0)",
|
|
@@ -184,6 +178,12 @@ var visuallyHiddenStyle = {
|
|
|
184
178
|
whiteSpace: "nowrap",
|
|
185
179
|
wordWrap: "normal"
|
|
186
180
|
};
|
|
181
|
+
function raf(fn) {
|
|
182
|
+
const id = globalThis.requestAnimationFrame(fn);
|
|
183
|
+
return function cleanup() {
|
|
184
|
+
globalThis.cancelAnimationFrame(id);
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
187
|
function addPointerlockChangeListener(doc, fn) {
|
|
188
188
|
return addDomEvent(doc, "pointerlockchange", fn, false);
|
|
189
189
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -23,6 +23,50 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
23
23
|
var dataAttr = (guard) => {
|
|
24
24
|
return guard ? "" : void 0;
|
|
25
25
|
};
|
|
26
|
+
function getCache() {
|
|
27
|
+
const g = globalThis;
|
|
28
|
+
g.__styleCache__ = g.__styleCache__ || /* @__PURE__ */ new WeakMap();
|
|
29
|
+
return g.__styleCache__;
|
|
30
|
+
}
|
|
31
|
+
function getComputedStyle(el) {
|
|
32
|
+
var _a;
|
|
33
|
+
if (!el)
|
|
34
|
+
return {};
|
|
35
|
+
const cache = getCache();
|
|
36
|
+
let style = cache.get(el);
|
|
37
|
+
if (!style) {
|
|
38
|
+
const win = (_a = el == null ? void 0 : el.ownerDocument.defaultView) != null ? _a : window;
|
|
39
|
+
style = win.getComputedStyle(el);
|
|
40
|
+
cache.set(el, style);
|
|
41
|
+
}
|
|
42
|
+
return style;
|
|
43
|
+
}
|
|
44
|
+
function isWindow(value) {
|
|
45
|
+
return (value == null ? void 0 : value.toString()) === "[object Window]";
|
|
46
|
+
}
|
|
47
|
+
function getDocument(el) {
|
|
48
|
+
var _a;
|
|
49
|
+
if (isWindow(el))
|
|
50
|
+
return el.document;
|
|
51
|
+
return (_a = el == null ? void 0 : el.ownerDocument) != null ? _a : document;
|
|
52
|
+
}
|
|
53
|
+
function getWindow(el) {
|
|
54
|
+
var _a;
|
|
55
|
+
return (_a = el == null ? void 0 : el.ownerDocument.defaultView) != null ? _a : window;
|
|
56
|
+
}
|
|
57
|
+
function getNodeName(node) {
|
|
58
|
+
var _a;
|
|
59
|
+
return isWindow(node) ? "" : (_a = node == null ? void 0 : node.localName) != null ? _a : "";
|
|
60
|
+
}
|
|
61
|
+
function getParent(el) {
|
|
62
|
+
const doc = getDocument(el);
|
|
63
|
+
if (getNodeName(el) === "html")
|
|
64
|
+
return el;
|
|
65
|
+
return el.assignedSlot || el.parentElement || doc.documentElement;
|
|
66
|
+
}
|
|
67
|
+
function isHTMLElement(v) {
|
|
68
|
+
return typeof v === "object" && (v == null ? void 0 : v.nodeType) === Node.ELEMENT_NODE && typeof (v == null ? void 0 : v.nodeName) === "string";
|
|
69
|
+
}
|
|
26
70
|
var isDom = () => typeof window !== "undefined";
|
|
27
71
|
var isArray = (v) => Array.isArray(v);
|
|
28
72
|
var isObject = (v) => !(v == null || typeof v !== "object" || isArray(v));
|
|
@@ -36,9 +80,9 @@ var runIfFn = (v, ...a) => {
|
|
|
36
80
|
return res != null ? res : void 0;
|
|
37
81
|
};
|
|
38
82
|
var isRef = (v) => hasProp(v, "current");
|
|
39
|
-
var
|
|
83
|
+
var fallback2 = { pageX: 0, pageY: 0, clientX: 0, clientY: 0 };
|
|
40
84
|
function extractInfo(event, type = "page") {
|
|
41
|
-
const point = isTouchEvent(event) ? event.touches[0] || event.changedTouches[0] ||
|
|
85
|
+
const point = isTouchEvent(event) ? event.touches[0] || event.changedTouches[0] || fallback2 : event;
|
|
42
86
|
return {
|
|
43
87
|
point: {
|
|
44
88
|
x: point[`${type}X`],
|
|
@@ -99,56 +143,6 @@ function getEventName(evt) {
|
|
|
99
143
|
return mouseEventNames[evt];
|
|
100
144
|
return evt;
|
|
101
145
|
}
|
|
102
|
-
function raf(fn) {
|
|
103
|
-
const id = globalThis.requestAnimationFrame(fn);
|
|
104
|
-
return function cleanup() {
|
|
105
|
-
globalThis.cancelAnimationFrame(id);
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
function getCache() {
|
|
109
|
-
const g = globalThis;
|
|
110
|
-
g.__styleCache__ = g.__styleCache__ || /* @__PURE__ */ new WeakMap();
|
|
111
|
-
return g.__styleCache__;
|
|
112
|
-
}
|
|
113
|
-
function getComputedStyle(el) {
|
|
114
|
-
var _a;
|
|
115
|
-
if (!el)
|
|
116
|
-
return {};
|
|
117
|
-
const cache = getCache();
|
|
118
|
-
let style = cache.get(el);
|
|
119
|
-
if (!style) {
|
|
120
|
-
const win = (_a = el == null ? void 0 : el.ownerDocument.defaultView) != null ? _a : window;
|
|
121
|
-
style = win.getComputedStyle(el);
|
|
122
|
-
cache.set(el, style);
|
|
123
|
-
}
|
|
124
|
-
return style;
|
|
125
|
-
}
|
|
126
|
-
function isWindow(value) {
|
|
127
|
-
return (value == null ? void 0 : value.toString()) === "[object Window]";
|
|
128
|
-
}
|
|
129
|
-
function getDocument(el) {
|
|
130
|
-
var _a;
|
|
131
|
-
if (isWindow(el))
|
|
132
|
-
return el.document;
|
|
133
|
-
return (_a = el == null ? void 0 : el.ownerDocument) != null ? _a : document;
|
|
134
|
-
}
|
|
135
|
-
function getWindow(el) {
|
|
136
|
-
var _a;
|
|
137
|
-
return (_a = el == null ? void 0 : el.ownerDocument.defaultView) != null ? _a : window;
|
|
138
|
-
}
|
|
139
|
-
function getNodeName(node) {
|
|
140
|
-
var _a;
|
|
141
|
-
return isWindow(node) ? "" : (_a = node == null ? void 0 : node.localName) != null ? _a : "";
|
|
142
|
-
}
|
|
143
|
-
function getParent(el) {
|
|
144
|
-
const doc = getDocument(el);
|
|
145
|
-
if (getNodeName(el) === "html")
|
|
146
|
-
return el;
|
|
147
|
-
return el.assignedSlot || el.parentElement || doc.documentElement;
|
|
148
|
-
}
|
|
149
|
-
function isHTMLElement(v) {
|
|
150
|
-
return typeof v === "object" && (v == null ? void 0 : v.nodeType) === Node.ELEMENT_NODE && typeof (v == null ? void 0 : v.nodeName) === "string";
|
|
151
|
-
}
|
|
152
146
|
var visuallyHiddenStyle = {
|
|
153
147
|
border: "0",
|
|
154
148
|
clip: "rect(0 0 0 0)",
|
|
@@ -161,6 +155,12 @@ var visuallyHiddenStyle = {
|
|
|
161
155
|
whiteSpace: "nowrap",
|
|
162
156
|
wordWrap: "normal"
|
|
163
157
|
};
|
|
158
|
+
function raf(fn) {
|
|
159
|
+
const id = globalThis.requestAnimationFrame(fn);
|
|
160
|
+
return function cleanup() {
|
|
161
|
+
globalThis.cancelAnimationFrame(id);
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
164
|
function addPointerlockChangeListener(doc, fn) {
|
|
165
165
|
return addDomEvent(doc, "pointerlockchange", fn, false);
|
|
166
166
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zag-js/tooltip",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20220704094417",
|
|
4
4
|
"description": "Core logic for the tooltip widget implemented as a state machine",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"js",
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
"url": "https://github.com/chakra-ui/zag/issues"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@zag-js/core": "0.0.0-dev-
|
|
33
|
-
"@zag-js/dom-utils": "0.0.0-dev-
|
|
34
|
-
"@zag-js/popper": "0.0.0-dev-
|
|
35
|
-
"@zag-js/types": "0.0.0-dev-
|
|
32
|
+
"@zag-js/core": "0.0.0-dev-20220704094417",
|
|
33
|
+
"@zag-js/dom-utils": "0.0.0-dev-20220704094417",
|
|
34
|
+
"@zag-js/popper": "0.0.0-dev-20220704094417",
|
|
35
|
+
"@zag-js/types": "0.0.0-dev-20220704094417"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
38
38
|
"build:fast": "zag build",
|