@measured/puck 0.12.0-canary.5caf0ab → 0.12.0-canary.889b4c7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. package/README.md +32 -2
  2. package/dist/index.css +252 -124
  3. package/dist/index.js +254 -371
  4. package/package.json +22 -1
package/dist/index.js CHANGED
@@ -327,7 +327,7 @@ var require_react_is_development = __commonJS({
327
327
  var ContextProvider = REACT_PROVIDER_TYPE;
328
328
  var Element = REACT_ELEMENT_TYPE;
329
329
  var ForwardRef = REACT_FORWARD_REF_TYPE;
330
- var Fragment12 = REACT_FRAGMENT_TYPE;
330
+ var Fragment13 = REACT_FRAGMENT_TYPE;
331
331
  var Lazy = REACT_LAZY_TYPE;
332
332
  var Memo = REACT_MEMO_TYPE;
333
333
  var Portal = REACT_PORTAL_TYPE;
@@ -386,7 +386,7 @@ var require_react_is_development = __commonJS({
386
386
  exports.ContextProvider = ContextProvider;
387
387
  exports.Element = Element;
388
388
  exports.ForwardRef = ForwardRef;
389
- exports.Fragment = Fragment12;
389
+ exports.Fragment = Fragment13;
390
390
  exports.Lazy = Lazy;
391
391
  exports.Memo = Memo;
392
392
  exports.Portal = Portal;
@@ -760,7 +760,7 @@ var require_factoryWithTypeCheckers = __commonJS({
760
760
  function validate(props, propName, componentName, location, propFullName) {
761
761
  if (!(props[propName] instanceof expectedClass)) {
762
762
  var expectedClassName = expectedClass.name || ANONYMOUS;
763
- var actualClassName = getClassName18(props[propName]);
763
+ var actualClassName = getClassName19(props[propName]);
764
764
  return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + actualClassName + "` supplied to `" + componentName + "`, expected ") + ("instance of `" + expectedClassName + "`."));
765
765
  }
766
766
  return null;
@@ -1012,7 +1012,7 @@ var require_factoryWithTypeCheckers = __commonJS({
1012
1012
  return type;
1013
1013
  }
1014
1014
  }
1015
- function getClassName18(propValue) {
1015
+ function getClassName19(propValue) {
1016
1016
  if (!propValue.constructor || !propValue.constructor.name) {
1017
1017
  return ANONYMOUS;
1018
1018
  }
@@ -9040,7 +9040,7 @@ var require_react_dom_development = __commonJS({
9040
9040
  var HostPortal = 4;
9041
9041
  var HostComponent = 5;
9042
9042
  var HostText = 6;
9043
- var Fragment12 = 7;
9043
+ var Fragment13 = 7;
9044
9044
  var Mode = 8;
9045
9045
  var ContextConsumer = 9;
9046
9046
  var ContextProvider = 10;
@@ -10196,7 +10196,7 @@ var require_react_dom_development = __commonJS({
10196
10196
  return "DehydratedFragment";
10197
10197
  case ForwardRef:
10198
10198
  return getWrappedName$1(type, type.render, "ForwardRef");
10199
- case Fragment12:
10199
+ case Fragment13:
10200
10200
  return "Fragment";
10201
10201
  case HostComponent:
10202
10202
  return type;
@@ -19867,7 +19867,7 @@ var require_react_dom_development = __commonJS({
19867
19867
  }
19868
19868
  }
19869
19869
  function updateFragment2(returnFiber, current2, fragment, lanes, key) {
19870
- if (current2 === null || current2.tag !== Fragment12) {
19870
+ if (current2 === null || current2.tag !== Fragment13) {
19871
19871
  var created = createFiberFromFragment(fragment, returnFiber.mode, lanes, key);
19872
19872
  created.return = returnFiber;
19873
19873
  return created;
@@ -20270,7 +20270,7 @@ var require_react_dom_development = __commonJS({
20270
20270
  if (child.key === key) {
20271
20271
  var elementType = element.type;
20272
20272
  if (elementType === REACT_FRAGMENT_TYPE) {
20273
- if (child.tag === Fragment12) {
20273
+ if (child.tag === Fragment13) {
20274
20274
  deleteRemainingChildren(returnFiber, child.sibling);
20275
20275
  var existing = useFiber(child, element.props.children);
20276
20276
  existing.return = returnFiber;
@@ -24445,7 +24445,7 @@ var require_react_dom_development = __commonJS({
24445
24445
  var _resolvedProps2 = workInProgress2.elementType === type ? _unresolvedProps2 : resolveDefaultProps(type, _unresolvedProps2);
24446
24446
  return updateForwardRef(current2, workInProgress2, type, _resolvedProps2, renderLanes2);
24447
24447
  }
24448
- case Fragment12:
24448
+ case Fragment13:
24449
24449
  return updateFragment(current2, workInProgress2, renderLanes2);
24450
24450
  case Mode:
24451
24451
  return updateMode(current2, workInProgress2, renderLanes2);
@@ -24718,7 +24718,7 @@ var require_react_dom_development = __commonJS({
24718
24718
  case SimpleMemoComponent:
24719
24719
  case FunctionComponent:
24720
24720
  case ForwardRef:
24721
- case Fragment12:
24721
+ case Fragment13:
24722
24722
  case Mode:
24723
24723
  case Profiler:
24724
24724
  case ContextConsumer:
@@ -28977,7 +28977,7 @@ var require_react_dom_development = __commonJS({
28977
28977
  return fiber;
28978
28978
  }
28979
28979
  function createFiberFromFragment(elements, mode, lanes, key) {
28980
- var fiber = createFiber(Fragment12, elements, key, mode);
28980
+ var fiber = createFiber(Fragment13, elements, key, mode);
28981
28981
  fiber.lanes = lanes;
28982
28982
  return fiber;
28983
28983
  }
@@ -30125,7 +30125,7 @@ var import_react2 = require("react");
30125
30125
 
30126
30126
  // css-module:/home/runner/work/puck/puck/packages/core/components/Button/Button.module.css#css-module
30127
30127
  init_react_import();
30128
- var Button_module_default = { "Button": "_Button_1muck_1", "Button--medium": "_Button--medium_1muck_20", "Button--large": "_Button--large_1muck_27", "Button-icon": "_Button-icon_1muck_34", "Button--primary": "_Button--primary_1muck_42", "Button--secondary": "_Button--secondary_1muck_51", "Button--flush": "_Button--flush_1muck_62", "Button--disabled": "_Button--disabled_1muck_66", "Button--fullWidth": "_Button--fullWidth_1muck_76" };
30128
+ var Button_module_default = { "Button": "_Button_zx1c8_1", "Button--medium": "_Button--medium_zx1c8_21", "Button--large": "_Button--large_zx1c8_28", "Button-icon": "_Button-icon_zx1c8_35", "Button--primary": "_Button--primary_zx1c8_43", "Button--secondary": "_Button--secondary_zx1c8_52", "Button--flush": "_Button--flush_zx1c8_63", "Button--disabled": "_Button--disabled_zx1c8_67", "Button--fullWidth": "_Button--fullWidth_zx1c8_77" };
30129
30129
 
30130
30130
  // lib/get-class-name-factory.ts
30131
30131
  init_react_import();
@@ -32367,7 +32367,7 @@ init_react_import();
32367
32367
 
32368
32368
  // css-module:/home/runner/work/puck/puck/packages/core/components/InputOrGroup/styles.module.css#css-module
32369
32369
  init_react_import();
32370
- var styles_module_default3 = { "Input": "_Input_1kw16_1", "Input-label": "_Input-label_1kw16_27", "Input-labelIcon": "_Input-labelIcon_1kw16_34", "Input-disabledIcon": "_Input-disabledIcon_1kw16_40", "Input-input": "_Input-input_1kw16_45", "Input--readOnly": "_Input--readOnly_1kw16_66", "Input-radioGroupItems": "_Input-radioGroupItems_1kw16_78", "Input-radio": "_Input-radio_1kw16_78", "Input-radioInner": "_Input-radioInner_1kw16_95", "Input-radioInput": "_Input-radioInput_1kw16_117" };
32370
+ var styles_module_default3 = { "Input": "_Input_sx9jb_1", "Input-label": "_Input-label_sx9jb_27", "Input-labelIcon": "_Input-labelIcon_sx9jb_34", "Input-disabledIcon": "_Input-disabledIcon_sx9jb_40", "Input-input": "_Input-input_sx9jb_45", "Input--readOnly": "_Input--readOnly_sx9jb_66", "Input-radioGroupItems": "_Input-radioGroupItems_sx9jb_78", "Input-radio": "_Input-radio_sx9jb_78", "Input-radioInner": "_Input-radioInner_sx9jb_95", "Input-radioInput": "_Input-radioInput_sx9jb_117" };
32371
32371
 
32372
32372
  // components/InputOrGroup/index.tsx
32373
32373
  var import_react30 = require("react");
@@ -32380,7 +32380,7 @@ init_react_import();
32380
32380
 
32381
32381
  // css-module:/home/runner/work/puck/puck/packages/core/components/InputOrGroup/fields/ArrayField/styles.module.css#css-module
32382
32382
  init_react_import();
32383
- var styles_module_default4 = { "ArrayField": "_ArrayField_13rp0_5", "ArrayField--isDraggingFrom": "_ArrayField--isDraggingFrom_13rp0_13", "ArrayField-addButton": "_ArrayField-addButton_13rp0_17", "ArrayField--hasItems": "_ArrayField--hasItems_13rp0_31", "ArrayFieldItem": "_ArrayFieldItem_13rp0_45", "ArrayFieldItem--isDragging": "_ArrayFieldItem--isDragging_13rp0_53", "ArrayFieldItem--isExpanded": "_ArrayFieldItem--isExpanded_13rp0_58", "ArrayFieldItem-summary": "_ArrayFieldItem-summary_13rp0_72", "ArrayFieldItem--readOnly": "_ArrayFieldItem--readOnly_13rp0_84", "ArrayFieldItem-body": "_ArrayFieldItem-body_13rp0_105", "ArrayFieldItem-fieldset": "_ArrayFieldItem-fieldset_13rp0_113", "ArrayFieldItem-rhs": "_ArrayFieldItem-rhs_13rp0_120", "ArrayFieldItem-actions": "_ArrayFieldItem-actions_13rp0_126", "ArrayFieldItem-action": "_ArrayFieldItem-action_13rp0_126" };
32383
+ var styles_module_default4 = { "ArrayField": "_ArrayField_19z2v_5", "ArrayField--isDraggingFrom": "_ArrayField--isDraggingFrom_19z2v_13", "ArrayField-addButton": "_ArrayField-addButton_19z2v_17", "ArrayField--hasItems": "_ArrayField--hasItems_19z2v_31", "ArrayFieldItem": "_ArrayFieldItem_19z2v_45", "ArrayFieldItem--isDragging": "_ArrayFieldItem--isDragging_19z2v_53", "ArrayFieldItem--isExpanded": "_ArrayFieldItem--isExpanded_19z2v_58", "ArrayFieldItem-summary": "_ArrayFieldItem-summary_19z2v_72", "ArrayFieldItem--readOnly": "_ArrayFieldItem--readOnly_19z2v_85", "ArrayFieldItem-body": "_ArrayFieldItem-body_19z2v_106", "ArrayFieldItem-fieldset": "_ArrayFieldItem-fieldset_19z2v_114", "ArrayFieldItem-rhs": "_ArrayFieldItem-rhs_19z2v_121", "ArrayFieldItem-actions": "_ArrayFieldItem-actions_19z2v_127", "ArrayFieldItem-action": "_ArrayFieldItem-action_19z2v_127" };
32384
32384
 
32385
32385
  // components/InputOrGroup/fields/ArrayField/index.tsx
32386
32386
  var import_dnd4 = require("@hello-pangea/dnd");
@@ -33102,14 +33102,16 @@ var InputOrGroup = (_a) => {
33102
33102
  var _b = _a, { onChange } = _b, props = __objRest(_b, ["onChange"]);
33103
33103
  const { name, field, value, readOnly } = props;
33104
33104
  const [localValue, setLocalValue] = (0, import_react30.useState)(value);
33105
- const [localValueDb] = (0, import_use_debounce2.useDebounce)(localValue, 50, { leading: true });
33106
- (0, import_react30.useEffect)(() => {
33107
- if (value !== localValueDb) {
33108
- onChange(localValueDb);
33109
- }
33110
- }, [localValueDb]);
33105
+ const onChangeDb = (0, import_use_debounce2.useDebouncedCallback)(
33106
+ (val) => {
33107
+ onChange(val);
33108
+ },
33109
+ 50,
33110
+ { leading: true }
33111
+ );
33111
33112
  const onChangeLocal = (0, import_react30.useCallback)((val) => {
33112
33113
  setLocalValue(val);
33114
+ onChangeDb(val);
33113
33115
  }, []);
33114
33116
  (0, import_react30.useEffect)(() => {
33115
33117
  setLocalValue(value);
@@ -33152,7 +33154,7 @@ var import_dnd6 = require("@hello-pangea/dnd");
33152
33154
 
33153
33155
  // css-module:/home/runner/work/puck/puck/packages/core/components/ComponentList/styles.module.css#css-module
33154
33156
  init_react_import();
33155
- var styles_module_default9 = { "ComponentList": "_ComponentList_3rdy2_1", "ComponentList--isExpanded": "_ComponentList--isExpanded_3rdy2_6", "ComponentList-content": "_ComponentList-content_3rdy2_10", "ComponentList-title": "_ComponentList-title_3rdy2_18", "ComponentList-titleIcon": "_ComponentList-titleIcon_3rdy2_39", "ComponentListItem": "_ComponentListItem_3rdy2_43", "ComponentListItem-draggable": "_ComponentListItem-draggable_3rdy2_43", "ComponentListItemIcon": "_ComponentListItemIcon_3rdy2_61", "ComponentList--isDraggingFrom": "_ComponentList--isDraggingFrom_3rdy2_65" };
33157
+ var styles_module_default9 = { "ComponentList": "_ComponentList_1m8r5_1", "ComponentList--isExpanded": "_ComponentList--isExpanded_1m8r5_6", "ComponentList-content": "_ComponentList-content_1m8r5_10", "ComponentList-title": "_ComponentList-title_1m8r5_18", "ComponentList-titleIcon": "_ComponentList-titleIcon_1m8r5_39", "ComponentListItem": "_ComponentListItem_1m8r5_43", "ComponentListItem-draggable": "_ComponentListItem-draggable_1m8r5_43", "ComponentListItem-name": "_ComponentListItem-name_1m8r5_60", "ComponentList--isDraggingFrom": "_ComponentList--isDraggingFrom_1m8r5_66" };
33156
33158
 
33157
33159
  // components/ComponentList/index.tsx
33158
33160
  var import_jsx_runtime18 = require("react/jsx-runtime");
@@ -33172,7 +33174,7 @@ var ComponentListItem = ({
33172
33174
  disableAnimations: true,
33173
33175
  className: () => getClassNameItem2("draggable"),
33174
33176
  children: () => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
33175
- component,
33177
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassNameItem2("name"), children: component }),
33176
33178
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassNameItem2("icon"), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DragIcon, {}) })
33177
33179
  ] })
33178
33180
  },
@@ -33292,7 +33294,7 @@ init_react_import();
33292
33294
 
33293
33295
  // css-module:/home/runner/work/puck/puck/packages/core/components/SidebarSection/styles.module.css#css-module
33294
33296
  init_react_import();
33295
- var styles_module_default10 = { "SidebarSection": "_SidebarSection_r7dv3_1", "SidebarSection-title": "_SidebarSection-title_r7dv3_12", "SidebarSection-content": "_SidebarSection-content_r7dv3_19", "SidebarSection--noPadding": "_SidebarSection--noPadding_r7dv3_24", "SidebarSection-breadcrumbLabel": "_SidebarSection-breadcrumbLabel_r7dv3_33", "SidebarSection-breadcrumbs": "_SidebarSection-breadcrumbs_r7dv3_44", "SidebarSection-breadcrumb": "_SidebarSection-breadcrumb_r7dv3_33", "SidebarSection-heading": "_SidebarSection-heading_r7dv3_56", "SidebarSection-loadingOverlay": "_SidebarSection-loadingOverlay_r7dv3_60" };
33297
+ var styles_module_default10 = { "SidebarSection": "_SidebarSection_1uyg2_1", "SidebarSection-title": "_SidebarSection-title_1uyg2_12", "SidebarSection-content": "_SidebarSection-content_1uyg2_19", "SidebarSection--noPadding": "_SidebarSection--noPadding_1uyg2_24", "SidebarSection-breadcrumbLabel": "_SidebarSection-breadcrumbLabel_1uyg2_37", "SidebarSection-breadcrumbs": "_SidebarSection-breadcrumbs_1uyg2_48", "SidebarSection-breadcrumb": "_SidebarSection-breadcrumb_1uyg2_37", "SidebarSection-heading": "_SidebarSection-heading_1uyg2_60", "SidebarSection-loadingOverlay": "_SidebarSection-loadingOverlay_1uyg2_64" };
33296
33298
 
33297
33299
  // lib/use-breadcrumbs.ts
33298
33300
  init_react_import();
@@ -33828,7 +33830,7 @@ init_react_import();
33828
33830
 
33829
33831
  // css-module:/home/runner/work/puck/puck/packages/core/components/LayerTree/styles.module.css#css-module
33830
33832
  init_react_import();
33831
- var styles_module_default11 = { "LayerTree": "_LayerTree_1dcmd_1", "LayerTree-zoneTitle": "_LayerTree-zoneTitle_1dcmd_11", "LayerTree-helper": "_LayerTree-helper_1dcmd_17", "Layer": "_Layer_1dcmd_1", "Layer-inner": "_Layer-inner_1dcmd_29", "Layer--containsZone": "_Layer--containsZone_1dcmd_35", "Layer-clickable": "_Layer-clickable_1dcmd_39", "Layer--isSelected": "_Layer--isSelected_1dcmd_48", "Layer--isHovering": "_Layer--isHovering_1dcmd_49", "Layer-chevron": "_Layer-chevron_1dcmd_65", "Layer--childIsSelected": "_Layer--childIsSelected_1dcmd_66", "Layer-zones": "_Layer-zones_1dcmd_70", "Layer-title": "_Layer-title_1dcmd_84", "Layer-icon": "_Layer-icon_1dcmd_92", "Layer-zoneIcon": "_Layer-zoneIcon_1dcmd_97" };
33833
+ var styles_module_default11 = { "LayerTree": "_LayerTree_o89yt_1", "LayerTree-zoneTitle": "_LayerTree-zoneTitle_o89yt_11", "LayerTree-helper": "_LayerTree-helper_o89yt_17", "Layer": "_Layer_o89yt_1", "Layer-inner": "_Layer-inner_o89yt_29", "Layer--containsZone": "_Layer--containsZone_o89yt_35", "Layer-clickable": "_Layer-clickable_o89yt_39", "Layer--isSelected": "_Layer--isSelected_o89yt_48", "Layer--isHovering": "_Layer--isHovering_o89yt_49", "Layer-chevron": "_Layer-chevron_o89yt_65", "Layer--childIsSelected": "_Layer--childIsSelected_o89yt_66", "Layer-zones": "_Layer-zones_o89yt_70", "Layer-title": "_Layer-title_o89yt_84", "Layer-name": "_Layer-name_o89yt_93", "Layer-icon": "_Layer-icon_o89yt_99", "Layer-zoneIcon": "_Layer-zoneIcon_o89yt_104" };
33832
33834
 
33833
33835
  // lib/scroll-into-view.ts
33834
33836
  init_react_import();
@@ -33954,7 +33956,7 @@ var LayerTree = ({
33954
33956
  ),
33955
33957
  /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: getClassNameLayer("title"), children: [
33956
33958
  /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassNameLayer("icon"), children: item.type === "Text" || item.type === "Heading" ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(type_default, { size: "16" }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(grid_default, { size: "16" }) }),
33957
- item.type
33959
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassNameLayer("name"), children: item.type })
33958
33960
  ] })
33959
33961
  ]
33960
33962
  }
@@ -34269,8 +34271,13 @@ var useResolvedData = (data, config, dispatch) => {
34269
34271
  };
34270
34272
  };
34271
34273
 
34274
+ // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/styles.module.css#css-module
34275
+ init_react_import();
34276
+ var styles_module_default12 = { "Puck": "_Puck_vj9gy_19", "Puck--leftSideBarVisible": "_Puck--leftSideBarVisible_vj9gy_36", "Puck-header": "_Puck-header_vj9gy_72", "Puck-headerInner": "_Puck-headerInner_vj9gy_79", "Puck-headerToggle": "_Puck-headerToggle_vj9gy_89", "Puck-headerTitle": "_Puck-headerTitle_vj9gy_93", "Puck-headerPath": "_Puck-headerPath_vj9gy_97", "Puck-headerTools": "_Puck-headerTools_vj9gy_104", "Puck-leftSideBar": "_Puck-leftSideBar_vj9gy_110", "Puck-frame": "_Puck-frame_vj9gy_119", "Puck-root": "_Puck-root_vj9gy_127", "Puck-page": "_Puck-page_vj9gy_139", "Puck-rightSideBar": "_Puck-rightSideBar_vj9gy_143" };
34277
+
34272
34278
  // components/Puck/index.tsx
34273
34279
  var import_jsx_runtime22 = require("react/jsx-runtime");
34280
+ var getClassName18 = get_class_name_factory_default("Puck", styles_module_default12);
34274
34281
  var defaultPageFields = {
34275
34282
  title: { type: "text" }
34276
34283
  };
@@ -34300,7 +34307,7 @@ function Puck({
34300
34307
  }) {
34301
34308
  var _a, _b;
34302
34309
  const [reducer] = (0, import_react38.useState)(() => createReducer({ config }));
34303
- const initialAppState = __spreadProps(__spreadValues({}, defaultAppState), {
34310
+ const [initialAppState] = (0, import_react38.useState)(__spreadProps(__spreadValues({}, defaultAppState), {
34304
34311
  data: initialData,
34305
34312
  ui: __spreadProps(__spreadValues({}, defaultAppState.ui), {
34306
34313
  // Store categories under componentList on state to allow render functions and plugins to modify
@@ -34318,7 +34325,7 @@ function Puck({
34318
34325
  {}
34319
34326
  ) : {}
34320
34327
  })
34321
- });
34328
+ }));
34322
34329
  const [appState, dispatch] = (0, import_react38.useReducer)(
34323
34330
  reducer,
34324
34331
  flushZones(initialAppState)
@@ -34421,7 +34428,7 @@ function Puck({
34421
34428
  );
34422
34429
  }
34423
34430
  }, []);
34424
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "puck", children: [
34431
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { children: [
34425
34432
  /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
34426
34433
  AppProvider,
34427
34434
  {
@@ -34495,361 +34502,237 @@ function Puck({
34495
34502
  },
34496
34503
  children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(dropZoneContext.Consumer, { children: (ctx) => {
34497
34504
  var _a2, _b2;
34498
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
34499
- "div",
34500
- {
34501
- style: {
34502
- display: "grid",
34503
- gridTemplateAreas: '"header header header" "left editor right"',
34504
- gridTemplateColumns: `${leftSideBarVisible ? "288px" : "0px"} auto 288px`,
34505
- gridTemplateRows: "min-content auto",
34506
- height: "100vh",
34507
- position: "fixed",
34508
- top: 0,
34509
- bottom: 0,
34510
- left: 0,
34511
- right: 0
34512
- },
34513
- children: [
34514
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
34515
- "header",
34516
- {
34517
- style: {
34518
- gridArea: "header",
34519
- color: "var(--puck-color-black)",
34520
- background: "var(--puck-color-white)",
34521
- borderBottom: "1px solid var(--puck-color-grey-8)"
34522
- },
34523
- children: renderHeader ? renderHeader({
34505
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: getClassName18({ leftSideBarVisible }), children: [
34506
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("header", { className: getClassName18("header"), children: renderHeader ? renderHeader({
34507
+ children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
34508
+ Button,
34509
+ {
34510
+ onClick: () => {
34511
+ onPublish(data);
34512
+ },
34513
+ icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(globe_default, { size: "14px" }),
34514
+ children: "Publish"
34515
+ }
34516
+ ),
34517
+ dispatch,
34518
+ state: appState
34519
+ }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: getClassName18("headerInner"), children: [
34520
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: getClassName18("headerToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
34521
+ IconButton,
34522
+ {
34523
+ onClick: () => dispatch({
34524
+ type: "setUi",
34525
+ ui: {
34526
+ leftSideBarVisible: !leftSideBarVisible
34527
+ }
34528
+ }),
34529
+ title: "Toggle left sidebar",
34530
+ children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(sidebar_default, {})
34531
+ }
34532
+ ) }),
34533
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: getClassName18("headerTitle"), children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Heading, { rank: 2, size: "xs", children: [
34534
+ headerTitle || rootProps.title || "Page",
34535
+ headerPath && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
34536
+ " ",
34537
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("code", { className: getClassName18("headerPath"), children: headerPath })
34538
+ ] })
34539
+ ] }) }),
34540
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: getClassName18("headerTools"), children: [
34541
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { style: { display: "flex" }, children: [
34542
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
34543
+ IconButton,
34544
+ {
34545
+ title: "undo",
34546
+ disabled: !canRewind,
34547
+ onClick: rewind,
34524
34548
  children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
34525
- Button,
34549
+ chevron_left_default,
34526
34550
  {
34527
- onClick: () => {
34528
- onPublish(data);
34529
- },
34530
- icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(globe_default, { size: "14px" }),
34531
- children: "Publish"
34551
+ size: 21,
34552
+ stroke: canRewind ? "var(--puck-color-black)" : "var(--puck-color-grey-7)"
34532
34553
  }
34533
- ),
34534
- dispatch,
34535
- state: appState
34536
- }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
34537
- "div",
34538
- {
34539
- style: {
34540
- display: "grid",
34541
- padding: 16,
34542
- gridTemplateAreas: '"left middle right"',
34543
- gridTemplateColumns: "344px auto 344px",
34544
- gridTemplateRows: "auto"
34545
- },
34546
- children: [
34547
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
34548
- "div",
34549
- {
34550
- style: {
34551
- display: "flex",
34552
- gap: 16
34553
- },
34554
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
34555
- IconButton,
34556
- {
34557
- onClick: () => dispatch({
34558
- type: "setUi",
34559
- ui: {
34560
- leftSideBarVisible: !leftSideBarVisible
34561
- }
34562
- }),
34563
- title: "Toggle left sidebar",
34564
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(sidebar_default, {})
34565
- }
34566
- )
34567
- }
34568
- ),
34569
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
34570
- "div",
34571
- {
34572
- style: {
34573
- display: "flex",
34574
- justifyContent: "center",
34575
- alignItems: "center"
34576
- },
34577
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Heading, { rank: 2, size: "xs", children: [
34578
- headerTitle || rootProps.title || "Page",
34579
- headerPath && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
34580
- "small",
34581
- {
34582
- style: { fontWeight: 400, marginLeft: 4 },
34583
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("code", { children: headerPath })
34584
- }
34585
- )
34586
- ] })
34587
- }
34588
- ),
34589
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
34590
- "div",
34591
- {
34592
- style: {
34593
- display: "flex",
34594
- gap: 16,
34595
- justifyContent: "flex-end"
34596
- },
34597
- children: [
34598
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { style: { display: "flex" }, children: [
34599
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
34600
- IconButton,
34601
- {
34602
- title: "undo",
34603
- disabled: !canRewind,
34604
- onClick: rewind,
34605
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
34606
- chevron_left_default,
34607
- {
34608
- size: 21,
34609
- stroke: canRewind ? "var(--puck-color-black)" : "var(--puck-color-grey-7)"
34610
- }
34611
- )
34612
- }
34613
- ),
34614
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
34615
- IconButton,
34616
- {
34617
- title: "redo",
34618
- disabled: !canForward,
34619
- onClick: forward,
34620
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
34621
- chevron_right_default,
34622
- {
34623
- size: 21,
34624
- stroke: canForward ? "var(--puck-color-black)" : "var(--puck-color-grey-7)"
34625
- }
34626
- )
34627
- }
34628
- )
34629
- ] }),
34630
- renderHeaderActions && renderHeaderActions({
34631
- state: appState,
34632
- dispatch
34633
- }),
34634
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
34635
- Button,
34636
- {
34637
- onClick: () => {
34638
- onPublish(data);
34639
- },
34640
- icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(globe_default, { size: "14px" }),
34641
- children: "Publish"
34642
- }
34643
- )
34644
- ]
34645
- }
34646
- )
34647
- ]
34648
- }
34649
- )
34650
- }
34651
- ),
34652
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
34653
- "div",
34554
+ )
34555
+ }
34556
+ ),
34557
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
34558
+ IconButton,
34559
+ {
34560
+ title: "redo",
34561
+ disabled: !canForward,
34562
+ onClick: forward,
34563
+ children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
34564
+ chevron_right_default,
34565
+ {
34566
+ size: 21,
34567
+ stroke: canForward ? "var(--puck-color-black)" : "var(--puck-color-grey-7)"
34568
+ }
34569
+ )
34570
+ }
34571
+ )
34572
+ ] }),
34573
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { children: renderHeaderActions && renderHeaderActions({
34574
+ state: appState,
34575
+ dispatch
34576
+ }) }),
34577
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
34578
+ Button,
34654
34579
  {
34655
- style: {
34656
- gridArea: "left",
34657
- background: "var(--puck-color-grey-11)",
34658
- borderRight: "1px solid var(--puck-color-grey-8)",
34659
- overflowY: "auto",
34660
- display: "flex",
34661
- flexDirection: "column"
34580
+ onClick: () => {
34581
+ onPublish(data);
34662
34582
  },
34663
- children: [
34664
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(SidebarSection, { title: "Components", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ComponentListWrapper, { children: componentList ? componentList : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ComponentList, { id: "all" }) }) }),
34665
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(SidebarSection, { title: "Outline", children: [
34666
- (ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
34667
- LayerTree,
34668
- {
34669
- data,
34670
- label: areaContainsZones(data, "root") ? rootDroppableId : "",
34671
- zoneContent: data.content,
34672
- setItemSelector,
34673
- itemSelector
34674
- }
34675
- ),
34676
- Object.entries(findZonesForArea(data, "root")).map(
34677
- ([zoneKey, zone]) => {
34678
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
34679
- LayerTree,
34680
- {
34681
- data,
34682
- label: zoneKey,
34683
- zone: zoneKey,
34684
- zoneContent: zone,
34685
- setItemSelector,
34686
- itemSelector
34687
- },
34688
- zoneKey
34689
- );
34690
- }
34691
- )
34692
- ] })
34693
- ]
34583
+ icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(globe_default, { size: "14px" }),
34584
+ children: "Publish"
34694
34585
  }
