@zag-js/tooltip 0.0.0-dev-20220627213111 → 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 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 getOwnerDocument(el) {
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 getOwnerWindow(el) {
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
- return isWindow(node) ? "" : node ? node.localName || "" : "";
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 = getOwnerDocument(el);
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 getOwnerDocument(el).body;
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 === getOwnerDocument(el).body;
205
- const win = getOwnerWindow(scrollParent);
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)
@@ -213,16 +214,6 @@ function getScrollParents(el, list = []) {
213
214
  // src/tooltip.connect.ts
214
215
  var import_popper = require("@zag-js/popper");
215
216
 
216
- // ../../types/dist/index.mjs
217
- function createNormalizer(fn) {
218
- return new Proxy({}, {
219
- get() {
220
- return fn;
221
- }
222
- });
223
- }
224
- var normalizeProp = createNormalizer((v) => v);
225
-
226
217
  // src/tooltip.dom.ts
227
218
  var dom = {
228
219
  getDoc: (ctx) => {
@@ -273,7 +264,7 @@ var store = (0, import_core.proxy)({
273
264
  });
274
265
 
275
266
  // src/tooltip.connect.ts
276
- function connect(state, send, normalize = normalizeProp) {
267
+ function connect(state, send, normalize) {
277
268
  const id = state.context.id;
278
269
  const hasAriaLabel = state.context.hasAriaLabel;
279
270
  const isOpen = state.hasTag("open");
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 getOwnerDocument(el) {
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 getOwnerWindow(el) {
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
- return isWindow(node) ? "" : node ? node.localName || "" : "";
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 = getOwnerDocument(el);
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 getOwnerDocument(el).body;
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 === getOwnerDocument(el).body;
182
- const win = getOwnerWindow(scrollParent);
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)
@@ -190,16 +191,6 @@ function getScrollParents(el, list = []) {
190
191
  // src/tooltip.connect.ts
191
192
  import { getPlacementStyles } from "@zag-js/popper";
192
193
 
193
- // ../../types/dist/index.mjs
194
- function createNormalizer(fn) {
195
- return new Proxy({}, {
196
- get() {
197
- return fn;
198
- }
199
- });
200
- }
201
- var normalizeProp = createNormalizer((v) => v);
202
-
203
194
  // src/tooltip.dom.ts
204
195
  var dom = {
205
196
  getDoc: (ctx) => {
@@ -250,7 +241,7 @@ var store = proxy({
250
241
  });
251
242
 
252
243
  // src/tooltip.connect.ts
253
- function connect(state, send, normalize = normalizeProp) {
244
+ function connect(state, send, normalize) {
254
245
  const id = state.context.id;
255
246
  const hasAriaLabel = state.context.hasAriaLabel;
256
247
  const isOpen = state.hasTag("open");
@@ -1,6 +1,6 @@
1
- import { PropTypes, ReactPropTypes } from "@zag-js/types";
2
- import { Send, State } from "./tooltip.types";
3
- export declare function connect<T extends PropTypes = ReactPropTypes>(state: State, send: Send, normalize?: import("@zag-js/types").NormalizeProps): {
1
+ import type { NormalizeProps, PropTypes } from "@zag-js/types";
2
+ import type { Send, State } from "./tooltip.types";
3
+ export declare function connect<T extends PropTypes>(state: State, send: Send, normalize: NormalizeProps<T>): {
4
4
  isOpen: boolean;
5
5
  open(): void;
6
6
  close(): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/tooltip",
3
- "version": "0.0.0-dev-20220627213111",
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-20220627213111",
33
- "@zag-js/dom-utils": "0.0.0-dev-20220627213111",
34
- "@zag-js/popper": "0.0.0-dev-20220627213111",
35
- "@zag-js/types": "0.2.0"
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",