camox 0.3.0 → 0.3.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 (69) hide show
  1. package/dist/components/AuthGate.js +2 -1
  2. package/dist/core/components/AddBlockControlBar.js +117 -44
  3. package/dist/core/components/lexical/InlineContentEditable.js +37 -17
  4. package/dist/core/components/lexical/InlineLexicalEditor.js +84 -25
  5. package/dist/core/components/lexical/SelectionBroadcaster.js +84 -47
  6. package/dist/core/components/lexical/SidebarLexicalEditor.js +54 -19
  7. package/dist/core/createBlock.js +1172 -414
  8. package/dist/core/createLayout.js +48 -16
  9. package/dist/core/hooks/useFieldSelection.js +24 -13
  10. package/dist/core/hooks/useIsEditable.js +8 -2
  11. package/dist/core/hooks/useOverlayMessage.js +51 -20
  12. package/dist/features/content/CamoxContent.js +239 -107
  13. package/dist/features/content/components/AssetCard.js +78 -16
  14. package/dist/features/content/components/AssetCardSkeleton.js +11 -4
  15. package/dist/features/content/components/ContentSidebar.js +15 -8
  16. package/dist/features/content/components/UploadDropZone.js +77 -34
  17. package/dist/features/content/components/UploadProgressDrawer.js +201 -58
  18. package/dist/features/metadata/sitemap.js +15 -0
  19. package/dist/features/preview/CamoxPreview.js +447 -179
  20. package/dist/features/preview/components/AddBlockSheet.js +344 -167
  21. package/dist/features/preview/components/AgentChatSheet.js +32 -10
  22. package/dist/features/preview/components/AssetFieldEditor.js +185 -50
  23. package/dist/features/preview/components/AssetLightbox.js +60 -33
  24. package/dist/features/preview/components/AssetPickerGrid.js +203 -71
  25. package/dist/features/preview/components/BlockActionsPopover.js +295 -218
  26. package/dist/features/preview/components/CreatePageSheet.js +3 -3
  27. package/dist/features/preview/components/DebouncedFieldEditor.js +80 -23
  28. package/dist/features/preview/components/EditPageSheet.js +241 -86
  29. package/dist/features/preview/components/ItemFieldsEditor.js +209 -115
  30. package/dist/features/preview/components/LinkFieldEditor.js +351 -153
  31. package/dist/features/preview/components/MultipleAssetFieldEditor.js +245 -92
  32. package/dist/features/preview/components/OverlayTracker.js +58 -23
  33. package/dist/features/preview/components/Overlays.js +85 -43
  34. package/dist/features/preview/components/PageContentSheet.js +18 -18
  35. package/dist/features/preview/components/PageLocationFieldset.js +229 -63
  36. package/dist/features/preview/components/PagePicker.js +27 -27
  37. package/dist/features/preview/components/PageTree.js +921 -319
  38. package/dist/features/preview/components/PeekedBlock.js +173 -63
  39. package/dist/features/preview/components/PreviewPanel.js +271 -148
  40. package/dist/features/preview/components/PreviewSideSheet.js +44 -11
  41. package/dist/features/preview/components/PreviewToolbar.js +262 -59
  42. package/dist/features/preview/components/RepeatableItemsList.js +187 -78
  43. package/dist/features/preview/components/ShikiMarkdown.js +46 -20
  44. package/dist/features/preview/components/TextFormatToolbar.js +81 -23
  45. package/dist/features/preview/components/UnlinkAssetButton.js +161 -40
  46. package/dist/features/preview/components/useUpdateBlockPosition.js +64 -47
  47. package/dist/features/preview/previewStore.d.ts +2 -2
  48. package/dist/features/provider/CamoxProvider.js +69 -21
  49. package/dist/features/provider/actionsStore.d.ts +2 -2
  50. package/dist/features/provider/components/CamoxAppContext.js +15 -5
  51. package/dist/features/provider/components/CommandPalette.js +199 -92
  52. package/dist/features/provider/useAdminShortcuts.js +80 -64
  53. package/dist/features/routes/pageRoute.js +8 -1
  54. package/dist/features/studio/CamoxStudio.js +45 -9
  55. package/dist/features/studio/components/EnvironmentMenu.js +47 -12
  56. package/dist/features/studio/components/Navbar.js +163 -65
  57. package/dist/features/studio/components/ProjectMenu.js +263 -82
  58. package/dist/features/studio/components/UserButton.js +21 -6
  59. package/dist/features/studio/studioStore.d.ts +2 -2
  60. package/dist/features/studio/useTheme.js +128 -74
  61. package/dist/hooks/use-file-upload.js +11 -11
  62. package/dist/hooks/use-marquee-selection.js +121 -74
  63. package/dist/lib/auth.js +95 -51
  64. package/dist/lib/normalized-data.js +103 -30
  65. package/dist/lib/use-project-room.js +55 -22
  66. package/dist/studio.css +2 -2
  67. package/package.json +29 -26
  68. package/dist/lib/auth.d.ts +0 -2130
  69. package/dist/lib/auth.d.ts.map +0 -1
