@raketa-builder/builder 1.5.2 → 1.5.8

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.
@@ -64,7 +64,7 @@ const PageBuilder = ({
64
64
  onExit,
65
65
  canvasClassName = "",
66
66
  notifications,
67
- autoSave
67
+ autoSave = true
68
68
  }) => {
69
69
  const [page, setPage] = React.useState(initialPage);
70
70
  const [preloadedData, setPreloadedData] = React.useState(preloaded);
@@ -75,9 +75,9 @@ const PageBuilder = ({
75
75
  const [selectedWidgets, setSelectedWidgets] = React.useState([]);
76
76
  const [autoSaveActive, setAutoSaveActive] = React.useState(() => {
77
77
  if (typeof window === "undefined") {
78
- return true;
78
+ return autoSave;
79
79
  }
80
- return getAutosavePreference();
80
+ return autoSave && getAutosavePreference();
81
81
  });
82
82
  const [dirty, setDirty] = React.useState(false);
83
83
  const [numberOfCopies, setNumberOfCopies] = React.useState(0);
@@ -78,9 +78,9 @@ const AdminSidebar = ({
78
78
  clipboardCopiesCount,
79
79
  handleAutoSaveState,
80
80
  autoSaveActive,
81
+ autoSave,
81
82
  dirty,
82
- onSave,
83
- autoSave
83
+ onSave
84
84
  }) => {
85
85
  const { adminLibrary } = React.useContext(LibraryContext);
86
86
  const activeUndo = historyIndex > 0;
@@ -129,30 +129,27 @@ const AdminSidebar = ({
129
129
  onClick: activeRedo ? redoChanges : null
130
130
  }
131
131
  ) }),
132
- /* @__PURE__ */ jsx(NavItem, { children: /* @__PURE__ */ jsx(
132
+ autoSave && /* @__PURE__ */ jsx(NavItem, { children: /* @__PURE__ */ jsx(
133
133
  NavButton,
134
134
  {
135
135
  tooltip: autoSaveActive ? "Auto save on" : "Auto save off",
136
136
  icon: ICONS.autoSave,
137
- autoSaveEnabled: autoSaveActive,
138
137
  variant: "autosave",
139
- autoSave,
140
138
  hasChanges: autoSaveActive,
141
139
  onClick: () => {
142
140
  handleAutoSaveState();
143
141
  }
144
142
  }
145
143
  ) }),
146
- /* @__PURE__ */ jsx(NavItem, { children: /* @__PURE__ */ jsx(
144
+ (!autoSave || !autoSaveActive) && /* @__PURE__ */ jsx(NavItem, { children: /* @__PURE__ */ jsx(
147
145
  NavButton,
148
146
  {
149
147
  tooltip: "Save page",
150
148
  icon: ICONS.save,
151
- autoSaveEnabled: autoSaveActive,
152
149
  variant: "save",
150
+ hasChanges: dirty,
153
151
  success: dirty,
154
- onClick: onSave,
155
- autoSave
152
+ onClick: onSave
156
153
  }
157
154
  ) }),
158
155
  buttons && buttons.map((button) => {
@@ -1,4 +1,4 @@
1
- import '../chunk-BBZEL7EG.js';
1
+ import { __spreadProps, __spreadValues } from '../chunk-BBZEL7EG.js';
2
2
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
3
3
  import React from 'react';
4
4
  import AdminWidgetWrapper from './AdminWidgetWrapper';
@@ -95,7 +95,11 @@ const AdminWidget = ({
95
95
  widgetData.title(currentAdminWidget),
96
96
  widgetData.deprecated(currentAdminWidget) && " (deprecated)"
97
97
  ] }),
98
- wrapWidget ? /* @__PURE__ */ jsx(Container, { settings: containerSettings, children: React.createElement(currentWidget, widget.settings) }) : React.createElement(currentWidget, widget.settings)
98
+ wrapWidget ? /* @__PURE__ */ jsx(Container, { settings: containerSettings, children: React.createElement(currentWidget, __spreadProps(__spreadValues({}, widget.settings), {
99
+ widgetId: widget.widgetId
100
+ })) }) : React.createElement(currentWidget, __spreadProps(__spreadValues({}, widget.settings), {
101
+ widgetId: widget.widgetId
102
+ }))
99
103
  ] });
100
104
  };
101
105
  var AdminWidget_default = AdminWidget;
@@ -31,29 +31,16 @@ const NavButtonStyle = (_g) => {
31
31
  icon,
32
32
  active,
33
33
  success,
34
- hasChanges,
35
- autoSave
34
+ hasChanges
36
35
  } = _h, props = __objRest(_h, [
37
36
  "className",
38
37
  "icon",
39
38
  "active",
40
39
  "success",
41
- "hasChanges",
42
- "autoSave"
40
+ "hasChanges"
43
41
  ]);
44
42
  const backgroundColor = active ? "var(--r-darker-gray)" : success ? "var(--r-success)" : "transparent";
45
- const _a = props, { clipboardCopiesCount, autoSaveEnabled } = _a, otherProps = __objRest(_a, ["clipboardCopiesCount", "autoSaveEnabled"]);
46
- const isVisible = () => {
47
- switch (props.variant) {
48
- case "save":
49
- return autoSave && !autoSaveEnabled;
50
- case "autosave":
51
- return autoSave;
52
- default:
53
- return true;
54
- }
55
- };
56
- if (isVisible() === false) return null;
43
+ const _a = props, { clipboardCopiesCount, variant } = _a, otherProps = __objRest(_a, ["clipboardCopiesCount", "variant"]);
57
44
  return /* @__PURE__ */ jsxs("div", { children: [
58
45
  /* @__PURE__ */ jsx(
59
46
  "div",
@@ -69,7 +56,7 @@ const NavButtonStyle = (_g) => {
69
56
  backgroundColor,
70
57
  backgroundImage: icon ? `url(${icon})` : "",
71
58
  opacity: hasChanges ? "" : "0.5",
72
- cursor: hasChanges ? "pointer" : typeof autoSaveEnabled !== "undefined" ? "" : "not-allowed"
59
+ cursor: hasChanges || variant === "autosave" ? "pointer" : "not-allowed"
73
60
  }
74
61
  }, otherProps)
75
62
  ),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raketa-builder/builder",
3
- "version": "1.5.2",
3
+ "version": "1.5.8",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -31,8 +31,8 @@
31
31
  },
32
32
  "dependencies": {
33
33
  "react-sortablejs": "6.1.4",
34
- "@raketa-builder/support": "1.5.2",
35
- "@raketa-builder/ui": "1.5.2"
34
+ "@raketa-builder/support": "1.5.4",
35
+ "@raketa-builder/ui": "1.5.4"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@biomejs/biome": "2.1.2",