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
@@ -11,35 +11,39 @@ import { AlertDialog, AlertDialogAction, AlertDialogContent, AlertDialogDescript
11
11
 
12
12
  //#region src/features/preview/components/UnlinkAssetButton.tsx
13
13
  const UnlinkAssetButton = (t0) => {
14
- const $ = c(37);
14
+ const $ = c(38);
15
+ if ($[0] !== "98ef69b59dc7ee877222a6436f2d70c9eec7d4caa8c5a4bed248c1b5cf221d00") {
16
+ for (let $i = 0; $i < 38; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
17
+ $[0] = "98ef69b59dc7ee877222a6436f2d70c9eec7d4caa8c5a4bed248c1b5cf221d00";
18
+ }
15
19
  const { fileId, onUnlink, className } = t0;
16
20
  const [dialogOpen, setDialogOpen] = useState(false);
17
21
  let t1;
18
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
22
+ if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
19
23
  t1 = fileMutations.delete();
20
- $[0] = t1;
21
- } else t1 = $[0];
24
+ $[1] = t1;
25
+ } else t1 = $[1];
22
26
  const deleteFile = useMutation(t1);
23
27
  let t2;
24
- if ($[1] !== fileId) {
28
+ if ($[2] !== fileId) {
25
29
  t2 = fileQueries.getUsageCount(fileId);
26
- $[1] = fileId;
27
- $[2] = t2;
28
- } else t2 = $[2];
30
+ $[2] = fileId;
31
+ $[3] = t2;
32
+ } else t2 = $[3];
29
33
  const t3 = !!fileId;
30
34
  let t4;
31
- if ($[3] !== t2 || $[4] !== t3) {
35
+ if ($[4] !== t2 || $[5] !== t3) {
32
36
  t4 = {
33
37
  ...t2,
34
38
  enabled: t3
35
39
  };
36
- $[3] = t2;
37
- $[4] = t3;
38
- $[5] = t4;
39
- } else t4 = $[5];
40
+ $[4] = t2;
41
+ $[5] = t3;
42
+ $[6] = t4;
43
+ } else t4 = $[6];
40
44
  const { data: usageCount } = useQuery(t4);
41
45
  let t5;
42
- if ($[6] !== fileId || $[7] !== onUnlink || $[8] !== usageCount) {
46
+ if ($[7] !== fileId || $[8] !== onUnlink || $[9] !== usageCount) {
43
47
  t5 = (e) => {
44
48
  e.stopPropagation();
45
49
  if (!fileId || usageCount === void 0 || usageCount > 1) {
@@ -48,20 +52,20 @@ const UnlinkAssetButton = (t0) => {
48
52
  }
49
53
  setDialogOpen(true);
50
54
  };
51
- $[6] = fileId;
52
- $[7] = onUnlink;
53
- $[8] = usageCount;
54
- $[9] = t5;
55
- } else t5 = $[9];
55
+ $[7] = fileId;
56
+ $[8] = onUnlink;
57
+ $[9] = usageCount;
58
+ $[10] = t5;
59
+ } else t5 = $[10];
56
60
  const handleClick = t5;
57
61
  let t6;
58
- if ($[10] !== className) {
62
+ if ($[11] !== className) {
59
63
  t6 = cn("text-muted-foreground hover:text-foreground shrink-0", className);
60
- $[10] = className;
61
- $[11] = t6;
62
- } else t6 = $[11];
64
+ $[11] = className;
65
+ $[12] = t6;
66
+ } else t6 = $[12];
63
67
  let t7;
64
- if ($[12] !== handleClick || $[13] !== t6) {
68
+ if ($[13] !== handleClick || $[14] !== t6) {
65
69
  t7 = /* @__PURE__ */ jsx(Button, {
66
70
  type: "button",
67
71
  variant: "ghost",
@@ -69,53 +73,53 @@ const UnlinkAssetButton = (t0) => {
69
73
  className: t6,
70
74
  onClick: handleClick
71
75
  });
72
- $[12] = handleClick;
73
- $[13] = t6;
74
- $[14] = t7;
75
- } else t7 = $[14];
76
+ $[13] = handleClick;
77
+ $[14] = t6;
78
+ $[15] = t7;
79
+ } else t7 = $[15];
76
80
  let t8;
77
- if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
81
+ if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
78
82
  t8 = /* @__PURE__ */ jsx(X, { className: "h-4 w-4" });
79
- $[15] = t8;
80
- } else t8 = $[15];
83
+ $[16] = t8;
84
+ } else t8 = $[16];
81
85
  let t9;
82
- if ($[16] !== t7) {
86
+ if ($[17] !== t7) {
83
87
  t9 = /* @__PURE__ */ jsx(TooltipTrigger, {
84
88
  render: t7,
85
89
  children: t8
86
90
  });
87
- $[16] = t7;
88
- $[17] = t9;
89
- } else t9 = $[17];
91
+ $[17] = t7;
92
+ $[18] = t9;
93
+ } else t9 = $[18];
90
94
  let t10;
91
- if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
95
+ if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
92
96
  t10 = /* @__PURE__ */ jsx(TooltipContent, { children: "Unlink" });
93
- $[18] = t10;
94
- } else t10 = $[18];
97
+ $[19] = t10;
98
+ } else t10 = $[19];
95
99
  let t11;