@@ -1,6 +1,7 @@
1
1
  import { previewStore } from "../previewStore.js";
2
2
  import { actionsStore } from "../../provider/actionsStore.js";
3
3
  import { cn, getActionShortcut } from "../../../lib/utils.js";
4
+ import { c } from "react/compiler-runtime";
4
5
  import { Kbd } from "@camox/ui/kbd";
5
6
  import { useSelector } from "@xstate/store/react";
6
7
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -12,68 +13,270 @@ import { FloatingToolbar } from "@camox/ui/floating-toolbar";
12
13
  import { Toggle } from "@camox/ui/toggle";
13
14
  //#region src/features/preview/components/PreviewToolbar.tsx
14
15
  var PreviewToolbar = () => {
15
- const isEditingLocked = useSelector(previewStore, (state) => state.context.isContentLocked);
16
- const isEditingPanelOpen = useSelector(previewStore, (state) => state.context.isSidebarOpen);
17
- const isPresentationMode = useSelector(previewStore, (state) => state.context.isPresentationMode);
18
- const isPageContentSheetOpen = useSelector(previewStore, (state) => state.context.isPageContentSheetOpen);
19
- const isAddBlockSheetOpen = useSelector(previewStore, (state) => state.context.isAddBlockSheetOpen);
20
- const isAgentChatSheetOpen = useSelector(previewStore, (state) => state.context.isAgentChatSheetOpen);
16
+ const $ = c(56);
17
+ const isEditingLocked = useSelector(previewStore, _temp);
18
+ const isEditingPanelOpen = useSelector(previewStore, _temp2);
19
+ const isPresentationMode = useSelector(previewStore, _temp3);
20
+ const isPageContentSheetOpen = useSelector(previewStore, _temp4);
21
+ const isAddBlockSheetOpen = useSelector(previewStore, _temp5);
22
+ const isAgentChatSheetOpen = useSelector(previewStore, _temp6);
21
23
  const isAnySideSheetOpen = isPageContentSheetOpen || isAddBlockSheetOpen || isAgentChatSheetOpen;
22
- const actions = useSelector(actionsStore, (state) => state.context.actions);
23
- const isMobileMode = useSelector(previewStore, (state) => state.context.isMobileMode);
24
- return /* @__PURE__ */ jsxs(FloatingToolbar, {
25
- className: cn("bottom-2 gap-4 justify-between", isAnySideSheetOpen && "opacity-0 pointer-events-none translate-y-full"),
26
- children: [/* @__PURE__ */ jsxs(ButtonGroup, { children: [
27
- /* @__PURE__ */ jsxs(Tooltip$1.Tooltip, { children: [/* @__PURE__ */ jsx(Tooltip$1.TooltipTrigger, {
28
- asChild: true,
29
- children: /* @__PURE__ */ jsx(Toggle, {
30
- "data-state": isEditingPanelOpen ? "off" : "on",
31
- pressed: !isEditingPanelOpen,
32
- variant: "outline",
33
- onClick: () => previewStore.send({ type: "toggleSidebar" }),
34
- children: /* @__PURE__ */ jsx(PanelRight, {})
35
- })
36
- }), /* @__PURE__ */ jsxs(Tooltip$1.TooltipContent, { children: ["Toggle sidebar ", getActionShortcut(actions, "toggle-editing-panel")] })] }),
37
- /* @__PURE__ */ jsxs(Tooltip$1.Tooltip, { children: [/* @__PURE__ */ jsx(Tooltip$1.TooltipTrigger, {
38
- asChild: true,
39
- children: /* @__PURE__ */ jsx(Toggle, {
40
- "data-state": isEditingLocked ? "on" : "off",
41
- pressed: isEditingLocked,
42
- onPressedChange: () => previewStore.send({ type: "toggleLockContent" }),
43
- variant: "outline",
44
- children: /* @__PURE__ */ jsx(Lock, {})
45
- })
46
- }), /* @__PURE__ */ jsxs(Tooltip$1.TooltipContent, { children: ["Toggle edit mode ", /* @__PURE__ */ jsx(Kbd, { children: "L" })] })] }),
47
- /* @__PURE__ */ jsxs(Tooltip$1.Tooltip, { children: [/* @__PURE__ */ jsx(Tooltip$1.TooltipTrigger, {
48
- asChild: true,
49
- children: /* @__PURE__ */ jsx(Toggle, {
50
- "data-state": isMobileMode ? "on" : "off",
51
- pressed: isMobileMode,
52
- onPressedChange: () => previewStore.send({ type: "toggleMobileMode" }),
53
- variant: "outline",
54
- children: /* @__PURE__ */ jsx(TabletSmartphone, {})
55
- })
56
- }), /* @__PURE__ */ jsxs(Tooltip$1.TooltipContent, { children: ["Toggle mobile layout ", getActionShortcut(actions, "toggle-mobile-mode")] })] }),
57
- /* @__PURE__ */ jsxs(Tooltip$1.Tooltip, { children: [/* @__PURE__ */ jsx(Tooltip$1.TooltipTrigger, {
58
- asChild: true,
59
- children: /* @__PURE__ */ jsxs(Toggle, {
60
- "data-state": isPresentationMode ? "on" : "off",
61
- pressed: isPresentationMode,
62
- variant: "outline",
63
- onClick: () => previewStore.send({ type: "enterPresentationMode" }),
64
- children: [/* @__PURE__ */ jsx(MonitorPlay, {}), "Preview"]
65
- })
66
- }), /* @__PURE__ */ jsxs(Tooltip$1.TooltipContent, { children: ["Hide all Camox UI ", getActionShortcut(actions, "enter-presentation-mode")] })] })
67
- ] }), /* @__PURE__ */ jsxs(Button, {
24
+ const actions = useSelector(actionsStore, _temp7);
25
+ const isMobileMode = useSelector(previewStore, _temp8);
26
+ const t0 = isAnySideSheetOpen && "opacity-0 pointer-events-none translate-y-full";
27
+ let t1;
28
+ if ($[0] !== t0) {
29
+ t1 = cn("bottom-2 gap-4 justify-between", t0);
30
+ $[0] = t0;
31
+ $[1] = t1;
32
+ } else t1 = $[1];
33
+ const t2 = isEditingPanelOpen ? "off" : "on";
34
+ const t3 = !isEditingPanelOpen;
35
+ let t4;
36
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
37
+ t4 = /* @__PURE__ */ jsx(PanelRight, {});
38
+ $[2] = t4;
39
+ } else t4 = $[2];
40
+ let t5;
41
+ if ($[3] !== t2 || $[4] !== t3) {
42
+ t5 = /* @__PURE__ */ jsx(Tooltip$1.TooltipTrigger, {
43
+ asChild: true,
44
+ children: /* @__PURE__ */ jsx(Toggle, {
45
+ "data-state": t2,
46
+ pressed: t3,
47
+ variant: "outline",
48
+ onClick: _temp9,
49
+ children: t4
50
+ })
51
+ });
52
+ $[3] = t2;
53
+ $[4] = t3;
54
+ $[5] = t5;
55
+ } else t5 = $[5];
56
+ let t6;
57
+ if ($[6] !== actions) {
58
+ t6 = getActionShortcut(actions, "toggle-editing-panel");
59
+ $[6] = actions;
60
+ $[7] = t6;
61
+ } else t6 = $[7];
62
+ let t7;
63
+ if ($[8] !== t6) {
64
+ t7 = /* @__PURE__ */ jsxs(Tooltip$1.TooltipContent, { children: ["Toggle sidebar ", t6] });
65
+ $[8] = t6;
66
+ $[9] = t7;
67
+ } else t7 = $[9];
68
+ let t8;
69
+ if ($[10] !== t5 || $[11] !== t7) {
70
+ t8 = /* @__PURE__ */ jsxs(Tooltip$1.Tooltip, { children: [t5, t7] });
71
+ $[10] = t5;
72
+ $[11] = t7;
73
+ $[12] = t8;
74
+ } else t8 = $[12];
75
+ const t9 = isEditingLocked ? "on" : "off";
76
+ let t10;
77
+ if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
78
+ t10 = /* @__PURE__ */ jsx(Lock, {});
79
+ $[13] = t10;
80
+ } else t10 = $[13];
81
+ let t11;
82
+ if ($[14] !== isEditingLocked || $[15] !== t9) {
83
+ t11 = /* @__PURE__ */ jsx(Tooltip$1.TooltipTrigger, {
84
+ asChild: true,
85
+ children: /* @__PURE__ */ jsx(Toggle, {
86
+ "data-state": t9,
87
+ pressed: isEditingLocked,
88
+ onPressedChange: _temp0,
89
+ variant: "outline",
90
+ children: t10
91
+ })
92
+ });
93
+ $[14] = isEditingLocked;
94
+ $[15] = t9;
95
+ $[16] = t11;
96
+ } else t11 = $[16];
97
+ let t12;
98
+ if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
99
+ t12 = /* @__PURE__ */ jsxs(Tooltip$1.TooltipContent, { children: ["Toggle edit mode ", /* @__PURE__ */ jsx(Kbd, { children: "L" })] });
100
+ $[17] = t12;
101
+ } else t12 = $[17];
102
+ let t13;
103
+ if ($[18] !== t11) {
104
+ t13 = /* @__PURE__ */ jsxs(Tooltip$1.Tooltip, { children: [t11, t12] });
105
+ $[18] = t11;
106
+ $[19] = t13;
107
+ } else t13 = $[19];
108
+ const t14 = isMobileMode ? "on" : "off";
109
+ let t15;
110
+ if ($[20] === Symbol.for("react.memo_cache_sentinel")) {
111
+ t15 = /* @__PURE__ */ jsx(TabletSmartphone, {});
112
+ $[20] = t15;
113
+ } else t15 = $[20];
114
+ let t16;
115
+ if ($[21] !== isMobileMode || $[22] !== t14) {
116
+ t16 = /* @__PURE__ */ jsx(Tooltip$1.TooltipTrigger, {
117
+ asChild: true,
118
+ children: /* @__PURE__ */ jsx(Toggle, {
119
+ "data-state": t14,
120
+ pressed: isMobileMode,
121
+ onPressedChange: _temp1,
122
+ variant: "outline",
123
+ children: t15
124
+ })
125
+ });
126
+ $[21] = isMobileMode;
127
+ $[22] = t14;
128
+ $[23] = t16;
129
+ } else t16 = $[23];
130
+ let t17;
131
+ if ($[24] !== actions) {
132
+ t17 = getActionShortcut(actions, "toggle-mobile-mode");
133
+ $[24] = actions;
134
+ $[25] = t17;
135
+ } else t17 = $[25];
136
+ let t18;
137
+ if ($[26] !== t17) {
138
+ t18 = /* @__PURE__ */ jsxs(Tooltip$1.TooltipContent, { children: ["Toggle mobile layout ", t17] });
139
+ $[26] = t17;
140
+ $[27] = t18;
141
+ } else t18 = $[27];
142
+ let t19;
143
+ if ($[28] !== t16 || $[29] !== t18) {
144
+ t19 = /* @__PURE__ */ jsxs(Tooltip$1.Tooltip, { children: [t16, t18] });
145
+ $[28] = t16;
146
+ $[29] = t18;
147
+ $[30] = t19;
148
+ } else t19 = $[30];
149
+ const t20 = isPresentationMode ? "on" : "off";
150
+ let t21;
151
+ if ($[31] === Symbol.for("react.memo_cache_sentinel")) {
152
+ t21 = /* @__PURE__ */ jsx(MonitorPlay, {});
153
+ $[31] = t21;
154
+ } else t21 = $[31];
155
+ let t22;
156
+ if ($[32] !== isPresentationMode || $[33] !== t20) {
157
+ t22 = /* @__PURE__ */ jsx(Tooltip$1.TooltipTrigger, {
158
+ asChild: true,
159
+ children: /* @__PURE__ */ jsxs(Toggle, {
160
+ "data-state": t20,
161
+ pressed: isPresentationMode,
162
+ variant: "outline",
163
+ onClick: _temp10,
164
+ children: [t21, "Preview"]
165
+ })
166
+ });
167
+ $[32] = isPresentationMode;
168
+ $[33] = t20;
169
+ $[34] = t22;
170
+ } else t22 = $[34];
171
+ let t23;
172
+ if ($[35] !== actions) {
173
+ t23 = getActionShortcut(actions, "enter-presentation-mode");
174
+ $[35] = actions;
175
+ $[36] = t23;
176
+ } else t23 = $[36];
177
+ let t24;
178
+ if ($[37] !== t23) {
179
+ t24 = /* @__PURE__ */ jsxs(Tooltip$1.TooltipContent, { children: ["Hide all Camox UI ", t23] });
180
+ $[37] = t23;
181
+ $[38] = t24;
182
+ } else t24 = $[38];
183
+ let t25;
184
+ if ($[39] !== t22 || $[40] !== t24) {
185
+ t25 = /* @__PURE__ */ jsxs(Tooltip$1.Tooltip, { children: [t22, t24] });
186
+ $[39] = t22;
187
+ $[40] = t24;
188
+ $[41] = t25;
189
+ } else t25 = $[41];
190
+ let t26;
191
+ if ($[42] !== t13 || $[43] !== t19 || $[44] !== t25 || $[45] !== t8) {
192
+ t26 = /* @__PURE__ */ jsxs(ButtonGroup, { children: [
193
+ t8,
194
+ t13,
195
+ t19,
196
+ t25
197
+ ] });
198
+ $[42] = t13;
199
+ $[43] = t19;
200
+ $[44] = t25;
201
+ $[45] = t8;
202
+ $[46] = t26;
203
+ } else t26 = $[46];
204
+ let t27;
205
+ if ($[47] === Symbol.for("react.memo_cache_sentinel")) {
206
+ t27 = /* @__PURE__ */ jsx("span", {
207
+ className: "text-muted-foreground",
208
+ children: "Ask for changes..."
209
+ });
210
+ $[47] = t27;
211
+ } else t27 = $[47];
212
+ let t28;
213
+ if ($[48] !== actions) {
214
+ t28 = getActionShortcut(actions, "open-agent-chat");
215
+ $[48] = actions;
216
+ $[49] = t28;
217
+ } else t28 = $[49];
218
+ let t29;
219
+ if ($[50] !== t28) {
220
+ t29 = /* @__PURE__ */ jsxs(Button, {
68
221
  variant: "outline",
69
222
  className: "bg-transparent dark:bg-transparent",
70
- onClick: () => previewStore.send({ type: "openAgentChatSheet" }),
71
- children: [/* @__PURE__ */ jsx("span", {
72
- className: "text-muted-foreground",
73
- children: "Ask for changes..."
74
- }), getActionShortcut(actions, "open-agent-chat")]
75
- })]
76
- });
223
+ onClick: _temp11,
224
+ children: [t27, t28]
225
+ });
226
+ $[50] = t28;
227
+ $[51] = t29;
228
+ } else t29 = $[51];
229
+ let t30;
230
+ if ($[52] !== t1 || $[53] !== t26 || $[54] !== t29) {
231
+ t30 = /* @__PURE__ */ jsxs(FloatingToolbar, {
232
+ className: t1,
233
+ children: [t26, t29]
234
+ });
235
+ $[52] = t1;
236
+ $[53] = t26;
237
+ $[54] = t29;
238
+ $[55] = t30;
239
+ } else t30 = $[55];
240
+ return t30;
77
241
  };
