@puckeditor/core 0.22.2 → 0.22.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11039,6 +11039,7 @@ var PluginTab = ({
11039
11039
  return /* @__PURE__ */ jsx55("div", { className: getPluginTabClassName({ visible, mobileOnly }), children: /* @__PURE__ */ jsx55("div", { className: getPluginTabClassName("body"), children }) });
11040
11040
  };
11041
11041
  var Layout = ({ children }) => {
11042
+ var _a, _b;
11042
11043
  const {
11043
11044
  iframe: _iframe,
11044
11045
  dnd,
@@ -11122,11 +11123,10 @@ var Layout = ({ children }) => {
11122
11123
  }
11123
11124
  const setUi = useAppStore((s) => s.setUi);
11124
11125
  const currentPlugin = useAppStore((s) => {
11125
- var _a;
11126
- return (_a = s.state.ui.plugin) == null ? void 0 : _a.current;
11126
+ var _a2;
11127
+ return (_a2 = s.state.ui.plugin) == null ? void 0 : _a2.current;
11127
11128
  });
11128
11129
  const appStoreApi = useAppStoreApi();
11129
- const [mobilePanelHeightMode, setMobilePanelHeightMode] = useState23("toggle");
11130
11130
  const hasLegacySideBarPlugin = useMemo24(
11131
11131
  () => !!(plugins == null ? void 0 : plugins.find((p) => p.name === "legacy-side-bar")),
11132
11132
  [plugins]
@@ -11143,17 +11143,15 @@ var Layout = ({ children }) => {
11143
11143
  combinedPlugins.push(fieldsPlugin());
11144
11144
  }
11145
11145
  combinedPlugins == null ? void 0 : combinedPlugins.forEach((plugin) => {
11146
- var _a, _b;
11146
+ var _a2, _b2, _c;
11147
11147
  if (plugin.name && plugin.render) {
11148
11148
  if (details[plugin.name]) {
11149
11149
  delete details[plugin.name];
11150
11150
  }
11151
11151
  details[plugin.name] = {
11152
- label: (_a = plugin.label) != null ? _a : plugin.name,
11153
- icon: (_b = plugin.icon) != null ? _b : /* @__PURE__ */ jsx55(ToyBrick, {}),
11152
+ label: (_a2 = plugin.label) != null ? _a2 : plugin.name,
11153
+ icon: (_b2 = plugin.icon) != null ? _b2 : /* @__PURE__ */ jsx55(ToyBrick, {}),
11154
11154
  onClick: () => {
11155
- var _a2;
11156
- setMobilePanelHeightMode((_a2 = plugin.mobilePanelHeight) != null ? _a2 : "toggle");
11157
11155
  if (plugin.name === currentPlugin) {
11158
11156
  if (leftSideBarVisible) {
11159
11157
  setUi({ leftSideBarVisible: false });
@@ -11171,6 +11169,7 @@ var Layout = ({ children }) => {
11171
11169
  },
11172
11170
  isActive: leftSideBarVisible && currentPlugin === plugin.name,
11173
11171
  render: plugin.render,
11172
+ mobilePanelHeight: (_c = plugin.mobilePanelHeight) != null ? _c : "toggle",
11174
11173
  mobileOnly: hasLegacySideBarPlugin || plugin.mobileOnly,
11175
11174
  desktopOnly: plugin.name === "legacy-side-bar" || plugin.desktopOnly
11176
11175
  };
@@ -11178,6 +11177,8 @@ var Layout = ({ children }) => {
11178
11177
  });
11179
11178
  return details;
11180
11179
  }, [plugins, currentPlugin, appStoreApi, leftSideBarVisible]);
11180
+ const activePlugin = currentPlugin != null ? currentPlugin : Object.keys(pluginItems)[0];
11181
+ const mobilePanelHeightMode = (_b = (_a = pluginItems[activePlugin]) == null ? void 0 : _a.mobilePanelHeight) != null ? _b : "toggle";
11181
11182
  useEffect28(() => {
11182
11183
  if (!currentPlugin) {
11183
11184
  const names = Object.keys(pluginItems);
@@ -11187,8 +11188,8 @@ var Layout = ({ children }) => {
11187
11188
  const hasDesktopFieldsPlugin = pluginItems["fields"] && pluginItems["fields"].mobileOnly === false;
11188
11189
  const mobilePanelExpanded = useAppStore(
11189
11190
  (s) => {
11190
- var _a;
11191
- return (_a = s.state.ui.mobilePanelExpanded) != null ? _a : false;
11191
+ var _a2;
11192
+ return (_a2 = s.state.ui.mobilePanelExpanded) != null ? _a2 : false;
11192
11193
  }
11193
11194
  );
11194
11195
  return /* @__PURE__ */ jsxs23(
package/dist/index.js CHANGED
@@ -16973,6 +16973,7 @@ var PluginTab = ({
16973
16973
  return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: getPluginTabClassName({ visible, mobileOnly }), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: getPluginTabClassName("body"), children }) });
16974
16974
  };
16975
16975
  var Layout = ({ children }) => {
16976
+ var _a, _b;
16976
16977
  const {
16977
16978
  iframe: _iframe,
16978
16979
  dnd,
@@ -17056,11 +17057,10 @@ var Layout = ({ children }) => {
17056
17057
  }
17057
17058
  const setUi = useAppStore((s) => s.setUi);
17058
17059
  const currentPlugin = useAppStore((s) => {
17059
- var _a;
17060
- return (_a = s.state.ui.plugin) == null ? void 0 : _a.current;
17060
+ var _a2;
17061
+ return (_a2 = s.state.ui.plugin) == null ? void 0 : _a2.current;
17061
17062
  });
17062
17063
  const appStoreApi = useAppStoreApi();
17063
- const [mobilePanelHeightMode, setMobilePanelHeightMode] = (0, import_react94.useState)("toggle");
17064
17064
  const hasLegacySideBarPlugin = (0, import_react94.useMemo)(
17065
17065
  () => !!(plugins == null ? void 0 : plugins.find((p) => p.name === "legacy-side-bar")),
17066
17066
  [plugins]
@@ -17077,17 +17077,15 @@ var Layout = ({ children }) => {
17077
17077
  combinedPlugins.push(fieldsPlugin());
17078
17078
  }
17079
17079
  combinedPlugins == null ? void 0 : combinedPlugins.forEach((plugin) => {
17080
- var _a, _b;
17080
+ var _a2, _b2, _c;
17081
17081
  if (plugin.name && plugin.render) {
17082
17082
  if (details[plugin.name]) {
17083
17083
  delete details[plugin.name];
17084
17084
  }
17085
17085
  details[plugin.name] = {
17086
- label: (_a = plugin.label) != null ? _a : plugin.name,
17087
- icon: (_b = plugin.icon) != null ? _b : /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToyBrick, {}),
17086
+ label: (_a2 = plugin.label) != null ? _a2 : plugin.name,
17087
+ icon: (_b2 = plugin.icon) != null ? _b2 : /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToyBrick, {}),
17088
17088
  onClick: () => {
17089
- var _a2;
17090
- setMobilePanelHeightMode((_a2 = plugin.mobilePanelHeight) != null ? _a2 : "toggle");
17091
17089
  if (plugin.name === currentPlugin) {
17092
17090
  if (leftSideBarVisible) {
17093
17091
  setUi({ leftSideBarVisible: false });
@@ -17105,6 +17103,7 @@ var Layout = ({ children }) => {
17105
17103
  },
17106
17104
  isActive: leftSideBarVisible && currentPlugin === plugin.name,
17107
17105
  render: plugin.render,
17106
+ mobilePanelHeight: (_c = plugin.mobilePanelHeight) != null ? _c : "toggle",
17108
17107
  mobileOnly: hasLegacySideBarPlugin || plugin.mobileOnly,
17109
17108
  desktopOnly: plugin.name === "legacy-side-bar" || plugin.desktopOnly
17110
17109
  };
@@ -17112,6 +17111,8 @@ var Layout = ({ children }) => {
17112
17111
  });
17113
17112
  return details;
17114
17113
  }, [plugins, currentPlugin, appStoreApi, leftSideBarVisible]);
17114
+ const activePlugin = currentPlugin != null ? currentPlugin : Object.keys(pluginItems)[0];
17115
+ const mobilePanelHeightMode = (_b = (_a = pluginItems[activePlugin]) == null ? void 0 : _a.mobilePanelHeight) != null ? _b : "toggle";
17115
17116
  (0, import_react94.useEffect)(() => {
17116
17117
  if (!currentPlugin) {
17117
17118
  const names = Object.keys(pluginItems);
@@ -17121,8 +17122,8 @@ var Layout = ({ children }) => {
17121
17122
  const hasDesktopFieldsPlugin = pluginItems["fields"] && pluginItems["fields"].mobileOnly === false;
17122
17123
  const mobilePanelExpanded = useAppStore(
17123
17124
  (s) => {
17124
- var _a;
17125
- return (_a = s.state.ui.mobilePanelExpanded) != null ? _a : false;
17125
+ var _a2;
17126
+ return (_a2 = s.state.ui.mobilePanelExpanded) != null ? _a2 : false;
17126
17127
  }
17127
17128
  );
17128
17129
  return /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(
package/dist/index.mjs CHANGED
@@ -17,7 +17,7 @@ import {
17
17
  setDeep,
18
18
  useGetPuck,
19
19
  usePuck
20
- } from "./chunk-CGHMSBNM.mjs";
20
+ } from "./chunk-WH6PO5ND.mjs";
21
21
  import "./chunk-PRZEIT36.mjs";
22
22
  import {
23
23
  migrate,
@@ -16973,6 +16973,7 @@ var PluginTab = ({
16973
16973
  return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: getPluginTabClassName({ visible, mobileOnly }), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: getPluginTabClassName("body"), children }) });
16974
16974
  };
16975
16975
  var Layout = ({ children }) => {
16976
+ var _a, _b;
16976
16977
  const {
16977
16978
  iframe: _iframe,
16978
16979
  dnd,
@@ -17056,11 +17057,10 @@ var Layout = ({ children }) => {
17056
17057
  }
17057
17058
  const setUi = useAppStore((s) => s.setUi);
17058
17059
  const currentPlugin = useAppStore((s) => {
17059
- var _a;
17060
- return (_a = s.state.ui.plugin) == null ? void 0 : _a.current;
17060
+ var _a2;
17061
+ return (_a2 = s.state.ui.plugin) == null ? void 0 : _a2.current;
17061
17062
  });
17062
17063
  const appStoreApi = useAppStoreApi();
17063
- const [mobilePanelHeightMode, setMobilePanelHeightMode] = (0, import_react94.useState)("toggle");
17064
17064
  const hasLegacySideBarPlugin = (0, import_react94.useMemo)(
17065
17065
  () => !!(plugins == null ? void 0 : plugins.find((p) => p.name === "legacy-side-bar")),
17066
17066
  [plugins]
@@ -17077,17 +17077,15 @@ var Layout = ({ children }) => {
17077
17077
  combinedPlugins.push(fieldsPlugin());
17078
17078
  }
17079
17079
  combinedPlugins == null ? void 0 : combinedPlugins.forEach((plugin) => {
17080
- var _a, _b;
17080
+ var _a2, _b2, _c;
17081
17081
  if (plugin.name && plugin.render) {
17082
17082
  if (details[plugin.name]) {
17083
17083
  delete details[plugin.name];
17084
17084
  }
17085
17085
  details[plugin.name] = {
17086
- label: (_a = plugin.label) != null ? _a : plugin.name,
17087
- icon: (_b = plugin.icon) != null ? _b : /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToyBrick, {}),
17086
+ label: (_a2 = plugin.label) != null ? _a2 : plugin.name,
17087
+ icon: (_b2 = plugin.icon) != null ? _b2 : /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToyBrick, {}),
17088
17088
  onClick: () => {
17089
- var _a2;
17090
- setMobilePanelHeightMode((_a2 = plugin.mobilePanelHeight) != null ? _a2 : "toggle");
17091
17089
  if (plugin.name === currentPlugin) {
17092
17090
  if (leftSideBarVisible) {
17093
17091
  setUi({ leftSideBarVisible: false });
@@ -17105,6 +17103,7 @@ var Layout = ({ children }) => {
17105
17103
  },
17106
17104
  isActive: leftSideBarVisible && currentPlugin === plugin.name,
17107
17105
  render: plugin.render,
17106
+ mobilePanelHeight: (_c = plugin.mobilePanelHeight) != null ? _c : "toggle",
17108
17107
  mobileOnly: hasLegacySideBarPlugin || plugin.mobileOnly,
17109
17108
  desktopOnly: plugin.name === "legacy-side-bar" || plugin.desktopOnly
17110
17109
  };
@@ -17112,6 +17111,8 @@ var Layout = ({ children }) => {
17112
17111
  });
17113
17112
  return details;
17114
17113
  }, [plugins, currentPlugin, appStoreApi, leftSideBarVisible]);
17114
+ const activePlugin = currentPlugin != null ? currentPlugin : Object.keys(pluginItems)[0];
17115
+ const mobilePanelHeightMode = (_b = (_a = pluginItems[activePlugin]) == null ? void 0 : _a.mobilePanelHeight) != null ? _b : "toggle";
17115
17116
  (0, import_react94.useEffect)(() => {
17116
17117
  if (!currentPlugin) {
17117
17118
  const names = Object.keys(pluginItems);
@@ -17121,8 +17122,8 @@ var Layout = ({ children }) => {
17121
17122
  const hasDesktopFieldsPlugin = pluginItems["fields"] && pluginItems["fields"].mobileOnly === false;
17122
17123
  const mobilePanelExpanded = useAppStore(
17123
17124
  (s) => {
17124
- var _a;
17125
- return (_a = s.state.ui.mobilePanelExpanded) != null ? _a : false;
17125
+ var _a2;
17126
+ return (_a2 = s.state.ui.mobilePanelExpanded) != null ? _a2 : false;
17126
17127
  }
17127
17128
  );
17128
17129
  return /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(
@@ -17,7 +17,7 @@ import {
17
17
  setDeep,
18
18
  useGetPuck,
19
19
  usePuck
20
- } from "./chunk-CGHMSBNM.mjs";
20
+ } from "./chunk-WH6PO5ND.mjs";
21
21
  import "./chunk-PRZEIT36.mjs";
22
22
  import {
23
23
  migrate,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@puckeditor/core",
3
- "version": "0.22.2",
3
+ "version": "0.22.3",
4
4
  "description": "The open-source visual editor for React",
5
5
  "author": "Chris Villa <chris@puckeditor.com>",
6
6
  "repository": "puckeditor/puck",