camox 0.42.0 → 0.43.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/{GradientNode.js → HighlightNode.js} +34 -34
- package/dist/core/components/lexical/InlineLexicalEditor.js +14 -14
- package/dist/core/components/lexical/InlineStylesPlugin.js +6 -6
- package/dist/core/components/lexical/SelectionBroadcaster.js +5 -5
- package/dist/core/components/lexical/SidebarLexicalEditor.js +20 -20
- package/dist/core/components/lexical/TextLinkPopover.js +191 -208
- package/dist/core/components/lexical/editorConfig.js +2 -2
- package/dist/core/createApp.d.ts +3 -2
- package/dist/core/createApp.js +2 -1
- package/dist/core/createLayout.d.ts +16 -3
- package/dist/core/createLayout.js +15 -15
- package/dist/core/derivedRoutes.js +1 -1
- package/dist/core/dom.d.ts +17 -0
- package/dist/core/dom.js +22 -0
- package/dist/core/lib/lexicalReact.js +4 -4
- package/dist/core/lib/lexicalState.js +3 -3
- package/dist/core/lib/modifierFormats.js +1 -1
- package/dist/core/lib/textLinks.js +5 -2
- package/dist/core/lib/textStyles.d.ts +2 -2
- package/dist/core/lib/textStyles.js +6 -11
- package/dist/core/pageDestinations.js +37 -0
- package/dist/features/og/imageResponse.node.js +11 -9
- package/dist/features/preview/CamoxPreview.js +42 -65
- package/dist/features/preview/components/AddBlockSidebar.js +1 -1
- package/dist/features/preview/components/BlockActionsPopover.js +1 -1
- package/dist/features/preview/components/CreatePageModal.js +4 -4
- package/dist/features/preview/components/DerivedLayoutSidebar.js +45 -26
- package/dist/features/preview/components/DerivedPageInfoSidebar.js +38 -26
- package/dist/features/preview/components/FieldToolbar.js +7 -7
- package/dist/features/preview/components/LinkFieldEditor.js +212 -209
- package/dist/features/preview/components/PageEditorSidebar.js +1 -1
- package/dist/features/preview/components/PageInfoSidebar.js +28 -28
- package/dist/features/preview/components/PagePicker.js +16 -16
- package/dist/features/preview/components/PageTree.js +1 -1
- package/dist/features/preview/components/PublicationRow.js +8 -4
- package/dist/features/preview/components/useRepeatableItemActions.js +1 -1
- package/dist/features/preview/publication.js +10 -0
- package/dist/features/provider/CoreCamoxProvider.js +1 -1
- package/dist/features/runtime/runtime.js +20 -21
- package/dist/features/studio/components/EnvironmentMenu.js +3 -2
- package/dist/features/studio/components/Navbar.js +53 -80
- package/dist/features/vite/layoutGeneration.js +7 -3
- package/dist/features/vite/vite.js +5 -1
- package/dist/hooks/use-page-destinations.js +53 -0
- package/dist/lib/auth.js +11 -14
- package/dist/lib/server-auth-cookie.js +21 -0
- package/dist/studio.css +1 -1
- package/package.json +8 -4
- package/skills/camox/SKILL.md +32 -9
- package/skills/camox/references/block-definitions.md +84 -290
- package/skills/camox/references/cli-common.md +2 -4
- package/skills/camox/references/cli-content.md +147 -0
- package/skills/camox/references/cli-environments.md +1 -1
- package/skills/camox/references/dom-integrations.md +93 -0
- package/skills/camox/references/field-styling.md +50 -0
- package/skills/camox/references/layout-definitions.md +33 -147
- package/skills/camox/references/routed-layouts.md +71 -0
- package/skills/camoxify/SKILL.md +52 -0
- package/skills/camox/references/cli-blocks.md +0 -78
- package/skills/camox/references/cli-pages.md +0 -53
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { getPageIdFromTextLinkTarget, isValidTextLinkTarget } from "../../lib/textLinks.js";
|
|
2
|
+
import { destinationTextLink } from "../../pageDestinations.js";
|
|
3
|
+
import { usePageDestinations } from "../../../hooks/use-page-destinations.js";
|
|
4
4
|
import { c } from "react/compiler-runtime";
|
|
5
|
-
import { useQuery } from "@tanstack/react-query";
|
|
6
5
|
import * as React from "react";
|
|
7
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
7
|
import { Button } from "@camox/ui/button";
|
|
@@ -14,50 +13,32 @@ import { Tabs, TabsList, TabsTrigger } from "@camox/ui/tabs";
|
|
|
14
13
|
|
|
15
14
|
//#region src/core/components/lexical/TextLinkPopover.tsx
|
|
16
15
|
function TextLinkPopover(t0) {
|
|
17
|
-
const $ = c(
|
|
18
|
-
if ($[0] !== "
|
|
19
|
-
for (let $i = 0; $i <
|
|
20
|
-
$[0] = "
|
|
16
|
+
const $ = c(64);
|
|
17
|
+
if ($[0] !== "88824dfd1c731cbf3353050e8cf8a5de209861b0dd4f32c3d21d9b49cba42e9b") {
|
|
18
|
+
for (let $i = 0; $i < 64; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
19
|
+
$[0] = "88824dfd1c731cbf3353050e8cf8a5de209861b0dd4f32c3d21d9b49cba42e9b";
|
|
21
20
|
}
|
|
22
21
|
const { open, onOpenChange, trigger, text, target, onSave, onUnlink } = t0;
|
|
23
22
|
const [textValue, setTextValue] = React.useState(text);
|
|
24
23
|
const [mode, setMode] = React.useState("page");
|
|
25
24
|
const [pageValue, setPageValue] = React.useState("");
|
|
26
25
|
const [urlValue, setUrlValue] = React.useState("");
|
|
27
|
-
const
|
|
26
|
+
const pages = usePageDestinations();
|
|
28
27
|
let t1;
|
|
29
|
-
if ($[1] !==
|
|
30
|
-
t1 =
|
|
31
|
-
$[1] =
|
|
32
|
-
$[2] =
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
if ($[1] !== pages || $[2] !== target) {
|
|
29
|
+
t1 = target != null && (getPageIdFromTextLinkTarget(target) != null || pages.some((page) => destinationTextLink(page) === target));
|
|
30
|
+
$[1] = pages;
|
|
31
|
+
$[2] = target;
|
|
32
|
+
$[3] = t1;
|
|
33
|
+
} else t1 = $[3];
|
|
34
|
+
const isPageTarget = t1;
|
|
35
35
|
let t2;
|
|
36
|
-
if ($[
|
|
37
|
-
t2 =
|
|
38
|
-
$[3] = project?.id;
|
|
39
|
-
$[4] = t2;
|
|
40
|
-
} else t2 = $[4];
|
|
41
|
-
const t3 = !!project;
|
|
42
|
-
let t4;
|
|
43
|
-
if ($[5] !== t2 || $[6] !== t3) {
|
|
44
|
-
t4 = {
|
|
45
|
-
...t2,
|
|
46
|
-
enabled: t3
|
|
47
|
-
};
|
|
48
|
-
$[5] = t2;
|
|
49
|
-
$[6] = t3;
|
|
50
|
-
$[7] = t4;
|
|
51
|
-
} else t4 = $[7];
|
|
52
|
-
const { data: pages } = useQuery(t4);
|
|
53
|
-
let t5;
|
|
54
|
-
if ($[8] !== target || $[9] !== text) {
|
|
55
|
-
t5 = () => {
|
|
36
|
+
if ($[4] !== isPageTarget || $[5] !== target || $[6] !== text) {
|
|
37
|
+
t2 = () => {
|
|
56
38
|
setTextValue(text);
|
|
57
|
-
|
|
58
|
-
if (pageId != null) {
|
|
39
|
+
if (target && isPageTarget) {
|
|
59
40
|
setMode("page");
|
|
60
|
-
setPageValue(
|
|
41
|
+
setPageValue(target);
|
|
61
42
|
setUrlValue("");
|
|
62
43
|
return;
|
|
63
44
|
}
|
|
@@ -65,116 +46,117 @@ function TextLinkPopover(t0) {
|
|
|
65
46
|
setUrlValue(target ?? "");
|
|
66
47
|
setPageValue("");
|
|
67
48
|
};
|
|
68
|
-
$[
|
|
69
|
-
$[
|
|
70
|
-
$[
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
let
|
|
75
|
-
|
|
76
|
-
|
|
49
|
+
$[4] = isPageTarget;
|
|
50
|
+
$[5] = target;
|
|
51
|
+
$[6] = text;
|
|
52
|
+
$[7] = t2;
|
|
53
|
+
} else t2 = $[7];
|
|
54
|
+
const prepare = t2;
|
|
55
|
+
let t3;
|
|
56
|
+
let t4;
|
|
57
|
+
if ($[8] !== open || $[9] !== prepare) {
|
|
58
|
+
t3 = () => {
|
|
77
59
|
if (!open) return;
|
|
78
60
|
prepare();
|
|
79
61
|
};
|
|
80
|
-
|
|
81
|
-
$[
|
|
82
|
-
$[
|
|
83
|
-
$[
|
|
84
|
-
$[
|
|
62
|
+
t4 = [open, prepare];
|
|
63
|
+
$[8] = open;
|
|
64
|
+
$[9] = prepare;
|
|
65
|
+
$[10] = t3;
|
|
66
|
+
$[11] = t4;
|
|
85
67
|
} else {
|
|
86
|
-
|
|
87
|
-
|
|
68
|
+
t3 = $[10];
|
|
69
|
+
t4 = $[11];
|
|
88
70
|
}
|
|
89
|
-
React.useEffect(
|
|
90
|
-
let
|
|
91
|
-
if ($[
|
|
92
|
-
|
|
71
|
+
React.useEffect(t3, t4);
|
|
72
|
+
let t5;
|
|
73
|
+
if ($[12] !== onOpenChange || $[13] !== prepare) {
|
|
74
|
+
t5 = (nextOpen) => {
|
|
93
75
|
onOpenChange(nextOpen);
|
|
94
76
|
if (nextOpen) prepare();
|
|
95
77
|
};
|
|
96
|
-
$[
|
|
97
|
-
$[
|
|
98
|
-
$[
|
|
99
|
-
} else
|
|
100
|
-
const handleOpenChange =
|
|
101
|
-
let
|
|
102
|
-
if ($[
|
|
103
|
-
|
|
78
|
+
$[12] = onOpenChange;
|
|
79
|
+
$[13] = prepare;
|
|
80
|
+
$[14] = t5;
|
|
81
|
+
} else t5 = $[14];
|
|
82
|
+
const handleOpenChange = t5;
|
|
83
|
+
let t6;
|
|
84
|
+
if ($[15] !== mode || $[16] !== onSave || $[17] !== pageValue || $[18] !== textValue || $[19] !== urlValue) {
|
|
85
|
+
t6 = (event) => {
|
|
104
86
|
event.preventDefault();
|
|
105
87
|
const nextText = textValue.trim();
|
|
106
88
|
if (!nextText) return;
|
|
107
89
|
if (mode === "page") {
|
|
108
90
|
if (!pageValue) return;
|
|
109
|
-
onSave(
|
|
91
|
+
onSave(pageValue, nextText);
|
|
110
92
|
return;
|
|
111
93
|
}
|
|
112
94
|
const nextTarget = urlValue.trim();
|
|
113
|
-
if (
|
|
95
|
+
if (!isValidTextLinkTarget(nextTarget)) return;
|
|
114
96
|
onSave(nextTarget, nextText);
|
|
115
97
|
};
|
|
116
|
-
$[
|
|
117
|
-
$[
|
|
118
|
-
$[
|
|
119
|
-
$[
|
|
120
|
-
$[
|
|
121
|
-
$[
|
|
122
|
-
} else
|
|
123
|
-
const handleSubmit =
|
|
124
|
-
let
|
|
125
|
-
if ($[
|
|
126
|
-
|
|
127
|
-
$[
|
|
128
|
-
} else
|
|
129
|
-
let
|
|
130
|
-
if ($[
|
|
131
|
-
|
|
98
|
+
$[15] = mode;
|
|
99
|
+
$[16] = onSave;
|
|
100
|
+
$[17] = pageValue;
|
|
101
|
+
$[18] = textValue;
|
|
102
|
+
$[19] = urlValue;
|
|
103
|
+
$[20] = t6;
|
|
104
|
+
} else t6 = $[20];
|
|
105
|
+
const handleSubmit = t6;
|
|
106
|
+
let t7;
|
|
107
|
+
if ($[21] === Symbol.for("react.memo_cache_sentinel")) {
|
|
108
|
+
t7 = /* @__PURE__ */ jsx(Link2, {});
|
|
109
|
+
$[21] = t7;
|
|
110
|
+
} else t7 = $[21];
|
|
111
|
+
let t8;
|
|
112
|
+
if ($[22] !== trigger) {
|
|
113
|
+
t8 = /* @__PURE__ */ jsx(PopoverTrigger, {
|
|
132
114
|
render: trigger,
|
|
133
|
-
children:
|
|
115
|
+
children: t7
|
|
134
116
|
});
|
|
135
|
-
$[
|
|
136
|
-
$[
|
|
137
|
-
} else
|
|
138
|
-
let
|
|
139
|
-
if ($[
|
|
140
|
-
|
|
117
|
+
$[22] = trigger;
|
|
118
|
+
$[23] = t8;
|
|
119
|
+
} else t8 = $[23];
|
|
120
|
+
let t9;
|
|
121
|
+
if ($[24] === Symbol.for("react.memo_cache_sentinel")) {
|
|
122
|
+
t9 = /* @__PURE__ */ jsx(Label, {
|
|
141
123
|
htmlFor: "text-link-text",
|
|
142
124
|
children: "Text"
|
|
143
125
|
});
|
|
144
|
-
$[
|
|
145
|
-
} else
|
|
146
|
-
let
|
|
147
|
-
if ($[
|
|
148
|
-
|
|
149
|
-
$[
|
|
150
|
-
} else
|
|
151
|
-
let
|
|
152
|
-
if ($[
|
|
153
|
-
|
|
126
|
+
$[24] = t9;
|
|
127
|
+
} else t9 = $[24];
|
|
128
|
+
let t10;
|
|
129
|
+
if ($[25] === Symbol.for("react.memo_cache_sentinel")) {
|
|
130
|
+
t10 = (event_0) => setTextValue(event_0.target.value);
|
|
131
|
+
$[25] = t10;
|
|
132
|
+
} else t10 = $[25];
|
|
133
|
+
let t11;
|
|
134
|
+
if ($[26] !== textValue) {
|
|
135
|
+
t11 = /* @__PURE__ */ jsxs("div", {
|
|
154
136
|
className: "grid gap-1.5",
|
|
155
|
-
children: [
|
|
137
|
+
children: [t9, /* @__PURE__ */ jsx(Input, {
|
|
156
138
|
id: "text-link-text",
|
|
157
139
|
value: textValue,
|
|
158
|
-
onChange:
|
|
140
|
+
onChange: t10,
|
|
159
141
|
autoFocus: true
|
|
160
142
|
})]
|
|
161
143
|
});
|
|
162
|
-
$[
|
|
163
|
-
$[
|
|
164
|
-
} else
|
|
165
|
-
let
|
|
166
|
-
if ($[
|
|
167
|
-
|
|
168
|
-
$[
|
|
169
|
-
} else
|
|
170
|
-
let
|
|
171
|
-
if ($[
|
|
172
|
-
|
|
173
|
-
$[
|
|
174
|
-
} else
|
|
175
|
-
let
|
|
176
|
-
if ($[
|
|
177
|
-
|
|
144
|
+
$[26] = textValue;
|
|
145
|
+
$[27] = t11;
|
|
146
|
+
} else t11 = $[27];
|
|
147
|
+
let t12;
|
|
148
|
+
if ($[28] === Symbol.for("react.memo_cache_sentinel")) {
|
|
149
|
+
t12 = /* @__PURE__ */ jsx(Label, { children: "Destination" });
|
|
150
|
+
$[28] = t12;
|
|
151
|
+
} else t12 = $[28];
|
|
152
|
+
let t13;
|
|
153
|
+
if ($[29] === Symbol.for("react.memo_cache_sentinel")) {
|
|
154
|
+
t13 = (nextMode) => setMode(nextMode);
|
|
155
|
+
$[29] = t13;
|
|
156
|
+
} else t13 = $[29];
|
|
157
|
+
let t14;
|
|
158
|
+
if ($[30] === Symbol.for("react.memo_cache_sentinel")) {
|
|
159
|
+
t14 = /* @__PURE__ */ jsxs(TabsList, {
|
|
178
160
|
className: "w-full",
|
|
179
161
|
children: [/* @__PURE__ */ jsx(TabsTrigger, {
|
|
180
162
|
value: "page",
|
|
@@ -184,21 +166,21 @@ function TextLinkPopover(t0) {
|
|
|
184
166
|
children: "URL"
|
|
185
167
|
})]
|
|
186
168
|
});
|
|
187
|
-
$[
|
|
188
|
-
} else
|
|
189
|
-
let
|
|
190
|
-
if ($[
|
|
191
|
-
|
|
169
|
+
$[30] = t14;
|
|
170
|
+
} else t14 = $[30];
|
|
171
|
+
let t15;
|
|
172
|
+
if ($[31] !== mode) {
|
|
173
|
+
t15 = /* @__PURE__ */ jsx(Tabs, {
|
|
192
174
|
value: mode,
|
|
193
|
-
onValueChange:
|
|
194
|
-
children:
|
|
175
|
+
onValueChange: t13,
|
|
176
|
+
children: t14
|
|
195
177
|
});
|
|
196
|
-
$[
|
|
197
|
-
$[
|
|
198
|
-
} else
|
|
199
|
-
let
|
|
200
|
-
if ($[
|
|
201
|
-
|
|
178
|
+
$[31] = mode;
|
|
179
|
+
$[32] = t15;
|
|
180
|
+
} else t15 = $[32];
|
|
181
|
+
let t16;
|
|
182
|
+
if ($[33] !== mode || $[34] !== pageValue || $[35] !== pages || $[36] !== urlValue) {
|
|
183
|
+
t16 = mode === "page" ? /* @__PURE__ */ jsxs("select", {
|
|
202
184
|
className: "border-input bg-background text-foreground h-9 rounded-md border px-2 text-sm",
|
|
203
185
|
value: pageValue,
|
|
204
186
|
onChange: (event_1) => setPageValue(event_1.target.value),
|
|
@@ -207,120 +189,121 @@ function TextLinkPopover(t0) {
|
|
|
207
189
|
children: pages && pages.length > 0 ? "Select a page" : "No pages found"
|
|
208
190
|
}), pages?.map(_temp)]
|
|
209
191
|
}) : /* @__PURE__ */ jsx(Input, {
|
|
210
|
-
type: "
|
|
211
|
-
|
|
192
|
+
type: "text",
|
|
193
|
+
inputMode: "url",
|
|
194
|
+
placeholder: "https:// or /path",
|
|
212
195
|
value: urlValue,
|
|
213
196
|
onChange: (event_2) => setUrlValue(event_2.target.value)
|
|
214
197
|
});
|
|
215
|
-
$[
|
|
216
|
-
$[
|
|
217
|
-
$[
|
|
218
|
-
$[
|
|
219
|
-
$[
|
|
220
|
-
} else
|
|
221
|
-
let
|
|
222
|
-
if ($[
|
|
223
|
-
|
|
198
|
+
$[33] = mode;
|
|
199
|
+
$[34] = pageValue;
|
|
200
|
+
$[35] = pages;
|
|
201
|
+
$[36] = urlValue;
|
|
202
|
+
$[37] = t16;
|
|
203
|
+
} else t16 = $[37];
|
|
204
|
+
let t17;
|
|
205
|
+
if ($[38] !== t15 || $[39] !== t16) {
|
|
206
|
+
t17 = /* @__PURE__ */ jsxs("div", {
|
|
224
207
|
className: "grid gap-1.5",
|
|
225
208
|
children: [
|
|
209
|
+
t12,
|
|
226
210
|
t15,
|
|
227
|
-
|
|
228
|
-
t19
|
|
211
|
+
t16
|
|
229
212
|
]
|
|
230
213
|
});
|
|
231
|
-
$[
|
|
232
|
-
$[
|
|
233
|
-
$[
|
|
234
|
-
} else
|
|
235
|
-
let
|
|
236
|
-
if ($[
|
|
237
|
-
|
|
238
|
-
$[
|
|
239
|
-
$[
|
|
240
|
-
$[
|
|
241
|
-
$[
|
|
242
|
-
$[
|
|
243
|
-
} else
|
|
244
|
-
let
|
|
245
|
-
if ($[
|
|
246
|
-
|
|
214
|
+
$[38] = t15;
|
|
215
|
+
$[39] = t16;
|
|
216
|
+
$[40] = t17;
|
|
217
|
+
} else t17 = $[40];
|
|
218
|
+
let t18;
|
|
219
|
+
if ($[41] !== mode || $[42] !== pageValue || $[43] !== textValue || $[44] !== urlValue) {
|
|
220
|
+
t18 = !textValue.trim() || (mode === "page" ? !pageValue : !/^https?:\/\//i.test(urlValue.trim()));
|
|
221
|
+
$[41] = mode;
|
|
222
|
+
$[42] = pageValue;
|
|
223
|
+
$[43] = textValue;
|
|
224
|
+
$[44] = urlValue;
|
|
225
|
+
$[45] = t18;
|
|
226
|
+
} else t18 = $[45];
|
|
227
|
+
let t19;
|
|
228
|
+
if ($[46] !== t18) {
|
|
229
|
+
t19 = /* @__PURE__ */ jsx(Button, {
|
|
247
230
|
type: "submit",
|
|
248
231
|
size: "sm",
|
|
249
|
-
disabled:
|
|
232
|
+
disabled: t18,
|
|
250
233
|
children: "Save"
|
|
251
234
|
});
|
|
252
|
-
$[
|
|
253
|
-
$[
|
|
254
|
-
} else
|
|
255
|
-
let
|
|
256
|
-
if ($[
|
|
257
|
-
|
|
235
|
+
$[46] = t18;
|
|
236
|
+
$[47] = t19;
|
|
237
|
+
} else t19 = $[47];
|
|
238
|
+
let t20;
|
|
239
|
+
if ($[48] !== onUnlink || $[49] !== target) {
|
|
240
|
+
t20 = target && /* @__PURE__ */ jsx(Button, {
|
|
258
241
|
type: "button",
|
|
259
242
|
variant: "outline",
|
|
260
243
|
size: "sm",
|
|
261
244
|
onClick: onUnlink,
|
|
262
245
|
children: "Unlink"
|
|
263
246
|
});
|
|
264
|
-
$[
|
|
265
|
-
$[
|
|
266
|
-
$[
|
|
267
|
-
} else
|
|
268
|
-
let
|
|
269
|
-
if ($[
|
|
270
|
-
|
|
247
|
+
$[48] = onUnlink;
|
|
248
|
+
$[49] = target;
|
|
249
|
+
$[50] = t20;
|
|
250
|
+
} else t20 = $[50];
|
|
251
|
+
let t21;
|
|
252
|
+
if ($[51] !== t19 || $[52] !== t20) {
|
|
253
|
+
t21 = /* @__PURE__ */ jsxs("div", {
|
|
271
254
|
className: "grid gap-2",
|
|
272
|
-
children: [
|
|
255
|
+
children: [t19, t20]
|
|
273
256
|
});
|
|
274
|
-
$[
|
|
275
|
-
$[
|
|
276
|
-
$[
|
|
277
|
-
} else
|
|
278
|
-
let
|
|
279
|
-
if ($[
|
|
280
|
-
|
|
257
|
+
$[51] = t19;
|
|
258
|
+
$[52] = t20;
|
|
259
|
+
$[53] = t21;
|
|
260
|
+
} else t21 = $[53];
|
|
261
|
+
let t22;
|
|
262
|
+
if ($[54] !== handleSubmit || $[55] !== t11 || $[56] !== t17 || $[57] !== t21) {
|
|
263
|
+
t22 = /* @__PURE__ */ jsx(PopoverContent, {
|
|
281
264
|
align: "center",
|
|
282
265
|
className: "w-72 p-3",
|
|
283
266
|
children: /* @__PURE__ */ jsxs("form", {
|
|
284
267
|
className: "grid gap-3",
|
|
285
268
|
onSubmit: handleSubmit,
|
|
286
269
|
children: [
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
270
|
+
t11,
|
|
271
|
+
t17,
|
|
272
|
+
t21
|
|
290
273
|
]
|
|
291
274
|
})
|
|
292
275
|
});
|
|
293
|
-
$[
|
|
294
|
-
$[
|
|
295
|
-
$[
|
|
296
|
-
$[
|
|
297
|
-
$[
|
|
298
|
-
} else
|
|
299
|
-
let
|
|
300
|
-
if ($[
|
|
301
|
-
|
|
276
|
+
$[54] = handleSubmit;
|
|
277
|
+
$[55] = t11;
|
|
278
|
+
$[56] = t17;
|
|
279
|
+
$[57] = t21;
|
|
280
|
+
$[58] = t22;
|
|
281
|
+
} else t22 = $[58];
|
|
282
|
+
let t23;
|
|
283
|
+
if ($[59] !== handleOpenChange || $[60] !== open || $[61] !== t22 || $[62] !== t8) {
|
|
284
|
+
t23 = /* @__PURE__ */ jsxs(Popover, {
|
|
302
285
|
open,
|
|
303
286
|
onOpenChange: handleOpenChange,
|
|
304
|
-
children: [
|
|
287
|
+
children: [t8, t22]
|
|
305
288
|
});
|
|
306
|
-
$[
|
|
307
|
-
$[
|
|
308
|
-
$[
|
|
309
|
-
$[
|
|
310
|
-
$[
|
|
311
|
-
} else
|
|
312
|
-
return
|
|
289
|
+
$[59] = handleOpenChange;
|
|
290
|
+
$[60] = open;
|
|
291
|
+
$[61] = t22;
|
|
292
|
+
$[62] = t8;
|
|
293
|
+
$[63] = t23;
|
|
294
|
+
} else t23 = $[63];
|
|
295
|
+
return t23;
|
|
313
296
|
}
|
|
314
|
-
function _temp(
|
|
297
|
+
function _temp(page_0) {
|
|
315
298
|
return /* @__PURE__ */ jsxs("option", {
|
|
316
|
-
value:
|
|
299
|
+
value: destinationTextLink(page_0),
|
|
317
300
|
children: [
|
|
318
|
-
|
|
301
|
+
page_0.title,
|
|
319
302
|
" (",
|
|
320
|
-
|
|
303
|
+
page_0.fullPath,
|
|
321
304
|
")"
|
|
322
305
|
]
|
|
323
|
-
},
|
|
306
|
+
}, page_0.key);
|
|
324
307
|
}
|
|
325
308
|
|
|
326
309
|
//#endregion
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isLexicalState, markdownToLexicalState } from "../../lib/lexicalState.js";
|
|
2
|
-
import {
|
|
2
|
+
import { HighlightNode } from "./HighlightNode.js";
|
|
3
3
|
import { InlineParagraphNode } from "./InlineParagraphNode.js";
|
|
4
4
|
import { LinkNode } from "@lexical/link";
|
|
5
5
|
import { ParagraphNode } from "lexical";
|
|
@@ -39,7 +39,7 @@ function createEditorConfig(initialState) {
|
|
|
39
39
|
theme: {},
|
|
40
40
|
nodes: [
|
|
41
41
|
LinkNode,
|
|
42
|
-
|
|
42
|
+
HighlightNode,
|
|
43
43
|
InlineParagraphNode,
|
|
44
44
|
{
|
|
45
45
|
replace: ParagraphNode,
|
package/dist/core/createApp.d.ts
CHANGED
|
@@ -844,7 +844,7 @@ declare function createApp({
|
|
|
844
844
|
useData(): unknown;
|
|
845
845
|
_internal: {
|
|
846
846
|
id: string;
|
|
847
|
-
kind: "derived" | "
|
|
847
|
+
kind: "curated" | "derived" | "singleton";
|
|
848
848
|
loader: ((context: {
|
|
849
849
|
params: Record<string, string>;
|
|
850
850
|
}) => unknown) | undefined;
|
|
@@ -919,7 +919,7 @@ declare function createApp({
|
|
|
919
919
|
useData(): unknown;
|
|
920
920
|
_internal: {
|
|
921
921
|
id: string;
|
|
922
|
-
kind: "derived" | "
|
|
922
|
+
kind: "curated" | "derived" | "singleton";
|
|
923
923
|
loader: ((context: {
|
|
924
924
|
params: Record<string, string>;
|
|
925
925
|
}) => unknown) | undefined;
|
|
@@ -1004,6 +1004,7 @@ declare function createApp({
|
|
|
1004
1004
|
}[];
|
|
1005
1005
|
getSerializableLayoutDefinitions(): {
|
|
1006
1006
|
layoutId: string;
|
|
1007
|
+
kind: "curated" | "derived" | "singleton";
|
|
1007
1008
|
description: string;
|
|
1008
1009
|
blocks: ({
|
|
1009
1010
|
type: string;
|
package/dist/core/createApp.js
CHANGED
|
@@ -7,7 +7,7 @@ function createApp({ blocks, layouts = [] }) {
|
|
|
7
7
|
for (const layout of layouts) {
|
|
8
8
|
const { id, kind } = layout._internal;
|
|
9
9
|
if (layoutsMap.has(id)) throw new Error(`Duplicate layout: ${id}`);
|
|
10
|
-
if (kind
|
|
10
|
+
if (kind !== "curated") {
|
|
11
11
|
const pattern = id.split(".").map((segment) => segment.startsWith("$") ? "$" : segment).join(".");
|
|
12
12
|
if (derivedPatterns.has(pattern)) throw new Error(`Equivalent derived route: ${id}`);
|
|
13
13
|
derivedPatterns.add(pattern);
|
|
@@ -46,6 +46,7 @@ function createApp({ blocks, layouts = [] }) {
|
|
|
46
46
|
getSerializableLayoutDefinitions() {
|
|
47
47
|
return Array.from(layoutsMap.values()).map((layout) => ({
|
|
48
48
|
layoutId: layout._internal.id,
|
|
49
|
+
kind: layout._internal.kind,
|
|
49
50
|
description: layout._internal.description,
|
|
50
51
|
blocks: layout._internal.blockDefinitions
|
|
51
52
|
}));
|
|
@@ -51,7 +51,7 @@ type ValidateLayoutOnlyBlocks<T extends readonly LayoutBlock[]> = { [K in keyof
|
|
|
51
51
|
type ValidatePageContentBlocks<T extends readonly LayoutBlock[]> = { [K in keyof T]: T[K] extends LayoutBlock<true> ? "❌ Camox: blocks in `blocks.initial` must NOT be `layoutOnly: true` — `initial` is for page-content blocks. Remove `layoutOnly: true` from this block's `createBlock` options." : T[K] };
|
|
52
52
|
interface CreateLayoutOptions<TBefore extends readonly LayoutBlock[], TAfter extends readonly LayoutBlock[], TInitial extends readonly LayoutBlock[]> {
|
|
53
53
|
id: string;
|
|
54
|
-
kind?: "curated" | "derived";
|
|
54
|
+
kind?: "curated" | "derived" | "singleton";
|
|
55
55
|
loader?: (context: {
|
|
56
56
|
params: Record<string, string>;
|
|
57
57
|
}) => unknown;
|
|
@@ -84,7 +84,7 @@ declare function createLayoutDefinition<const TBefore extends readonly LayoutBlo
|
|
|
84
84
|
useData(): unknown;
|
|
85
85
|
_internal: {
|
|
86
86
|
id: string;
|
|
87
|
-
kind: "derived" | "
|
|
87
|
+
kind: "curated" | "derived" | "singleton";
|
|
88
88
|
loader: ((context: {
|
|
89
89
|
params: Record<string, string>;
|
|
90
90
|
}) => unknown) | undefined;
|
|
@@ -156,6 +156,19 @@ type FileOptions<Id extends string, Data, B extends readonly LayoutBlock[], A ex
|
|
|
156
156
|
children: React.ReactNode;
|
|
157
157
|
}>;
|
|
158
158
|
loader?: never;
|
|
159
|
+
} | {
|
|
160
|
+
kind: "singleton";
|
|
161
|
+
blocks: {
|
|
162
|
+
before: ValidateLayoutOnlyBlocks<B>;
|
|
163
|
+
after: ValidateLayoutOnlyBlocks<A>;
|
|
164
|
+
initial?: never;
|
|
165
|
+
};
|
|
166
|
+
loader?: (context: {
|
|
167
|
+
params: Record<string, never>;
|
|
168
|
+
}) => Data;
|
|
169
|
+
component: React.ComponentType<{
|
|
170
|
+
children?: never;
|
|
171
|
+
}>;
|
|
159
172
|
} | {
|
|
160
173
|
kind: "derived";
|
|
161
174
|
blocks: {
|
|
@@ -172,7 +185,7 @@ type FileOptions<Id extends string, Data, B extends readonly LayoutBlock[], A ex
|
|
|
172
185
|
children?: never;
|
|
173
186
|
}>;
|
|
174
187
|
});
|
|
175
|
-
declare function createLayout<const Id extends string>(id: Id): <Data, const B extends readonly LayoutBlock[], const A extends readonly LayoutBlock[], const I extends readonly LayoutBlock[] = []>(options: FileOptions<Id, Data, B, A, I>) => Omit<Layout, "useData"> & {
|
|
188
|
+
declare function createLayout<const Id extends string>(id: Id): <Data = undefined, const B extends readonly LayoutBlock[] = [], const A extends readonly LayoutBlock[] = [], const I extends readonly LayoutBlock[] = []>(options: FileOptions<Id, Data, B, A, I>) => Omit<Layout, "useData"> & {
|
|
176
189
|
useData: () => Awaited<Data>;
|
|
177
190
|
};
|
|
178
191
|
declare function createLayout<const B extends readonly LayoutBlock[], const A extends readonly LayoutBlock[], const I extends readonly LayoutBlock[] = []>(options: CreateLayoutOptions<B, A, I>): Layout;
|