242
+ function _temp(state) {
243
+ return state.context.isContentLocked;
244
+ }
245
+ function _temp2(state_0) {
246
+ return state_0.context.isSidebarOpen;
247
+ }
248
+ function _temp3(state_1) {
249
+ return state_1.context.isPresentationMode;
250
+ }
251
+ function _temp4(state_2) {
252
+ return state_2.context.isPageContentSheetOpen;
253
+ }
254
+ function _temp5(state_3) {
255
+ return state_3.context.isAddBlockSheetOpen;
256
+ }
257
+ function _temp6(state_4) {
258
+ return state_4.context.isAgentChatSheetOpen;
259
+ }
260
+ function _temp7(state_5) {
261
+ return state_5.context.actions;
262
+ }
263
+ function _temp8(state_6) {
264
+ return state_6.context.isMobileMode;
265
+ }
266
+ function _temp9() {
267
+ return previewStore.send({ type: "toggleSidebar" });
268
+ }
269
+ function _temp0() {
270
+ return previewStore.send({ type: "toggleLockContent" });
271
+ }
272
+ function _temp1() {
273
+ return previewStore.send({ type: "toggleMobileMode" });
274
+ }
275
+ function _temp10() {
276
+ return previewStore.send({ type: "enterPresentationMode" });
277
+ }
278
+ function _temp11() {
279
+ return previewStore.send({ type: "openAgentChatSheet" });
280
+ }
78
281
  //#endregion