34695
- ),
34696
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
34697
- "div",
34586
+ ) })
34587
+ ] })
34588
+ ] }) }),
34589
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: getClassName18("leftSideBar"), children: [
34590
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(SidebarSection, { title: "Components", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ComponentListWrapper, { children: componentList ? componentList : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ComponentList, { id: "all" }) }) }),
34591
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(SidebarSection, { title: "Outline", children: [
34592
+ (ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
34593
+ LayerTree,
34698
34594
  {
34699
- style: {
34700
- overflowY: "auto",
34701
- gridArea: "editor",
34702
- position: "relative",
34703
- display: "flex",
34704
- flexDirection: "column"
34705
- },
34706
- onClick: () => setItemSelector(null),
34707
- id: "puck-frame",
34708
- children: [
34709
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
34710
- "div",
34711
- {
34712
- className: "puck-root",
34713
- style: {
34714
- boxShadow: "0px 0px 0px 32px var(--puck-color-grey-10)",
34715
- margin: 32,
34716
- zoom: 0.75
34717
- },
34718
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
34719
- "div",
34720
- {
34721
- style: {
34722
- border: "1px solid var(--puck-color-grey-8)"
34723
- },
34724
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
34725
- Page,
34726
- __spreadProps(__spreadValues({
34727
- dispatch,
34728
- state: appState
34729
- }, data.root), {
34730
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropZone, { zone: rootDroppableId })
34731
- })
34732
- )
34733
- }
34734
- )
34735
- }
34736
- ),
34737
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
34738
- "div",
34739
- {
34740
- style: {
34741
- background: "var(--puck-color-grey-10)",
34742
- height: "100%",
34743
- flexGrow: 1
34744
- }
34745
- }
34746
- )
34747
- ]
34595
+ data,
34596
+ label: areaContainsZones(data, "root") ? rootDroppableId : "",
34597
+ zoneContent: data.content,
34598
+ setItemSelector,
34599
+ itemSelector
34748
34600
  }