96
- if ($[19] !== t9) {
100
+ if ($[20] !== t9) {
97
101
  t11 = /* @__PURE__ */ jsxs(Tooltip, { children: [t9, t10] });
98
- $[19] = t9;
99
- $[20] = t11;
100
- } else t11 = $[20];
102
+ $[20] = t9;
103
+ $[21] = t11;
104
+ } else t11 = $[21];
101
105
  let t12;
102
- if ($[21] === Symbol.for("react.memo_cache_sentinel")) {
106
+ if ($[22] === Symbol.for("react.memo_cache_sentinel")) {
103
107
  t12 = /* @__PURE__ */ jsxs(AlertDialogHeader, { children: [/* @__PURE__ */ jsx(AlertDialogTitle, { children: "Unlink file" }), /* @__PURE__ */ jsx(AlertDialogDescription, { children: "This file is not used anywhere else. Would you like to also delete it?" })] });
104
- $[21] = t12;
105
- } else t12 = $[21];
108
+ $[22] = t12;
109
+ } else t12 = $[22];
106
110
  let t13;
107
- if ($[22] !== onUnlink) {
111
+ if ($[23] !== onUnlink) {
108
112
  t13 = /* @__PURE__ */ jsx(AlertDialogAction, {
109
113
  variant: "outline",
110
114
  className: "bg-background hover:bg-accent text-foreground",
111
115
  onClick: () => onUnlink(),
112
116
  children: "Unlink only"
113
117
  });
114
- $[22] = onUnlink;
115
- $[23] = t13;
116
- } else t13 = $[23];
118
+ $[23] = onUnlink;
119
+ $[24] = t13;
120
+ } else t13 = $[24];
117
121
  let t14;
