@zag-js/dom-query
Advanced tools
| declare function getScale(element: HTMLElement): { | ||
| x: number; | ||
| y: number; | ||
| }; | ||
| export { getScale }; |
| declare function getScale(element: HTMLElement): { | ||
| x: number; | ||
| y: number; | ||
| }; | ||
| export { getScale }; |
| "use strict"; | ||
| var __defProp = Object.defineProperty; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __export = (target, all) => { | ||
| for (var name in all) | ||
| __defProp(target, name, { get: all[name], enumerable: true }); | ||
| }; | ||
| var __copyProps = (to, from, except, desc) => { | ||
| if (from && typeof from === "object" || typeof from === "function") { | ||
| for (let key of __getOwnPropNames(from)) | ||
| if (!__hasOwnProp.call(to, key) && key !== except) | ||
| __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
| } | ||
| return to; | ||
| }; | ||
| var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
| // src/scale.ts | ||
| var scale_exports = {}; | ||
| __export(scale_exports, { | ||
| getScale: () => getScale | ||
| }); | ||
| module.exports = __toCommonJS(scale_exports); | ||
| function getScale(element) { | ||
| const rect = element.getBoundingClientRect(); | ||
| const offsetWidth = element.offsetWidth; | ||
| const offsetHeight = element.offsetHeight; | ||
| const hasTransform = Math.round(rect.width) !== offsetWidth || Math.round(rect.height) !== offsetHeight; | ||
| let x = hasTransform ? Math.round(rect.width) / offsetWidth : 1; | ||
| let y = hasTransform ? Math.round(rect.height) / offsetHeight : 1; | ||
| if (!x || !Number.isFinite(x)) x = 1; | ||
| if (!y || !Number.isFinite(y)) y = 1; | ||
| return { x, y }; | ||
| } | ||
| // Annotate the CommonJS export names for ESM import in node: | ||
| 0 && (module.exports = { | ||
| getScale | ||
| }); |
| import "./chunk-QZ7TP4HQ.mjs"; | ||
| // src/scale.ts | ||
| function getScale(element) { | ||
| const rect = element.getBoundingClientRect(); | ||
| const offsetWidth = element.offsetWidth; | ||
| const offsetHeight = element.offsetHeight; | ||
| const hasTransform = Math.round(rect.width) !== offsetWidth || Math.round(rect.height) !== offsetHeight; | ||
| let x = hasTransform ? Math.round(rect.width) / offsetWidth : 1; | ||
| let y = hasTransform ? Math.round(rect.height) / offsetHeight : 1; | ||
| if (!x || !Number.isFinite(x)) x = 1; | ||
| if (!y || !Number.isFinite(y)) y = 1; | ||
| return { x, y }; | ||
| } | ||
| export { | ||
| getScale | ||
| }; |
+1
-0
@@ -21,2 +21,3 @@ export { isCaretAtStart, setCaretToEnd } from './caret.mjs'; | ||
| export { resizeObserverBorderBox, resizeObserverContentBox, resizeObserverDevicePixelContentBox } from './resize-observer.mjs'; | ||
| export { getScale } from './scale.mjs'; | ||
| export { ScopeContext, createScope } from './scope.mjs'; | ||
@@ -23,0 +24,0 @@ export { SearchableItem, getByText } from './searchable.mjs'; |
+1
-0
@@ -21,2 +21,3 @@ export { isCaretAtStart, setCaretToEnd } from './caret.js'; | ||
| export { resizeObserverBorderBox, resizeObserverContentBox, resizeObserverDevicePixelContentBox } from './resize-observer.js'; | ||
| export { getScale } from './scale.js'; | ||
| export { ScopeContext, createScope } from './scope.js'; | ||
@@ -23,0 +24,0 @@ export { SearchableItem, getByText } from './searchable.js'; |
+2
-0
@@ -49,2 +49,3 @@ "use strict"; | ||
| __reExport(index_exports, require("./resize-observer.js"), module.exports); | ||
| __reExport(index_exports, require("./scale.js"), module.exports); | ||
| __reExport(index_exports, require("./scope.js"), module.exports); | ||
@@ -85,2 +86,3 @@ __reExport(index_exports, require("./searchable.js"), module.exports); | ||
| ...require("./resize-observer.js"), | ||
| ...require("./scale.js"), | ||
| ...require("./scope.js"), | ||
@@ -87,0 +89,0 @@ ...require("./searchable.js"), |
+1
-0
@@ -24,2 +24,3 @@ import "./chunk-QZ7TP4HQ.mjs"; | ||
| export * from "./resize-observer.mjs"; | ||
| export * from "./scale.mjs"; | ||
| export * from "./scope.mjs"; | ||
@@ -26,0 +27,0 @@ export * from "./searchable.mjs"; |
+2
-2
| { | ||
| "name": "@zag-js/dom-query", | ||
| "version": "1.35.3", | ||
| "version": "1.36.0", | ||
| "description": "The dom helper library for zag.js machines", | ||
@@ -31,3 +31,3 @@ "keywords": [ | ||
| "dependencies": { | ||
| "@zag-js/types": "1.35.3" | ||
| "@zag-js/types": "1.36.0" | ||
| }, | ||
@@ -34,0 +34,0 @@ "module": "dist/index.mjs", |
216034
1.19%136
3.03%4915
1.32%+ Added
- Removed
Updated