@measured/puck-plugin-heading-analyzer 0.14.0-canary.70cf177 → 0.14.0-canary.924c85a
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.js +38 -20
- package/package.json +2 -2
package/dist/index.js
CHANGED
@@ -43102,7 +43102,8 @@ var require_dist = __commonJS({
|
|
43102
43102
|
};
|
43103
43103
|
var CopyHostStyles = ({
|
43104
43104
|
children,
|
43105
|
-
debug = false
|
43105
|
+
debug = false,
|
43106
|
+
onStylesLoaded = () => null
|
43106
43107
|
}) => {
|
43107
43108
|
const { document: doc, window: win } = (0, import_react_frame_component.useFrame)();
|
43108
43109
|
(0, import_react22.useLayoutEffect)(() => {
|
@@ -43112,7 +43113,8 @@ var require_dist = __commonJS({
|
|
43112
43113
|
}
|
43113
43114
|
const elements = [];
|
43114
43115
|
const lookupEl = (el) => elements.findIndex((elementMap) => elementMap.original === el);
|
43115
|
-
const addEl = (el) => {
|
43116
|
+
const addEl = (el, onLoad = () => {
|
43117
|
+
}) => {
|
43116
43118
|
const index = lookupEl(el);
|
43117
43119
|
if (index > -1) {
|
43118
43120
|
if (debug)
|
@@ -43120,6 +43122,7 @@ var require_dist = __commonJS({
|
|
43120
43122
|
`Tried to add an element that was already mirrored. Updating instead...`
|
43121
43123
|
);
|
43122
43124
|
elements[index].mirror.innerText = el.innerText;
|
43125
|
+
onLoad();
|
43123
43126
|
return;
|
43124
43127
|
}
|
43125
43128
|
const elHash = (0, import_object_hash.default)(el.outerHTML);
|
@@ -43131,9 +43134,11 @@ var require_dist = __commonJS({
|
|
43131
43134
|
console.log(
|
43132
43135
|
`iframe already contains element that is being mirrored. Skipping...`
|
43133
43136
|
);
|
43137
|
+
onLoad();
|
43134
43138
|
return;
|
43135
43139
|
}
|
43136
43140
|
const mirror = el.cloneNode(true);
|
43141
|
+
mirror.onload = onLoad;
|
43137
43142
|
doc.head.append(mirror);
|
43138
43143
|
elements.push({ original: el, mirror });
|
43139
43144
|
if (debug)
|
@@ -43176,8 +43181,15 @@ var require_dist = __commonJS({
|
|
43176
43181
|
});
|
43177
43182
|
const parentDocument = win.parent.document;
|
43178
43183
|
const collectedStyles = collectStyles(parentDocument);
|
43184
|
+
let mountedCounter = 0;
|
43179
43185
|
collectedStyles.forEach((styleNode) => {
|
43180
|
-
addEl(styleNode)
|
43186
|
+
addEl(styleNode, () => {
|
43187
|
+
console.log("load style");
|
43188
|
+
mountedCounter += 1;
|
43189
|
+
if (mountedCounter === collectedStyles.length) {
|
43190
|
+
onStylesLoaded();
|
43191
|
+
}
|
43192
|
+
});
|
43181
43193
|
});
|
43182
43194
|
observer.observe(parentDocument.head, { childList: true, subtree: true });
|
43183
43195
|
return () => {
|
@@ -43187,8 +43199,8 @@ var require_dist = __commonJS({
|
|
43187
43199
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_jsx_runtime8.Fragment, { children });
|
43188
43200
|
};
|
43189
43201
|
var AutoFrameComponent_default = import_react22.default.forwardRef(function(_a, ref2) {
|
43190
|
-
var _b = _a, { children, debug } = _b, props = __objRest2(_b, ["children", "debug"]);
|
43191
|
-
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, children }) }));
|
43202
|
+
var _b = _a, { children, debug, onStylesLoaded } = _b, props = __objRest2(_b, ["children", "debug", "onStylesLoaded"]);
|
43203
|
+
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 }) }));
|
43192
43204
|
});
|
43193
43205
|
}
|
43194
43206
|
});
|
@@ -51737,7 +51749,7 @@ var require_dist2 = __commonJS({
|
|
51737
51749
|
var HostPortal = 4;
|
51738
51750
|
var HostComponent = 5;
|
51739
51751
|
var HostText = 6;
|
51740
|
-
var
|
51752
|
+
var Fragment16 = 7;
|
51741
51753
|
var Mode = 8;
|
51742
51754
|
var ContextConsumer = 9;
|
51743
51755
|
var ContextProvider = 10;
|
@@ -52893,7 +52905,7 @@ var require_dist2 = __commonJS({
|
|
52893
52905
|
return "DehydratedFragment";
|
52894
52906
|
case ForwardRef:
|
52895
52907
|
return getWrappedName$1(type, type.render, "ForwardRef");
|
52896
|
-
case
|
52908
|
+
case Fragment16:
|
52897
52909
|
return "Fragment";
|
52898
52910
|
case HostComponent:
|
52899
52911
|
return type;
|
@@ -62564,7 +62576,7 @@ var require_dist2 = __commonJS({
|
|
62564
62576
|
}
|
62565
62577
|
}
|
62566
62578
|
function updateFragment2(returnFiber, current2, fragment, lanes, key) {
|
62567
|
-
if (current2 === null || current2.tag !==
|
62579
|
+
if (current2 === null || current2.tag !== Fragment16) {
|
62568
62580
|
var created = createFiberFromFragment(fragment, returnFiber.mode, lanes, key);
|
62569
62581
|
created.return = returnFiber;
|
62570
62582
|
return created;
|
@@ -62967,7 +62979,7 @@ var require_dist2 = __commonJS({
|
|
62967
62979
|
if (child.key === key) {
|
62968
62980
|
var elementType = element.type;
|
62969
62981
|
if (elementType === REACT_FRAGMENT_TYPE) {
|
62970
|
-
if (child.tag ===
|
62982
|
+
if (child.tag === Fragment16) {
|
62971
62983
|
deleteRemainingChildren(returnFiber, child.sibling);
|
62972
62984
|
var existing = useFiber(child, element.props.children);
|
62973
62985
|
existing.return = returnFiber;
|
@@ -67142,7 +67154,7 @@ var require_dist2 = __commonJS({
|
|
67142
67154
|
var _resolvedProps2 = workInProgress2.elementType === type ? _unresolvedProps2 : resolveDefaultProps(type, _unresolvedProps2);
|
67143
67155
|
return updateForwardRef(current2, workInProgress2, type, _resolvedProps2, renderLanes2);
|
67144
67156
|
}
|
67145
|
-
case
|
67157
|
+
case Fragment16:
|
67146
67158
|
return updateFragment(current2, workInProgress2, renderLanes2);
|
67147
67159
|
case Mode:
|
67148
67160
|
return updateMode(current2, workInProgress2, renderLanes2);
|
@@ -67415,7 +67427,7 @@ var require_dist2 = __commonJS({
|
|
67415
67427
|
case SimpleMemoComponent:
|
67416
67428
|
case FunctionComponent:
|
67417
67429
|
case ForwardRef:
|
67418
|
-
case
|
67430
|
+
case Fragment16:
|
67419
67431
|
case Mode:
|
67420
67432
|
case Profiler:
|
67421
67433
|
case ContextConsumer:
|
@@ -71674,7 +71686,7 @@ var require_dist2 = __commonJS({
|
|
71674
71686
|
return fiber;
|
71675
71687
|
}
|
71676
71688
|
function createFiberFromFragment(elements, mode, lanes, key) {
|
71677
|
-
var fiber = createFiber(
|
71689
|
+
var fiber = createFiber(Fragment16, elements, key, mode);
|
71678
71690
|
fiber.lanes = lanes;
|
71679
71691
|
return fiber;
|
71680
71692
|
}
|
@@ -73017,7 +73029,7 @@ var require_dist2 = __commonJS({
|
|
73017
73029
|
draggingFromThisWith: null,
|
73018
73030
|
isUsingPlaceholder: false
|
73019
73031
|
};
|
73020
|
-
var DefaultDroppable = ({ children }) => children(defaultProvided, defaultSnapshot);
|
73032
|
+
var DefaultDroppable = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_jsx_runtime32.Fragment, { children: children(defaultProvided, defaultSnapshot) });
|
73021
73033
|
var Droppable2 = (props) => {
|
73022
73034
|
const { status } = useAppContext2();
|
73023
73035
|
const El = status === "READY" ? import_dnd.Droppable : DefaultDroppable;
|
@@ -73051,7 +73063,7 @@ var require_dist2 = __commonJS({
|
|
73051
73063
|
type: "",
|
73052
73064
|
source: { droppableId: "", index: 0 }
|
73053
73065
|
};
|
73054
|
-
var DefaultDraggable = ({ children }) => children(defaultProvided2, defaultSnapshot2, defaultRubric);
|
73066
|
+
var DefaultDraggable = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_jsx_runtime42.Fragment, { children: children(defaultProvided2, defaultSnapshot2, defaultRubric) });
|
73055
73067
|
var Draggable2 = ({
|
73056
73068
|
className,
|
73057
73069
|
children,
|
@@ -73178,7 +73190,7 @@ var require_dist2 = __commonJS({
|
|
73178
73190
|
var import_react72 = require("react");
|
73179
73191
|
var import_dnd3 = (init_dnd_esm(), __toCommonJS(dnd_esm_exports));
|
73180
73192
|
init_react_import2();
|
73181
|
-
var styles_module_default32 = { "DraggableComponent": "
|
73193
|
+
var styles_module_default32 = { "DraggableComponent": "_DraggableComponent_17mte_1", "DraggableComponent--isDragging": "_DraggableComponent--isDragging_17mte_11", "DraggableComponent-contents": "_DraggableComponent-contents_17mte_16", "DraggableComponent-overlay": "_DraggableComponent-overlay_17mte_29", "DraggableComponent-loadingOverlay": "_DraggableComponent-loadingOverlay_17mte_49", "DraggableComponent--isLocked": "_DraggableComponent--isLocked_17mte_65", "DraggableComponent--forceHover": "_DraggableComponent--forceHover_17mte_71", "DraggableComponent--isSelected": "_DraggableComponent--isSelected_17mte_76", "DraggableComponent--indicativeHover": "_DraggableComponent--indicativeHover_17mte_81", "DraggableComponent-actionsOverlay": "_DraggableComponent-actionsOverlay_17mte_97", "DraggableComponent-actions": "_DraggableComponent-actions_17mte_97", "DraggableComponent-actionsLabel": "_DraggableComponent-actionsLabel_17mte_127", "DraggableComponent-action": "_DraggableComponent-action_17mte_97" };
|
73182
73194
|
init_react_import2();
|
73183
73195
|
init_react_import2();
|
73184
73196
|
var import_react52 = require("react");
|
@@ -74762,7 +74774,7 @@ var require_dist2 = __commonJS({
|
|
74762
74774
|
init_react_import2();
|
74763
74775
|
var import_dnd4 = (init_dnd_esm(), __toCommonJS(dnd_esm_exports));
|
74764
74776
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
74765
|
-
var DefaultDragDropContext = ({ children }) => children;
|
74777
|
+
var DefaultDragDropContext = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_jsx_runtime14.Fragment, { children });
|
74766
74778
|
var DragDropContext2 = (props) => {
|
74767
74779
|
const { status } = useAppContext2();
|
74768
74780
|
const El = status === "READY" ? import_dnd4.DragDropContext : DefaultDragDropContext;
|
@@ -75923,7 +75935,7 @@ var require_dist2 = __commonJS({
|
|
75923
75935
|
var import_react222 = require("react");
|
75924
75936
|
var import_auto_frame_component = __toESM2(require_dist());
|
75925
75937
|
init_react_import2();
|
75926
|
-
var styles_module_default16 = { "PuckPreview": "
|
75938
|
+
var styles_module_default16 = { "PuckPreview": "_PuckPreview_379hm_1", "PuckPreview-iframe": "_PuckPreview-iframe_379hm_5", "PuckPreview-content": "_PuckPreview-content_379hm_11", "PuckPreview--stylesLoaded": "_PuckPreview--stylesLoaded_379hm_18" };
|
75927
75939
|
var import_jsx_runtime29 = require("react/jsx-runtime");
|
75928
75940
|
var getClassName21 = get_class_name_factory_default2("PuckPreview", styles_module_default16);
|
75929
75941
|
var Preview = ({ id = "puck-preview" }) => {
|
@@ -75937,24 +75949,30 @@ var require_dist2 = __commonJS({
|
|
75937
75949
|
);
|
75938
75950
|
const rootProps = state.data.root.props || state.data.root;
|
75939
75951
|
const ref2 = (0, import_react222.useRef)(null);
|
75952
|
+
const [stylesLoaded, setStylesLoaded] = (0, import_react222.useState)(false);
|
75940
75953
|
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
75941
75954
|
"div",
|
75942
75955
|
{
|
75943
|
-
className: getClassName21(),
|
75956
|
+
className: getClassName21({ stylesLoaded }),
|
75944
75957
|
id,
|
75945
75958
|
onClick: () => {
|
75946
75959
|
dispatch({ type: "setUi", ui: __spreadProps2(__spreadValues2({}, state.ui), { itemSelector: null }) });
|
75947
75960
|
},
|
75948
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
75961
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName21("content"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
75949
75962
|
import_auto_frame_component.default,
|
75950
75963
|
{
|
75951
75964
|
id: "preview-iframe",
|
75952
75965
|
className: getClassName21("iframe"),
|
75953
75966
|
"data-rfd-iframe": true,
|
75954
75967
|
ref: ref2,
|
75968
|
+
debug: true,
|
75969
|
+
onStylesLoaded: () => {
|
75970
|
+
console.log("callback");
|
75971
|
+
setStylesLoaded(true);
|
75972
|
+
},
|
75955
75973
|
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Page, __spreadProps2(__spreadValues2({ dispatch, state }, rootProps), { children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(DropZone, { zone: rootDroppableId2 }) }))
|
75956
75974
|
}
|
75957
|
-
)
|
75975
|
+
) })
|
75958
75976
|
}
|
75959
75977
|
);
|
75960
75978
|
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@measured/puck-plugin-heading-analyzer",
|
3
|
-
"version": "0.14.0-canary.
|
3
|
+
"version": "0.14.0-canary.924c85a",
|
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.0-canary.
|
21
|
+
"@measured/puck": "^0.14.0-canary.924c85a",
|
22
22
|
"@types/react": "^18.2.0",
|
23
23
|
"@types/react-dom": "^18.2.0",
|
24
24
|
"eslint": "^7.32.0",
|