34749
34601
  ),
34750
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
34751
- "div",
34752
- {
34753
- style: {
34754
- borderLeft: "1px solid var(--puck-color-grey-8)",
34755
- overflowY: "auto",
34756
- gridArea: "right",
34757
- fontFamily: "var(--puck-font-stack)",
34758
- display: "flex",
34759
- flexDirection: "column",
34760
- background: "var(--puck-color-white)"
34761
- },
34762
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(FieldWrapper, { dispatch, state: appState, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
34763
- SidebarSection,
34602
+ Object.entries(findZonesForArea(data, "root")).map(
34603
+ ([zoneKey, zone]) => {
34604
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
34605
+ LayerTree,
34764
34606
  {
34765
- noPadding: true,
34766
- showBreadcrumbs: true,
34767
- title: selectedItem ? selectedItem.type : "Page",
34768
- isLoading: selectedItem ? (_a2 = componentState[selectedItem == null ? void 0 : selectedItem.props.id]) == null ? void 0 : _a2.loading : (_b2 = componentState["puck-root"]) == null ? void 0 : _b2.loading,
34769
- children: Object.keys(fields).map((fieldName) => {
34770
- const field = fields[fieldName];
34771
- const onChange2 = (value) => {
34772
- var _a3, _b3;
34773
- let currentProps;
34774
- if (selectedItem) {
34775
- currentProps = selectedItem.props;
34776
- } else {
34777
- currentProps = data.root;
34778
- }
34779
- const newProps = __spreadProps(__spreadValues({}, currentProps), {
34780
- [fieldName]: value
34781
- });
34782
- if (itemSelector) {
34783
- const action = {
34784
- type: "replace",
34785
- destinationIndex: itemSelector.index,
34786
- destinationZone: itemSelector.zone || rootDroppableId,
34787
- data: __spreadProps(__spreadValues({}, selectedItem), { props: newProps })
34788
- };
34789
- if ((_a3 = config.components[selectedItem.type]) == null ? void 0 : _a3.resolveData) {
34790
- resolveData(replaceAction(data, action));
34791
- } else {
34792
- dispatch(action);
34793
- }
34794
- } else {
34795
- if (data.root.props) {
34796
- if ((_b3 = config.root) == null ? void 0 : _b3.resolveData) {
34797
- resolveData(__spreadProps(__spreadValues({}, data), {
34798
- root: { props: { newProps } }
34799
- }));
34800
- } else {
34801
- dispatch({
34802
- type: "setData",
34803
- data: { root: { props: { newProps } } }
34804
- });
34805
- }
34806
- } else {
34807
- dispatch({
34808
- type: "setData",
34809
- data: { root: newProps }
34810
- });
34811
- }
34812
- }
34813
- };
34814
- if (selectedItem && itemSelector) {
34815
- const { readOnly = {} } = selectedItem;
34816
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
34817
- InputOrGroup,
34818
- {
34819
- field,
34820
- name: fieldName,
34821
- label: field.label,
34822
- readOnly: readOnly[fieldName],
34823
- readOnlyFields: readOnly,
34824
- value: selectedItem.props[fieldName],
34825
- onChange: onChange2
34826
- },
34827
- `${selectedItem.props.id}_${fieldName}`
34828
- );
34829
- } else {
34830
- const { readOnly = {} } = data.root;
34831
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
34832
- InputOrGroup,
34833
- {
34834
- field,
34835
- name: fieldName,
34836
- label: field.label,
34837
- readOnly: readOnly[fieldName],
34838
- readOnlyFields: readOnly,
34839
- value: rootProps[fieldName],
34840
- onChange: onChange2
34841
- },
34842
- `page_${fieldName}`
34843
- );
34844
- }
34845
- })
34846
- }
34847
- ) })
34607
+ data,
34608
+ label: zoneKey,
34609
+ zone: zoneKey,
34610
+ zoneContent: zone,
34611
+ setItemSelector,
34612
+ itemSelector
34613
+ },
34614
+ zoneKey
34615
+ );
34848
34616
  }
