@measured/puck-plugin-heading-analyzer 0.14.3-canary.9a1cc7c → 0.15.0-canary.480467a
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.d.ts +5 -9
- package/dist/index.js +360 -453
- 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
|
);
|
@@ -77697,17 +77411,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
77697
77411
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_jsx_runtime13.Fragment, { children: renderHeaderActions && renderHeaderActions({
|
77698
77412
|
state: appState,
|
77699
77413
|
dispatch
|
77700
|
-
}) })
|
77701
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
77702
|
-
Button,
|
77703
|
-
{
|
77704
|
-
onClick: () => {
|
77705
|
-
onPublish && onPublish(data);
|
77706
|
-
},
|
77707
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Globe, { size: "14px" }),
|
77708
|
-
children: "Publish"
|
77709
|
-
}
|
77710
|
-
) })
|
77414
|
+
}) })
|
77711
77415
|
] })
|
77712
77416
|
}
|
77713
77417
|
);
|
@@ -78894,15 +78598,212 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
78894
78598
|
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ComponentList, { id: "all" }) });
|
78895
78599
|
};
|
78896
78600
|
init_react_import2();
|
78897
|
-
var
|
78898
|
-
var import_auto_frame_component = __toESM2(require_dist());
|
78601
|
+
var import_react23 = require("react");
|
78899
78602
|
init_react_import2();
|
78900
|
-
var
|
78603
|
+
var import_react222 = __toESM2(require("react"));
|
78604
|
+
var import_react_frame_component = __toESM2(require_lib());
|
78605
|
+
var import_object_hash = __toESM2(require_object_hash());
|
78901
78606
|
var import_jsx_runtime29 = require("react/jsx-runtime");
|
78607
|
+
var styleSelector = 'style, link[rel="stylesheet"]';
|
78608
|
+
var collectStyles = (doc) => {
|
78609
|
+
const collected = [];
|
78610
|
+
doc.head.querySelectorAll(styleSelector).forEach((style2) => {
|
78611
|
+
collected.push(style2);
|
78612
|
+
});
|
78613
|
+
return collected;
|
78614
|
+
};
|
78615
|
+
var getStyleSheet = (el) => {
|
78616
|
+
return Array.from(document.styleSheets).find((ss) => {
|
78617
|
+
const ownerNode = ss.ownerNode;
|
78618
|
+
return ownerNode.href === el.href;
|
78619
|
+
});
|
78620
|
+
};
|
78621
|
+
var getStyles2 = (styleSheet) => {
|
78622
|
+
if (styleSheet) {
|
78623
|
+
try {
|
78624
|
+
return [...styleSheet.cssRules].map((rule) => rule.cssText).join("");
|
78625
|
+
} catch (e2) {
|
78626
|
+
console.warn(
|
78627
|
+
"Access to stylesheet %s is denied. Ignoring\u2026",
|
78628
|
+
styleSheet.href
|
78629
|
+
);
|
78630
|
+
}
|
78631
|
+
}
|
78632
|
+
return "";
|
78633
|
+
};
|
78634
|
+
var defer = (fn) => setTimeout(fn, 0);
|
78635
|
+
var CopyHostStyles = ({
|
78636
|
+
children,
|
78637
|
+
debug = false,
|
78638
|
+
onStylesLoaded = () => null
|
78639
|
+
}) => {
|
78640
|
+
const { document: doc, window: win } = (0, import_react_frame_component.useFrame)();
|
78641
|
+
(0, import_react222.useEffect)(() => {
|
78642
|
+
if (!win || !doc) {
|
78643
|
+
return () => {
|
78644
|
+
};
|
78645
|
+
}
|
78646
|
+
let elements = [];
|
78647
|
+
const hashes = {};
|
78648
|
+
const lookupEl = (el) => elements.findIndex((elementMap) => elementMap.original === el);
|
78649
|
+
const mirrorEl = (el, inlineStyles = false) => __async2(void 0, null, function* () {
|
78650
|
+
let mirror;
|
78651
|
+
if (el.nodeName === "LINK" && inlineStyles) {
|
78652
|
+
mirror = document.createElement("style");
|
78653
|
+
mirror.type = "text/css";
|
78654
|
+
let styleSheet = getStyleSheet(el);
|
78655
|
+
if (!styleSheet) {
|
78656
|
+
yield new Promise((resolve) => {
|
78657
|
+
const fn = () => {
|
78658
|
+
resolve();
|
78659
|
+
el.removeEventListener("load", fn);
|
78660
|
+
};
|
78661
|
+
el.addEventListener("load", fn);
|
78662
|
+
});
|
78663
|
+
styleSheet = getStyleSheet(el);
|
78664
|
+
}
|
78665
|
+
const styles = getStyles2(styleSheet);
|
78666
|
+
if (!styles) {
|
78667
|
+
if (debug) {
|
78668
|
+
console.warn(
|
78669
|
+
`Tried to load styles for link element, but couldn't find them. Skipping...`
|
78670
|
+
);
|
78671
|
+
}
|
78672
|
+
return;
|
78673
|
+
}
|
78674
|
+
mirror.innerHTML = styles;
|
78675
|
+
mirror.setAttribute("data-href", el.getAttribute("href"));
|
78676
|
+
} else {
|
78677
|
+
mirror = el.cloneNode(true);
|
78678
|
+
}
|
78679
|
+
return mirror;
|
78680
|
+
});
|
78681
|
+
const addEl = (el) => __async2(void 0, null, function* () {
|
78682
|
+
const index = lookupEl(el);
|
78683
|
+
if (index > -1) {
|
78684
|
+
if (debug)
|
78685
|
+
console.log(
|
78686
|
+
`Tried to add an element that was already mirrored. Updating instead...`
|
78687
|
+
);
|
78688
|
+
elements[index].mirror.innerText = el.innerText;
|
78689
|
+
return;
|
78690
|
+
}
|
78691
|
+
const mirror = yield mirrorEl(el);
|
78692
|
+
if (!mirror) {
|
78693
|
+
return;
|
78694
|
+
}
|
78695
|
+
const elHash = (0, import_object_hash.default)(mirror.outerHTML);
|
78696
|
+
if (hashes[elHash]) {
|
78697
|
+
if (debug)
|
78698
|
+
console.log(
|
78699
|
+
`iframe already contains element that is being mirrored. Skipping...`
|
78700
|
+
);
|
78701
|
+
return;
|
78702
|
+
}
|
78703
|
+
hashes[elHash] = true;
|
78704
|
+
doc.head.append(mirror);
|
78705
|
+
elements.push({ original: el, mirror });
|
78706
|
+
if (debug)
|
78707
|
+
console.log(`Added style node ${el.outerHTML}`);
|
78708
|
+
});
|
78709
|
+
const removeEl = (el) => {
|
78710
|
+
var _a3, _b;
|
78711
|
+
const index = lookupEl(el);
|
78712
|
+
if (index === -1) {
|
78713
|
+
if (debug)
|
78714
|
+
console.log(
|
78715
|
+
`Tried to remove an element that did not exist. Skipping...`
|
78716
|
+
);
|
78717
|
+
return;
|
78718
|
+
}
|
78719
|
+
const elHash = (0, import_object_hash.default)(el.outerHTML);
|
78720
|
+
(_b = (_a3 = elements[index]) == null ? void 0 : _a3.mirror) == null ? void 0 : _b.remove();
|
78721
|
+
delete hashes[elHash];
|
78722
|
+
if (debug)
|
78723
|
+
console.log(`Removed style node ${el.outerHTML}`);
|
78724
|
+
};
|
78725
|
+
const observer = new MutationObserver((mutations) => {
|
78726
|
+
mutations.forEach((mutation) => {
|
78727
|
+
if (mutation.type === "childList") {
|
78728
|
+
mutation.addedNodes.forEach((node) => {
|
78729
|
+
if (node.nodeType === Node.TEXT_NODE || node.nodeType === Node.ELEMENT_NODE) {
|
78730
|
+
const el = node.nodeType === Node.TEXT_NODE ? node.parentElement : node;
|
78731
|
+
if (el && el.matches(styleSelector)) {
|
78732
|
+
defer(() => addEl(el));
|
78733
|
+
}
|
78734
|
+
}
|
78735
|
+
});
|
78736
|
+
mutation.removedNodes.forEach((node) => {
|
78737
|
+
if (node.nodeType === Node.TEXT_NODE || node.nodeType === Node.ELEMENT_NODE) {
|
78738
|
+
const el = node.nodeType === Node.TEXT_NODE ? node.parentElement : node;
|
78739
|
+
if (el && el.matches(styleSelector)) {
|
78740
|
+
defer(() => removeEl(el));
|
78741
|
+
}
|
78742
|
+
}
|
78743
|
+
});
|
78744
|
+
}
|
78745
|
+
});
|
78746
|
+
});
|
78747
|
+
const parentDocument = win.parent.document;
|
78748
|
+
const collectedStyles = collectStyles(parentDocument);
|
78749
|
+
const hrefs = [];
|
78750
|
+
let stylesLoaded = 0;
|
78751
|
+
Promise.all(
|
78752
|
+
collectedStyles.map((styleNode, i2) => __async2(void 0, null, function* () {
|
78753
|
+
if (styleNode.nodeName === "LINK") {
|
78754
|
+
const linkHref = styleNode.href;
|
78755
|
+
if (hrefs.indexOf(linkHref) > -1) {
|
78756
|
+
return;
|
78757
|
+
}
|
78758
|
+
hrefs.push(linkHref);
|
78759
|
+
}
|
78760
|
+
const mirror = yield mirrorEl(styleNode);
|
78761
|
+
if (!mirror)
|
78762
|
+
return;
|
78763
|
+
elements.push({ original: styleNode, mirror });
|
78764
|
+
return mirror;
|
78765
|
+
}))
|
78766
|
+
).then((mirrorStyles) => {
|
78767
|
+
const filtered = mirrorStyles.filter(
|
78768
|
+
(el) => typeof el !== "undefined"
|
78769
|
+
);
|
78770
|
+
filtered.forEach((mirror) => {
|
78771
|
+
mirror.onload = () => {
|
78772
|
+
stylesLoaded = stylesLoaded + 1;
|
78773
|
+
if (stylesLoaded >= elements.length) {
|
78774
|
+
onStylesLoaded();
|
78775
|
+
}
|
78776
|
+
};
|
78777
|
+
});
|
78778
|
+
doc.head.innerHTML = "";
|
78779
|
+
doc.head.append(...filtered);
|
78780
|
+
observer.observe(parentDocument.head, { childList: true, subtree: true });
|
78781
|
+
filtered.forEach((el) => {
|
78782
|
+
const elHash = (0, import_object_hash.default)(el.outerHTML);
|
78783
|
+
hashes[elHash] = true;
|
78784
|
+
});
|
78785
|
+
});
|
78786
|
+
return () => {
|
78787
|
+
observer.disconnect();
|
78788
|
+
};
|
78789
|
+
}, []);
|
78790
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_jsx_runtime29.Fragment, { children });
|
78791
|
+
};
|
78792
|
+
var AutoFrameComponent = import_react222.default.forwardRef(
|
78793
|
+
function(_a3, ref2) {
|
78794
|
+
var _b = _a3, { children, debug, onStylesLoaded } = _b, props = __objRest2(_b, ["children", "debug", "onStylesLoaded"]);
|
78795
|
+
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 }) }));
|
78796
|
+
}
|
78797
|
+
);
|
78798
|
+
AutoFrameComponent.displayName = "AutoFrameComponent";
|
78799
|
+
var AutoFrame_default = AutoFrameComponent;
|
78800
|
+
init_react_import2();
|
78801
|
+
var styles_module_default16 = { "PuckPreview": "_PuckPreview_rxwlr_1", "PuckPreview-frame": "_PuckPreview-frame_rxwlr_5" };
|
78802
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
78902
78803
|
var getClassName21 = get_class_name_factory_default2("PuckPreview", styles_module_default16);
|
78903
78804
|
var Preview = ({ id = "puck-preview" }) => {
|
78904
78805
|
const { config, dispatch, state, setStatus, iframe } = useAppContext2();
|
78905
|
-
const Page = (0,
|
78806
|
+
const Page = (0, import_react23.useCallback)(
|
78906
78807
|
(pageProps) => {
|
78907
78808
|
var _a3, _b;
|
78908
78809
|
return ((_a3 = config.root) == null ? void 0 : _a3.render) ? (_b = config.root) == null ? void 0 : _b.render(__spreadProps2(__spreadValues2({
|
@@ -78910,13 +78811,13 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
78910
78811
|
}, pageProps), {
|
78911
78812
|
editMode: true,
|
78912
78813
|
puck: { renderDropZone: DropZone }
|
78913
|
-
})) : /* @__PURE__ */ (0,
|
78814
|
+
})) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_jsx_runtime30.Fragment, { children: pageProps.children });
|
78914
78815
|
},
|
78915
78816
|
[config.root]
|
78916
78817
|
);
|
78917
78818
|
const rootProps = state.data.root.props || state.data.root;
|
78918
|
-
const ref2 = (0,
|
78919
|
-
return /* @__PURE__ */ (0,
|
78819
|
+
const ref2 = (0, import_react23.useRef)(null);
|
78820
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
78920
78821
|
"div",
|
78921
78822
|
{
|
78922
78823
|
className: getClassName21(),
|
@@ -78924,8 +78825,8 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
78924
78825
|
onClick: () => {
|
78925
78826
|
dispatch({ type: "setUi", ui: __spreadProps2(__spreadValues2({}, state.ui), { itemSelector: null }) });
|
78926
78827
|
},
|
78927
|
-
children: iframe.enabled ? /* @__PURE__ */ (0,
|
78928
|
-
|
78828
|
+
children: iframe.enabled ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
78829
|
+
AutoFrame_default,
|
78929
78830
|
{
|
78930
78831
|
id: "preview-frame",
|
78931
78832
|
className: getClassName21("frame"),
|
@@ -78934,9 +78835,9 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
78934
78835
|
onStylesLoaded: () => {
|
78935
78836
|
setStatus("READY");
|
78936
78837
|
},
|
78937
|
-
children: /* @__PURE__ */ (0,
|
78838
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Page, __spreadProps2(__spreadValues2({ dispatch, state }, rootProps), { children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(DropZone, { zone: rootDroppableId2 }) }))
|
78938
78839
|
}
|
78939
|
-
) : /* @__PURE__ */ (0,
|
78840
|
+
) : /* @__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
78841
|
}
|
78941
78842
|
);
|
78942
78843
|
};
|
@@ -78968,7 +78869,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
78968
78869
|
el.style.scrollMargin = oldStyle.scrollMargin || "";
|
78969
78870
|
}
|
78970
78871
|
};
|
78971
|
-
var
|
78872
|
+
var import_react24 = require("react");
|
78972
78873
|
init_react_import2();
|
78973
78874
|
var isChildOfZone = (item, maybeChild, ctx) => {
|
78974
78875
|
var _a3;
|
@@ -78978,7 +78879,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
78978
78879
|
return area === item.props.id;
|
78979
78880
|
})) : false;
|
78980
78881
|
};
|
78981
|
-
var
|
78882
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
78982
78883
|
var getClassName222 = get_class_name_factory_default2("LayerTree", styles_module_default17);
|
78983
78884
|
var getClassNameLayer = get_class_name_factory_default2("Layer", styles_module_default17);
|
78984
78885
|
var LayerTree = ({
|
@@ -78991,15 +78892,15 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
78991
78892
|
label
|
78992
78893
|
}) => {
|
78993
78894
|
const zones = data.zones || {};
|
78994
|
-
const ctx = (0,
|
78995
|
-
return /* @__PURE__ */ (0,
|
78996
|
-
label && /* @__PURE__ */ (0,
|
78997
|
-
/* @__PURE__ */ (0,
|
78895
|
+
const ctx = (0, import_react24.useContext)(dropZoneContext2);
|
78896
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
|
78897
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: getClassName222("zoneTitle"), children: [
|
78898
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: getClassName222("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Layers, { size: "16" }) }),
|
78998
78899
|
" ",
|
78999
78900
|
label
|
79000
78901
|
] }),
|
79001
|
-
/* @__PURE__ */ (0,
|
79002
|
-
zoneContent.length === 0 && /* @__PURE__ */ (0,
|
78902
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("ul", { className: getClassName222(), children: [
|
78903
|
+
zoneContent.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: getClassName222("helper"), children: "No items" }),
|
79003
78904
|
zoneContent.map((item, i2) => {
|
79004
78905
|
var _a3;
|
79005
78906
|
const isSelected = (itemSelector == null ? void 0 : itemSelector.index) === i2 && (itemSelector.zone === zone || itemSelector.zone === rootDroppableId2 && !zone);
|
@@ -79015,7 +78916,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79015
78916
|
const selectedItem = itemSelector && data ? getItem2(itemSelector, data) : null;
|
79016
78917
|
const isHovering = hoveringComponent === item.props.id;
|
79017
78918
|
const childIsSelected = isChildOfZone(item, selectedItem, ctx);
|
79018
|
-
return /* @__PURE__ */ (0,
|
78919
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
79019
78920
|
"li",
|
79020
78921
|
{
|
79021
78922
|
className: getClassNameLayer({
|
@@ -79025,7 +78926,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79025
78926
|
childIsSelected
|
79026
78927
|
}),
|
79027
78928
|
children: [
|
79028
|
-
/* @__PURE__ */ (0,
|
78929
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
79029
78930
|
"button",
|
79030
78931
|
{
|
79031
78932
|
className: getClassNameLayer("clickable"),
|
@@ -79057,22 +78958,22 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79057
78958
|
setHoveringComponent(null);
|
79058
78959
|
},
|
79059
78960
|
children: [
|
79060
|
-
containsZone && /* @__PURE__ */ (0,
|
78961
|
+
containsZone && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
79061
78962
|
"div",
|
79062
78963
|
{
|
79063
78964
|
className: getClassNameLayer("chevron"),
|
79064
78965
|
title: isSelected ? "Collapse" : "Expand",
|
79065
|
-
children: /* @__PURE__ */ (0,
|
78966
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ChevronDown, { size: "12" })
|
79066
78967
|
}
|
79067
78968
|
),
|
79068
|
-
/* @__PURE__ */ (0,
|
79069
|
-
/* @__PURE__ */ (0,
|
79070
|
-
/* @__PURE__ */ (0,
|
78969
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: getClassNameLayer("title"), children: [
|
78970
|
+
/* @__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" }) }),
|
78971
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: getClassNameLayer("name"), children: (_a3 = config.components[item.type]["label"]) != null ? _a3 : item.type })
|
79071
78972
|
] })
|
79072
78973
|
]
|
79073
78974
|
}
|
79074
78975
|
) }),
|
79075
|
-
containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ (0,
|
78976
|
+
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
78977
|
LayerTree,
|
79077
78978
|
{
|
79078
78979
|
config,
|
@@ -79092,13 +78993,13 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79092
78993
|
] })
|
79093
78994
|
] });
|
79094
78995
|
};
|
79095
|
-
var
|
79096
|
-
var
|
78996
|
+
var import_react25 = require("react");
|
78997
|
+
var import_jsx_runtime322 = require("react/jsx-runtime");
|
79097
78998
|
var Outline = () => {
|
79098
78999
|
const { dispatch, state, overrides, config } = useAppContext2();
|
79099
79000
|
const { data, ui } = state;
|
79100
79001
|
const { itemSelector } = ui;
|
79101
|
-
const setItemSelector = (0,
|
79002
|
+
const setItemSelector = (0, import_react25.useCallback)(
|
79102
79003
|
(newItemSelector) => {
|
79103
79004
|
dispatch({
|
79104
79005
|
type: "setUi",
|
@@ -79107,9 +79008,9 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79107
79008
|
},
|
79108
79009
|
[]
|
79109
79010
|
);
|
79110
|
-
const Wrapper = (0,
|
79111
|
-
return /* @__PURE__ */ (0,
|
79112
|
-
(ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId2]) && /* @__PURE__ */ (0,
|
79011
|
+
const Wrapper = (0, import_react25.useMemo)(() => overrides.outline || "div", [overrides]);
|
79012
|
+
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: [
|
79013
|
+
(ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId2]) && /* @__PURE__ */ (0, import_jsx_runtime322.jsx)(
|
79113
79014
|
LayerTree,
|
79114
79015
|
{
|
79115
79016
|
config,
|
@@ -79122,7 +79023,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79122
79023
|
),
|
79123
79024
|
Object.entries(findZonesForArea(data, "root")).map(
|
79124
79025
|
([zoneKey, zone]) => {
|
79125
|
-
return /* @__PURE__ */ (0,
|
79026
|
+
return /* @__PURE__ */ (0, import_jsx_runtime322.jsx)(
|
79126
79027
|
LayerTree,
|
79127
79028
|
{
|
79128
79029
|
config,
|
@@ -79201,12 +79102,12 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79201
79102
|
};
|
79202
79103
|
}
|
79203
79104
|
init_react_import2();
|
79204
|
-
var
|
79105
|
+
var import_react26 = require("react");
|
79205
79106
|
var import_use_debounce3 = (init_index_module(), __toCommonJS(index_module_exports));
|
79206
79107
|
var EMPTY_HISTORY_INDEX = -1;
|
79207
79108
|
function useHistoryStore() {
|
79208
|
-
const [histories, setHistories] = (0,
|
79209
|
-
const [index, setIndex] = (0,
|
79109
|
+
const [histories, setHistories] = (0, import_react26.useState)([]);
|
79110
|
+
const [index, setIndex] = (0, import_react26.useState)(EMPTY_HISTORY_INDEX);
|
79210
79111
|
const hasPast = index > EMPTY_HISTORY_INDEX;
|
79211
79112
|
const hasFuture = index < histories.length - 1;
|
79212
79113
|
const currentHistory = histories[index];
|
@@ -79356,16 +79257,16 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79356
79257
|
var styles = window.getComputedStyle(el);
|
79357
79258
|
return calculateBox3(borderBox, styles);
|
79358
79259
|
};
|
79359
|
-
var
|
79260
|
+
var import_react28 = require("react");
|
79360
79261
|
init_react_import2();
|
79361
|
-
var
|
79262
|
+
var import_react27 = require("react");
|
79362
79263
|
init_react_import2();
|
79363
79264
|
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
|
79265
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
79365
79266
|
var icons = {
|
79366
|
-
Smartphone: /* @__PURE__ */ (0,
|
79367
|
-
Tablet: /* @__PURE__ */ (0,
|
79368
|
-
Monitor: /* @__PURE__ */ (0,
|
79267
|
+
Smartphone: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Smartphone, { size: 16 }),
|
79268
|
+
Tablet: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Tablet, { size: 16 }),
|
79269
|
+
Monitor: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Monitor, { size: 16 })
|
79369
79270
|
};
|
79370
79271
|
var getClassName23 = get_class_name_factory_default2("ViewportControls", styles_module_default18);
|
79371
79272
|
var getClassNameButton = get_class_name_factory_default2("ViewportButton", styles_module_default18);
|
@@ -79377,11 +79278,11 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79377
79278
|
onClick
|
79378
79279
|
}) => {
|
79379
79280
|
const { state } = useAppContext2();
|
79380
|
-
const [isActive2, setIsActive] = (0,
|
79381
|
-
(0,
|
79281
|
+
const [isActive2, setIsActive] = (0, import_react27.useState)(false);
|
79282
|
+
(0, import_react27.useEffect)(() => {
|
79382
79283
|
setIsActive(width === state.ui.viewports.current.width);
|
79383
79284
|
}, [width, state.ui.viewports.current.width]);
|
79384
|
-
return /* @__PURE__ */ (0,
|
79285
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: getClassNameButton({ isActive: isActive2 }), children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
79385
79286
|
IconButton,
|
79386
79287
|
{
|
79387
79288
|
title,
|
@@ -79390,7 +79291,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79390
79291
|
e2.stopPropagation();
|
79391
79292
|
onClick({ width, height });
|
79392
79293
|
},
|
79393
|
-
children: /* @__PURE__ */ (0,
|
79294
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: getClassNameButton("inner"), children })
|
79394
79295
|
}
|
79395
79296
|
) });
|
79396
79297
|
};
|
@@ -79414,7 +79315,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79414
79315
|
const defaultsContainAutoZoom = defaultZoomOptions.find(
|
79415
79316
|
(option) => option.value === autoZoom
|
79416
79317
|
);
|
79417
|
-
const zoomOptions = (0,
|
79318
|
+
const zoomOptions = (0, import_react27.useMemo)(
|
79418
79319
|
() => [
|
79419
79320
|
...defaultZoomOptions,
|
79420
79321
|
...defaultsContainAutoZoom ? [] : [
|
@@ -79426,8 +79327,8 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79426
79327
|
].filter((a2) => a2.value <= autoZoom).sort((a2, b) => a2.value > b.value ? 1 : -1),
|
79427
79328
|
[autoZoom]
|
79428
79329
|
);
|
79429
|
-
return /* @__PURE__ */ (0,
|
79430
|
-
viewports.map((viewport, i2) => /* @__PURE__ */ (0,
|
79330
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: getClassName23(), children: [
|
79331
|
+
viewports.map((viewport, i2) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
79431
79332
|
ViewportButton,
|
79432
79333
|
{
|
79433
79334
|
height: viewport.height,
|
@@ -79438,8 +79339,8 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79438
79339
|
},
|
79439
79340
|
i2
|
79440
79341
|
)),
|
79441
|
-
/* @__PURE__ */ (0,
|
79442
|
-
/* @__PURE__ */ (0,
|
79342
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: getClassName23("divider") }),
|
79343
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
79443
79344
|
IconButton,
|
79444
79345
|
{
|
79445
79346
|
title: "Zoom viewport out",
|
@@ -79453,10 +79354,10 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79453
79354
|
)].value
|
79454
79355
|
);
|
79455
79356
|
},
|
79456
|
-
children: /* @__PURE__ */ (0,
|
79357
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ZoomOut, { size: 16 })
|
79457
79358
|
}
|
79458
79359
|
),
|
79459
|
-
/* @__PURE__ */ (0,
|
79360
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
79460
79361
|
IconButton,
|
79461
79362
|
{
|
79462
79363
|
title: "Zoom viewport in",
|
@@ -79470,11 +79371,11 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79470
79371
|
)].value
|
79471
79372
|
);
|
79472
79373
|
},
|
79473
|
-
children: /* @__PURE__ */ (0,
|
79374
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ZoomIn, { size: 16 })
|
79474
79375
|
}
|
79475
79376
|
),
|
79476
|
-
/* @__PURE__ */ (0,
|
79477
|
-
/* @__PURE__ */ (0,
|
79377
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: getClassName23("divider") }),
|
79378
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
79478
79379
|
"select",
|
79479
79380
|
{
|
79480
79381
|
className: getClassName23("zoomSelect"),
|
@@ -79482,7 +79383,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79482
79383
|
onChange: (e2) => {
|
79483
79384
|
onZoom(parseFloat(e2.currentTarget.value));
|
79484
79385
|
},
|
79485
|
-
children: zoomOptions.map((option) => /* @__PURE__ */ (0,
|
79386
|
+
children: zoomOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
79486
79387
|
"option",
|
79487
79388
|
{
|
79488
79389
|
value: option.value,
|
@@ -79524,24 +79425,24 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79524
79425
|
}
|
79525
79426
|
return { autoZoom, rootHeight, zoom };
|
79526
79427
|
};
|
79527
|
-
var
|
79428
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
79528
79429
|
var getClassName24 = get_class_name_factory_default2("PuckCanvas", styles_module_default19);
|
79529
79430
|
var ZOOM_ON_CHANGE = true;
|
79530
79431
|
var Canvas = () => {
|
79531
79432
|
const { status, iframe } = useAppContext2();
|
79532
79433
|
const { dispatch, state, overrides, setUi, zoomConfig, setZoomConfig } = useAppContext2();
|
79533
79434
|
const { ui } = state;
|
79534
|
-
const frameRef = (0,
|
79535
|
-
const [showTransition, setShowTransition] = (0,
|
79536
|
-
const defaultRender = (0,
|
79537
|
-
const PuckDefault = ({ children }) => /* @__PURE__ */ (0,
|
79435
|
+
const frameRef = (0, import_react28.useRef)(null);
|
79436
|
+
const [showTransition, setShowTransition] = (0, import_react28.useState)(false);
|
79437
|
+
const defaultRender = (0, import_react28.useMemo)(() => {
|
79438
|
+
const PuckDefault = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_jsx_runtime34.Fragment, { children });
|
79538
79439
|
return PuckDefault;
|
79539
79440
|
}, []);
|
79540
|
-
const CustomPreview = (0,
|
79441
|
+
const CustomPreview = (0, import_react28.useMemo)(
|
79541
79442
|
() => overrides.preview || defaultRender,
|
79542
79443
|
[overrides]
|
79543
79444
|
);
|
79544
|
-
const getFrameDimensions = (0,
|
79445
|
+
const getFrameDimensions = (0, import_react28.useCallback)(() => {
|
79545
79446
|
if (frameRef.current) {
|
79546
79447
|
const frame = frameRef.current;
|
79547
79448
|
const box = getBox3(frame);
|
@@ -79549,7 +79450,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79549
79450
|
}
|
79550
79451
|
return { width: 0, height: 0 };
|
79551
79452
|
}, [frameRef]);
|
79552
|
-
const resetAutoZoom = (0,
|
79453
|
+
const resetAutoZoom = (0, import_react28.useCallback)(
|
79553
79454
|
(ui2 = state.ui) => {
|
79554
79455
|
if (frameRef.current) {
|
79555
79456
|
setZoomConfig(
|
@@ -79559,11 +79460,11 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79559
79460
|
},
|
79560
79461
|
[frameRef, zoomConfig, state.ui]
|
79561
79462
|
);
|
79562
|
-
(0,
|
79463
|
+
(0, import_react28.useEffect)(() => {
|
79563
79464
|
setShowTransition(false);
|
79564
79465
|
resetAutoZoom();
|
79565
79466
|
}, [frameRef, ui.leftSideBarVisible, ui.rightSideBarVisible]);
|
79566
|
-
(0,
|
79467
|
+
(0, import_react28.useEffect)(() => {
|
79567
79468
|
const { height: frameHeight } = getFrameDimensions();
|
79568
79469
|
if (ui.viewports.current.height === "auto") {
|
79569
79470
|
setZoomConfig(__spreadProps2(__spreadValues2({}, zoomConfig), {
|
@@ -79571,7 +79472,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79571
79472
|
}));
|
79572
79473
|
}
|
79573
79474
|
}, [zoomConfig.zoom]);
|
79574
|
-
(0,
|
79475
|
+
(0, import_react28.useEffect)(() => {
|
79575
79476
|
const observer = new ResizeObserver(() => {
|
79576
79477
|
setShowTransition(false);
|
79577
79478
|
resetAutoZoom();
|
@@ -79583,7 +79484,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79583
79484
|
observer.disconnect();
|
79584
79485
|
};
|
79585
79486
|
}, []);
|
79586
|
-
return /* @__PURE__ */ (0,
|
79487
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
79587
79488
|
"div",
|
79588
79489
|
{
|
79589
79490
|
className: getClassName24({
|
@@ -79595,7 +79496,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79595
79496
|
recordHistory: true
|
79596
79497
|
}),
|
79597
79498
|
children: [
|
79598
|
-
ui.viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ (0,
|
79499
|
+
ui.viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName24("controls"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
79599
79500
|
ViewportControls,
|
79600
79501
|
{
|
79601
79502
|
autoZoom: zoomConfig.autoZoom,
|
@@ -79620,7 +79521,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79620
79521
|
}
|
79621
79522
|
}
|
79622
79523
|
) }),
|
79623
|
-
/* @__PURE__ */ (0,
|
79524
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName24("inner"), ref: frameRef, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
79624
79525
|
"div",
|
79625
79526
|
{
|
79626
79527
|
className: getClassName24("root"),
|
@@ -79632,14 +79533,14 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79632
79533
|
overflow: iframe.enabled ? void 0 : "auto"
|
79633
79534
|
},
|
79634
79535
|
suppressHydrationWarning: true,
|
79635
|
-
children: /* @__PURE__ */ (0,
|
79536
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(CustomPreview, { children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Preview, {}) })
|
79636
79537
|
}
|
79637
79538
|
) })
|
79638
79539
|
]
|
79639
79540
|
}
|
79640
79541
|
);
|
79641
79542
|
};
|
79642
|
-
var
|
79543
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
79643
79544
|
var getClassName25 = get_class_name_factory_default2("Puck", styles_module_default8);
|
79644
79545
|
function Puck({
|
79645
79546
|
children,
|
@@ -79662,10 +79563,10 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79662
79563
|
}) {
|
79663
79564
|
var _a3;
|
79664
79565
|
const historyStore = useHistoryStore();
|
79665
|
-
const [reducer2] = (0,
|
79566
|
+
const [reducer2] = (0, import_react29.useState)(
|
79666
79567
|
() => createReducer({ config, record: historyStore.record })
|
79667
79568
|
);
|
79668
|
-
const [initialAppState] = (0,
|
79569
|
+
const [initialAppState] = (0, import_react29.useState)(() => {
|
79669
79570
|
var _a22, _b, _c, _d, _e;
|
79670
79571
|
const initial = __spreadValues2(__spreadValues2({}, defaultAppState2.ui), initialUi);
|
79671
79572
|
let clientUiState = {};
|
@@ -79717,7 +79618,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79717
79618
|
})
|
79718
79619
|
});
|
79719
79620
|
});
|
79720
|
-
const [appState, dispatch] = (0,
|
79621
|
+
const [appState, dispatch] = (0, import_react29.useReducer)(
|
79721
79622
|
reducer2,
|
79722
79623
|
flushZones(initialAppState)
|
79723
79624
|
);
|
@@ -79728,9 +79629,9 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79728
79629
|
config,
|
79729
79630
|
dispatch
|
79730
79631
|
);
|
79731
|
-
const [menuOpen, setMenuOpen] = (0,
|
79632
|
+
const [menuOpen, setMenuOpen] = (0, import_react29.useState)(false);
|
79732
79633
|
const { itemSelector, leftSideBarVisible, rightSideBarVisible } = ui;
|
79733
|
-
const setItemSelector = (0,
|
79634
|
+
const setItemSelector = (0, import_react29.useCallback)(
|
79734
79635
|
(newItemSelector) => {
|
79735
79636
|
if (newItemSelector === itemSelector)
|
79736
79637
|
return;
|
@@ -79743,21 +79644,21 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79743
79644
|
[itemSelector]
|
79744
79645
|
);
|
79745
79646
|
const selectedItem = itemSelector ? getItem2(itemSelector, data) : null;
|
79746
|
-
(0,
|
79647
|
+
(0, import_react29.useEffect)(() => {
|
79747
79648
|
if (onChange)
|
79748
79649
|
onChange(data);
|
79749
79650
|
}, [data]);
|
79750
79651
|
const { onDragStartOrUpdate, placeholderStyle } = usePlaceholderStyle();
|
79751
|
-
const [draggedItem, setDraggedItem] = (0,
|
79652
|
+
const [draggedItem, setDraggedItem] = (0, import_react29.useState)();
|
79752
79653
|
const rootProps = data.root.props || data.root;
|
79753
|
-
(0,
|
79654
|
+
(0, import_react29.useEffect)(() => {
|
79754
79655
|
if (Object.keys(data.root).length > 0 && !data.root.props) {
|
79755
79656
|
console.error(
|
79756
79657
|
"Warning: Defining props on `root` is deprecated. Please use `root.props`. This will be a breaking change in a future release."
|
79757
79658
|
);
|
79758
79659
|
}
|
79759
79660
|
}, []);
|
79760
|
-
const toggleSidebars = (0,
|
79661
|
+
const toggleSidebars = (0, import_react29.useCallback)(
|
79761
79662
|
(sidebar) => {
|
79762
79663
|
const widerViewport = window.matchMedia("(min-width: 638px)").matches;
|
79763
79664
|
const sideBarVisible = sidebar === "left" ? leftSideBarVisible : rightSideBarVisible;
|
@@ -79771,7 +79672,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79771
79672
|
},
|
79772
79673
|
[dispatch, leftSideBarVisible, rightSideBarVisible]
|
79773
79674
|
);
|
79774
|
-
(0,
|
79675
|
+
(0, import_react29.useEffect)(() => {
|
79775
79676
|
if (!window.matchMedia("(min-width: 638px)").matches) {
|
79776
79677
|
dispatch({
|
79777
79678
|
type: "setUi",
|
@@ -79794,11 +79695,11 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79794
79695
|
window.removeEventListener("resize", handleResize);
|
79795
79696
|
};
|
79796
79697
|
}, []);
|
79797
|
-
const defaultRender = (0,
|
79798
|
-
const PuckDefault = ({ children: children2 }) => /* @__PURE__ */ (0,
|
79698
|
+
const defaultRender = (0, import_react29.useMemo)(() => {
|
79699
|
+
const PuckDefault = ({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_jsx_runtime35.Fragment, { children: children2 });
|
79799
79700
|
return PuckDefault;
|
79800
79701
|
}, []);
|
79801
|
-
const defaultHeaderRender = (0,
|
79702
|
+
const defaultHeaderRender = (0, import_react29.useMemo)(() => {
|
79802
79703
|
if (renderHeader) {
|
79803
79704
|
console.warn(
|
79804
79705
|
"`renderHeader` is deprecated. Please use `overrides.header` and the `usePuck` hook instead"
|
@@ -79806,45 +79707,45 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79806
79707
|
const RenderHeader = (_a22) => {
|
79807
79708
|
var _b = _a22, { actions } = _b, props = __objRest2(_b, ["actions"]);
|
79808
79709
|
const Comp = renderHeader;
|
79809
|
-
return /* @__PURE__ */ (0,
|
79710
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Comp, __spreadProps2(__spreadValues2({}, props), { dispatch, state: appState, children: actions }));
|
79810
79711
|
};
|
79811
79712
|
return RenderHeader;
|
79812
79713
|
}
|
79813
79714
|
return defaultRender;
|
79814
79715
|
}, [renderHeader]);
|
79815
|
-
const defaultHeaderActionsRender = (0,
|
79716
|
+
const defaultHeaderActionsRender = (0, import_react29.useMemo)(() => {
|
79816
79717
|
if (renderHeaderActions) {
|
79817
79718
|
console.warn(
|
79818
79719
|
"`renderHeaderActions` is deprecated. Please use `overrides.headerActions` and the `usePuck` hook instead."
|
79819
79720
|
);
|
79820
79721
|
const RenderHeader = (props) => {
|
79821
79722
|
const Comp = renderHeaderActions;
|
79822
|
-
return /* @__PURE__ */ (0,
|
79723
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Comp, __spreadProps2(__spreadValues2({}, props), { dispatch, state: appState }));
|
79823
79724
|
};
|
79824
79725
|
return RenderHeader;
|
79825
79726
|
}
|
79826
79727
|
return defaultRender;
|
79827
79728
|
}, [renderHeader]);
|
79828
|
-
const loadedOverrides = (0,
|
79729
|
+
const loadedOverrides = (0, import_react29.useMemo)(() => {
|
79829
79730
|
return loadOverrides({ overrides, plugins });
|
79830
79731
|
}, [plugins]);
|
79831
|
-
const CustomPuck = (0,
|
79732
|
+
const CustomPuck = (0, import_react29.useMemo)(
|
79832
79733
|
() => loadedOverrides.puck || defaultRender,
|
79833
79734
|
[loadedOverrides]
|
79834
79735
|
);
|
79835
|
-
const CustomHeader = (0,
|
79736
|
+
const CustomHeader = (0, import_react29.useMemo)(
|
79836
79737
|
() => loadedOverrides.header || defaultHeaderRender,
|
79837
79738
|
[loadedOverrides]
|
79838
79739
|
);
|
79839
|
-
const CustomHeaderActions = (0,
|
79740
|
+
const CustomHeaderActions = (0, import_react29.useMemo)(
|
79840
79741
|
() => loadedOverrides.headerActions || defaultHeaderActionsRender,
|
79841
79742
|
[loadedOverrides]
|
79842
79743
|
);
|
79843
|
-
const [mounted, setMounted] = (0,
|
79844
|
-
(0,
|
79744
|
+
const [mounted, setMounted] = (0, import_react29.useState)(false);
|
79745
|
+
(0, import_react29.useEffect)(() => {
|
79845
79746
|
setMounted(true);
|
79846
79747
|
}, []);
|
79847
|
-
return /* @__PURE__ */ (0,
|
79748
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "Puck", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
79848
79749
|
AppProvider,
|
79849
79750
|
{
|
79850
79751
|
value: {
|
@@ -79859,7 +79760,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79859
79760
|
viewports,
|
79860
79761
|
iframe
|
79861
79762
|
},
|
79862
|
-
children: /* @__PURE__ */ (0,
|
79763
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
79863
79764
|
DragDropContext2,
|
79864
79765
|
{
|
79865
79766
|
autoScrollerOptions: { disabled: dnd == null ? void 0 : dnd.disableAutoScroll },
|
@@ -79915,7 +79816,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79915
79816
|
});
|
79916
79817
|
}
|
79917
79818
|
},
|
79918
|
-
children: /* @__PURE__ */ (0,
|
79819
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
79919
79820
|
DropZoneProvider,
|
79920
79821
|
{
|
79921
79822
|
value: {
|
@@ -79929,7 +79830,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79929
79830
|
mode: "edit",
|
79930
79831
|
areaId: "root"
|
79931
79832
|
},
|
79932
|
-
children: /* @__PURE__ */ (0,
|
79833
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(CustomPuck, { children: children || /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
79933
79834
|
"div",
|
79934
79835
|
{
|
79935
79836
|
className: getClassName25({
|
@@ -79939,65 +79840,62 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
79939
79840
|
rightSideBarVisible
|
79940
79841
|
}),
|
79941
79842
|
children: [
|
79942
|
-
/* @__PURE__ */ (0,
|
79943
|
-
/* @__PURE__ */ (0,
|
79843
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: getClassName25("layout"), children: [
|
79844
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
79944
79845
|
CustomHeader,
|
79945
79846
|
{
|
79946
|
-
actions: /* @__PURE__ */ (0,
|
79947
|
-
|
79948
|
-
|
79949
|
-
|
79950
|
-
|
79951
|
-
|
79952
|
-
|
79953
|
-
|
79954
|
-
|
79955
|
-
|
79956
|
-
|
79957
|
-
)
|
79958
|
-
|
79959
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("header", { className: getClassName25("header"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName25("headerInner"), children: [
|
79960
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName25("headerToggle"), children: [
|
79961
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("leftSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
79847
|
+
actions: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_jsx_runtime35.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(CustomHeaderActions, { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
79848
|
+
Button,
|
79849
|
+
{
|
79850
|
+
onClick: () => {
|
79851
|
+
onPublish && onPublish(data);
|
79852
|
+
},
|
79853
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Globe, { size: "14px" }),
|
79854
|
+
children: "Publish"
|
79855
|
+
}
|
79856
|
+
) }) }),
|
79857
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("header", { className: getClassName25("header"), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: getClassName25("headerInner"), children: [
|
79858
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: getClassName25("headerToggle"), children: [
|
79859
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: getClassName25("leftSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
79962
79860
|
IconButton,
|
79963
79861
|
{
|
79964
79862
|
onClick: () => {
|
79965
79863
|
toggleSidebars("left");
|
79966
79864
|
},
|
79967
79865
|
title: "Toggle left sidebar",
|
79968
|
-
children: /* @__PURE__ */ (0,
|
79866
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(PanelLeft, { focusable: "false" })
|
79969
79867
|
}
|
79970
79868
|
) }),
|
79971
|
-
/* @__PURE__ */ (0,
|
79869
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: getClassName25("rightSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
79972
79870
|
IconButton,
|
79973
79871
|
{
|
79974
79872
|
onClick: () => {
|
79975
79873
|
toggleSidebars("right");
|
79976
79874
|
},
|
79977
79875
|
title: "Toggle right sidebar",
|
79978
|
-
children: /* @__PURE__ */ (0,
|
79876
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(PanelRight, { focusable: "false" })
|
79979
79877
|
}
|
79980
79878
|
) })
|
79981
79879
|
] }),
|
79982
|
-
/* @__PURE__ */ (0,
|
79880
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: getClassName25("headerTitle"), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Heading2, { rank: 2, size: "xs", children: [
|
79983
79881
|
headerTitle || rootProps.title || "Page",
|
79984
|
-
headerPath && /* @__PURE__ */ (0,
|
79882
|
+
headerPath && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
|
79985
79883
|
" ",
|
79986
|
-
/* @__PURE__ */ (0,
|
79884
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("code", { className: getClassName25("headerPath"), children: headerPath })
|
79987
79885
|
] })
|
79988
79886
|
] }) }),
|
79989
|
-
/* @__PURE__ */ (0,
|
79990
|
-
/* @__PURE__ */ (0,
|
79887
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: getClassName25("headerTools"), children: [
|
79888
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: getClassName25("menuButton"), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
79991
79889
|
IconButton,
|
79992
79890
|
{
|
79993
79891
|
onClick: () => {
|
79994
79892
|
return setMenuOpen(!menuOpen);
|
79995
79893
|
},
|
79996
79894
|
title: "Toggle menu bar",
|
79997
|
-
children: menuOpen ? /* @__PURE__ */ (0,
|
79895
|
+
children: menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ChevronDown, { focusable: "false" })
|
79998
79896
|
}
|
79999
79897
|
) }),
|
80000
|
-
/* @__PURE__ */ (0,
|
79898
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
80001
79899
|
MenuBar,
|
80002
79900
|
{
|
80003
79901
|
appState,
|
@@ -80005,7 +79903,16 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
80005
79903
|
dispatch,
|
80006
79904
|
onPublish,
|
80007
79905
|
menuOpen,
|
80008
|
-
renderHeaderActions: () => /* @__PURE__ */ (0,
|
79906
|
+
renderHeaderActions: () => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(CustomHeaderActions, { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
79907
|
+
Button,
|
79908
|
+
{
|
79909
|
+
onClick: () => {
|
79910
|
+
onPublish && onPublish(data);
|
79911
|
+
},
|
79912
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Globe, { size: "14px" }),
|
79913
|
+
children: "Publish"
|
79914
|
+
}
|
79915
|
+
) }),
|
80009
79916
|
setMenuOpen
|
80010
79917
|
}
|
80011
79918
|
)
|
@@ -80013,23 +79920,23 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
80013
79920
|
] }) })
|
80014
79921
|
}
|
80015
79922
|
),
|
80016
|
-
/* @__PURE__ */ (0,
|
80017
|
-
/* @__PURE__ */ (0,
|
80018
|
-
/* @__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, {}) })
|
80019
79926
|
] }),
|
80020
|
-
/* @__PURE__ */ (0,
|
80021
|
-
/* @__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)(
|
80022
79929
|
SidebarSection2,
|
80023
79930
|
{
|
80024
79931
|
noPadding: true,
|
80025
79932
|
noBorderTop: true,
|
80026
79933
|
showBreadcrumbs: true,
|
80027
79934
|
title: selectedItem ? (_a3 = config.components[selectedItem.type]["label"]) != null ? _a3 : selectedItem.type : "Page",
|
80028
|
-
children: /* @__PURE__ */ (0,
|
79935
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Fields, {})
|
80029
79936
|
}
|
80030
79937
|
) })
|
80031
79938
|
] }),
|
80032
|
-
/* @__PURE__ */ (0,
|
79939
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
80033
79940
|
"div",
|
80034
79941
|
{
|
80035
79942
|
id: "puck-portal-root",
|
@@ -80051,7 +79958,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
80051
79958
|
Puck.Outline = Outline;
|
80052
79959
|
Puck.Preview = Preview;
|
80053
79960
|
init_react_import2();
|
80054
|
-
var
|
79961
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
80055
79962
|
function Render({
|
80056
79963
|
config,
|
80057
79964
|
data
|
@@ -80060,7 +79967,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
80060
79967
|
const rootProps = data.root.props || data.root;
|
80061
79968
|
const title = (rootProps == null ? void 0 : rootProps.title) || "";
|
80062
79969
|
if ((_a3 = config.root) == null ? void 0 : _a3.render) {
|
80063
|
-
return /* @__PURE__ */ (0,
|
79970
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
80064
79971
|
config.root.render,
|
80065
79972
|
__spreadProps2(__spreadValues2({}, rootProps), {
|
80066
79973
|
puck: {
|
@@ -80069,11 +79976,11 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
80069
79976
|
title,
|
80070
79977
|
editMode: false,
|
80071
79978
|
id: "puck-root",
|
80072
|
-
children: /* @__PURE__ */ (0,
|
79979
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(DropZone, { zone: rootDroppableId2 })
|
80073
79980
|
})
|
80074
79981
|
) });
|
80075
79982
|
}
|
80076
|
-
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 }) });
|
80077
79984
|
}
|
80078
79985
|
init_react_import2();
|
80079
79986
|
var migrations = [
|
@@ -80238,7 +80145,7 @@ init_react_import();
|
|
80238
80145
|
// src/HeadingAnalyzer.tsx
|
80239
80146
|
init_react_import();
|
80240
80147
|
var import_react12 = require("react");
|
80241
|
-
var import_puck = __toESM(
|
80148
|
+
var import_puck = __toESM(require_dist());
|
80242
80149
|
|
80243
80150
|
// ../core/components/SidebarSection/index.tsx
|
80244
80151
|
init_react_import();
|