camox 0.40.0 → 0.41.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.
Files changed (97) hide show
  1. package/dist/components/PlatformLabel.js +62 -0
  2. package/dist/core/components/lexical/GradientNode.js +126 -0
  3. package/dist/core/components/lexical/InlineLexicalEditor.js +37 -56
  4. package/dist/core/components/lexical/InlineStylesPlugin.js +183 -0
  5. package/dist/core/components/lexical/SelectionBroadcaster.js +49 -46
  6. package/dist/core/components/lexical/SidebarLexicalEditor.js +197 -151
  7. package/dist/core/components/lexical/editorConfig.js +25 -7
  8. package/dist/core/components/lexical/selectTextLink.js +21 -0
  9. package/dist/core/createApp.d.ts +30 -17
  10. package/dist/core/createApp.js +14 -3
  11. package/dist/core/createBlock.d.ts +2 -2
  12. package/dist/core/createBlock.js +18 -15
  13. package/dist/core/createLayout.d.ts +48 -4
  14. package/dist/core/createLayout.js +51 -23
  15. package/dist/core/derivedRoutes.js +36 -0
  16. package/dist/core/editing/createEditableBlock.d.ts +9 -8
  17. package/dist/core/editing/createEditableBlock.js +167 -168
  18. package/dist/core/lib/lexicalReact.d.ts +1 -26
  19. package/dist/core/lib/lexicalReact.js +46 -60
  20. package/dist/core/lib/lexicalState.js +164 -81
  21. package/dist/core/lib/modifierFormats.js +4 -15
  22. package/dist/core/lib/textStyles.d.ts +27 -0
  23. package/dist/core/lib/textStyles.js +47 -0
  24. package/dist/features/navigation/navigation.d.ts +2 -0
  25. package/dist/features/navigation/navigation.js +51 -46
  26. package/dist/features/page/DerivedPageContent.js +61 -0
  27. package/dist/features/page/PublishedPageContent.js +52 -83
  28. package/dist/features/page/SharedLayoutContent.js +66 -0
  29. package/dist/features/preview/CamoxPreview.d.ts +16 -1
  30. package/dist/features/preview/CamoxPreview.js +242 -265
  31. package/dist/features/preview/DerivedPreview.js +137 -0
  32. package/dist/features/preview/EditablePageExperience.js +25 -8
  33. package/dist/features/preview/components/AddBlockSidebar.js +43 -33
  34. package/dist/features/preview/components/AssetLightbox.js +1 -1
  35. package/dist/features/preview/components/BlockThumbnail.js +192 -0
  36. package/dist/features/preview/components/CreatePageModal.js +123 -115
  37. package/dist/features/preview/components/DerivedLayoutDialog.js +100 -0
  38. package/dist/features/preview/components/DerivedLayoutSidebar.d.ts +5 -0
  39. package/dist/features/preview/components/DerivedLayoutSidebar.js +163 -0
  40. package/dist/features/preview/components/DerivedPageInfoSidebar.js +57 -0
  41. package/dist/features/preview/components/FieldToolbar.js +42 -20
  42. package/dist/features/preview/components/Frame.js +133 -140
  43. package/dist/features/preview/components/LeftSidebar.js +42 -38
  44. package/dist/features/preview/components/MobilePreviewDrawer.js +4 -4
  45. package/dist/features/preview/components/Overlays.js +57 -42
  46. package/dist/features/preview/components/PageInfoSidebar.js +63 -55
  47. package/dist/features/preview/components/PageNavigatorSidebar.js +34 -483
  48. package/dist/features/preview/components/PagePicker.js +205 -153
  49. package/dist/features/preview/components/PageTree.js +298 -206
  50. package/dist/features/preview/components/PreviewActivation.js +78 -0
  51. package/dist/features/preview/components/PreviewPanel.js +67 -35
  52. package/dist/features/preview/components/PreviewToolbar.js +218 -232
  53. package/dist/features/preview/components/PublicationRow.js +431 -0
  54. package/dist/features/preview/components/PublishDialog.js +180 -97
  55. package/dist/features/preview/components/RightSidebar.js +19 -34
  56. package/dist/features/preview/components/previewStyles.js +8 -0
  57. package/dist/features/preview/components/useUpdateBlockPosition.js +7 -13
  58. package/dist/features/preview/previewConstants.js +8 -0
  59. package/dist/features/preview/previewStore.js +0 -10
  60. package/dist/features/preview/publication.js +71 -0
  61. package/dist/features/provider/AuthenticatedCamoxProvider.js +2 -1
  62. package/dist/features/provider/CoreCamoxProvider.js +11 -2
  63. package/dist/features/provider/LocalhostPreviewProvider.js +6 -7
  64. package/dist/features/routes/pageRuntime.d.ts +10 -0
  65. package/dist/features/routes/pageRuntime.js +7 -9
  66. package/dist/features/runtime/PreviewDocumentContext.js +7 -0
  67. package/dist/features/runtime/RuntimeChrome.js +137 -0
  68. package/dist/features/runtime/SharedChromeContext.js +7 -0
  69. package/dist/features/runtime/navigationRequest.js +21 -0
  70. package/dist/features/runtime/navigationTarget.js +23 -0
  71. package/dist/features/runtime/pageApp.js +196 -121
  72. package/dist/features/runtime/pageNavigation.js +79 -130
  73. package/dist/features/runtime/runtime.d.ts +11 -0
  74. package/dist/features/runtime/runtime.js +183 -47
  75. package/dist/features/runtime/studioApp.d.ts +2 -11
  76. package/dist/features/runtime/studioApp.js +14 -177
  77. package/dist/features/studio/CamoxStudio.js +27 -13
  78. package/dist/features/studio/components/Navbar.js +80 -74
  79. package/dist/features/studio/studioTheme.js +25 -0
  80. package/dist/features/studio/useTheme.js +94 -109
  81. package/dist/features/vite/appGeneration.js +12 -3
  82. package/dist/features/vite/definitionsSync.js +4 -2
  83. package/dist/features/vite/layoutGeneration.js +38 -0
  84. package/dist/features/vite/runtimeDev.js +3 -1
  85. package/dist/lib/auth.js +15 -13
  86. package/dist/lib/normalized-data.js +4 -4
  87. package/dist/lib/platform.js +13 -0
  88. package/dist/lib/utils.js +90 -38
  89. package/dist/studio-overlays.css +5 -40
  90. package/dist/studio.css +1 -1
  91. package/package.json +8 -4
  92. package/skills/camox/SKILL.md +2 -0
  93. package/skills/camox/references/block-definitions.md +31 -12
  94. package/skills/camox/references/layout-definitions.md +2 -0
  95. package/dist/core/lib/modifiers.js +0 -24
  96. package/dist/features/preview/previewQueryFns.js +0 -23
  97. package/dist/features/runtime/studioNavigation.js +0 -120
