camox 0.16.1 → 0.17.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.
- package/dist/core/components/lexical/InlineLexicalEditor.js +22 -15
- package/dist/core/components/lexical/SidebarLexicalEditor.js +8 -6
- package/dist/core/createBlock.js +26 -20
- package/dist/features/preview/components/AddBlockSheet.js +85 -80
- package/dist/features/preview/components/AssetLightbox.js +15 -6
- package/dist/features/preview/components/BlockActionsPopover.js +15 -9
- package/dist/features/preview/components/CreatePageModal.js +1 -1
- package/dist/features/preview/components/EditPageModal.js +20 -13
- package/dist/features/preview/components/Overlays.js +4 -3
- package/dist/features/preview/components/PageContentSheet.js +24 -12
- package/dist/features/preview/components/PageTree.js +26 -23
- package/dist/features/preview/previewStore.js +25 -9
- package/dist/features/provider/CamoxProvider.js +34 -40
- package/dist/features/routes/pageRoute.js +3 -3
- package/dist/features/studio/CamoxStudio.js +43 -23
- package/dist/features/vite/vite.d.ts +2 -2
- package/dist/features/vite/vite.js +4 -2
- package/dist/hooks/use-file-upload.js +1 -1
- package/dist/lib/api-client.js +2 -1
- package/dist/lib/telemetry-client.js +66 -0
- package/dist/lib/{analytics.js → telemetry.js} +5 -4
- package/package.json +4 -4
- package/dist/lib/analytics-client.js +0 -32
|
@@ -8,6 +8,7 @@ import * as React from "react";
|
|
|
8
8
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
import { LexicalComposer } from "@lexical/react/LexicalComposer";
|
|
10
10
|
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
11
|
+
import { HistoryPlugin } from "@lexical/react/LexicalHistoryPlugin";
|
|
11
12
|
import { OnChangePlugin } from "@lexical/react/LexicalOnChangePlugin";
|
|
12
13
|
import { RichTextPlugin } from "@lexical/react/LexicalRichTextPlugin";
|
|
13
14
|
import { COMMAND_PRIORITY_LOW, INSERT_LINE_BREAK_COMMAND, KEY_ENTER_COMMAND, KEY_ESCAPE_COMMAND } from "lexical";
|
|
@@ -15,9 +16,9 @@ import { COMMAND_PRIORITY_LOW, INSERT_LINE_BREAK_COMMAND, KEY_ENTER_COMMAND, KEY
|
|
|
15
16
|
//#region src/core/components/lexical/InlineLexicalEditor.tsx
|
|
16
17
|
function ExternalStateSync(t0) {
|
|
17
18
|
const $ = c(8);
|
|
18
|
-
if ($[0] !== "
|
|
19
|
+
if ($[0] !== "d55dc2470e7a8239785b31acd1a520713ae4ab4b2286f30664666de45ce709b6") {
|
|
19
20
|
for (let $i = 0; $i < 8; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
20
|
-
$[0] = "
|
|
21
|
+
$[0] = "d55dc2470e7a8239785b31acd1a520713ae4ab4b2286f30664666de45ce709b6";
|
|
21
22
|
}
|
|
22
23
|
const { externalState } = t0;
|
|
23
24
|
const [editor] = useLexicalComposerContext();
|
|
@@ -74,9 +75,9 @@ function ExternalStateSync(t0) {
|
|
|
74
75
|
}
|
|
75
76
|
function EscapeHandler() {
|
|
76
77
|
const $ = c(4);
|
|
77
|
-
if ($[0] !== "
|
|
78
|
+
if ($[0] !== "d55dc2470e7a8239785b31acd1a520713ae4ab4b2286f30664666de45ce709b6") {
|
|
78
79
|
for (let $i = 0; $i < 4; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
79
|
-
$[0] = "
|
|
80
|
+
$[0] = "d55dc2470e7a8239785b31acd1a520713ae4ab4b2286f30664666de45ce709b6";
|
|
80
81
|
}
|
|
81
82
|
const [editor] = useLexicalComposerContext();
|
|
82
83
|
let t0;
|
|
@@ -99,9 +100,9 @@ function EscapeHandler() {
|
|
|
99
100
|
}
|
|
100
101
|
function EnterAsLineBreakHandler() {
|
|
101
102
|
const $ = c(4);
|
|
102
|
-
if ($[0] !== "
|
|
103
|
+
if ($[0] !== "d55dc2470e7a8239785b31acd1a520713ae4ab4b2286f30664666de45ce709b6") {
|
|
103
104
|
for (let $i = 0; $i < 4; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
104
|
-
$[0] = "
|
|
105
|
+
$[0] = "d55dc2470e7a8239785b31acd1a520713ae4ab4b2286f30664666de45ce709b6";
|
|
105
106
|
}
|
|
106
107
|
const [editor] = useLexicalComposerContext();
|
|
107
108
|
let t0;
|
|
@@ -125,9 +126,9 @@ function EnterAsLineBreakHandler() {
|
|
|
125
126
|
}
|
|
126
127
|
function FocusBlurHandler(t0) {
|
|
127
128
|
const $ = c(6);
|
|
128
|
-
if ($[0] !== "
|
|
129
|
+
if ($[0] !== "d55dc2470e7a8239785b31acd1a520713ae4ab4b2286f30664666de45ce709b6") {
|
|
129
130
|
for (let $i = 0; $i < 6; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
130
|
-
$[0] = "
|
|
131
|
+
$[0] = "d55dc2470e7a8239785b31acd1a520713ae4ab4b2286f30664666de45ce709b6";
|
|
131
132
|
}
|
|
132
133
|
const { onFocus, onBlur } = t0;
|
|
133
134
|
const [editor] = useLexicalComposerContext();
|
|
@@ -163,22 +164,27 @@ function FocusBlurHandler(t0) {
|
|
|
163
164
|
function InlineLexicalEditor({ initialState, externalState, onChange, onFocus, onBlur }) {
|
|
164
165
|
const { window: iframeWindow } = useFrame();
|
|
165
166
|
const timerRef = React.useRef(null);
|
|
166
|
-
const
|
|
167
|
+
const isFocusedRef = React.useRef(false);
|
|
168
|
+
const editedDuringFocusRef = React.useRef(false);
|
|
167
169
|
const config = React.useMemo(() => createEditorConfig(initialState), []);
|
|
168
170
|
const handleChange = React.useCallback((editorState) => {
|
|
169
|
-
if (!
|
|
171
|
+
if (!isFocusedRef.current) return;
|
|
172
|
+
editedDuringFocusRef.current = true;
|
|
170
173
|
if (timerRef.current) clearTimeout(timerRef.current);
|
|
171
174
|
timerRef.current = window.setTimeout(() => {
|
|
172
175
|
onChange(lexicalStateToMarkdown(editorState.toJSON()));
|
|
173
176
|
}, 300);
|
|
174
177
|
}, [onChange]);
|
|
175
178
|
const handleFocus = React.useCallback(() => {
|
|
176
|
-
|
|
179
|
+
isFocusedRef.current = true;
|
|
180
|
+
editedDuringFocusRef.current = false;
|
|
177
181
|
onFocus();
|
|
178
182
|
}, [onFocus]);
|
|
179
183
|
const handleBlur = React.useCallback(() => {
|
|
180
|
-
|
|
181
|
-
|
|
184
|
+
isFocusedRef.current = false;
|
|
185
|
+
const wasEdited = editedDuringFocusRef.current;
|
|
186
|
+
editedDuringFocusRef.current = false;
|
|
187
|
+
onBlur(wasEdited);
|
|
182
188
|
}, [onBlur]);
|
|
183
189
|
React.useEffect(() => {
|
|
184
190
|
return () => {
|
|
@@ -193,6 +199,7 @@ function InlineLexicalEditor({ initialState, externalState, onChange, onFocus, o
|
|
|
193
199
|
ErrorBoundary: LexicalErrorBoundary
|
|
194
200
|
}),
|
|
195
201
|
/* @__PURE__ */ jsx(OnChangePlugin, { onChange: handleChange }),
|
|
202
|
+
/* @__PURE__ */ jsx(HistoryPlugin, {}),
|
|
196
203
|
/* @__PURE__ */ jsx(ExternalStateSync, { externalState }),
|
|
197
204
|
/* @__PURE__ */ jsx(EscapeHandler, {}),
|
|
198
205
|
/* @__PURE__ */ jsx(EnterAsLineBreakHandler, {}),
|
|
@@ -206,9 +213,9 @@ function InlineLexicalEditor({ initialState, externalState, onChange, onFocus, o
|
|
|
206
213
|
}
|
|
207
214
|
function LexicalErrorBoundary(t0) {
|
|
208
215
|
const $ = c(3);
|
|
209
|
-
if ($[0] !== "
|
|
216
|
+
if ($[0] !== "d55dc2470e7a8239785b31acd1a520713ae4ab4b2286f30664666de45ce709b6") {
|
|
210
217
|
for (let $i = 0; $i < 3; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
211
|
-
$[0] = "
|
|
218
|
+
$[0] = "d55dc2470e7a8239785b31acd1a520713ae4ab4b2286f30664666de45ce709b6";
|
|
212
219
|
}
|
|
213
220
|
const { children } = t0;
|
|
214
221
|
let t1;
|
|
@@ -6,6 +6,7 @@ import * as React from "react";
|
|
|
6
6
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import { LexicalComposer } from "@lexical/react/LexicalComposer";
|
|
8
8
|
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
9
|
+
import { HistoryPlugin } from "@lexical/react/LexicalHistoryPlugin";
|
|
9
10
|
import { OnChangePlugin } from "@lexical/react/LexicalOnChangePlugin";
|
|
10
11
|
import { RichTextPlugin } from "@lexical/react/LexicalRichTextPlugin";
|
|
11
12
|
import { COMMAND_PRIORITY_LOW, INSERT_LINE_BREAK_COMMAND, KEY_ENTER_COMMAND } from "lexical";
|
|
@@ -14,9 +15,9 @@ import { ContentEditable } from "@lexical/react/LexicalContentEditable";
|
|
|
14
15
|
//#region src/core/components/lexical/SidebarLexicalEditor.tsx
|
|
15
16
|
function EnterAsLineBreakHandler() {
|
|
16
17
|
const $ = c(4);
|
|
17
|
-
if ($[0] !== "
|
|
18
|
+
if ($[0] !== "9a1f0240935b013c9ac987c70099d7838c89696e79ef991f24c440416afce1d4") {
|
|
18
19
|
for (let $i = 0; $i < 4; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
19
|
-
$[0] = "
|
|
20
|
+
$[0] = "9a1f0240935b013c9ac987c70099d7838c89696e79ef991f24c440416afce1d4";
|
|
20
21
|
}
|
|
21
22
|
const [editor] = useLexicalComposerContext();
|
|
22
23
|
let t0;
|
|
@@ -40,9 +41,9 @@ function EnterAsLineBreakHandler() {
|
|
|
40
41
|
}
|
|
41
42
|
function ExternalStateSync(t0) {
|
|
42
43
|
const $ = c(6);
|
|
43
|
-
if ($[0] !== "
|
|
44
|
+
if ($[0] !== "9a1f0240935b013c9ac987c70099d7838c89696e79ef991f24c440416afce1d4") {
|
|
44
45
|
for (let $i = 0; $i < 6; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
45
|
-
$[0] = "
|
|
46
|
+
$[0] = "9a1f0240935b013c9ac987c70099d7838c89696e79ef991f24c440416afce1d4";
|
|
46
47
|
}
|
|
47
48
|
const { value, isSyncingRef } = t0;
|
|
48
49
|
const [editor] = useLexicalComposerContext();
|
|
@@ -110,6 +111,7 @@ function SidebarLexicalEditor({ id, value, onChange, onFocus, onBlur }) {
|
|
|
110
111
|
ErrorBoundary: LexicalErrorBoundary
|
|
111
112
|
}),
|
|
112
113
|
/* @__PURE__ */ jsx(OnChangePlugin, { onChange: handleChange }),
|
|
114
|
+
/* @__PURE__ */ jsx(HistoryPlugin, {}),
|
|
113
115
|
/* @__PURE__ */ jsx(ExternalStateSync, {
|
|
114
116
|
value,
|
|
115
117
|
isSyncingRef
|
|
@@ -120,9 +122,9 @@ function SidebarLexicalEditor({ id, value, onChange, onFocus, onBlur }) {
|
|
|
120
122
|
}
|
|
121
123
|
function LexicalErrorBoundary(t0) {
|
|
122
124
|
const $ = c(3);
|
|
123
|
-
if ($[0] !== "
|
|
125
|
+
if ($[0] !== "9a1f0240935b013c9ac987c70099d7838c89696e79ef991f24c440416afce1d4") {
|
|
124
126
|
for (let $i = 0; $i < 3; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
125
|
-
$[0] = "
|
|
127
|
+
$[0] = "9a1f0240935b013c9ac987c70099d7838c89696e79ef991f24c440416afce1d4";
|
|
126
128
|
}
|
|
127
129
|
const { children } = t0;
|
|
128
130
|
let t1;
|
package/dist/core/createBlock.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { trackClientEvent } from "../lib/telemetry-client.js";
|
|
1
2
|
import { previewStore } from "../features/preview/previewStore.js";
|
|
2
3
|
import { useIsPreviewSheetOpen } from "../features/preview/components/PreviewSideSheet.js";
|
|
3
4
|
import { useProjectSlug } from "../lib/auth.js";
|
|
@@ -245,9 +246,14 @@ function createBlock(options) {
|
|
|
245
246
|
name,
|
|
246
247
|
repeaterContext?.itemId
|
|
247
248
|
]);
|
|
248
|
-
const handleBlur = React.useCallback(() => {
|
|
249
|
+
const handleBlur = React.useCallback((wasEdited) => {
|
|
249
250
|
setIsEditorFocused(false);
|
|
250
|
-
|
|
251
|
+
if (wasEdited) trackClientEvent("block_edited", {
|
|
252
|
+
via: "inline-lexical",
|
|
253
|
+
blockType: options.id,
|
|
254
|
+
field: String(name)
|
|
255
|
+
});
|
|
256
|
+
}, [name]);
|
|
251
257
|
const handleMouseEnter = () => {
|
|
252
258
|
if (isContentEditable) setIsHovered(true);
|
|
253
259
|
};
|
|
@@ -275,9 +281,9 @@ function createBlock(options) {
|
|
|
275
281
|
};
|
|
276
282
|
const Embed = (t0) => {
|
|
277
283
|
const $ = c(59);
|
|
278
|
-
if ($[0] !== "
|
|
284
|
+
if ($[0] !== "50c74140b2fc3c96e656363dba6d1b89943fa30a4545390a9b1121f213cb8321") {
|
|
279
285
|
for (let $i = 0; $i < 59; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
280
|
-
$[0] = "
|
|
286
|
+
$[0] = "50c74140b2fc3c96e656363dba6d1b89943fa30a4545390a9b1121f213cb8321";
|
|
281
287
|
}
|
|
282
288
|
const { name, children } = t0;
|
|
283
289
|
const blockContext = React.use(Context);
|
|
@@ -525,9 +531,9 @@ function createBlock(options) {
|
|
|
525
531
|
};
|
|
526
532
|
const Link = (t0) => {
|
|
527
533
|
const $ = c(38);
|
|
528
|
-
if ($[0] !== "
|
|
534
|
+
if ($[0] !== "50c74140b2fc3c96e656363dba6d1b89943fa30a4545390a9b1121f213cb8321") {
|
|
529
535
|
for (let $i = 0; $i < 38; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
530
|
-
$[0] = "
|
|
536
|
+
$[0] = "50c74140b2fc3c96e656363dba6d1b89943fa30a4545390a9b1121f213cb8321";
|
|
531
537
|
}
|
|
532
538
|
const { name, children } = t0;
|
|
533
539
|
const blockContext = React.use(Context);
|
|
@@ -766,9 +772,9 @@ function createBlock(options) {
|
|
|
766
772
|
};
|
|
767
773
|
const Image = (t0) => {
|
|
768
774
|
const $ = c(22);
|
|
769
|
-
if ($[0] !== "
|
|
775
|
+
if ($[0] !== "50c74140b2fc3c96e656363dba6d1b89943fa30a4545390a9b1121f213cb8321") {
|
|
770
776
|
for (let $i = 0; $i < 22; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
771
|
-
$[0] = "
|
|
777
|
+
$[0] = "50c74140b2fc3c96e656363dba6d1b89943fa30a4545390a9b1121f213cb8321";
|
|
772
778
|
}
|
|
773
779
|
const { name, children } = t0;
|
|
774
780
|
const blockContext = React.use(Context);
|
|
@@ -884,9 +890,9 @@ function createBlock(options) {
|
|
|
884
890
|
};
|
|
885
891
|
const File = (t0) => {
|
|
886
892
|
const $ = c(9);
|
|
887
|
-
if ($[0] !== "
|
|
893
|
+
if ($[0] !== "50c74140b2fc3c96e656363dba6d1b89943fa30a4545390a9b1121f213cb8321") {
|
|
888
894
|
for (let $i = 0; $i < 9; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
889
|
-
$[0] = "
|
|
895
|
+
$[0] = "50c74140b2fc3c96e656363dba6d1b89943fa30a4545390a9b1121f213cb8321";
|
|
890
896
|
}
|
|
891
897
|
const { name, children } = t0;
|
|
892
898
|
const blockContext = React.use(Context);
|
|
@@ -921,9 +927,9 @@ function createBlock(options) {
|
|
|
921
927
|
};
|
|
922
928
|
const RepeaterItemWrapper = (t0) => {
|
|
923
929
|
const $ = c(9);
|
|
924
|
-
if ($[0] !== "
|
|
930
|
+
if ($[0] !== "50c74140b2fc3c96e656363dba6d1b89943fa30a4545390a9b1121f213cb8321") {
|
|
925
931
|
for (let $i = 0; $i < 9; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
926
|
-
$[0] = "
|
|
932
|
+
$[0] = "50c74140b2fc3c96e656363dba6d1b89943fa30a4545390a9b1121f213cb8321";
|
|
927
933
|
}
|
|
928
934
|
const { itemId, blockId, mode, children } = t0;
|
|
929
935
|
const isContentEditable = useIsEditable(mode);
|
|
@@ -964,9 +970,9 @@ function createBlock(options) {
|
|
|
964
970
|
};
|
|
965
971
|
const RepeaterHoverProvider = (t0) => {
|
|
966
972
|
const $ = c(7);
|
|
967
|
-
if ($[0] !== "
|
|
973
|
+
if ($[0] !== "50c74140b2fc3c96e656363dba6d1b89943fa30a4545390a9b1121f213cb8321") {
|
|
968
974
|
for (let $i = 0; $i < 7; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
969
|
-
$[0] = "
|
|
975
|
+
$[0] = "50c74140b2fc3c96e656363dba6d1b89943fa30a4545390a9b1121f213cb8321";
|
|
970
976
|
}
|
|
971
977
|
const { blockId, fieldName, children } = t0;
|
|
972
978
|
const isContentEditable = useIsEditable("site");
|
|
@@ -997,9 +1003,9 @@ function createBlock(options) {
|
|
|
997
1003
|
};
|
|
998
1004
|
const Repeater = (t0) => {
|
|
999
1005
|
const $ = c(30);
|
|
1000
|
-
if ($[0] !== "
|
|
1006
|
+
if ($[0] !== "50c74140b2fc3c96e656363dba6d1b89943fa30a4545390a9b1121f213cb8321") {
|
|
1001
1007
|
for (let $i = 0; $i < 30; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
1002
|
-
$[0] = "
|
|
1008
|
+
$[0] = "50c74140b2fc3c96e656363dba6d1b89943fa30a4545390a9b1121f213cb8321";
|
|
1003
1009
|
}
|
|
1004
1010
|
const { name, children } = t0;
|
|
1005
1011
|
const blockContext = React.use(Context);
|
|
@@ -1140,9 +1146,9 @@ function createBlock(options) {
|
|
|
1140
1146
|
};
|
|
1141
1147
|
const BlockComponent = (t0) => {
|
|
1142
1148
|
const $ = c(70);
|
|
1143
|
-
if ($[0] !== "
|
|
1149
|
+
if ($[0] !== "50c74140b2fc3c96e656363dba6d1b89943fa30a4545390a9b1121f213cb8321") {
|
|
1144
1150
|
for (let $i = 0; $i < 70; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
1145
|
-
$[0] = "
|
|
1151
|
+
$[0] = "50c74140b2fc3c96e656363dba6d1b89943fa30a4545390a9b1121f213cb8321";
|
|
1146
1152
|
}
|
|
1147
1153
|
const { blockData, mode, isFirstBlock, showAddBlockTop, showAddBlockBottom, addBlockAfterPosition } = t0;
|
|
1148
1154
|
const isContentEditable = useIsEditable(mode);
|
|
@@ -1442,9 +1448,9 @@ function createBlock(options) {
|
|
|
1442
1448
|
*/
|
|
1443
1449
|
const Detached = (t0) => {
|
|
1444
1450
|
const $ = c(31);
|
|
1445
|
-
if ($[0] !== "
|
|
1451
|
+
if ($[0] !== "50c74140b2fc3c96e656363dba6d1b89943fa30a4545390a9b1121f213cb8321") {
|
|
1446
1452
|
for (let $i = 0; $i < 31; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
1447
|
-
$[0] = "
|
|
1453
|
+
$[0] = "50c74140b2fc3c96e656363dba6d1b89943fa30a4545390a9b1121f213cb8321";
|
|
1448
1454
|
}
|
|
1449
1455
|
const { children } = t0;
|
|
1450
1456
|
const ctx = React.use(Context);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { trackClientEvent } from "../../../lib/telemetry-client.js";
|
|
1
2
|
import { previewStore } from "../previewStore.js";
|
|
2
3
|
import { PreviewSideSheet, Sheet } from "./PreviewSideSheet.js";
|
|
3
4
|
import { useProjectSlug } from "../../../lib/auth.js";
|
|
4
5
|
import { blockMutations, blockQueries, projectQueries } from "../../../lib/queries.js";
|
|
5
6
|
import { usePageBlocks } from "../../../lib/normalized-data.js";
|
|
6
7
|
import { useCamoxApp } from "../../provider/components/CamoxAppContext.js";
|
|
7
|
-
import { trackClientEvent } from "../../../lib/analytics-client.js";
|
|
8
8
|
import { usePreviewedPage } from "../CamoxPreview.js";
|
|
9
9
|
import { c } from "react/compiler-runtime";
|
|
10
10
|
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
@@ -18,10 +18,10 @@ import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, Command
|
|
|
18
18
|
|
|
19
19
|
//#region src/features/preview/components/AddBlockSheet.tsx
|
|
20
20
|
const AddBlockSheet = () => {
|
|
21
|
-
const $ = c(
|
|
22
|
-
if ($[0] !== "
|
|
23
|
-
for (let $i = 0; $i <
|
|
24
|
-
$[0] = "
|
|
21
|
+
const $ = c(60);
|
|
22
|
+
if ($[0] !== "eaa0318b13b193e792904949c4da8d4db94d4d7cfdb3255f0c3d4b505c4a3f1f") {
|
|
23
|
+
for (let $i = 0; $i < 60; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
24
|
+
$[0] = "eaa0318b13b193e792904949c4da8d4db94d4d7cfdb3255f0c3d4b505c4a3f1f";
|
|
25
25
|
}
|
|
26
26
|
const [highlightedValue, setHighlightedValue] = React.useState("");
|
|
27
27
|
const queryClient = useQueryClient();
|
|
@@ -163,8 +163,9 @@ const AddBlockSheet = () => {
|
|
|
163
163
|
const pageCounts = t8;
|
|
164
164
|
const isOpen = useSelector(previewStore, _temp4);
|
|
165
165
|
const peekedBlockPosition = useSelector(previewStore, _temp5);
|
|
166
|
+
const addBlockSource = useSelector(previewStore, _temp6);
|
|
166
167
|
let t9;
|
|
167
|
-
if ($[17] !==
|
|
168
|
+
if ($[17] !== addBlockSource || $[18] !== createBlock || $[19] !== page || $[20] !== pageBlocks_0 || $[21] !== peekedBlockPosition) {
|
|
168
169
|
t9 = async (block_0) => {
|
|
169
170
|
if (!page) return;
|
|
170
171
|
const afterPosition_0 = peekedBlockPosition === "" ? "" : peekedBlockPosition ?? pageBlocks_0[pageBlocks_0.length - 1]?.position;
|
|
@@ -178,8 +179,8 @@ const AddBlockSheet = () => {
|
|
|
178
179
|
repeatableItems: bundle.repeatableItems
|
|
179
180
|
});
|
|
180
181
|
trackClientEvent("block_added", {
|
|
181
|
-
|
|
182
|
-
|
|
182
|
+
blockType: block_0._internal.id,
|
|
183
|
+
via: addBlockSource ?? "unknown"
|
|
183
184
|
});
|
|
184
185
|
previewStore.send({
|
|
185
186
|
type: "focusCreatedBlock",
|
|
@@ -187,15 +188,16 @@ const AddBlockSheet = () => {
|
|
|
187
188
|
});
|
|
188
189
|
previewStore.send({ type: "exitPeekedBlock" });
|
|
189
190
|
};
|
|
190
|
-
$[17] =
|
|
191
|
-
$[18] =
|
|
192
|
-
$[19] =
|
|
193
|
-
$[20] =
|
|
194
|
-
$[21] =
|
|
195
|
-
|
|
191
|
+
$[17] = addBlockSource;
|
|
192
|
+
$[18] = createBlock;
|
|
193
|
+
$[19] = page;
|
|
194
|
+
$[20] = pageBlocks_0;
|
|
195
|
+
$[21] = peekedBlockPosition;
|
|
196
|
+
$[22] = t9;
|
|
197
|
+
} else t9 = $[22];
|
|
196
198
|
const handleAddBlock = t9;
|
|
197
199
|
let t10;
|
|
198
|
-
if ($[
|
|
200
|
+
if ($[23] !== pageBlocks_0 || $[24] !== peekedBlockPosition) {
|
|
199
201
|
t10 = (block_1) => {
|
|
200
202
|
const afterPosition_1 = peekedBlockPosition === "" ? "" : peekedBlockPosition ?? pageBlocks_0[pageBlocks_0.length - 1]?.position;
|
|
201
203
|
previewStore.send({
|
|
@@ -204,10 +206,10 @@ const AddBlockSheet = () => {
|
|
|
204
206
|
afterPosition: afterPosition_1
|
|
205
207
|
});
|
|
206
208
|
};
|
|
207
|
-
$[
|
|
208
|
-
$[
|
|
209
|
-
$[
|
|
210
|
-
} else t10 = $[
|
|
209
|
+
$[23] = pageBlocks_0;
|
|
210
|
+
$[24] = peekedBlockPosition;
|
|
211
|
+
$[25] = t10;
|
|
212
|
+
} else t10 = $[25];
|
|
211
213
|
const handlePreviewBlock = t10;
|
|
212
214
|
const handleValueChange = (value) => {
|
|
213
215
|
setHighlightedValue(value);
|
|
@@ -215,73 +217,73 @@ const AddBlockSheet = () => {
|
|
|
215
217
|
if (block_2) handlePreviewBlock(block_2);
|
|
216
218
|
else previewStore.send({ type: "clearPeekedBlock" });
|
|
217
219
|
};
|
|
218
|
-
const handleOpenChange =
|
|
220
|
+
const handleOpenChange = _temp7;
|
|
219
221
|
let t11;
|
|
220
222
|
let t12;
|
|
221
|
-
if ($[
|
|
223
|
+
if ($[26] !== isOpen) {
|
|
222
224
|
t11 = () => {
|
|
223
225
|
if (isOpen) setHighlightedValue("");
|
|
224
226
|
};
|
|
225
227
|
t12 = [isOpen];
|
|
226
|
-
$[
|
|
227
|
-
$[
|
|
228
|
-
$[
|
|
228
|
+
$[26] = isOpen;
|
|
229
|
+
$[27] = t11;
|
|
230
|
+
$[28] = t12;
|
|
229
231
|
} else {
|
|
230
|
-
t11 = $[
|
|
231
|
-
t12 = $[
|
|
232
|
+
t11 = $[27];
|
|
233
|
+
t12 = $[28];
|
|
232
234
|
}
|
|
233
235
|
React.useEffect(t11, t12);
|
|
234
236
|
let t13;
|
|
235
|
-
if ($[
|
|
237
|
+
if ($[29] !== pageCounts || $[30] !== totalCounts) {
|
|
236
238
|
t13 = (blockId_0) => {
|
|
237
239
|
const total = totalCounts[blockId_0] ?? 0;
|
|
238
240
|
if (total === 0) return "Never used";
|
|
239
241
|
const page_0 = pageCounts[blockId_0] ?? "none";
|
|
240
242
|
return `${total} use${total > 1 ? "s" : ""} (${page_0} here)`;
|
|
241
243
|
};
|
|
242
|
-
$[
|
|
243
|
-
$[
|
|
244
|
-
$[
|
|
245
|
-
} else t13 = $[
|
|
244
|
+
$[29] = pageCounts;
|
|
245
|
+
$[30] = totalCounts;
|
|
246
|
+
$[31] = t13;
|
|
247
|
+
} else t13 = $[31];
|
|
246
248
|
const displayCount = t13;
|
|
247
249
|
const T0 = PreviewSideSheet;
|
|
248
250
|
const t14 = "flex flex-col gap-0";
|
|
249
251
|
let t15;
|
|
250
|
-
if ($[
|
|
252
|
+
if ($[32] === Symbol.for("react.memo_cache_sentinel")) {
|
|
251
253
|
t15 = /* @__PURE__ */ jsxs(Sheet.SheetHeader, {
|
|
252
254
|
className: "border-border border-b",
|
|
253
255
|
children: [/* @__PURE__ */ jsx(Sheet.SheetTitle, { children: "Add new block" }), /* @__PURE__ */ jsx(Sheet.SheetDescription, { children: "Search and select a block to add to the page." })]
|
|
254
256
|
});
|
|
255
|
-
$[
|
|
256
|
-
} else t15 = $[
|
|
257
|
+
$[32] = t15;
|
|
258
|
+
} else t15 = $[32];
|
|
257
259
|
const t16 = "flex-1 overflow-auto p-2";
|
|
258
260
|
const T1 = Command;
|
|
259
261
|
const t17 = "overflow-visible";
|
|
260
|
-
const t18 =
|
|
262
|
+
const t18 = _temp8;
|
|
261
263
|
let t19;
|
|
262
|
-
if ($[
|
|
264
|
+
if ($[33] === Symbol.for("react.memo_cache_sentinel")) {
|
|
263
265
|
t19 = /* @__PURE__ */ jsx(CommandInput, {
|
|
264
266
|
placeholder: "Search blocks...",
|
|
265
267
|
autoFocus: true
|
|
266
268
|
});
|
|
267
|
-
$[
|
|
268
|
-
} else t19 = $[
|
|
269
|
+
$[33] = t19;
|
|
270
|
+
} else t19 = $[33];
|
|
269
271
|
const T2 = CommandList;
|
|
270
272
|
const t20 = "mt-1 max-h-full";
|
|
271
273
|
let t21;
|
|
272
|
-
if ($[
|
|
274
|
+
if ($[34] === Symbol.for("react.memo_cache_sentinel")) {
|
|
273
275
|
t21 = /* @__PURE__ */ jsx(CommandEmpty, { children: "No blocks found." });
|
|
274
|
-
$[
|
|
275
|
-
} else t21 = $[
|
|
276
|
+
$[34] = t21;
|
|
277
|
+
} else t21 = $[34];
|
|
276
278
|
const T3 = CommandGroup;
|
|
277
279
|
let t22;
|
|
278
|
-
if ($[
|
|
280
|
+
if ($[35] !== totalCounts) {
|
|
279
281
|
t22 = (a, b_3) => (totalCounts[b_3._internal.id] ?? 0) - (totalCounts[a._internal.id] ?? 0);
|
|
280
|
-
$[
|
|
281
|
-
$[
|
|
282
|
-
} else t22 = $[
|
|
282
|
+
$[35] = totalCounts;
|
|
283
|
+
$[36] = t22;
|
|
284
|
+
} else t22 = $[36];
|
|
283
285
|
let t23;
|
|
284
|
-
if ($[
|
|
286
|
+
if ($[37] !== displayCount || $[38] !== handleAddBlock) {
|
|
285
287
|
t23 = (block_3) => /* @__PURE__ */ jsx(CommandItem, {
|
|
286
288
|
value: block_3._internal.title,
|
|
287
289
|
onSelect: () => {
|
|
@@ -296,31 +298,31 @@ const AddBlockSheet = () => {
|
|
|
296
298
|
})]
|
|
297
299
|
})
|
|
298
300
|
}, block_3._internal.id);
|
|
299
|
-
$[
|
|
300
|
-
$[
|
|
301
|
-
$[
|
|
302
|
-
} else t23 = $[
|
|
301
|
+
$[37] = displayCount;
|
|
302
|
+
$[38] = handleAddBlock;
|
|
303
|
+
$[39] = t23;
|
|
304
|
+
} else t23 = $[39];
|
|
303
305
|
const t24 = availableBlocks.sort(t22).map(t23);
|
|
304
306
|
let t25;
|
|
305
|
-
if ($[
|
|
307
|
+
if ($[40] !== T3 || $[41] !== t24) {
|
|
306
308
|
t25 = /* @__PURE__ */ jsx(T3, { children: t24 });
|
|
307
|
-
$[
|
|
308
|
-
$[
|
|
309
|
-
$[
|
|
310
|
-
} else t25 = $[
|
|
309
|
+
$[40] = T3;
|
|
310
|
+
$[41] = t24;
|
|
311
|
+
$[42] = t25;
|
|
312
|
+
} else t25 = $[42];
|
|
311
313
|
let t26;
|
|
312
|
-
if ($[
|
|
314
|
+
if ($[43] !== T2 || $[44] !== t21 || $[45] !== t25) {
|
|
313
315
|
t26 = /* @__PURE__ */ jsxs(T2, {
|
|
314
316
|
className: t20,
|
|
315
317
|
children: [t21, t25]
|
|
316
318
|
});
|
|
317
|
-
$[
|
|
318
|
-
$[
|
|
319
|
-
$[
|
|
320
|
-
$[
|
|
321
|
-
} else t26 = $[
|
|
319
|
+
$[43] = T2;
|
|
320
|
+
$[44] = t21;
|
|
321
|
+
$[45] = t25;
|
|
322
|
+
$[46] = t26;
|
|
323
|
+
} else t26 = $[46];
|
|
322
324
|
let t27;
|
|
323
|
-
if ($[
|
|
325
|
+
if ($[47] !== T1 || $[48] !== handleValueChange || $[49] !== highlightedValue || $[50] !== t18 || $[51] !== t19 || $[52] !== t26) {
|
|
324
326
|
t27 = /* @__PURE__ */ jsx("div", {
|
|
325
327
|
className: t16,
|
|
326
328
|
children: /* @__PURE__ */ jsxs(T1, {
|
|
@@ -331,29 +333,29 @@ const AddBlockSheet = () => {
|
|
|
331
333
|
children: [t19, t26]
|
|
332
334
|
})
|
|
333
335
|
});
|
|
334
|
-
$[
|
|
335
|
-
$[
|
|
336
|
-
$[
|
|
337
|
-
$[
|
|
338
|
-
$[
|
|
339
|
-
$[
|
|
340
|
-
$[
|
|
341
|
-
} else t27 = $[
|
|
336
|
+
$[47] = T1;
|
|
337
|
+
$[48] = handleValueChange;
|
|
338
|
+
$[49] = highlightedValue;
|
|
339
|
+
$[50] = t18;
|
|
340
|
+
$[51] = t19;
|
|
341
|
+
$[52] = t26;
|
|
342
|
+
$[53] = t27;
|
|
343
|
+
} else t27 = $[53];
|
|
342
344
|
let t28;
|
|
343
|
-
if ($[
|
|
345
|
+
if ($[54] !== T0 || $[55] !== handleOpenChange || $[56] !== isOpen || $[57] !== t15 || $[58] !== t27) {
|
|
344
346
|
t28 = /* @__PURE__ */ jsxs(T0, {
|
|
345
347
|
open: isOpen,
|
|
346
348
|
onOpenChange: handleOpenChange,
|
|
347
349
|
className: t14,
|
|
348
350
|
children: [t15, t27]
|
|
349
351
|
});
|
|
350
|
-
$[
|
|
351
|
-
$[
|
|
352
|
-
$[
|
|
353
|
-
$[
|
|
354
|
-
$[
|
|
355
|
-
$[
|
|
356
|
-
} else t28 = $[
|
|
352
|
+
$[54] = T0;
|
|
353
|
+
$[55] = handleOpenChange;
|
|
354
|
+
$[56] = isOpen;
|
|
355
|
+
$[57] = t15;
|
|
356
|
+
$[58] = t27;
|
|
357
|
+
$[59] = t28;
|
|
358
|
+
} else t28 = $[59];
|
|
357
359
|
return t28;
|
|
358
360
|
};
|
|
359
361
|
function _temp(state) {
|
|
@@ -371,10 +373,13 @@ function _temp4(state_0) {
|
|
|
371
373
|
function _temp5(state_1) {
|
|
372
374
|
return state_1.context.peekedBlockPosition;
|
|
373
375
|
}
|
|
374
|
-
function _temp6(
|
|
376
|
+
function _temp6(state_2) {
|
|
377
|
+
return state_2.context.addBlockSource;
|
|
378
|
+
}
|
|
379
|
+
function _temp7(open) {
|
|
375
380
|
if (!open) previewStore.send({ type: "closeAddBlockSheet" });
|
|
376
381
|
}
|
|
377
|
-
function
|
|
382
|
+
function _temp8(e) {
|
|
378
383
|
if (e.key === "Escape") previewStore.send({ type: "closeAddBlockSheet" });
|
|
379
384
|
}
|
|
380
385
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { trackClientEvent } from "../../../lib/telemetry-client.js";
|
|
1
2
|
import { getAuthCookieHeader } from "../../../lib/auth.js";
|
|
2
3
|
import { getApiUrl, getEnvironmentName } from "../../../lib/api-client.js";
|
|
3
4
|
import { fileMutations, fileQueries } from "../../../lib/queries.js";
|
|
@@ -19,9 +20,9 @@ import { ButtonGroup } from "@camox/ui/button-group";
|
|
|
19
20
|
//#region src/features/preview/components/AssetLightbox.tsx
|
|
20
21
|
function MetadataRow(t0) {
|
|
21
22
|
const $ = c(9);
|
|
22
|
-
if ($[0] !== "
|
|
23
|
+
if ($[0] !== "37940925d91368c87c0e95d97da969b420d7241705fd90761ebca29def086c1e") {
|
|
23
24
|
for (let $i = 0; $i < 9; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
24
|
-
$[0] = "
|
|
25
|
+
$[0] = "37940925d91368c87c0e95d97da969b420d7241705fd90761ebca29def086c1e";
|
|
25
26
|
}
|
|
26
27
|
const { label, children } = t0;
|
|
27
28
|
let t1;
|
|
@@ -344,10 +345,18 @@ const AssetLightbox = ({ open, onOpenChange, fileId }) => {
|
|
|
344
345
|
children: [/* @__PURE__ */ jsx(Switch, {
|
|
345
346
|
id: "ai-metadata",
|
|
346
347
|
checked: file.aiMetadataEnabled !== false,
|
|
347
|
-
onCheckedChange: (checked) =>
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
348
|
+
onCheckedChange: (checked) => {
|
|
349
|
+
setAiMetadata.mutate({
|
|
350
|
+
id: fileId,
|
|
351
|
+
enabled: checked
|
|
352
|
+
});
|
|
353
|
+
trackClientEvent("ai_metadata_toggled", {
|
|
354
|
+
target: "file",
|
|
355
|
+
enabled: checked,
|
|
356
|
+
fileId,
|
|
357
|
+
mimeType: file.mimeType
|
|
358
|
+
});
|
|
359
|
+
}
|
|
351
360
|
}), /* @__PURE__ */ jsx(Label, {
|
|
352
361
|
htmlFor: "ai-metadata",
|
|
353
362
|
children: "AI metadata"
|