@measured/puck-plugin-heading-analyzer 0.14.2 → 0.14.3-canary.73b83ef
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.
- package/dist/index.js +344 -433
- package/package.json +2 -2
package/dist/index.js
CHANGED
@@ -45807,292 +45807,6 @@ var require_object_hash = __commonJS({
|
|
45807
45807
|
}
|
45808
45808
|
});
|
45809
45809
|
|
45810
|
-
// ../../node_modules/@measured/auto-frame-component/dist/index.js
|
45811
|
-
var require_dist = __commonJS({
|
45812
|
-
"../../node_modules/@measured/auto-frame-component/dist/index.js"(exports, module2) {
|
45813
|
-
"use strict";
|
45814
|
-
init_react_import();
|
45815
|
-
var __create2 = Object.create;
|
45816
|
-
var __defProp2 = Object.defineProperty;
|
45817
|
-
var __defProps2 = Object.defineProperties;
|
45818
|
-
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
45819
|
-
var __getOwnPropDescs2 = Object.getOwnPropertyDescriptors;
|
45820
|
-
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
45821
|
-
var __getOwnPropSymbols2 = Object.getOwnPropertySymbols;
|
45822
|
-
var __getProtoOf2 = Object.getPrototypeOf;
|
45823
|
-
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
45824
|
-
var __propIsEnum2 = Object.prototype.propertyIsEnumerable;
|
45825
|
-
var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
45826
|
-
var __spreadValues2 = (a2, b) => {
|
45827
|
-
for (var prop in b || (b = {}))
|
45828
|
-
if (__hasOwnProp2.call(b, prop))
|
45829
|
-
__defNormalProp2(a2, prop, b[prop]);
|
45830
|
-
if (__getOwnPropSymbols2)
|
45831
|
-
for (var prop of __getOwnPropSymbols2(b)) {
|
45832
|
-
if (__propIsEnum2.call(b, prop))
|
45833
|
-
__defNormalProp2(a2, prop, b[prop]);
|
45834
|
-
}
|
45835
|
-
return a2;
|
45836
|
-
};
|
45837
|
-
var __spreadProps2 = (a2, b) => __defProps2(a2, __getOwnPropDescs2(b));
|
45838
|
-
var __objRest2 = (source, exclude) => {
|
45839
|
-
var target = {};
|
45840
|
-
for (var prop in source)
|
45841
|
-
if (__hasOwnProp2.call(source, prop) && exclude.indexOf(prop) < 0)
|
45842
|
-
target[prop] = source[prop];
|
45843
|
-
if (source != null && __getOwnPropSymbols2)
|
45844
|
-
for (var prop of __getOwnPropSymbols2(source)) {
|
45845
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum2.call(source, prop))
|
45846
|
-
target[prop] = source[prop];
|
45847
|
-
}
|
45848
|
-
return target;
|
45849
|
-
};
|
45850
|
-
var __export2 = (target, all) => {
|
45851
|
-
for (var name in all)
|
45852
|
-
__defProp2(target, name, { get: all[name], enumerable: true });
|
45853
|
-
};
|
45854
|
-
var __copyProps2 = (to, from, except, desc) => {
|
45855
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
45856
|
-
for (let key of __getOwnPropNames2(from))
|
45857
|
-
if (!__hasOwnProp2.call(to, key) && key !== except)
|
45858
|
-
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
45859
|
-
}
|
45860
|
-
return to;
|
45861
|
-
};
|
45862
|
-
var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
|
45863
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
45864
|
-
// file that has been converted to a CommonJS file using a Babel-
|
45865
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
45866
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
45867
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
|
45868
|
-
mod
|
45869
|
-
));
|
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
|
-
};
|
45891
|
-
var auto_frame_component_exports = {};
|
45892
|
-
__export2(auto_frame_component_exports, {
|
45893
|
-
default: () => AutoFrameComponent_default
|
45894
|
-
});
|
45895
|
-
module2.exports = __toCommonJS2(auto_frame_component_exports);
|
45896
|
-
var import_react13 = __toESM2(require("react"));
|
45897
|
-
var import_react22 = __toESM2(require("react"));
|
45898
|
-
var import_react_frame_component = __toESM2(require_lib());
|
45899
|
-
var import_object_hash = __toESM2(require_object_hash());
|
45900
|
-
var import_jsx_runtime8 = require("react/jsx-runtime");
|
45901
|
-
var styleSelector = 'style, link[as="style"], link[rel="stylesheet"]';
|
45902
|
-
var collectStyles = (doc) => {
|
45903
|
-
const collected = [];
|
45904
|
-
doc.head.querySelectorAll(styleSelector).forEach((style2) => {
|
45905
|
-
collected.push(style2);
|
45906
|
-
});
|
45907
|
-
return collected;
|
45908
|
-
};
|
45909
|
-
var getStyleSheet = (el) => {
|
45910
|
-
return Array.from(document.styleSheets).find((ss) => {
|
45911
|
-
const ownerNode = ss.ownerNode;
|
45912
|
-
return ownerNode.href === el.href;
|
45913
|
-
});
|
45914
|
-
};
|
45915
|
-
var getStyles2 = (styleSheet) => {
|
45916
|
-
if (styleSheet) {
|
45917
|
-
try {
|
45918
|
-
return [...styleSheet.cssRules].map((rule) => rule.cssText).join("");
|
45919
|
-
} catch (e2) {
|
45920
|
-
console.warn(
|
45921
|
-
"Access to stylesheet %s is denied. Ignoring\u2026",
|
45922
|
-
styleSheet.href
|
45923
|
-
);
|
45924
|
-
}
|
45925
|
-
}
|
45926
|
-
return "";
|
45927
|
-
};
|
45928
|
-
var defer = (fn) => setTimeout(fn, 0);
|
45929
|
-
var CopyHostStyles = ({
|
45930
|
-
children,
|
45931
|
-
debug = false,
|
45932
|
-
onStylesLoaded = () => null
|
45933
|
-
}) => {
|
45934
|
-
const { document: doc, window: win } = (0, import_react_frame_component.useFrame)();
|
45935
|
-
(0, import_react22.useEffect)(() => {
|
45936
|
-
if (!win || !doc) {
|
45937
|
-
return () => {
|
45938
|
-
};
|
45939
|
-
}
|
45940
|
-
let elements = [];
|
45941
|
-
const hashes = {};
|
45942
|
-
const lookupEl = (el) => elements.findIndex((elementMap) => elementMap.original === el);
|
45943
|
-
const mirrorEl = (el, onLoad = () => {
|
45944
|
-
}) => __async2(void 0, null, function* () {
|
45945
|
-
let mirror;
|
45946
|
-
if (el.nodeName === "LINK") {
|
45947
|
-
mirror = document.createElement("style");
|
45948
|
-
mirror.type = "text/css";
|
45949
|
-
let styleSheet = getStyleSheet(el);
|
45950
|
-
if (!styleSheet) {
|
45951
|
-
yield new Promise((resolve) => {
|
45952
|
-
const fn = () => {
|
45953
|
-
resolve();
|
45954
|
-
el.removeEventListener("load", fn);
|
45955
|
-
};
|
45956
|
-
el.addEventListener("load", fn);
|
45957
|
-
});
|
45958
|
-
styleSheet = getStyleSheet(el);
|
45959
|
-
}
|
45960
|
-
const styles = getStyles2(styleSheet);
|
45961
|
-
if (!styles) {
|
45962
|
-
if (debug) {
|
45963
|
-
console.warn(
|
45964
|
-
`Tried to load styles for link element, but couldn't find them. Skipping...`
|
45965
|
-
);
|
45966
|
-
}
|
45967
|
-
return;
|
45968
|
-
}
|
45969
|
-
mirror.innerHTML = styles;
|
45970
|
-
mirror.setAttribute("data-href", el.getAttribute("href"));
|
45971
|
-
} else {
|
45972
|
-
mirror = el.cloneNode(true);
|
45973
|
-
}
|
45974
|
-
mirror.onload = onLoad;
|
45975
|
-
return mirror;
|
45976
|
-
});
|
45977
|
-
const addEl = (el, onLoad = () => {
|
45978
|
-
}) => __async2(void 0, null, function* () {
|
45979
|
-
const index = lookupEl(el);
|
45980
|
-
if (index > -1) {
|
45981
|
-
if (debug)
|
45982
|
-
console.log(
|
45983
|
-
`Tried to add an element that was already mirrored. Updating instead...`
|
45984
|
-
);
|
45985
|
-
elements[index].mirror.innerText = el.innerText;
|
45986
|
-
onLoad();
|
45987
|
-
return;
|
45988
|
-
}
|
45989
|
-
const mirror = yield mirrorEl(el, onLoad);
|
45990
|
-
if (!mirror) {
|
45991
|
-
onLoad();
|
45992
|
-
return;
|
45993
|
-
}
|
45994
|
-
const elHash = (0, import_object_hash.default)(mirror.outerHTML);
|
45995
|
-
if (hashes[elHash]) {
|
45996
|
-
if (debug)
|
45997
|
-
console.log(
|
45998
|
-
`iframe already contains element that is being mirrored. Skipping...`
|
45999
|
-
);
|
46000
|
-
onLoad();
|
46001
|
-
return;
|
46002
|
-
}
|
46003
|
-
hashes[elHash] = true;
|
46004
|
-
mirror.onload = onLoad;
|
46005
|
-
doc.head.append(mirror);
|
46006
|
-
elements.push({ original: el, mirror });
|
46007
|
-
if (debug)
|
46008
|
-
console.log(`Added style node ${el.outerHTML}`);
|
46009
|
-
});
|
46010
|
-
const removeEl = (el) => {
|
46011
|
-
var _a3, _b;
|
46012
|
-
const index = lookupEl(el);
|
46013
|
-
if (index === -1) {
|
46014
|
-
if (debug)
|
46015
|
-
console.log(
|
46016
|
-
`Tried to remove an element that did not exist. Skipping...`
|
46017
|
-
);
|
46018
|
-
return;
|
46019
|
-
}
|
46020
|
-
const elHash = (0, import_object_hash.default)(el.outerHTML);
|
46021
|
-
(_b = (_a3 = elements[index]) == null ? void 0 : _a3.mirror) == null ? void 0 : _b.remove();
|
46022
|
-
delete hashes[elHash];
|
46023
|
-
if (debug)
|
46024
|
-
console.log(`Removed style node ${el.outerHTML}`);
|
46025
|
-
};
|
46026
|
-
const observer = new MutationObserver((mutations) => {
|
46027
|
-
mutations.forEach((mutation) => {
|
46028
|
-
if (mutation.type === "childList") {
|
46029
|
-
mutation.addedNodes.forEach((node) => {
|
46030
|
-
if (node.nodeType === Node.TEXT_NODE || node.nodeType === Node.ELEMENT_NODE) {
|
46031
|
-
const el = node.nodeType === Node.TEXT_NODE ? node.parentElement : node;
|
46032
|
-
if (el && el.matches(styleSelector)) {
|
46033
|
-
defer(() => addEl(el));
|
46034
|
-
}
|
46035
|
-
}
|
46036
|
-
});
|
46037
|
-
mutation.removedNodes.forEach((node) => {
|
46038
|
-
if (node.nodeType === Node.TEXT_NODE || node.nodeType === Node.ELEMENT_NODE) {
|
46039
|
-
const el = node.nodeType === Node.TEXT_NODE ? node.parentElement : node;
|
46040
|
-
if (el && el.matches(styleSelector)) {
|
46041
|
-
defer(() => removeEl(el));
|
46042
|
-
}
|
46043
|
-
}
|
46044
|
-
});
|
46045
|
-
}
|
46046
|
-
});
|
46047
|
-
});
|
46048
|
-
const parentDocument = win.parent.document;
|
46049
|
-
const collectedStyles = collectStyles(parentDocument);
|
46050
|
-
const hrefs = [];
|
46051
|
-
Promise.all(
|
46052
|
-
collectedStyles.map((styleNode, i2) => __async2(void 0, null, function* () {
|
46053
|
-
if (styleNode.nodeName === "LINK") {
|
46054
|
-
const linkHref = styleNode.href;
|
46055
|
-
if (hrefs.indexOf(linkHref) > -1) {
|
46056
|
-
return;
|
46057
|
-
}
|
46058
|
-
hrefs.push(linkHref);
|
46059
|
-
}
|
46060
|
-
const mirror = yield mirrorEl(styleNode);
|
46061
|
-
if (!mirror)
|
46062
|
-
return;
|
46063
|
-
elements.push({ original: styleNode, mirror });
|
46064
|
-
return mirror;
|
46065
|
-
}))
|
46066
|
-
).then((mirrorStyles) => {
|
46067
|
-
const filtered = mirrorStyles.filter(
|
46068
|
-
(el) => typeof el !== "undefined"
|
46069
|
-
);
|
46070
|
-
doc.head.innerHTML = "";
|
46071
|
-
doc.head.append(...filtered);
|
46072
|
-
observer.observe(parentDocument.head, { childList: true, subtree: true });
|
46073
|
-
filtered.forEach((el) => {
|
46074
|
-
const elHash = (0, import_object_hash.default)(el.outerHTML);
|
46075
|
-
hashes[elHash] = true;
|
46076
|
-
});
|
46077
|
-
onStylesLoaded();
|
46078
|
-
});
|
46079
|
-
return () => {
|
46080
|
-
observer.disconnect();
|
46081
|
-
};
|
46082
|
-
}, []);
|
46083
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_jsx_runtime8.Fragment, { children });
|
46084
|
-
};
|
46085
|
-
var AutoFrameComponent = import_react22.default.forwardRef(
|
46086
|
-
function(_a3, ref2) {
|
46087
|
-
var _b = _a3, { children, debug, onStylesLoaded } = _b, props = __objRest2(_b, ["children", "debug", "onStylesLoaded"]);
|
46088
|
-
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 }) }));
|
46089
|
-
}
|
46090
|
-
);
|
46091
|
-
AutoFrameComponent.displayName = "AutoFrameComponent";
|
46092
|
-
var AutoFrameComponent_default = AutoFrameComponent;
|
46093
|
-
}
|
46094
|
-
});
|
46095
|
-
|
46096
45810
|
// ../../node_modules/react-hotkeys-hook/dist/react-hotkeys-hook.esm.js
|
46097
45811
|
var react_hotkeys_hook_esm_exports = {};
|
46098
45812
|
__export(react_hotkeys_hook_esm_exports, {
|
@@ -46562,7 +46276,7 @@ var init_react_hotkeys_hook_esm = __esm({
|
|
46562
46276
|
});
|
46563
46277
|
|
46564
46278
|
// ../core/dist/index.js
|
46565
|
-
var
|
46279
|
+
var require_dist = __commonJS({
|
46566
46280
|
"../core/dist/index.js"(exports, module2) {
|
46567
46281
|
"use strict";
|
46568
46282
|
init_react_import();
|
@@ -54586,9 +54300,9 @@ var require_dist2 = __commonJS({
|
|
54586
54300
|
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === "function") {
|
54587
54301
|
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
54588
54302
|
}
|
54589
|
-
var
|
54303
|
+
var React32 = require("react");
|
54590
54304
|
var Scheduler = require_scheduler2();
|
54591
|
-
var ReactSharedInternals =
|
54305
|
+
var ReactSharedInternals = React32.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
54592
54306
|
var suppressWarning = false;
|
54593
54307
|
function setSuppressWarning(newSuppressWarning) {
|
54594
54308
|
{
|
@@ -54637,7 +54351,7 @@ var require_dist2 = __commonJS({
|
|
54637
54351
|
var HostPortal = 4;
|
54638
54352
|
var HostComponent = 5;
|
54639
54353
|
var HostText = 6;
|
54640
|
-
var
|
54354
|
+
var Fragment18 = 7;
|
54641
54355
|
var Mode = 8;
|
54642
54356
|
var ContextConsumer = 9;
|
54643
54357
|
var ContextProvider = 10;
|
@@ -55793,7 +55507,7 @@ var require_dist2 = __commonJS({
|
|
55793
55507
|
return "DehydratedFragment";
|
55794
55508
|
case ForwardRef:
|
55795
55509
|
return getWrappedName$1(type, type.render, "ForwardRef");
|
55796
|
-
case
|
55510
|
+
case Fragment18:
|
55797
55511
|
return "Fragment";
|
55798
55512
|
case HostComponent:
|
55799
55513
|
return type;
|
@@ -56193,7 +55907,7 @@ var require_dist2 = __commonJS({
|
|
56193
55907
|
{
|
56194
55908
|
if (props.value == null) {
|
56195
55909
|
if (typeof props.children === "object" && props.children !== null) {
|
56196
|
-
|
55910
|
+
React32.Children.forEach(props.children, function(child) {
|
56197
55911
|
if (child == null) {
|
56198
55912
|
return;
|
56199
55913
|
}
|
@@ -64640,7 +64354,7 @@ var require_dist2 = __commonJS({
|
|
64640
64354
|
}
|
64641
64355
|
}
|
64642
64356
|
var fakeInternalInstance = {};
|
64643
|
-
var emptyRefsObject = new
|
64357
|
+
var emptyRefsObject = new React32.Component().refs;
|
64644
64358
|
var didWarnAboutStateAssignmentForComponent;
|
64645
64359
|
var didWarnAboutUninitializedState;
|
64646
64360
|
var didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate;
|
@@ -65464,7 +65178,7 @@ var require_dist2 = __commonJS({
|
|
65464
65178
|
}
|
65465
65179
|
}
|
65466
65180
|
function updateFragment2(returnFiber, current2, fragment, lanes, key) {
|
65467
|
-
if (current2 === null || current2.tag !==
|
65181
|
+
if (current2 === null || current2.tag !== Fragment18) {
|
65468
65182
|
var created = createFiberFromFragment(fragment, returnFiber.mode, lanes, key);
|
65469
65183
|
created.return = returnFiber;
|
65470
65184
|
return created;
|
@@ -65867,7 +65581,7 @@ var require_dist2 = __commonJS({
|
|
65867
65581
|
if (child.key === key) {
|
65868
65582
|
var elementType = element.type;
|
65869
65583
|
if (elementType === REACT_FRAGMENT_TYPE) {
|
65870
|
-
if (child.tag ===
|
65584
|
+
if (child.tag === Fragment18) {
|
65871
65585
|
deleteRemainingChildren(returnFiber, child.sibling);
|
65872
65586
|
var existing = useFiber(child, element.props.children);
|
65873
65587
|
existing.return = returnFiber;
|
@@ -70042,7 +69756,7 @@ var require_dist2 = __commonJS({
|
|
70042
69756
|
var _resolvedProps2 = workInProgress2.elementType === type ? _unresolvedProps2 : resolveDefaultProps(type, _unresolvedProps2);
|
70043
69757
|
return updateForwardRef(current2, workInProgress2, type, _resolvedProps2, renderLanes2);
|
70044
69758
|
}
|
70045
|
-
case
|
69759
|
+
case Fragment18:
|
70046
69760
|
return updateFragment(current2, workInProgress2, renderLanes2);
|
70047
69761
|
case Mode:
|
70048
69762
|
return updateMode(current2, workInProgress2, renderLanes2);
|
@@ -70315,7 +70029,7 @@ var require_dist2 = __commonJS({
|
|
70315
70029
|
case SimpleMemoComponent:
|
70316
70030
|
case FunctionComponent:
|
70317
70031
|
case ForwardRef:
|
70318
|
-
case
|
70032
|
+
case Fragment18:
|
70319
70033
|
case Mode:
|
70320
70034
|
case Profiler:
|
70321
70035
|
case ContextConsumer:
|
@@ -74574,7 +74288,7 @@ var require_dist2 = __commonJS({
|
|
74574
74288
|
return fiber;
|
74575
74289
|
}
|
74576
74290
|
function createFiberFromFragment(elements, mode, lanes, key) {
|
74577
|
-
var fiber = createFiber(
|
74291
|
+
var fiber = createFiber(Fragment18, elements, key, mode);
|
74578
74292
|
fiber.lanes = lanes;
|
74579
74293
|
return fiber;
|
74580
74294
|
}
|
@@ -76931,7 +76645,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76931
76645
|
return el;
|
76932
76646
|
};
|
76933
76647
|
init_react_import2();
|
76934
|
-
var
|
76648
|
+
var import_react29 = require("react");
|
76935
76649
|
init_react_import2();
|
76936
76650
|
var import_react112 = require("react");
|
76937
76651
|
init_react_import2();
|
@@ -77562,7 +77276,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
77562
77276
|
const [componentState, setComponentState] = (0, import_react132.useState)({});
|
77563
77277
|
const deferredSetStates = {};
|
77564
77278
|
const setComponentLoading = (0, import_react132.useCallback)(
|
77565
|
-
(id, loading,
|
77279
|
+
(id, loading, defer2 = 0) => {
|
77566
77280
|
if (deferredSetStates[id]) {
|
77567
77281
|
clearTimeout(deferredSetStates[id]);
|
77568
77282
|
delete deferredSetStates[id];
|
@@ -77572,7 +77286,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
77572
77286
|
[id]: __spreadProps2(__spreadValues2({}, prev[id]), { loading })
|
77573
77287
|
}));
|
77574
77288
|
delete deferredSetStates[id];
|
77575
|
-
},
|
77289
|
+
}, defer2);
|
77576
77290
|
},
|
77577
77291
|
[]
|
77578
77292
|
);
|
@@ -78894,15 +78608,212 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
78894
78608
|
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ComponentList, { id: "all" }) });
|
78895
78609
|
};
|
78896
78610
|
init_react_import2();
|
78897
|
-
var
|
78898
|
-
var import_auto_frame_component = __toESM2(require_dist());
|
78611
|
+
var import_react23 = require("react");
|
78899
78612
|
init_react_import2();
|
78900
|
-
var
|
78613
|
+
var import_react222 = __toESM2(require("react"));
|
78614
|
+
var import_react_frame_component = __toESM2(require_lib());
|
78615
|
+
var import_object_hash = __toESM2(require_object_hash());
|
78901
78616
|
var import_jsx_runtime29 = require("react/jsx-runtime");
|
78617
|
+
var styleSelector = 'style, link[rel="stylesheet"]';
|
78618
|
+
var collectStyles = (doc) => {
|
78619
|
+
const collected = [];
|
78620
|
+
doc.head.querySelectorAll(styleSelector).forEach((style2) => {
|
78621
|
+
collected.push(style2);
|
78622
|
+
});
|
78623
|
+
return collected;
|
78624
|
+
};
|
78625
|
+
var getStyleSheet = (el) => {
|
78626
|
+
return Array.from(document.styleSheets).find((ss) => {
|
78627
|
+
const ownerNode = ss.ownerNode;
|
78628
|
+
return ownerNode.href === el.href;
|
78629
|
+
});
|
78630
|
+
};
|
78631
|
+
var getStyles2 = (styleSheet) => {
|
78632
|
+
if (styleSheet) {
|
78633
|
+
try {
|
78634
|
+
return [...styleSheet.cssRules].map((rule) => rule.cssText).join("");
|
78635
|
+
} catch (e2) {
|
78636
|
+
console.warn(
|
78637
|
+
"Access to stylesheet %s is denied. Ignoring\u2026",
|
78638
|
+
styleSheet.href
|
78639
|
+
);
|
78640
|
+
}
|
78641
|
+
}
|
78642
|
+
return "";
|
78643
|
+
};
|
78644
|
+
var defer = (fn) => setTimeout(fn, 0);
|
78645
|
+
var CopyHostStyles = ({
|
78646
|
+
children,
|
78647
|
+
debug = false,
|
78648
|
+
onStylesLoaded = () => null
|
78649
|
+
}) => {
|
78650
|
+
const { document: doc, window: win } = (0, import_react_frame_component.useFrame)();
|
78651
|
+
(0, import_react222.useEffect)(() => {
|
78652
|
+
if (!win || !doc) {
|
78653
|
+
return () => {
|
78654
|
+
};
|
78655
|
+
}
|
78656
|
+
let elements = [];
|
78657
|
+
const hashes = {};
|
78658
|
+
const lookupEl = (el) => elements.findIndex((elementMap) => elementMap.original === el);
|
78659
|
+
const mirrorEl = (el, inlineStyles = false) => __async2(void 0, null, function* () {
|
78660
|
+
let mirror;
|
78661
|
+
if (el.nodeName === "LINK" && inlineStyles) {
|
78662
|
+
mirror = document.createElement("style");
|
78663
|
+
mirror.type = "text/css";
|
78664
|
+
let styleSheet = getStyleSheet(el);
|
78665
|
+
if (!styleSheet) {
|
78666
|
+
yield new Promise((resolve) => {
|
78667
|
+
const fn = () => {
|
78668
|
+
resolve();
|
78669
|
+
el.removeEventListener("load", fn);
|
78670
|
+
};
|
78671
|
+
el.addEventListener("load", fn);
|
78672
|
+
});
|
78673
|
+
styleSheet = getStyleSheet(el);
|
78674
|
+
}
|
78675
|
+
const styles = getStyles2(styleSheet);
|
78676
|
+
if (!styles) {
|
78677
|
+
if (debug) {
|
78678
|
+
console.warn(
|
78679
|
+
`Tried to load styles for link element, but couldn't find them. Skipping...`
|
78680
|
+
);
|
78681
|
+
}
|
78682
|
+
return;
|
78683
|
+
}
|
78684
|
+
mirror.innerHTML = styles;
|
78685
|
+
mirror.setAttribute("data-href", el.getAttribute("href"));
|
78686
|
+
} else {
|
78687
|
+
mirror = el.cloneNode(true);
|
78688
|
+
}
|
78689
|
+
return mirror;
|
78690
|
+
});
|
78691
|
+
const addEl = (el) => __async2(void 0, null, function* () {
|
78692
|
+
const index = lookupEl(el);
|
78693
|
+
if (index > -1) {
|
78694
|
+
if (debug)
|
78695
|
+
console.log(
|
78696
|
+
`Tried to add an element that was already mirrored. Updating instead...`
|
78697
|
+
);
|
78698
|
+
elements[index].mirror.innerText = el.innerText;
|
78699
|
+
return;
|
78700
|
+
}
|
78701
|
+
const mirror = yield mirrorEl(el);
|
78702
|
+
if (!mirror) {
|
78703
|
+
return;
|
78704
|
+
}
|
78705
|
+
const elHash = (0, import_object_hash.default)(mirror.outerHTML);
|
78706
|
+
if (hashes[elHash]) {
|
78707
|
+
if (debug)
|
78708
|
+
console.log(
|
78709
|
+
`iframe already contains element that is being mirrored. Skipping...`
|
78710
|
+
);
|
78711
|
+
return;
|
78712
|
+
}
|
78713
|
+
hashes[elHash] = true;
|
78714
|
+
doc.head.append(mirror);
|
78715
|
+
elements.push({ original: el, mirror });
|
78716
|
+
if (debug)
|
78717
|
+
console.log(`Added style node ${el.outerHTML}`);
|
78718
|
+
});
|
78719
|
+
const removeEl = (el) => {
|
78720
|
+
var _a3, _b;
|
78721
|
+
const index = lookupEl(el);
|
78722
|
+
if (index === -1) {
|
78723
|
+
if (debug)
|
78724
|
+
console.log(
|
78725
|
+
`Tried to remove an element that did not exist. Skipping...`
|
78726
|
+
);
|
78727
|
+
return;
|
78728
|
+
}
|
78729
|
+
const elHash = (0, import_object_hash.default)(el.outerHTML);
|
78730
|
+
(_b = (_a3 = elements[index]) == null ? void 0 : _a3.mirror) == null ? void 0 : _b.remove();
|
78731
|
+
delete hashes[elHash];
|
78732
|
+
if (debug)
|
78733
|
+
console.log(`Removed style node ${el.outerHTML}`);
|
78734
|
+
};
|
78735
|
+
const observer = new MutationObserver((mutations) => {
|
78736
|
+
mutations.forEach((mutation) => {
|
78737
|
+
if (mutation.type === "childList") {
|
78738
|
+
mutation.addedNodes.forEach((node) => {
|
78739
|
+
if (node.nodeType === Node.TEXT_NODE || node.nodeType === Node.ELEMENT_NODE) {
|
78740
|
+
const el = node.nodeType === Node.TEXT_NODE ? node.parentElement : node;
|
78741
|
+
if (el && el.matches(styleSelector)) {
|
78742
|
+
defer(() => addEl(el));
|
78743
|
+
}
|
78744
|
+
}
|
78745
|
+
});
|
78746
|
+
mutation.removedNodes.forEach((node) => {
|
78747
|
+
if (node.nodeType === Node.TEXT_NODE || node.nodeType === Node.ELEMENT_NODE) {
|
78748
|
+
const el = node.nodeType === Node.TEXT_NODE ? node.parentElement : node;
|
78749
|
+
if (el && el.matches(styleSelector)) {
|
78750
|
+
defer(() => removeEl(el));
|
78751
|
+
}
|
78752
|
+
}
|
78753
|
+
});
|
78754
|
+
}
|
78755
|
+
});
|
78756
|
+
});
|
78757
|
+
const parentDocument = win.parent.document;
|
78758
|
+
const collectedStyles = collectStyles(parentDocument);
|
78759
|
+
const hrefs = [];
|
78760
|
+
let stylesLoaded = 0;
|
78761
|
+
Promise.all(
|
78762
|
+
collectedStyles.map((styleNode, i2) => __async2(void 0, null, function* () {
|
78763
|
+
if (styleNode.nodeName === "LINK") {
|
78764
|
+
const linkHref = styleNode.href;
|
78765
|
+
if (hrefs.indexOf(linkHref) > -1) {
|
78766
|
+
return;
|
78767
|
+
}
|
78768
|
+
hrefs.push(linkHref);
|
78769
|
+
}
|
78770
|
+
const mirror = yield mirrorEl(styleNode);
|
78771
|
+
if (!mirror)
|
78772
|
+
return;
|
78773
|
+
elements.push({ original: styleNode, mirror });
|
78774
|
+
return mirror;
|
78775
|
+
}))
|
78776
|
+
).then((mirrorStyles) => {
|
78777
|
+
const filtered = mirrorStyles.filter(
|
78778
|
+
(el) => typeof el !== "undefined"
|
78779
|
+
);
|
78780
|
+
filtered.forEach((mirror) => {
|
78781
|
+
mirror.onload = () => {
|
78782
|
+
stylesLoaded = stylesLoaded + 1;
|
78783
|
+
if (stylesLoaded >= elements.length) {
|
78784
|
+
onStylesLoaded();
|
78785
|
+
}
|
78786
|
+
};
|
78787
|
+
});
|
78788
|
+
doc.head.innerHTML = "";
|
78789
|
+
doc.head.append(...filtered);
|
78790
|
+
observer.observe(parentDocument.head, { childList: true, subtree: true });
|
78791
|
+
filtered.forEach((el) => {
|
78792
|
+
const elHash = (0, import_object_hash.default)(el.outerHTML);
|
78793
|
+
hashes[elHash] = true;
|
78794
|
+
});
|
78795
|
+
});
|
78796
|
+
return () => {
|
78797
|
+
observer.disconnect();
|
78798
|
+
};
|
78799
|
+
}, []);
|
78800
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_jsx_runtime29.Fragment, { children });
|
78801
|
+
};
|
78802
|
+
var AutoFrameComponent = import_react222.default.forwardRef(
|
78803
|
+
function(_a3, ref2) {
|
78804
|
+
var _b = _a3, { children, debug, onStylesLoaded } = _b, props = __objRest2(_b, ["children", "debug", "onStylesLoaded"]);
|
78805
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_react_frame_component.default, __spreadProps2(__spreadValues2({}, props), { ref: ref2, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(CopyHostStyles, { debug, onStylesLoaded, children }) }));
|
78806
|
+
}
|
78807
|
+
);
|
78808
|
+
AutoFrameComponent.displayName = "AutoFrameComponent";
|
78809
|
+
var AutoFrame_default = AutoFrameComponent;
|
78810
|
+
init_react_import2();
|
78811
|
+
var styles_module_default16 = { "PuckPreview": "_PuckPreview_rxwlr_1", "PuckPreview-frame": "_PuckPreview-frame_rxwlr_5" };
|
78812
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
78902
78813
|
var getClassName21 = get_class_name_factory_default2("PuckPreview", styles_module_default16);
|
78903
78814
|
var Preview = ({ id = "puck-preview" }) => {
|
78904
78815
|
const { config, dispatch, state, setStatus, iframe } = useAppContext2();
|
78905
|
-
const Page = (0,
|
78816
|
+
const Page = (0, import_react23.useCallback)(
|
78906
78817
|
(pageProps) => {
|
78907
78818
|
var _a3, _b;
|
78908
78819
|
return ((_a3 = config.root) == null ? void 0 : _a3.render) ? (_b = config.root) == null ? void 0 : _b.render(__spreadProps2(__spreadValues2({
|
@@ -78910,13 +78821,13 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
78910
78821
|
}, pageProps), {
|
78911
78822
|
editMode: true,
|
78912
78823
|
puck: { renderDropZone: DropZone }
|
78913
|
-
})) : /* @__PURE__ */ (0,
|
78824
|
+
})) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_jsx_runtime30.Fragment, { children: pageProps.children });
|
78914
78825
|
},
|
78915
78826
|
[config.root]
|
78916
78827
|
);
|
78917
78828
|
const rootProps = state.data.root.props || state.data.root;
|
78918
|
-
const ref2 = (0,
|
78919
|
-
return /* @__PURE__ */ (0,
|
78829
|
+
const ref2 = (0, import_react23.useRef)(null);
|
78830
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
78920
78831
|
"div",
|
78921
78832
|
{
|
78922
78833
|
className: getClassName21(),
|
@@ -78924,8 +78835,8 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
78924
78835
|
onClick: () => {
|
78925
78836
|
dispatch({ type: "setUi", ui: __spreadProps2(__spreadValues2({}, state.ui), { itemSelector: null }) });
|
78926
78837
|
},
|
78927
|
-
children: iframe.enabled ? /* @__PURE__ */ (0,
|
78928
|
-
|
78838
|
+
children: iframe.enabled ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
78839
|
+
AutoFrame_default,
|
78929
78840
|
{
|
78930
78841
|
id: "preview-frame",
|
78931
78842
|
className: getClassName21("frame"),
|
@@ -78934,9 +78845,9 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
78934
78845
|
onStylesLoaded: () => {
|
78935
78846
|
setStatus("READY");
|
78936
78847
|
},
|
78937
|
-
children: /* @__PURE__ */ (0,
|
78848
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Page, __spreadProps2(__spreadValues2({ dispatch, state }, rootProps), { children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(DropZone, { zone: rootDroppableId2 }) }))
|
78938
78849
|
}
|
78939
|
-
) : /* @__PURE__ */ (0,
|
78850
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { id: "preview-frame", className: getClassName21("frame"), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Page, __spreadProps2(__spreadValues2({ dispatch, state }, rootProps), { children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(DropZone, { zone: rootDroppableId2 }) })) })
|
78940
78851
|
}
|
78941
78852
|
);
|
78942
78853
|
};
|
@@ -78968,7 +78879,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
78968
78879
|
el.style.scrollMargin = oldStyle.scrollMargin || "";
|
78969
78880
|
}
|
78970
78881
|
};
|
78971
|
-
var
|
78882
|
+
var import_react24 = require("react");
|
78972
78883
|
init_react_import2();
|
78973
78884
|
var isChildOfZone = (item, maybeChild, ctx) => {
|
78974
78885
|
var _a3;
|
@@ -78978,7 +78889,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
78978
78889
|
return area === item.props.id;
|
78979
78890
|
})) : false;
|
78980
78891
|
};
|
78981
|
-
var
|
78892
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
78982
78893
|
var getClassName222 = get_class_name_factory_default2("LayerTree", styles_module_default17);
|
78983
78894
|
var getClassNameLayer = get_class_name_factory_default2("Layer", styles_module_default17);
|
78984
78895
|
var LayerTree = ({
|
@@ -78991,15 +78902,15 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
78991
78902
|
label
|
78992
78903
|
}) => {
|
78993
78904
|
const zones = data.zones || {};
|
78994
|
-
const ctx = (0,
|
78995
|
-
return /* @__PURE__ */ (0,
|
78996
|
-
label && /* @__PURE__ */ (0,
|
78997
|
-
/* @__PURE__ */ (0,
|
78905
|
+
const ctx = (0, import_react24.useContext)(dropZoneContext2);
|
78906
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
|
78907
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: getClassName222("zoneTitle"), children: [
|
78908
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: getClassName222("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Layers, { size: "16" }) }),
|
78998
78909
|
" ",
|
78999
78910
|
label
|
79000
78911
|
] }),
|
79001
|
-
/* @__PURE__ */ (0,
|
79002
|
-
zoneContent.length === 0 && /* @__PURE__ */ (0,
|
78912
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("ul", { className: getClassName222(), children: [
|
78913
|
+
zoneContent.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: getClassName222("helper"), children: "No items" }),
|
79003
78914
|
zoneContent.map((item, i2) => {
|
79004
78915
|
var _a3;
|
79005
78916
|
const isSelected = (itemSelector == null ? void 0 : itemSelector.index) === i2 && (itemSelector.zone === zone || itemSelector.zone === rootDroppableId2 && !zone);
|
@@ -79015,7 +78926,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79015
78926
|
const selectedItem = itemSelector && data ? getItem2(itemSelector, data) : null;
|
79016
78927
|
const isHovering = hoveringComponent === item.props.id;
|
79017
78928
|
const childIsSelected = isChildOfZone(item, selectedItem, ctx);
|
79018
|
-
return /* @__PURE__ */ (0,
|
78929
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
79019
78930
|
"li",
|
79020
78931
|
{
|
79021
78932
|
className: getClassNameLayer({
|
@@ -79025,7 +78936,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79025
78936
|
childIsSelected
|
79026
78937
|
}),
|
79027
78938
|
children: [
|
79028
|
-
/* @__PURE__ */ (0,
|
78939
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
79029
78940
|
"button",
|
79030
78941
|
{
|
79031
78942
|
className: getClassNameLayer("clickable"),
|
@@ -79057,22 +78968,22 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79057
78968
|
setHoveringComponent(null);
|
79058
78969
|
},
|
79059
78970
|
children: [
|
79060
|
-
containsZone && /* @__PURE__ */ (0,
|
78971
|
+
containsZone && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
79061
78972
|
"div",
|
79062
78973
|
{
|
79063
78974
|
className: getClassNameLayer("chevron"),
|
79064
78975
|
title: isSelected ? "Collapse" : "Expand",
|
79065
|
-
children: /* @__PURE__ */ (0,
|
78976
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ChevronDown, { size: "12" })
|
79066
78977
|
}
|
79067
78978
|
),
|
79068
|
-
/* @__PURE__ */ (0,
|
79069
|
-
/* @__PURE__ */ (0,
|
79070
|
-
/* @__PURE__ */ (0,
|
78979
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: getClassNameLayer("title"), children: [
|
78980
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: getClassNameLayer("icon"), children: item.type === "Text" || item.type === "Heading" ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Type, { size: "16" }) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(LayoutGrid, { size: "16" }) }),
|
78981
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: getClassNameLayer("name"), children: (_a3 = config.components[item.type]["label"]) != null ? _a3 : item.type })
|
79071
78982
|
] })
|
79072
78983
|
]
|
79073
78984
|
}
|
79074
78985
|
) }),
|
79075
|
-
containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ (0,
|
78986
|
+
containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
79076
78987
|
LayerTree,
|
79077
78988
|
{
|
79078
78989
|
config,
|
@@ -79092,13 +79003,13 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79092
79003
|
] })
|
79093
79004
|
] });
|
79094
79005
|
};
|
79095
|
-
var
|
79096
|
-
var
|
79006
|
+
var import_react25 = require("react");
|
79007
|
+
var import_jsx_runtime322 = require("react/jsx-runtime");
|
79097
79008
|
var Outline = () => {
|
79098
79009
|
const { dispatch, state, overrides, config } = useAppContext2();
|
79099
79010
|
const { data, ui } = state;
|
79100
79011
|
const { itemSelector } = ui;
|
79101
|
-
const setItemSelector = (0,
|
79012
|
+
const setItemSelector = (0, import_react25.useCallback)(
|
79102
79013
|
(newItemSelector) => {
|
79103
79014
|
dispatch({
|
79104
79015
|
type: "setUi",
|
@@ -79107,9 +79018,9 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79107
79018
|
},
|
79108
79019
|
[]
|
79109
79020
|
);
|
79110
|
-
const Wrapper = (0,
|
79111
|
-
return /* @__PURE__ */ (0,
|
79112
|
-
(ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId2]) && /* @__PURE__ */ (0,
|
79021
|
+
const Wrapper = (0, import_react25.useMemo)(() => overrides.outline || "div", [overrides]);
|
79022
|
+
return /* @__PURE__ */ (0, import_jsx_runtime322.jsx)(Wrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime322.jsx)(dropZoneContext2.Consumer, { children: (ctx) => /* @__PURE__ */ (0, import_jsx_runtime322.jsxs)(import_jsx_runtime322.Fragment, { children: [
|
79023
|
+
(ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId2]) && /* @__PURE__ */ (0, import_jsx_runtime322.jsx)(
|
79113
79024
|
LayerTree,
|
79114
79025
|
{
|
79115
79026
|
config,
|
@@ -79122,7 +79033,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79122
79033
|
),
|
79123
79034
|
Object.entries(findZonesForArea(data, "root")).map(
|
79124
79035
|
([zoneKey, zone]) => {
|
79125
|
-
return /* @__PURE__ */ (0,
|
79036
|
+
return /* @__PURE__ */ (0, import_jsx_runtime322.jsx)(
|
79126
79037
|
LayerTree,
|
79127
79038
|
{
|
79128
79039
|
config,
|
@@ -79201,12 +79112,12 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79201
79112
|
};
|
79202
79113
|
}
|
79203
79114
|
init_react_import2();
|
79204
|
-
var
|
79115
|
+
var import_react26 = require("react");
|
79205
79116
|
var import_use_debounce3 = (init_index_module(), __toCommonJS(index_module_exports));
|
79206
79117
|
var EMPTY_HISTORY_INDEX = -1;
|
79207
79118
|
function useHistoryStore() {
|
79208
|
-
const [histories, setHistories] = (0,
|
79209
|
-
const [index, setIndex] = (0,
|
79119
|
+
const [histories, setHistories] = (0, import_react26.useState)([]);
|
79120
|
+
const [index, setIndex] = (0, import_react26.useState)(EMPTY_HISTORY_INDEX);
|
79210
79121
|
const hasPast = index > EMPTY_HISTORY_INDEX;
|
79211
79122
|
const hasFuture = index < histories.length - 1;
|
79212
79123
|
const currentHistory = histories[index];
|
@@ -79356,16 +79267,16 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79356
79267
|
var styles = window.getComputedStyle(el);
|
79357
79268
|
return calculateBox3(borderBox, styles);
|
79358
79269
|
};
|
79359
|
-
var
|
79270
|
+
var import_react28 = require("react");
|
79360
79271
|
init_react_import2();
|
79361
|
-
var
|
79272
|
+
var import_react27 = require("react");
|
79362
79273
|
init_react_import2();
|
79363
79274
|
var styles_module_default18 = { "ViewportControls": "_ViewportControls_3zdvn_1", "ViewportControls-divider": "_ViewportControls-divider_3zdvn_15", "ViewportControls-zoomSelect": "_ViewportControls-zoomSelect_3zdvn_21", "ViewportButton--isActive": "_ViewportButton--isActive_3zdvn_33", "ViewportButton-inner": "_ViewportButton-inner_3zdvn_33" };
|
79364
|
-
var
|
79275
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
79365
79276
|
var icons = {
|
79366
|
-
Smartphone: /* @__PURE__ */ (0,
|
79367
|
-
Tablet: /* @__PURE__ */ (0,
|
79368
|
-
Monitor: /* @__PURE__ */ (0,
|
79277
|
+
Smartphone: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Smartphone, { size: 16 }),
|
79278
|
+
Tablet: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Tablet, { size: 16 }),
|
79279
|
+
Monitor: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Monitor, { size: 16 })
|
79369
79280
|
};
|
79370
79281
|
var getClassName23 = get_class_name_factory_default2("ViewportControls", styles_module_default18);
|
79371
79282
|
var getClassNameButton = get_class_name_factory_default2("ViewportButton", styles_module_default18);
|
@@ -79377,11 +79288,11 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79377
79288
|
onClick
|
79378
79289
|
}) => {
|
79379
79290
|
const { state } = useAppContext2();
|
79380
|
-
const [isActive2, setIsActive] = (0,
|
79381
|
-
(0,
|
79291
|
+
const [isActive2, setIsActive] = (0, import_react27.useState)(false);
|
79292
|
+
(0, import_react27.useEffect)(() => {
|
79382
79293
|
setIsActive(width === state.ui.viewports.current.width);
|
79383
79294
|
}, [width, state.ui.viewports.current.width]);
|
79384
|
-
return /* @__PURE__ */ (0,
|
79295
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: getClassNameButton({ isActive: isActive2 }), children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
79385
79296
|
IconButton,
|
79386
79297
|
{
|
79387
79298
|
title,
|
@@ -79390,7 +79301,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79390
79301
|
e2.stopPropagation();
|
79391
79302
|
onClick({ width, height });
|
79392
79303
|
},
|
79393
|
-
children: /* @__PURE__ */ (0,
|
79304
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: getClassNameButton("inner"), children })
|
79394
79305
|
}
|
79395
79306
|
) });
|
79396
79307
|
};
|
@@ -79414,7 +79325,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79414
79325
|
const defaultsContainAutoZoom = defaultZoomOptions.find(
|
79415
79326
|
(option) => option.value === autoZoom
|
79416
79327
|
);
|
79417
|
-
const zoomOptions = (0,
|
79328
|
+
const zoomOptions = (0, import_react27.useMemo)(
|
79418
79329
|
() => [
|
79419
79330
|
...defaultZoomOptions,
|
79420
79331
|
...defaultsContainAutoZoom ? [] : [
|
@@ -79426,8 +79337,8 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79426
79337
|
].filter((a2) => a2.value <= autoZoom).sort((a2, b) => a2.value > b.value ? 1 : -1),
|
79427
79338
|
[autoZoom]
|
79428
79339
|
);
|
79429
|
-
return /* @__PURE__ */ (0,
|
79430
|
-
viewports.map((viewport, i2) => /* @__PURE__ */ (0,
|
79340
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: getClassName23(), children: [
|
79341
|
+
viewports.map((viewport, i2) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
79431
79342
|
ViewportButton,
|
79432
79343
|
{
|
79433
79344
|
height: viewport.height,
|
@@ -79438,8 +79349,8 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79438
79349
|
},
|
79439
79350
|
i2
|
79440
79351
|
)),
|
79441
|
-
/* @__PURE__ */ (0,
|
79442
|
-
/* @__PURE__ */ (0,
|
79352
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: getClassName23("divider") }),
|
79353
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
79443
79354
|
IconButton,
|
79444
79355
|
{
|
79445
79356
|
title: "Zoom viewport out",
|
@@ -79453,10 +79364,10 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79453
79364
|
)].value
|
79454
79365
|
);
|
79455
79366
|
},
|
79456
|
-
children: /* @__PURE__ */ (0,
|
79367
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ZoomOut, { size: 16 })
|
79457
79368
|
}
|
79458
79369
|
),
|
79459
|
-
/* @__PURE__ */ (0,
|
79370
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
79460
79371
|
IconButton,
|
79461
79372
|
{
|
79462
79373
|
title: "Zoom viewport in",
|
@@ -79470,11 +79381,11 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79470
79381
|
)].value
|
79471
79382
|
);
|
79472
79383
|
},
|
79473
|
-
children: /* @__PURE__ */ (0,
|
79384
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ZoomIn, { size: 16 })
|
79474
79385
|
}
|
79475
79386
|
),
|
79476
|
-
/* @__PURE__ */ (0,
|
79477
|
-
/* @__PURE__ */ (0,
|
79387
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: getClassName23("divider") }),
|
79388
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
79478
79389
|
"select",
|
79479
79390
|
{
|
79480
79391
|
className: getClassName23("zoomSelect"),
|
@@ -79482,7 +79393,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79482
79393
|
onChange: (e2) => {
|
79483
79394
|
onZoom(parseFloat(e2.currentTarget.value));
|
79484
79395
|
},
|
79485
|
-
children: zoomOptions.map((option) => /* @__PURE__ */ (0,
|
79396
|
+
children: zoomOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
79486
79397
|
"option",
|
79487
79398
|
{
|
79488
79399
|
value: option.value,
|
@@ -79524,24 +79435,24 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79524
79435
|
}
|
79525
79436
|
return { autoZoom, rootHeight, zoom };
|
79526
79437
|
};
|
79527
|
-
var
|
79438
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
79528
79439
|
var getClassName24 = get_class_name_factory_default2("PuckCanvas", styles_module_default19);
|
79529
79440
|
var ZOOM_ON_CHANGE = true;
|
79530
79441
|
var Canvas = () => {
|
79531
79442
|
const { status, iframe } = useAppContext2();
|
79532
79443
|
const { dispatch, state, overrides, setUi, zoomConfig, setZoomConfig } = useAppContext2();
|
79533
79444
|
const { ui } = state;
|
79534
|
-
const frameRef = (0,
|
79535
|
-
const [showTransition, setShowTransition] = (0,
|
79536
|
-
const defaultRender = (0,
|
79537
|
-
const PuckDefault = ({ children }) => /* @__PURE__ */ (0,
|
79445
|
+
const frameRef = (0, import_react28.useRef)(null);
|
79446
|
+
const [showTransition, setShowTransition] = (0, import_react28.useState)(false);
|
79447
|
+
const defaultRender = (0, import_react28.useMemo)(() => {
|
79448
|
+
const PuckDefault = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_jsx_runtime34.Fragment, { children });
|
79538
79449
|
return PuckDefault;
|
79539
79450
|
}, []);
|
79540
|
-
const CustomPreview = (0,
|
79451
|
+
const CustomPreview = (0, import_react28.useMemo)(
|
79541
79452
|
() => overrides.preview || defaultRender,
|
79542
79453
|
[overrides]
|
79543
79454
|
);
|
79544
|
-
const getFrameDimensions = (0,
|
79455
|
+
const getFrameDimensions = (0, import_react28.useCallback)(() => {
|
79545
79456
|
if (frameRef.current) {
|
79546
79457
|
const frame = frameRef.current;
|
79547
79458
|
const box = getBox3(frame);
|
@@ -79549,7 +79460,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79549
79460
|
}
|
79550
79461
|
return { width: 0, height: 0 };
|
79551
79462
|
}, [frameRef]);
|
79552
|
-
const resetAutoZoom = (0,
|
79463
|
+
const resetAutoZoom = (0, import_react28.useCallback)(
|
79553
79464
|
(ui2 = state.ui) => {
|
79554
79465
|
if (frameRef.current) {
|
79555
79466
|
setZoomConfig(
|
@@ -79559,11 +79470,11 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79559
79470
|
},
|
79560
79471
|
[frameRef, zoomConfig, state.ui]
|
79561
79472
|
);
|
79562
|
-
(0,
|
79473
|
+
(0, import_react28.useEffect)(() => {
|
79563
79474
|
setShowTransition(false);
|
79564
79475
|
resetAutoZoom();
|
79565
79476
|
}, [frameRef, ui.leftSideBarVisible, ui.rightSideBarVisible]);
|
79566
|
-
(0,
|
79477
|
+
(0, import_react28.useEffect)(() => {
|
79567
79478
|
const { height: frameHeight } = getFrameDimensions();
|
79568
79479
|
if (ui.viewports.current.height === "auto") {
|
79569
79480
|
setZoomConfig(__spreadProps2(__spreadValues2({}, zoomConfig), {
|
@@ -79571,7 +79482,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79571
79482
|
}));
|
79572
79483
|
}
|
79573
79484
|
}, [zoomConfig.zoom]);
|
79574
|
-
(0,
|
79485
|
+
(0, import_react28.useEffect)(() => {
|
79575
79486
|
const observer = new ResizeObserver(() => {
|
79576
79487
|
setShowTransition(false);
|
79577
79488
|
resetAutoZoom();
|
@@ -79583,7 +79494,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79583
79494
|
observer.disconnect();
|
79584
79495
|
};
|
79585
79496
|
}, []);
|
79586
|
-
return /* @__PURE__ */ (0,
|
79497
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
79587
79498
|
"div",
|
79588
79499
|
{
|
79589
79500
|
className: getClassName24({
|
@@ -79595,7 +79506,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79595
79506
|
recordHistory: true
|
79596
79507
|
}),
|
79597
79508
|
children: [
|
79598
|
-
ui.viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ (0,
|
79509
|
+
ui.viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName24("controls"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
79599
79510
|
ViewportControls,
|
79600
79511
|
{
|
79601
79512
|
autoZoom: zoomConfig.autoZoom,
|
@@ -79620,7 +79531,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79620
79531
|
}
|
79621
79532
|
}
|
79622
79533
|
) }),
|
79623
|
-
/* @__PURE__ */ (0,
|
79534
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName24("inner"), ref: frameRef, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
79624
79535
|
"div",
|
79625
79536
|
{
|
79626
79537
|
className: getClassName24("root"),
|
@@ -79632,14 +79543,14 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79632
79543
|
overflow: iframe.enabled ? void 0 : "auto"
|
79633
79544
|
},
|
79634
79545
|
suppressHydrationWarning: true,
|
79635
|
-
children: /* @__PURE__ */ (0,
|
79546
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(CustomPreview, { children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Preview, {}) })
|
79636
79547
|
}
|
79637
79548
|
) })
|
79638
79549
|
]
|
79639
79550
|
}
|
79640
79551
|
);
|
79641
79552
|
};
|
79642
|
-
var
|
79553
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
79643
79554
|
var getClassName25 = get_class_name_factory_default2("Puck", styles_module_default8);
|
79644
79555
|
function Puck({
|
79645
79556
|
children,
|
@@ -79662,10 +79573,10 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79662
79573
|
}) {
|
79663
79574
|
var _a3;
|
79664
79575
|
const historyStore = useHistoryStore();
|
79665
|
-
const [reducer2] = (0,
|
79576
|
+
const [reducer2] = (0, import_react29.useState)(
|
79666
79577
|
() => createReducer({ config, record: historyStore.record })
|
79667
79578
|
);
|
79668
|
-
const [initialAppState] = (0,
|
79579
|
+
const [initialAppState] = (0, import_react29.useState)(() => {
|
79669
79580
|
var _a22, _b, _c, _d;
|
79670
79581
|
const initial = __spreadValues2(__spreadValues2({}, defaultAppState2.ui), initialUi);
|
79671
79582
|
let clientUiState = {};
|
@@ -79713,7 +79624,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79713
79624
|
})
|
79714
79625
|
});
|
79715
79626
|
});
|
79716
|
-
const [appState, dispatch] = (0,
|
79627
|
+
const [appState, dispatch] = (0, import_react29.useReducer)(
|
79717
79628
|
reducer2,
|
79718
79629
|
flushZones(initialAppState)
|
79719
79630
|
);
|
@@ -79724,9 +79635,9 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79724
79635
|
config,
|
79725
79636
|
dispatch
|
79726
79637
|
);
|
79727
|
-
const [menuOpen, setMenuOpen] = (0,
|
79638
|
+
const [menuOpen, setMenuOpen] = (0, import_react29.useState)(false);
|
79728
79639
|
const { itemSelector, leftSideBarVisible, rightSideBarVisible } = ui;
|
79729
|
-
const setItemSelector = (0,
|
79640
|
+
const setItemSelector = (0, import_react29.useCallback)(
|
79730
79641
|
(newItemSelector) => {
|
79731
79642
|
if (newItemSelector === itemSelector)
|
79732
79643
|
return;
|
@@ -79739,21 +79650,21 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79739
79650
|
[itemSelector]
|
79740
79651
|
);
|
79741
79652
|
const selectedItem = itemSelector ? getItem2(itemSelector, data) : null;
|
79742
|
-
(0,
|
79653
|
+
(0, import_react29.useEffect)(() => {
|
79743
79654
|
if (onChange)
|
79744
79655
|
onChange(data);
|
79745
79656
|
}, [data]);
|
79746
79657
|
const { onDragStartOrUpdate, placeholderStyle } = usePlaceholderStyle();
|
79747
|
-
const [draggedItem, setDraggedItem] = (0,
|
79658
|
+
const [draggedItem, setDraggedItem] = (0, import_react29.useState)();
|
79748
79659
|
const rootProps = data.root.props || data.root;
|
79749
|
-
(0,
|
79660
|
+
(0, import_react29.useEffect)(() => {
|
79750
79661
|
if (Object.keys(data.root).length > 0 && !data.root.props) {
|
79751
79662
|
console.error(
|
79752
79663
|
"Warning: Defining props on `root` is deprecated. Please use `root.props`. This will be a breaking change in a future release."
|
79753
79664
|
);
|
79754
79665
|
}
|
79755
79666
|
}, []);
|
79756
|
-
const toggleSidebars = (0,
|
79667
|
+
const toggleSidebars = (0, import_react29.useCallback)(
|
79757
79668
|
(sidebar) => {
|
79758
79669
|
const widerViewport = window.matchMedia("(min-width: 638px)").matches;
|
79759
79670
|
const sideBarVisible = sidebar === "left" ? leftSideBarVisible : rightSideBarVisible;
|
@@ -79767,7 +79678,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79767
79678
|
},
|
79768
79679
|
[dispatch, leftSideBarVisible, rightSideBarVisible]
|
79769
79680
|
);
|
79770
|
-
(0,
|
79681
|
+
(0, import_react29.useEffect)(() => {
|
79771
79682
|
if (!window.matchMedia("(min-width: 638px)").matches) {
|
79772
79683
|
dispatch({
|
79773
79684
|
type: "setUi",
|
@@ -79790,11 +79701,11 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79790
79701
|
window.removeEventListener("resize", handleResize);
|
79791
79702
|
};
|
79792
79703
|
}, []);
|
79793
|
-
const defaultRender = (0,
|
79794
|
-
const PuckDefault = ({ children: children2 }) => /* @__PURE__ */ (0,
|
79704
|
+
const defaultRender = (0, import_react29.useMemo)(() => {
|
79705
|
+
const PuckDefault = ({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_jsx_runtime35.Fragment, { children: children2 });
|
79795
79706
|
return PuckDefault;
|
79796
79707
|
}, []);
|
79797
|
-
const defaultHeaderRender = (0,
|
79708
|
+
const defaultHeaderRender = (0, import_react29.useMemo)(() => {
|
79798
79709
|
if (renderHeader) {
|
79799
79710
|
console.warn(
|
79800
79711
|
"`renderHeader` is deprecated. Please use `overrides.header` and the `usePuck` hook instead"
|
@@ -79802,45 +79713,45 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79802
79713
|
const RenderHeader = (_a22) => {
|
79803
79714
|
var _b = _a22, { actions } = _b, props = __objRest2(_b, ["actions"]);
|
79804
79715
|
const Comp = renderHeader;
|
79805
|
-
return /* @__PURE__ */ (0,
|
79716
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Comp, __spreadProps2(__spreadValues2({}, props), { dispatch, state: appState, children: actions }));
|
79806
79717
|
};
|
79807
79718
|
return RenderHeader;
|
79808
79719
|
}
|
79809
79720
|
return defaultRender;
|
79810
79721
|
}, [renderHeader]);
|
79811
|
-
const defaultHeaderActionsRender = (0,
|
79722
|
+
const defaultHeaderActionsRender = (0, import_react29.useMemo)(() => {
|
79812
79723
|
if (renderHeaderActions) {
|
79813
79724
|
console.warn(
|
79814
79725
|
"`renderHeaderActions` is deprecated. Please use `overrides.headerActions` and the `usePuck` hook instead."
|
79815
79726
|
);
|
79816
79727
|
const RenderHeader = (props) => {
|
79817
79728
|
const Comp = renderHeaderActions;
|
79818
|
-
return /* @__PURE__ */ (0,
|
79729
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Comp, __spreadProps2(__spreadValues2({}, props), { dispatch, state: appState }));
|
79819
79730
|
};
|
79820
79731
|
return RenderHeader;
|
79821
79732
|
}
|
79822
79733
|
return defaultRender;
|
79823
79734
|
}, [renderHeader]);
|
79824
|
-
const loadedOverrides = (0,
|
79735
|
+
const loadedOverrides = (0, import_react29.useMemo)(() => {
|
79825
79736
|
return loadOverrides({ overrides, plugins });
|
79826
79737
|
}, [plugins]);
|
79827
|
-
const CustomPuck = (0,
|
79738
|
+
const CustomPuck = (0, import_react29.useMemo)(
|
79828
79739
|
() => loadedOverrides.puck || defaultRender,
|
79829
79740
|
[loadedOverrides]
|
79830
79741
|
);
|
79831
|
-
const CustomHeader = (0,
|
79742
|
+
const CustomHeader = (0, import_react29.useMemo)(
|
79832
79743
|
() => loadedOverrides.header || defaultHeaderRender,
|
79833
79744
|
[loadedOverrides]
|
79834
79745
|
);
|
79835
|
-
const CustomHeaderActions = (0,
|
79746
|
+
const CustomHeaderActions = (0, import_react29.useMemo)(
|
79836
79747
|
() => loadedOverrides.headerActions || defaultHeaderActionsRender,
|
79837
79748
|
[loadedOverrides]
|
79838
79749
|
);
|
79839
|
-
const [mounted, setMounted] = (0,
|
79840
|
-
(0,
|
79750
|
+
const [mounted, setMounted] = (0, import_react29.useState)(false);
|
79751
|
+
(0, import_react29.useEffect)(() => {
|
79841
79752
|
setMounted(true);
|
79842
79753
|
}, []);
|
79843
|
-
return /* @__PURE__ */ (0,
|
79754
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "Puck", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
79844
79755
|
AppProvider,
|
79845
79756
|
{
|
79846
79757
|
value: {
|
@@ -79855,7 +79766,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79855
79766
|
viewports,
|
79856
79767
|
iframe
|
79857
79768
|
},
|
79858
|
-
children: /* @__PURE__ */ (0,
|
79769
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
79859
79770
|
DragDropContext2,
|
79860
79771
|
{
|
79861
79772
|
autoScrollerOptions: { disabled: dnd == null ? void 0 : dnd.disableAutoScroll },
|
@@ -79911,7 +79822,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79911
79822
|
});
|
79912
79823
|
}
|
79913
79824
|
},
|
79914
|
-
children: /* @__PURE__ */ (0,
|
79825
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
79915
79826
|
DropZoneProvider,
|
79916
79827
|
{
|
79917
79828
|
value: {
|
@@ -79925,7 +79836,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79925
79836
|
mode: "edit",
|
79926
79837
|
areaId: "root"
|
79927
79838
|
},
|
79928
|
-
children: /* @__PURE__ */ (0,
|
79839
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(CustomPuck, { children: children || /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
79929
79840
|
"div",
|
79930
79841
|
{
|
79931
79842
|
className: getClassName25({
|
@@ -79935,65 +79846,65 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79935
79846
|
rightSideBarVisible
|
79936
79847
|
}),
|
79937
79848
|
children: [
|
79938
|
-
/* @__PURE__ */ (0,
|
79939
|
-
/* @__PURE__ */ (0,
|
79849
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: getClassName25("layout"), children: [
|
79850
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
79940
79851
|
CustomHeader,
|
79941
79852
|
{
|
79942
|
-
actions: /* @__PURE__ */ (0,
|
79943
|
-
/* @__PURE__ */ (0,
|
79944
|
-
/* @__PURE__ */ (0,
|
79853
|
+
actions: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
|
79854
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(CustomHeaderActions, {}),
|
79855
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
79945
79856
|
Button,
|
79946
79857
|
{
|
79947
79858
|
onClick: () => {
|
79948
79859
|
onPublish && onPublish(data);
|
79949
79860
|
},
|
79950
|
-
icon: /* @__PURE__ */ (0,
|
79861
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Globe, { size: "14px" }),
|
79951
79862
|
children: "Publish"
|
79952
79863
|
}
|
79953
79864
|
)
|
79954
79865
|
] }),
|
79955
|
-
children: /* @__PURE__ */ (0,
|
79956
|
-
/* @__PURE__ */ (0,
|
79957
|
-
/* @__PURE__ */ (0,
|
79866
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("header", { className: getClassName25("header"), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: getClassName25("headerInner"), children: [
|
79867
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: getClassName25("headerToggle"), children: [
|
79868
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: getClassName25("leftSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
79958
79869
|
IconButton,
|
79959
79870
|
{
|
79960
79871
|
onClick: () => {
|
79961
79872
|
toggleSidebars("left");
|
79962
79873
|
},
|
79963
79874
|
title: "Toggle left sidebar",
|
79964
|
-
children: /* @__PURE__ */ (0,
|
79875
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(PanelLeft, { focusable: "false" })
|
79965
79876
|
}
|
79966
79877
|
) }),
|
79967
|
-
/* @__PURE__ */ (0,
|
79878
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: getClassName25("rightSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
79968
79879
|
IconButton,
|
79969
79880
|
{
|
79970
79881
|
onClick: () => {
|
79971
79882
|
toggleSidebars("right");
|
79972
79883
|
},
|
79973
79884
|
title: "Toggle right sidebar",
|
79974
|
-
children: /* @__PURE__ */ (0,
|
79885
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(PanelRight, { focusable: "false" })
|
79975
79886
|
}
|
79976
79887
|
) })
|
79977
79888
|
] }),
|
79978
|
-
/* @__PURE__ */ (0,
|
79889
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: getClassName25("headerTitle"), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Heading2, { rank: 2, size: "xs", children: [
|
79979
79890
|
headerTitle || rootProps.title || "Page",
|
79980
|
-
headerPath && /* @__PURE__ */ (0,
|
79891
|
+
headerPath && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
|
79981
79892
|
" ",
|
79982
|
-
/* @__PURE__ */ (0,
|
79893
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("code", { className: getClassName25("headerPath"), children: headerPath })
|
79983
79894
|
] })
|
79984
79895
|
] }) }),
|
79985
|
-
/* @__PURE__ */ (0,
|
79986
|
-
/* @__PURE__ */ (0,
|
79896
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: getClassName25("headerTools"), children: [
|
79897
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: getClassName25("menuButton"), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
79987
79898
|
IconButton,
|
79988
79899
|
{
|
79989
79900
|
onClick: () => {
|
79990
79901
|
return setMenuOpen(!menuOpen);
|
79991
79902
|
},
|
79992
79903
|
title: "Toggle menu bar",
|
79993
|
-
children: menuOpen ? /* @__PURE__ */ (0,
|
79904
|
+
children: menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ChevronDown, { focusable: "false" })
|
79994
79905
|
}
|
79995
79906
|
) }),
|
79996
|
-
/* @__PURE__ */ (0,
|
79907
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
79997
79908
|
MenuBar,
|
79998
79909
|
{
|
79999
79910
|
appState,
|
@@ -80001,7 +79912,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
80001
79912
|
dispatch,
|
80002
79913
|
onPublish,
|
80003
79914
|
menuOpen,
|
80004
|
-
renderHeaderActions: () => /* @__PURE__ */ (0,
|
79915
|
+
renderHeaderActions: () => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(CustomHeaderActions, {}),
|
80005
79916
|
setMenuOpen
|
80006
79917
|
}
|
80007
79918
|
)
|
@@ -80009,23 +79920,23 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
80009
79920
|
] }) })
|
80010
79921
|
}
|
80011
79922
|
),
|
80012
|
-
/* @__PURE__ */ (0,
|
80013
|
-
/* @__PURE__ */ (0,
|
80014
|
-
/* @__PURE__ */ (0,
|
79923
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: getClassName25("leftSideBar"), children: [
|
79924
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(SidebarSection2, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Components, {}) }),
|
79925
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(SidebarSection2, { title: "Outline", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Outline, {}) })
|
80015
79926
|
] }),
|
80016
|
-
/* @__PURE__ */ (0,
|
80017
|
-
/* @__PURE__ */ (0,
|
79927
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Canvas, {}),
|
79928
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: getClassName25("rightSideBar"), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
80018
79929
|
SidebarSection2,
|
80019
79930
|
{
|
80020
79931
|
noPadding: true,
|
80021
79932
|
noBorderTop: true,
|
80022
79933
|
showBreadcrumbs: true,
|
80023
79934
|
title: selectedItem ? (_a3 = config.components[selectedItem.type]["label"]) != null ? _a3 : selectedItem.type : "Page",
|
80024
|
-
children: /* @__PURE__ */ (0,
|
79935
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Fields, {})
|
80025
79936
|
}
|
80026
79937
|
) })
|
80027
79938
|
] }),
|
80028
|
-
/* @__PURE__ */ (0,
|
79939
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
80029
79940
|
"div",
|
80030
79941
|
{
|
80031
79942
|
id: "puck-portal-root",
|
@@ -80047,7 +79958,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
80047
79958
|
Puck.Outline = Outline;
|
80048
79959
|
Puck.Preview = Preview;
|
80049
79960
|
init_react_import2();
|
80050
|
-
var
|
79961
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
80051
79962
|
function Render({
|
80052
79963
|
config,
|
80053
79964
|
data
|
@@ -80056,7 +79967,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
80056
79967
|
const rootProps = data.root.props || data.root;
|
80057
79968
|
const title = (rootProps == null ? void 0 : rootProps.title) || "";
|
80058
79969
|
if ((_a3 = config.root) == null ? void 0 : _a3.render) {
|
80059
|
-
return /* @__PURE__ */ (0,
|
79970
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
80060
79971
|
config.root.render,
|
80061
79972
|
__spreadProps2(__spreadValues2({}, rootProps), {
|
80062
79973
|
puck: {
|
@@ -80065,11 +79976,11 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
80065
79976
|
title,
|
80066
79977
|
editMode: false,
|
80067
79978
|
id: "puck-root",
|
80068
|
-
children: /* @__PURE__ */ (0,
|
79979
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(DropZone, { zone: rootDroppableId2 })
|
80069
79980
|
})
|
80070
79981
|
) });
|
80071
79982
|
}
|
80072
|
-
return /* @__PURE__ */ (0,
|
79983
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(DropZone, { zone: rootDroppableId2 }) });
|
80073
79984
|
}
|
80074
79985
|
init_react_import2();
|
80075
79986
|
var migrations = [
|
@@ -80234,7 +80145,7 @@ init_react_import();
|
|
80234
80145
|
// src/HeadingAnalyzer.tsx
|
80235
80146
|
init_react_import();
|
80236
80147
|
var import_react12 = require("react");
|
80237
|
-
var import_puck = __toESM(
|
80148
|
+
var import_puck = __toESM(require_dist());
|
80238
80149
|
|
80239
80150
|
// ../core/components/SidebarSection/index.tsx
|
80240
80151
|
init_react_import();
|