@zag-js/tooltip 0.0.0-dev-20220628115342 → 0.0.0-dev-20220703123907
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 +8 -7
- package/dist/index.mjs +8 -7
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -149,21 +149,22 @@ function getComputedStyle(el) {
|
|
|
149
149
|
function isWindow(value) {
|
|
150
150
|
return (value == null ? void 0 : value.toString()) === "[object Window]";
|
|
151
151
|
}
|
|
152
|
-
function
|
|
152
|
+
function getDocument(el) {
|
|
153
153
|
var _a;
|
|
154
154
|
if (isWindow(el))
|
|
155
155
|
return el.document;
|
|
156
156
|
return (_a = el == null ? void 0 : el.ownerDocument) != null ? _a : document;
|
|
157
157
|
}
|
|
158
|
-
function
|
|
158
|
+
function getWindow(el) {
|
|
159
159
|
var _a;
|
|
160
160
|
return (_a = el == null ? void 0 : el.ownerDocument.defaultView) != null ? _a : window;
|
|
161
161
|
}
|
|
162
162
|
function getNodeName(node) {
|
|
163
|
-
|
|
163
|
+
var _a;
|
|
164
|
+
return isWindow(node) ? "" : (_a = node == null ? void 0 : node.localName) != null ? _a : "";
|
|
164
165
|
}
|
|
165
166
|
function getParent(el) {
|
|
166
|
-
const doc =
|
|
167
|
+
const doc = getDocument(el);
|
|
167
168
|
if (getNodeName(el) === "html")
|
|
168
169
|
return el;
|
|
169
170
|
return el.assignedSlot || el.parentElement || doc.documentElement;
|
|
@@ -192,7 +193,7 @@ function isScrollParent(el) {
|
|
|
192
193
|
}
|
|
193
194
|
function getScrollParent(el) {
|
|
194
195
|
if (["html", "body", "#document"].includes(getNodeName(el))) {
|
|
195
|
-
return
|
|
196
|
+
return getDocument(el).body;
|
|
196
197
|
}
|
|
197
198
|
if (isHTMLElement(el) && isScrollParent(el)) {
|
|
198
199
|
return el;
|
|
@@ -201,8 +202,8 @@ function getScrollParent(el) {
|
|
|
201
202
|
}
|
|
202
203
|
function getScrollParents(el, list = []) {
|
|
203
204
|
const scrollParent = getScrollParent(el);
|
|
204
|
-
const isBody = scrollParent ===
|
|
205
|
-
const win =
|
|
205
|
+
const isBody = scrollParent === getDocument(el).body;
|
|
206
|
+
const win = getWindow(scrollParent);
|
|
206
207
|
const target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
|
|
207
208
|
const parents = list.concat(target);
|
|
208
209
|
if (isBody)
|
package/dist/index.mjs
CHANGED
|
@@ -126,21 +126,22 @@ function getComputedStyle(el) {
|
|
|
126
126
|
function isWindow(value) {
|
|
127
127
|
return (value == null ? void 0 : value.toString()) === "[object Window]";
|
|
128
128
|
}
|
|
129
|
-
function
|
|
129
|
+
function getDocument(el) {
|
|
130
130
|
var _a;
|
|
131
131
|
if (isWindow(el))
|
|
132
132
|
return el.document;
|
|
133
133
|
return (_a = el == null ? void 0 : el.ownerDocument) != null ? _a : document;
|
|
134
134
|
}
|
|
135
|
-
function
|
|
135
|
+
function getWindow(el) {
|
|
136
136
|
var _a;
|
|
137
137
|
return (_a = el == null ? void 0 : el.ownerDocument.defaultView) != null ? _a : window;
|
|
138
138
|
}
|
|
139
139
|
function getNodeName(node) {
|
|
140
|
-
|
|
140
|
+
var _a;
|
|
141
|
+
return isWindow(node) ? "" : (_a = node == null ? void 0 : node.localName) != null ? _a : "";
|
|
141
142
|
}
|
|
142
143
|
function getParent(el) {
|
|
143
|
-
const doc =
|
|
144
|
+
const doc = getDocument(el);
|
|
144
145
|
if (getNodeName(el) === "html")
|
|
145
146
|
return el;
|
|
146
147
|
return el.assignedSlot || el.parentElement || doc.documentElement;
|
|
@@ -169,7 +170,7 @@ function isScrollParent(el) {
|
|
|
169
170
|
}
|
|
170
171
|
function getScrollParent(el) {
|
|
171
172
|
if (["html", "body", "#document"].includes(getNodeName(el))) {
|
|
172
|
-
return
|
|
173
|
+
return getDocument(el).body;
|
|
173
174
|
}
|
|
174
175
|
if (isHTMLElement(el) && isScrollParent(el)) {
|
|
175
176
|
return el;
|
|
@@ -178,8 +179,8 @@ function getScrollParent(el) {
|
|
|
178
179
|
}
|
|
179
180
|
function getScrollParents(el, list = []) {
|
|
180
181
|
const scrollParent = getScrollParent(el);
|
|
181
|
-
const isBody = scrollParent ===
|
|
182
|
-
const win =
|
|
182
|
+
const isBody = scrollParent === getDocument(el).body;
|
|
183
|
+
const win = getWindow(scrollParent);
|
|
183
184
|
const target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
|
|
184
185
|
const parents = list.concat(target);
|
|
185
186
|
if (isBody)
|
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-20220703123907",
|
|
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-20220703123907",
|
|
33
|
+
"@zag-js/dom-utils": "0.0.0-dev-20220703123907",
|
|
34
|
+
"@zag-js/popper": "0.0.0-dev-20220703123907",
|
|
35
|
+
"@zag-js/types": "0.0.0-dev-20220703123907"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
38
38
|
"build:fast": "zag build",
|