118
- if ($[24] !== deleteFile || $[25] !== fileId || $[26] !== onUnlink) {
122
+ if ($[25] !== deleteFile || $[26] !== fileId || $[27] !== onUnlink) {
119
123
  t14 = /* @__PURE__ */ jsx(AlertDialogAction, {
120
124
  onClick: () => {
121
125
  onUnlink();
@@ -123,36 +127,36 @@ const UnlinkAssetButton = (t0) => {
123
127
  },
124
128
  children: "Delete file"
125
129
  });
126
- $[24] = deleteFile;
127
- $[25] = fileId;
128
- $[26] = onUnlink;
129
- $[27] = t14;
130
- } else t14 = $[27];
130
+ $[25] = deleteFile;
131
+ $[26] = fileId;
132
+ $[27] = onUnlink;
133
+ $[28] = t14;
134
+ } else t14 = $[28];
131
135
  let t15;
132
- if ($[28] !== t13 || $[29] !== t14) {
136
+ if ($[29] !== t13 || $[30] !== t14) {
133
137
  t15 = /* @__PURE__ */ jsxs(AlertDialogContent, { children: [t12, /* @__PURE__ */ jsxs(AlertDialogFooter, { children: [t13, t14] })] });
134
- $[28] = t13;
135
- $[29] = t14;
136
- $[30] = t15;
137
- } else t15 = $[30];
138
+ $[29] = t13;
139
+ $[30] = t14;
140
+ $[31] = t15;
141
+ } else t15 = $[31];
138
142
  let t16;
139
- if ($[31] !== dialogOpen || $[32] !== t15) {
143
+ if ($[32] !== dialogOpen || $[33] !== t15) {
140
144
  t16 = /* @__PURE__ */ jsx(AlertDialog, {
141
145
  open: dialogOpen,
142
146
  onOpenChange: setDialogOpen,
143
147
  children: t15
144
148
  });
145
- $[31] = dialogOpen;
146
- $[32] = t15;
147
- $[33] = t16;
148
- } else t16 = $[33];
149
+ $[32] = dialogOpen;
150
+ $[33] = t15;
151
+ $[34] = t16;
152
+ } else t16 = $[34];
149
153
  let t17;
150
- if ($[34] !== t11 || $[35] !== t16) {
154
+ if ($[35] !== t11 || $[36] !== t16) {
151
155
  t17 = /* @__PURE__ */ jsxs(Fragment, { children: [t11, t16] });
152
- $[34] = t11;
153
- $[35] = t16;
154
- $[36] = t17;
155
- } else t17 = $[36];
156
+ $[35] = t11;
157
+ $[36] = t16;
158
+ $[37] = t17;
159
+ } else t17 = $[37];
156
160
  return t17;
157
161
  };
158
162
 
