@measured/puck 0.14.2-canary.e6e01c6 → 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/README.md +1 -1
- package/dist/index.css +0 -3
- package/dist/index.d.ts +4 -1
- package/dist/index.js +382 -151
- package/package.json +6 -3
package/README.md
CHANGED
@@ -108,7 +108,7 @@ Available recipes include:
|
|
108
108
|
|
109
109
|
Puck is developed and maintained by **Measured**, a small group of industry veterans with decades of experience helping companies solve hard UI problems. We offer consultancy and development services for scale-ups, SMEs and enterprises.
|
110
110
|
|
111
|
-
If you need support integrating Puck or creating a beautiful component library, please reach out via [
|
111
|
+
If you need support integrating Puck or creating a beautiful component library, please reach out via the [Measured](https://measured.co) website.
|
112
112
|
|
113
113
|
## License
|
114
114
|
|
package/dist/index.css
CHANGED
package/dist/index.d.ts
CHANGED
@@ -229,7 +229,7 @@ type IframeConfig = {
|
|
229
229
|
enabled?: boolean;
|
230
230
|
};
|
231
231
|
|
232
|
-
declare function Puck<UserConfig extends Config = Config>({ children, config, data: initialData, ui: initialUi, onChange, onPublish, plugins, overrides, renderHeader, renderHeaderActions, headerTitle, headerPath, viewports, iframe, }: {
|
232
|
+
declare function Puck<UserConfig extends Config = Config>({ children, config, data: initialData, ui: initialUi, onChange, onPublish, plugins, overrides, renderHeader, renderHeaderActions, headerTitle, headerPath, viewports, iframe, dnd, }: {
|
233
233
|
children?: ReactNode;
|
234
234
|
config: UserConfig;
|
235
235
|
data: Data;
|
@@ -251,6 +251,9 @@ declare function Puck<UserConfig extends Config = Config>({ children, config, da
|
|
251
251
|
headerPath?: string;
|
252
252
|
viewports?: Viewports;
|
253
253
|
iframe?: IframeConfig;
|
254
|
+
dnd?: {
|
255
|
+
disableAutoScroll?: boolean;
|
256
|
+
};
|
254
257
|
}): react_jsx_runtime.JSX.Element;
|
255
258
|
declare namespace Puck {
|
256
259
|
var Components: () => react_jsx_runtime.JSX.Element;
|
package/dist/index.js
CHANGED
@@ -8033,9 +8033,9 @@ var require_react_dom_development = __commonJS({
|
|
8033
8033
|
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === "function") {
|
8034
8034
|
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
8035
8035
|
}
|
8036
|
-
var
|
8036
|
+
var React3 = require("react");
|
8037
8037
|
var Scheduler = require_scheduler();
|
8038
|
-
var ReactSharedInternals =
|
8038
|
+
var ReactSharedInternals = React3.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
8039
8039
|
var suppressWarning = false;
|
8040
8040
|
function setSuppressWarning(newSuppressWarning) {
|
8041
8041
|
{
|
@@ -8084,7 +8084,7 @@ var require_react_dom_development = __commonJS({
|
|
8084
8084
|
var HostPortal = 4;
|
8085
8085
|
var HostComponent = 5;
|
8086
8086
|
var HostText = 6;
|
8087
|
-
var
|
8087
|
+
var Fragment18 = 7;
|
8088
8088
|
var Mode = 8;
|
8089
8089
|
var ContextConsumer = 9;
|
8090
8090
|
var ContextProvider = 10;
|
@@ -9240,7 +9240,7 @@ var require_react_dom_development = __commonJS({
|
|
9240
9240
|
return "DehydratedFragment";
|
9241
9241
|
case ForwardRef:
|
9242
9242
|
return getWrappedName$1(type, type.render, "ForwardRef");
|
9243
|
-
case
|
9243
|
+
case Fragment18:
|
9244
9244
|
return "Fragment";
|
9245
9245
|
case HostComponent:
|
9246
9246
|
return type;
|
@@ -9640,7 +9640,7 @@ var require_react_dom_development = __commonJS({
|
|
9640
9640
|
{
|
9641
9641
|
if (props.value == null) {
|
9642
9642
|
if (typeof props.children === "object" && props.children !== null) {
|
9643
|
-
|
9643
|
+
React3.Children.forEach(props.children, function(child) {
|
9644
9644
|
if (child == null) {
|
9645
9645
|
return;
|
9646
9646
|
}
|
@@ -18087,7 +18087,7 @@ var require_react_dom_development = __commonJS({
|
|
18087
18087
|
}
|
18088
18088
|
}
|
18089
18089
|
var fakeInternalInstance = {};
|
18090
|
-
var emptyRefsObject = new
|
18090
|
+
var emptyRefsObject = new React3.Component().refs;
|
18091
18091
|
var didWarnAboutStateAssignmentForComponent;
|
18092
18092
|
var didWarnAboutUninitializedState;
|
18093
18093
|
var didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate;
|
@@ -18911,7 +18911,7 @@ var require_react_dom_development = __commonJS({
|
|
18911
18911
|
}
|
18912
18912
|
}
|
18913
18913
|
function updateFragment2(returnFiber, current2, fragment, lanes, key) {
|
18914
|
-
if (current2 === null || current2.tag !==
|
18914
|
+
if (current2 === null || current2.tag !== Fragment18) {
|
18915
18915
|
var created = createFiberFromFragment(fragment, returnFiber.mode, lanes, key);
|
18916
18916
|
created.return = returnFiber;
|
18917
18917
|
return created;
|
@@ -19314,7 +19314,7 @@ var require_react_dom_development = __commonJS({
|
|
19314
19314
|
if (child.key === key) {
|
19315
19315
|
var elementType = element.type;
|
19316
19316
|
if (elementType === REACT_FRAGMENT_TYPE) {
|
19317
|
-
if (child.tag ===
|
19317
|
+
if (child.tag === Fragment18) {
|
19318
19318
|
deleteRemainingChildren(returnFiber, child.sibling);
|
19319
19319
|
var existing = useFiber(child, element.props.children);
|
19320
19320
|
existing.return = returnFiber;
|
@@ -23489,7 +23489,7 @@ var require_react_dom_development = __commonJS({
|
|
23489
23489
|
var _resolvedProps2 = workInProgress2.elementType === type ? _unresolvedProps2 : resolveDefaultProps(type, _unresolvedProps2);
|
23490
23490
|
return updateForwardRef(current2, workInProgress2, type, _resolvedProps2, renderLanes2);
|
23491
23491
|
}
|
23492
|
-
case
|
23492
|
+
case Fragment18:
|
23493
23493
|
return updateFragment(current2, workInProgress2, renderLanes2);
|
23494
23494
|
case Mode:
|
23495
23495
|
return updateMode(current2, workInProgress2, renderLanes2);
|
@@ -23762,7 +23762,7 @@ var require_react_dom_development = __commonJS({
|
|
23762
23762
|
case SimpleMemoComponent:
|
23763
23763
|
case FunctionComponent:
|
23764
23764
|
case ForwardRef:
|
23765
|
-
case
|
23765
|
+
case Fragment18:
|
23766
23766
|
case Mode:
|
23767
23767
|
case Profiler:
|
23768
23768
|
case ContextConsumer:
|
@@ -28021,7 +28021,7 @@ var require_react_dom_development = __commonJS({
|
|
28021
28021
|
return fiber;
|
28022
28022
|
}
|
28023
28023
|
function createFiberFromFragment(elements, mode, lanes, key) {
|
28024
|
-
var fiber = createFiber(
|
28024
|
+
var fiber = createFiber(Fragment18, elements, key, mode);
|
28025
28025
|
fiber.lanes = lanes;
|
28026
28026
|
return fiber;
|
28027
28027
|
}
|
@@ -29311,6 +29311,7 @@ var defaultViewports = [
|
|
29311
29311
|
];
|
29312
29312
|
|
29313
29313
|
// components/Puck/context.tsx
|
29314
|
+
var import_ua_parser_js = require("ua-parser-js");
|
29314
29315
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
29315
29316
|
var defaultAppState = {
|
29316
29317
|
data: { content: [], root: { props: { title: "" } } },
|
@@ -29350,7 +29351,8 @@ var defaultContext = {
|
|
29350
29351
|
setZoomConfig: () => null,
|
29351
29352
|
status: "LOADING",
|
29352
29353
|
setStatus: () => null,
|
29353
|
-
iframe: {}
|
29354
|
+
iframe: {},
|
29355
|
+
safariFallbackMode: false
|
29354
29356
|
};
|
29355
29357
|
var appContext = (0, import_react3.createContext)(defaultContext);
|
29356
29358
|
var AppProvider = ({
|
@@ -29362,10 +29364,34 @@ var AppProvider = ({
|
|
29362
29364
|
(0, import_react3.useEffect)(() => {
|
29363
29365
|
setStatus("MOUNTED");
|
29364
29366
|
}, []);
|
29367
|
+
const [safariFallbackMode, setSafariFallbackMode] = (0, import_react3.useState)(false);
|
29368
|
+
(0, import_react3.useEffect)(() => {
|
29369
|
+
var _a, _b, _c;
|
29370
|
+
const ua = new import_ua_parser_js.UAParser(navigator.userAgent);
|
29371
|
+
const { browser } = ua.getResult();
|
29372
|
+
if (browser.name === "Safari" && (((_a = browser.version) == null ? void 0 : _a.indexOf("17.2.")) || ((_b = browser.version) == null ? void 0 : _b.indexOf("17.3.")) || ((_c = browser.version) == null ? void 0 : _c.indexOf("17.4.")))) {
|
29373
|
+
if (process.env.NODE_ENV !== "production" && value.iframe.enabled) {
|
29374
|
+
console.warn(
|
29375
|
+
`Detected Safari ${browser.version}, which contains a bug that prevents Puck DropZones from detecting a mouseover event within an iframe. This affects Safari versions 17.2, 17.3 and 17.4.
|
29376
|
+
|
29377
|
+
Running in compatibility mode, which may have some DropZone side-effects. Alternatively, consider disabling iframes: https://puckeditor.com/docs/integrating-puck/viewports#opting-out-of-iframes.
|
29378
|
+
|
29379
|
+
See https://github.com/measuredco/puck/issues/411 for more information. This message will not show in production.`
|
29380
|
+
);
|
29381
|
+
}
|
29382
|
+
setSafariFallbackMode(true);
|
29383
|
+
}
|
29384
|
+
}, []);
|
29365
29385
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
29366
29386
|
appContext.Provider,
|
29367
29387
|
{
|
29368
|
-
value: __spreadProps(__spreadValues({}, value), {
|
29388
|
+
value: __spreadProps(__spreadValues({}, value), {
|
29389
|
+
zoomConfig,
|
29390
|
+
setZoomConfig,
|
29391
|
+
status,
|
29392
|
+
setStatus,
|
29393
|
+
safariFallbackMode
|
29394
|
+
}),
|
29369
29395
|
children
|
29370
29396
|
}
|
29371
29397
|
);
|
@@ -30193,7 +30219,11 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
30193
30219
|
let isEnabled = userWillDrag;
|
30194
30220
|
if (userIsDragging) {
|
30195
30221
|
if (draggingNewComponent) {
|
30196
|
-
|
30222
|
+
if (appContext2.safariFallbackMode) {
|
30223
|
+
isEnabled = true;
|
30224
|
+
} else {
|
30225
|
+
isEnabled = hoveringOverArea;
|
30226
|
+
}
|
30197
30227
|
} else {
|
30198
30228
|
isEnabled = draggingOverArea && hoveringOverZone;
|
30199
30229
|
}
|
@@ -30498,7 +30528,7 @@ var IconButton = ({
|
|
30498
30528
|
|
30499
30529
|
// components/Puck/index.tsx
|
30500
30530
|
init_react_import();
|
30501
|
-
var
|
30531
|
+
var import_react29 = require("react");
|
30502
30532
|
|
30503
30533
|
// lib/use-placeholder-style.ts
|
30504
30534
|
init_react_import();
|
@@ -31183,7 +31213,7 @@ var useResolvedData = (appState, config, dispatch) => {
|
|
31183
31213
|
const [componentState, setComponentState] = (0, import_react13.useState)({});
|
31184
31214
|
const deferredSetStates = {};
|
31185
31215
|
const setComponentLoading = (0, import_react13.useCallback)(
|
31186
|
-
(id, loading,
|
31216
|
+
(id, loading, defer2 = 0) => {
|
31187
31217
|
if (deferredSetStates[id]) {
|
31188
31218
|
clearTimeout(deferredSetStates[id]);
|
31189
31219
|
delete deferredSetStates[id];
|
@@ -31193,7 +31223,7 @@ var useResolvedData = (appState, config, dispatch) => {
|
|
31193
31223
|
[id]: __spreadProps(__spreadValues({}, prev[id]), { loading })
|
31194
31224
|
}));
|
31195
31225
|
delete deferredSetStates[id];
|
31196
|
-
},
|
31226
|
+
}, defer2);
|
31197
31227
|
},
|
31198
31228
|
[]
|
31199
31229
|
);
|
@@ -32031,7 +32061,7 @@ var RadioField = ({
|
|
32031
32061
|
onChange(e.currentTarget.value);
|
32032
32062
|
},
|
32033
32063
|
disabled: readOnly,
|
32034
|
-
|
32064
|
+
checked: value === option.value
|
32035
32065
|
}
|
32036
32066
|
),
|
32037
32067
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName14("radioInner"), children: option.label || option.value })
|
@@ -32073,7 +32103,7 @@ var SelectField = ({
|
|
32073
32103
|
disabled: readOnly,
|
32074
32104
|
onChange: (e) => {
|
32075
32105
|
if (e.currentTarget.value === "true" || e.currentTarget.value === "false") {
|
32076
|
-
onChange(
|
32106
|
+
onChange(JSON.parse(e.currentTarget.value));
|
32077
32107
|
return;
|
32078
32108
|
}
|
32079
32109
|
onChange(e.currentTarget.value);
|
@@ -32597,19 +32627,218 @@ var Components = () => {
|
|
32597
32627
|
|
32598
32628
|
// components/Puck/components/Preview/index.tsx
|
32599
32629
|
init_react_import();
|
32600
|
-
var
|
32601
|
-
|
32630
|
+
var import_react23 = require("react");
|
32631
|
+
|
32632
|
+
// components/AutoFrame/index.tsx
|
32633
|
+
init_react_import();
|
32634
|
+
var import_react22 = __toESM(require("react"));
|
32635
|
+
var import_react_frame_component = __toESM(require("react-frame-component"));
|
32636
|
+
var import_object_hash = __toESM(require("object-hash"));
|
32637
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
32638
|
+
var styleSelector = 'style, link[rel="stylesheet"]';
|
32639
|
+
var collectStyles = (doc) => {
|
32640
|
+
const collected = [];
|
32641
|
+
doc.head.querySelectorAll(styleSelector).forEach((style) => {
|
32642
|
+
collected.push(style);
|
32643
|
+
});
|
32644
|
+
return collected;
|
32645
|
+
};
|
32646
|
+
var getStyleSheet = (el) => {
|
32647
|
+
return Array.from(document.styleSheets).find((ss) => {
|
32648
|
+
const ownerNode = ss.ownerNode;
|
32649
|
+
return ownerNode.href === el.href;
|
32650
|
+
});
|
32651
|
+
};
|
32652
|
+
var getStyles = (styleSheet) => {
|
32653
|
+
if (styleSheet) {
|
32654
|
+
try {
|
32655
|
+
return [...styleSheet.cssRules].map((rule) => rule.cssText).join("");
|
32656
|
+
} catch (e) {
|
32657
|
+
console.warn(
|
32658
|
+
"Access to stylesheet %s is denied. Ignoring\u2026",
|
32659
|
+
styleSheet.href
|
32660
|
+
);
|
32661
|
+
}
|
32662
|
+
}
|
32663
|
+
return "";
|
32664
|
+
};
|
32665
|
+
var defer = (fn) => setTimeout(fn, 0);
|
32666
|
+
var CopyHostStyles = ({
|
32667
|
+
children,
|
32668
|
+
debug = false,
|
32669
|
+
onStylesLoaded = () => null
|
32670
|
+
}) => {
|
32671
|
+
const { document: doc, window: win } = (0, import_react_frame_component.useFrame)();
|
32672
|
+
(0, import_react22.useEffect)(() => {
|
32673
|
+
if (!win || !doc) {
|
32674
|
+
return () => {
|
32675
|
+
};
|
32676
|
+
}
|
32677
|
+
let elements = [];
|
32678
|
+
const hashes = {};
|
32679
|
+
const lookupEl = (el) => elements.findIndex((elementMap) => elementMap.original === el);
|
32680
|
+
const mirrorEl = (el, inlineStyles = false) => __async(void 0, null, function* () {
|
32681
|
+
let mirror;
|
32682
|
+
if (el.nodeName === "LINK" && inlineStyles) {
|
32683
|
+
mirror = document.createElement("style");
|
32684
|
+
mirror.type = "text/css";
|
32685
|
+
let styleSheet = getStyleSheet(el);
|
32686
|
+
if (!styleSheet) {
|
32687
|
+
yield new Promise((resolve) => {
|
32688
|
+
const fn = () => {
|
32689
|
+
resolve();
|
32690
|
+
el.removeEventListener("load", fn);
|
32691
|
+
};
|
32692
|
+
el.addEventListener("load", fn);
|
32693
|
+
});
|
32694
|
+
styleSheet = getStyleSheet(el);
|
32695
|
+
}
|
32696
|
+
const styles = getStyles(styleSheet);
|
32697
|
+
if (!styles) {
|
32698
|
+
if (debug) {
|
32699
|
+
console.warn(
|
32700
|
+
`Tried to load styles for link element, but couldn't find them. Skipping...`
|
32701
|
+
);
|
32702
|
+
}
|
32703
|
+
return;
|
32704
|
+
}
|
32705
|
+
mirror.innerHTML = styles;
|
32706
|
+
mirror.setAttribute("data-href", el.getAttribute("href"));
|
32707
|
+
} else {
|
32708
|
+
mirror = el.cloneNode(true);
|
32709
|
+
}
|
32710
|
+
return mirror;
|
32711
|
+
});
|
32712
|
+
const addEl = (el) => __async(void 0, null, function* () {
|
32713
|
+
const index = lookupEl(el);
|
32714
|
+
if (index > -1) {
|
32715
|
+
if (debug)
|
32716
|
+
console.log(
|
32717
|
+
`Tried to add an element that was already mirrored. Updating instead...`
|
32718
|
+
);
|
32719
|
+
elements[index].mirror.innerText = el.innerText;
|
32720
|
+
return;
|
32721
|
+
}
|
32722
|
+
const mirror = yield mirrorEl(el);
|
32723
|
+
if (!mirror) {
|
32724
|
+
return;
|
32725
|
+
}
|
32726
|
+
const elHash = (0, import_object_hash.default)(mirror.outerHTML);
|
32727
|
+
if (hashes[elHash]) {
|
32728
|
+
if (debug)
|
32729
|
+
console.log(
|
32730
|
+
`iframe already contains element that is being mirrored. Skipping...`
|
32731
|
+
);
|
32732
|
+
return;
|
32733
|
+
}
|
32734
|
+
hashes[elHash] = true;
|
32735
|
+
doc.head.append(mirror);
|
32736
|
+
elements.push({ original: el, mirror });
|
32737
|
+
if (debug)
|
32738
|
+
console.log(`Added style node ${el.outerHTML}`);
|
32739
|
+
});
|
32740
|
+
const removeEl = (el) => {
|
32741
|
+
var _a, _b;
|
32742
|
+
const index = lookupEl(el);
|
32743
|
+
if (index === -1) {
|
32744
|
+
if (debug)
|
32745
|
+
console.log(
|
32746
|
+
`Tried to remove an element that did not exist. Skipping...`
|
32747
|
+
);
|
32748
|
+
return;
|
32749
|
+
}
|
32750
|
+
const elHash = (0, import_object_hash.default)(el.outerHTML);
|
32751
|
+
(_b = (_a = elements[index]) == null ? void 0 : _a.mirror) == null ? void 0 : _b.remove();
|
32752
|
+
delete hashes[elHash];
|
32753
|
+
if (debug)
|
32754
|
+
console.log(`Removed style node ${el.outerHTML}`);
|
32755
|
+
};
|
32756
|
+
const observer = new MutationObserver((mutations) => {
|
32757
|
+
mutations.forEach((mutation) => {
|
32758
|
+
if (mutation.type === "childList") {
|
32759
|
+
mutation.addedNodes.forEach((node) => {
|
32760
|
+
if (node.nodeType === Node.TEXT_NODE || node.nodeType === Node.ELEMENT_NODE) {
|
32761
|
+
const el = node.nodeType === Node.TEXT_NODE ? node.parentElement : node;
|
32762
|
+
if (el && el.matches(styleSelector)) {
|
32763
|
+
defer(() => addEl(el));
|
32764
|
+
}
|
32765
|
+
}
|
32766
|
+
});
|
32767
|
+
mutation.removedNodes.forEach((node) => {
|
32768
|
+
if (node.nodeType === Node.TEXT_NODE || node.nodeType === Node.ELEMENT_NODE) {
|
32769
|
+
const el = node.nodeType === Node.TEXT_NODE ? node.parentElement : node;
|
32770
|
+
if (el && el.matches(styleSelector)) {
|
32771
|
+
defer(() => removeEl(el));
|
32772
|
+
}
|
32773
|
+
}
|
32774
|
+
});
|
32775
|
+
}
|
32776
|
+
});
|
32777
|
+
});
|
32778
|
+
const parentDocument = win.parent.document;
|
32779
|
+
const collectedStyles = collectStyles(parentDocument);
|
32780
|
+
const hrefs = [];
|
32781
|
+
let stylesLoaded = 0;
|
32782
|
+
Promise.all(
|
32783
|
+
collectedStyles.map((styleNode, i) => __async(void 0, null, function* () {
|
32784
|
+
if (styleNode.nodeName === "LINK") {
|
32785
|
+
const linkHref = styleNode.href;
|
32786
|
+
if (hrefs.indexOf(linkHref) > -1) {
|
32787
|
+
return;
|
32788
|
+
}
|
32789
|
+
hrefs.push(linkHref);
|
32790
|
+
}
|
32791
|
+
const mirror = yield mirrorEl(styleNode);
|
32792
|
+
if (!mirror)
|
32793
|
+
return;
|
32794
|
+
elements.push({ original: styleNode, mirror });
|
32795
|
+
return mirror;
|
32796
|
+
}))
|
32797
|
+
).then((mirrorStyles) => {
|
32798
|
+
const filtered = mirrorStyles.filter(
|
32799
|
+
(el) => typeof el !== "undefined"
|
32800
|
+
);
|
32801
|
+
filtered.forEach((mirror) => {
|
32802
|
+
mirror.onload = () => {
|
32803
|
+
stylesLoaded = stylesLoaded + 1;
|
32804
|
+
if (stylesLoaded >= elements.length) {
|
32805
|
+
onStylesLoaded();
|
32806
|
+
}
|
32807
|
+
};
|
32808
|
+
});
|
32809
|
+
doc.head.innerHTML = "";
|
32810
|
+
doc.head.append(...filtered);
|
32811
|
+
observer.observe(parentDocument.head, { childList: true, subtree: true });
|
32812
|
+
filtered.forEach((el) => {
|
32813
|
+
const elHash = (0, import_object_hash.default)(el.outerHTML);
|
32814
|
+
hashes[elHash] = true;
|
32815
|
+
});
|
32816
|
+
});
|
32817
|
+
return () => {
|
32818
|
+
observer.disconnect();
|
32819
|
+
};
|
32820
|
+
}, []);
|
32821
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_jsx_runtime29.Fragment, { children });
|
32822
|
+
};
|
32823
|
+
var AutoFrameComponent = import_react22.default.forwardRef(
|
32824
|
+
function(_a, ref) {
|
32825
|
+
var _b = _a, { children, debug, onStylesLoaded } = _b, props = __objRest(_b, ["children", "debug", "onStylesLoaded"]);
|
32826
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_react_frame_component.default, __spreadProps(__spreadValues({}, props), { ref, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(CopyHostStyles, { debug, onStylesLoaded, children }) }));
|
32827
|
+
}
|
32828
|
+
);
|
32829
|
+
AutoFrameComponent.displayName = "AutoFrameComponent";
|
32830
|
+
var AutoFrame_default = AutoFrameComponent;
|
32602
32831
|
|
32603
32832
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Preview/styles.module.css#css-module
|
32604
32833
|
init_react_import();
|
32605
32834
|
var styles_module_default16 = { "PuckPreview": "_PuckPreview_rxwlr_1", "PuckPreview-frame": "_PuckPreview-frame_rxwlr_5" };
|
32606
32835
|
|
32607
32836
|
// components/Puck/components/Preview/index.tsx
|
32608
|
-
var
|
32837
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
32609
32838
|
var getClassName21 = get_class_name_factory_default("PuckPreview", styles_module_default16);
|
32610
32839
|
var Preview = ({ id = "puck-preview" }) => {
|
32611
32840
|
const { config, dispatch, state, setStatus, iframe } = useAppContext();
|
32612
|
-
const Page = (0,
|
32841
|
+
const Page = (0, import_react23.useCallback)(
|
32613
32842
|
(pageProps) => {
|
32614
32843
|
var _a, _b;
|
32615
32844
|
return ((_a = config.root) == null ? void 0 : _a.render) ? (_b = config.root) == null ? void 0 : _b.render(__spreadProps(__spreadValues({
|
@@ -32617,13 +32846,13 @@ var Preview = ({ id = "puck-preview" }) => {
|
|
32617
32846
|
}, pageProps), {
|
32618
32847
|
editMode: true,
|
32619
32848
|
puck: { renderDropZone: DropZone }
|
32620
|
-
})) : /* @__PURE__ */ (0,
|
32849
|
+
})) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_jsx_runtime30.Fragment, { children: pageProps.children });
|
32621
32850
|
},
|
32622
32851
|
[config.root]
|
32623
32852
|
);
|
32624
32853
|
const rootProps = state.data.root.props || state.data.root;
|
32625
|
-
const ref = (0,
|
32626
|
-
return /* @__PURE__ */ (0,
|
32854
|
+
const ref = (0, import_react23.useRef)(null);
|
32855
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
32627
32856
|
"div",
|
32628
32857
|
{
|
32629
32858
|
className: getClassName21(),
|
@@ -32631,8 +32860,8 @@ var Preview = ({ id = "puck-preview" }) => {
|
|
32631
32860
|
onClick: () => {
|
32632
32861
|
dispatch({ type: "setUi", ui: __spreadProps(__spreadValues({}, state.ui), { itemSelector: null }) });
|
32633
32862
|
},
|
32634
|
-
children: iframe.enabled ? /* @__PURE__ */ (0,
|
32635
|
-
|
32863
|
+
children: iframe.enabled ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
32864
|
+
AutoFrame_default,
|
32636
32865
|
{
|
32637
32866
|
id: "preview-frame",
|
32638
32867
|
className: getClassName21("frame"),
|
@@ -32641,9 +32870,9 @@ var Preview = ({ id = "puck-preview" }) => {
|
|
32641
32870
|
onStylesLoaded: () => {
|
32642
32871
|
setStatus("READY");
|
32643
32872
|
},
|
32644
|
-
children: /* @__PURE__ */ (0,
|
32873
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Page, __spreadProps(__spreadValues({ dispatch, state }, rootProps), { children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(DropZone, { zone: rootDroppableId }) }))
|
32645
32874
|
}
|
32646
|
-
) : /* @__PURE__ */ (0,
|
32875
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { id: "preview-frame", className: getClassName21("frame"), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Page, __spreadProps(__spreadValues({ dispatch, state }, rootProps), { children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(DropZone, { zone: rootDroppableId }) })) })
|
32647
32876
|
}
|
32648
32877
|
);
|
32649
32878
|
};
|
@@ -32691,7 +32920,7 @@ var scrollIntoView = (el) => {
|
|
32691
32920
|
};
|
32692
32921
|
|
32693
32922
|
// components/LayerTree/index.tsx
|
32694
|
-
var
|
32923
|
+
var import_react24 = require("react");
|
32695
32924
|
|
32696
32925
|
// lib/is-child-of-zone.ts
|
32697
32926
|
init_react_import();
|
@@ -32705,7 +32934,7 @@ var isChildOfZone = (item, maybeChild, ctx) => {
|
|
32705
32934
|
};
|
32706
32935
|
|
32707
32936
|
// components/LayerTree/index.tsx
|
32708
|
-
var
|
32937
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
32709
32938
|
var getClassName22 = get_class_name_factory_default("LayerTree", styles_module_default17);
|
32710
32939
|
var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default17);
|
32711
32940
|
var LayerTree = ({
|
@@ -32718,15 +32947,15 @@ var LayerTree = ({
|
|
32718
32947
|
label
|
32719
32948
|
}) => {
|
32720
32949
|
const zones = data.zones || {};
|
32721
|
-
const ctx = (0,
|
32722
|
-
return /* @__PURE__ */ (0,
|
32723
|
-
label && /* @__PURE__ */ (0,
|
32724
|
-
/* @__PURE__ */ (0,
|
32950
|
+
const ctx = (0, import_react24.useContext)(dropZoneContext);
|
32951
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
|
32952
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: getClassName22("zoneTitle"), children: [
|
32953
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: getClassName22("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Layers, { size: "16" }) }),
|
32725
32954
|
" ",
|
32726
32955
|
label
|
32727
32956
|
] }),
|
32728
|
-
/* @__PURE__ */ (0,
|
32729
|
-
zoneContent.length === 0 && /* @__PURE__ */ (0,
|
32957
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("ul", { className: getClassName22(), children: [
|
32958
|
+
zoneContent.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: getClassName22("helper"), children: "No items" }),
|
32730
32959
|
zoneContent.map((item, i) => {
|
32731
32960
|
var _a;
|
32732
32961
|
const isSelected = (itemSelector == null ? void 0 : itemSelector.index) === i && (itemSelector.zone === zone || itemSelector.zone === rootDroppableId && !zone);
|
@@ -32742,7 +32971,7 @@ var LayerTree = ({
|
|
32742
32971
|
const selectedItem = itemSelector && data ? getItem(itemSelector, data) : null;
|
32743
32972
|
const isHovering = hoveringComponent === item.props.id;
|
32744
32973
|
const childIsSelected = isChildOfZone(item, selectedItem, ctx);
|
32745
|
-
return /* @__PURE__ */ (0,
|
32974
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
32746
32975
|
"li",
|
32747
32976
|
{
|
32748
32977
|
className: getClassNameLayer({
|
@@ -32752,7 +32981,7 @@ var LayerTree = ({
|
|
32752
32981
|
childIsSelected
|
32753
32982
|
}),
|
32754
32983
|
children: [
|
32755
|
-
/* @__PURE__ */ (0,
|
32984
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
32756
32985
|
"button",
|
32757
32986
|
{
|
32758
32987
|
className: getClassNameLayer("clickable"),
|
@@ -32784,22 +33013,22 @@ var LayerTree = ({
|
|
32784
33013
|
setHoveringComponent(null);
|
32785
33014
|
},
|
32786
33015
|
children: [
|
32787
|
-
containsZone && /* @__PURE__ */ (0,
|
33016
|
+
containsZone && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
32788
33017
|
"div",
|
32789
33018
|
{
|
32790
33019
|
className: getClassNameLayer("chevron"),
|
32791
33020
|
title: isSelected ? "Collapse" : "Expand",
|
32792
|
-
children: /* @__PURE__ */ (0,
|
33021
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ChevronDown, { size: "12" })
|
32793
33022
|
}
|
32794
33023
|
),
|
32795
|
-
/* @__PURE__ */ (0,
|
32796
|
-
/* @__PURE__ */ (0,
|
32797
|
-
/* @__PURE__ */ (0,
|
33024
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: getClassNameLayer("title"), children: [
|
33025
|
+
/* @__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" }) }),
|
33026
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: getClassNameLayer("name"), children: (_a = config.components[item.type]["label"]) != null ? _a : item.type })
|
32798
33027
|
] })
|
32799
33028
|
]
|
32800
33029
|
}
|
32801
33030
|
) }),
|
32802
|
-
containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ (0,
|
33031
|
+
containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
32803
33032
|
LayerTree,
|
32804
33033
|
{
|
32805
33034
|
config,
|
@@ -32821,13 +33050,13 @@ var LayerTree = ({
|
|
32821
33050
|
};
|
32822
33051
|
|
32823
33052
|
// components/Puck/components/Outline/index.tsx
|
32824
|
-
var
|
32825
|
-
var
|
33053
|
+
var import_react25 = require("react");
|
33054
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
32826
33055
|
var Outline = () => {
|
32827
33056
|
const { dispatch, state, overrides, config } = useAppContext();
|
32828
33057
|
const { data, ui } = state;
|
32829
33058
|
const { itemSelector } = ui;
|
32830
|
-
const setItemSelector = (0,
|
33059
|
+
const setItemSelector = (0, import_react25.useCallback)(
|
32831
33060
|
(newItemSelector) => {
|
32832
33061
|
dispatch({
|
32833
33062
|
type: "setUi",
|
@@ -32836,9 +33065,9 @@ var Outline = () => {
|
|
32836
33065
|
},
|
32837
33066
|
[]
|
32838
33067
|
);
|
32839
|
-
const Wrapper = (0,
|
32840
|
-
return /* @__PURE__ */ (0,
|
32841
|
-
(ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0,
|
33068
|
+
const Wrapper = (0, import_react25.useMemo)(() => overrides.outline || "div", [overrides]);
|
33069
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Wrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(dropZoneContext.Consumer, { children: (ctx) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
33070
|
+
(ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
32842
33071
|
LayerTree,
|
32843
33072
|
{
|
32844
33073
|
config,
|
@@ -32851,7 +33080,7 @@ var Outline = () => {
|
|
32851
33080
|
),
|
32852
33081
|
Object.entries(findZonesForArea(data, "root")).map(
|
32853
33082
|
([zoneKey, zone]) => {
|
32854
|
-
return /* @__PURE__ */ (0,
|
33083
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
32855
33084
|
LayerTree,
|
32856
33085
|
{
|
32857
33086
|
config,
|
@@ -32936,12 +33165,12 @@ function usePuckHistory({
|
|
32936
33165
|
|
32937
33166
|
// lib/use-history-store.ts
|
32938
33167
|
init_react_import();
|
32939
|
-
var
|
33168
|
+
var import_react26 = require("react");
|
32940
33169
|
var import_use_debounce3 = require("use-debounce");
|
32941
33170
|
var EMPTY_HISTORY_INDEX = -1;
|
32942
33171
|
function useHistoryStore() {
|
32943
|
-
const [histories, setHistories] = (0,
|
32944
|
-
const [index, setIndex] = (0,
|
33172
|
+
const [histories, setHistories] = (0, import_react26.useState)([]);
|
33173
|
+
const [index, setIndex] = (0, import_react26.useState)(EMPTY_HISTORY_INDEX);
|
32945
33174
|
const hasPast = index > EMPTY_HISTORY_INDEX;
|
32946
33175
|
const hasFuture = index < histories.length - 1;
|
32947
33176
|
const currentHistory = histories[index];
|
@@ -33101,22 +33330,22 @@ var getBox = function getBox2(el) {
|
|
33101
33330
|
};
|
33102
33331
|
|
33103
33332
|
// components/Puck/components/Canvas/index.tsx
|
33104
|
-
var
|
33333
|
+
var import_react28 = require("react");
|
33105
33334
|
|
33106
33335
|
// components/ViewportControls/index.tsx
|
33107
33336
|
init_react_import();
|
33108
|
-
var
|
33337
|
+
var import_react27 = require("react");
|
33109
33338
|
|
33110
33339
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ViewportControls/styles.module.css#css-module
|
33111
33340
|
init_react_import();
|
33112
33341
|
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" };
|
33113
33342
|
|
33114
33343
|
// components/ViewportControls/index.tsx
|
33115
|
-
var
|
33344
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
33116
33345
|
var icons = {
|
33117
|
-
Smartphone: /* @__PURE__ */ (0,
|
33118
|
-
Tablet: /* @__PURE__ */ (0,
|
33119
|
-
Monitor: /* @__PURE__ */ (0,
|
33346
|
+
Smartphone: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Smartphone, { size: 16 }),
|
33347
|
+
Tablet: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Tablet, { size: 16 }),
|
33348
|
+
Monitor: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Monitor, { size: 16 })
|
33120
33349
|
};
|
33121
33350
|
var getClassName23 = get_class_name_factory_default("ViewportControls", styles_module_default18);
|
33122
33351
|
var getClassNameButton = get_class_name_factory_default("ViewportButton", styles_module_default18);
|
@@ -33128,11 +33357,11 @@ var ViewportButton = ({
|
|
33128
33357
|
onClick
|
33129
33358
|
}) => {
|
33130
33359
|
const { state } = useAppContext();
|
33131
|
-
const [isActive, setIsActive] = (0,
|
33132
|
-
(0,
|
33360
|
+
const [isActive, setIsActive] = (0, import_react27.useState)(false);
|
33361
|
+
(0, import_react27.useEffect)(() => {
|
33133
33362
|
setIsActive(width === state.ui.viewports.current.width);
|
33134
33363
|
}, [width, state.ui.viewports.current.width]);
|
33135
|
-
return /* @__PURE__ */ (0,
|
33364
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: getClassNameButton({ isActive }), children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
33136
33365
|
IconButton,
|
33137
33366
|
{
|
33138
33367
|
title,
|
@@ -33141,7 +33370,7 @@ var ViewportButton = ({
|
|
33141
33370
|
e.stopPropagation();
|
33142
33371
|
onClick({ width, height });
|
33143
33372
|
},
|
33144
|
-
children: /* @__PURE__ */ (0,
|
33373
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: getClassNameButton("inner"), children })
|
33145
33374
|
}
|
33146
33375
|
) });
|
33147
33376
|
};
|
@@ -33165,7 +33394,7 @@ var ViewportControls = ({
|
|
33165
33394
|
const defaultsContainAutoZoom = defaultZoomOptions.find(
|
33166
33395
|
(option) => option.value === autoZoom
|
33167
33396
|
);
|
33168
|
-
const zoomOptions = (0,
|
33397
|
+
const zoomOptions = (0, import_react27.useMemo)(
|
33169
33398
|
() => [
|
33170
33399
|
...defaultZoomOptions,
|
33171
33400
|
...defaultsContainAutoZoom ? [] : [
|
@@ -33177,8 +33406,8 @@ var ViewportControls = ({
|
|
33177
33406
|
].filter((a) => a.value <= autoZoom).sort((a, b) => a.value > b.value ? 1 : -1),
|
33178
33407
|
[autoZoom]
|
33179
33408
|
);
|
33180
|
-
return /* @__PURE__ */ (0,
|
33181
|
-
viewports.map((viewport, i) => /* @__PURE__ */ (0,
|
33409
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: getClassName23(), children: [
|
33410
|
+
viewports.map((viewport, i) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
33182
33411
|
ViewportButton,
|
33183
33412
|
{
|
33184
33413
|
height: viewport.height,
|
@@ -33189,8 +33418,8 @@ var ViewportControls = ({
|
|
33189
33418
|
},
|
33190
33419
|
i
|
33191
33420
|
)),
|
33192
|
-
/* @__PURE__ */ (0,
|
33193
|
-
/* @__PURE__ */ (0,
|
33421
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: getClassName23("divider") }),
|
33422
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
33194
33423
|
IconButton,
|
33195
33424
|
{
|
33196
33425
|
title: "Zoom viewport out",
|
@@ -33204,10 +33433,10 @@ var ViewportControls = ({
|
|
33204
33433
|
)].value
|
33205
33434
|
);
|
33206
33435
|
},
|
33207
|
-
children: /* @__PURE__ */ (0,
|
33436
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ZoomOut, { size: 16 })
|
33208
33437
|
}
|
33209
33438
|
),
|
33210
|
-
/* @__PURE__ */ (0,
|
33439
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
33211
33440
|
IconButton,
|
33212
33441
|
{
|
33213
33442
|
title: "Zoom viewport in",
|
@@ -33221,11 +33450,11 @@ var ViewportControls = ({
|
|
33221
33450
|
)].value
|
33222
33451
|
);
|
33223
33452
|
},
|
33224
|
-
children: /* @__PURE__ */ (0,
|
33453
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ZoomIn, { size: 16 })
|
33225
33454
|
}
|
33226
33455
|
),
|
33227
|
-
/* @__PURE__ */ (0,
|
33228
|
-
/* @__PURE__ */ (0,
|
33456
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: getClassName23("divider") }),
|
33457
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
33229
33458
|
"select",
|
33230
33459
|
{
|
33231
33460
|
className: getClassName23("zoomSelect"),
|
@@ -33233,7 +33462,7 @@ var ViewportControls = ({
|
|
33233
33462
|
onChange: (e) => {
|
33234
33463
|
onZoom(parseFloat(e.currentTarget.value));
|
33235
33464
|
},
|
33236
|
-
children: zoomOptions.map((option) => /* @__PURE__ */ (0,
|
33465
|
+
children: zoomOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
33237
33466
|
"option",
|
33238
33467
|
{
|
33239
33468
|
value: option.value,
|
@@ -33281,24 +33510,24 @@ var getZoomConfig = (uiViewport, frame, zoom) => {
|
|
33281
33510
|
};
|
33282
33511
|
|
33283
33512
|
// components/Puck/components/Canvas/index.tsx
|
33284
|
-
var
|
33513
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
33285
33514
|
var getClassName24 = get_class_name_factory_default("PuckCanvas", styles_module_default19);
|
33286
33515
|
var ZOOM_ON_CHANGE = true;
|
33287
33516
|
var Canvas = () => {
|
33288
33517
|
const { status, iframe } = useAppContext();
|
33289
33518
|
const { dispatch, state, overrides, setUi, zoomConfig, setZoomConfig } = useAppContext();
|
33290
33519
|
const { ui } = state;
|
33291
|
-
const frameRef = (0,
|
33292
|
-
const [showTransition, setShowTransition] = (0,
|
33293
|
-
const defaultRender = (0,
|
33294
|
-
const PuckDefault = ({ children }) => /* @__PURE__ */ (0,
|
33520
|
+
const frameRef = (0, import_react28.useRef)(null);
|
33521
|
+
const [showTransition, setShowTransition] = (0, import_react28.useState)(false);
|
33522
|
+
const defaultRender = (0, import_react28.useMemo)(() => {
|
33523
|
+
const PuckDefault = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_jsx_runtime34.Fragment, { children });
|
33295
33524
|
return PuckDefault;
|
33296
33525
|
}, []);
|
33297
|
-
const CustomPreview = (0,
|
33526
|
+
const CustomPreview = (0, import_react28.useMemo)(
|
33298
33527
|
() => overrides.preview || defaultRender,
|
33299
33528
|
[overrides]
|
33300
33529
|
);
|
33301
|
-
const getFrameDimensions = (0,
|
33530
|
+
const getFrameDimensions = (0, import_react28.useCallback)(() => {
|
33302
33531
|
if (frameRef.current) {
|
33303
33532
|
const frame = frameRef.current;
|
33304
33533
|
const box = getBox(frame);
|
@@ -33306,7 +33535,7 @@ var Canvas = () => {
|
|
33306
33535
|
}
|
33307
33536
|
return { width: 0, height: 0 };
|
33308
33537
|
}, [frameRef]);
|
33309
|
-
const resetAutoZoom = (0,
|
33538
|
+
const resetAutoZoom = (0, import_react28.useCallback)(
|
33310
33539
|
(ui2 = state.ui) => {
|
33311
33540
|
if (frameRef.current) {
|
33312
33541
|
setZoomConfig(
|
@@ -33316,11 +33545,11 @@ var Canvas = () => {
|
|
33316
33545
|
},
|
33317
33546
|
[frameRef, zoomConfig, state.ui]
|
33318
33547
|
);
|
33319
|
-
(0,
|
33548
|
+
(0, import_react28.useEffect)(() => {
|
33320
33549
|
setShowTransition(false);
|
33321
33550
|
resetAutoZoom();
|
33322
33551
|
}, [frameRef, ui.leftSideBarVisible, ui.rightSideBarVisible]);
|
33323
|
-
(0,
|
33552
|
+
(0, import_react28.useEffect)(() => {
|
33324
33553
|
const { height: frameHeight } = getFrameDimensions();
|
33325
33554
|
if (ui.viewports.current.height === "auto") {
|
33326
33555
|
setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), {
|
@@ -33328,7 +33557,7 @@ var Canvas = () => {
|
|
33328
33557
|
}));
|
33329
33558
|
}
|
33330
33559
|
}, [zoomConfig.zoom]);
|
33331
|
-
(0,
|
33560
|
+
(0, import_react28.useEffect)(() => {
|
33332
33561
|
const observer = new ResizeObserver(() => {
|
33333
33562
|
setShowTransition(false);
|
33334
33563
|
resetAutoZoom();
|
@@ -33340,7 +33569,7 @@ var Canvas = () => {
|
|
33340
33569
|
observer.disconnect();
|
33341
33570
|
};
|
33342
33571
|
}, []);
|
33343
|
-
return /* @__PURE__ */ (0,
|
33572
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
33344
33573
|
"div",
|
33345
33574
|
{
|
33346
33575
|
className: getClassName24({
|
@@ -33352,7 +33581,7 @@ var Canvas = () => {
|
|
33352
33581
|
recordHistory: true
|
33353
33582
|
}),
|
33354
33583
|
children: [
|
33355
|
-
ui.viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ (0,
|
33584
|
+
ui.viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName24("controls"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
33356
33585
|
ViewportControls,
|
33357
33586
|
{
|
33358
33587
|
autoZoom: zoomConfig.autoZoom,
|
@@ -33377,7 +33606,7 @@ var Canvas = () => {
|
|
33377
33606
|
}
|
33378
33607
|
}
|
33379
33608
|
) }),
|
33380
|
-
/* @__PURE__ */ (0,
|
33609
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName24("inner"), ref: frameRef, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
33381
33610
|
"div",
|
33382
33611
|
{
|
33383
33612
|
className: getClassName24("root"),
|
@@ -33389,7 +33618,7 @@ var Canvas = () => {
|
|
33389
33618
|
overflow: iframe.enabled ? void 0 : "auto"
|
33390
33619
|
},
|
33391
33620
|
suppressHydrationWarning: true,
|
33392
|
-
children: /* @__PURE__ */ (0,
|
33621
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(CustomPreview, { children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Preview, {}) })
|
33393
33622
|
}
|
33394
33623
|
) })
|
33395
33624
|
]
|
@@ -33398,7 +33627,7 @@ var Canvas = () => {
|
|
33398
33627
|
};
|
33399
33628
|
|
33400
33629
|
// components/Puck/index.tsx
|
33401
|
-
var
|
33630
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
33402
33631
|
var getClassName25 = get_class_name_factory_default("Puck", styles_module_default8);
|
33403
33632
|
function Puck({
|
33404
33633
|
children,
|
@@ -33416,14 +33645,15 @@ function Puck({
|
|
33416
33645
|
viewports = defaultViewports,
|
33417
33646
|
iframe = {
|
33418
33647
|
enabled: true
|
33419
|
-
}
|
33648
|
+
},
|
33649
|
+
dnd
|
33420
33650
|
}) {
|
33421
33651
|
var _a;
|
33422
33652
|
const historyStore = useHistoryStore();
|
33423
|
-
const [reducer] = (0,
|
33653
|
+
const [reducer] = (0, import_react29.useState)(
|
33424
33654
|
() => createReducer({ config, record: historyStore.record })
|
33425
33655
|
);
|
33426
|
-
const [initialAppState] = (0,
|
33656
|
+
const [initialAppState] = (0, import_react29.useState)(() => {
|
33427
33657
|
var _a2, _b, _c, _d;
|
33428
33658
|
const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
|
33429
33659
|
let clientUiState = {};
|
@@ -33471,7 +33701,7 @@ function Puck({
|
|
33471
33701
|
})
|
33472
33702
|
});
|
33473
33703
|
});
|
33474
|
-
const [appState, dispatch] = (0,
|
33704
|
+
const [appState, dispatch] = (0, import_react29.useReducer)(
|
33475
33705
|
reducer,
|
33476
33706
|
flushZones(initialAppState)
|
33477
33707
|
);
|
@@ -33482,9 +33712,9 @@ function Puck({
|
|
33482
33712
|
config,
|
33483
33713
|
dispatch
|
33484
33714
|
);
|
33485
|
-
const [menuOpen, setMenuOpen] = (0,
|
33715
|
+
const [menuOpen, setMenuOpen] = (0, import_react29.useState)(false);
|
33486
33716
|
const { itemSelector, leftSideBarVisible, rightSideBarVisible } = ui;
|
33487
|
-
const setItemSelector = (0,
|
33717
|
+
const setItemSelector = (0, import_react29.useCallback)(
|
33488
33718
|
(newItemSelector) => {
|
33489
33719
|
if (newItemSelector === itemSelector)
|
33490
33720
|
return;
|
@@ -33497,21 +33727,21 @@ function Puck({
|
|
33497
33727
|
[itemSelector]
|
33498
33728
|
);
|
33499
33729
|
const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
|
33500
|
-
(0,
|
33730
|
+
(0, import_react29.useEffect)(() => {
|
33501
33731
|
if (onChange)
|
33502
33732
|
onChange(data);
|
33503
33733
|
}, [data]);
|
33504
33734
|
const { onDragStartOrUpdate, placeholderStyle } = usePlaceholderStyle();
|
33505
|
-
const [draggedItem, setDraggedItem] = (0,
|
33735
|
+
const [draggedItem, setDraggedItem] = (0, import_react29.useState)();
|
33506
33736
|
const rootProps = data.root.props || data.root;
|
33507
|
-
(0,
|
33737
|
+
(0, import_react29.useEffect)(() => {
|
33508
33738
|
if (Object.keys(data.root).length > 0 && !data.root.props) {
|
33509
33739
|
console.error(
|
33510
33740
|
"Warning: Defining props on `root` is deprecated. Please use `root.props`. This will be a breaking change in a future release."
|
33511
33741
|
);
|
33512
33742
|
}
|
33513
33743
|
}, []);
|
33514
|
-
const toggleSidebars = (0,
|
33744
|
+
const toggleSidebars = (0, import_react29.useCallback)(
|
33515
33745
|
(sidebar) => {
|
33516
33746
|
const widerViewport = window.matchMedia("(min-width: 638px)").matches;
|
33517
33747
|
const sideBarVisible = sidebar === "left" ? leftSideBarVisible : rightSideBarVisible;
|
@@ -33525,7 +33755,7 @@ function Puck({
|
|
33525
33755
|
},
|
33526
33756
|
[dispatch, leftSideBarVisible, rightSideBarVisible]
|
33527
33757
|
);
|
33528
|
-
(0,
|
33758
|
+
(0, import_react29.useEffect)(() => {
|
33529
33759
|
if (!window.matchMedia("(min-width: 638px)").matches) {
|
33530
33760
|
dispatch({
|
33531
33761
|
type: "setUi",
|
@@ -33548,11 +33778,11 @@ function Puck({
|
|
33548
33778
|
window.removeEventListener("resize", handleResize);
|
33549
33779
|
};
|
33550
33780
|
}, []);
|
33551
|
-
const defaultRender = (0,
|
33552
|
-
const PuckDefault = ({ children: children2 }) => /* @__PURE__ */ (0,
|
33781
|
+
const defaultRender = (0, import_react29.useMemo)(() => {
|
33782
|
+
const PuckDefault = ({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_jsx_runtime35.Fragment, { children: children2 });
|
33553
33783
|
return PuckDefault;
|
33554
33784
|
}, []);
|
33555
|
-
const defaultHeaderRender = (0,
|
33785
|
+
const defaultHeaderRender = (0, import_react29.useMemo)(() => {
|
33556
33786
|
if (renderHeader) {
|
33557
33787
|
console.warn(
|
33558
33788
|
"`renderHeader` is deprecated. Please use `overrides.header` and the `usePuck` hook instead"
|
@@ -33560,45 +33790,45 @@ function Puck({
|
|
33560
33790
|
const RenderHeader = (_a2) => {
|
33561
33791
|
var _b = _a2, { actions } = _b, props = __objRest(_b, ["actions"]);
|
33562
33792
|
const Comp = renderHeader;
|
33563
|
-
return /* @__PURE__ */ (0,
|
33793
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
|
33564
33794
|
};
|
33565
33795
|
return RenderHeader;
|
33566
33796
|
}
|
33567
33797
|
return defaultRender;
|
33568
33798
|
}, [renderHeader]);
|
33569
|
-
const defaultHeaderActionsRender = (0,
|
33799
|
+
const defaultHeaderActionsRender = (0, import_react29.useMemo)(() => {
|
33570
33800
|
if (renderHeaderActions) {
|
33571
33801
|
console.warn(
|
33572
33802
|
"`renderHeaderActions` is deprecated. Please use `overrides.headerActions` and the `usePuck` hook instead."
|
33573
33803
|
);
|
33574
33804
|
const RenderHeader = (props) => {
|
33575
33805
|
const Comp = renderHeaderActions;
|
33576
|
-
return /* @__PURE__ */ (0,
|
33806
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
|
33577
33807
|
};
|
33578
33808
|
return RenderHeader;
|
33579
33809
|
}
|
33580
33810
|
return defaultRender;
|
33581
33811
|
}, [renderHeader]);
|
33582
|
-
const loadedOverrides = (0,
|
33812
|
+
const loadedOverrides = (0, import_react29.useMemo)(() => {
|
33583
33813
|
return loadOverrides({ overrides, plugins });
|
33584
33814
|
}, [plugins]);
|
33585
|
-
const CustomPuck = (0,
|
33815
|
+
const CustomPuck = (0, import_react29.useMemo)(
|
33586
33816
|
() => loadedOverrides.puck || defaultRender,
|
33587
33817
|
[loadedOverrides]
|
33588
33818
|
);
|
33589
|
-
const CustomHeader = (0,
|
33819
|
+
const CustomHeader = (0, import_react29.useMemo)(
|
33590
33820
|
() => loadedOverrides.header || defaultHeaderRender,
|
33591
33821
|
[loadedOverrides]
|
33592
33822
|
);
|
33593
|
-
const CustomHeaderActions = (0,
|
33823
|
+
const CustomHeaderActions = (0, import_react29.useMemo)(
|
33594
33824
|
() => loadedOverrides.headerActions || defaultHeaderActionsRender,
|
33595
33825
|
[loadedOverrides]
|
33596
33826
|
);
|
33597
|
-
const [mounted, setMounted] = (0,
|
33598
|
-
(0,
|
33827
|
+
const [mounted, setMounted] = (0, import_react29.useState)(false);
|
33828
|
+
(0, import_react29.useEffect)(() => {
|
33599
33829
|
setMounted(true);
|
33600
33830
|
}, []);
|
33601
|
-
return /* @__PURE__ */ (0,
|
33831
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "Puck", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
33602
33832
|
AppProvider,
|
33603
33833
|
{
|
33604
33834
|
value: {
|
@@ -33613,9 +33843,10 @@ function Puck({
|
|
33613
33843
|
viewports,
|
33614
33844
|
iframe
|
33615
33845
|
},
|
33616
|
-
children: /* @__PURE__ */ (0,
|
33846
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
33617
33847
|
DragDropContext,
|
33618
33848
|
{
|
33849
|
+
autoScrollerOptions: { disabled: dnd == null ? void 0 : dnd.disableAutoScroll },
|
33619
33850
|
onDragUpdate: (update) => {
|
33620
33851
|
setDraggedItem(__spreadValues(__spreadValues({}, draggedItem), update));
|
33621
33852
|
onDragStartOrUpdate(update);
|
@@ -33668,7 +33899,7 @@ function Puck({
|
|
33668
33899
|
});
|
33669
33900
|
}
|
33670
33901
|
},
|
33671
|
-
children: /* @__PURE__ */ (0,
|
33902
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
33672
33903
|
DropZoneProvider,
|
33673
33904
|
{
|
33674
33905
|
value: {
|
@@ -33682,7 +33913,7 @@ function Puck({
|
|
33682
33913
|
mode: "edit",
|
33683
33914
|
areaId: "root"
|
33684
33915
|
},
|
33685
|
-
children: /* @__PURE__ */ (0,
|
33916
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(CustomPuck, { children: children || /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
33686
33917
|
"div",
|
33687
33918
|
{
|
33688
33919
|
className: getClassName25({
|
@@ -33692,65 +33923,65 @@ function Puck({
|
|
33692
33923
|
rightSideBarVisible
|
33693
33924
|
}),
|
33694
33925
|
children: [
|
33695
|
-
/* @__PURE__ */ (0,
|
33696
|
-
/* @__PURE__ */ (0,
|
33926
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: getClassName25("layout"), children: [
|
33927
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
33697
33928
|
CustomHeader,
|
33698
33929
|
{
|
33699
|
-
actions: /* @__PURE__ */ (0,
|
33700
|
-
/* @__PURE__ */ (0,
|
33701
|
-
/* @__PURE__ */ (0,
|
33930
|
+
actions: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
|
33931
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(CustomHeaderActions, {}),
|
33932
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
33702
33933
|
Button,
|
33703
33934
|
{
|
33704
33935
|
onClick: () => {
|
33705
33936
|
onPublish && onPublish(data);
|
33706
33937
|
},
|
33707
|
-
icon: /* @__PURE__ */ (0,
|
33938
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Globe, { size: "14px" }),
|
33708
33939
|
children: "Publish"
|
33709
33940
|
}
|
33710
33941
|
)
|
33711
33942
|
] }),
|
33712
|
-
children: /* @__PURE__ */ (0,
|
33713
|
-
/* @__PURE__ */ (0,
|
33714
|
-
/* @__PURE__ */ (0,
|
33943
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("header", { className: getClassName25("header"), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: getClassName25("headerInner"), children: [
|
33944
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: getClassName25("headerToggle"), children: [
|
33945
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: getClassName25("leftSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
33715
33946
|
IconButton,
|
33716
33947
|
{
|
33717
33948
|
onClick: () => {
|
33718
33949
|
toggleSidebars("left");
|
33719
33950
|
},
|
33720
33951
|
title: "Toggle left sidebar",
|
33721
|
-
children: /* @__PURE__ */ (0,
|
33952
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(PanelLeft, { focusable: "false" })
|
33722
33953
|
}
|
33723
33954
|
) }),
|
33724
|
-
/* @__PURE__ */ (0,
|
33955
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: getClassName25("rightSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
33725
33956
|
IconButton,
|
33726
33957
|
{
|
33727
33958
|
onClick: () => {
|
33728
33959
|
toggleSidebars("right");
|
33729
33960
|
},
|
33730
33961
|
title: "Toggle right sidebar",
|
33731
|
-
children: /* @__PURE__ */ (0,
|
33962
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(PanelRight, { focusable: "false" })
|
33732
33963
|
}
|
33733
33964
|
) })
|
33734
33965
|
] }),
|
33735
|
-
/* @__PURE__ */ (0,
|
33966
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: getClassName25("headerTitle"), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Heading, { rank: 2, size: "xs", children: [
|
33736
33967
|
headerTitle || rootProps.title || "Page",
|
33737
|
-
headerPath && /* @__PURE__ */ (0,
|
33968
|
+
headerPath && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
|
33738
33969
|
" ",
|
33739
|
-
/* @__PURE__ */ (0,
|
33970
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("code", { className: getClassName25("headerPath"), children: headerPath })
|
33740
33971
|
] })
|
33741
33972
|
] }) }),
|
33742
|
-
/* @__PURE__ */ (0,
|
33743
|
-
/* @__PURE__ */ (0,
|
33973
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: getClassName25("headerTools"), children: [
|
33974
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: getClassName25("menuButton"), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
33744
33975
|
IconButton,
|
33745
33976
|
{
|
33746
33977
|
onClick: () => {
|
33747
33978
|
return setMenuOpen(!menuOpen);
|
33748
33979
|
},
|
33749
33980
|
title: "Toggle menu bar",
|
33750
|
-
children: menuOpen ? /* @__PURE__ */ (0,
|
33981
|
+
children: menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ChevronDown, { focusable: "false" })
|
33751
33982
|
}
|
33752
33983
|
) }),
|
33753
|
-
/* @__PURE__ */ (0,
|
33984
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
33754
33985
|
MenuBar,
|
33755
33986
|
{
|
33756
33987
|
appState,
|
@@ -33758,7 +33989,7 @@ function Puck({
|
|
33758
33989
|
dispatch,
|
33759
33990
|
onPublish,
|
33760
33991
|
menuOpen,
|
33761
|
-
renderHeaderActions: () => /* @__PURE__ */ (0,
|
33992
|
+
renderHeaderActions: () => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(CustomHeaderActions, {}),
|
33762
33993
|
setMenuOpen
|
33763
33994
|
}
|
33764
33995
|
)
|
@@ -33766,23 +33997,23 @@ function Puck({
|
|
33766
33997
|
] }) })
|
33767
33998
|
}
|
33768
33999
|
),
|
33769
|
-
/* @__PURE__ */ (0,
|
33770
|
-
/* @__PURE__ */ (0,
|
33771
|
-
/* @__PURE__ */ (0,
|
34000
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: getClassName25("leftSideBar"), children: [
|
34001
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Components, {}) }),
|
34002
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(SidebarSection, { title: "Outline", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Outline, {}) })
|
33772
34003
|
] }),
|
33773
|
-
/* @__PURE__ */ (0,
|
33774
|
-
/* @__PURE__ */ (0,
|
34004
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Canvas, {}),
|
34005
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: getClassName25("rightSideBar"), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
33775
34006
|
SidebarSection,
|
33776
34007
|
{
|
33777
34008
|
noPadding: true,
|
33778
34009
|
noBorderTop: true,
|
33779
34010
|
showBreadcrumbs: true,
|
33780
34011
|
title: selectedItem ? (_a = config.components[selectedItem.type]["label"]) != null ? _a : selectedItem.type : "Page",
|
33781
|
-
children: /* @__PURE__ */ (0,
|
34012
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Fields, {})
|
33782
34013
|
}
|
33783
34014
|
) })
|
33784
34015
|
] }),
|
33785
|
-
/* @__PURE__ */ (0,
|
34016
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
33786
34017
|
"div",
|
33787
34018
|
{
|
33788
34019
|
id: "puck-portal-root",
|
@@ -33806,7 +34037,7 @@ Puck.Preview = Preview;
|
|
33806
34037
|
|
33807
34038
|
// components/Render/index.tsx
|
33808
34039
|
init_react_import();
|
33809
|
-
var
|
34040
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
33810
34041
|
function Render({
|
33811
34042
|
config,
|
33812
34043
|
data
|
@@ -33815,7 +34046,7 @@ function Render({
|
|
33815
34046
|
const rootProps = data.root.props || data.root;
|
33816
34047
|
const title = (rootProps == null ? void 0 : rootProps.title) || "";
|
33817
34048
|
if ((_a = config.root) == null ? void 0 : _a.render) {
|
33818
|
-
return /* @__PURE__ */ (0,
|
34049
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
33819
34050
|
config.root.render,
|
33820
34051
|
__spreadProps(__spreadValues({}, rootProps), {
|
33821
34052
|
puck: {
|
@@ -33824,11 +34055,11 @@ function Render({
|
|
33824
34055
|
title,
|
33825
34056
|
editMode: false,
|
33826
34057
|
id: "puck-root",
|
33827
|
-
children: /* @__PURE__ */ (0,
|
34058
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(DropZone, { zone: rootDroppableId })
|
33828
34059
|
})
|
33829
34060
|
) });
|
33830
34061
|
}
|
33831
|
-
return /* @__PURE__ */ (0,
|
34062
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(DropZone, { zone: rootDroppableId }) });
|
33832
34063
|
}
|
33833
34064
|
|
33834
34065
|
// lib/migrate.ts
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@measured/puck",
|
3
|
-
"version": "0.14.
|
3
|
+
"version": "0.14.3-canary.73b83ef",
|
4
4
|
"author": "Measured Corporation Ltd <hello@measured.co>",
|
5
5
|
"repository": "measuredco/puck",
|
6
6
|
"bugs": "https://github.com/measuredco/puck/issues",
|
@@ -46,6 +46,7 @@
|
|
46
46
|
"@types/jest": "^29.5.4",
|
47
47
|
"@types/react": "^18.2.0",
|
48
48
|
"@types/react-dom": "^18.2.0",
|
49
|
+
"@types/ua-parser-js": "^0.7.39",
|
49
50
|
"css-box-model": "^1.2.1",
|
50
51
|
"eslint": "^7.32.0",
|
51
52
|
"eslint-config-custom": "*",
|
@@ -59,11 +60,13 @@
|
|
59
60
|
"typescript": "^4.5.2"
|
60
61
|
},
|
61
62
|
"dependencies": {
|
62
|
-
"@measured/
|
63
|
-
"@measured/dnd": "16.6.0-canary.f472135",
|
63
|
+
"@measured/dnd": "16.6.0-canary.4cba1d1",
|
64
64
|
"deep-diff": "^1.0.2",
|
65
|
+
"object-hash": "^3.0.0",
|
66
|
+
"react-frame-component": "^5.2.6",
|
65
67
|
"react-hotkeys-hook": "^4.4.1",
|
66
68
|
"react-spinners": "^0.13.8",
|
69
|
+
"ua-parser-js": "^1.0.37",
|
67
70
|
"use-debounce": "^9.0.4",
|
68
71
|
"uuid": "^9.0.1"
|
69
72
|
},
|