camox 0.48.0 → 0.51.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/layoutContext.d.ts +1 -0
- package/dist/features/canvas/sidebar/CanvasInspector.js +1 -1
- package/dist/features/content/ContentAssets.js +84 -88
- package/dist/features/preview/CamoxPreview.js +1 -1
- package/dist/features/preview/EditablePageExperience.js +17 -9
- package/dist/features/preview/components/BlockActionsPopover.js +11 -35
- package/dist/features/preview/components/FieldToolbar.js +1 -1
- package/dist/features/preview/components/MobilePreviewDrawer.js +6 -9
- package/dist/features/preview/components/PreviewPanel.js +10 -64
- package/dist/features/preview/components/PreviewToolbar.js +1 -1
- package/dist/features/preview/previewConstants.js +2 -8
- package/dist/features/preview/usePreviewViewportActions.js +1 -1
- package/dist/features/provider/AuthenticatedCamoxProvider.js +1 -1
- package/dist/features/provider/components/CommandPalette.js +2 -5
- package/dist/features/provider/signInShortcut.js +1 -2
- package/dist/features/provider/useAdminShortcuts.js +47 -53
- package/dist/features/routes/pageRuntime.d.ts +2 -1
- package/dist/features/routes/pageRuntime.js +27 -20
- package/dist/features/runtime/publicCache.js +83 -0
- package/dist/features/runtime/runtime.d.ts +13 -3
- package/dist/features/runtime/runtime.js +173 -79
- package/dist/features/runtime/worker.d.ts +5 -1
- package/dist/features/runtime/worker.js +20 -3
- package/dist/features/settings/AnalyticsSettings.js +622 -0
- package/dist/features/settings/CamoxSettings.js +95 -0
- package/dist/features/settings/FaviconSettings.js +254 -0
- package/dist/features/settings/ProjectNameSettings.js +145 -0
- package/dist/features/settings/SettingsPart.js +73 -0
- package/dist/features/settings/SocialProfilesSettings.js +245 -0
- package/dist/features/settings/useProjectMutation.js +61 -0
- package/dist/features/studio/components/DraftsControl.js +136 -131
- package/dist/features/studio/components/LocalePicker.js +178 -174
- package/dist/features/studio/components/Navbar.js +107 -66
- package/dist/features/studio/components/ProjectMenu.js +118 -170
- package/dist/features/studio/components/ReviewDraftSheet.js +1046 -990
- package/dist/features/studio/components/UserButton.js +1 -1
- package/dist/features/studio/routes.js +3 -1
- package/dist/features/studio/showInCanvas.js +129 -0
- package/dist/features/vite/definitionsSync.js +4 -5
- package/dist/features/vite/runtimeDev.js +32 -17
- package/dist/features/vite/staticAssetHeaders.js +52 -0
- package/dist/features/vite/vite.d.ts +1 -1
- package/dist/features/vite/vite.js +16 -4
- package/dist/lib/api-client-server.d.ts +1 -1
- package/dist/lib/api-client.d.ts +2 -1
- package/dist/lib/draft-scope.d.ts +1 -0
- package/dist/lib/locale-path.d.ts +3 -11
- package/dist/lib/locale-path.js +3 -27
- package/dist/lib/queries.js +7 -1
- package/dist/lib/shortcuts.js +29 -0
- package/dist/lib/studio-reads.d.ts +1 -0
- package/dist/lib/utils.js +1 -104
- package/dist/package.js +1 -1
- package/dist/studio.css +1 -1
- package/package.json +5 -4
- package/dist/features/studio/components/FaviconDialog.js +0 -318
- package/dist/features/studio/components/SocialProfilesDialog.js +0 -342
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { reads, useStudioCache } from "../../lib/studio-reads.js";
|
|
2
|
+
import { projectMutations } from "../../lib/queries.js";
|
|
3
|
+
import { c } from "react/compiler-runtime";
|
|
4
|
+
import { useMutation } from "@tanstack/react-query";
|
|
5
|
+
import { toast } from "@camox/ui/toaster";
|
|
6
|
+
|
|
7
|
+
//#region src/features/settings/useProjectMutation.ts
|
|
8
|
+
/**
|
|
9
|
+
* One of the project's mutations, as a Settings part saves with it: once it succeeds the studio
|
|
10
|
+
* reads the project afresh, then `onSuccess` runs and a toast says `success`; a failure toasts the
|
|
11
|
+
* API's message, or `failure` when it has none.
|
|
12
|
+
*/
|
|
13
|
+
function useProjectMutation(project, mutation, t0) {
|
|
14
|
+
const $ = c(13);
|
|
15
|
+
const { success, failure, onSuccess } = t0;
|
|
16
|
+
const studioCache = useStudioCache();
|
|
17
|
+
let t1;
|
|
18
|
+
if ($[0] !== mutation) {
|
|
19
|
+
t1 = projectMutations[mutation]();
|
|
20
|
+
$[0] = mutation;
|
|
21
|
+
$[1] = t1;
|
|
22
|
+
} else t1 = $[1];
|
|
23
|
+
const options = t1;
|
|
24
|
+
let t2;
|
|
25
|
+
if ($[2] !== onSuccess || $[3] !== project || $[4] !== studioCache || $[5] !== success) {
|
|
26
|
+
t2 = async (_, variables) => {
|
|
27
|
+
await studioCache.invalidate(reads.project({ projectUuid: project.uuid }));
|
|
28
|
+
onSuccess?.(variables);
|
|
29
|
+
toast.success(typeof success === "string" ? success : success(variables));
|
|
30
|
+
};
|
|
31
|
+
$[2] = onSuccess;
|
|
32
|
+
$[3] = project;
|
|
33
|
+
$[4] = studioCache;
|
|
34
|
+
$[5] = success;
|
|
35
|
+
$[6] = t2;
|
|
36
|
+
} else t2 = $[6];
|
|
37
|
+
let t3;
|
|
38
|
+
if ($[7] !== failure) {
|
|
39
|
+
t3 = (error) => {
|
|
40
|
+
toast.error(error.message || failure);
|
|
41
|
+
};
|
|
42
|
+
$[7] = failure;
|
|
43
|
+
$[8] = t3;
|
|
44
|
+
} else t3 = $[8];
|
|
45
|
+
let t4;
|
|
46
|
+
if ($[9] !== options || $[10] !== t2 || $[11] !== t3) {
|
|
47
|
+
t4 = {
|
|
48
|
+
...options,
|
|
49
|
+
onSuccess: t2,
|
|
50
|
+
onError: t3
|
|
51
|
+
};
|
|
52
|
+
$[9] = options;
|
|
53
|
+
$[10] = t2;
|
|
54
|
+
$[11] = t3;
|
|
55
|
+
$[12] = t4;
|
|
56
|
+
} else t4 = $[12];
|
|
57
|
+
return useMutation(t4);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
//#endregion
|
|
61
|
+
export { useProjectMutation };
|
|
@@ -99,10 +99,13 @@ function useDrafts() {
|
|
|
99
99
|
* Picks what the studio is viewing, Live or a draft (#203). Live is read-only; the first edit
|
|
100
100
|
* starts a draft. The localhost studio works only in the development draft, so it shows that
|
|
101
101
|
* draft alone, with nothing to switch to (ADR 0006). The command palette offers the same actions,
|
|
102
|
-
* and the picker hosts the draft's review and discard confirmation they open.
|
|
102
|
+
* and the picker hosts the draft's review and discard confirmation they open. A `disabled` picker
|
|
103
|
+
* still names what the studio is viewing.
|
|
103
104
|
*/
|
|
104
|
-
function DraftPicker() {
|
|
105
|
-
const $ = c(
|
|
105
|
+
function DraftPicker(t0) {
|
|
106
|
+
const $ = c(57);
|
|
107
|
+
const { disabled: t1 } = t0;
|
|
108
|
+
const disabled = t1 === void 0 ? false : t1;
|
|
106
109
|
const { draftScope, draftId, developmentMode, projectId, list, current } = useDrafts();
|
|
107
110
|
const navigate = useNavigate();
|
|
108
111
|
const leaveDraft = useLeaveDraft();
|
|
@@ -110,43 +113,43 @@ function DraftPicker() {
|
|
|
110
113
|
const discarding = useSelector(studioStore, _temp2);
|
|
111
114
|
const [menuOpen, setMenuOpen] = React.useState(false);
|
|
112
115
|
const [renaming, setRenaming] = React.useState(null);
|
|
113
|
-
let
|
|
114
|
-
let
|
|
116
|
+
let t2;
|
|
117
|
+
let t3;
|
|
115
118
|
if ($[0] !== draftScope) {
|
|
116
|
-
|
|
117
|
-
|
|
119
|
+
t2 = () => draftScope.subscribe(_temp3);
|
|
120
|
+
t3 = [draftScope];
|
|
118
121
|
$[0] = draftScope;
|
|
119
|
-
$[1] =
|
|
120
|
-
$[2] =
|
|
122
|
+
$[1] = t2;
|
|
123
|
+
$[2] = t3;
|
|
121
124
|
} else {
|
|
122
|
-
|
|
123
|
-
|
|
125
|
+
t2 = $[1];
|
|
126
|
+
t3 = $[2];
|
|
124
127
|
}
|
|
125
|
-
React.useEffect(
|
|
126
|
-
let
|
|
128
|
+
React.useEffect(t2, t3);
|
|
129
|
+
let t4;
|
|
127
130
|
if ($[3] !== draftId) {
|
|
128
|
-
|
|
131
|
+
t4 = [draftId];
|
|
129
132
|
$[3] = draftId;
|
|
130
|
-
$[4] =
|
|
131
|
-
} else
|
|
132
|
-
React.useEffect(_temp5,
|
|
133
|
+
$[4] = t4;
|
|
134
|
+
} else t4 = $[4];
|
|
135
|
+
React.useEffect(_temp5, t4);
|
|
133
136
|
const drafts = list?.drafts;
|
|
134
|
-
let
|
|
137
|
+
let t5;
|
|
135
138
|
if ($[5] !== drafts) {
|
|
136
|
-
|
|
139
|
+
t5 = drafts ?? [];
|
|
137
140
|
$[5] = drafts;
|
|
138
|
-
$[6] =
|
|
139
|
-
} else
|
|
140
|
-
let
|
|
141
|
-
if ($[7] !==
|
|
142
|
-
|
|
143
|
-
$[7] =
|
|
144
|
-
$[8] =
|
|
145
|
-
} else
|
|
146
|
-
const regular =
|
|
147
|
-
let
|
|
141
|
+
$[6] = t5;
|
|
142
|
+
} else t5 = $[6];
|
|
143
|
+
let t6;
|
|
144
|
+
if ($[7] !== t5) {
|
|
145
|
+
t6 = t5.filter(_temp6);
|
|
146
|
+
$[7] = t5;
|
|
147
|
+
$[8] = t6;
|
|
148
|
+
} else t6 = $[8];
|
|
149
|
+
const regular = t6;
|
|
150
|
+
let t7;
|
|
148
151
|
if ($[9] !== draftId || $[10] !== navigate) {
|
|
149
|
-
|
|
152
|
+
t7 = (next) => {
|
|
150
153
|
if (next === draftId) return;
|
|
151
154
|
navigate({
|
|
152
155
|
to: window.location.href,
|
|
@@ -155,14 +158,14 @@ function DraftPicker() {
|
|
|
155
158
|
};
|
|
156
159
|
$[9] = draftId;
|
|
157
160
|
$[10] = navigate;
|
|
158
|
-
$[11] =
|
|
159
|
-
} else
|
|
160
|
-
const switchTo =
|
|
161
|
-
const
|
|
162
|
-
let
|
|
163
|
-
if ($[12] !== developmentMode || $[13] !== draftId || $[14] !== regular || $[15] !== switchTo || $[16] !==
|
|
164
|
-
|
|
165
|
-
enabled:
|
|
161
|
+
$[11] = t7;
|
|
162
|
+
} else t7 = $[11];
|
|
163
|
+
const switchTo = t7;
|
|
164
|
+
const t8 = !!projectId;
|
|
165
|
+
let t9;
|
|
166
|
+
if ($[12] !== developmentMode || $[13] !== draftId || $[14] !== regular || $[15] !== switchTo || $[16] !== t8) {
|
|
167
|
+
t9 = {
|
|
168
|
+
enabled: t8,
|
|
166
169
|
draftId,
|
|
167
170
|
developmentMode,
|
|
168
171
|
regular,
|
|
@@ -172,78 +175,80 @@ function DraftPicker() {
|
|
|
172
175
|
$[13] = draftId;
|
|
173
176
|
$[14] = regular;
|
|
174
177
|
$[15] = switchTo;
|
|
175
|
-
$[16] =
|
|
176
|
-
$[17] =
|
|
177
|
-
} else
|
|
178
|
-
useDraftsActions(
|
|
178
|
+
$[16] = t8;
|
|
179
|
+
$[17] = t9;
|
|
180
|
+
} else t9 = $[17];
|
|
181
|
+
useDraftsActions(t9);
|
|
179
182
|
if (developmentMode && !draftId) return null;
|
|
180
183
|
if (draftId && !developmentMode && !current) return null;
|
|
181
|
-
let
|
|
184
|
+
let t10;
|
|
182
185
|
if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
|
|
183
|
-
|
|
186
|
+
t10 = /* @__PURE__ */ jsx(Button, {
|
|
184
187
|
type: "button",
|
|
185
188
|
variant: "ghost"
|
|
186
189
|
});
|
|
187
|
-
$[18] =
|
|
188
|
-
} else
|
|
189
|
-
const
|
|
190
|
-
let
|
|
191
|
-
if ($[19] !==
|
|
192
|
-
|
|
193
|
-
$[19] =
|
|
194
|
-
$[20] =
|
|
195
|
-
} else
|
|
196
|
-
let
|
|
197
|
-
if ($[21] !==
|
|
198
|
-
|
|
190
|
+
$[18] = t10;
|
|
191
|
+
} else t10 = $[18];
|
|
192
|
+
const t11 = draftId ? "bg-blue-500" : "bg-emerald-500";
|
|
193
|
+
let t12;
|
|
194
|
+
if ($[19] !== t11) {
|
|
195
|
+
t12 = cn("size-2 shrink-0 rounded-full", t11);
|
|
196
|
+
$[19] = t11;
|
|
197
|
+
$[20] = t12;
|
|
198
|
+
} else t12 = $[20];
|
|
199
|
+
let t13;
|
|
200
|
+
if ($[21] !== t12) {
|
|
201
|
+
t13 = /* @__PURE__ */ jsx("span", {
|
|
199
202
|
"aria-hidden": true,
|
|
200
|
-
className:
|
|
203
|
+
className: t12
|
|
201
204
|
});
|
|
202
|
-
$[21] =
|
|
203
|
-
$[22] =
|
|
204
|
-
} else
|
|
205
|
-
let
|
|
205
|
+
$[21] = t12;
|
|
206
|
+
$[22] = t13;
|
|
207
|
+
} else t13 = $[22];
|
|
208
|
+
let t14;
|
|
206
209
|
if ($[23] !== current || $[24] !== developmentMode || $[25] !== draftId) {
|
|
207
|
-
|
|
210
|
+
t14 = !draftId ? "Live" : developmentMode ? "Development draft" : draftLabel(current);
|
|
208
211
|
$[23] = current;
|
|
209
212
|
$[24] = developmentMode;
|
|
210
213
|
$[25] = draftId;
|
|
211
|
-
$[26] =
|
|
212
|
-
} else
|
|
213
|
-
let
|
|
214
|
-
if ($[27] !==
|
|
215
|
-
|
|
214
|
+
$[26] = t14;
|
|
215
|
+
} else t14 = $[26];
|
|
216
|
+
let t15;
|
|
217
|
+
if ($[27] !== t14) {
|
|
218
|
+
t15 = /* @__PURE__ */ jsx("span", {
|
|
216
219
|
className: "max-w-48 truncate",
|
|
217
|
-
children:
|
|
220
|
+
children: t14
|
|
218
221
|
});
|
|
219
|
-
$[27] =
|
|
220
|
-
$[28] =
|
|
221
|
-
} else
|
|
222
|
-
let
|
|
222
|
+
$[27] = t14;
|
|
223
|
+
$[28] = t15;
|
|
224
|
+
} else t15 = $[28];
|
|
225
|
+
let t16;
|
|
223
226
|
if ($[29] === Symbol.for("react.memo_cache_sentinel")) {
|
|
224
|
-
|
|
227
|
+
t16 = /* @__PURE__ */ jsx(ChevronsUpDown, {
|
|
225
228
|
"aria-hidden": true,
|
|
226
229
|
className: "size-4 opacity-50"
|
|
227
230
|
});
|
|
228
|
-
$[29] =
|
|
229
|
-
} else
|
|
230
|
-
let
|
|
231
|
-
if ($[30] !==
|
|
232
|
-
|
|
233
|
-
|
|
231
|
+
$[29] = t16;
|
|
232
|
+
} else t16 = $[29];
|
|
233
|
+
let t17;
|
|
234
|
+
if ($[30] !== disabled || $[31] !== t13 || $[32] !== t15) {
|
|
235
|
+
t17 = /* @__PURE__ */ jsxs(DropdownMenuTrigger, {
|
|
236
|
+
disabled,
|
|
237
|
+
render: t10,
|
|
234
238
|
children: [
|
|
235
|
-
t11,
|
|
236
239
|
t13,
|
|
237
|
-
|
|
240
|
+
t15,
|
|
241
|
+
t16
|
|
238
242
|
]
|
|
239
243
|
});
|
|
240
|
-
$[30] =
|
|
244
|
+
$[30] = disabled;
|
|
241
245
|
$[31] = t13;
|
|
242
246
|
$[32] = t15;
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
+
$[33] = t17;
|
|
248
|
+
} else t17 = $[33];
|
|
249
|
+
let t18;
|
|
250
|
+
if ($[34] !== developmentMode || $[35] !== draftId || $[36] !== list || $[37] !== regular || $[38] !== switchTo) {
|
|
251
|
+
t18 = /* @__PURE__ */ jsx(DropdownMenuContent, {
|
|
247
252
|
className: "w-80",
|
|
248
253
|
align: "start",
|
|
249
254
|
children: developmentMode ? /* @__PURE__ */ jsx(DropdownMenuGroup, { children: /* @__PURE__ */ jsx(DropdownMenuLabel, {
|
|
@@ -278,41 +283,41 @@ function DraftPicker() {
|
|
|
278
283
|
] })
|
|
279
284
|
})] })
|
|
280
285
|
});
|
|
281
|
-
$[
|
|
282
|
-
$[
|
|
283
|
-
$[
|
|
284
|
-
$[
|
|
285
|
-
$[
|
|
286
|
-
$[
|
|
287
|
-
} else
|
|
288
|
-
let
|
|
289
|
-
if ($[
|
|
290
|
-
|
|
286
|
+
$[34] = developmentMode;
|
|
287
|
+
$[35] = draftId;
|
|
288
|
+
$[36] = list;
|
|
289
|
+
$[37] = regular;
|
|
290
|
+
$[38] = switchTo;
|
|
291
|
+
$[39] = t18;
|
|
292
|
+
} else t18 = $[39];
|
|
293
|
+
let t19;
|
|
294
|
+
if ($[40] !== menuOpen || $[41] !== t17 || $[42] !== t18) {
|
|
295
|
+
t19 = /* @__PURE__ */ jsxs(DropdownMenu, {
|
|
291
296
|
open: menuOpen,
|
|
292
297
|
onOpenChange: setMenuOpen,
|
|
293
|
-
children: [
|
|
298
|
+
children: [t17, t18]
|
|
294
299
|
});
|
|
295
|
-
$[
|
|
296
|
-
$[
|
|
297
|
-
$[
|
|
298
|
-
$[
|
|
299
|
-
} else
|
|
300
|
-
let
|
|
301
|
-
if ($[
|
|
302
|
-
|
|
300
|
+
$[40] = menuOpen;
|
|
301
|
+
$[41] = t17;
|
|
302
|
+
$[42] = t18;
|
|
303
|
+
$[43] = t19;
|
|
304
|
+
} else t19 = $[43];
|
|
305
|
+
let t20;
|
|
306
|
+
if ($[44] !== projectId || $[45] !== renaming) {
|
|
307
|
+
t20 = projectId && /* @__PURE__ */ jsx(RenameDraftDialog, {
|
|
303
308
|
projectId,
|
|
304
309
|
draft: renaming,
|
|
305
310
|
onOpenChange: (open) => {
|
|
306
311
|
if (!open) setRenaming(null);
|
|
307
312
|
}
|
|
308
313
|
});
|
|
309
|
-
$[
|
|
310
|
-
$[
|
|
311
|
-
$[
|
|
312
|
-
} else
|
|
313
|
-
let
|
|
314
|
-
if ($[
|
|
315
|
-
|
|
314
|
+
$[44] = projectId;
|
|
315
|
+
$[45] = renaming;
|
|
316
|
+
$[46] = t20;
|
|
317
|
+
} else t20 = $[46];
|
|
318
|
+
let t21;
|
|
319
|
+
if ($[47] !== discarding || $[48] !== draftId || $[49] !== leaveDraft || $[50] !== projectId || $[51] !== review) {
|
|
320
|
+
t21 = draftId && projectId && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(ReviewDraftSheet, {
|
|
316
321
|
projectId,
|
|
317
322
|
draftId,
|
|
318
323
|
open: review.open,
|
|
@@ -324,26 +329,26 @@ function DraftPicker() {
|
|
|
324
329
|
onOpenChange: _temp8,
|
|
325
330
|
onDiscarded: leaveDraft
|
|
326
331
|
})] });
|
|
327
|
-
$[
|
|
328
|
-
$[
|
|
329
|
-
$[
|
|
330
|
-
$[
|
|
331
|
-
$[
|
|
332
|
-
$[
|
|
333
|
-
} else
|
|
334
|
-
let
|
|
335
|
-
if ($[
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
332
|
+
$[47] = discarding;
|
|
333
|
+
$[48] = draftId;
|
|
334
|
+
$[49] = leaveDraft;
|
|
335
|
+
$[50] = projectId;
|
|
336
|
+
$[51] = review;
|
|
337
|
+
$[52] = t21;
|
|
338
|
+
} else t21 = $[52];
|
|
339
|
+
let t22;
|
|
340
|
+
if ($[53] !== t19 || $[54] !== t20 || $[55] !== t21) {
|
|
341
|
+
t22 = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
342
|
+
t19,
|
|
343
|
+
t20,
|
|
344
|
+
t21
|
|
340
345
|
] });
|
|
341
|
-
$[
|
|
342
|
-
$[
|
|
343
|
-
$[
|
|
344
|
-
$[
|
|
345
|
-
} else
|
|
346
|
-
return
|
|
346
|
+
$[53] = t19;
|
|
347
|
+
$[54] = t20;
|
|
348
|
+
$[55] = t21;
|
|
349
|
+
$[56] = t22;
|
|
350
|
+
} else t22 = $[56];
|
|
351
|
+
return t22;
|
|
347
352
|
}
|
|
348
353
|
function _temp8(open_1) {
|
|
349
354
|
if (!open_1) studioStore.send({ type: "closeDiscardDraftDialog" });
|