@@ -0,0 +1,266 @@
1
+ import { previewStore } from "../previewStore.js";
2
+ import { blockQueries, repeatableItemMutations } from "../../../lib/queries.js";
3
+ import { useCamoxApp } from "../../provider/components/CamoxAppContext.js";
4
+ import { c } from "react/compiler-runtime";
5
+ import { useMutation, useQuery } from "@tanstack/react-query";
6
+ import { generateKeyBetween } from "fractional-indexing";
7
+
8
+ //#region src/features/preview/components/useRepeatableItemActions.ts
9
+ const buildDefaultContent = (itemProperties) => {
10
+ const content = {};
11
+ if (!itemProperties) return content;
12
+ for (const [key, prop] of Object.entries(itemProperties)) {
13
+ if (prop.fieldType === "Image" || prop.fieldType === "File") continue;
14
+ if (prop.type === "array" && prop.items?.properties) continue;
15
+ if ("default" in prop) content[key] = prop.default;
16
+ }
17
+ return content;
18
+ };
19
+ const buildNestedItemSeeds = (itemProperties) => {
20
+ const seeds = [];
21
+ if (!itemProperties) return seeds;
22
+ let counter = 0;
23
+ const recurse = (properties, parentTempId) => {
24
+ for (const [fieldName, fieldSchema] of Object.entries(properties)) {
25
+ if (fieldSchema.type !== "array" || !fieldSchema.items?.properties) continue;
26
+ const defaultCount = fieldSchema.defaultItems ?? fieldSchema.minItems ?? 0;
27
+ if (defaultCount <= 0) continue;
28
+ const nestedItemProps = fieldSchema.items.properties;
29
+ const nestedContent = buildDefaultContent(nestedItemProps);
30
+ const nestedSettingsDefaults = fieldSchema.defaultItemSettings;
31
+ let prevPos = null;
32
+ for (let i = 0; i < defaultCount; i++) {
33
+ const tempId = `nested_${++counter}`;
34
+ const position = generateKeyBetween(prevPos, null);
35
+ prevPos = position;
36
+ seeds.push({
37
+ tempId,
38
+ parentTempId,
39
+ fieldName,
40
+ content: { ...nestedContent },
41
+ settings: nestedSettingsDefaults ? { ...nestedSettingsDefaults } : void 0,
42
+ position
43
+ });
44
+ recurse(nestedItemProps, tempId);
45
+ }
46
+ }
47
+ };
48
+ recurse(itemProperties, null);
49
+ return seeds;
50
+ };
51
+ const useRepeatableItemActions = (t0) => {
52
+ const $ = c(16);
53
+ if ($[0] !== "12813e2c0be104fa869bc45cac18b9b3a77f7c0ca99aba0644d37c28bb33dbeb") {
54
+ for (let $i = 0; $i < 16; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
55
+ $[0] = "12813e2c0be104fa869bc45cac18b9b3a77f7c0ca99aba0644d37c28bb33dbeb";
56
+ }
57
+ const { blockId, fieldName, parentItemId, arraySchema, siblingCount } = t0;
58
+ let t1;
59
+ if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
60
+ t1 = repeatableItemMutations.create();
61
+ $[1] = t1;
62
+ } else t1 = $[1];
63
+ const createRepeatableItem = useMutation(t1);
64
+ let t2;
65
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
66
+ t2 = repeatableItemMutations.delete();
67
+ $[2] = t2;
68
+ } else t2 = $[2];
69
+ const deleteRepeatableItem = useMutation(t2);
70
+ const canAdd = arraySchema != null && (arraySchema.maxItems === void 0 || siblingCount < arraySchema.maxItems);
71
+ const canRemove = arraySchema != null && (arraySchema.minItems === void 0 || siblingCount > arraySchema.minItems);
72
+ let t3;
73
+ if ($[3] !== arraySchema || $[4] !== blockId || $[5] !== createRepeatableItem || $[6] !== fieldName || $[7] !== parentItemId) {
74
+ t3 = (options) => {
75
+ if (!arraySchema) return;
76
+ const itemsSchema = arraySchema.items;
77
+ const defaultContent = buildDefaultContent(itemsSchema?.properties);
78
+ const defaultSettings = arraySchema.defaultItemSettings;
79
+ const nestedItems = buildNestedItemSeeds(itemsSchema?.properties);
80
+ createRepeatableItem.mutate({
81
+ blockId,
82
+ parentItemId: parentItemId ?? void 0,
83
+ fieldName,
84
+ content: defaultContent,
85
+ settings: defaultSettings ? { ...defaultSettings } : void 0,
86
+ nestedItems: nestedItems.length > 0 ? nestedItems : void 0,
87
+ afterPosition: options?.afterPosition
88
+ }, { onSuccess: (created) => {
89
+ previewStore.send({
90
+ type: "selectItem",
91
+ blockId,
92
+ itemId: created.id
93
+ });
94
+ } });
95
+ };
96
+ $[3] = arraySchema;
97
+ $[4] = blockId;
98
+ $[5] = createRepeatableItem;
99
+ $[6] = fieldName;
100
+ $[7] = parentItemId;
101
+ $[8] = t3;
102
+ } else t3 = $[8];
103
+ const addItem = t3;
104
+ let t4;
105
+ if ($[9] !== deleteRepeatableItem) {
106
+ t4 = (itemId, options_0) => {
107
+ deleteRepeatableItem.mutate({ id: itemId }, { onSuccess: options_0?.onSuccess });
108
+ };
109
+ $[9] = deleteRepeatableItem;
110
+ $[10] = t4;
111
+ } else t4 = $[10];
112
+ const removeItem = t4;
113
+ let t5;
114
+ if ($[11] !== addItem || $[12] !== canAdd || $[13] !== canRemove || $[14] !== removeItem) {
115
+ t5 = {
116
+ canAdd,
117
+ addItem,
118
+ canRemove,
119
+ removeItem
120
+ };
121
+ $[11] = addItem;
122
+ $[12] = canAdd;
123
+ $[13] = canRemove;
124
+ $[14] = removeItem;
125
+ $[15] = t5;
126
+ } else t5 = $[15];
127
+ return t5;
128
+ };
129
+ const getArraySchemaForItem = (contentSchema, itemId, itemsMap) => {
130
+ const path = [];
131
+ let current = itemsMap.get(itemId);
132
+ while (current) {
133
+ path.unshift(current.fieldName);
134
+ current = current.parentItemId ? itemsMap.get(current.parentItemId) : void 0;
135
+ }
136
+ let schema = contentSchema;
137
+ for (let i = 0; i < path.length; i++) {
138
+ const prop = schema?.properties?.[path[i]];
139
+ if (!prop?.items) return null;
140
+ if (i === path.length - 1) return prop;
141
+ schema = prop.items;
142
+ }
143
+ return null;
144
+ };
145
+ /**
146
+ * Resolves the action surface for the currently-edited repeatable item by
147
+ * fetching the block bundle, locating the item's array-level schema, and
148
+ * counting siblings. Hook is safe to call when ids are null — it'll just
149
+ * return disabled actions.
150
+ */
151
+ const useCurrentItemActions = (blockId, itemId) => {
152
+ const $ = c(27);
153
+ if ($[0] !== "12813e2c0be104fa869bc45cac18b9b3a77f7c0ca99aba0644d37c28bb33dbeb") {
154
+ for (let $i = 0; $i < 27; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
155
+ $[0] = "12813e2c0be104fa869bc45cac18b9b3a77f7c0ca99aba0644d37c28bb33dbeb";
156
+ }
157
+ const camoxApp = useCamoxApp();
158
+ let t0;
159
+ if ($[1] !== blockId) {
160
+ t0 = blockQueries.get(blockId);
161
+ $[1] = blockId;
162
+ $[2] = t0;
163
+ } else t0 = $[2];
164
+ const t1 = blockId != null;
165
+ let t2;
166
+ if ($[3] !== t0 || $[4] !== t1) {
167
+ t2 = {
168
+ ...t0,
169
+ enabled: t1
170
+ };
171
+ $[3] = t0;
172
+ $[4] = t1;
173
+ $[5] = t2;
174
+ } else t2 = $[5];
175
+ const { data: blockBundle } = useQuery(t2);
176
+ blockBundle?.repeatableItems;
177
+ let t3;
178
+ if ($[6] !== blockBundle?.repeatableItems) {
179
+ t3 = new Map((blockBundle?.repeatableItems ?? []).map(_temp));
180
+ $[6] = blockBundle?.repeatableItems;
181
+ $[7] = t3;
182
+ } else t3 = $[7];
183
+ const itemsMap = t3;
184
+ let t4;
185
+ if ($[8] !== itemId || $[9] !== itemsMap) {
186
+ t4 = itemId != null ? itemsMap.get(itemId) ?? null : null;
187
+ $[8] = itemId;
188
+ $[9] = itemsMap;
189
+ $[10] = t4;
190
+ } else t4 = $[10];
191
+ const currentItem = t4;
192
+ const block = blockBundle?.block ?? null;
193
+ let t5;
194
+ if ($[11] !== block || $[12] !== camoxApp) {
195
+ t5 = block ? camoxApp.getBlockById(block.type) : null;
196
+ $[11] = block;
197
+ $[12] = camoxApp;
198
+ $[13] = t5;
199
+ } else t5 = $[13];
200
+ const blockDef = t5;
201
+ let t6;
202
+ bb0: {
203
+ if (!blockDef || itemId == null) {
204
+ t6 = null;
205
+ break bb0;
206
+ }
207
+ let t7;
208
+ if ($[14] !== blockDef._internal.contentSchema || $[15] !== itemId || $[16] !== itemsMap) {
209
+ t7 = getArraySchemaForItem(blockDef._internal.contentSchema, itemId, itemsMap);
210
+ $[14] = blockDef._internal.contentSchema;
211
+ $[15] = itemId;
212
+ $[16] = itemsMap;
213
+ $[17] = t7;
214
+ } else t7 = $[17];
215
+ t6 = t7;
216
+ }
217
+ const arraySchema = t6;
218
+ let t7;
219
+ bb1: {
220
+ if (!currentItem) {
221
+ t7 = 0;
222
+ break bb1;
223
+ }
224
+ let count = 0;
225
+ for (const it of itemsMap.values()) if (it.fieldName === currentItem.fieldName && it.parentItemId === currentItem.parentItemId) count++;
226
+ t7 = count;
227
+ }
228
+ const siblingCount = t7;
229
+ const t8 = block?.id ?? -1;
230
+ const t9 = currentItem?.fieldName ?? "";
231
+ const t10 = currentItem?.parentItemId ?? null;
232
+ let t11;
233
+ if ($[18] !== arraySchema || $[19] !== siblingCount || $[20] !== t10 || $[21] !== t8 || $[22] !== t9) {
234
+ t11 = {
235
+ blockId: t8,
236
+ fieldName: t9,
237
+ parentItemId: t10,
238
+ arraySchema,
239
+ siblingCount
240
+ };
241
+ $[18] = arraySchema;
242
+ $[19] = siblingCount;
243
+ $[20] = t10;
244
+ $[21] = t8;
245
+ $[22] = t9;
246
+ $[23] = t11;
247
+ } else t11 = $[23];
248
+ const actions = useRepeatableItemActions(t11);
249
+ let t12;
250
+ if ($[24] !== actions || $[25] !== currentItem) {
251
+ t12 = {
252
+ ...actions,
253
+ currentItem
254
+ };
255
+ $[24] = actions;
256
+ $[25] = currentItem;
257
+ $[26] = t12;
258
+ } else t12 = $[26];
259
+ return t12;
260
+ };
261
+ function _temp(i) {
262
+ return [i.id, i];
263
+ }
264
+
265
+ //#endregion
266
+ export { useCurrentItemActions, useRepeatableItemActions };
@@ -9,17 +9,21 @@ import { queryKeys } from "@camox/api-contract/query-keys";
9
9
 
10
10
  //#region src/features/preview/components/useUpdateBlockPosition.ts
11
11
  function useUpdateBlockPosition() {
12
- const $ = c(4);
12
+ const $ = c(5);
13
+ if ($[0] !== "cfd2dbbd0b074b69d0620d0a4c9349251b74dbca99375732a76b4d2073db2bfc") {
14
+ for (let $i = 0; $i < 5; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
15
+ $[0] = "cfd2dbbd0b074b69d0620d0a4c9349251b74dbca99375732a76b4d2073db2bfc";
16
+ }
13
17
  const queryClient = useQueryClient();
14
18
  const { pathname } = useLocation();
15
19
  const pagePathname = useSelector(previewStore, _temp) ?? pathname;
16
20
  let t0;
17
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
21
+ if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
18
22
  t0 = blockMutations.updatePosition();
19
- $[0] = t0;
20
- } else t0 = $[0];
23
+ $[1] = t0;
24
+ } else t0 = $[1];
21
25
  let t1;
22
- if ($[1] !== pagePathname || $[2] !== queryClient) {
26
+ if ($[2] !== pagePathname || $[3] !== queryClient) {
23
27
  t1 = {
24
28
  ...t0,
25
29
  onMutate: (variables) => {
@@ -68,10 +72,10 @@ function useUpdateBlockPosition() {
68
72
  queryClient.invalidateQueries({ queryKey: queryKeys.pages.getByPath(pagePathname) });
69
73
  }
70
74
  };
71
- $[1] = pagePathname;
72
- $[2] = queryClient;
73
- $[3] = t1;
74
- } else t1 = $[3];
75
+ $[2] = pagePathname;
76
+ $[3] = queryClient;
77
+ $[4] = t1;
78
+ } else t1 = $[4];
75
79
  return useMutation(t1);
76
80
  }
77
81
  function _temp(state) {