camox 0.3.0 → 0.4.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.
- package/dist/components/AuthGate.js +2 -1
- package/dist/core/components/AddBlockControlBar.js +117 -44
- package/dist/core/components/lexical/InlineContentEditable.js +37 -17
- package/dist/core/components/lexical/InlineLexicalEditor.js +84 -25
- package/dist/core/components/lexical/SelectionBroadcaster.js +84 -47
- package/dist/core/components/lexical/SidebarLexicalEditor.js +54 -19
- package/dist/core/createBlock.js +1172 -414
- package/dist/core/createLayout.js +48 -16
- package/dist/core/hooks/useFieldSelection.js +24 -13
- package/dist/core/hooks/useIsEditable.js +8 -2
- package/dist/core/hooks/useOverlayMessage.js +51 -20
- package/dist/features/content/CamoxContent.js +239 -107
- package/dist/features/content/components/AssetCard.js +78 -16
- package/dist/features/content/components/AssetCardSkeleton.js +11 -4
- package/dist/features/content/components/ContentSidebar.js +15 -8
- package/dist/features/content/components/UploadDropZone.js +77 -34
- package/dist/features/content/components/UploadProgressDrawer.js +201 -58
- package/dist/features/metadata/sitemap.js +15 -0
- package/dist/features/preview/CamoxPreview.js +447 -179
- package/dist/features/preview/components/AddBlockSheet.js +344 -167
- package/dist/features/preview/components/AgentChatSheet.js +32 -10
- package/dist/features/preview/components/AssetFieldEditor.js +185 -50
- package/dist/features/preview/components/AssetLightbox.js +60 -33
- package/dist/features/preview/components/AssetPickerGrid.js +203 -71
- package/dist/features/preview/components/BlockActionsPopover.js +295 -218
- package/dist/features/preview/components/CreatePageSheet.js +3 -3
- package/dist/features/preview/components/DebouncedFieldEditor.js +80 -23
- package/dist/features/preview/components/EditPageSheet.js +241 -86
- package/dist/features/preview/components/ItemFieldsEditor.js +209 -115
- package/dist/features/preview/components/LinkFieldEditor.js +351 -153
- package/dist/features/preview/components/MultipleAssetFieldEditor.js +245 -92
- package/dist/features/preview/components/OverlayTracker.js +58 -23
- package/dist/features/preview/components/Overlays.js +85 -43
- package/dist/features/preview/components/PageContentSheet.js +18 -18
- package/dist/features/preview/components/PageLocationFieldset.js +229 -63
- package/dist/features/preview/components/PagePicker.js +27 -27
- package/dist/features/preview/components/PageTree.js +921 -319
- package/dist/features/preview/components/PeekedBlock.js +173 -63
- package/dist/features/preview/components/PreviewPanel.js +271 -148
- package/dist/features/preview/components/PreviewSideSheet.js +44 -11
- package/dist/features/preview/components/PreviewToolbar.js +262 -59
- package/dist/features/preview/components/RepeatableItemsList.js +187 -78
- package/dist/features/preview/components/ShikiMarkdown.js +46 -20
- package/dist/features/preview/components/TextFormatToolbar.js +81 -23
- package/dist/features/preview/components/UnlinkAssetButton.js +161 -40
- package/dist/features/preview/components/useUpdateBlockPosition.js +64 -47
- package/dist/features/preview/previewStore.d.ts +2 -2
- package/dist/features/provider/CamoxProvider.js +69 -21
- package/dist/features/provider/actionsStore.d.ts +2 -2
- package/dist/features/provider/components/CamoxAppContext.js +15 -5
- package/dist/features/provider/components/CommandPalette.js +199 -92
- package/dist/features/provider/useAdminShortcuts.js +80 -64
- package/dist/features/routes/pageRoute.js +8 -1
- package/dist/features/studio/CamoxStudio.js +45 -9
- package/dist/features/studio/components/EnvironmentMenu.js +47 -12
- package/dist/features/studio/components/Navbar.js +163 -65
- package/dist/features/studio/components/ProjectMenu.d.ts.map +1 -1
- package/dist/features/studio/components/ProjectMenu.js +284 -83
- package/dist/features/studio/components/UserButton.js +21 -6
- package/dist/features/studio/studioStore.d.ts +2 -2
- package/dist/features/studio/useTheme.js +128 -74
- package/dist/features/vite/definitionsSync.d.ts +7 -12
- package/dist/features/vite/definitionsSync.d.ts.map +1 -1
- package/dist/features/vite/definitionsSync.js +5 -16
- package/dist/features/vite/vite.d.ts +0 -3
- package/dist/features/vite/vite.d.ts.map +1 -1
- package/dist/features/vite/vite.js +1 -2
- package/dist/hooks/use-file-upload.js +11 -11
- package/dist/hooks/use-marquee-selection.js +121 -74
- package/dist/lib/auth.js +95 -51
- package/dist/lib/normalized-data.js +103 -30
- package/dist/lib/use-project-room.js +55 -22
- package/dist/studio.css +2 -2
- package/package.json +29 -26
- package/dist/lib/auth.d.ts +0 -2130
- package/dist/lib/auth.d.ts.map +0 -1
|
@@ -1,89 +1,199 @@
|
|
|
1
1
|
import { previewStore } from "../previewStore.js";
|
|
2
2
|
import { NormalizedDataProvider } from "../../../lib/normalized-data.js";
|
|
3
|
+
import { c } from "react/compiler-runtime";
|
|
3
4
|
import { useSelector } from "@xstate/store/react";
|
|
4
5
|
import * as React from "react";
|
|
5
6
|
import { jsx } from "react/jsx-runtime";
|
|
6
7
|
//#region src/features/preview/components/PeekedBlock.tsx
|
|
7
|
-
var PeekedBlock = (
|
|
8
|
-
const
|
|
9
|
-
const
|
|
8
|
+
var PeekedBlock = (t0) => {
|
|
9
|
+
const $ = c(34);
|
|
10
|
+
const { onExitComplete } = t0;
|
|
11
|
+
const peekedBlock = useSelector(previewStore, _temp);
|
|
12
|
+
const skipExitAnimation = useSelector(previewStore, _temp2);
|
|
10
13
|
const peekedBlockRef = React.useRef(null);
|
|
11
14
|
const [displayedBlock, setDisplayedBlock] = React.useState(null);
|
|
12
15
|
const [isExpanded, setIsExpanded] = React.useState(false);
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
let t1;
|
|
17
|
+
let t2;
|
|
18
|
+
if ($[0] !== onExitComplete || $[1] !== peekedBlock || $[2] !== skipExitAnimation) {
|
|
19
|
+
t1 = () => {
|
|
20
|
+
if (peekedBlock) {
|
|
21
|
+
setDisplayedBlock(peekedBlock);
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
if (skipExitAnimation) {
|
|
25
|
+
setIsExpanded(false);
|
|
26
|
+
setDisplayedBlock(null);
|
|
27
|
+
onExitComplete?.();
|
|
28
|
+
previewStore.send({ type: "clearSkipPeekedBlockExitAnimation" });
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
19
31
|
setIsExpanded(false);
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
peekedBlock
|
|
28
|
-
skipExitAnimation
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
32
|
+
};
|
|
33
|
+
t2 = [
|
|
34
|
+
peekedBlock,
|
|
35
|
+
skipExitAnimation,
|
|
36
|
+
onExitComplete
|
|
37
|
+
];
|
|
38
|
+
$[0] = onExitComplete;
|
|
39
|
+
$[1] = peekedBlock;
|
|
40
|
+
$[2] = skipExitAnimation;
|
|
41
|
+
$[3] = t1;
|
|
42
|
+
$[4] = t2;
|
|
43
|
+
} else {
|
|
44
|
+
t1 = $[3];
|
|
45
|
+
t2 = $[4];
|
|
46
|
+
}
|
|
47
|
+
React.useEffect(t1, t2);
|
|
48
|
+
let t3;
|
|
49
|
+
let t4;
|
|
50
|
+
if ($[5] !== displayedBlock) {
|
|
51
|
+
t3 = () => {
|
|
52
|
+
if (!displayedBlock) return;
|
|
53
|
+
const id = requestAnimationFrame(() => setIsExpanded(true));
|
|
54
|
+
return () => cancelAnimationFrame(id);
|
|
55
|
+
};
|
|
56
|
+
t4 = [displayedBlock];
|
|
57
|
+
$[5] = displayedBlock;
|
|
58
|
+
$[6] = t3;
|
|
59
|
+
$[7] = t4;
|
|
60
|
+
} else {
|
|
61
|
+
t3 = $[6];
|
|
62
|
+
t4 = $[7];
|
|
63
|
+
}
|
|
64
|
+
React.useEffect(t3, t4);
|
|
65
|
+
let t5;
|
|
66
|
+
let t6;
|
|
67
|
+
if ($[8] !== displayedBlock) {
|
|
68
|
+
t5 = () => {
|
|
69
|
+
if (displayedBlock && peekedBlockRef.current) peekedBlockRef.current.scrollIntoView({
|
|
46
70
|
behavior: "instant",
|
|
47
71
|
block: "start"
|
|
48
72
|
});
|
|
49
|
-
|
|
73
|
+
};
|
|
74
|
+
t6 = [displayedBlock];
|
|
75
|
+
$[8] = displayedBlock;
|
|
76
|
+
$[9] = t5;
|
|
77
|
+
$[10] = t6;
|
|
78
|
+
} else {
|
|
79
|
+
t5 = $[9];
|
|
80
|
+
t6 = $[10];
|
|
81
|
+
}
|
|
82
|
+
React.useEffect(t5, t6);
|
|
83
|
+
let t7;
|
|
84
|
+
if ($[11] !== isExpanded || $[12] !== onExitComplete) {
|
|
85
|
+
t7 = (e) => {
|
|
86
|
+
if (e.propertyName !== "grid-template-rows" || e.target !== e.currentTarget) return;
|
|
87
|
+
if (isExpanded) {
|
|
88
|
+
peekedBlockRef.current?.scrollIntoView({
|
|
89
|
+
behavior: "instant",
|
|
90
|
+
block: "start"
|
|
91
|
+
});
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
setDisplayedBlock(null);
|
|
95
|
+
onExitComplete?.();
|
|
96
|
+
};
|
|
97
|
+
$[11] = isExpanded;
|
|
98
|
+
$[12] = onExitComplete;
|
|
99
|
+
$[13] = t7;
|
|
100
|
+
} else t7 = $[13];
|
|
101
|
+
const handleTransitionEnd = t7;
|
|
102
|
+
let t8;
|
|
103
|
+
bb0: {
|
|
104
|
+
if (!displayedBlock) {
|
|
105
|
+
t8 = null;
|
|
106
|
+
break bb0;
|
|
50
107
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
108
|
+
let t9;
|
|
109
|
+
if ($[14] !== displayedBlock) {
|
|
110
|
+
t9 = displayedBlock.getPeekBundle();
|
|
111
|
+
$[14] = displayedBlock;
|
|
112
|
+
$[15] = t9;
|
|
113
|
+
} else t9 = $[15];
|
|
114
|
+
t8 = t9;
|
|
115
|
+
}
|
|
116
|
+
const peekBundle = t8;
|
|
58
117
|
if (!displayedBlock || !peekBundle) return null;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
118
|
+
const t9 = isExpanded ? "1fr" : "0fr";
|
|
119
|
+
let t10;
|
|
120
|
+
if ($[16] !== t9) {
|
|
121
|
+
t10 = {
|
|
62
122
|
scrollMargin: "5rem",
|
|
63
123
|
display: "grid",
|
|
64
|
-
gridTemplateRows:
|
|
124
|
+
gridTemplateRows: t9,
|
|
65
125
|
transition: "grid-template-rows 300ms ease-out",
|
|
66
126
|
background: "var(--background)"
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
127
|
+
};
|
|
128
|
+
$[16] = t9;
|
|
129
|
+
$[17] = t10;
|
|
130
|
+
} else t10 = $[17];
|
|
131
|
+
let t11;
|
|
132
|
+
if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
|
|
133
|
+
t11 = { overflow: "hidden" };
|
|
134
|
+
$[18] = t11;
|
|
135
|
+
} else t11 = $[18];
|
|
136
|
+
const t12 = peekBundle.block.content;
|
|
137
|
+
const t13 = peekBundle.block.settings;
|
|
138
|
+
let t14;
|
|
139
|
+
if ($[19] !== displayedBlock.id || $[20] !== t12 || $[21] !== t13) {
|
|
140
|
+
t14 = {
|
|
141
|
+
_id: "__peek__",
|
|
142
|
+
type: displayedBlock.id,
|
|
143
|
+
content: t12,
|
|
144
|
+
settings: t13,
|
|
145
|
+
position: ""
|
|
146
|
+
};
|
|
147
|
+
$[19] = displayedBlock.id;
|
|
148
|
+
$[20] = t12;
|
|
149
|
+
$[21] = t13;
|
|
150
|
+
$[22] = t14;
|
|
151
|
+
} else t14 = $[22];
|
|
152
|
+
let t15;
|
|
153
|
+
if ($[23] !== displayedBlock.Component || $[24] !== t14) {
|
|
154
|
+
t15 = /* @__PURE__ */ jsx(displayedBlock.Component, {
|
|
155
|
+
blockData: t14,
|
|
156
|
+
mode: "peek"
|
|
157
|
+
});
|
|
158
|
+
$[23] = displayedBlock.Component;
|
|
159
|
+
$[24] = t14;
|
|
160
|
+
$[25] = t15;
|
|
161
|
+
} else t15 = $[25];
|
|
162
|
+
let t16;
|
|
163
|
+
if ($[26] !== peekBundle.files || $[27] !== peekBundle.repeatableItems || $[28] !== t15) {
|
|
164
|
+
t16 = /* @__PURE__ */ jsx("div", {
|
|
165
|
+
style: t11,
|
|
71
166
|
children: /* @__PURE__ */ jsx(NormalizedDataProvider, {
|
|
72
167
|
files: peekBundle.files,
|
|
73
168
|
repeatableItems: peekBundle.repeatableItems,
|
|
74
|
-
children:
|
|
75
|
-
blockData: {
|
|
76
|
-
_id: "__peek__",
|
|
77
|
-
type: displayedBlock.id,
|
|
78
|
-
content: peekBundle.block.content,
|
|
79
|
-
settings: peekBundle.block.settings,
|
|
80
|
-
position: ""
|
|
81
|
-
},
|
|
82
|
-
mode: "peek"
|
|
83
|
-
})
|
|
169
|
+
children: t15
|
|
84
170
|
})
|
|
85
|
-
})
|
|
86
|
-
|
|
171
|
+
});
|
|
172
|
+
$[26] = peekBundle.files;
|
|
173
|
+
$[27] = peekBundle.repeatableItems;
|
|
174
|
+
$[28] = t15;
|
|
175
|
+
$[29] = t16;
|
|
176
|
+
} else t16 = $[29];
|
|
177
|
+
let t17;
|
|
178
|
+
if ($[30] !== handleTransitionEnd || $[31] !== t10 || $[32] !== t16) {
|
|
179
|
+
t17 = /* @__PURE__ */ jsx("div", {
|
|
180
|
+
ref: peekedBlockRef,
|
|
181
|
+
style: t10,
|
|
182
|
+
onTransitionEnd: handleTransitionEnd,
|
|
183
|
+
children: t16
|
|
184
|
+
});
|
|
185
|
+
$[30] = handleTransitionEnd;
|
|
186
|
+
$[31] = t10;
|
|
187
|
+
$[32] = t16;
|
|
188
|
+
$[33] = t17;
|
|
189
|
+
} else t17 = $[33];
|
|
190
|
+
return t17;
|
|
87
191
|
};
|
|
192
|
+
function _temp(state) {
|
|
193
|
+
return state.context.peekedBlock;
|
|
194
|
+
}
|
|
195
|
+
function _temp2(state_0) {
|
|
196
|
+
return state_0.context.skipPeekedBlockExitAnimation;
|
|
197
|
+
}
|
|
88
198
|
//#endregion
|
|
89
199
|
export { PeekedBlock };
|