@measured/puck-plugin-heading-analyzer 0.14.2-canary.78047de → 0.14.2-canary.9a7066f
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.js +134 -41
- package/package.json +2 -2
package/dist/index.js
CHANGED
@@ -35956,20 +35956,22 @@ function offsetPoint(x, y, win) {
|
|
35956
35956
|
let offsetY = 0;
|
35957
35957
|
if (win.parent !== win.self) {
|
35958
35958
|
const iframe = win.frameElement;
|
35959
|
-
|
35960
|
-
|
35961
|
-
|
35962
|
-
|
35963
|
-
|
35964
|
-
|
35965
|
-
|
35966
|
-
|
35967
|
-
|
35968
|
-
|
35969
|
-
|
35970
|
-
|
35971
|
-
|
35972
|
-
|
35959
|
+
if (iframe) {
|
35960
|
+
const rect = iframe.getBoundingClientRect();
|
35961
|
+
const transform = getTransform(iframe);
|
35962
|
+
offsetX = rect.left;
|
35963
|
+
offsetY = rect.top;
|
35964
|
+
if (transform) {
|
35965
|
+
const {
|
35966
|
+
x: transformedX,
|
35967
|
+
y: transformedY
|
35968
|
+
} = applyTransformPoint(x, y, transform.matrix, transform.origin);
|
35969
|
+
const point2 = {
|
35970
|
+
x: transformedX + offsetX,
|
35971
|
+
y: transformedY + offsetY
|
35972
|
+
};
|
35973
|
+
return point2;
|
35974
|
+
}
|
35973
35975
|
}
|
35974
35976
|
}
|
35975
35977
|
const point = {
|
@@ -41050,7 +41052,7 @@ var init_dnd_esm = __esm({
|
|
41050
41052
|
}
|
41051
41053
|
if (!el.parentElement) {
|
41052
41054
|
const refWindow = el.ownerDocument.defaultView;
|
41053
|
-
if (refWindow && refWindow.self !== refWindow.parent) {
|
41055
|
+
if (refWindow && refWindow.self !== refWindow.parent && refWindow.frameElement) {
|
41054
41056
|
const iframe = refWindow.frameElement;
|
41055
41057
|
return findNearestTransform(iframe);
|
41056
41058
|
}
|
@@ -41172,7 +41174,7 @@ var init_dnd_esm = __esm({
|
|
41172
41174
|
}) => {
|
41173
41175
|
const el = querySelectorAllIframe(`[data-rfd-draggable-id="${state.critical.draggable.id}"]`)[0];
|
41174
41176
|
const win = (el == null ? void 0 : el.ownerDocument.defaultView) || window;
|
41175
|
-
const isInIframe = win !== window;
|
41177
|
+
const isInIframe = win !== window && win.frameElement;
|
41176
41178
|
if (isInIframe) {
|
41177
41179
|
const iframe = win.frameElement;
|
41178
41180
|
const viewportBox = getBox(iframe);
|
@@ -45866,6 +45868,26 @@ var require_dist = __commonJS({
|
|
45866
45868
|
mod
|
45867
45869
|
));
|
45868
45870
|
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
45871
|
+
var __async2 = (__this, __arguments, generator) => {
|
45872
|
+
return new Promise((resolve, reject) => {
|
45873
|
+
var fulfilled = (value) => {
|
45874
|
+
try {
|
45875
|
+
step(generator.next(value));
|
45876
|
+
} catch (e2) {
|
45877
|
+
reject(e2);
|
45878
|
+
}
|
45879
|
+
};
|
45880
|
+
var rejected = (value) => {
|
45881
|
+
try {
|
45882
|
+
step(generator.throw(value));
|
45883
|
+
} catch (e2) {
|
45884
|
+
reject(e2);
|
45885
|
+
}
|
45886
|
+
};
|
45887
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
45888
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
45889
|
+
});
|
45890
|
+
};
|
45869
45891
|
var auto_frame_component_exports = {};
|
45870
45892
|
__export2(auto_frame_component_exports, {
|
45871
45893
|
default: () => AutoFrameComponent_default
|
@@ -45884,21 +45906,67 @@ var require_dist = __commonJS({
|
|
45884
45906
|
});
|
45885
45907
|
return collected;
|
45886
45908
|
};
|
45909
|
+
var getStyleSheet = (el) => {
|
45910
|
+
return Array.from(document.styleSheets).find((ss) => ss.ownerNode === el);
|
45911
|
+
};
|
45912
|
+
var getStyles2 = (styleSheet) => {
|
45913
|
+
if (styleSheet) {
|
45914
|
+
try {
|
45915
|
+
return [...styleSheet.cssRules].map((rule) => rule.cssText).join("");
|
45916
|
+
} catch (e2) {
|
45917
|
+
console.warn(
|
45918
|
+
"Access to stylesheet %s is denied. Ignoring\u2026",
|
45919
|
+
styleSheet.href
|
45920
|
+
);
|
45921
|
+
}
|
45922
|
+
}
|
45923
|
+
return "";
|
45924
|
+
};
|
45925
|
+
var defer = (fn) => setTimeout(fn, 0);
|
45887
45926
|
var CopyHostStyles = ({
|
45888
45927
|
children,
|
45889
45928
|
debug = false,
|
45890
45929
|
onStylesLoaded = () => null
|
45891
45930
|
}) => {
|
45892
45931
|
const { document: doc, window: win } = (0, import_react_frame_component.useFrame)();
|
45893
|
-
(0, import_react22.
|
45932
|
+
(0, import_react22.useEffect)(() => {
|
45894
45933
|
if (!win || !doc) {
|
45895
45934
|
return () => {
|
45896
45935
|
};
|
45897
45936
|
}
|
45898
|
-
|
45937
|
+
let elements = [];
|
45938
|
+
const hashes = {};
|
45899
45939
|
const lookupEl = (el) => elements.findIndex((elementMap) => elementMap.original === el);
|
45940
|
+
const mirrorEl = (el, onLoad = () => {
|
45941
|
+
}) => __async2(void 0, null, function* () {
|
45942
|
+
let mirror;
|
45943
|
+
if (el.nodeName === "LINK") {
|
45944
|
+
mirror = document.createElement("style");
|
45945
|
+
mirror.type = "text/css";
|
45946
|
+
let styleSheet = getStyleSheet(el);
|
45947
|
+
if (!styleSheet) {
|
45948
|
+
yield new Promise((resolve) => el.onload = resolve);
|
45949
|
+
styleSheet = getStyleSheet(el);
|
45950
|
+
}
|
45951
|
+
const styles = getStyles2(styleSheet);
|
45952
|
+
if (!styles) {
|
45953
|
+
if (debug) {
|
45954
|
+
console.warn(
|
45955
|
+
`Tried to load styles for link element, but couldn't find them. Skipping...`
|
45956
|
+
);
|
45957
|
+
}
|
45958
|
+
return;
|
45959
|
+
}
|
45960
|
+
mirror.innerHTML = styles;
|
45961
|
+
mirror.setAttribute("data-href", el.getAttribute("href"));
|
45962
|
+
} else {
|
45963
|
+
mirror = el.cloneNode(true);
|
45964
|
+
}
|
45965
|
+
mirror.onload = onLoad;
|
45966
|
+
return mirror;
|
45967
|
+
});
|
45900
45968
|
const addEl = (el, onLoad = () => {
|
45901
|
-
}) => {
|
45969
|
+
}) => __async2(void 0, null, function* () {
|
45902
45970
|
const index = lookupEl(el);
|
45903
45971
|
if (index > -1) {
|
45904
45972
|
if (debug)
|
@@ -45909,11 +45977,13 @@ var require_dist = __commonJS({
|
|
45909
45977
|
onLoad();
|
45910
45978
|
return;
|
45911
45979
|
}
|
45912
|
-
const
|
45913
|
-
|
45914
|
-
(
|
45915
|
-
|
45916
|
-
|
45980
|
+
const mirror = yield mirrorEl(el, onLoad);
|
45981
|
+
if (!mirror) {
|
45982
|
+
onLoad();
|
45983
|
+
return;
|
45984
|
+
}
|
45985
|
+
const elHash = (0, import_object_hash.default)(mirror.outerHTML);
|
45986
|
+
if (hashes[elHash]) {
|
45917
45987
|
if (debug)
|
45918
45988
|
console.log(
|
45919
45989
|
`iframe already contains element that is being mirrored. Skipping...`
|
@@ -45921,14 +45991,15 @@ var require_dist = __commonJS({
|
|
45921
45991
|
onLoad();
|
45922
45992
|
return;
|
45923
45993
|
}
|
45924
|
-
|
45994
|
+
hashes[elHash] = true;
|
45925
45995
|
mirror.onload = onLoad;
|
45926
45996
|
doc.head.append(mirror);
|
45927
45997
|
elements.push({ original: el, mirror });
|
45928
45998
|
if (debug)
|
45929
45999
|
console.log(`Added style node ${el.outerHTML}`);
|
45930
|
-
};
|
46000
|
+
});
|
45931
46001
|
const removeEl = (el) => {
|
46002
|
+
var _a3, _b;
|
45932
46003
|
const index = lookupEl(el);
|
45933
46004
|
if (index === -1) {
|
45934
46005
|
if (debug)
|
@@ -45937,7 +46008,9 @@ var require_dist = __commonJS({
|
|
45937
46008
|
);
|
45938
46009
|
return;
|
45939
46010
|
}
|
45940
|
-
|
46011
|
+
const elHash = (0, import_object_hash.default)(el.outerHTML);
|
46012
|
+
(_b = (_a3 = elements[index]) == null ? void 0 : _a3.mirror) == null ? void 0 : _b.remove();
|
46013
|
+
delete hashes[elHash];
|
45941
46014
|
if (debug)
|
45942
46015
|
console.log(`Removed style node ${el.outerHTML}`);
|
45943
46016
|
};
|
@@ -45948,7 +46021,7 @@ var require_dist = __commonJS({
|
|
45948
46021
|
if (node.nodeType === Node.TEXT_NODE || node.nodeType === Node.ELEMENT_NODE) {
|
45949
46022
|
const el = node.nodeType === Node.TEXT_NODE ? node.parentElement : node;
|
45950
46023
|
if (el && el.matches(styleSelector)) {
|
45951
|
-
addEl(el);
|
46024
|
+
defer(() => addEl(el));
|
45952
46025
|
}
|
45953
46026
|
}
|
45954
46027
|
});
|
@@ -45956,7 +46029,7 @@ var require_dist = __commonJS({
|
|
45956
46029
|
if (node.nodeType === Node.TEXT_NODE || node.nodeType === Node.ELEMENT_NODE) {
|
45957
46030
|
const el = node.nodeType === Node.TEXT_NODE ? node.parentElement : node;
|
45958
46031
|
if (el && el.matches(styleSelector)) {
|
45959
|
-
removeEl(el);
|
46032
|
+
defer(() => removeEl(el));
|
45960
46033
|
}
|
45961
46034
|
}
|
45962
46035
|
});
|
@@ -45966,25 +46039,45 @@ var require_dist = __commonJS({
|
|
45966
46039
|
const parentDocument = win.parent.document;
|
45967
46040
|
const collectedStyles = collectStyles(parentDocument);
|
45968
46041
|
let mountedCounter = 0;
|
45969
|
-
|
45970
|
-
|
45971
|
-
|
45972
|
-
|
45973
|
-
|
45974
|
-
|
46042
|
+
Promise.all(
|
46043
|
+
collectedStyles.map((styleNode) => __async2(void 0, null, function* () {
|
46044
|
+
const mirror = yield mirrorEl(styleNode, () => {
|
46045
|
+
mountedCounter += 1;
|
46046
|
+
if (mountedCounter === collectedStyles.length) {
|
46047
|
+
onStylesLoaded();
|
46048
|
+
}
|
46049
|
+
});
|
46050
|
+
if (!mirror)
|
46051
|
+
return;
|
46052
|
+
elements.push({ original: styleNode, mirror });
|
46053
|
+
return mirror;
|
46054
|
+
}))
|
46055
|
+
).then((mirrorStyles) => {
|
46056
|
+
const filtered = mirrorStyles.filter(
|
46057
|
+
(el) => typeof el !== "undefined"
|
46058
|
+
);
|
46059
|
+
doc.head.innerHTML = "";
|
46060
|
+
doc.head.append(...filtered);
|
46061
|
+
observer.observe(parentDocument.head, { childList: true, subtree: true });
|
46062
|
+
filtered.forEach((el) => {
|
46063
|
+
const elHash = (0, import_object_hash.default)(el.outerHTML);
|
46064
|
+
hashes[elHash] = true;
|
45975
46065
|
});
|
45976
46066
|
});
|
45977
|
-
observer.observe(parentDocument.head, { childList: true, subtree: true });
|
45978
46067
|
return () => {
|
45979
46068
|
observer.disconnect();
|
45980
46069
|
};
|
45981
46070
|
}, []);
|
45982
46071
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_jsx_runtime8.Fragment, { children });
|
45983
46072
|
};
|
45984
|
-
var
|
45985
|
-
|
45986
|
-
|
45987
|
-
|
46073
|
+
var AutoFrameComponent = import_react22.default.forwardRef(
|
46074
|
+
function(_a3, ref2) {
|
46075
|
+
var _b = _a3, { children, debug, onStylesLoaded } = _b, props = __objRest2(_b, ["children", "debug", "onStylesLoaded"]);
|
46076
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_frame_component.default, __spreadProps2(__spreadValues2({}, props), { ref: ref2, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CopyHostStyles, { debug, onStylesLoaded, children }) }));
|
46077
|
+
}
|
46078
|
+
);
|
46079
|
+
AutoFrameComponent.displayName = "AutoFrameComponent";
|
46080
|
+
var AutoFrameComponent_default = AutoFrameComponent;
|
45988
46081
|
}
|
45989
46082
|
});
|
45990
46083
|
|
@@ -78257,7 +78350,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
78257
78350
|
onChange(e2.currentTarget.value);
|
78258
78351
|
},
|
78259
78352
|
disabled: readOnly,
|
78260
|
-
|
78353
|
+
checked: value === option.value
|
78261
78354
|
}
|
78262
78355
|
),
|
78263
78356
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName14("radioInner"), children: option.label || option.value })
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@measured/puck-plugin-heading-analyzer",
|
3
|
-
"version": "0.14.2-canary.
|
3
|
+
"version": "0.14.2-canary.9a7066f",
|
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.14.2-canary.
|
21
|
+
"@measured/puck": "^0.14.2-canary.9a7066f",
|
22
22
|
"@types/react": "^18.2.0",
|
23
23
|
"@types/react-dom": "^18.2.0",
|
24
24
|
"eslint": "^7.32.0",
|