@@ -0,0 +1,78 @@
1
+ import { c } from "react/compiler-runtime";
2
+ import * as React from "react";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+
5
+ //#region src/features/preview/components/PreviewActivation.tsx
6
+ /** A replacement preview must load its document and commit before we reveal it. */
7
+ const PreviewActivationContext = React.createContext(void 0);
8
+ function PreviewActivation(t0) {
9
+ const $ = c(16);
10
+ if ($[0] !== "7173efcb0430a426f5e87095e95173285c836e918e936cfcdfbdaa6d172fdb6a") {
11
+ for (let $i = 0; $i < 16; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
12
+ $[0] = "7173efcb0430a426f5e87095e95173285c836e918e936cfcdfbdaa6d172fdb6a";
13
+ }
14
+ const { fallback, children } = t0;
15
+ const [ready, setReady] = React.useState(false);
16
+ let t1;
17
+ if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
18
+ t1 = () => setReady(true);
19
+ $[1] = t1;
20
+ } else t1 = $[1];
21
+ const activate = t1;
22
+ const t2 = ready ? void 0 : "hidden";
23
+ let t3;
24
+ if ($[2] !== t2) {
25
+ t3 = { visibility: t2 };
26
+ $[2] = t2;
27
+ $[3] = t3;
28
+ } else t3 = $[3];
29
+ const t4 = ready ? fallback : null;
30
+ let t5;
31
+ if ($[4] !== children || $[5] !== t4) {
32
+ t5 = /* @__PURE__ */ jsx(PreviewActivationContext.Provider, {
33
+ value: activate,
34
+ children: /* @__PURE__ */ jsx(React.Suspense, {
35
+ fallback: t4,
36
+ children
37
+ })
38
+ });
39
+ $[4] = children;
40
+ $[5] = t4;
41
+ $[6] = t5;
42
+ } else t5 = $[6];
43
+ let t6;
44
+ if ($[7] !== t3 || $[8] !== t5) {
45
+ t6 = /* @__PURE__ */ jsx("div", {
46
+ className: "flex min-h-0 flex-1 flex-col",
47
+ style: t3,
48
+ children: t5
49
+ });
50
+ $[7] = t3;
51
+ $[8] = t5;
52
+ $[9] = t6;
53
+ } else t6 = $[9];
54
+ let t7;
55
+ if ($[10] !== fallback || $[11] !== ready) {
56
+ t7 = !ready && /* @__PURE__ */ jsx("div", {
57
+ className: "absolute inset-0",
58
+ children: fallback
59
+ });
60
+ $[10] = fallback;
61
+ $[11] = ready;
62
+ $[12] = t7;
63
+ } else t7 = $[12];
64
+ let t8;
65
+ if ($[13] !== t6 || $[14] !== t7) {
66
+ t8 = /* @__PURE__ */ jsxs("div", {
67
+ className: "relative flex min-h-0 flex-1 flex-col",
68
+ children: [t6, t7]
69
+ });
70
+ $[13] = t6;
71
+ $[14] = t7;
72
+ $[15] = t8;
73
+ } else t8 = $[15];
74
+ return t8;
75
+ }
76
+
77
+ //#endregion
78
+ export { PreviewActivation, PreviewActivationContext };
@@ -1,5 +1,6 @@
1
1
  import { actionsStore } from "../../provider/actionsStore.js";