79
282
  export { PreviewToolbar };
@@ -1,6 +1,7 @@
1
1
  import { previewStore, selectionItemId } from "../previewStore.js";
2
2
  import { repeatableItemMutations } from "../../../lib/queries.js";
3
3
  import { cn } from "../../../lib/utils.js";
4
+ import { c } from "react/compiler-runtime";
4
5
  import { useMutation } from "@tanstack/react-query";
5
6
  import { useSelector } from "@xstate/store/react";
6
7
  import { generateKeyBetween } from "fractional-indexing";
@@ -13,85 +14,190 @@ import { restrictToVerticalAxis } from "@dnd-kit/modifiers";
13
14
  import { SortableContext, sortableKeyboardCoordinates, useSortable, verticalListSortingStrategy } from "@dnd-kit/sortable";
14
15
  import { CSS } from "@dnd-kit/utilities";
15
16
  //#region src/features/preview/components/RepeatableItemsList.tsx
16
- var SortableRepeatableItem = ({ item, fieldName, blockId, canRemove, onRemove }) => {
17
- const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable({ id: String(item.id) });
18
- const style = {
19
- transform: CSS.Transform.toString(transform),
20
- transition,
21
- opacity: isDragging ? .5 : 1
22
- };
23
- const isSelected = useSelector(previewStore, (state) => selectionItemId(state.context.selection) === String(item.id));
24
- const iframeElement = useSelector(previewStore, (state) => state.context.iframeElement);
17
+ var SortableRepeatableItem = (t0) => {
18
+ const $ = c(46);
19
+ const { item, fieldName, blockId, canRemove, onRemove } = t0;
20
+ const t1 = String(item.id);
21
+ let t2;
22
+ if ($[0] !== t1) {
23
+ t2 = { id: t1 };
24
+ $[0] = t1;
25
+ $[1] = t2;
26
+ } else t2 = $[1];
27
+ const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable(t2);
28
+ let t3;
29
+ if ($[2] !== transform) {
30
+ t3 = CSS.Transform.toString(transform);
31
+ $[2] = transform;
32
+ $[3] = t3;
33
+ } else t3 = $[3];
34
+ const t4 = isDragging ? .5 : 1;
35
+ let t5;
36
+ if ($[4] !== t3 || $[5] !== t4 || $[6] !== transition) {
37
+ t5 = {
38
+ transform: t3,
39
+ transition,
40
+ opacity: t4
41
+ };
42
+ $[4] = t3;
43
+ $[5] = t4;
44
+ $[6] = transition;
45
+ $[7] = t5;
46
+ } else t5 = $[7];
47
+ const style = t5;
48
+ let t6;
49
+ if ($[8] !== item.id) {
50
+ t6 = (state) => selectionItemId(state.context.selection) === String(item.id);
51
+ $[8] = item.id;
52
+ $[9] = t6;
53
+ } else t6 = $[9];
54
+ const isSelected = useSelector(previewStore, t6);
55
+ const iframeElement = useSelector(previewStore, _temp);
25
56
  const shouldShowHover = !isDragging && !isSelected;
26
- const handleMouseEnter = () => {
27
- if (!iframeElement?.contentWindow) return;
28
- const message = {
29
- type: "CAMOX_HOVER_REPEATER_ITEM",
30
- blockId,
31
- itemId: String(item.id)
57
+ let t7;
58
+ if ($[10] !== blockId || $[11] !== iframeElement || $[12] !== item.id) {
59
+ t7 = () => {
60
+ if (!iframeElement?.contentWindow) return;
61
+ const message = {
62
+ type: "CAMOX_HOVER_REPEATER_ITEM",
63
+ blockId,
64
+ itemId: String(item.id)
65
+ };
66
+ iframeElement.contentWindow.postMessage(message, "*");
32
67
  };
33
- iframeElement.contentWindow.postMessage(message, "*");
34
- };
35
- const handleMouseLeave = () => {
36
- if (!iframeElement?.contentWindow) return;
37
- const message = {
38
- type: "CAMOX_HOVER_REPEATER_ITEM_END",
39
- blockId,
40
- itemId: String(item.id)
68
+ $[10] = blockId;
69
+ $[11] = iframeElement;
70
+ $[12] = item.id;
71
+ $[13] = t7;
72
+ } else t7 = $[13];
73
+ const handleMouseEnter = t7;
74
+ let t8;
75
+ if ($[14] !== blockId || $[15] !== iframeElement || $[16] !== item.id) {
76
+ t8 = () => {
77
+ if (!iframeElement?.contentWindow) return;
78
+ const message_0 = {
79
+ type: "CAMOX_HOVER_REPEATER_ITEM_END",
80
+ blockId,
81
+ itemId: String(item.id)
82
+ };
83
+ iframeElement.contentWindow.postMessage(message_0, "*");
41
84
  };
42
- iframeElement.contentWindow.postMessage(message, "*");
43
- };
44
- return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs("div", {
45
- ref: setNodeRef,
46
- style,
47
- className: cn("flex flex-row justify-between items-center gap-2 px-1 py-1 max-w-full rounded-lg text-foreground transition-none group", shouldShowHover && "hover:bg-accent/75", isSelected && "bg-accent text-accent-foreground"),
48
- onMouseEnter: handleMouseEnter,
49
- onMouseLeave: handleMouseLeave,
50
- children: [
51
- /* @__PURE__ */ jsx(Button, {
85
+ $[14] = blockId;
86
+ $[15] = iframeElement;
87
+ $[16] = item.id;
88
+ $[17] = t8;
89
+ } else t8 = $[17];
90
+ const handleMouseLeave = t8;
91
+ const t9 = shouldShowHover && "hover:bg-accent/75";
92
+ const t10 = isSelected && "bg-accent text-accent-foreground";
93
+ let t11;
94
+ if ($[18] !== t10 || $[19] !== t9) {
95
+ t11 = cn("flex flex-row justify-between items-center gap-2 px-1 py-1 max-w-full rounded-lg text-foreground transition-none group", t9, t10);
96
+ $[18] = t10;
97
+ $[19] = t9;
98
+ $[20] = t11;
99
+ } else t11 = $[20];
100
+ let t12;
101
+ if ($[21] === Symbol.for("react.memo_cache_sentinel")) {
102
+ t12 = /* @__PURE__ */ jsx(GripVertical, { className: "h-4 w-4" });
103
+ $[21] = t12;
104
+ } else t12 = $[21];
105
+ let t13;
106
+ if ($[22] !== attributes || $[23] !== listeners) {
107
+ t13 = /* @__PURE__ */ jsx(Button, {
108
+ type: "button",
109
+ variant: "ghost",
110
+ size: "icon-sm",
111
+ className: "text-muted-foreground hover:text-foreground flex cursor-grab active:cursor-grabbing",
112
+ ...attributes,
113
+ ...listeners,
114
+ children: t12
115
+ });
116
+ $[22] = attributes;
117
+ $[23] = listeners;
118
+ $[24] = t13;
119
+ } else t13 = $[24];
120
+ let t14;
121
+ if ($[25] !== blockId || $[26] !== handleMouseLeave || $[27] !== item.id) {
122
+ t14 = () => {
123
+ handleMouseLeave();
124
+ previewStore.send({
125
+ type: "selectItem",
126
+ blockId,
127
+ itemId: String(item.id)
128
+ });
129
+ };
130
+ $[25] = blockId;
131
+ $[26] = handleMouseLeave;
132
+ $[27] = item.id;
133
+ $[28] = t14;
134
+ } else t14 = $[28];
135
+ const t15 = item.summary || `${fieldName} (${item.id})`;
136
+ let t16;
137
+ if ($[29] !== item.summary || $[30] !== t14 || $[31] !== t15) {
138
+ t16 = /* @__PURE__ */ jsx("div", {
139
+ className: "flex flex-1 items-center gap-1 overflow-x-hidden",
140
+ children: /* @__PURE__ */ jsx("p", {
141
+ className: "flex-1 cursor-default truncate py-1 text-sm",
142
+ title: item.summary,
143
+ onClick: t14,
144
+ children: t15
145
+ })
146
+ });
147
+ $[29] = item.summary;
148
+ $[30] = t14;
149
+ $[31] = t15;
150
+ $[32] = t16;
151
+ } else t16 = $[32];
152
+ let t17;
153
+ if ($[33] !== canRemove || $[34] !== item.id || $[35] !== onRemove) {
154
+ t17 = canRemove && /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
155
+ asChild: true,
156
+ children: /* @__PURE__ */ jsx(Button, {
52
157
  type: "button",
53
158
  variant: "ghost",
54
159
  size: "icon-sm",
55
- className: "text-muted-foreground hover:text-foreground flex cursor-grab active:cursor-grabbing",
56
- ...attributes,
57
- ...listeners,
58
- children: /* @__PURE__ */ jsx(GripVertical, { className: "h-4 w-4" })
59
- }),
60
- /* @__PURE__ */ jsx("div", {
61
- className: "flex flex-1 items-center gap-1 overflow-x-hidden",
62
- children: /* @__PURE__ */ jsx("p", {
63
- className: "flex-1 cursor-default truncate py-1 text-sm",
64
- title: item.summary,
65
- onClick: () => {
66
- handleMouseLeave();
67
- previewStore.send({
68
- type: "selectItem",
69
- blockId,
70
- itemId: String(item.id)
71
- });
72
- },
73
- children: item.summary || `${fieldName} (${item.id})`
74
- })
75
- }),
76
- canRemove && /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
77
- asChild: true,
78
- children: /* @__PURE__ */ jsx(Button, {
79
- type: "button",
80
- variant: "ghost",
81
- size: "icon-sm",
82
- className: "text-muted-foreground hover:text-foreground hidden shrink-0 group-focus-within:flex group-hover:flex",
83
- onClick: (e) => {
84
- e.stopPropagation();
85
- onRemove(String(item.id));
86
- },
87
- children: /* @__PURE__ */ jsx(CircleMinus, { className: "h-4 w-4" })
88
- })
89
- }), /* @__PURE__ */ jsx(TooltipContent, {
90
- side: "right",
91
- children: "Remove item"
92
- })] })
93
- ]
94
- }) });
160
+ className: "text-muted-foreground hover:text-foreground hidden shrink-0 group-focus-within:flex group-hover:flex",
161
+ onClick: (e) => {
162
+ e.stopPropagation();
163
+ onRemove(String(item.id));
164
+ },
165
+ children: /* @__PURE__ */ jsx(CircleMinus, { className: "h-4 w-4" })
166
+ })
167
+ }), /* @__PURE__ */ jsx(TooltipContent, {
168
+ side: "right",
169
+ children: "Remove item"
170
+ })] });
171
+ $[33] = canRemove;
172
+ $[34] = item.id;
173
+ $[35] = onRemove;
174
+ $[36] = t17;
175
+ } else t17 = $[36];
176
+ let t18;
177
+ if ($[37] !== handleMouseEnter || $[38] !== handleMouseLeave || $[39] !== setNodeRef || $[40] !== style || $[41] !== t11 || $[42] !== t13 || $[43] !== t16 || $[44] !== t17) {
178
+ t18 = /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs("div", {
179
+ ref: setNodeRef,
180
+ style,
181
+ className: t11,
182
+ onMouseEnter: handleMouseEnter,
183
+ onMouseLeave: handleMouseLeave,
184
+ children: [
185
+ t13,
186
+ t16,
187
+ t17
188
+ ]
189
+ }) });
190
+ $[37] = handleMouseEnter;
191
+ $[38] = handleMouseLeave;
192
+ $[39] = setNodeRef;
193
+ $[40] = style;
194
+ $[41] = t11;
195
+ $[42] = t13;
196
+ $[43] = t16;
197
+ $[44] = t17;
198
+ $[45] = t18;
199
+ } else t18 = $[45];
200
+ return t18;
95
201
  };
