camox 0.48.0 → 0.52.1

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.
Files changed (127) hide show
  1. package/dist/core/createApp.d.ts +1 -0
  2. package/dist/core/createApp.js +1 -0
  3. package/dist/core/editing/contentEdits.js +78 -0
  4. package/dist/core/editing/createEditableBlock.js +277 -311
  5. package/dist/core/layoutContext.d.ts +1 -0
  6. package/dist/core/lib/contentType.js +2 -2
  7. package/dist/core/recordItem.js +3 -3
  8. package/dist/features/canvas/CamoxCanvas.js +15 -15
  9. package/dist/features/canvas/CanvasLoadingScreen.js +15 -11
  10. package/dist/features/canvas/CanvasPageFrame.js +81 -87
  11. package/dist/features/canvas/CanvasPreviewPageSlot.js +1 -1
  12. package/dist/features/canvas/DerivedPagePathInput.js +12 -12
  13. package/dist/features/canvas/canvasOverlayGeometry.js +1 -1
  14. package/dist/features/canvas/canvasStore.js +2 -2
  15. package/dist/features/canvas/sidebar/CanvasInspector.js +1 -1
  16. package/dist/features/canvas/sidebar/CuratedPageInspector.js +1 -1
  17. package/dist/features/canvas/sidebar/LayoutPageBlocks.js +23 -31
  18. package/dist/features/canvas/useCanvasCamera.js +1 -1
  19. package/dist/features/canvas/useDiscoveredPreviewPaths.js +16 -9
  20. package/dist/features/content/ContentAssets.js +84 -88
  21. package/dist/features/page/CuratedPageContent.js +1 -1
  22. package/dist/features/preview/CamoxPreview.d.ts +8 -4
  23. package/dist/features/preview/CamoxPreview.js +258 -443
  24. package/dist/features/preview/EditablePageContent.js +244 -2
  25. package/dist/features/preview/EditablePageExperience.js +19 -13
  26. package/dist/features/preview/components/AddBlockSheet.js +55 -15
  27. package/dist/features/preview/components/BlockActionsPopover.js +23 -51
  28. package/dist/features/preview/components/BlockPeek.js +66 -0
  29. package/dist/features/preview/components/BlockThumbnail.js +134 -119
  30. package/dist/features/preview/components/CanvasPreview.js +1 -1
  31. package/dist/features/preview/components/CreatePageModal.js +150 -156
  32. package/dist/features/preview/components/FieldToolbar.js +1 -1
  33. package/dist/features/preview/components/Frame.js +27 -4
  34. package/dist/features/preview/components/MobilePreviewDrawer.js +6 -9
  35. package/dist/features/preview/components/PageInfo.js +161 -126
  36. package/dist/features/preview/components/PagePicker.js +2 -2
  37. package/dist/features/preview/components/PageTree.js +174 -190
  38. package/dist/features/preview/components/PreviewPanel.js +13 -67
  39. package/dist/features/preview/components/PreviewToolbar.js +1 -1
  40. package/dist/features/preview/components/ReferenceFieldEditor.js +4 -4
  41. package/dist/features/preview/components/ReferenceListFieldEditor.js +4 -4
  42. package/dist/features/preview/components/RemovedBlockPlaceholder.js +37 -70
  43. package/dist/features/preview/components/RepeatableItemsList.js +1 -1
  44. package/dist/features/preview/components/SelectionEditor.js +248 -256
  45. package/dist/features/preview/components/StudioEditingFallback.js +22 -26
  46. package/dist/features/preview/components/useFieldWriter.js +19 -19
  47. package/dist/features/preview/components/useRecordView.js +105 -147
  48. package/dist/features/preview/components/useRepeatableItemActions.js +0 -2
  49. package/dist/features/preview/pageRecord.js +30 -24
  50. package/dist/features/preview/previewConstants.js +2 -8
  51. package/dist/features/preview/previewStore.js +2 -0
  52. package/dist/features/preview/studioNotice.js +20 -0
  53. package/dist/features/preview/usePreviewViewportActions.js +1 -1
  54. package/dist/features/provider/AuthenticatedCamoxProvider.js +47 -31
  55. package/dist/features/provider/components/CommandPalette.js +2 -5
  56. package/dist/features/provider/signInShortcut.js +1 -2
  57. package/dist/features/provider/useAdminShortcuts.js +47 -53
  58. package/dist/features/renderer/RendererApp.js +542 -0
  59. package/dist/features/renderer/RendererFrames.js +450 -0
  60. package/dist/features/renderer/definitionAnswers.js +26 -0
  61. package/dist/features/renderer/protocol.js +35 -0
  62. package/dist/features/renderer/rendererHost.js +249 -0
  63. package/dist/features/renderer/studioConnection.js +186 -0
  64. package/dist/features/routes/pageRuntime.d.ts +2 -1
  65. package/dist/features/routes/pageRuntime.js +34 -22
  66. package/dist/features/runtime/RuntimeChrome.js +2 -5
  67. package/dist/features/runtime/assetPrefix.js +14 -0
  68. package/dist/features/runtime/breadcrumbs.js +1 -1
  69. package/dist/features/runtime/editingFallback.js +4 -8
  70. package/dist/features/runtime/livePages.js +1 -1
  71. package/dist/features/runtime/pageApp.js +57 -83
  72. package/dist/features/runtime/pageClient.js +1 -1
  73. package/dist/features/runtime/pageNavigation.js +3 -2
  74. package/dist/features/runtime/publicCache.js +95 -0
  75. package/dist/features/runtime/publishingDraft.js +23 -0
  76. package/dist/features/runtime/rendererClient.d.ts +8 -0
  77. package/dist/features/runtime/rendererClient.js +77 -0
  78. package/dist/features/runtime/runtime.d.ts +22 -3
  79. package/dist/features/runtime/runtime.js +209 -96
  80. package/dist/features/runtime/runtimeRoutes.d.ts +2 -0
  81. package/dist/features/runtime/runtimeRoutes.js +2 -0
  82. package/dist/features/runtime/worker.d.ts +14 -1
  83. package/dist/features/runtime/worker.js +34 -4
  84. package/dist/features/settings/AnalyticsSettings.js +622 -0
  85. package/dist/features/settings/CamoxSettings.js +95 -0
  86. package/dist/features/settings/FaviconSettings.js +254 -0
  87. package/dist/features/settings/ProjectNameSettings.js +145 -0
  88. package/dist/features/settings/SettingsPart.js +73 -0
  89. package/dist/features/settings/SocialProfilesSettings.js +245 -0
  90. package/dist/features/settings/useProjectMutation.js +61 -0
  91. package/dist/features/studio/FollowAgentProvider.js +10 -10
  92. package/dist/features/studio/components/DraftsControl.js +136 -131
  93. package/dist/features/studio/components/LocalePicker.js +178 -174
  94. package/dist/features/studio/components/Navbar.js +107 -66
  95. package/dist/features/studio/components/ProjectMenu.js +119 -171
  96. package/dist/features/studio/components/ReviewDraftSheet.js +1151 -991
  97. package/dist/features/studio/components/ThreadMessages.js +100 -65
  98. package/dist/features/studio/components/UserButton.js +2 -2
  99. package/dist/features/studio/routes.js +3 -1
  100. package/dist/features/studio/showInCanvas.js +129 -0
  101. package/dist/features/vite/definitionsSync.js +5 -6
  102. package/dist/features/vite/hostedChecks.js +127 -0
  103. package/dist/features/vite/runtimeDev.js +58 -17
  104. package/dist/features/vite/staticAssetHeaders.js +52 -0
  105. package/dist/features/vite/vite.d.ts +1 -1
  106. package/dist/features/vite/vite.js +49 -9
  107. package/dist/hooks/use-page-destinations.js +10 -10
  108. package/dist/lib/api-client-server.d.ts +1 -1
  109. package/dist/lib/api-client.d.ts +2 -1
  110. package/dist/lib/draft-scope.d.ts +1 -0
  111. package/dist/lib/locale-path.d.ts +3 -11
  112. package/dist/lib/locale-path.js +3 -27
  113. package/dist/lib/queries.js +7 -1
  114. package/dist/lib/revisions.js +20 -0
  115. package/dist/lib/shortcuts.js +29 -0
  116. package/dist/lib/studio-definitions.js +160 -0
  117. package/dist/lib/studio-reads.d.ts +1 -0
  118. package/dist/lib/studio-reads.js +65 -21
  119. package/dist/lib/use-project-room.js +16 -10
  120. package/dist/lib/utils.js +1 -104
  121. package/dist/package.js +1 -1
  122. package/dist/studio.css +1 -1
  123. package/package.json +9 -4
  124. package/skills/camox/SKILL.md +4 -0
  125. package/skills/camox/references/artifacts.md +1 -1
  126. package/dist/features/studio/components/FaviconDialog.js +0 -318
  127. package/dist/features/studio/components/SocialProfilesDialog.js +0 -342
