camox 0.40.0 → 0.41.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/PlatformLabel.js +62 -0
- package/dist/core/components/lexical/GradientNode.js +126 -0
- package/dist/core/components/lexical/InlineLexicalEditor.js +37 -56
- package/dist/core/components/lexical/InlineStylesPlugin.js +183 -0
- package/dist/core/components/lexical/SelectionBroadcaster.js +49 -46
- package/dist/core/components/lexical/SidebarLexicalEditor.js +197 -151
- package/dist/core/components/lexical/editorConfig.js +25 -7
- package/dist/core/components/lexical/selectTextLink.js +21 -0
- package/dist/core/createApp.d.ts +30 -17
- package/dist/core/createApp.js +14 -3
- package/dist/core/createBlock.d.ts +2 -2
- package/dist/core/createBlock.js +18 -15
- package/dist/core/createLayout.d.ts +48 -4
- package/dist/core/createLayout.js +51 -23
- package/dist/core/derivedRoutes.js +36 -0
- package/dist/core/editing/createEditableBlock.d.ts +9 -8
- package/dist/core/editing/createEditableBlock.js +167 -168
- package/dist/core/lib/lexicalReact.d.ts +1 -26
- package/dist/core/lib/lexicalReact.js +46 -60
- package/dist/core/lib/lexicalState.js +164 -81
- package/dist/core/lib/modifierFormats.js +4 -15
- package/dist/core/lib/textStyles.d.ts +27 -0
- package/dist/core/lib/textStyles.js +47 -0
- package/dist/features/navigation/navigation.d.ts +2 -0
- package/dist/features/navigation/navigation.js +51 -46
- package/dist/features/page/DerivedPageContent.js +61 -0
- package/dist/features/page/PublishedPageContent.js +52 -83
- package/dist/features/page/SharedLayoutContent.js +66 -0
- package/dist/features/preview/CamoxPreview.d.ts +16 -1
- package/dist/features/preview/CamoxPreview.js +242 -265
- package/dist/features/preview/DerivedPreview.js +137 -0
- package/dist/features/preview/EditablePageExperience.js +25 -8
- package/dist/features/preview/components/AddBlockSidebar.js +43 -33
- package/dist/features/preview/components/AssetLightbox.js +1 -1
- package/dist/features/preview/components/BlockThumbnail.js +192 -0
- package/dist/features/preview/components/CreatePageModal.js +123 -115
- package/dist/features/preview/components/DerivedLayoutDialog.js +100 -0
- package/dist/features/preview/components/DerivedLayoutSidebar.d.ts +5 -0
- package/dist/features/preview/components/DerivedLayoutSidebar.js +163 -0
- package/dist/features/preview/components/DerivedPageInfoSidebar.js +57 -0
- package/dist/features/preview/components/FieldToolbar.js +42 -20
- package/dist/features/preview/components/Frame.js +133 -140
- package/dist/features/preview/components/LeftSidebar.js +42 -38
- package/dist/features/preview/components/MobilePreviewDrawer.js +4 -4
- package/dist/features/preview/components/Overlays.js +57 -42
- package/dist/features/preview/components/PageInfoSidebar.js +63 -55
- package/dist/features/preview/components/PageNavigatorSidebar.js +34 -483
- package/dist/features/preview/components/PagePicker.js +205 -153
- package/dist/features/preview/components/PageTree.js +298 -206
- package/dist/features/preview/components/PreviewActivation.js +78 -0
- package/dist/features/preview/components/PreviewPanel.js +67 -35
- package/dist/features/preview/components/PreviewToolbar.js +218 -232
- package/dist/features/preview/components/PublicationRow.js +431 -0
- package/dist/features/preview/components/PublishDialog.js +180 -97
- package/dist/features/preview/components/RightSidebar.js +19 -34
- package/dist/features/preview/components/previewStyles.js +8 -0
- package/dist/features/preview/components/useUpdateBlockPosition.js +7 -13
- package/dist/features/preview/previewConstants.js +8 -0
- package/dist/features/preview/previewStore.js +0 -10
- package/dist/features/preview/publication.js +71 -0
- package/dist/features/provider/AuthenticatedCamoxProvider.js +2 -1
- package/dist/features/provider/CoreCamoxProvider.js +11 -2
- package/dist/features/provider/LocalhostPreviewProvider.js +6 -7
- package/dist/features/routes/pageRuntime.d.ts +10 -0
- package/dist/features/routes/pageRuntime.js +7 -9
- package/dist/features/runtime/PreviewDocumentContext.js +7 -0
- package/dist/features/runtime/RuntimeChrome.js +137 -0
- package/dist/features/runtime/SharedChromeContext.js +7 -0
- package/dist/features/runtime/navigationRequest.js +21 -0
- package/dist/features/runtime/navigationTarget.js +23 -0
- package/dist/features/runtime/pageApp.js +196 -121
- package/dist/features/runtime/pageNavigation.js +79 -130
- package/dist/features/runtime/runtime.d.ts +11 -0
- package/dist/features/runtime/runtime.js +183 -47
- package/dist/features/runtime/studioApp.d.ts +2 -11
- package/dist/features/runtime/studioApp.js +14 -177
- package/dist/features/studio/CamoxStudio.js +27 -13
- package/dist/features/studio/components/Navbar.js +80 -74
- package/dist/features/studio/studioTheme.js +25 -0
- package/dist/features/studio/useTheme.js +94 -109
- package/dist/features/vite/appGeneration.js +12 -3
- package/dist/features/vite/definitionsSync.js +4 -2
- package/dist/features/vite/layoutGeneration.js +38 -0
- package/dist/features/vite/runtimeDev.js +3 -1
- package/dist/lib/auth.js +15 -13
- package/dist/lib/normalized-data.js +4 -4
- package/dist/lib/platform.js +13 -0
- package/dist/lib/utils.js +90 -38
- package/dist/studio-overlays.css +5 -40
- package/dist/studio.css +1 -1
- package/package.json +8 -4
- package/skills/camox/SKILL.md +2 -0
- package/skills/camox/references/block-definitions.md +31 -12
- package/skills/camox/references/layout-definitions.md +2 -0
- package/dist/core/lib/modifiers.js +0 -24
- package/dist/features/preview/previewQueryFns.js +0 -23
- package/dist/features/runtime/studioNavigation.js +0 -120
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { FORMAT_FLAGS } from "../../lib/modifierFormats.js";
|
|
1
2
|
import { isOverlayMessage, postOverlayMessage } from "../../../features/preview/overlayMessages.js";
|
|
2
|
-
import {
|
|
3
|
+
import { $selectionHasGradient, $toggleGradient } from "./GradientNode.js";
|
|
4
|
+
import { selectTextLink } from "./selectTextLink.js";
|
|
3
5
|
import { c } from "react/compiler-runtime";
|
|
4
6
|
import * as React from "react";
|
|
5
7
|
import { $createLinkNode, TOGGLE_LINK_COMMAND } from "@lexical/link";
|
|
@@ -21,10 +23,10 @@ function getLinkTargetFromSelection() {
|
|
|
21
23
|
return null;
|
|
22
24
|
}
|
|
23
25
|
function SelectionBroadcaster(t0) {
|
|
24
|
-
const $ = c(
|
|
25
|
-
if ($[0] !== "
|
|
26
|
-
for (let $i = 0; $i <
|
|
27
|
-
$[0] = "
|
|
26
|
+
const $ = c(20);
|
|
27
|
+
if ($[0] !== "9b38f39cf15304b288c351ba69b5c7891a3521400640cd47c3395c47e67ae59c") {
|
|
28
|
+
for (let $i = 0; $i < 20; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
29
|
+
$[0] = "9b38f39cf15304b288c351ba69b5c7891a3521400640cd47c3395c47e67ae59c";
|
|
28
30
|
}
|
|
29
31
|
const { targetWindow } = t0;
|
|
30
32
|
const [editor] = useLexicalComposerContext();
|
|
@@ -49,10 +51,12 @@ function SelectionBroadcaster(t0) {
|
|
|
49
51
|
const selection = $getSelection();
|
|
50
52
|
if (!$isRangeSelection(selection)) return;
|
|
51
53
|
lastTextSelectionRef.current = selection.clone();
|
|
52
|
-
for (const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
for (const key of [
|
|
55
|
+
"bold",
|
|
56
|
+
"italic",
|
|
57
|
+
"underline"
|
|
58
|
+
]) if (selection.hasFormat(key)) format = format | FORMAT_FLAGS[key];
|
|
59
|
+
if ($selectionHasGradient()) format = format | FORMAT_FLAGS.gradient;
|
|
56
60
|
linkTarget = getLinkTargetFromSelection();
|
|
57
61
|
});
|
|
58
62
|
postOverlayMessage({
|
|
@@ -88,8 +92,7 @@ function SelectionBroadcaster(t0) {
|
|
|
88
92
|
}
|
|
89
93
|
React.useEffect(t2, t3);
|
|
90
94
|
let t4;
|
|
91
|
-
|
|
92
|
-
if ($[8] !== broadcastSelection || $[9] !== editor || $[10] !== targetWindow) {
|
|
95
|
+
if ($[8] !== broadcastSelection || $[9] !== editor) {
|
|
93
96
|
t4 = () => editor.registerRootListener((root) => {
|
|
94
97
|
if (!root) return;
|
|
95
98
|
const handleLinkClick = (event) => {
|
|
@@ -97,44 +100,42 @@ function SelectionBroadcaster(t0) {
|
|
|
97
100
|
if (!(target instanceof HTMLElement)) return;
|
|
98
101
|
const anchor = target.closest("a");
|
|
99
102
|
if (!anchor || !root.contains(anchor)) return;
|
|
100
|
-
|
|
101
|
-
if (!href) return;
|
|
103
|
+
if (!(anchor.dataset.camoxLinkTarget ?? anchor.getAttribute("href"))) return;
|
|
102
104
|
event.preventDefault();
|
|
103
105
|
event.stopPropagation();
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
selection_0?.removeAllRanges();
|
|
108
|
-
selection_0?.addRange(range);
|
|
109
|
-
root.focus();
|
|
106
|
+
const link = selectTextLink(editor, anchor);
|
|
107
|
+
if (!link) return;
|
|
108
|
+
lastTextSelectionRef.current = link.selection;
|
|
110
109
|
broadcastSelection();
|
|
111
110
|
postOverlayMessage({
|
|
112
111
|
type: "CAMOX_OPEN_TEXT_LINK_POPOVER",
|
|
113
|
-
target:
|
|
114
|
-
text:
|
|
112
|
+
target: link.target,
|
|
113
|
+
text: link.text
|
|
115
114
|
});
|
|
116
115
|
};
|
|
117
116
|
root.addEventListener("click", handleLinkClick);
|
|
118
117
|
return () => root.removeEventListener("click", handleLinkClick);
|
|
119
118
|
});
|
|
119
|
+
$[8] = broadcastSelection;
|
|
120
|
+
$[9] = editor;
|
|
121
|
+
$[10] = t4;
|
|
122
|
+
} else t4 = $[10];
|
|
123
|
+
let t5;
|
|
124
|
+
if ($[11] !== broadcastSelection || $[12] !== editor || $[13] !== targetWindow) {
|
|
120
125
|
t5 = [
|
|
121
126
|
editor,
|
|
122
127
|
targetWindow,
|
|
123
128
|
broadcastSelection
|
|
124
129
|
];
|
|
125
|
-
$[
|
|
126
|
-
$[
|
|
127
|
-
$[
|
|
128
|
-
$[
|
|
129
|
-
|
|
130
|
-
} else {
|
|
131
|
-
t4 = $[11];
|
|
132
|
-
t5 = $[12];
|
|
133
|
-
}
|
|
130
|
+
$[11] = broadcastSelection;
|
|
131
|
+
$[12] = editor;
|
|
132
|
+
$[13] = targetWindow;
|
|
133
|
+
$[14] = t5;
|
|
134
|
+
} else t5 = $[14];
|
|
134
135
|
React.useEffect(t4, t5);
|
|
135
136
|
let t6;
|
|
136
137
|
let t7;
|
|
137
|
-
if ($[
|
|
138
|
+
if ($[15] !== broadcastSelection || $[16] !== editor || $[17] !== targetWindow) {
|
|
138
139
|
t6 = () => {
|
|
139
140
|
const handleMessage = (event_0) => {
|
|
140
141
|
const data = event_0.data;
|
|
@@ -145,23 +146,25 @@ function SelectionBroadcaster(t0) {
|
|
|
145
146
|
if (!root_0.contains(nativeSelection_0.anchorNode)) return;
|
|
146
147
|
root_0.focus();
|
|
147
148
|
editor.update(() => {
|
|
148
|
-
const
|
|
149
|
-
if ($isRangeSelection(
|
|
150
|
-
lastTextSelectionRef.current =
|
|
149
|
+
const selection_0 = $getSelection();
|
|
150
|
+
if ($isRangeSelection(selection_0) && !selection_0.isCollapsed()) {
|
|
151
|
+
lastTextSelectionRef.current = selection_0.clone();
|
|
151
152
|
return;
|
|
152
153
|
}
|
|
153
154
|
if (lastTextSelectionRef.current) $setSelection(lastTextSelectionRef.current.clone());
|
|
154
155
|
});
|
|
155
|
-
if (data.type === "CAMOX_FORMAT_TEXT")
|
|
156
|
-
|
|
156
|
+
if (data.type === "CAMOX_FORMAT_TEXT") {
|
|
157
|
+
if (data.formatKey === "gradient") editor.update($toggleGradient);
|
|
158
|
+
else if (data.formatKey === "bold" || data.formatKey === "italic" || data.formatKey === "underline") editor.dispatchCommand(FORMAT_TEXT_COMMAND, data.formatKey);
|
|
159
|
+
} else if (data.target === null) editor.dispatchCommand(TOGGLE_LINK_COMMAND, null);
|
|
157
160
|
else if (typeof data.text === "string") {
|
|
158
161
|
const target_0 = data.target;
|
|
159
162
|
editor.update(() => {
|
|
160
|
-
const
|
|
161
|
-
if (!$isRangeSelection(
|
|
163
|
+
const selection_1 = $getSelection();
|
|
164
|
+
if (!$isRangeSelection(selection_1)) return;
|
|
162
165
|
const linkNode = $createLinkNode(target_0);
|
|
163
166
|
linkNode.append($createTextNode(data.text));
|
|
164
|
-
|
|
167
|
+
selection_1.insertNodes([linkNode]);
|
|
165
168
|
});
|
|
166
169
|
} else editor.dispatchCommand(TOGGLE_LINK_COMMAND, data.target);
|
|
167
170
|
setTimeout(broadcastSelection, 10);
|
|
@@ -174,14 +177,14 @@ function SelectionBroadcaster(t0) {
|
|
|
174
177
|
targetWindow,
|
|
175
178
|
broadcastSelection
|
|
176
179
|
];
|
|
177
|
-
$[
|
|
178
|
-
$[
|
|
179
|
-
$[
|
|
180
|
-
$[
|
|
181
|
-
$[
|
|
180
|
+
$[15] = broadcastSelection;
|
|
181
|
+
$[16] = editor;
|
|
182
|
+
$[17] = targetWindow;
|
|
183
|
+
$[18] = t6;
|
|
184
|
+
$[19] = t7;
|
|
182
185
|
} else {
|
|
183
|
-
t6 = $[
|
|
184
|
-
t7 = $[
|
|
186
|
+
t6 = $[18];
|
|
187
|
+
t7 = $[19];
|
|
185
188
|
}
|
|
186
189
|
React.useEffect(t6, t7);
|
|
187
190
|
return null;
|