camox 0.41.0 → 0.42.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/core/components/lexical/SidebarLexicalEditor.js +42 -39
- package/dist/core/createApp.d.ts +16 -2
- package/dist/core/createBlock.js +11 -25
- package/dist/core/editing/BlockEditingRuntime.js +4 -4
- package/dist/core/editing/CompleteBlockEditingRuntime.js +5 -5
- package/dist/core/editing/createEditableBlock.d.ts +8 -1
- package/dist/core/editing/createEditableBlock.js +684 -644
- package/dist/core/hooks/useIsEditable.js +4 -7
- package/dist/core/hooks/useOverlayState.js +11 -0
- package/dist/core/hooks/useRequireDraftSource.js +7 -11
- package/dist/core/lib/fieldTypes.js +5 -5
- package/dist/core/lib/lexicalState.js +17 -1
- package/dist/features/preview/CamoxPreview.js +123 -137
- package/dist/features/preview/DerivedPreview.js +6 -9
- package/dist/features/preview/commentsEnabled.js +8 -0
- package/dist/features/preview/components/AddBlockSidebar.js +79 -89
- package/dist/features/preview/components/AssetLightbox.js +4 -11
- package/dist/features/preview/components/AttachedComments.js +194 -0
- package/dist/features/preview/components/BlockActionsPopover.js +19 -70
- package/dist/features/preview/components/CommentHeader.js +122 -0
- package/dist/features/preview/components/CommentSidebar.js +29 -0
- package/dist/features/preview/components/CommentTargetQuote.js +166 -0
- package/dist/features/preview/components/CreatePageModal.js +2 -8
- package/dist/features/preview/components/DerivedLayoutSidebar.js +4 -7
- package/dist/features/preview/components/ItemFieldsEditor.js +275 -204
- package/dist/features/preview/components/LeftSidebar.js +18 -18
- package/dist/features/preview/components/LinkFieldEditor.js +3 -4
- package/dist/features/preview/components/MobilePreviewDrawer.js +3 -3
- package/dist/features/preview/components/OverlayTracker.js +14 -20
- package/dist/features/preview/components/Overlays.js +28 -40
- package/dist/features/preview/components/PageEditorSidebar.js +231 -241
- package/dist/features/preview/components/PageInfoSidebar.js +126 -157
- package/dist/features/preview/components/PagePicker.js +13 -8
- package/dist/features/preview/components/PageTree.js +255 -319
- package/dist/features/preview/components/PreviewComments.js +56 -0
- package/dist/features/preview/components/PreviewPanel.js +149 -107
- package/dist/features/preview/components/PreviewToolbar.js +292 -246
- package/dist/features/preview/components/PreviewToolbarSpacer.js +43 -0
- package/dist/features/preview/components/PublicationRow.js +11 -24
- package/dist/features/preview/components/RightSidebar.js +14 -11
- package/dist/features/preview/components/SidebarSection.js +121 -0
- package/dist/features/preview/previewCommentsStore.js +115 -0
- package/dist/features/preview/previewSelection.js +75 -0
- package/dist/features/preview/previewStore.js +32 -63
- package/dist/features/provider/AuthenticatedCamoxProvider.js +46 -34
- package/dist/features/provider/components/CommandPalette.js +142 -58
- package/dist/features/provider/useAdminShortcuts.js +20 -8
- package/dist/features/routes/pageRuntime.js +0 -6
- package/dist/features/runtime/RuntimeChrome.js +102 -87
- package/dist/features/studio/CamoxStudio.js +30 -50
- package/dist/features/studio/components/UserButton.js +4 -4
- package/dist/features/vite/runtimeDev.js +4 -1
- package/dist/features/vite/vite.d.ts +3 -2
- package/dist/features/vite/vite.js +9 -5
- package/dist/hooks/use-file-upload.js +0 -2
- package/dist/studio.css +1 -1
- package/package.json +5 -7
- package/dist/features/preview/components/DraftSwitchDialog.js +0 -66
- package/dist/lib/telemetry-client.js +0 -66
- package/dist/lib/telemetry.js +0 -26
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { formatShortcut } from "../../../lib/utils.js";
|
|
2
|
-
import {
|
|
2
|
+
import { areCommentsEnabled } from "../commentsEnabled.js";
|
|
3
|
+
import { previewStore, selectIsCommentMode, selectIsEditMode } from "../previewStore.js";
|
|
3
4
|
import { EDIT_MODE_SHORTCUT } from "../previewConstants.js";
|
|
5
|
+
import { previewCommentsStore } from "../previewCommentsStore.js";
|
|
4
6
|
import { c } from "react/compiler-runtime";
|
|
5
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
8
|
import { useSelector } from "@xstate/store-react";
|
|
7
9
|
import { Button } from "@camox/ui/button";
|
|
8
|
-
import { Monitor, Smartphone, Tablet, X } from "lucide-react";
|
|
10
|
+
import { MessageCircle, Monitor, Smartphone, Tablet, X } from "lucide-react";
|
|
9
11
|
import { Label } from "@camox/ui/label";
|
|
10
12
|
import * as Tooltip$1 from "@camox/ui/tooltip";
|
|
11
13
|
import { ButtonGroup } from "@camox/ui/button-group";
|
|
@@ -15,326 +17,370 @@ import { Toggle } from "@camox/ui/toggle";
|
|
|
15
17
|
|
|
16
18
|
//#region src/features/preview/components/PreviewToolbar.tsx
|
|
17
19
|
const PreviewToolbar = (t0) => {
|
|
18
|
-
const $ = c(
|
|
19
|
-
if ($[0] !== "
|
|
20
|
-
for (let $i = 0; $i <
|
|
21
|
-
$[0] = "
|
|
20
|
+
const $ = c(77);
|
|
21
|
+
if ($[0] !== "19095e3108d685099398c545dfc96ef948a6769b13376550d2ac5eaeccd94797") {
|
|
22
|
+
for (let $i = 0; $i < 77; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
23
|
+
$[0] = "19095e3108d685099398c545dfc96ef948a6769b13376550d2ac5eaeccd94797";
|
|
22
24
|
}
|
|
23
|
-
const { onEditModeChange, pageStatus, hasLiveVersion } = t0;
|
|
24
|
-
const isEditMode = useSelector(previewStore,
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
|
|
25
|
+
const { onEditModeChange, pageId, pageStatus, hasLiveVersion } = t0;
|
|
26
|
+
const isEditMode = useSelector(previewStore, selectIsEditMode);
|
|
27
|
+
const isCommentMode = useSelector(previewStore, selectIsCommentMode);
|
|
28
|
+
const isToolbarHidden = useSelector(previewStore, _temp);
|
|
29
|
+
const peekedBlock = useSelector(previewStore, _temp2);
|
|
30
|
+
const viewportMode = useSelector(previewStore, _temp3);
|
|
29
31
|
let t1;
|
|
30
|
-
if ($[1] !==
|
|
31
|
-
t1 = (
|
|
32
|
+
if ($[1] !== pageId) {
|
|
33
|
+
t1 = (state_2) => state_2.context.comments.filter((comment) => comment.pageId === pageId).length;
|
|
34
|
+
$[1] = pageId;
|
|
35
|
+
$[2] = t1;
|
|
36
|
+
} else t1 = $[2];
|
|
37
|
+
const commentCount = useSelector(previewCommentsStore, t1);
|
|
38
|
+
if (isToolbarHidden || peekedBlock) return null;
|
|
39
|
+
let t2;
|
|
40
|
+
if ($[3] !== onEditModeChange) {
|
|
41
|
+
t2 = (checked) => {
|
|
32
42
|
if (onEditModeChange) {
|
|
33
43
|
onEditModeChange(checked);
|
|
34
44
|
return;
|
|
35
45
|
}
|
|
36
46
|
previewStore.send({ type: checked ? "enterEditMode" : "exitEditMode" });
|
|
37
47
|
};
|
|
38
|
-
$[
|
|
39
|
-
$[
|
|
40
|
-
} else
|
|
41
|
-
let
|
|
42
|
-
if ($[
|
|
43
|
-
|
|
48
|
+
$[3] = onEditModeChange;
|
|
49
|
+
$[4] = t2;
|
|
50
|
+
} else t2 = $[4];
|
|
51
|
+
let t3;
|
|
52
|
+
if ($[5] !== isEditMode || $[6] !== t2) {
|
|
53
|
+
t3 = /* @__PURE__ */ jsx(Switch, {
|
|
44
54
|
id: "edit-mode",
|
|
45
55
|
checked: isEditMode,
|
|
46
|
-
onCheckedChange:
|
|
56
|
+
onCheckedChange: t2
|
|
47
57
|
});
|
|
48
|
-
$[
|
|
49
|
-
$[
|
|
50
|
-
$[
|
|
51
|
-
} else
|
|
52
|
-
let
|
|
53
|
-
if ($[
|
|
54
|
-
|
|
58
|
+
$[5] = isEditMode;
|
|
59
|
+
$[6] = t2;
|
|
60
|
+
$[7] = t3;
|
|
61
|
+
} else t3 = $[7];
|
|
62
|
+
let t4;
|
|
63
|
+
if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
|
|
64
|
+
t4 = /* @__PURE__ */ jsxs(Label, {
|
|
55
65
|
htmlFor: "edit-mode",
|
|
56
66
|
className: "flex items-center gap-2",
|
|
57
67
|
children: ["Edit mode ", formatShortcut(EDIT_MODE_SHORTCUT)]
|
|
58
68
|
});
|
|
59
|
-
$[6] = t3;
|
|
60
|
-
} else t3 = $[6];
|
|
61
|
-
let t4;
|
|
62
|
-
if ($[7] !== t2) {
|
|
63
|
-
t4 = /* @__PURE__ */ jsxs("div", {
|
|
64
|
-
className: "flex shrink-0 items-center gap-2 px-2",
|
|
65
|
-
children: [t2, t3]
|
|
66
|
-
});
|
|
67
|
-
$[7] = t2;
|
|
68
69
|
$[8] = t4;
|
|
69
70
|
} else t4 = $[8];
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
71
|
+
let t5;
|
|
72
|
+
if ($[9] !== t3) {
|
|
73
|
+
t5 = /* @__PURE__ */ jsxs("div", {
|
|
74
|
+
className: "flex shrink-0 items-center gap-2 px-2",
|
|
75
|
+
children: [t3, t4]
|
|
76
|
+
});
|
|
77
|
+
$[9] = t3;
|
|
78
|
+
$[10] = t5;
|
|
79
|
+
} else t5 = $[10];
|
|
80
|
+
let t6;
|
|
81
|
+
if ($[11] !== commentCount || $[12] !== isCommentMode || $[13] !== isEditMode || $[14] !== pageStatus) {
|
|
82
|
+
t6 = areCommentsEnabled() && pageStatus && /* @__PURE__ */ jsxs(Tooltip$1.Tooltip, { children: [/* @__PURE__ */ jsxs(Tooltip$1.TooltipTrigger, {
|
|
83
|
+
render: /* @__PURE__ */ jsx(Toggle, {
|
|
84
|
+
pressed: isCommentMode,
|
|
85
|
+
"data-state": isCommentMode ? "on" : "off",
|
|
86
|
+
onPressedChange: (enabled) => {
|
|
87
|
+
if (enabled && !isEditMode) previewStore.send({ type: "enterEditMode" });
|
|
88
|
+
previewStore.send({
|
|
89
|
+
type: "setCommentMode",
|
|
90
|
+
enabled
|
|
91
|
+
});
|
|
92
|
+
},
|
|
93
|
+
variant: "outline"
|
|
94
|
+
}),
|
|
95
|
+
children: [
|
|
96
|
+
/* @__PURE__ */ jsx(MessageCircle, {}),
|
|
97
|
+
"Feedback",
|
|
98
|
+
commentCount > 0 && /* @__PURE__ */ jsxs("span", {
|
|
99
|
+
className: "text-muted-foreground",
|
|
100
|
+
children: [
|
|
101
|
+
"(",
|
|
102
|
+
commentCount,
|
|
103
|
+
")"
|
|
104
|
+
]
|
|
105
|
+
})
|
|
106
|
+
]
|
|
107
|
+
}), /* @__PURE__ */ jsx(Tooltip$1.TooltipContent, { children: "Leave feedback for agents or teammates" })] });
|
|
108
|
+
$[11] = commentCount;
|
|
109
|
+
$[12] = isCommentMode;
|
|
110
|
+
$[13] = isEditMode;
|
|
111
|
+
$[14] = pageStatus;
|
|
112
|
+
$[15] = t6;
|
|
113
|
+
} else t6 = $[15];
|
|
114
|
+
const t7 = viewportMode === "full" ? "on" : "off";
|
|
115
|
+
const t8 = viewportMode === "full";
|
|
116
|
+
let t9;
|
|
117
|
+
if ($[16] !== viewportMode) {
|
|
118
|
+
t9 = () => {
|
|
75
119
|
if (viewportMode === "full") return;
|
|
76
120
|
previewStore.send({
|
|
77
121
|
type: "setViewportMode",
|
|
78
122
|
mode: "full"
|
|
79
123
|
});
|
|
80
124
|
};
|
|
81
|
-
$[
|
|
82
|
-
$[
|
|
83
|
-
} else
|
|
84
|
-
let t8;
|
|
85
|
-
if ($[11] !== t5 || $[12] !== t6 || $[13] !== t7) {
|
|
86
|
-
t8 = /* @__PURE__ */ jsx(Toggle, {
|
|
87
|
-
"data-state": t5,
|
|
88
|
-
pressed: t6,
|
|
89
|
-
onPressedChange: t7,
|
|
90
|
-
variant: "outline"
|
|
91
|
-
});
|
|
92
|
-
$[11] = t5;
|
|
93
|
-
$[12] = t6;
|
|
94
|
-
$[13] = t7;
|
|
95
|
-
$[14] = t8;
|
|
96
|
-
} else t8 = $[14];
|
|
97
|
-
let t9;
|
|
98
|
-
if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
|
|
99
|
-
t9 = /* @__PURE__ */ jsx(Monitor, {});
|
|
100
|
-
$[15] = t9;
|
|
101
|
-
} else t9 = $[15];
|
|
125
|
+
$[16] = viewportMode;
|
|
126
|
+
$[17] = t9;
|
|
127
|
+
} else t9 = $[17];
|
|
102
128
|
let t10;
|
|
103
|
-
if ($[
|
|
104
|
-
t10 = /* @__PURE__ */ jsx(
|
|
105
|
-
|
|
106
|
-
|
|
129
|
+
if ($[18] !== t7 || $[19] !== t8 || $[20] !== t9) {
|
|
130
|
+
t10 = /* @__PURE__ */ jsx(Toggle, {
|
|
131
|
+
"data-state": t7,
|
|
132
|
+
pressed: t8,
|
|
133
|
+
onPressedChange: t9,
|
|
134
|
+
variant: "outline"
|
|
107
135
|
});
|
|
108
|
-
$[
|
|
109
|
-
$[
|
|
110
|
-
|
|
136
|
+
$[18] = t7;
|
|
137
|
+
$[19] = t8;
|
|
138
|
+
$[20] = t9;
|
|
139
|
+
$[21] = t10;
|
|
140
|
+
} else t10 = $[21];
|
|
111
141
|
let t11;
|
|
112
|
-
if ($[
|
|
113
|
-
t11 = /* @__PURE__ */ jsx(
|
|
114
|
-
$[
|
|
115
|
-
} else t11 = $[
|
|
142
|
+
if ($[22] === Symbol.for("react.memo_cache_sentinel")) {
|
|
143
|
+
t11 = /* @__PURE__ */ jsx(Monitor, {});
|
|
144
|
+
$[22] = t11;
|
|
145
|
+
} else t11 = $[22];
|
|
116
146
|
let t12;
|
|
117
|
-
if ($[
|
|
118
|
-
t12 = /* @__PURE__ */
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
147
|
+
if ($[23] !== t10) {
|
|
148
|
+
t12 = /* @__PURE__ */ jsx(Tooltip$1.TooltipTrigger, {
|
|
149
|
+
render: t10,
|
|
150
|
+
children: t11
|
|
151
|
+
});
|
|
152
|
+
$[23] = t10;
|
|
153
|
+
$[24] = t12;
|
|
154
|
+
} else t12 = $[24];
|
|
155
|
+
let t13;
|
|
156
|
+
if ($[25] === Symbol.for("react.memo_cache_sentinel")) {
|
|
157
|
+
t13 = /* @__PURE__ */ jsx(Tooltip$1.TooltipContent, { children: "Full view" });
|
|
158
|
+
$[25] = t13;
|
|
159
|
+
} else t13 = $[25];
|
|
160
|
+
let t14;
|
|
161
|
+
if ($[26] !== t12) {
|
|
162
|
+
t14 = /* @__PURE__ */ jsxs(Tooltip$1.Tooltip, { children: [t12, t13] });
|
|
163
|
+
$[26] = t12;
|
|
164
|
+
$[27] = t14;
|
|
165
|
+
} else t14 = $[27];
|
|
166
|
+
const t15 = viewportMode === "tablet" ? "on" : "off";
|
|
167
|
+
const t16 = viewportMode === "tablet";
|
|
168
|
+
let t17;
|
|
169
|
+
if ($[28] !== viewportMode) {
|
|
170
|
+
t17 = () => {
|
|
127
171
|
if (viewportMode === "tablet") return;
|
|
128
172
|
previewStore.send({
|
|
129
173
|
type: "setViewportMode",
|
|
130
174
|
mode: "tablet"
|
|
131
175
|
});
|
|
132
176
|
};
|
|
133
|
-
$[
|
|
134
|
-
$[
|
|
135
|
-
} else
|
|
136
|
-
let t16;
|
|
137
|
-
if ($[23] !== t13 || $[24] !== t14 || $[25] !== t15) {
|
|
138
|
-
t16 = /* @__PURE__ */ jsx(Toggle, {
|
|
139
|
-
"data-state": t13,
|
|
140
|
-
pressed: t14,
|
|
141
|
-
onPressedChange: t15,
|
|
142
|
-
variant: "outline"
|
|
143
|
-
});
|
|
144
|
-
$[23] = t13;
|
|
145
|
-
$[24] = t14;
|
|
146
|
-
$[25] = t15;
|
|
147
|
-
$[26] = t16;
|
|
148
|
-
} else t16 = $[26];
|
|
149
|
-
let t17;
|
|
150
|
-
if ($[27] === Symbol.for("react.memo_cache_sentinel")) {
|
|
151
|
-
t17 = /* @__PURE__ */ jsx(Tablet, {});
|
|
152
|
-
$[27] = t17;
|
|
153
|
-
} else t17 = $[27];
|
|
177
|
+
$[28] = viewportMode;
|
|
178
|
+
$[29] = t17;
|
|
179
|
+
} else t17 = $[29];
|
|
154
180
|
let t18;
|
|
155
|
-
if ($[
|
|
156
|
-
t18 = /* @__PURE__ */ jsx(
|
|
157
|
-
|
|
158
|
-
|
|
181
|
+
if ($[30] !== t15 || $[31] !== t16 || $[32] !== t17) {
|
|
182
|
+
t18 = /* @__PURE__ */ jsx(Toggle, {
|
|
183
|
+
"data-state": t15,
|
|
184
|
+
pressed: t16,
|
|
185
|
+
onPressedChange: t17,
|
|
186
|
+
variant: "outline"
|
|
159
187
|
});
|
|
160
|
-
$[
|
|
161
|
-
$[
|
|
162
|
-
|
|
188
|
+
$[30] = t15;
|
|
189
|
+
$[31] = t16;
|
|
190
|
+
$[32] = t17;
|
|
191
|
+
$[33] = t18;
|
|
192
|
+
} else t18 = $[33];
|
|
163
193
|
let t19;
|
|
164
|
-
if ($[
|
|
165
|
-
t19 = /* @__PURE__ */ jsx(
|
|
166
|
-
$[
|
|
167
|
-
} else t19 = $[
|
|
194
|
+
if ($[34] === Symbol.for("react.memo_cache_sentinel")) {
|
|
195
|
+
t19 = /* @__PURE__ */ jsx(Tablet, {});
|
|
196
|
+
$[34] = t19;
|
|
197
|
+
} else t19 = $[34];
|
|
168
198
|
let t20;
|
|
169
|
-
if ($[
|
|
170
|
-
t20 = /* @__PURE__ */
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
199
|
+
if ($[35] !== t18) {
|
|
200
|
+
t20 = /* @__PURE__ */ jsx(Tooltip$1.TooltipTrigger, {
|
|
201
|
+
render: t18,
|
|
202
|
+
children: t19
|
|
203
|
+
});
|
|
204
|
+
$[35] = t18;
|
|
205
|
+
$[36] = t20;
|
|
206
|
+
} else t20 = $[36];
|
|
207
|
+
let t21;
|
|
208
|
+
if ($[37] === Symbol.for("react.memo_cache_sentinel")) {
|
|
209
|
+
t21 = /* @__PURE__ */ jsx(Tooltip$1.TooltipContent, { children: "Tablet view" });
|
|
210
|
+
$[37] = t21;
|
|
211
|
+
} else t21 = $[37];
|
|
212
|
+
let t22;
|
|
213
|
+
if ($[38] !== t20) {
|
|
214
|
+
t22 = /* @__PURE__ */ jsxs(Tooltip$1.Tooltip, { children: [t20, t21] });
|
|
215
|
+
$[38] = t20;
|
|
216
|
+
$[39] = t22;
|
|
217
|
+
} else t22 = $[39];
|
|
218
|
+
const t23 = viewportMode === "mobile" ? "on" : "off";
|
|
219
|
+
const t24 = viewportMode === "mobile";
|
|
220
|
+
let t25;
|
|
221
|
+
if ($[40] !== viewportMode) {
|
|
222
|
+
t25 = () => {
|
|
179
223
|
if (viewportMode === "mobile") return;
|
|
180
224
|
previewStore.send({
|
|
181
225
|
type: "setViewportMode",
|
|
182
226
|
mode: "mobile"
|
|
183
227
|
});
|
|
184
228
|
};
|
|
185
|
-
$[
|
|
186
|
-
$[
|
|
187
|
-
} else
|
|
188
|
-
let t24;
|
|
189
|
-
if ($[35] !== t21 || $[36] !== t22 || $[37] !== t23) {
|
|
190
|
-
t24 = /* @__PURE__ */ jsx(Toggle, {
|
|
191
|
-
"data-state": t21,
|
|
192
|
-
pressed: t22,
|
|
193
|
-
onPressedChange: t23,
|
|
194
|
-
variant: "outline"
|
|
195
|
-
});
|
|
196
|
-
$[35] = t21;
|
|
197
|
-
$[36] = t22;
|
|
198
|
-
$[37] = t23;
|
|
199
|
-
$[38] = t24;
|
|
200
|
-
} else t24 = $[38];
|
|
201
|
-
let t25;
|
|
202
|
-
if ($[39] === Symbol.for("react.memo_cache_sentinel")) {
|
|
203
|
-
t25 = /* @__PURE__ */ jsx(Smartphone, {});
|
|
204
|
-
$[39] = t25;
|
|
205
|
-
} else t25 = $[39];
|
|
229
|
+
$[40] = viewportMode;
|
|
230
|
+
$[41] = t25;
|
|
231
|
+
} else t25 = $[41];
|
|
206
232
|
let t26;
|
|
207
|
-
if ($[
|
|
208
|
-
t26 = /* @__PURE__ */ jsx(
|
|
209
|
-
|
|
210
|
-
|
|
233
|
+
if ($[42] !== t23 || $[43] !== t24 || $[44] !== t25) {
|
|
234
|
+
t26 = /* @__PURE__ */ jsx(Toggle, {
|
|
235
|
+
"data-state": t23,
|
|
236
|
+
pressed: t24,
|
|
237
|
+
onPressedChange: t25,
|
|
238
|
+
variant: "outline"
|
|
211
239
|
});
|
|
212
|
-
$[
|
|
213
|
-
$[
|
|
214
|
-
|
|
240
|
+
$[42] = t23;
|
|
241
|
+
$[43] = t24;
|
|
242
|
+
$[44] = t25;
|
|
243
|
+
$[45] = t26;
|
|
244
|
+
} else t26 = $[45];
|
|
215
245
|
let t27;
|
|
216
|
-
if ($[
|
|
217
|
-
t27 = /* @__PURE__ */ jsx(
|
|
218
|
-
$[
|
|
219
|
-
} else t27 = $[
|
|
246
|
+
if ($[46] === Symbol.for("react.memo_cache_sentinel")) {
|
|
247
|
+
t27 = /* @__PURE__ */ jsx(Smartphone, {});
|
|
248
|
+
$[46] = t27;
|
|
249
|
+
} else t27 = $[46];
|
|
220
250
|
let t28;
|
|
221
|
-
if ($[
|
|
222
|
-
t28 = /* @__PURE__ */
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
251
|
+
if ($[47] !== t26) {
|
|
252
|
+
t28 = /* @__PURE__ */ jsx(Tooltip$1.TooltipTrigger, {
|
|
253
|
+
render: t26,
|
|
254
|
+
children: t27
|
|
255
|
+
});
|
|
256
|
+
$[47] = t26;
|
|
257
|
+
$[48] = t28;
|
|
258
|
+
} else t28 = $[48];
|
|
226
259
|
let t29;
|
|
227
|
-
if ($[
|
|
228
|
-
t29 = /* @__PURE__ */
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
t28
|
|
232
|
-
] });
|
|
233
|
-
$[45] = t12;
|
|
234
|
-
$[46] = t20;
|
|
235
|
-
$[47] = t28;
|
|
236
|
-
$[48] = t29;
|
|
237
|
-
} else t29 = $[48];
|
|
260
|
+
if ($[49] === Symbol.for("react.memo_cache_sentinel")) {
|
|
261
|
+
t29 = /* @__PURE__ */ jsx(Tooltip$1.TooltipContent, { children: "Mobile view" });
|
|
262
|
+
$[49] = t29;
|
|
263
|
+
} else t29 = $[49];
|
|
238
264
|
let t30;
|
|
239
|
-
if ($[
|
|
240
|
-
t30 =
|
|
265
|
+
if ($[50] !== t28) {
|
|
266
|
+
t30 = /* @__PURE__ */ jsxs(Tooltip$1.Tooltip, { children: [t28, t29] });
|
|
267
|
+
$[50] = t28;
|
|
268
|
+
$[51] = t30;
|
|
269
|
+
} else t30 = $[51];
|
|
270
|
+
let t31;
|
|
271
|
+
if ($[52] !== t14 || $[53] !== t22 || $[54] !== t30) {
|
|
272
|
+
t31 = /* @__PURE__ */ jsxs(ButtonGroup, { children: [
|
|
273
|
+
t14,
|
|
274
|
+
t22,
|
|
275
|
+
t30
|
|
276
|
+
] });
|
|
277
|
+
$[52] = t14;
|
|
278
|
+
$[53] = t22;
|
|
279
|
+
$[54] = t30;
|
|
280
|
+
$[55] = t31;
|
|
281
|
+
} else t31 = $[55];
|
|
282
|
+
let t32;
|
|
283
|
+
if ($[56] !== hasLiveVersion || $[57] !== pageStatus) {
|
|
284
|
+
t32 = pageStatus && /* @__PURE__ */ jsx(Button, {
|
|
241
285
|
type: "button",
|
|
242
286
|
variant: "outline",
|
|
243
287
|
disabled: pageStatus === "published" || !hasLiveVersion,
|
|
244
|
-
onClick:
|
|
245
|
-
children: "View
|
|
288
|
+
onClick: _temp4,
|
|
289
|
+
children: "View live page"
|
|
246
290
|
});
|
|
247
|
-
$[
|
|
248
|
-
$[
|
|
249
|
-
$[
|
|
250
|
-
} else
|
|
251
|
-
let
|
|
252
|
-
if ($[
|
|
253
|
-
|
|
291
|
+
$[56] = hasLiveVersion;
|
|
292
|
+
$[57] = pageStatus;
|
|
293
|
+
$[58] = t32;
|
|
294
|
+
} else t32 = $[58];
|
|
295
|
+
let t33;
|
|
296
|
+
if ($[59] !== isEditMode) {
|
|
297
|
+
t33 = /* @__PURE__ */ jsx(Button, {
|
|
254
298
|
type: "button",
|
|
255
299
|
variant: "ghost",
|
|
256
300
|
size: "icon",
|
|
257
301
|
disabled: isEditMode,
|
|
258
|
-
onClick:
|
|
302
|
+
onClick: _temp5,
|
|
259
303
|
"aria-label": "Hide toolbar",
|
|
260
304
|
className: "text-muted-foreground"
|
|
261
305
|
});
|
|
262
|
-
$[
|
|
263
|
-
$[
|
|
264
|
-
} else
|
|
265
|
-
let t32;
|
|
266
|
-
if ($[54] === Symbol.for("react.memo_cache_sentinel")) {
|
|
267
|
-
t32 = /* @__PURE__ */ jsx(X, {});
|
|
268
|
-
$[54] = t32;
|
|
269
|
-
} else t32 = $[54];
|
|
270
|
-
let t33;
|
|
271
|
-
if ($[55] !== t31) {
|
|
272
|
-
t33 = /* @__PURE__ */ jsx(Tooltip$1.TooltipTrigger, {
|
|
273
|
-
render: t31,
|
|
274
|
-
children: t32
|
|
275
|
-
});
|
|
276
|
-
$[55] = t31;
|
|
277
|
-
$[56] = t33;
|
|
278
|
-
} else t33 = $[56];
|
|
306
|
+
$[59] = isEditMode;
|
|
307
|
+
$[60] = t33;
|
|
308
|
+
} else t33 = $[60];
|
|
279
309
|
let t34;
|
|
280
|
-
if ($[
|
|
281
|
-
t34 = /* @__PURE__ */ jsx(
|
|
282
|
-
$[
|
|
283
|
-
} else t34 = $[
|
|
310
|
+
if ($[61] === Symbol.for("react.memo_cache_sentinel")) {
|
|
311
|
+
t34 = /* @__PURE__ */ jsx(X, {});
|
|
312
|
+
$[61] = t34;
|
|
313
|
+
} else t34 = $[61];
|
|
284
314
|
let t35;
|
|
285
|
-
if ($[
|
|
286
|
-
t35 = /* @__PURE__ */
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
315
|
+
if ($[62] !== t33) {
|
|
316
|
+
t35 = /* @__PURE__ */ jsx(Tooltip$1.TooltipTrigger, {
|
|
317
|
+
render: t33,
|
|
318
|
+
children: t34
|
|
319
|
+
});
|
|
320
|
+
$[62] = t33;
|
|
321
|
+
$[63] = t35;
|
|
322
|
+
} else t35 = $[63];
|
|
290
323
|
let t36;
|
|
291
|
-
if ($[
|
|
292
|
-
t36 = /* @__PURE__ */
|
|
324
|
+
if ($[64] === Symbol.for("react.memo_cache_sentinel")) {
|
|
325
|
+
t36 = /* @__PURE__ */ jsx(Tooltip$1.TooltipContent, { children: "Hide toolbar" });
|
|
326
|
+
$[64] = t36;
|
|
327
|
+
} else t36 = $[64];
|
|
328
|
+
let t37;
|
|
329
|
+
if ($[65] !== t35) {
|
|
330
|
+
t37 = /* @__PURE__ */ jsxs(Tooltip$1.Tooltip, { children: [t35, t36] });
|
|
331
|
+
$[65] = t35;
|
|
332
|
+
$[66] = t37;
|
|
333
|
+
} else t37 = $[66];
|
|
334
|
+
let t38;
|
|
335
|
+
if ($[67] !== t32 || $[68] !== t37) {
|
|
336
|
+
t38 = /* @__PURE__ */ jsxs("div", {
|
|
293
337
|
className: "flex items-center gap-2",
|
|
294
|
-
children: [
|
|
338
|
+
children: [t32, t37]
|
|
295
339
|
});
|
|
296
|
-
$[
|
|
297
|
-
$[
|
|
298
|
-
$[
|
|
299
|
-
} else
|
|
300
|
-
let
|
|
301
|
-
if ($[
|
|
302
|
-
|
|
303
|
-
className: "flex shrink-0 items-center gap-
|
|
304
|
-
children: [
|
|
340
|
+
$[67] = t32;
|
|
341
|
+
$[68] = t37;
|
|
342
|
+
$[69] = t38;
|
|
343
|
+
} else t38 = $[69];
|
|
344
|
+
let t39;
|
|
345
|
+
if ($[70] !== t31 || $[71] !== t38 || $[72] !== t6) {
|
|
346
|
+
t39 = /* @__PURE__ */ jsxs("div", {
|
|
347
|
+
className: "flex shrink-0 items-center gap-6 self-stretch",
|
|
348
|
+
children: [
|
|
349
|
+
t6,
|
|
350
|
+
t31,
|
|
351
|
+
t38
|
|
352
|
+
]
|
|
305
353
|
});
|
|
306
|
-
$[
|
|
307
|
-
$[
|
|
308
|
-
$[
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
354
|
+
$[70] = t31;
|
|
355
|
+
$[71] = t38;
|
|
356
|
+
$[72] = t6;
|
|
357
|
+
$[73] = t39;
|
|
358
|
+
} else t39 = $[73];
|
|
359
|
+
let t40;
|
|
360
|
+
if ($[74] !== t39 || $[75] !== t5) {
|
|
361
|
+
t40 = /* @__PURE__ */ jsxs(FloatingToolbar, {
|
|
362
|
+
className: "bottom-2 w-max justify-between gap-6 transition-none",
|
|
363
|
+
children: [t5, t39]
|
|
315
364
|
});
|
|
316
|
-
$[
|
|
317
|
-
$[
|
|
318
|
-
$[
|
|
319
|
-
} else
|
|
320
|
-
return
|
|
365
|
+
$[74] = t39;
|
|
366
|
+
$[75] = t5;
|
|
367
|
+
$[76] = t40;
|
|
368
|
+
} else t40 = $[76];
|
|
369
|
+
return t40;
|
|
321
370
|
};
|
|
322
371
|
function _temp(state) {
|
|
323
|
-
return state.context.
|
|
372
|
+
return state.context.isToolbarHidden;
|
|
324
373
|
}
|
|
325
374
|
function _temp2(state_0) {
|
|
326
|
-
return state_0.context.
|
|
375
|
+
return state_0.context.peekedBlock;
|
|
327
376
|
}
|
|
328
377
|
function _temp3(state_1) {
|
|
329
|
-
return state_1.context.
|
|
378
|
+
return state_1.context.viewportMode;
|
|
330
379
|
}
|
|
331
|
-
function _temp4(
|
|
332
|
-
return state_2.context.viewportMode;
|
|
333
|
-
}
|
|
334
|
-
function _temp5() {
|
|
380
|
+
function _temp4() {
|
|
335
381
|
return previewStore.send({ type: "viewLivePage" });
|
|
336
382
|
}
|
|
337
|
-
function
|
|
383
|
+
function _temp5() {
|
|
338
384
|
return previewStore.send({ type: "hideToolbar" });
|
|
339
385
|
}
|
|
340
386
|
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { useFrame } from "./Frame.js";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region src/features/preview/components/PreviewToolbarSpacer.tsx
|
|
6
|
+
/** Reserve scroll space without painting the site's document background over it. */
|
|
7
|
+
function PreviewToolbarSpacer() {
|
|
8
|
+
const { window: frameWindow, iframeElement } = useFrame();
|
|
9
|
+
const spacerRef = React.useRef(null);
|
|
10
|
+
React.useLayoutEffect(() => {
|
|
11
|
+
const spacer = spacerRef.current;
|
|
12
|
+
if (!frameWindow || !iframeElement || !spacer) return;
|
|
13
|
+
const previousClipPath = iframeElement.style.clipPath;
|
|
14
|
+
const updateClip = () => {
|
|
15
|
+
const { top, height } = spacer.getBoundingClientRect();
|
|
16
|
+
const visibleHeight = Math.max(0, Math.min(height, frameWindow.innerHeight - top));
|
|
17
|
+
iframeElement.style.clipPath = `inset(0 0 ${visibleHeight}px 0)`;
|
|
18
|
+
};
|
|
19
|
+
const observer = new ResizeObserver(updateClip);
|
|
20
|
+
observer.observe(frameWindow.document.documentElement);
|
|
21
|
+
observer.observe(spacer.parentElement);
|
|
22
|
+
frameWindow.addEventListener("scroll", updateClip);
|
|
23
|
+
frameWindow.addEventListener("resize", updateClip);
|
|
24
|
+
updateClip();
|
|
25
|
+
return () => {
|
|
26
|
+
observer.disconnect();
|
|
27
|
+
frameWindow.removeEventListener("scroll", updateClip);
|
|
28
|
+
frameWindow.removeEventListener("resize", updateClip);
|
|
29
|
+
iframeElement.style.clipPath = previousClipPath;
|
|
30
|
+
};
|
|
31
|
+
}, [frameWindow, iframeElement]);
|
|
32
|
+
return /* @__PURE__ */ jsx("div", {
|
|
33
|
+
ref: spacerRef,
|
|
34
|
+
"aria-hidden": true,
|
|
35
|
+
style: {
|
|
36
|
+
height: 80,
|
|
37
|
+
flexShrink: 0
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
//#endregion
|
|
43
|
+
export { PreviewToolbarSpacer };
|