@measured/puck 0.16.0-canary.39e7f40 → 0.16.0-canary.538cb05

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/dist/index.js +13 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -32744,7 +32744,7 @@ var import_jsx_runtime30 = require("react/jsx-runtime");
32744
32744
  var styleSelector = 'style, link[rel="stylesheet"]';
32745
32745
  var collectStyles = (doc) => {
32746
32746
  const collected = [];
32747
- doc.head.querySelectorAll(styleSelector).forEach((style) => {
32747
+ doc.querySelectorAll(styleSelector).forEach((style) => {
32748
32748
  collected.push(style);
32749
32749
  });
32750
32750
  return collected;
@@ -32768,6 +32768,14 @@ var getStyles = (styleSheet) => {
32768
32768
  }
32769
32769
  return "";
32770
32770
  };
32771
+ var syncAttributes = (sourceElement, targetElement) => {
32772
+ const attributes = sourceElement.attributes;
32773
+ if ((attributes == null ? void 0 : attributes.length) > 0) {
32774
+ Array.from(attributes).forEach((attribute) => {
32775
+ targetElement.setAttribute(attribute.name, attribute.value);
32776
+ });
32777
+ }
32778
+ };
32771
32779
  var defer = (fn) => setTimeout(fn, 0);
32772
32780
  var CopyHostStyles = ({
32773
32781
  children,
@@ -32885,6 +32893,10 @@ var CopyHostStyles = ({
32885
32893
  const collectedStyles = collectStyles(parentDocument);
32886
32894
  const hrefs = [];
32887
32895
  let stylesLoaded = 0;
32896
+ const parentHtml = parentDocument.getElementsByTagName("html")[0];
32897
+ syncAttributes(parentHtml, doc.documentElement);
32898
+ const parentBody = parentDocument.getElementsByTagName("body")[0];
32899
+ syncAttributes(parentBody, doc.body);
32888
32900
  Promise.all(
32889
32901
  collectedStyles.map((styleNode, i) => __async(void 0, null, function* () {
32890
32902
  if (styleNode.nodeName === "LINK") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@measured/puck",
3
- "version": "0.16.0-canary.39e7f40",
3
+ "version": "0.16.0-canary.538cb05",
4
4
  "author": "Measured Corporation Ltd <hello@measured.co>",
5
5
  "repository": "measuredco/puck",
6
6
  "bugs": "https://github.com/measuredco/puck/issues",