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

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.
Files changed (2) hide show
  1. package/dist/index.js +13 -1
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -76984,7 +76984,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
76984
76984
  var styleSelector = 'style, link[rel="stylesheet"]';
76985
76985
  var collectStyles = (doc) => {
76986
76986
  const collected = [];
76987
- doc.head.querySelectorAll(styleSelector).forEach((style2) => {
76987
+ doc.querySelectorAll(styleSelector).forEach((style2) => {
76988
76988
  collected.push(style2);
76989
76989
  });
76990
76990
  return collected;
@@ -77008,6 +77008,14 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
77008
77008
  }
77009
77009
  return "";
77010
77010
  };
77011
+ var syncAttributes = (sourceElement, targetElement) => {
77012
+ const attributes = sourceElement.attributes;
77013
+ if ((attributes == null ? void 0 : attributes.length) > 0) {
77014
+ Array.from(attributes).forEach((attribute) => {
77015
+ targetElement.setAttribute(attribute.name, attribute.value);
77016
+ });
77017
+ }
77018
+ };
77011
77019
  var defer = (fn) => setTimeout(fn, 0);
77012
77020
  var CopyHostStyles = ({
77013
77021
  children,
@@ -77125,6 +77133,10 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
77125
77133
  const collectedStyles = collectStyles(parentDocument);
77126
77134
  const hrefs = [];
77127
77135
  let stylesLoaded = 0;
77136
+ const parentHtml = parentDocument.getElementsByTagName("html")[0];
77137
+ syncAttributes(parentHtml, doc.documentElement);
77138
+ const parentBody = parentDocument.getElementsByTagName("body")[0];
77139
+ syncAttributes(parentBody, doc.body);
77128
77140
  Promise.all(
77129
77141
  collectedStyles.map((styleNode, i2) => __async2(void 0, null, function* () {
77130
77142
  if (styleNode.nodeName === "LINK") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@measured/puck-plugin-heading-analyzer",
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",
@@ -18,7 +18,7 @@
18
18
  "dist"
19
19
  ],
20
20
  "devDependencies": {
21
- "@measured/puck": "^0.16.0-canary.39e7f40",
21
+ "@measured/puck": "^0.16.0-canary.538cb05",
22
22
  "@types/react": "^18.2.0",
23
23
  "@types/react-dom": "^18.2.0",
24
24
  "eslint": "^7.32.0",