96
202
  var RepeatableItemsList = ({ items, blockId, fieldName, minItems, maxItems, schema }) => {
97
203
  const createRepeatableItem = useMutation(repeatableItemMutations.create());
@@ -157,7 +263,7 @@ var RepeatableItemsList = ({ items, blockId, fieldName, minItems, maxItems, sche
157
263
  const { active, over } = event;
158
264
  if (!over || active.id === over.id) return;
159
265
  const oldIndex = items.findIndex((item) => String(item.id) === active.id);
160
- const newIndex = items.findIndex((item) => String(item.id) === over.id);
266
+ const newIndex = items.findIndex((item_0) => String(item_0.id) === over.id);
161
267
  if (oldIndex === -1 || newIndex === -1) return;
162
268
  let afterPosition;
163
269
  let beforePosition;
@@ -182,17 +288,17 @@ var RepeatableItemsList = ({ items, blockId, fieldName, minItems, maxItems, sche
182
288
  onDragEnd: handleDragEnd,
183
289
  modifiers: [restrictToVerticalAxis],
184
290
  children: /* @__PURE__ */ jsx(SortableContext, {
185
- items: items.map((item) => String(item.id)),
291
+ items: items.map((item_1) => String(item_1.id)),
186
292
  strategy: verticalListSortingStrategy,
187
293
  children: /* @__PURE__ */ jsx("ul", {
188
294
  className: "flex flex-col gap-1",
189
- children: items.map((item) => /* @__PURE__ */ jsx(SortableRepeatableItem, {
190
- item,
295
+ children: items.map((item_2) => /* @__PURE__ */ jsx(SortableRepeatableItem, {
296
+ item: item_2,
191
297
  blockId,
192
298
  fieldName,
193
299
  canRemove,
194
300
  onRemove: handleRemoveItem
195
- }, String(item.id)))
301
+ }, String(item_2.id)))
196
302
  })
197
303
  })
198
304
  }), canAdd && /* @__PURE__ */ jsxs(Button, {
@@ -205,5 +311,8 @@ var RepeatableItemsList = ({ items, blockId, fieldName, minItems, maxItems, sche
205
311
  })]
206
312
  });
207
313
  };
314
+ function _temp(state_0) {
315
+ return state_0.context.iframeElement;
316
+ }
208
317
  //#endregion
209
318
  export { RepeatableItemsList };