2
2
  import { checkIfInputFocused, cn } from "../../../lib/utils.js";
3
+ import { SharedChromeContext } from "../../runtime/SharedChromeContext.js";
3
4
  import { previewStore } from "../previewStore.js";
4
5
  import { useBlockActionsShortcuts } from "./BlockActionsPopover.js";
5
6
  import { FieldOverlayStyles } from "./FieldOverlayStyles.js";
@@ -18,9 +19,9 @@ import { PanelContent } from "@camox/ui/panel";
18
19
  //#region src/features/preview/components/PreviewPanel.tsx
19
20
  const PreviewFrame = (t0) => {
20
21
  const $ = c(9);
21
- if ($[0] !== "e11c3b34ca0f5fb034c9be15c118c7ca06abc87dbf81a94c0e4b32239a67ad26") {
22
+ if ($[0] !== "d1fef758f47859e4d6ac1a8436e009a46839990f032b83d1c6b20b946ff84297") {
22
23
  for (let $i = 0; $i < 9; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
23
- $[0] = "e11c3b34ca0f5fb034c9be15c118c7ca06abc87dbf81a94c0e4b32239a67ad26";
24
+ $[0] = "d1fef758f47859e4d6ac1a8436e009a46839990f032b83d1c6b20b946ff84297";
24
25
  }
25
26
  const { children, style, className, onIframeReady } = t0;
26
27
  let t1;
@@ -61,9 +62,9 @@ const PreviewFrame = (t0) => {
61
62
  };
62
63
  const KeyDownForwarder = () => {
63
64
  const $ = c(5);
64
- if ($[0] !== "e11c3b34ca0f5fb034c9be15c118c7ca06abc87dbf81a94c0e4b32239a67ad26") {
65
+ if ($[0] !== "d1fef758f47859e4d6ac1a8436e009a46839990f032b83d1c6b20b946ff84297") {
65
66
  for (let $i = 0; $i < 5; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
66
- $[0] = "e11c3b34ca0f5fb034c9be15c118c7ca06abc87dbf81a94c0e4b32239a67ad26";
67
+ $[0] = "d1fef758f47859e4d6ac1a8436e009a46839990f032b83d1c6b20b946ff84297";
67
68
  }
68
69
  const { window: iframeWindow } = useFrame();
69
70
  const actions = useSelector(actionsStore, _temp);
@@ -112,16 +113,25 @@ const viewportClassName = {
112
113
  tablet: "h-[1024px] w-[768px] max-h-full max-w-full",
113
114
  mobile: "h-175 w-[393px] max-h-full max-w-full"
114
115
  };
116
+ function CuratedBlockShortcuts() {
117
+ const $ = c(1);
118
+ if ($[0] !== "d1fef758f47859e4d6ac1a8436e009a46839990f032b83d1c6b20b946ff84297") {
119
+ for (let $i = 0; $i < 1; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
120
+ $[0] = "d1fef758f47859e4d6ac1a8436e009a46839990f032b83d1c6b20b946ff84297";
121
+ }
122
+ useBlockActionsShortcuts();
123
+ return null;
124
+ }
115
125
  const PreviewPanel = (t0) => {
116
- const $ = c(17);
117
- if ($[0] !== "e11c3b34ca0f5fb034c9be15c118c7ca06abc87dbf81a94c0e4b32239a67ad26") {
118
- for (let $i = 0; $i < 17; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
119
- $[0] = "e11c3b34ca0f5fb034c9be15c118c7ca06abc87dbf81a94c0e4b32239a67ad26";
126
+ const $ = c(26);
127
+ if ($[0] !== "d1fef758f47859e4d6ac1a8436e009a46839990f032b83d1c6b20b946ff84297") {
128
+ for (let $i = 0; $i < 26; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
129
+ $[0] = "d1fef758f47859e4d6ac1a8436e009a46839990f032b83d1c6b20b946ff84297";
120
130
  }
121
131
  const { children, isMobileExperience: t1, page, projectName: t2, toolbarProps } = t0;
122
132
  const isMobileExperience = t1 === void 0 ? false : t1;
123
133
  const projectName = t2 === void 0 ? "Project" : t2;
124
- useBlockActionsShortcuts();
134
+ const sharedChrome = React.useContext(SharedChromeContext);
125
135
  const iframeElement = useSelector(previewStore, _temp2);
126
136
  const handleIframeReady = _temp3;
127
137
  const viewportMode = useSelector(previewStore, _temp4);
@@ -134,7 +144,6 @@ const PreviewPanel = (t0) => {
134
144
  } else t3 = $[1];
135
145
  React.useEffect(_temp16, t3);
136
146
  if (isMobileExperience) {
137
- if (!page) return null;
138
147
  let t4;
139
148
  if ($[2] !== children) {
140
149
  t4 = /* @__PURE__ */ jsx("div", {
@@ -149,31 +158,39 @@ const PreviewPanel = (t0) => {
149
158
  $[3] = t4;
150
159
  } else t4 = $[3];
151
160
  let t5;
152
- if ($[4] !== isToolbarHidden || $[5] !== page || $[6] !== projectName) {
153
- t5 = !isToolbarHidden && /* @__PURE__ */ jsx(MobilePreviewDrawer, {
161
+ if ($[4] !== isToolbarHidden || $[5] !== page || $[6] !== projectName || $[7] !== sharedChrome || $[8] !== toolbarProps) {
162
+ t5 = !isToolbarHidden && (page ? /* @__PURE__ */ jsx(MobilePreviewDrawer, {
154
163
  page,
155
164
  projectName
156
- });
165
+ }) : !sharedChrome && /* @__PURE__ */ jsx(PreviewToolbar, { ...toolbarProps }));
157
166
  $[4] = isToolbarHidden;
158
167
  $[5] = page;
159
168
  $[6] = projectName;
160
- $[7] = t5;
161
- } else t5 = $[7];
169
+ $[7] = sharedChrome;
170
+ $[8] = toolbarProps;
171
+ $[9] = t5;
172
+ } else t5 = $[9];
162
173
  let t6;
163
- if ($[8] !== t4 || $[9] !== t5) {
174
+ if ($[10] !== t4 || $[11] !== t5) {
164
175
  t6 = /* @__PURE__ */ jsxs(PanelContent, {
165
176
  className: "flex min-h-0 flex-col overflow-hidden bg-black",
166
177
  children: [t4, t5]
167
178
  });
168
- $[8] = t4;
169
- $[9] = t5;
170
- $[10] = t6;
171
- } else t6 = $[10];
179
+ $[10] = t4;
180
+ $[11] = t5;
181
+ $[12] = t6;
182
+ } else t6 = $[12];
172
183
  return t6;
173
184
  }
174
185
  let t4;
175
- if ($[11] !== children || $[12] !== iframeElement || $[13] !== isEditMode || $[14] !== toolbarProps || $[15] !== viewportMode) {
176
- t4 = /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(PanelContent, {
186
+ if ($[13] !== page) {
187
+ t4 = page && /* @__PURE__ */ jsx(CuratedBlockShortcuts, {});
188
+ $[13] = page;
189
+ $[14] = t4;
190
+ } else t4 = $[14];
191
+ let t5;
192
+ if ($[15] !== children || $[16] !== iframeElement || $[17] !== isEditMode || $[18] !== page || $[19] !== sharedChrome || $[20] !== toolbarProps || $[21] !== viewportMode) {
193
+ t5 = /* @__PURE__ */ jsx(PanelContent, {
177
194
  className: "relative overflow-hidden bg-black",
178
195
  children: /* @__PURE__ */ jsx("div", {
179
196
  className: "absolute inset-0",
@@ -183,9 +200,12 @@ const PreviewPanel = (t0) => {
183
200
  onIframeReady: handleIframeReady,
184
201
  children
185
202
  }),
186
- isEditMode && /* @__PURE__ */ jsx(Overlays, { iframeElement }),
203
+ isEditMode && /* @__PURE__ */ jsx(Overlays, {
204
+ iframeElement,
205
+ canAddBlocks: !!page
206
+ }),
187
207
  isEditMode && /* @__PURE__ */ jsx(FieldToolbar, {}),
188
- /* @__PURE__ */ jsx(PreviewToolbar, { ...toolbarProps })
208
+ !sharedChrome && /* @__PURE__ */ jsx(PreviewToolbar, { ...toolbarProps })
189
209
  ] }) : /* @__PURE__ */ jsxs("div", {
190
210
  className: cn("checkered flex h-full justify-center", isEditMode ? "items-start" : "items-center"),
191
211
  children: [
@@ -195,22 +215,34 @@ const PreviewPanel = (t0) => {
195
215
  className: "overflow-auto",
196
216
  onIframeReady: handleIframeReady,
197
217
  children
198
- }), isEditMode && /* @__PURE__ */ jsx(Overlays, { iframeElement })]
218
+ }), isEditMode && /* @__PURE__ */ jsx(Overlays, {
219
+ iframeElement,
220
+ canAddBlocks: !!page
221
+ })]
199
222
  }),
200
223
  isEditMode && /* @__PURE__ */ jsx(FieldToolbar, {}),
201
- /* @__PURE__ */ jsx(PreviewToolbar, { ...toolbarProps })
224
+ !sharedChrome && /* @__PURE__ */ jsx(PreviewToolbar, { ...toolbarProps })
202
225
  ]
203
226
  })
204
227
  })
205
- }) });
206
- $[11] = children;
207
- $[12] = iframeElement;
208
- $[13] = isEditMode;
209
- $[14] = toolbarProps;
210
- $[15] = viewportMode;
211
- $[16] = t4;
212
- } else t4 = $[16];
213
- return t4;
228
+ });
229
+ $[15] = children;
230
+ $[16] = iframeElement;
231
+ $[17] = isEditMode;
232
+ $[18] = page;
233
+ $[19] = sharedChrome;
234
+ $[20] = toolbarProps;
235
+ $[21] = viewportMode;
236
+ $[22] = t5;
237
+ } else t5 = $[22];
238
+ let t6;
239
+ if ($[23] !== t4 || $[24] !== t5) {
240
+ t6 = /* @__PURE__ */ jsxs(Fragment, { children: [t4, t5] });
241
+ $[23] = t4;
242
+ $[24] = t5;
243
+ $[25] = t6;
244
+ } else t6 = $[25];
245
+ return t6;
214
246
  };
215
247
  function _temp(state) {
216
248
  return state.context.actions;