camox 0.14.2 → 0.16.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 (75) hide show
  1. package/dist/components/AuthGate.js +6 -0
  2. package/dist/core/components/AddBlockControlBar.js +30 -26
  3. package/dist/core/components/lexical/InlineContentEditable.js +19 -15
  4. package/dist/core/components/lexical/InlineLexicalEditor.js +62 -42
  5. package/dist/core/components/lexical/SelectionBroadcaster.js +25 -21
  6. package/dist/core/components/lexical/SidebarLexicalEditor.js +33 -21
  7. package/dist/core/createBlock.js +524 -488
  8. package/dist/core/createLayout.js +40 -28
  9. package/dist/core/hooks/useFieldSelection.js +12 -8
  10. package/dist/core/hooks/useIsEditable.js +6 -0
  11. package/dist/core/hooks/useOverlayMessage.js +19 -15
  12. package/dist/core/lib/contentType.d.ts +8 -8
  13. package/dist/core/lib/contentType.js +63 -0
  14. package/dist/features/content/CamoxContent.js +92 -88
  15. package/dist/features/content/components/AssetCard.js +46 -42
  16. package/dist/features/content/components/AssetCardSkeleton.js +8 -4
  17. package/dist/features/content/components/ContentSidebar.js +8 -4
  18. package/dist/features/content/components/UploadDropZone.js +31 -27
  19. package/dist/features/content/components/UploadProgressDrawer.js +98 -90
  20. package/dist/features/preview/CamoxPreview.js +162 -146
  21. package/dist/features/preview/components/AddBlockSheet.js +105 -101
  22. package/dist/features/preview/components/AgentChatSheet.js +74 -21
  23. package/dist/features/preview/components/AssetFieldEditor.js +98 -90
  24. package/dist/features/preview/components/AssetLightbox.js +21 -17
  25. package/dist/features/preview/components/AssetPickerGrid.js +84 -80
  26. package/dist/features/preview/components/BlockActionsPopover.js +35 -31
  27. package/dist/features/preview/components/BlockErrorBoundary.js +12 -8
  28. package/dist/features/preview/components/CreatePageModal.js +1 -1
  29. package/dist/features/preview/components/DebouncedFieldEditor.js +41 -37
  30. package/dist/features/preview/components/EditPageModal.js +114 -98
  31. package/dist/features/preview/components/FieldOverlayStyles.js +8 -4
  32. package/dist/features/preview/components/FieldToolbar.js +95 -54
  33. package/dist/features/preview/components/Frame.js +50 -46
  34. package/dist/features/preview/components/ItemFieldsEditor.js +81 -79
  35. package/dist/features/preview/components/LinkFieldEditor.js +138 -134
  36. package/dist/features/preview/components/MultipleAssetFieldEditor.js +105 -97
  37. package/dist/features/preview/components/OverlayTracker.js +19 -15
  38. package/dist/features/preview/components/Overlays.js +27 -23
  39. package/dist/features/preview/components/PageContentSheet.js +54 -4
  40. package/dist/features/preview/components/PageLocationFieldset.js +113 -109
  41. package/dist/features/preview/components/PagePicker.js +1 -1
  42. package/dist/features/preview/components/PageTree.js +443 -399
  43. package/dist/features/preview/components/PeekedBlock.js +69 -65
  44. package/dist/features/preview/components/PreviewPanel.js +64 -52
  45. package/dist/features/preview/components/PreviewSideSheet.js +25 -16
  46. package/dist/features/preview/components/PreviewToolbar.js +127 -123
  47. package/dist/features/preview/components/RepeatableItemsList.js +176 -171
  48. package/dist/features/preview/components/ShikiMarkdown.js +18 -14
  49. package/dist/features/preview/components/UnlinkAssetButton.js +74 -70
  50. package/dist/features/preview/components/useRepeatableItemActions.js +266 -0
  51. package/dist/features/preview/components/useUpdateBlockPosition.js +13 -9
  52. package/dist/features/provider/CamoxProvider.js +60 -52
  53. package/dist/features/provider/components/CamoxAppContext.js +10 -6
  54. package/dist/features/provider/components/CommandPalette.js +77 -69
  55. package/dist/features/provider/useAdminShortcuts.js +11 -7
  56. package/dist/features/routes/pageRoute.js +8 -4
  57. package/dist/features/studio/CamoxStudio.js +23 -19
  58. package/dist/features/studio/components/EnvironmentMenu.js +32 -28
  59. package/dist/features/studio/components/Navbar.js +62 -54
  60. package/dist/features/studio/components/ProjectMenu.js +131 -123
  61. package/dist/features/studio/components/UserButton.js +15 -11
  62. package/dist/features/studio/useTheme.js +82 -42
  63. package/dist/features/vite/definitionsSync.js +5 -5
  64. package/dist/features/vite/skillGeneration.js +43 -8
  65. package/dist/features/vite/vite.d.ts +1 -1
  66. package/dist/features/vite/vite.js +20 -2
  67. package/dist/hooks/use-marquee-selection.js +36 -32
  68. package/dist/lib/auth.js +49 -22
  69. package/dist/lib/normalized-data.js +55 -47
  70. package/dist/lib/use-project-room.js +22 -18
  71. package/dist/studio.css +1 -1
  72. package/package.json +10 -11
  73. package/skills/camox-block/SKILL.md +4 -0
  74. package/skills/camox-cli/SKILL.md +142 -0
  75. package/skills/camox-layout/SKILL.md +4 -0