34849
34617
  )
34850
- ]
34851
- }
34852
- );
34618
+ ] })
34619
+ ] }),
34620
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
34621
+ "div",
34622
+ {
34623
+ className: getClassName18("frame"),
34624
+ onClick: () => setItemSelector(null),
34625
+ id: "puck-frame",
34626
+ children: [
34627
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: getClassName18("root"), children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: getClassName18("page"), children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
34628
+ Page,
34629
+ __spreadProps(__spreadValues({
34630
+ dispatch,
34631
+ state: appState
34632
+ }, data.root), {
34633
+ children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropZone, { zone: rootDroppableId })
34634
+ })
34635
+ ) }) }),
34636
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
34637
+ "div",
34638
+ {
34639
+ style: {
34640
+ background: "var(--puck-color-grey-10)",
34641
+ height: "100%",
34642
+ flexGrow: 1
34643
+ }
34644
+ }
34645
+ )
34646
+ ]
34647
+ }
34648
+ ),
34649
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: getClassName18("rightSideBar"), children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(FieldWrapper, { dispatch, state: appState, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
34650
+ SidebarSection,
34651
+ {
34652
+ noPadding: true,
34653
+ showBreadcrumbs: true,
34654
+ title: selectedItem ? selectedItem.type : "Page",
34655
+ isLoading: selectedItem ? (_a2 = componentState[selectedItem == null ? void 0 : selectedItem.props.id]) == null ? void 0 : _a2.loading : (_b2 = componentState["puck-root"]) == null ? void 0 : _b2.loading,
34656
+ children: Object.keys(fields).map((fieldName) => {
34657
+ const field = fields[fieldName];
34658
+ const onChange2 = (value) => {
34659
+ var _a3, _b3;
34660
+ let currentProps;
34661
+ if (selectedItem) {
34662
+ currentProps = selectedItem.props;
34663
+ } else {
34664
+ currentProps = data.root;
34665
+ }
34666
+ const newProps = __spreadProps(__spreadValues({}, currentProps), {
34667
+ [fieldName]: value
34668
+ });
34669
+ if (itemSelector) {
34670
+ const action = {
34671
+ type: "replace",
34672
+ destinationIndex: itemSelector.index,
34673
+ destinationZone: itemSelector.zone || rootDroppableId,
34674
+ data: __spreadProps(__spreadValues({}, selectedItem), { props: newProps })
34675
+ };
34676
+ if ((_a3 = config.components[selectedItem.type]) == null ? void 0 : _a3.resolveData) {
34677
+ resolveData(replaceAction(data, action));
34678
+ } else {
34679
+ dispatch(action);
34680
+ }
34681
+ } else {
34682
+ if (data.root.props) {
34683
+ if ((_b3 = config.root) == null ? void 0 : _b3.resolveData) {
34684
+ resolveData(__spreadProps(__spreadValues({}, data), {
34685
+ root: { props: { newProps } }
34686
+ }));
34687
+ } else {
34688
+ dispatch({
34689
+ type: "setData",
34690
+ data: { root: { props: { newProps } } }
34691
+ });
34692
+ }
34693
+ } else {
34694
+ dispatch({
34695
+ type: "setData",
34696
+ data: { root: newProps }
34697
+ });
34698
+ }
34699
+ }
34700
+ };
34701
+ if (selectedItem && itemSelector) {
34702
+ const { readOnly = {} } = selectedItem;
34703
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
34704
+ InputOrGroup,
34705
+ {
34706
+ field,
34707
+ name: fieldName,
34708
+ label: field.label,
34709
+ readOnly: readOnly[fieldName],
34710
+ readOnlyFields: readOnly,
34711
+ value: selectedItem.props[fieldName],
34712
+ onChange: onChange2
34713
+ },
34714
+ `${selectedItem.props.id}_${fieldName}`
34715
+ );
34716
+ } else {
34717
+ const { readOnly = {} } = data.root;
34718
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
34719
+ InputOrGroup,
34720
+ {
34721
+ field,
34722
+ name: fieldName,
34723
+ label: field.label,
34724
+ readOnly: readOnly[fieldName],
34725
+ readOnlyFields: readOnly,
34726
+ value: rootProps[fieldName],
34727
+ onChange: onChange2
34728
+ },
34729
+ `page_${fieldName}`
34730
+ );
34731
+ }
34732
+ })
34733
+ }
34734
+ ) }) })
34735
+ ] });
34853
34736
  } })
34854
34737
  }
34855
34738
  )