@atomico/hooks
Advanced tools
Comparing version 3.36.0 to 3.36.1
{ | ||
"name": "@atomico/hooks", | ||
"description": "Series of utilities in hooks format to extend the operation of Atomico", | ||
"version": "3.36.0", | ||
"version": "3.36.1", | ||
"type": "module", | ||
@@ -20,4 +20,3 @@ "workspaces": [ | ||
"atomico": "^1.45.0", | ||
"@lit/reactive-element": "^1.0.2", | ||
"@atomico/design-tokens": "latest" | ||
"@lit/reactive-element": "^1.0.2" | ||
}, | ||
@@ -72,3 +71,2 @@ "devDependencies": { | ||
"@atomico/channel": "^0.0.0", | ||
"@atomico/design-tokens": "latest", | ||
"dollars.js": "^0.6.2", | ||
@@ -75,0 +73,0 @@ "element-internals-polyfill": "^0.1.49", |
{ | ||
"type": "module", | ||
"dependencies": { | ||
@@ -3,0 +4,0 @@ "@atomico/channel": "^0.0.0" |
{ | ||
"type": "module", | ||
"devDependencies": { | ||
@@ -3,0 +4,0 @@ "@lit/reactive-element": "^1.0.2" |
@@ -49,1 +49,51 @@ /** | ||
} | ||
/*** | ||
* @type {HTMLIFrameElement} | ||
*/ | ||
let sandbox; | ||
/** | ||
* | ||
* @param {import("atomico").Sheet} style | ||
* @returns | ||
*/ | ||
export function getSheet(style) { | ||
if (style instanceof CSSStyleSheet) { | ||
return style; | ||
} | ||
if (style.sheet) { | ||
return style.sheet; | ||
} | ||
if (!sandbox) { | ||
sandbox = document.createElement("iframe"); | ||
sandbox.style.display = "none"; | ||
document.body.appendChild(sandbox); | ||
} | ||
const { contentDocument } = sandbox; | ||
contentDocument.head.appendChild(style); | ||
const { sheet } = style; | ||
const { cloneNode } = style; | ||
/** | ||
* | ||
* @param {boolean} [deep] | ||
* @returns {HTMLElement} | ||
*/ | ||
style.cloneNode = (deep) => { | ||
const copy = cloneNode.call(style); | ||
const { cssRules } = sheet; | ||
for (let i = 0; i < cssRules.length; i++) { | ||
copy.textContent += cssRules[i].cssText; | ||
} | ||
return copy; | ||
}; | ||
return sheet; | ||
} |
import { useHost, useLayoutEffect } from "atomico"; | ||
import { getSheet } from "@atomico/design-tokens"; | ||
import { getRules } from "./src/utils.js"; | ||
import { getRules, getSheet } from "./src/utils.js"; | ||
@@ -5,0 +4,0 @@ let ID = 0; |
{ | ||
"type": "module", | ||
"dependencies": { | ||
@@ -3,0 +4,0 @@ "dollars.js": "^0.6.2" |
{ | ||
"type": "module", | ||
"dependencies": { | ||
@@ -3,0 +4,0 @@ "@uppercod/form-tools": "^0.0.0" |
{ | ||
"type": "module", | ||
"dependencies": { | ||
@@ -3,0 +4,0 @@ "element-internals-polyfill": "^0.1.49" |
{ | ||
"type": "module", | ||
"dependencies": { | ||
@@ -3,0 +4,0 @@ "@uppercod/exp-route": "^1.3.0" |
{ | ||
"type": "module", | ||
"dependencies": { | ||
@@ -3,0 +4,0 @@ "@uppercod/hash": "^1.1.1" |
@@ -5,1 +5,7 @@ /** | ||
export function getRules(Sheet: any, scopeSelector: any): any; | ||
/** | ||
* | ||
* @param {import("atomico").Sheet} style | ||
* @returns | ||
*/ | ||
export function getSheet(style: import("atomico").Sheet): CSSStyleSheet | null; |
94899
8
2806
115
- Removed@atomico/design-tokens@latest
- Removed@atomico/design-tokens@1.5.2(transitive)