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
|
@@ -7,182 +7,305 @@ import { Overlays } from "./Overlays.js";
|
|
|
7
7
|
import { OverlayTracker } from "./OverlayTracker.js";
|
|
8
8
|
import { PreviewToolbar } from "./PreviewToolbar.js";
|
|
9
9
|
import { TextFormatToolbar } from "./TextFormatToolbar.js";
|
|
10
|
+
import { c } from "react/compiler-runtime";
|
|
10
11
|
import { Frame, useFrame } from "@camox/ui/frame";
|
|
11
12
|
import { useSelector } from "@xstate/store/react";
|
|
12
13
|
import * as React from "react";
|
|
13
14
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
14
15
|
import { PanelContent } from "@camox/ui/panel";
|
|
15
16
|
//#region src/features/preview/components/PreviewPanel.tsx
|
|
16
|
-
var PreviewFrame = (
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
]
|
|
26
|
-
}
|
|
17
|
+
var PreviewFrame = (t0) => {
|
|
18
|
+
const $ = c(7);
|
|
19
|
+
const { children, style, className, onIframeReady } = t0;
|
|
20
|
+
let t1;
|
|
21
|
+
let t2;
|
|
22
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
23
|
+
t1 = /* @__PURE__ */ jsx(KeyDownForwarder, {});
|
|
24
|
+
t2 = /* @__PURE__ */ jsx(OverlayTracker, {});
|
|
25
|
+
$[0] = t1;
|
|
26
|
+
$[1] = t2;
|
|
27
|
+
} else {
|
|
28
|
+
t1 = $[0];
|
|
29
|
+
t2 = $[1];
|
|
30
|
+
}
|
|
31
|
+
let t3;
|
|
32
|
+
if ($[2] !== children || $[3] !== className || $[4] !== onIframeReady || $[5] !== style) {
|
|
33
|
+
t3 = /* @__PURE__ */ jsxs(Frame, {
|
|
34
|
+
className,
|
|
35
|
+
style,
|
|
36
|
+
onIframeReady,
|
|
37
|
+
children: [
|
|
38
|
+
children,
|
|
39
|
+
t1,
|
|
40
|
+
t2
|
|
41
|
+
]
|
|
42
|
+
});
|
|
43
|
+
$[2] = children;
|
|
44
|
+
$[3] = className;
|
|
45
|
+
$[4] = onIframeReady;
|
|
46
|
+
$[5] = style;
|
|
47
|
+
$[6] = t3;
|
|
48
|
+
} else t3 = $[6];
|
|
49
|
+
return t3;
|
|
27
50
|
};
|
|
28
51
|
var KeyDownForwarder = () => {
|
|
52
|
+
const $ = c(4);
|
|
29
53
|
const { window: iframeWindow } = useFrame();
|
|
30
|
-
const actions = useSelector(actionsStore,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
if (!action.checkIfAvailable()) return false;
|
|
42
|
-
if (checkIfInputFocused(iframeWindow.document)) {
|
|
43
|
-
if (!action.shortcut.withMeta && !action.shortcut.withAlt) return false;
|
|
44
|
-
if (action.shortcut.key === "Backspace") return false;
|
|
54
|
+
const actions = useSelector(actionsStore, _temp);
|
|
55
|
+
let t0;
|
|
56
|
+
let t1;
|
|
57
|
+
if ($[0] !== actions || $[1] !== iframeWindow) {
|
|
58
|
+
t0 = () => {
|
|
59
|
+
if (!iframeWindow || !iframeWindow.parent || iframeWindow.parent === iframeWindow) return;
|
|
60
|
+
const handleKeyDown = (e) => {
|
|
61
|
+
if (e.key.toLowerCase() === "l" && !e.repeat && !checkIfInputFocused(iframeWindow.document)) {
|
|
62
|
+
e.preventDefault();
|
|
63
|
+
iframeWindow.parent.postMessage({ type: "holdLockContent" }, "*");
|
|
64
|
+
return;
|
|
45
65
|
}
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
66
|
+
const matchingAction = actions.find((action) => {
|
|
67
|
+
if (!action.shortcut) return false;
|
|
68
|
+
if (!action.checkIfAvailable()) return false;
|
|
69
|
+
if (checkIfInputFocused(iframeWindow.document)) {
|
|
70
|
+
if (!action.shortcut.withMeta && !action.shortcut.withAlt) return false;
|
|
71
|
+
if (action.shortcut.key === "Backspace") return false;
|
|
72
|
+
}
|
|
73
|
+
const { key, withMeta, withAlt, withShift } = action.shortcut;
|
|
74
|
+
return (withAlt && key.length === 1 && /[a-z]/i.test(key) ? e.code === `Key${key.toUpperCase()}` : key.toLowerCase() === e.key.toLowerCase()) && !!withMeta === (e.metaKey || e.ctrlKey) && !!withAlt === e.altKey && !!withShift === e.shiftKey;
|
|
75
|
+
});
|
|
76
|
+
if (matchingAction) {
|
|
77
|
+
e.preventDefault();
|
|
78
|
+
iframeWindow.parent.postMessage({
|
|
79
|
+
type: "executeAction",
|
|
80
|
+
actionId: matchingAction.id
|
|
81
|
+
}, "*");
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
const handleKeyUp = (e_0) => {
|
|
85
|
+
if (e_0.key.toLowerCase() === "l") iframeWindow.parent.postMessage({ type: "releaseLockContent" }, "*");
|
|
86
|
+
};
|
|
87
|
+
iframeWindow.addEventListener("keydown", handleKeyDown);
|
|
88
|
+
iframeWindow.addEventListener("keyup", handleKeyUp);
|
|
89
|
+
return () => {
|
|
90
|
+
iframeWindow.removeEventListener("keydown", handleKeyDown);
|
|
91
|
+
iframeWindow.removeEventListener("keyup", handleKeyUp);
|
|
92
|
+
};
|
|
65
93
|
};
|
|
66
|
-
|
|
94
|
+
t1 = [iframeWindow, actions];
|
|
95
|
+
$[0] = actions;
|
|
96
|
+
$[1] = iframeWindow;
|
|
97
|
+
$[2] = t0;
|
|
98
|
+
$[3] = t1;
|
|
99
|
+
} else {
|
|
100
|
+
t0 = $[2];
|
|
101
|
+
t1 = $[3];
|
|
102
|
+
}
|
|
103
|
+
React.useEffect(t0, t1);
|
|
67
104
|
return null;
|
|
68
105
|
};
|
|
69
|
-
var PreviewPanel = (
|
|
106
|
+
var PreviewPanel = (t0) => {
|
|
107
|
+
const $ = c(15);
|
|
108
|
+
const { children } = t0;
|
|
70
109
|
useBlockActionsShortcuts();
|
|
71
|
-
const iframeElement = useSelector(previewStore,
|
|
72
|
-
const handleIframeReady =
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
element
|
|
76
|
-
});
|
|
77
|
-
}, []);
|
|
78
|
-
const isMobileMode = useSelector(previewStore, (state) => state.context.isMobileMode);
|
|
79
|
-
const isAgentChatSheetOpen = useSelector(previewStore, (state) => state.context.isAgentChatSheetOpen);
|
|
110
|
+
const iframeElement = useSelector(previewStore, _temp2);
|
|
111
|
+
const handleIframeReady = _temp3;
|
|
112
|
+
const isMobileMode = useSelector(previewStore, _temp4);
|
|
113
|
+
const isAgentChatSheetOpen = useSelector(previewStore, _temp5);
|
|
80
114
|
const isAnySideSheetOpen = useIsPreviewSheetOpen();
|
|
81
115
|
const wrapperRef = React.useRef(null);
|
|
82
116
|
const [panelWidth, setPanelWidth] = React.useState(0);
|
|
83
117
|
const [panelLeft, setPanelLeft] = React.useState(0);
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
118
|
+
let t1;
|
|
119
|
+
let t2;
|
|
120
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
121
|
+
t1 = () => {
|
|
122
|
+
const el = wrapperRef.current?.parentElement;
|
|
123
|
+
if (!el) return;
|
|
124
|
+
const update = () => {
|
|
125
|
+
const rect = el.getBoundingClientRect();
|
|
126
|
+
setPanelWidth(rect.width);
|
|
127
|
+
setPanelLeft(rect.left);
|
|
128
|
+
};
|
|
129
|
+
update();
|
|
130
|
+
const observer = new ResizeObserver(update);
|
|
131
|
+
observer.observe(el);
|
|
132
|
+
return () => observer.disconnect();
|
|
91
133
|
};
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
134
|
+
t2 = [];
|
|
135
|
+
$[0] = t1;
|
|
136
|
+
$[1] = t2;
|
|
137
|
+
} else {
|
|
138
|
+
t1 = $[0];
|
|
139
|
+
t2 = $[1];
|
|
140
|
+
}
|
|
141
|
+
React.useEffect(t1, t2);
|
|
97
142
|
const sheetOverlap = Math.max(0, 400 - panelLeft);
|
|
98
143
|
const sheetOpenScale = panelWidth > 0 ? (panelWidth - sheetOverlap) / panelWidth : 1;
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
144
|
+
let t3;
|
|
145
|
+
let t4;
|
|
146
|
+
if ($[2] !== isAgentChatSheetOpen) {
|
|
147
|
+
t3 = () => {
|
|
148
|
+
const actions = [
|
|
149
|
+
{
|
|
150
|
+
id: "toggle-editing-panel",
|
|
151
|
+
label: "Toggle editing panel",
|
|
152
|
+
groupLabel: "Preview",
|
|
153
|
+
checkIfAvailable: _temp6,
|
|
154
|
+
execute: _temp7,
|
|
155
|
+
shortcut: {
|
|
156
|
+
key: "b",
|
|
157
|
+
withAlt: true
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
id: "toggle-lock-content",
|
|
162
|
+
label: "Toggle lock content",
|
|
163
|
+
groupLabel: "Preview",
|
|
164
|
+
checkIfAvailable: _temp8,
|
|
165
|
+
execute: _temp9
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
id: "toggle-mobile-mode",
|
|
169
|
+
label: "Toggle mobile mode",
|
|
170
|
+
groupLabel: "Preview",
|
|
171
|
+
checkIfAvailable: _temp0,
|
|
172
|
+
execute: _temp1,
|
|
173
|
+
shortcut: { key: "m" }
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
id: "open-agent-chat",
|
|
177
|
+
label: "Ask for changes",
|
|
178
|
+
groupLabel: "Preview",
|
|
179
|
+
checkIfAvailable: () => !isAgentChatSheetOpen,
|
|
180
|
+
execute: _temp10,
|
|
181
|
+
shortcut: {
|
|
182
|
+
key: "i",
|
|
183
|
+
withAlt: true
|
|
184
|
+
}
|
|
136
185
|
}
|
|
137
|
-
|
|
138
|
-
];
|
|
139
|
-
actionsStore.send({
|
|
140
|
-
type: "registerManyActions",
|
|
141
|
-
actions
|
|
142
|
-
});
|
|
143
|
-
return () => {
|
|
186
|
+
];
|
|
144
187
|
actionsStore.send({
|
|
145
|
-
type: "
|
|
146
|
-
|
|
188
|
+
type: "registerManyActions",
|
|
189
|
+
actions
|
|
147
190
|
});
|
|
191
|
+
return () => {
|
|
192
|
+
actionsStore.send({
|
|
193
|
+
type: "unregisterManyActions",
|
|
194
|
+
ids: actions.map(_temp11)
|
|
195
|
+
});
|
|
196
|
+
};
|
|
148
197
|
};
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
children
|
|
198
|
+
t4 = [isAgentChatSheetOpen];
|
|
199
|
+
$[2] = isAgentChatSheetOpen;
|
|
200
|
+
$[3] = t3;
|
|
201
|
+
$[4] = t4;
|
|
202
|
+
} else {
|
|
203
|
+
t3 = $[3];
|
|
204
|
+
t4 = $[4];
|
|
205
|
+
}
|
|
206
|
+
React.useEffect(t3, t4);
|
|
207
|
+
const t5 = isAnySideSheetOpen ? `${100 / sheetOpenScale}%` : "100%";
|
|
208
|
+
const t6 = isAnySideSheetOpen ? `scale(${sheetOpenScale})` : "scale(1)";
|
|
209
|
+
let t7;
|
|
210
|
+
if ($[5] !== t5 || $[6] !== t6) {
|
|
211
|
+
t7 = {
|
|
212
|
+
height: t5,
|
|
213
|
+
transformOrigin: "top right",
|
|
214
|
+
transform: t6
|
|
215
|
+
};
|
|
216
|
+
$[5] = t5;
|
|
217
|
+
$[6] = t6;
|
|
218
|
+
$[7] = t7;
|
|
219
|
+
} else t7 = $[7];
|
|
220
|
+
let t8;
|
|
221
|
+
if ($[8] !== children || $[9] !== iframeElement || $[10] !== isMobileMode) {
|
|
222
|
+
t8 = isMobileMode ? /* @__PURE__ */ jsxs("div", {
|
|
223
|
+
className: "checkered flex h-full justify-center",
|
|
224
|
+
children: [
|
|
225
|
+
/* @__PURE__ */ jsxs("div", {
|
|
226
|
+
className: "relative mt-8 h-[700px] w-[393px] overflow-hidden",
|
|
227
|
+
children: [/* @__PURE__ */ jsx(PreviewFrame, {
|
|
228
|
+
className: "overflow-auto",
|
|
229
|
+
onIframeReady: handleIframeReady,
|
|
230
|
+
children
|
|
231
|
+
}), /* @__PURE__ */ jsx(Overlays, { iframeElement })]
|
|
179
232
|
}),
|
|
180
|
-
/* @__PURE__ */ jsx(Overlays, { iframeElement }),
|
|
181
233
|
/* @__PURE__ */ jsx(TextFormatToolbar, {}),
|
|
182
234
|
/* @__PURE__ */ jsx(PreviewToolbar, {})
|
|
183
|
-
]
|
|
184
|
-
})
|
|
185
|
-
|
|
235
|
+
]
|
|
236
|
+
}) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
237
|
+
/* @__PURE__ */ jsx(PreviewFrame, {
|
|
238
|
+
className: "checkered h-full w-full",
|
|
239
|
+
onIframeReady: handleIframeReady,
|
|
240
|
+
children
|
|
241
|
+
}),
|
|
242
|
+
/* @__PURE__ */ jsx(Overlays, { iframeElement }),
|
|
243
|
+
/* @__PURE__ */ jsx(TextFormatToolbar, {}),
|
|
244
|
+
/* @__PURE__ */ jsx(PreviewToolbar, {})
|
|
245
|
+
] });
|
|
246
|
+
$[8] = children;
|
|
247
|
+
$[9] = iframeElement;
|
|
248
|
+
$[10] = isMobileMode;
|
|
249
|
+
$[11] = t8;
|
|
250
|
+
} else t8 = $[11];
|
|
251
|
+
let t9;
|
|
252
|
+
if ($[12] !== t7 || $[13] !== t8) {
|
|
253
|
+
t9 = /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(PanelContent, {
|
|
254
|
+
className: "relative overflow-hidden bg-black",
|
|
255
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
256
|
+
ref: wrapperRef,
|
|
257
|
+
className: "absolute inset-0 transition-[transform,height] duration-500 ease-in-out will-change-transform",
|
|
258
|
+
style: t7,
|
|
259
|
+
children: t8
|
|
260
|
+
})
|
|
261
|
+
}) });
|
|
262
|
+
$[12] = t7;
|
|
263
|
+
$[13] = t8;
|
|
264
|
+
$[14] = t9;
|
|
265
|
+
} else t9 = $[14];
|
|
266
|
+
return t9;
|
|
186
267
|
};
|
|
268
|
+
function _temp(state) {
|
|
269
|
+
return state.context.actions;
|
|
270
|
+
}
|
|
271
|
+
function _temp2(state) {
|
|
272
|
+
return state.context.iframeElement;
|
|
273
|
+
}
|
|
274
|
+
function _temp3(element) {
|
|
275
|
+
previewStore.send({
|
|
276
|
+
type: "setIframeElement",
|
|
277
|
+
element
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
function _temp4(state_0) {
|
|
281
|
+
return state_0.context.isMobileMode;
|
|
282
|
+
}
|
|
283
|
+
function _temp5(state_1) {
|
|
284
|
+
return state_1.context.isAgentChatSheetOpen;
|
|
285
|
+
}
|
|
286
|
+
function _temp6() {
|
|
287
|
+
return true;
|
|
288
|
+
}
|
|
289
|
+
function _temp7() {
|
|
290
|
+
return previewStore.send({ type: "toggleSidebar" });
|
|
291
|
+
}
|
|
292
|
+
function _temp8() {
|
|
293
|
+
return true;
|
|
294
|
+
}
|
|
295
|
+
function _temp9() {
|
|
296
|
+
return previewStore.send({ type: "toggleLockContent" });
|
|
297
|
+
}
|
|
298
|
+
function _temp0() {
|
|
299
|
+
return true;
|
|
300
|
+
}
|
|
301
|
+
function _temp1() {
|
|
302
|
+
return previewStore.send({ type: "toggleMobileMode" });
|
|
303
|
+
}
|
|
304
|
+
function _temp10() {
|
|
305
|
+
return previewStore.send({ type: "openAgentChatSheet" });
|
|
306
|
+
}
|
|
307
|
+
function _temp11(a) {
|
|
308
|
+
return a.id;
|
|
309
|
+
}
|
|
187
310
|
//#endregion
|
|
188
311
|
export { PreviewFrame, PreviewPanel };
|
|
@@ -1,28 +1,61 @@
|
|
|
1
1
|
import { previewStore } from "../previewStore.js";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
2
3
|
import { useSelector } from "@xstate/store/react";
|
|
3
4
|
import "react";
|
|
4
5
|
import * as Sheet from "@camox/ui/sheet";
|
|
5
6
|
import { jsx } from "react/jsx-runtime";
|
|
6
7
|
//#region src/features/preview/components/PreviewSideSheet.tsx
|
|
7
|
-
var PreviewSideSheet = (
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
var PreviewSideSheet = (t0) => {
|
|
9
|
+
const $ = c(9);
|
|
10
|
+
const { open, onOpenChange, onOpenAutoFocus, children, className } = t0;
|
|
11
|
+
let t1;
|
|
12
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
13
|
+
t1 = { minWidth: 400 };
|
|
14
|
+
$[0] = t1;
|
|
15
|
+
} else t1 = $[0];
|
|
16
|
+
let t2;
|
|
17
|
+
if ($[1] !== children || $[2] !== className || $[3] !== onOpenAutoFocus) {
|
|
18
|
+
t2 = /* @__PURE__ */ jsx(Sheet.SheetContent, {
|
|
12
19
|
className,
|
|
13
20
|
side: "left",
|
|
14
21
|
overlayClassName: "bg-black/0",
|
|
15
|
-
style:
|
|
22
|
+
style: t1,
|
|
16
23
|
onOpenAutoFocus,
|
|
17
24
|
children
|
|
18
|
-
})
|
|
19
|
-
|
|
25
|
+
});
|
|
26
|
+
$[1] = children;
|
|
27
|
+
$[2] = className;
|
|
28
|
+
$[3] = onOpenAutoFocus;
|
|
29
|
+
$[4] = t2;
|
|
30
|
+
} else t2 = $[4];
|
|
31
|
+
let t3;
|
|
32
|
+
if ($[5] !== onOpenChange || $[6] !== open || $[7] !== t2) {
|
|
33
|
+
t3 = /* @__PURE__ */ jsx(Sheet.Sheet, {
|
|
34
|
+
open,
|
|
35
|
+
onOpenChange,
|
|
36
|
+
children: t2
|
|
37
|
+
});
|
|
38
|
+
$[5] = onOpenChange;
|
|
39
|
+
$[6] = open;
|
|
40
|
+
$[7] = t2;
|
|
41
|
+
$[8] = t3;
|
|
42
|
+
} else t3 = $[8];
|
|
43
|
+
return t3;
|
|
20
44
|
};
|
|
21
45
|
function useIsPreviewSheetOpen() {
|
|
22
|
-
const isPageContentSheetOpen = useSelector(previewStore,
|
|
23
|
-
const isPeekingBlock = useSelector(previewStore,
|
|
24
|
-
const isAgentChatSheetOpen = useSelector(previewStore,
|
|
46
|
+
const isPageContentSheetOpen = useSelector(previewStore, _temp);
|
|
47
|
+
const isPeekingBlock = useSelector(previewStore, _temp2);
|
|
48
|
+
const isAgentChatSheetOpen = useSelector(previewStore, _temp3);
|
|
25
49
|
return isPageContentSheetOpen || isPeekingBlock || isAgentChatSheetOpen;
|
|
26
50
|
}
|
|
51
|
+
function _temp3(state_1) {
|
|
52
|
+
return state_1.context.isAgentChatSheetOpen;
|
|
53
|
+
}
|
|
54
|
+
function _temp2(state_0) {
|
|
55
|
+
return state_0.context.peekedBlock != null;
|
|
56
|
+
}
|
|
57
|
+
function _temp(state) {
|
|
58
|
+
return state.context.isPageContentSheetOpen;
|
|
59
|
+
}
|
|
27
60
|
//#endregion
|
|
28
61
|
export { PreviewSideSheet, Sheet, useIsPreviewSheetOpen };
|