@@ -24,14 +24,18 @@ const normalizeLinkValue = (value) => {
24
24
  return value;
25
25
  };
26
26
  const LinkFieldEditor = (t0) => {
27
- const $ = c(75);
27
+ const $ = c(76);
28
+ if ($[0] !== "fe9989574021dca3d84b6e4d5a16b1a739d91ba1250a8a3ea4bc0adfe2cf5512") {
29
+ for (let $i = 0; $i < 76; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
30
+ $[0] = "fe9989574021dca3d84b6e4d5a16b1a739d91ba1250a8a3ea4bc0adfe2cf5512";
31
+ }
28
32
  const { fieldName, linkValue: rawLinkValue, onSave } = t0;
29
33
  let t1;
30
- if ($[0] !== rawLinkValue) {
34
+ if ($[1] !== rawLinkValue) {
31
35
  t1 = normalizeLinkValue(rawLinkValue);
32
- $[0] = rawLinkValue;
33
- $[1] = t1;
34
- } else t1 = $[1];
36
+ $[1] = rawLinkValue;
37
+ $[2] = t1;
38
+ } else t1 = $[2];
35
39
  const linkValue = t1;
36
40
  const timerRef = React.useRef(null);
37
41
  const [text, setText] = React.useState(linkValue.text);
@@ -42,96 +46,96 @@ const LinkFieldEditor = (t0) => {
42
46
  const [pagePickerOpen, setPagePickerOpen] = React.useState(false);
43
47
  const projectSlug = useProjectSlug();
44
48
  let t2;
45
- if ($[2] !== projectSlug) {
49
+ if ($[3] !== projectSlug) {
46
50
  t2 = projectQueries.getBySlug(projectSlug);
47
- $[2] = projectSlug;
48
- $[3] = t2;
49
- } else t2 = $[3];
51
+ $[3] = projectSlug;
52
+ $[4] = t2;
53
+ } else t2 = $[4];
50
54
  const { data: project } = useQuery(t2);
51
55
  let t3;
52
- if ($[4] !== project?.id) {
56
+ if ($[5] !== project?.id) {
53
57
  t3 = pageQueries.list(project?.id ?? 0);
54
- $[4] = project?.id;
55
- $[5] = t3;
56
- } else t3 = $[5];
58
+ $[5] = project?.id;
59
+ $[6] = t3;
60
+ } else t3 = $[6];
57
61
  const t4 = !!project;
58
62
  let t5;
59
- if ($[6] !== t3 || $[7] !== t4) {
63
+ if ($[7] !== t3 || $[8] !== t4) {
60
64
  t5 = {
61
65
  ...t3,
62
66
  enabled: t4
63
67
  };
64
- $[6] = t3;
65
- $[7] = t4;
66
- $[8] = t5;
67
- } else t5 = $[8];
68
+ $[7] = t3;
69
+ $[8] = t4;
70
+ $[9] = t5;
71
+ } else t5 = $[9];
68
72
  const { data: pages } = useQuery(t5);
69
73
  const selectedPage = linkValue.type === "page" ? pages?.find((p) => String(p.id) === linkValue.pageId) : null;
70
74
  let t6;
71
75
  let t7;
72
- if ($[9] !== linkValue) {
76
+ if ($[10] !== linkValue) {
73
77
  t6 = () => {
74
78
  linkValueRef.current = linkValue;
75
79
  };
76
80
  t7 = [linkValue];
77
- $[9] = linkValue;
78
- $[10] = t6;
79
- $[11] = t7;
81
+ $[10] = linkValue;
82
+ $[11] = t6;
83
+ $[12] = t7;
80
84
  } else {
81
- t6 = $[10];
82
- t7 = $[11];
85
+ t6 = $[11];
86
+ t7 = $[12];
83
87
  }
84
88
  React.useEffect(t6, t7);
85
89
  let t8;
86
90
  let t9;
87
- if ($[12] !== isTextFocused || $[13] !== linkValue.text) {
91
+ if ($[13] !== isTextFocused || $[14] !== linkValue.text) {
88
92
  t8 = () => {
89
93
  if (!isTextFocused) setText(linkValue.text);
90
94
  };
91
95
  t9 = [linkValue.text, isTextFocused];
92
- $[12] = isTextFocused;
93
- $[13] = linkValue.text;
94
- $[14] = t8;
95
- $[15] = t9;
96
+ $[13] = isTextFocused;
97
+ $[14] = linkValue.text;
98
+ $[15] = t8;
99
+ $[16] = t9;
96
100
  } else {
97
- t8 = $[14];
98
- t9 = $[15];
101
+ t8 = $[15];
102
+ t9 = $[16];
99
103
  }
100
104
  React.useEffect(t8, t9);
101
105
  let t10;
102
- if ($[16] !== isHrefFocused || $[17] !== linkValue.href || $[18] !== linkValue.type) {
106
+ if ($[17] !== isHrefFocused || $[18] !== linkValue.href || $[19] !== linkValue.type) {
103
107
  t10 = () => {
104
108
  if (linkValue.type === "external" && !isHrefFocused) setHref(linkValue.href);
105
109
  };
106
- $[16] = isHrefFocused;
107
- $[17] = linkValue.href;
108
- $[18] = linkValue.type;
109
- $[19] = t10;
110
- } else t10 = $[19];
110
+ $[17] = isHrefFocused;
111
+ $[18] = linkValue.href;
112
+ $[19] = linkValue.type;
113
+ $[20] = t10;
114
+ } else t10 = $[20];
111
115
  let t11;
112
- if ($[20] !== isHrefFocused || $[21] !== linkValue) {
116
+ if ($[21] !== isHrefFocused || $[22] !== linkValue) {
113
117
  t11 = [linkValue, isHrefFocused];
114
- $[20] = isHrefFocused;
115
- $[21] = linkValue;
116
- $[22] = t11;
117
- } else t11 = $[22];
118
+ $[21] = isHrefFocused;
119
+ $[22] = linkValue;
120
+ $[23] = t11;
121
+ } else t11 = $[23];
118
122
  React.useEffect(t10, t11);
119
123
  let t12;
120
124
  let t13;
121
- if ($[23] === Symbol.for("react.memo_cache_sentinel")) {
125
+ if ($[24] === Symbol.for("react.memo_cache_sentinel")) {
122
126
  t12 = () => () => {
123
127
  if (timerRef.current) clearTimeout(timerRef.current);
124
128
  };
125
129
  t13 = [];
126
- $[23] = t12;
127
- $[24] = t13;
130
+ $[24] = t12;
131
+ $[25] = t13;
128
132
  } else {
129
- t12 = $[23];
130
- t13 = $[24];
133
+ t12 = $[24];
134
+ t13 = $[25];
131
135
  }
132
136
  React.useEffect(t12, t13);
133
137
  let t14;
134
- if ($[25] !== fieldName || $[26] !== onSave) {
138
+ if ($[26] !== fieldName || $[27] !== onSave) {
135
139
  t14 = (value) => {
136
140
  if (timerRef.current) clearTimeout(timerRef.current);
137
141
  timerRef.current = window.setTimeout(() => {
@@ -141,13 +145,13 @@ const LinkFieldEditor = (t0) => {
141
145
  });
142
146
  }, 500);
143
147
  };
144
- $[25] = fieldName;
145
- $[26] = onSave;
146
- $[27] = t14;
147
- } else t14 = $[27];
148
+ $[26] = fieldName;
149
+ $[27] = onSave;
150
+ $[28] = t14;
151
+ } else t14 = $[28];
148
152
  const handleTextChange = t14;
149
153
  let t15;
150
- if ($[28] !== fieldName || $[29] !== onSave) {
154
+ if ($[29] !== fieldName || $[30] !== onSave) {
151
155
  t15 = (value_0) => {
152
156
  if (timerRef.current) clearTimeout(timerRef.current);
153
157
  timerRef.current = window.setTimeout(() => {
@@ -157,13 +161,13 @@ const LinkFieldEditor = (t0) => {
157
161
  });
158
162
  }, 500);
159
163
  };
160
- $[28] = fieldName;
161
- $[29] = onSave;
162
- $[30] = t15;
163
- } else t15 = $[30];
164
+ $[29] = fieldName;
165
+ $[30] = onSave;
166
+ $[31] = t15;
167
+ } else t15 = $[31];
164
168
  const handleHrefChange = t15;
165
169
  let t16;
166
- if ($[31] !== fieldName || $[32] !== onSave) {
170
+ if ($[32] !== fieldName || $[33] !== onSave) {
167
171
  t16 = (mode) => {
168
172
  if (mode === "page") onSave(fieldName, {
169
173
  type: "page",
@@ -178,13 +182,13 @@ const LinkFieldEditor = (t0) => {
178
182
  newTab: linkValueRef.current.newTab
179
183
  });
180
184
  };
181
- $[31] = fieldName;
182
- $[32] = onSave;
183
- $[33] = t16;
184
- } else t16 = $[33];
185
+ $[32] = fieldName;
186
+ $[33] = onSave;
187
+ $[34] = t16;
188
+ } else t16 = $[34];
185
189
  const handleModeChange = t16;
186
190
  let t17;
187
- if ($[34] !== fieldName || $[35] !== onSave) {
191
+ if ($[35] !== fieldName || $[36] !== onSave) {
188
192
  t17 = (pageId) => {
189
193
  onSave(fieldName, {
190
194
  type: "page",
@@ -194,45 +198,45 @@ const LinkFieldEditor = (t0) => {
194
198
  });
195
199
  setPagePickerOpen(false);
196
200
  };
197
- $[34] = fieldName;
198
- $[35] = onSave;
199
- $[36] = t17;
200
- } else t17 = $[36];
201
+ $[35] = fieldName;
202
+ $[36] = onSave;
203
+ $[37] = t17;
204
+ } else t17 = $[37];
201
205
  const handlePageSelect = t17;
202
206
  const t18 = "grid gap-3";
203
207
  const t19 = `${fieldName}-text`;
204
208
  let t20;
205
- if ($[37] !== t19) {
209
+ if ($[38] !== t19) {
206
210
  t20 = /* @__PURE__ */ jsx(Label, {
207
211
  htmlFor: t19,
208
212
  children: "Text"
209
213
  });
210
- $[37] = t19;
211
- $[38] = t20;
212
- } else t20 = $[38];
214
+ $[38] = t19;
215
+ $[39] = t20;
216
+ } else t20 = $[39];
213
217
  const t21 = `${fieldName}-text`;
214
218
  let t22;
215
- if ($[39] !== handleTextChange) {
219
+ if ($[40] !== handleTextChange) {
216
220
  t22 = (e) => {
217
221
  setText(e.target.value);
218
222
  handleTextChange(e.target.value);
219
223
  };
220
- $[39] = handleTextChange;
221
- $[40] = t22;
222
- } else t22 = $[40];
224
+ $[40] = handleTextChange;
225
+ $[41] = t22;
226
+ } else t22 = $[41];
223
227
  let t23;
224
228
  let t24;
225
- if ($[41] === Symbol.for("react.memo_cache_sentinel")) {
229
+ if ($[42] === Symbol.for("react.memo_cache_sentinel")) {
226
230
  t23 = () => setIsTextFocused(true);
227
231
  t24 = () => setIsTextFocused(false);
228
- $[41] = t23;
229
- $[42] = t24;
232
+ $[42] = t23;
233
+ $[43] = t24;
230
234
  } else {
231
- t23 = $[41];
232
- t24 = $[42];
235
+ t23 = $[42];
236
+ t24 = $[43];
233
237
  }
234
238
  let t25;
235
- if ($[43] !== t21 || $[44] !== t22 || $[45] !== text) {
239
+ if ($[44] !== t21 || $[45] !== t22 || $[46] !== text) {
236
240
  t25 = /* @__PURE__ */ jsx(Input, {
237
241
  id: t21,
238
242
  value: text,
@@ -241,29 +245,29 @@ const LinkFieldEditor = (t0) => {
241
245
  onBlur: t24,
242
246
  autoFocus: true
243
247
  });
244
- $[43] = t21;
245
- $[44] = t22;
246
- $[45] = text;
247
- $[46] = t25;
248
- } else t25 = $[46];
248
+ $[44] = t21;
249
+ $[45] = t22;
250
+ $[46] = text;
251
+ $[47] = t25;
252
+ } else t25 = $[47];
249
253
  let t26;
250
- if ($[47] !== t20 || $[48] !== t25) {
254
+ if ($[48] !== t20 || $[49] !== t25) {
251
255
  t26 = /* @__PURE__ */ jsxs("div", {
252
256
  className: "grid gap-1.5",
253
257
  children: [t20, t25]
254
258
  });
255
- $[47] = t20;
256
- $[48] = t25;
257
- $[49] = t26;
258
- } else t26 = $[49];
259
+ $[48] = t20;
260
+ $[49] = t25;
261
+ $[50] = t26;
262
+ } else t26 = $[50];
259
263
  const t27 = "grid gap-1.5";
260
264
  let t28;
261
- if ($[50] === Symbol.for("react.memo_cache_sentinel")) {
265
+ if ($[51] === Symbol.for("react.memo_cache_sentinel")) {
262
266
  t28 = /* @__PURE__ */ jsx(Label, { children: "Destination" });
263
- $[50] = t28;
264
- } else t28 = $[50];
267
+ $[51] = t28;
268
+ } else t28 = $[51];
265
269
  let t29;
266
- if ($[51] === Symbol.for("react.memo_cache_sentinel")) {
270
+ if ($[52] === Symbol.for("react.memo_cache_sentinel")) {
267
271
  t29 = /* @__PURE__ */ jsxs(TabsList, {
268
272
  className: "w-full",
269
273
  children: [/* @__PURE__ */ jsx(TabsTrigger, {
@@ -274,19 +278,19 @@ const LinkFieldEditor = (t0) => {
274
278
  children: "URL"
275
279
  })]
276
280
  });
277
- $[51] = t29;
278
- } else t29 = $[51];
281
+ $[52] = t29;
282
+ } else t29 = $[52];
279
283
  let t30;
280
- if ($[52] !== handleModeChange || $[53] !== linkValue.type) {
284
+ if ($[53] !== handleModeChange || $[54] !== linkValue.type) {
281
285
  t30 = /* @__PURE__ */ jsx(Tabs, {
282
286
  value: linkValue.type,
283
287
  onValueChange: handleModeChange,
284
288
  children: t29
285
289
  });
286
- $[52] = handleModeChange;
287
- $[53] = linkValue.type;
288
- $[54] = t30;
289
- } else t30 = $[54];
290
+ $[53] = handleModeChange;
291
+ $[54] = linkValue.type;
292
+ $[55] = t30;
293
+ } else t30 = $[55];
290
294
  const t31 = linkValue.type === "page" ? /* @__PURE__ */ jsxs(Popover, {
291
295
  open: pagePickerOpen,
292
296
  onOpenChange: setPagePickerOpen,
@@ -334,7 +338,7 @@ const LinkFieldEditor = (t0) => {
334
338
  onBlur: () => setIsHrefFocused(false)
335
339
  });
336
340
  let t32;
337
- if ($[55] !== t28 || $[56] !== t30 || $[57] !== t31) {
341
+ if ($[56] !== t28 || $[57] !== t30 || $[58] !== t31) {
338
342
  t32 = /* @__PURE__ */ jsxs("div", {
339
343
  className: t27,
340
344
  children: [
@@ -343,58 +347,58 @@ const LinkFieldEditor = (t0) => {
343
347
  t31
344
348
  ]
345
349
  });
346
- $[55] = t28;
347
- $[56] = t30;
348
- $[57] = t31;
349
- $[58] = t32;
350
- } else t32 = $[58];
350
+ $[56] = t28;
351
+ $[57] = t30;
352
+ $[58] = t31;
353
+ $[59] = t32;
354
+ } else t32 = $[59];
351
355
  const t33 = `${fieldName}-newtab`;
352
356
  let t34;
353
- if ($[59] !== fieldName || $[60] !== onSave) {
357
+ if ($[60] !== fieldName || $[61] !== onSave) {
354
358
  t34 = (checked) => {
355
359
  onSave(fieldName, {
356
360
  ...linkValueRef.current,
357
361
  newTab: checked
358
362
  });
359
363
  };
360
- $[59] = fieldName;
361
- $[60] = onSave;
362
- $[61] = t34;
363
- } else t34 = $[61];
364
+ $[60] = fieldName;
365
+ $[61] = onSave;
366
+ $[62] = t34;
367
+ } else t34 = $[62];
364
368
  let t35;
365
- if ($[62] !== linkValue.newTab || $[63] !== t33 || $[64] !== t34) {
369
+ if ($[63] !== linkValue.newTab || $[64] !== t33 || $[65] !== t34) {
366
370
  t35 = /* @__PURE__ */ jsx(Switch, {
367
371
  id: t33,
368
372
  checked: linkValue.newTab,
369
373
  onCheckedChange: t34
370
374
  });
371
- $[62] = linkValue.newTab;
372
- $[63] = t33;
373
- $[64] = t34;
374
- $[65] = t35;
375
- } else t35 = $[65];
375
+ $[63] = linkValue.newTab;
376
+ $[64] = t33;
377
+ $[65] = t34;
378
+ $[66] = t35;
379
+ } else t35 = $[66];
376
380
  const t36 = `${fieldName}-newtab`;
377
381
  let t37;
378
- if ($[66] !== t36) {
382
+ if ($[67] !== t36) {
379
383
  t37 = /* @__PURE__ */ jsx(Label, {
380
384
  htmlFor: t36,
381
385
  children: "Open in new tab"
382
386
  });
383
- $[66] = t36;
384
- $[67] = t37;
385
- } else t37 = $[67];
387
+ $[67] = t36;
388
+ $[68] = t37;
389
+ } else t37 = $[68];
386
390
  let t38;
387
- if ($[68] !== t35 || $[69] !== t37) {
391
+ if ($[69] !== t35 || $[70] !== t37) {
388
392
  t38 = /* @__PURE__ */ jsxs("div", {
389
393
  className: "flex items-center gap-2",
390
394
  children: [t35, t37]
391
395
  });
392
- $[68] = t35;
393
- $[69] = t37;
394
- $[70] = t38;
395
- } else t38 = $[70];
396
+ $[69] = t35;
397
+ $[70] = t37;
398
+ $[71] = t38;
399
+ } else t38 = $[71];
396
400
  let t39;
397
- if ($[71] !== t26 || $[72] !== t32 || $[73] !== t38) {
401
+ if ($[72] !== t26 || $[73] !== t32 || $[74] !== t38) {
398
402
  t39 = /* @__PURE__ */ jsxs("form", {
399
403
  className: t18,
400
404
  children: [
@@ -403,11 +407,11 @@ const LinkFieldEditor = (t0) => {
403
407
  t38
404
408
  ]
405
409
  });
406
- $[71] = t26;
407
- $[72] = t32;
408
- $[73] = t38;
409
- $[74] = t39;
410
- } else t39 = $[74];
410
+ $[72] = t26;
411
+ $[73] = t32;
412
+ $[74] = t38;
413
+ $[75] = t39;
414
+ } else t39 = $[75];
411
415
  return t39;
412
416
  };
413
417