@@ -1,8 +1,8 @@
1
1
  import { useProjectUuid } from "../../../lib/auth.js";
2
2
  import { useNavigate } from "../../navigation/navigation.js";
3
- import { useCamoxApp } from "../../provider/components/CamoxAppContext.js";
4
3
  import { reads, useReadQuery } from "../../../lib/studio-reads.js";
5
4
  import { pageMutations } from "../../../lib/queries.js";
5
+ import { useLayoutDefinitions } from "../../../lib/studio-definitions.js";
6
6
  import { useLocalizedPath } from "../../../lib/view-locale.js";
7
7
  import { PageNicknameField } from "./PageNicknameField.js";
8
8
  import { previewStore } from "../previewStore.js";
@@ -27,7 +27,7 @@ const slugifyPathSegment = (nickname) => {
27
27
  return trimmedNickname.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
28
28
  };
29
29
  const CreatePageModal = () => {
30
- const $ = c(56);
30
+ const $ = c(51);
31
31
  const projectUuid = useProjectUuid();
32
32
  const open = useSelector(previewStore, _temp);
33
33
  let t0;
@@ -57,43 +57,28 @@ const CreatePageModal = () => {
57
57
  $[6] = t4;
58
58
  } else t4 = $[6];
59
59
  const { data: pages } = useReadQuery(t2, t4);
60
+ const allLayouts = useLayoutDefinitions();
60
61
  let t5;
61
- if ($[7] !== project?.id) {
62
- t5 = reads.layoutList({ projectId: project?.id ?? 0 });
63
- $[7] = project?.id;
62
+ if ($[7] !== allLayouts) {
63
+ t5 = allLayouts.filter(_temp2);
64
+ $[7] = allLayouts;
64
65
  $[8] = t5;
65
66
  } else t5 = $[8];
66
- const t6 = !!project;
67
- let t7;
68
- if ($[9] !== t6) {
69
- t7 = { enabled: t6 };
70
- $[9] = t6;
71
- $[10] = t7;
72
- } else t7 = $[10];
73
- const { data: allLayouts } = useReadQuery(t5, t7);
74
- const camoxApp = useCamoxApp();
75
- let t8;
76
- if ($[11] !== allLayouts || $[12] !== camoxApp) {
77
- t8 = allLayouts?.filter((layout) => camoxApp.getLayoutById(layout.layoutId)?._internal.kind === "curated");
78
- $[11] = allLayouts;
79
- $[12] = camoxApp;
80
- $[13] = t8;
81
- } else t8 = $[13];
82
- const layouts = t8;
67
+ const layouts = t5;
83
68
  const navigate = useNavigate();
84
69
  const localized = useLocalizedPath();
85
- let t9;
86
- if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
87
- t9 = {
70
+ let t6;
71
+ if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
72
+ t6 = {
88
73
  nickname: "",
89
74
  parentPageId: void 0,
90
75
  pathSegment: "",
91
76
  layoutId: ""
92
77
  };
93
- $[14] = t9;
94
- } else t9 = $[14];
78
+ $[9] = t6;
79
+ } else t6 = $[9];
95
80
  const form = useForm({
96
- defaultValues: t9,
81
+ defaultValues: t6,
97
82
  onSubmit: async (values) => {
98
83
  try {
99
84
  if (!project) {
@@ -120,49 +105,50 @@ const CreatePageModal = () => {
120
105
  const { fullPath } = await createPagePromise;
121
106
  previewStore.send({ type: "closeCreatePageModal" });
122
107
  form.reset();
123
- await new Promise(_temp2);
108
+ await new Promise(_temp3);
124
109
  await navigate({ to: localized(fullPath) });
125
- } catch (t10) {
126
- console.error("Failed to create page:", t10);
110
+ } catch (t7) {
111
+ console.error("Failed to create page:", t7);
127
112
  toast.error("Could not create page");
128
113
  }
129
114
  }
130
115
  });
131
- let t11;
132
- if ($[15] !== form || $[16] !== layouts) {
133
- t11 = () => {
134
- if (layouts && layouts.length > 0 && !form.getFieldValue("layoutId")) form.setFieldValue("layoutId", layouts[0].layoutId);
116
+ let t8;
117
+ if ($[10] !== form || $[11] !== layouts[0] || $[12] !== layouts.length) {
118
+ t8 = () => {
119
+ if (layouts.length > 0 && !form.getFieldValue("layoutId")) form.setFieldValue("layoutId", layouts[0].id);
135
120
  };
136
- $[15] = form;
137
- $[16] = layouts;
138
- $[17] = t11;
139
- } else t11 = $[17];
140
- let t12;
141
- if ($[18] !== form || $[19] !== layouts) {
142
- t12 = [layouts, form];
143
- $[18] = form;
144
- $[19] = layouts;
145
- $[20] = t12;
146
- } else t12 = $[20];
147
- useEffect(t11, t12);
148
- let t13;
149
- if ($[21] === Symbol.for("react.memo_cache_sentinel")) {
150
- t13 = /* @__PURE__ */ jsxs(DialogHeader, { children: [/* @__PURE__ */ jsx(DialogTitle, { children: "Create page" }), /* @__PURE__ */ jsx(DialogDescription, { children: "Fill in the details to create a new page. It will be created as a draft." })] });
151
- $[21] = t13;
152
- } else t13 = $[21];
153
- let t14;
154
- if ($[22] !== form) {
155
- t14 = (e) => {
121
+ $[10] = form;
122
+ $[11] = layouts[0];
123
+ $[12] = layouts.length;
124
+ $[13] = t8;
125
+ } else t8 = $[13];
126
+ let t9;
127
+ if ($[14] !== form || $[15] !== layouts) {
128
+ t9 = [layouts, form];
129
+ $[14] = form;
130
+ $[15] = layouts;
131
+ $[16] = t9;
132
+ } else t9 = $[16];
133
+ useEffect(t8, t9);
134
+ let t10;
135
+ if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
136
+ t10 = /* @__PURE__ */ jsxs(DialogHeader, { children: [/* @__PURE__ */ jsx(DialogTitle, { children: "Create page" }), /* @__PURE__ */ jsx(DialogDescription, { children: "Fill in the details to create a new page. It will be created as a draft." })] });
137
+ $[17] = t10;
138
+ } else t10 = $[17];
139
+ let t11;
140
+ if ($[18] !== form) {
141
+ t11 = (e) => {
156
142
  e.preventDefault();
157
143
  e.stopPropagation();
158
144
  form.handleSubmit();
159
145
  };
160
- $[22] = form;
161
- $[23] = t14;
162
- } else t14 = $[23];
163
- let t15;
164
- if ($[24] !== form) {
165
- t15 = (field) => /* @__PURE__ */ jsx(PageNicknameField, {
146
+ $[18] = form;
147
+ $[19] = t11;
148
+ } else t11 = $[19];
149
+ let t12;
150
+ if ($[20] !== form) {
151
+ t12 = (field) => /* @__PURE__ */ jsx(PageNicknameField, {
166
152
  value: field.state.value,
167
153
  onChange: (value_0) => {
168
154
  field.handleChange(value_0);
@@ -171,22 +157,22 @@ const CreatePageModal = () => {
171
157
  },
172
158
  autoFocus: true
173
159
  });
174
- $[24] = form;
175
- $[25] = t15;
176
- } else t15 = $[25];
177
- let t16;
178
- if ($[26] !== form.Field || $[27] !== t15) {
179
- t16 = /* @__PURE__ */ jsx(form.Field, {
160
+ $[20] = form;
161
+ $[21] = t12;
162
+ } else t12 = $[21];
163
+ let t13;
164
+ if ($[22] !== form.Field || $[23] !== t12) {
165
+ t13 = /* @__PURE__ */ jsx(form.Field, {
180
166
  name: "nickname",
181
- children: t15
167
+ children: t12
182
168
  });
183
- $[26] = form.Field;
184
- $[27] = t15;
185
- $[28] = t16;
186
- } else t16 = $[28];
187
- let t17;
188
- if ($[29] !== form.Field || $[30] !== pages) {
189
- t17 = (parentField) => /* @__PURE__ */ jsx(form.Field, {
169
+ $[22] = form.Field;
170
+ $[23] = t12;
171
+ $[24] = t13;
172
+ } else t13 = $[24];
173
+ let t14;
174
+ if ($[25] !== form.Field || $[26] !== pages) {
175
+ t14 = (parentField) => /* @__PURE__ */ jsx(form.Field, {
190
176
  name: "pathSegment",
191
177
  children: (pathField) => /* @__PURE__ */ jsx(PageLocationFieldset, {
192
178
  parentPageId: parentField.state.value,
@@ -196,23 +182,23 @@ const CreatePageModal = () => {
196
182
  pages
197
183
  })
198
184
  });
199
- $[29] = form.Field;
200
- $[30] = pages;
201
- $[31] = t17;
202
- } else t17 = $[31];
203
- let t18;
204
- if ($[32] !== form.Field || $[33] !== t17) {
205
- t18 = /* @__PURE__ */ jsx(form.Field, {
185
+ $[25] = form.Field;
186
+ $[26] = pages;
187
+ $[27] = t14;
188
+ } else t14 = $[27];
189
+ let t15;
190
+ if ($[28] !== form.Field || $[29] !== t14) {
191
+ t15 = /* @__PURE__ */ jsx(form.Field, {
206
192
  name: "parentPageId",
207
- children: t17
193
+ children: t14
208
194
  });
209
- $[32] = form.Field;
210
- $[33] = t17;
211
- $[34] = t18;
212
- } else t18 = $[34];
213
- let t19;
214
- if ($[35] !== camoxApp || $[36] !== layouts) {
215
- t19 = (field_0) => /* @__PURE__ */ jsxs("div", {
195
+ $[28] = form.Field;
196
+ $[29] = t14;
197
+ $[30] = t15;
198
+ } else t15 = $[30];
199
+ let t16;
200
+ if ($[31] !== layouts) {
201
+ t16 = (field_0) => /* @__PURE__ */ jsxs("div", {
216
202
  className: "space-y-2",
217
203
  children: [/* @__PURE__ */ jsx(Label, {
218
204
  htmlFor: "layoutId",
@@ -222,98 +208,106 @@ const CreatePageModal = () => {
222
208
  onValueChange: (value_1) => {
223
209
  if (value_1 != null) field_0.handleChange(value_1);
224
210
  },
225
- disabled: layouts != null && layouts.length <= 1,
226
- items: layouts?.map((t) => ({
227
- value: t.layoutId,
228
- label: camoxApp.getLayoutById(t.layoutId)?._internal.title ?? t.layoutId
229
- })),
230
- children: [/* @__PURE__ */ jsx(SelectTrigger, { children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Select a layout" }) }), /* @__PURE__ */ jsx(SelectContent, { children: layouts?.map((t_0) => /* @__PURE__ */ jsx(SelectItem, {
231
- value: t_0.layoutId,
232
- children: camoxApp.getLayoutById(t_0.layoutId)?._internal.title ?? t_0.layoutId
233
- }, t_0.layoutId)) })]
211
+ disabled: layouts.length <= 1,
212
+ items: layouts.map(_temp5),
213
+ children: [/* @__PURE__ */ jsx(SelectTrigger, { children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Select a layout" }) }), /* @__PURE__ */ jsx(SelectContent, { children: layouts.map(_temp6) })]
234
214
  })]
235
215
  });
236
- $[35] = camoxApp;
237
- $[36] = layouts;
238
- $[37] = t19;
239
- } else t19 = $[37];
240
- let t20;
241
- if ($[38] !== form.Field || $[39] !== t19) {
242
- t20 = /* @__PURE__ */ jsx(form.Field, {
216
+ $[31] = layouts;
217
+ $[32] = t16;
218
+ } else t16 = $[32];
219
+ let t17;
220
+ if ($[33] !== form.Field || $[34] !== t16) {
221
+ t17 = /* @__PURE__ */ jsx(form.Field, {
243
222
  name: "layoutId",
244
- children: t19
223
+ children: t16
245
224
  });
246
- $[38] = form.Field;
247
- $[39] = t19;
248
- $[40] = t20;
249
- } else t20 = $[40];
250
- let t21;
251
- if ($[41] !== form.state.isSubmitting) {
252
- t21 = form.state.isSubmitting && /* @__PURE__ */ jsx(Spinner, {});
253
- $[41] = form.state.isSubmitting;
254
- $[42] = t21;
255
- } else t21 = $[42];
256
- const t22 = form.state.isSubmitting && "...";
257
- let t23;
258
- if ($[43] !== form.state.isSubmitting || $[44] !== t21 || $[45] !== t22) {
259
- t23 = /* @__PURE__ */ jsxs(Button, {
225
+ $[33] = form.Field;
226
+ $[34] = t16;
227
+ $[35] = t17;
228
+ } else t17 = $[35];
229
+ let t18;
230
+ if ($[36] !== form.state.isSubmitting) {
231
+ t18 = form.state.isSubmitting && /* @__PURE__ */ jsx(Spinner, {});
232
+ $[36] = form.state.isSubmitting;
233
+ $[37] = t18;
234
+ } else t18 = $[37];
235
+ const t19 = form.state.isSubmitting && "...";
236
+ let t20;
237
+ if ($[38] !== form.state.isSubmitting || $[39] !== t18 || $[40] !== t19) {
238
+ t20 = /* @__PURE__ */ jsxs(Button, {
260
239
  type: "submit",
261
240
  disabled: form.state.isSubmitting,
262
241
  children: [
263
- t21,
242
+ t18,
264
243
  "Create page",
265
- t22
244
+ t19
266
245
  ]
267
246
  });
268
- $[43] = form.state.isSubmitting;
269
- $[44] = t21;
270
- $[45] = t22;
271
- $[46] = t23;
272
- } else t23 = $[46];
273
- let t24;
274
- if ($[47] !== t14 || $[48] !== t16 || $[49] !== t18 || $[50] !== t20 || $[51] !== t23) {
275
- t24 = /* @__PURE__ */ jsxs(DialogContent, {
247
+ $[38] = form.state.isSubmitting;
248
+ $[39] = t18;
249
+ $[40] = t19;
250
+ $[41] = t20;
251
+ } else t20 = $[41];
252
+ let t21;
253
+ if ($[42] !== t11 || $[43] !== t13 || $[44] !== t15 || $[45] !== t17 || $[46] !== t20) {
254
+ t21 = /* @__PURE__ */ jsxs(DialogContent, {
276
255
  className: "flex max-h-[90vh] flex-col sm:max-w-lg",
277
- children: [t13, /* @__PURE__ */ jsxs("form", {
278
- onSubmit: t14,
256
+ children: [t10, /* @__PURE__ */ jsxs("form", {
257
+ onSubmit: t11,
279
258
  className: "-mx-1 space-y-4 overflow-y-auto px-1 py-2",
280
259
  children: [
281
- t16,
282
- t18,
283
- t20,
284
- t23
260
+ t13,
261
+ t15,
262
+ t17,
263
+ t20
285
264
  ]
286
265
  })]
287
266
  });
288
- $[47] = t14;
289
- $[48] = t16;
290
- $[49] = t18;
291
- $[50] = t20;
292
- $[51] = t23;
293
- $[52] = t24;
294
- } else t24 = $[52];
295
- let t25;
296
- if ($[53] !== open || $[54] !== t24) {
297
- t25 = /* @__PURE__ */ jsx(Dialog, {
267
+ $[42] = t11;
268
+ $[43] = t13;
269
+ $[44] = t15;
270
+ $[45] = t17;
271
+ $[46] = t20;
272
+ $[47] = t21;
273
+ } else t21 = $[47];
274
+ let t22;
275
+ if ($[48] !== open || $[49] !== t21) {
276
+ t22 = /* @__PURE__ */ jsx(Dialog, {
298
277
  open,
299
- onOpenChange: _temp3,
300
- children: t24
278
+ onOpenChange: _temp4,
279
+ children: t21
301
280
  });
302
- $[53] = open;
303
- $[54] = t24;
304
- $[55] = t25;
305
- } else t25 = $[55];
306
- return t25;
281
+ $[48] = open;
282
+ $[49] = t21;
283
+ $[50] = t22;
284
+ } else t22 = $[50];
285
+ return t22;
307
286
  };
308
287
  function _temp(state) {
309
288
  return state.context.isCreatePageModalOpen;
310
289
  }
311
- function _temp2(resolve) {
290
+ function _temp2(layout) {
291
+ return layout.kind === "curated";
292
+ }
293
+ function _temp3(resolve) {
312
294
  return setTimeout(resolve, 50);
313
295
  }
314
- function _temp3(value) {
296
+ function _temp4(value) {
315
297
  if (!value) previewStore.send({ type: "closeCreatePageModal" });
316
298
  }
299
+ function _temp5(layout_0) {
300
+ return {
301
+ value: layout_0.id,
302
+ label: layout_0.title
303
+ };
304
+ }
305
+ function _temp6(layout_1) {
306
+ return /* @__PURE__ */ jsx(SelectItem, {
307
+ value: layout_1.id,
308
+ children: layout_1.title
309
+ }, layout_1.id);
310
+ }
317
311
 
318
312
  //#endregion
319
313
  export { CreatePageModal };
@@ -7,9 +7,9 @@ import * as React from "react";
7
7
  import { jsx, jsxs } from "react/jsx-runtime";
8
8
  import { Button } from "@camox/ui/button";
9
9
  import { Bold, Highlighter, Italic, Strikethrough } from "lucide-react";
10
- import { Kbd } from "@camox/ui/kbd";
11
10
  import { ButtonGroup } from "@camox/ui/button-group";
12
11
  import * as Tooltip$1 from "@camox/ui/tooltip";
12
+ import { Kbd } from "@camox/ui/kbd";
13
13
  import { FloatingToolbar } from "@camox/ui/floating-toolbar";
14
14
  import { Toggle } from "@camox/ui/toggle";
15
15
 
@@ -21,6 +21,23 @@ function useFrame() {
21
21
  if (!context) throw new Error("useFrame must be used within a Frame");
22
22
  return context;
23
23
  }
24
+ /** The stylesheets of a document's head that are the site's: not the studio's. */
25
+ const SITE_STYLESHEETS = "link[rel~=\"stylesheet\"], style";
26
+ const siteStylesheetsOf = (head) => Array.from(head.querySelectorAll(SITE_STYLESHEETS)).filter((element) => element.parentElement === head && isSiteStyle(element));
27
+ /**
28
+ * Gives the frame's document the site stylesheets of `html`, a site document: the ones it no
29
+ * longer has go, and its new ones are added, the rest of the frame left as it is.
30
+ */
31
+ function restyle(frame, html) {
32
+ const doc = frame.document;
33
+ const { DOMParser } = frame;
34
+ const wanted = siteStylesheetsOf(new DOMParser().parseFromString(html, "text/html").head);
35
+ const held = siteStylesheetsOf(doc.head);
36
+ const wantedMarkup = new Set(wanted.map((element) => element.outerHTML));
37
+ const heldMarkup = new Set(held.map((element) => element.outerHTML));
38
+ for (const element of held) if (!wantedMarkup.has(element.outerHTML)) element.remove();
39
+ for (const element of wanted) if (!heldMarkup.has(element.outerHTML)) doc.head.appendChild(doc.importNode(element, true));
40
+ }
24
41
  function ClearServerMarkup(t0) {
25
42
  const $ = c(4);
26
43
  const { nodes } = t0;
@@ -47,7 +64,7 @@ function ClearServerMarkup(t0) {
47
64
  function _temp(node) {
48
65
  return node.remove();
49
66
  }
50
- const Frame = ({ children, className, style, copyStyles = true, serverOnly = false, onIframeReady, iframeProps, inCanvas = false }) => {
67
+ const Frame = ({ children, className, style, copyStyles = true, onIframeReady, iframeProps, inCanvas = false }) => {
51
68
  const inCanvasRef = React.useRef(inCanvas);
52
69
  const navigate = useNavigate();
53
70
  const { pathname, hash, href } = useLocation();
@@ -92,7 +109,6 @@ const Frame = ({ children, className, style, copyStyles = true, serverOnly = fal
92
109
  const clonedStyle = style.cloneNode(true);
93
110
  iframeDoc.head.appendChild(clonedStyle);
94
111
  });
95
- if (serverOnly) return;
96
112
  setServerNodes(Array.from(root.childNodes));
97
113
  setMountNode(root);
98
114
  setIframeWindow(iframeWin);
@@ -107,8 +123,15 @@ const Frame = ({ children, className, style, copyStyles = true, serverOnly = fal
107
123
  }, [
108
124
  copyStyles,
109
125
  onIframeReady,
110
- srcDoc,
111
- serverOnly
126
+ srcDoc
127
+ ]);
128
+ React.useLayoutEffect(() => {
129
+ if (!iframeWindow || !previewDocument || srcDoc === "<!doctype html><html><head></head><body><div id=\"root\" data-camox-preview-root></div></body></html>") return;
130
+ restyle(iframeWindow, previewDocument);
131
+ }, [
132
+ iframeWindow,
133
+ previewDocument,
134
+ srcDoc
112
135
  ]);
113
136
  React.useLayoutEffect(() => {
114
137
  if (!iframeWindow || !mountNode) return;
@@ -1,7 +1,8 @@
1
- import { useAuthContext } from "../../../lib/auth.js";
2
- import { reads, useReadQuery } from "../../../lib/studio-reads.js";
1
+ import { useNavigate } from "../../navigation/navigation.js";
3
2
  import { cn } from "../../../lib/utils.js";
3
+ import { useLocalizedPath } from "../../../lib/view-locale.js";
4
4
  import { previewStore, selectionBlockId, selectionForPage } from "../previewStore.js";
5
+ import { STUDIO_SETTINGS_PATH } from "../../studio/routes.js";
5
6
  import { UserButton } from "../../studio/components/UserButton.js";
6
7
  import { PageInfo, PageMarkdownContent, PageSeoContent } from "./PageInfo.js";
7
8
  import { PageNavigatorHeader } from "./PageNavigatorHeader.js";
@@ -28,8 +29,8 @@ function MobilePreviewDrawer({ page, projectName }) {
28
29
  const [isExpanded, setIsExpanded] = React.useState(false);
29
30
  const [isDragging, setIsDragging] = React.useState(false);
30
31
  const [screen, setScreen] = React.useState("root");
31
- const authCtx = useAuthContext();
32
- const { data: project } = useReadQuery(reads.project({ projectUuid: authCtx.projectUuid }));
32
+ const navigate = useNavigate();
33
+ const localized = useLocalizedPath();
33
34
  const dragStartRef = React.useRef({
34
35
  y: 0,
35
36
  height: COLLAPSED_HEIGHT
@@ -200,11 +201,7 @@ function MobilePreviewDrawer({ page, projectName }) {
200
201
  /* @__PURE__ */ jsx(DrawerTile, {
201
202
  title: "Project settings",
202
203
  icon: Settings,
203
- onClick: () => {
204
- if (!project) return;
205
- window.open(`${authCtx.authenticationUrl}/${project.organizationSlug}/${project.slug}/overview`, "_blank", "noopener,noreferrer");
206
- },
207
- disabled: !project
204
+ onClick: () => void navigate({ to: localized("/camox/settings") })
208
205
  })
209
206
  ]
210
207
  })]