@zag-js/auto-resize
Advanced tools
Comparing version 0.0.0-dev-20230202113057 to 0.0.0-dev-20230222120620
@@ -26,26 +26,7 @@ "use strict"; | ||
module.exports = __toCommonJS(src_exports); | ||
// ../dom/src/query.ts | ||
function isDocument(el) { | ||
return el.nodeType === Node.DOCUMENT_NODE; | ||
} | ||
function isWindow(value) { | ||
return value?.toString() === "[object Window]"; | ||
} | ||
function getDocument(el) { | ||
if (isWindow(el)) | ||
return el.document; | ||
if (isDocument(el)) | ||
return el; | ||
return el?.ownerDocument ?? document; | ||
} | ||
function getWindow(el) { | ||
return el?.ownerDocument.defaultView ?? window; | ||
} | ||
// src/index.ts | ||
var import_dom_query = require("@zag-js/dom-query"); | ||
function copyVisualStyles(fromEl, toEl) { | ||
if (!fromEl) | ||
return; | ||
const win = getWindow(fromEl); | ||
const win = (0, import_dom_query.getWindow)(fromEl); | ||
const el = win.getComputedStyle(fromEl); | ||
@@ -65,4 +46,4 @@ const cssText = "box-sizing:" + el.boxSizing + ";border-left:" + el.borderLeftWidth + " solid red;border-right:" + el.borderRightWidth + " solid red;font-family:" + el.fontFamily + ";font-feature-settings:" + el.fontFeatureSettings + ";font-kerning:" + el.fontKerning + ";font-size:" + el.fontSize + ";font-stretch:" + el.fontStretch + ";font-style:" + el.fontStyle + ";font-variant:" + el.fontVariant + ";font-variant-caps:" + el.fontVariantCaps + ";font-variant-ligatures:" + el.fontVariantLigatures + ";font-variant-numeric:" + el.fontVariantNumeric + ";font-weight:" + el.fontWeight + ";letter-spacing:" + el.letterSpacing + ";margin-left:" + el.marginLeft + ";margin-right:" + el.marginRight + ";padding-left:" + el.paddingLeft + ";padding-right:" + el.paddingRight + ";text-indent:" + el.textIndent + ";text-transform:" + el.textTransform; | ||
return; | ||
const doc = getDocument(input); | ||
const win = getWindow(input); | ||
const doc = (0, import_dom_query.getDocument)(input); | ||
const win = (0, import_dom_query.getWindow)(input); | ||
const ghost = createGhostElement(doc); | ||
@@ -69,0 +50,0 @@ copyVisualStyles(input, ghost); |
{ | ||
"name": "@zag-js/auto-resize", | ||
"version": "0.0.0-dev-20230202113057", | ||
"version": "0.0.0-dev-20230222120620", | ||
"description": "Autoresize utilities for the web", | ||
@@ -24,5 +24,7 @@ "keywords": [ | ||
}, | ||
"dependencies": { | ||
"@zag-js/dom-query": "0.0.0-dev-20230222120620" | ||
}, | ||
"devDependencies": { | ||
"clean-package": "2.2.0", | ||
"@zag-js/dom-utils": "0.0.0-dev-20230202113057" | ||
"clean-package": "2.2.0" | ||
}, | ||
@@ -29,0 +31,0 @@ "clean-package": "../../../clean-package.config.json", |
Sorry, the diff of this file is not supported yet
1
8175
1
116
+ Added@zag-js/dom-query@0.0.0-dev-20230222120620(transitive)