@measured/puck 0.14.3-canary.9df6633 → 0.15.0-canary.480467a
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/{Config-09628f3c.d.ts → Config-550396e1.d.ts} +4 -8
- package/dist/index.d.ts +3 -3
- package/dist/index.js +369 -170
- package/dist/rsc.d.ts +1 -1
- package/package.json +3 -2
@@ -110,16 +110,12 @@ type ExternalField<Props extends {
|
|
110
110
|
filterFields?: Record<string, Field>;
|
111
111
|
initialFilters?: Record<string, any>;
|
112
112
|
};
|
113
|
-
type CustomField<Props extends {
|
114
|
-
[key: string]: any;
|
115
|
-
} = {
|
116
|
-
[key: string]: any;
|
117
|
-
}> = BaseField & {
|
113
|
+
type CustomField<Props extends any = {}> = BaseField & {
|
118
114
|
type: "custom";
|
119
115
|
render: (props: {
|
120
|
-
field: CustomField
|
116
|
+
field: CustomField<Props>;
|
121
117
|
name: string;
|
122
|
-
value:
|
118
|
+
value: Props;
|
123
119
|
onChange: (value: Props) => void;
|
124
120
|
readOnly?: boolean;
|
125
121
|
}) => ReactElement;
|
@@ -128,7 +124,7 @@ type Field<Props extends {
|
|
128
124
|
[key: string]: any;
|
129
125
|
} = {
|
130
126
|
[key: string]: any;
|
131
|
-
}> = TextField | NumberField | TextareaField | SelectField | RadioField | ArrayField<Props> | ObjectField<Props> | ExternalField<Props> | ExternalFieldWithAdaptor<Props> | CustomField
|
127
|
+
}> = TextField | NumberField | TextareaField | SelectField | RadioField | ArrayField<Props> | ObjectField<Props> | ExternalField<Props> | ExternalFieldWithAdaptor<Props> | CustomField<Props>;
|
132
128
|
type DefaultRootProps = {
|
133
129
|
title?: string;
|
134
130
|
[key: string]: any;
|
package/dist/index.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import { U as UiState, D as Data, A as AppState, C as Config, a as DefaultRootProps, I as ItemSelector, b as DropZoneProps, F as Field, V as Viewports, c as DefaultComponentProps, M as MappedItem, R as RootDataWithProps, d as RootData, e as ComponentData } from './Config-
|
2
|
-
export { i as Adaptor, h as ArrayField, s as ArrayState, p as BaseData, B as BaseField, o as ComponentConfig, m as Content, k as CustomField, j as ExternalField, E as ExternalFieldWithAdaptor, l as Fields, r as ItemWithId, N as NumberField, O as ObjectField, P as PuckComponent, n as PuckContext, g as RadioField, q as RootDataWithoutProps, S as SelectField, T as TextField, f as TextareaField } from './Config-
|
1
|
+
import { U as UiState, D as Data, A as AppState, C as Config, a as DefaultRootProps, I as ItemSelector, b as DropZoneProps, F as Field, V as Viewports, c as DefaultComponentProps, M as MappedItem, R as RootDataWithProps, d as RootData, e as ComponentData } from './Config-550396e1.js';
|
2
|
+
export { i as Adaptor, h as ArrayField, s as ArrayState, p as BaseData, B as BaseField, o as ComponentConfig, m as Content, k as CustomField, j as ExternalField, E as ExternalFieldWithAdaptor, l as Fields, r as ItemWithId, N as NumberField, O as ObjectField, P as PuckComponent, n as PuckContext, g as RadioField, q as RootDataWithoutProps, S as SelectField, T as TextField, f as TextareaField } from './Config-550396e1.js';
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
4
4
|
import * as react from 'react';
|
5
5
|
import { ReactNode, ReactElement, CSSProperties, SyntheticEvent } from 'react';
|
@@ -185,7 +185,7 @@ type Overrides = OverridesGeneric<{
|
|
185
185
|
children: ReactNode;
|
186
186
|
}>;
|
187
187
|
headerActions: RenderFunc<{
|
188
|
-
children
|
188
|
+
children: ReactNode;
|
189
189
|
}>;
|
190
190
|
preview: RenderFunc;
|
191
191
|
fields: RenderFunc<{
|
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
|
}
|
@@ -29314,7 +29314,7 @@ var defaultViewports = [
|
|
29314
29314
|
var import_ua_parser_js = require("ua-parser-js");
|
29315
29315
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
29316
29316
|
var defaultAppState = {
|
29317
|
-
data: { content: [], root: { props: {
|
29317
|
+
data: { content: [], root: { props: {} } },
|
29318
29318
|
ui: {
|
29319
29319
|
leftSideBarVisible: true,
|
29320
29320
|
rightSideBarVisible: true,
|
@@ -30528,7 +30528,7 @@ var IconButton = ({
|
|
30528
30528
|
|
30529
30529
|
// components/Puck/index.tsx
|
30530
30530
|
init_react_import();
|
30531
|
-
var
|
30531
|
+
var import_react29 = require("react");
|
30532
30532
|
|
30533
30533
|
// lib/use-placeholder-style.ts
|
30534
30534
|
init_react_import();
|
@@ -31213,7 +31213,7 @@ var useResolvedData = (appState, config, dispatch) => {
|
|
31213
31213
|
const [componentState, setComponentState] = (0, import_react13.useState)({});
|
31214
31214
|
const deferredSetStates = {};
|
31215
31215
|
const setComponentLoading = (0, import_react13.useCallback)(
|
31216
|
-
(id, loading,
|
31216
|
+
(id, loading, defer2 = 0) => {
|
31217
31217
|
if (deferredSetStates[id]) {
|
31218
31218
|
clearTimeout(deferredSetStates[id]);
|
31219
31219
|
delete deferredSetStates[id];
|
@@ -31223,7 +31223,7 @@ var useResolvedData = (appState, config, dispatch) => {
|
|
31223
31223
|
[id]: __spreadProps(__spreadValues({}, prev[id]), { loading })
|
31224
31224
|
}));
|
31225
31225
|
delete deferredSetStates[id];
|
31226
|
-
},
|
31226
|
+
}, defer2);
|
31227
31227
|
},
|
31228
31228
|
[]
|
31229
31229
|
);
|
@@ -31309,7 +31309,7 @@ var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
31309
31309
|
var getClassName9 = get_class_name_factory_default("MenuBar", styles_module_default7);
|
31310
31310
|
var MenuBar = ({
|
31311
31311
|
appState,
|
31312
|
-
data = { content: [], root: {
|
31312
|
+
data = { content: [], root: {} },
|
31313
31313
|
dispatch,
|
31314
31314
|
menuOpen = false,
|
31315
31315
|
onPublish,
|
@@ -31354,17 +31354,7 @@ var MenuBar = ({
|
|
31354
31354
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_jsx_runtime13.Fragment, { children: renderHeaderActions && renderHeaderActions({
|
31355
31355
|
state: appState,
|
31356
31356
|
dispatch
|
31357
|
-
}) })
|
31358
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
31359
|
-
Button,
|
31360
|
-
{
|
31361
|
-
onClick: () => {
|
31362
|
-
onPublish && onPublish(data);
|
31363
|
-
},
|
31364
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Globe, { size: "14px" }),
|
31365
|
-
children: "Publish"
|
31366
|
-
}
|
31367
|
-
) })
|
31357
|
+
}) })
|
31368
31358
|
] })
|
31369
31359
|
}
|
31370
31360
|
);
|
@@ -32627,19 +32617,218 @@ var Components = () => {
|
|
32627
32617
|
|
32628
32618
|
// components/Puck/components/Preview/index.tsx
|
32629
32619
|
init_react_import();
|
32630
|
-
var
|
32631
|
-
|
32620
|
+
var import_react23 = require("react");
|
32621
|
+
|
32622
|
+
// components/AutoFrame/index.tsx
|
32623
|
+
init_react_import();
|
32624
|
+
var import_react22 = __toESM(require("react"));
|
32625
|
+
var import_react_frame_component = __toESM(require("react-frame-component"));
|
32626
|
+
var import_object_hash = __toESM(require("object-hash"));
|
32627
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
32628
|
+
var styleSelector = 'style, link[rel="stylesheet"]';
|
32629
|
+
var collectStyles = (doc) => {
|
32630
|
+
const collected = [];
|
32631
|
+
doc.head.querySelectorAll(styleSelector).forEach((style) => {
|
32632
|
+
collected.push(style);
|
32633
|
+
});
|
32634
|
+
return collected;
|
32635
|
+
};
|
32636
|
+
var getStyleSheet = (el) => {
|
32637
|
+
return Array.from(document.styleSheets).find((ss) => {
|
32638
|
+
const ownerNode = ss.ownerNode;
|
32639
|
+
return ownerNode.href === el.href;
|
32640
|
+
});
|
32641
|
+
};
|
32642
|
+
var getStyles = (styleSheet) => {
|
32643
|
+
if (styleSheet) {
|
32644
|
+
try {
|
32645
|
+
return [...styleSheet.cssRules].map((rule) => rule.cssText).join("");
|
32646
|
+
} catch (e) {
|
32647
|
+
console.warn(
|
32648
|
+
"Access to stylesheet %s is denied. Ignoring\u2026",
|
32649
|
+
styleSheet.href
|
32650
|
+
);
|
32651
|
+
}
|
32652
|
+
}
|
32653
|
+
return "";
|
32654
|
+
};
|
32655
|
+
var defer = (fn) => setTimeout(fn, 0);
|
32656
|
+
var CopyHostStyles = ({
|
32657
|
+
children,
|
32658
|
+
debug = false,
|
32659
|
+
onStylesLoaded = () => null
|
32660
|
+
}) => {
|
32661
|
+
const { document: doc, window: win } = (0, import_react_frame_component.useFrame)();
|
32662
|
+
(0, import_react22.useEffect)(() => {
|
32663
|
+
if (!win || !doc) {
|
32664
|
+
return () => {
|
32665
|
+
};
|
32666
|
+
}
|
32667
|
+
let elements = [];
|
32668
|
+
const hashes = {};
|
32669
|
+
const lookupEl = (el) => elements.findIndex((elementMap) => elementMap.original === el);
|
32670
|
+
const mirrorEl = (el, inlineStyles = false) => __async(void 0, null, function* () {
|
32671
|
+
let mirror;
|
32672
|
+
if (el.nodeName === "LINK" && inlineStyles) {
|
32673
|
+
mirror = document.createElement("style");
|
32674
|
+
mirror.type = "text/css";
|
32675
|
+
let styleSheet = getStyleSheet(el);
|
32676
|
+
if (!styleSheet) {
|
32677
|
+
yield new Promise((resolve) => {
|
32678
|
+
const fn = () => {
|
32679
|
+
resolve();
|
32680
|
+
el.removeEventListener("load", fn);
|
32681
|
+
};
|
32682
|
+
el.addEventListener("load", fn);
|
32683
|
+
});
|
32684
|
+
styleSheet = getStyleSheet(el);
|
32685
|
+
}
|
32686
|
+
const styles = getStyles(styleSheet);
|
32687
|
+
if (!styles) {
|
32688
|
+
if (debug) {
|
32689
|
+
console.warn(
|
32690
|
+
`Tried to load styles for link element, but couldn't find them. Skipping...`
|
32691
|
+
);
|
32692
|
+
}
|
32693
|
+
return;
|
32694
|
+
}
|
32695
|
+
mirror.innerHTML = styles;
|
32696
|
+
mirror.setAttribute("data-href", el.getAttribute("href"));
|
32697
|
+
} else {
|
32698
|
+
mirror = el.cloneNode(true);
|
32699
|
+
}
|
32700
|
+
return mirror;
|
32701
|
+
});
|
32702
|
+
const addEl = (el) => __async(void 0, null, function* () {
|
32703
|
+
const index = lookupEl(el);
|
32704
|
+
if (index > -1) {
|
32705
|
+
if (debug)
|
32706
|
+
console.log(
|
32707
|
+
`Tried to add an element that was already mirrored. Updating instead...`
|
32708
|
+
);
|
32709
|
+
elements[index].mirror.innerText = el.innerText;
|
32710
|
+
return;
|
32711
|
+
}
|
32712
|
+
const mirror = yield mirrorEl(el);
|
32713
|
+
if (!mirror) {
|
32714
|
+
return;
|
32715
|
+
}
|
32716
|
+
const elHash = (0, import_object_hash.default)(mirror.outerHTML);
|
32717
|
+
if (hashes[elHash]) {
|
32718
|
+
if (debug)
|
32719
|
+
console.log(
|
32720
|
+
`iframe already contains element that is being mirrored. Skipping...`
|
32721
|
+
);
|
32722
|
+
return;
|
32723
|
+
}
|
32724
|
+
hashes[elHash] = true;
|
32725
|
+
doc.head.append(mirror);
|
32726
|
+
elements.push({ original: el, mirror });
|
32727
|
+
if (debug)
|
32728
|
+
console.log(`Added style node ${el.outerHTML}`);
|
32729
|
+
});
|
32730
|
+
const removeEl = (el) => {
|
32731
|
+
var _a, _b;
|
32732
|
+
const index = lookupEl(el);
|
32733
|
+
if (index === -1) {
|
32734
|
+
if (debug)
|
32735
|
+
console.log(
|
32736
|
+
`Tried to remove an element that did not exist. Skipping...`
|
32737
|
+
);
|
32738
|
+
return;
|
32739
|
+
}
|
32740
|
+
const elHash = (0, import_object_hash.default)(el.outerHTML);
|
32741
|
+
(_b = (_a = elements[index]) == null ? void 0 : _a.mirror) == null ? void 0 : _b.remove();
|
32742
|
+
delete hashes[elHash];
|
32743
|
+
if (debug)
|
32744
|
+
console.log(`Removed style node ${el.outerHTML}`);
|
32745
|
+
};
|
32746
|
+
const observer = new MutationObserver((mutations) => {
|
32747
|
+
mutations.forEach((mutation) => {
|
32748
|
+
if (mutation.type === "childList") {
|
32749
|
+
mutation.addedNodes.forEach((node) => {
|
32750
|
+
if (node.nodeType === Node.TEXT_NODE || node.nodeType === Node.ELEMENT_NODE) {
|
32751
|
+
const el = node.nodeType === Node.TEXT_NODE ? node.parentElement : node;
|
32752
|
+
if (el && el.matches(styleSelector)) {
|
32753
|
+
defer(() => addEl(el));
|
32754
|
+
}
|
32755
|
+
}
|
32756
|
+
});
|
32757
|
+
mutation.removedNodes.forEach((node) => {
|
32758
|
+
if (node.nodeType === Node.TEXT_NODE || node.nodeType === Node.ELEMENT_NODE) {
|
32759
|
+
const el = node.nodeType === Node.TEXT_NODE ? node.parentElement : node;
|
32760
|
+
if (el && el.matches(styleSelector)) {
|
32761
|
+
defer(() => removeEl(el));
|
32762
|
+
}
|
32763
|
+
}
|
32764
|
+
});
|
32765
|
+
}
|
32766
|
+
});
|
32767
|
+
});
|
32768
|
+
const parentDocument = win.parent.document;
|
32769
|
+
const collectedStyles = collectStyles(parentDocument);
|
32770
|
+
const hrefs = [];
|
32771
|
+
let stylesLoaded = 0;
|
32772
|
+
Promise.all(
|
32773
|
+
collectedStyles.map((styleNode, i) => __async(void 0, null, function* () {
|
32774
|
+
if (styleNode.nodeName === "LINK") {
|
32775
|
+
const linkHref = styleNode.href;
|
32776
|
+
if (hrefs.indexOf(linkHref) > -1) {
|
32777
|
+
return;
|
32778
|
+
}
|
32779
|
+
hrefs.push(linkHref);
|
32780
|
+
}
|
32781
|
+
const mirror = yield mirrorEl(styleNode);
|
32782
|
+
if (!mirror)
|
32783
|
+
return;
|
32784
|
+
elements.push({ original: styleNode, mirror });
|
32785
|
+
return mirror;
|
32786
|
+
}))
|
32787
|
+
).then((mirrorStyles) => {
|
32788
|
+
const filtered = mirrorStyles.filter(
|
32789
|
+
(el) => typeof el !== "undefined"
|
32790
|
+
);
|
32791
|
+
filtered.forEach((mirror) => {
|
32792
|
+
mirror.onload = () => {
|
32793
|
+
stylesLoaded = stylesLoaded + 1;
|
32794
|
+
if (stylesLoaded >= elements.length) {
|
32795
|
+
onStylesLoaded();
|
32796
|
+
}
|
32797
|
+
};
|
32798
|
+
});
|
32799
|
+
doc.head.innerHTML = "";
|
32800
|
+
doc.head.append(...filtered);
|
32801
|
+
observer.observe(parentDocument.head, { childList: true, subtree: true });
|
32802
|
+
filtered.forEach((el) => {
|
32803
|
+
const elHash = (0, import_object_hash.default)(el.outerHTML);
|
32804
|
+
hashes[elHash] = true;
|
32805
|
+
});
|
32806
|
+
});
|
32807
|
+
return () => {
|
32808
|
+
observer.disconnect();
|
32809
|
+
};
|
32810
|
+
}, []);
|
32811
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_jsx_runtime29.Fragment, { children });
|
32812
|
+
};
|
32813
|
+
var AutoFrameComponent = import_react22.default.forwardRef(
|
32814
|
+
function(_a, ref) {
|
32815
|
+
var _b = _a, { children, debug, onStylesLoaded } = _b, props = __objRest(_b, ["children", "debug", "onStylesLoaded"]);
|
32816
|
+
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 }) }));
|
32817
|
+
}
|
32818
|
+
);
|
32819
|
+
AutoFrameComponent.displayName = "AutoFrameComponent";
|
32820
|
+
var AutoFrame_default = AutoFrameComponent;
|
32632
32821
|
|
32633
32822
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Preview/styles.module.css#css-module
|
32634
32823
|
init_react_import();
|
32635
32824
|
var styles_module_default16 = { "PuckPreview": "_PuckPreview_rxwlr_1", "PuckPreview-frame": "_PuckPreview-frame_rxwlr_5" };
|
32636
32825
|
|
32637
32826
|
// components/Puck/components/Preview/index.tsx
|
32638
|
-
var
|
32827
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
32639
32828
|
var getClassName21 = get_class_name_factory_default("PuckPreview", styles_module_default16);
|
32640
32829
|
var Preview = ({ id = "puck-preview" }) => {
|
32641
32830
|
const { config, dispatch, state, setStatus, iframe } = useAppContext();
|
32642
|
-
const Page = (0,
|
32831
|
+
const Page = (0, import_react23.useCallback)(
|
32643
32832
|
(pageProps) => {
|
32644
32833
|
var _a, _b;
|
32645
32834
|
return ((_a = config.root) == null ? void 0 : _a.render) ? (_b = config.root) == null ? void 0 : _b.render(__spreadProps(__spreadValues({
|
@@ -32647,13 +32836,13 @@ var Preview = ({ id = "puck-preview" }) => {
|
|
32647
32836
|
}, pageProps), {
|
32648
32837
|
editMode: true,
|
32649
32838
|
puck: { renderDropZone: DropZone }
|
32650
|
-
})) : /* @__PURE__ */ (0,
|
32839
|
+
})) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_jsx_runtime30.Fragment, { children: pageProps.children });
|
32651
32840
|
},
|
32652
32841
|
[config.root]
|
32653
32842
|
);
|
32654
32843
|
const rootProps = state.data.root.props || state.data.root;
|
32655
|
-
const ref = (0,
|
32656
|
-
return /* @__PURE__ */ (0,
|
32844
|
+
const ref = (0, import_react23.useRef)(null);
|
32845
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
32657
32846
|
"div",
|
32658
32847
|
{
|
32659
32848
|
className: getClassName21(),
|
@@ -32661,8 +32850,8 @@ var Preview = ({ id = "puck-preview" }) => {
|
|
32661
32850
|
onClick: () => {
|
32662
32851
|
dispatch({ type: "setUi", ui: __spreadProps(__spreadValues({}, state.ui), { itemSelector: null }) });
|
32663
32852
|
},
|
32664
|
-
children: iframe.enabled ? /* @__PURE__ */ (0,
|
32665
|
-
|
32853
|
+
children: iframe.enabled ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
32854
|
+
AutoFrame_default,
|
32666
32855
|
{
|
32667
32856
|
id: "preview-frame",
|
32668
32857
|
className: getClassName21("frame"),
|
@@ -32671,9 +32860,9 @@ var Preview = ({ id = "puck-preview" }) => {
|
|
32671
32860
|
onStylesLoaded: () => {
|
32672
32861
|
setStatus("READY");
|
32673
32862
|
},
|
32674
|
-
children: /* @__PURE__ */ (0,
|
32863
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Page, __spreadProps(__spreadValues({ dispatch, state }, rootProps), { children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(DropZone, { zone: rootDroppableId }) }))
|
32675
32864
|
}
|
32676
|
-
) : /* @__PURE__ */ (0,
|
32865
|
+
) : /* @__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 }) })) })
|
32677
32866
|
}
|
32678
32867
|
);
|
32679
32868
|
};
|
@@ -32721,7 +32910,7 @@ var scrollIntoView = (el) => {
|
|
32721
32910
|
};
|
32722
32911
|
|
32723
32912
|
// components/LayerTree/index.tsx
|
32724
|
-
var
|
32913
|
+
var import_react24 = require("react");
|
32725
32914
|
|
32726
32915
|
// lib/is-child-of-zone.ts
|
32727
32916
|
init_react_import();
|
@@ -32735,7 +32924,7 @@ var isChildOfZone = (item, maybeChild, ctx) => {
|
|
32735
32924
|
};
|
32736
32925
|
|
32737
32926
|
// components/LayerTree/index.tsx
|
32738
|
-
var
|
32927
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
32739
32928
|
var getClassName22 = get_class_name_factory_default("LayerTree", styles_module_default17);
|
32740
32929
|
var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default17);
|
32741
32930
|
var LayerTree = ({
|
@@ -32748,15 +32937,15 @@ var LayerTree = ({
|
|
32748
32937
|
label
|
32749
32938
|
}) => {
|
32750
32939
|
const zones = data.zones || {};
|
32751
|
-
const ctx = (0,
|
32752
|
-
return /* @__PURE__ */ (0,
|
32753
|
-
label && /* @__PURE__ */ (0,
|
32754
|
-
/* @__PURE__ */ (0,
|
32940
|
+
const ctx = (0, import_react24.useContext)(dropZoneContext);
|
32941
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
|
32942
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: getClassName22("zoneTitle"), children: [
|
32943
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: getClassName22("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Layers, { size: "16" }) }),
|
32755
32944
|
" ",
|
32756
32945
|
label
|
32757
32946
|
] }),
|
32758
|
-
/* @__PURE__ */ (0,
|
32759
|
-
zoneContent.length === 0 && /* @__PURE__ */ (0,
|
32947
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("ul", { className: getClassName22(), children: [
|
32948
|
+
zoneContent.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: getClassName22("helper"), children: "No items" }),
|
32760
32949
|
zoneContent.map((item, i) => {
|
32761
32950
|
var _a;
|
32762
32951
|
const isSelected = (itemSelector == null ? void 0 : itemSelector.index) === i && (itemSelector.zone === zone || itemSelector.zone === rootDroppableId && !zone);
|
@@ -32772,7 +32961,7 @@ var LayerTree = ({
|
|
32772
32961
|
const selectedItem = itemSelector && data ? getItem(itemSelector, data) : null;
|
32773
32962
|
const isHovering = hoveringComponent === item.props.id;
|
32774
32963
|
const childIsSelected = isChildOfZone(item, selectedItem, ctx);
|
32775
|
-
return /* @__PURE__ */ (0,
|
32964
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
32776
32965
|
"li",
|
32777
32966
|
{
|
32778
32967
|
className: getClassNameLayer({
|
@@ -32782,7 +32971,7 @@ var LayerTree = ({
|
|
32782
32971
|
childIsSelected
|
32783
32972
|
}),
|
32784
32973
|
children: [
|
32785
|
-
/* @__PURE__ */ (0,
|
32974
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
32786
32975
|
"button",
|
32787
32976
|
{
|
32788
32977
|
className: getClassNameLayer("clickable"),
|
@@ -32814,22 +33003,22 @@ var LayerTree = ({
|
|
32814
33003
|
setHoveringComponent(null);
|
32815
33004
|
},
|
32816
33005
|
children: [
|
32817
|
-
containsZone && /* @__PURE__ */ (0,
|
33006
|
+
containsZone && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
32818
33007
|
"div",
|
32819
33008
|
{
|
32820
33009
|
className: getClassNameLayer("chevron"),
|
32821
33010
|
title: isSelected ? "Collapse" : "Expand",
|
32822
|
-
children: /* @__PURE__ */ (0,
|
33011
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ChevronDown, { size: "12" })
|
32823
33012
|
}
|
32824
33013
|
),
|
32825
|
-
/* @__PURE__ */ (0,
|
32826
|
-
/* @__PURE__ */ (0,
|
32827
|
-
/* @__PURE__ */ (0,
|
33014
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: getClassNameLayer("title"), children: [
|
33015
|
+
/* @__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" }) }),
|
33016
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: getClassNameLayer("name"), children: (_a = config.components[item.type]["label"]) != null ? _a : item.type })
|
32828
33017
|
] })
|
32829
33018
|
]
|
32830
33019
|
}
|
32831
33020
|
) }),
|
32832
|
-
containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ (0,
|
33021
|
+
containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
32833
33022
|
LayerTree,
|
32834
33023
|
{
|
32835
33024
|
config,
|
@@ -32851,13 +33040,13 @@ var LayerTree = ({
|
|
32851
33040
|
};
|
32852
33041
|
|
32853
33042
|
// components/Puck/components/Outline/index.tsx
|
32854
|
-
var
|
32855
|
-
var
|
33043
|
+
var import_react25 = require("react");
|
33044
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
32856
33045
|
var Outline = () => {
|
32857
33046
|
const { dispatch, state, overrides, config } = useAppContext();
|
32858
33047
|
const { data, ui } = state;
|
32859
33048
|
const { itemSelector } = ui;
|
32860
|
-
const setItemSelector = (0,
|
33049
|
+
const setItemSelector = (0, import_react25.useCallback)(
|
32861
33050
|
(newItemSelector) => {
|
32862
33051
|
dispatch({
|
32863
33052
|
type: "setUi",
|
@@ -32866,9 +33055,9 @@ var Outline = () => {
|
|
32866
33055
|
},
|
32867
33056
|
[]
|
32868
33057
|
);
|
32869
|
-
const Wrapper = (0,
|
32870
|
-
return /* @__PURE__ */ (0,
|
32871
|
-
(ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0,
|
33058
|
+
const Wrapper = (0, import_react25.useMemo)(() => overrides.outline || "div", [overrides]);
|
33059
|
+
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: [
|
33060
|
+
(ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
32872
33061
|
LayerTree,
|
32873
33062
|
{
|
32874
33063
|
config,
|
@@ -32881,7 +33070,7 @@ var Outline = () => {
|
|
32881
33070
|
),
|
32882
33071
|
Object.entries(findZonesForArea(data, "root")).map(
|
32883
33072
|
([zoneKey, zone]) => {
|
32884
|
-
return /* @__PURE__ */ (0,
|
33073
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
32885
33074
|
LayerTree,
|
32886
33075
|
{
|
32887
33076
|
config,
|
@@ -32966,12 +33155,12 @@ function usePuckHistory({
|
|
32966
33155
|
|
32967
33156
|
// lib/use-history-store.ts
|
32968
33157
|
init_react_import();
|
32969
|
-
var
|
33158
|
+
var import_react26 = require("react");
|
32970
33159
|
var import_use_debounce3 = require("use-debounce");
|
32971
33160
|
var EMPTY_HISTORY_INDEX = -1;
|
32972
33161
|
function useHistoryStore() {
|
32973
|
-
const [histories, setHistories] = (0,
|
32974
|
-
const [index, setIndex] = (0,
|
33162
|
+
const [histories, setHistories] = (0, import_react26.useState)([]);
|
33163
|
+
const [index, setIndex] = (0, import_react26.useState)(EMPTY_HISTORY_INDEX);
|
32975
33164
|
const hasPast = index > EMPTY_HISTORY_INDEX;
|
32976
33165
|
const hasFuture = index < histories.length - 1;
|
32977
33166
|
const currentHistory = histories[index];
|
@@ -33131,22 +33320,22 @@ var getBox = function getBox2(el) {
|
|
33131
33320
|
};
|
33132
33321
|
|
33133
33322
|
// components/Puck/components/Canvas/index.tsx
|
33134
|
-
var
|
33323
|
+
var import_react28 = require("react");
|
33135
33324
|
|
33136
33325
|
// components/ViewportControls/index.tsx
|
33137
33326
|
init_react_import();
|
33138
|
-
var
|
33327
|
+
var import_react27 = require("react");
|
33139
33328
|
|
33140
33329
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ViewportControls/styles.module.css#css-module
|
33141
33330
|
init_react_import();
|
33142
33331
|
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" };
|
33143
33332
|
|
33144
33333
|
// components/ViewportControls/index.tsx
|
33145
|
-
var
|
33334
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
33146
33335
|
var icons = {
|
33147
|
-
Smartphone: /* @__PURE__ */ (0,
|
33148
|
-
Tablet: /* @__PURE__ */ (0,
|
33149
|
-
Monitor: /* @__PURE__ */ (0,
|
33336
|
+
Smartphone: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Smartphone, { size: 16 }),
|
33337
|
+
Tablet: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Tablet, { size: 16 }),
|
33338
|
+
Monitor: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Monitor, { size: 16 })
|
33150
33339
|
};
|
33151
33340
|
var getClassName23 = get_class_name_factory_default("ViewportControls", styles_module_default18);
|
33152
33341
|
var getClassNameButton = get_class_name_factory_default("ViewportButton", styles_module_default18);
|
@@ -33158,11 +33347,11 @@ var ViewportButton = ({
|
|
33158
33347
|
onClick
|
33159
33348
|
}) => {
|
33160
33349
|
const { state } = useAppContext();
|
33161
|
-
const [isActive, setIsActive] = (0,
|
33162
|
-
(0,
|
33350
|
+
const [isActive, setIsActive] = (0, import_react27.useState)(false);
|
33351
|
+
(0, import_react27.useEffect)(() => {
|
33163
33352
|
setIsActive(width === state.ui.viewports.current.width);
|
33164
33353
|
}, [width, state.ui.viewports.current.width]);
|
33165
|
-
return /* @__PURE__ */ (0,
|
33354
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: getClassNameButton({ isActive }), children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
33166
33355
|
IconButton,
|
33167
33356
|
{
|
33168
33357
|
title,
|
@@ -33171,7 +33360,7 @@ var ViewportButton = ({
|
|
33171
33360
|
e.stopPropagation();
|
33172
33361
|
onClick({ width, height });
|
33173
33362
|
},
|
33174
|
-
children: /* @__PURE__ */ (0,
|
33363
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: getClassNameButton("inner"), children })
|
33175
33364
|
}
|
33176
33365
|
) });
|
33177
33366
|
};
|
@@ -33195,7 +33384,7 @@ var ViewportControls = ({
|
|
33195
33384
|
const defaultsContainAutoZoom = defaultZoomOptions.find(
|
33196
33385
|
(option) => option.value === autoZoom
|
33197
33386
|
);
|
33198
|
-
const zoomOptions = (0,
|
33387
|
+
const zoomOptions = (0, import_react27.useMemo)(
|
33199
33388
|
() => [
|
33200
33389
|
...defaultZoomOptions,
|
33201
33390
|
...defaultsContainAutoZoom ? [] : [
|
@@ -33207,8 +33396,8 @@ var ViewportControls = ({
|
|
33207
33396
|
].filter((a) => a.value <= autoZoom).sort((a, b) => a.value > b.value ? 1 : -1),
|
33208
33397
|
[autoZoom]
|
33209
33398
|
);
|
33210
|
-
return /* @__PURE__ */ (0,
|
33211
|
-
viewports.map((viewport, i) => /* @__PURE__ */ (0,
|
33399
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: getClassName23(), children: [
|
33400
|
+
viewports.map((viewport, i) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
33212
33401
|
ViewportButton,
|
33213
33402
|
{
|
33214
33403
|
height: viewport.height,
|
@@ -33219,8 +33408,8 @@ var ViewportControls = ({
|
|
33219
33408
|
},
|
33220
33409
|
i
|
33221
33410
|
)),
|
33222
|
-
/* @__PURE__ */ (0,
|
33223
|
-
/* @__PURE__ */ (0,
|
33411
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: getClassName23("divider") }),
|
33412
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
33224
33413
|
IconButton,
|
33225
33414
|
{
|
33226
33415
|
title: "Zoom viewport out",
|
@@ -33234,10 +33423,10 @@ var ViewportControls = ({
|
|
33234
33423
|
)].value
|
33235
33424
|
);
|
33236
33425
|
},
|
33237
|
-
children: /* @__PURE__ */ (0,
|
33426
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ZoomOut, { size: 16 })
|
33238
33427
|
}
|
33239
33428
|
),
|
33240
|
-
/* @__PURE__ */ (0,
|
33429
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
33241
33430
|
IconButton,
|
33242
33431
|
{
|
33243
33432
|
title: "Zoom viewport in",
|
@@ -33251,11 +33440,11 @@ var ViewportControls = ({
|
|
33251
33440
|
)].value
|
33252
33441
|
);
|
33253
33442
|
},
|
33254
|
-
children: /* @__PURE__ */ (0,
|
33443
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ZoomIn, { size: 16 })
|
33255
33444
|
}
|
33256
33445
|
),
|
33257
|
-
/* @__PURE__ */ (0,
|
33258
|
-
/* @__PURE__ */ (0,
|
33446
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: getClassName23("divider") }),
|
33447
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
33259
33448
|
"select",
|
33260
33449
|
{
|
33261
33450
|
className: getClassName23("zoomSelect"),
|
@@ -33263,7 +33452,7 @@ var ViewportControls = ({
|
|
33263
33452
|
onChange: (e) => {
|
33264
33453
|
onZoom(parseFloat(e.currentTarget.value));
|
33265
33454
|
},
|
33266
|
-
children: zoomOptions.map((option) => /* @__PURE__ */ (0,
|
33455
|
+
children: zoomOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
33267
33456
|
"option",
|
33268
33457
|
{
|
33269
33458
|
value: option.value,
|
@@ -33311,24 +33500,24 @@ var getZoomConfig = (uiViewport, frame, zoom) => {
|
|
33311
33500
|
};
|
33312
33501
|
|
33313
33502
|
// components/Puck/components/Canvas/index.tsx
|
33314
|
-
var
|
33503
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
33315
33504
|
var getClassName24 = get_class_name_factory_default("PuckCanvas", styles_module_default19);
|
33316
33505
|
var ZOOM_ON_CHANGE = true;
|
33317
33506
|
var Canvas = () => {
|
33318
33507
|
const { status, iframe } = useAppContext();
|
33319
33508
|
const { dispatch, state, overrides, setUi, zoomConfig, setZoomConfig } = useAppContext();
|
33320
33509
|
const { ui } = state;
|
33321
|
-
const frameRef = (0,
|
33322
|
-
const [showTransition, setShowTransition] = (0,
|
33323
|
-
const defaultRender = (0,
|
33324
|
-
const PuckDefault = ({ children }) => /* @__PURE__ */ (0,
|
33510
|
+
const frameRef = (0, import_react28.useRef)(null);
|
33511
|
+
const [showTransition, setShowTransition] = (0, import_react28.useState)(false);
|
33512
|
+
const defaultRender = (0, import_react28.useMemo)(() => {
|
33513
|
+
const PuckDefault = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_jsx_runtime34.Fragment, { children });
|
33325
33514
|
return PuckDefault;
|
33326
33515
|
}, []);
|
33327
|
-
const CustomPreview = (0,
|
33516
|
+
const CustomPreview = (0, import_react28.useMemo)(
|
33328
33517
|
() => overrides.preview || defaultRender,
|
33329
33518
|
[overrides]
|
33330
33519
|
);
|
33331
|
-
const getFrameDimensions = (0,
|
33520
|
+
const getFrameDimensions = (0, import_react28.useCallback)(() => {
|
33332
33521
|
if (frameRef.current) {
|
33333
33522
|
const frame = frameRef.current;
|
33334
33523
|
const box = getBox(frame);
|
@@ -33336,7 +33525,7 @@ var Canvas = () => {
|
|
33336
33525
|
}
|
33337
33526
|
return { width: 0, height: 0 };
|
33338
33527
|
}, [frameRef]);
|
33339
|
-
const resetAutoZoom = (0,
|
33528
|
+
const resetAutoZoom = (0, import_react28.useCallback)(
|
33340
33529
|
(ui2 = state.ui) => {
|
33341
33530
|
if (frameRef.current) {
|
33342
33531
|
setZoomConfig(
|
@@ -33346,11 +33535,11 @@ var Canvas = () => {
|
|
33346
33535
|
},
|
33347
33536
|
[frameRef, zoomConfig, state.ui]
|
33348
33537
|
);
|
33349
|
-
(0,
|
33538
|
+
(0, import_react28.useEffect)(() => {
|
33350
33539
|
setShowTransition(false);
|
33351
33540
|
resetAutoZoom();
|
33352
33541
|
}, [frameRef, ui.leftSideBarVisible, ui.rightSideBarVisible]);
|
33353
|
-
(0,
|
33542
|
+
(0, import_react28.useEffect)(() => {
|
33354
33543
|
const { height: frameHeight } = getFrameDimensions();
|
33355
33544
|
if (ui.viewports.current.height === "auto") {
|
33356
33545
|
setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), {
|
@@ -33358,7 +33547,7 @@ var Canvas = () => {
|
|
33358
33547
|
}));
|
33359
33548
|
}
|
33360
33549
|
}, [zoomConfig.zoom]);
|
33361
|
-
(0,
|
33550
|
+
(0, import_react28.useEffect)(() => {
|
33362
33551
|
const observer = new ResizeObserver(() => {
|
33363
33552
|
setShowTransition(false);
|
33364
33553
|
resetAutoZoom();
|
@@ -33370,7 +33559,7 @@ var Canvas = () => {
|
|
33370
33559
|
observer.disconnect();
|
33371
33560
|
};
|
33372
33561
|
}, []);
|
33373
|
-
return /* @__PURE__ */ (0,
|
33562
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
33374
33563
|
"div",
|
33375
33564
|
{
|
33376
33565
|
className: getClassName24({
|
@@ -33382,7 +33571,7 @@ var Canvas = () => {
|
|
33382
33571
|
recordHistory: true
|
33383
33572
|
}),
|
33384
33573
|
children: [
|
33385
|
-
ui.viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ (0,
|
33574
|
+
ui.viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName24("controls"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
33386
33575
|
ViewportControls,
|
33387
33576
|
{
|
33388
33577
|
autoZoom: zoomConfig.autoZoom,
|
@@ -33407,7 +33596,7 @@ var Canvas = () => {
|
|
33407
33596
|
}
|
33408
33597
|
}
|
33409
33598
|
) }),
|
33410
|
-
/* @__PURE__ */ (0,
|
33599
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName24("inner"), ref: frameRef, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
33411
33600
|
"div",
|
33412
33601
|
{
|
33413
33602
|
className: getClassName24("root"),
|
@@ -33419,7 +33608,7 @@ var Canvas = () => {
|
|
33419
33608
|
overflow: iframe.enabled ? void 0 : "auto"
|
33420
33609
|
},
|
33421
33610
|
suppressHydrationWarning: true,
|
33422
|
-
children: /* @__PURE__ */ (0,
|
33611
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(CustomPreview, { children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Preview, {}) })
|
33423
33612
|
}
|
33424
33613
|
) })
|
33425
33614
|
]
|
@@ -33428,12 +33617,12 @@ var Canvas = () => {
|
|
33428
33617
|
};
|
33429
33618
|
|
33430
33619
|
// components/Puck/index.tsx
|
33431
|
-
var
|
33620
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
33432
33621
|
var getClassName25 = get_class_name_factory_default("Puck", styles_module_default8);
|
33433
33622
|
function Puck({
|
33434
33623
|
children,
|
33435
33624
|
config,
|
33436
|
-
data: initialData = { content: [], root: {
|
33625
|
+
data: initialData = { content: [], root: {} },
|
33437
33626
|
ui: initialUi,
|
33438
33627
|
onChange,
|
33439
33628
|
onPublish,
|
@@ -33451,11 +33640,11 @@ function Puck({
|
|
33451
33640
|
}) {
|
33452
33641
|
var _a;
|
33453
33642
|
const historyStore = useHistoryStore();
|
33454
|
-
const [reducer] = (0,
|
33643
|
+
const [reducer] = (0, import_react29.useState)(
|
33455
33644
|
() => createReducer({ config, record: historyStore.record })
|
33456
33645
|
);
|
33457
|
-
const [initialAppState] = (0,
|
33458
|
-
var _a2, _b, _c, _d;
|
33646
|
+
const [initialAppState] = (0, import_react29.useState)(() => {
|
33647
|
+
var _a2, _b, _c, _d, _e;
|
33459
33648
|
const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
|
33460
33649
|
let clientUiState = {};
|
33461
33650
|
if (typeof window !== "undefined") {
|
@@ -33482,8 +33671,12 @@ function Puck({
|
|
33482
33671
|
};
|
33483
33672
|
}
|
33484
33673
|
}
|
33674
|
+
const rootProps2 = initialData.root.props || initialData.root;
|
33675
|
+
const defaultedRootProps = __spreadValues(__spreadValues({}, (_e = config.root) == null ? void 0 : _e.defaultProps), rootProps2);
|
33485
33676
|
return __spreadProps(__spreadValues({}, defaultAppState), {
|
33486
|
-
data: initialData,
|
33677
|
+
data: __spreadProps(__spreadValues({}, initialData), {
|
33678
|
+
root: defaultedRootProps
|
33679
|
+
}),
|
33487
33680
|
ui: __spreadProps(__spreadValues(__spreadValues({}, initial), clientUiState), {
|
33488
33681
|
// Store categories under componentList on state to allow render functions and plugins to modify
|
33489
33682
|
componentList: config.categories ? Object.entries(config.categories).reduce(
|
@@ -33502,7 +33695,7 @@ function Puck({
|
|
33502
33695
|
})
|
33503
33696
|
});
|
33504
33697
|
});
|
33505
|
-
const [appState, dispatch] = (0,
|
33698
|
+
const [appState, dispatch] = (0, import_react29.useReducer)(
|
33506
33699
|
reducer,
|
33507
33700
|
flushZones(initialAppState)
|
33508
33701
|
);
|
@@ -33513,9 +33706,9 @@ function Puck({
|
|
33513
33706
|
config,
|
33514
33707
|
dispatch
|
33515
33708
|
);
|
33516
|
-
const [menuOpen, setMenuOpen] = (0,
|
33709
|
+
const [menuOpen, setMenuOpen] = (0, import_react29.useState)(false);
|
33517
33710
|
const { itemSelector, leftSideBarVisible, rightSideBarVisible } = ui;
|
33518
|
-
const setItemSelector = (0,
|
33711
|
+
const setItemSelector = (0, import_react29.useCallback)(
|
33519
33712
|
(newItemSelector) => {
|
33520
33713
|
if (newItemSelector === itemSelector)
|
33521
33714
|
return;
|
@@ -33528,21 +33721,21 @@ function Puck({
|
|
33528
33721
|
[itemSelector]
|
33529
33722
|
);
|
33530
33723
|
const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
|
33531
|
-
(0,
|
33724
|
+
(0, import_react29.useEffect)(() => {
|
33532
33725
|
if (onChange)
|
33533
33726
|
onChange(data);
|
33534
33727
|
}, [data]);
|
33535
33728
|
const { onDragStartOrUpdate, placeholderStyle } = usePlaceholderStyle();
|
33536
|
-
const [draggedItem, setDraggedItem] = (0,
|
33729
|
+
const [draggedItem, setDraggedItem] = (0, import_react29.useState)();
|
33537
33730
|
const rootProps = data.root.props || data.root;
|
33538
|
-
(0,
|
33731
|
+
(0, import_react29.useEffect)(() => {
|
33539
33732
|
if (Object.keys(data.root).length > 0 && !data.root.props) {
|
33540
33733
|
console.error(
|
33541
33734
|
"Warning: Defining props on `root` is deprecated. Please use `root.props`. This will be a breaking change in a future release."
|
33542
33735
|
);
|
33543
33736
|
}
|
33544
33737
|
}, []);
|
33545
|
-
const toggleSidebars = (0,
|
33738
|
+
const toggleSidebars = (0, import_react29.useCallback)(
|
33546
33739
|
(sidebar) => {
|
33547
33740
|
const widerViewport = window.matchMedia("(min-width: 638px)").matches;
|
33548
33741
|
const sideBarVisible = sidebar === "left" ? leftSideBarVisible : rightSideBarVisible;
|
@@ -33556,7 +33749,7 @@ function Puck({
|
|
33556
33749
|
},
|
33557
33750
|
[dispatch, leftSideBarVisible, rightSideBarVisible]
|
33558
33751
|
);
|
33559
|
-
(0,
|
33752
|
+
(0, import_react29.useEffect)(() => {
|
33560
33753
|
if (!window.matchMedia("(min-width: 638px)").matches) {
|
33561
33754
|
dispatch({
|
33562
33755
|
type: "setUi",
|
@@ -33579,11 +33772,11 @@ function Puck({
|
|
33579
33772
|
window.removeEventListener("resize", handleResize);
|
33580
33773
|
};
|
33581
33774
|
}, []);
|
33582
|
-
const defaultRender = (0,
|
33583
|
-
const PuckDefault = ({ children: children2 }) => /* @__PURE__ */ (0,
|
33775
|
+
const defaultRender = (0, import_react29.useMemo)(() => {
|
33776
|
+
const PuckDefault = ({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_jsx_runtime35.Fragment, { children: children2 });
|
33584
33777
|
return PuckDefault;
|
33585
33778
|
}, []);
|
33586
|
-
const defaultHeaderRender = (0,
|
33779
|
+
const defaultHeaderRender = (0, import_react29.useMemo)(() => {
|
33587
33780
|
if (renderHeader) {
|
33588
33781
|
console.warn(
|
33589
33782
|
"`renderHeader` is deprecated. Please use `overrides.header` and the `usePuck` hook instead"
|
@@ -33591,45 +33784,45 @@ function Puck({
|
|
33591
33784
|
const RenderHeader = (_a2) => {
|
33592
33785
|
var _b = _a2, { actions } = _b, props = __objRest(_b, ["actions"]);
|
33593
33786
|
const Comp = renderHeader;
|
33594
|
-
return /* @__PURE__ */ (0,
|
33787
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
|
33595
33788
|
};
|
33596
33789
|
return RenderHeader;
|
33597
33790
|
}
|
33598
33791
|
return defaultRender;
|
33599
33792
|
}, [renderHeader]);
|
33600
|
-
const defaultHeaderActionsRender = (0,
|
33793
|
+
const defaultHeaderActionsRender = (0, import_react29.useMemo)(() => {
|
33601
33794
|
if (renderHeaderActions) {
|
33602
33795
|
console.warn(
|
33603
33796
|
"`renderHeaderActions` is deprecated. Please use `overrides.headerActions` and the `usePuck` hook instead."
|
33604
33797
|
);
|
33605
33798
|
const RenderHeader = (props) => {
|
33606
33799
|
const Comp = renderHeaderActions;
|
33607
|
-
return /* @__PURE__ */ (0,
|
33800
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
|
33608
33801
|
};
|
33609
33802
|
return RenderHeader;
|
33610
33803
|
}
|
33611
33804
|
return defaultRender;
|
33612
33805
|
}, [renderHeader]);
|
33613
|
-
const loadedOverrides = (0,
|
33806
|
+
const loadedOverrides = (0, import_react29.useMemo)(() => {
|
33614
33807
|
return loadOverrides({ overrides, plugins });
|
33615
33808
|
}, [plugins]);
|
33616
|
-
const CustomPuck = (0,
|
33809
|
+
const CustomPuck = (0, import_react29.useMemo)(
|
33617
33810
|
() => loadedOverrides.puck || defaultRender,
|
33618
33811
|
[loadedOverrides]
|
33619
33812
|
);
|
33620
|
-
const CustomHeader = (0,
|
33813
|
+
const CustomHeader = (0, import_react29.useMemo)(
|
33621
33814
|
() => loadedOverrides.header || defaultHeaderRender,
|
33622
33815
|
[loadedOverrides]
|
33623
33816
|
);
|
33624
|
-
const CustomHeaderActions = (0,
|
33817
|
+
const CustomHeaderActions = (0, import_react29.useMemo)(
|
33625
33818
|
() => loadedOverrides.headerActions || defaultHeaderActionsRender,
|
33626
33819
|
[loadedOverrides]
|
33627
33820
|
);
|
33628
|
-
const [mounted, setMounted] = (0,
|
33629
|
-
(0,
|
33821
|
+
const [mounted, setMounted] = (0, import_react29.useState)(false);
|
33822
|
+
(0, import_react29.useEffect)(() => {
|
33630
33823
|
setMounted(true);
|
33631
33824
|
}, []);
|
33632
|
-
return /* @__PURE__ */ (0,
|
33825
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "Puck", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
33633
33826
|
AppProvider,
|
33634
33827
|
{
|
33635
33828
|
value: {
|
@@ -33644,7 +33837,7 @@ function Puck({
|
|
33644
33837
|
viewports,
|
33645
33838
|
iframe
|
33646
33839
|
},
|
33647
|
-
children: /* @__PURE__ */ (0,
|
33840
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
33648
33841
|
DragDropContext,
|
33649
33842
|
{
|
33650
33843
|
autoScrollerOptions: { disabled: dnd == null ? void 0 : dnd.disableAutoScroll },
|
@@ -33700,7 +33893,7 @@ function Puck({
|
|
33700
33893
|
});
|
33701
33894
|
}
|
33702
33895
|
},
|
33703
|
-
children: /* @__PURE__ */ (0,
|
33896
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
33704
33897
|
DropZoneProvider,
|
33705
33898
|
{
|
33706
33899
|
value: {
|
@@ -33714,7 +33907,7 @@ function Puck({
|
|
33714
33907
|
mode: "edit",
|
33715
33908
|
areaId: "root"
|
33716
33909
|
},
|
33717
|
-
children: /* @__PURE__ */ (0,
|
33910
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(CustomPuck, { children: children || /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
33718
33911
|
"div",
|
33719
33912
|
{
|
33720
33913
|
className: getClassName25({
|
@@ -33724,65 +33917,62 @@ function Puck({
|
|
33724
33917
|
rightSideBarVisible
|
33725
33918
|
}),
|
33726
33919
|
children: [
|
33727
|
-
/* @__PURE__ */ (0,
|
33728
|
-
/* @__PURE__ */ (0,
|
33920
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: getClassName25("layout"), children: [
|
33921
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
33729
33922
|
CustomHeader,
|
33730
33923
|
{
|
33731
|
-
actions: /* @__PURE__ */ (0,
|
33732
|
-
|
33733
|
-
|
33734
|
-
|
33735
|
-
|
33736
|
-
|
33737
|
-
|
33738
|
-
|
33739
|
-
|
33740
|
-
|
33741
|
-
|
33742
|
-
)
|
33743
|
-
|
33744
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("header", { className: getClassName25("header"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName25("headerInner"), children: [
|
33745
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName25("headerToggle"), children: [
|
33746
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("leftSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
33924
|
+
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)(
|
33925
|
+
Button,
|
33926
|
+
{
|
33927
|
+
onClick: () => {
|
33928
|
+
onPublish && onPublish(data);
|
33929
|
+
},
|
33930
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Globe, { size: "14px" }),
|
33931
|
+
children: "Publish"
|
33932
|
+
}
|
33933
|
+
) }) }),
|
33934
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("header", { className: getClassName25("header"), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: getClassName25("headerInner"), children: [
|
33935
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: getClassName25("headerToggle"), children: [
|
33936
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: getClassName25("leftSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
33747
33937
|
IconButton,
|
33748
33938
|
{
|
33749
33939
|
onClick: () => {
|
33750
33940
|
toggleSidebars("left");
|
33751
33941
|
},
|
33752
33942
|
title: "Toggle left sidebar",
|
33753
|
-
children: /* @__PURE__ */ (0,
|
33943
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(PanelLeft, { focusable: "false" })
|
33754
33944
|
}
|
33755
33945
|
) }),
|
33756
|
-
/* @__PURE__ */ (0,
|
33946
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: getClassName25("rightSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
33757
33947
|
IconButton,
|
33758
33948
|
{
|
33759
33949
|
onClick: () => {
|
33760
33950
|
toggleSidebars("right");
|
33761
33951
|
},
|
33762
33952
|
title: "Toggle right sidebar",
|
33763
|
-
children: /* @__PURE__ */ (0,
|
33953
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(PanelRight, { focusable: "false" })
|
33764
33954
|
}
|
33765
33955
|
) })
|
33766
33956
|
] }),
|
33767
|
-
/* @__PURE__ */ (0,
|
33957
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: getClassName25("headerTitle"), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Heading, { rank: 2, size: "xs", children: [
|
33768
33958
|
headerTitle || rootProps.title || "Page",
|
33769
|
-
headerPath && /* @__PURE__ */ (0,
|
33959
|
+
headerPath && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
|
33770
33960
|
" ",
|
33771
|
-
/* @__PURE__ */ (0,
|
33961
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("code", { className: getClassName25("headerPath"), children: headerPath })
|
33772
33962
|
] })
|
33773
33963
|
] }) }),
|
33774
|
-
/* @__PURE__ */ (0,
|
33775
|
-
/* @__PURE__ */ (0,
|
33964
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: getClassName25("headerTools"), children: [
|
33965
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: getClassName25("menuButton"), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
33776
33966
|
IconButton,
|
33777
33967
|
{
|
33778
33968
|
onClick: () => {
|
33779
33969
|
return setMenuOpen(!menuOpen);
|
33780
33970
|
},
|
33781
33971
|
title: "Toggle menu bar",
|
33782
|
-
children: menuOpen ? /* @__PURE__ */ (0,
|
33972
|
+
children: menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ChevronDown, { focusable: "false" })
|
33783
33973
|
}
|
33784
33974
|
) }),
|
33785
|
-
/* @__PURE__ */ (0,
|
33975
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
33786
33976
|
MenuBar,
|
33787
33977
|
{
|
33788
33978
|
appState,
|
@@ -33790,7 +33980,16 @@ function Puck({
|
|
33790
33980
|
dispatch,
|
33791
33981
|
onPublish,
|
33792
33982
|
menuOpen,
|
33793
|
-
renderHeaderActions: () => /* @__PURE__ */ (0,
|
33983
|
+
renderHeaderActions: () => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(CustomHeaderActions, { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
33984
|
+
Button,
|
33985
|
+
{
|
33986
|
+
onClick: () => {
|
33987
|
+
onPublish && onPublish(data);
|
33988
|
+
},
|
33989
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Globe, { size: "14px" }),
|
33990
|
+
children: "Publish"
|
33991
|
+
}
|
33992
|
+
) }),
|
33794
33993
|
setMenuOpen
|
33795
33994
|
}
|
33796
33995
|
)
|
@@ -33798,23 +33997,23 @@ function Puck({
|
|
33798
33997
|
] }) })
|
33799
33998
|
}
|
33800
33999
|
),
|
33801
|
-
/* @__PURE__ */ (0,
|
33802
|
-
/* @__PURE__ */ (0,
|
33803
|
-
/* @__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, {}) })
|
33804
34003
|
] }),
|
33805
|
-
/* @__PURE__ */ (0,
|
33806
|
-
/* @__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)(
|
33807
34006
|
SidebarSection,
|
33808
34007
|
{
|
33809
34008
|
noPadding: true,
|
33810
34009
|
noBorderTop: true,
|
33811
34010
|
showBreadcrumbs: true,
|
33812
34011
|
title: selectedItem ? (_a = config.components[selectedItem.type]["label"]) != null ? _a : selectedItem.type : "Page",
|
33813
|
-
children: /* @__PURE__ */ (0,
|
34012
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Fields, {})
|
33814
34013
|
}
|
33815
34014
|
) })
|
33816
34015
|
] }),
|
33817
|
-
/* @__PURE__ */ (0,
|
34016
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
33818
34017
|
"div",
|
33819
34018
|
{
|
33820
34019
|
id: "puck-portal-root",
|
@@ -33838,7 +34037,7 @@ Puck.Preview = Preview;
|
|
33838
34037
|
|
33839
34038
|
// components/Render/index.tsx
|
33840
34039
|
init_react_import();
|
33841
|
-
var
|
34040
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
33842
34041
|
function Render({
|
33843
34042
|
config,
|
33844
34043
|
data
|
@@ -33847,7 +34046,7 @@ function Render({
|
|
33847
34046
|
const rootProps = data.root.props || data.root;
|
33848
34047
|
const title = (rootProps == null ? void 0 : rootProps.title) || "";
|
33849
34048
|
if ((_a = config.root) == null ? void 0 : _a.render) {
|
33850
|
-
return /* @__PURE__ */ (0,
|
34049
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
33851
34050
|
config.root.render,
|
33852
34051
|
__spreadProps(__spreadValues({}, rootProps), {
|
33853
34052
|
puck: {
|
@@ -33856,11 +34055,11 @@ function Render({
|
|
33856
34055
|
title,
|
33857
34056
|
editMode: false,
|
33858
34057
|
id: "puck-root",
|
33859
|
-
children: /* @__PURE__ */ (0,
|
34058
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(DropZone, { zone: rootDroppableId })
|
33860
34059
|
})
|
33861
34060
|
) });
|
33862
34061
|
}
|
33863
|
-
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 }) });
|
33864
34063
|
}
|
33865
34064
|
|
33866
34065
|
// lib/migrate.ts
|
package/dist/rsc.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
2
|
-
import { C as Config, D as Data } from './Config-
|
2
|
+
import { C as Config, D as Data } from './Config-550396e1.js';
|
3
3
|
import 'react';
|
4
4
|
|
5
5
|
declare function Render<UserConfig extends Config = Config>({ config, data, }: {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@measured/puck",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.15.0-canary.480467a",
|
4
4
|
"author": "Measured Corporation Ltd <hello@measured.co>",
|
5
5
|
"repository": "measuredco/puck",
|
6
6
|
"bugs": "https://github.com/measuredco/puck/issues",
|
@@ -60,9 +60,10 @@
|
|
60
60
|
"typescript": "^4.5.2"
|
61
61
|
},
|
62
62
|
"dependencies": {
|
63
|
-
"@measured/auto-frame-component": "0.1.7",
|
64
63
|
"@measured/dnd": "16.6.0-canary.4cba1d1",
|
65
64
|
"deep-diff": "^1.0.2",
|
65
|
+
"object-hash": "^3.0.0",
|
66
|
+
"react-frame-component": "^5.2.6",
|
66
67
|
"react-hotkeys-hook": "^4.4.1",
|
67
68
|
"react-spinners": "^0.13.8",
|
68
69
|
"ua-parser-js": "^1.0.37",
|