camox 0.33.1 → 0.34.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/createBlock.js +19 -19
- package/dist/core/defineDocument.d.ts +7 -0
- package/dist/core/defineDocument.js +7 -0
- package/dist/features/agent-chat/components/AgentChatSidebar.js +3 -3
- package/dist/features/agent-chat/components/AgentChatThread.js +5 -5
- package/dist/features/navigation/navigation.d.ts +39 -0
- package/dist/features/navigation/navigation.js +231 -0
- package/dist/features/preview/CamoxPreview.d.ts +3 -0
- package/dist/features/preview/CamoxPreview.js +12 -12
- package/dist/features/preview/components/AddBlockSidebar.js +4 -4
- package/dist/features/preview/components/CreatePageModal.js +3 -3
- package/dist/features/preview/components/FieldToolbar.js +1 -1
- package/dist/features/preview/components/PageInfoSidebar.js +23 -23
- package/dist/features/preview/components/PageNavigatorSidebar.js +6 -6
- package/dist/features/preview/components/PagePicker.js +1 -1
- package/dist/features/preview/components/useUpdateBlockPosition.js +3 -3
- package/dist/features/provider/CamoxProvider.js +10 -8
- package/dist/features/routes/pageRuntime.js +6 -0
- package/dist/features/runtime/pageApp.js +75 -0
- package/dist/features/runtime/pageClient.d.ts +7 -0
- package/dist/features/runtime/pageClient.js +37 -0
- package/dist/features/runtime/pageNavigation.js +170 -0
- package/dist/features/runtime/pageServer.d.ts +9 -0
- package/dist/features/runtime/pageServer.js +18 -0
- package/dist/features/runtime/runtime.d.ts +24 -0
- package/dist/features/runtime/runtime.js +44 -0
- package/dist/features/runtime/studioApp.d.ts +15 -0
- package/dist/features/runtime/studioApp.js +117 -0
- package/dist/features/runtime/studioNavigation.js +115 -0
- package/dist/features/runtime/studioServer.d.ts +9 -0
- package/dist/features/runtime/studioServer.js +18 -0
- package/dist/features/studio/CamoxStudio.js +3 -3
- package/dist/features/studio/components/Navbar.js +7 -7
- package/dist/features/studio/components/ProjectMenu.js +9 -9
- package/dist/features/studio/components/UserButton.js +3 -3
- package/dist/features/vite/appGeneration.js +16 -5
- package/dist/features/vite/blockBoilerplate.js +1 -1
- package/dist/features/vite/definitionsSync.js +4 -4
- package/dist/features/vite/routeGeneration.js +9 -156
- package/dist/features/vite/runtimeDev.js +270 -0
- package/dist/features/vite/utils.js +3 -1
- package/dist/features/vite/vite.d.ts +22 -3
- package/dist/features/vite/vite.js +36 -19
- package/dist/lib/auth.js +42 -68
- package/dist/lib/telemetry.js +1 -24
- package/dist/lib/utils.js +1 -1
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/Matches.d.ts +114 -0
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/RouterProvider.d.ts +25 -0
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/config.d.ts +1 -0
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/defer.d.ts +1 -0
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/fileRoute.d.ts +20 -0
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/global.d.ts +8 -0
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/hash-scroll.d.ts +1 -0
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/index.d.ts +18 -0
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/link.d.ts +161 -0
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/load-matches.d.ts +6 -0
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/location.d.ts +54 -0
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/lru-cache.d.ts +8 -0
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/manifest.d.ts +32 -0
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/new-process-route-tree.d.ts +115 -0
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/not-found.d.ts +1 -0
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/redirect.d.ts +49 -0
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/rewrite.d.ts +1 -0
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/root.d.ts +6 -0
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/route.d.ts +343 -0
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/routeInfo.d.ts +48 -0
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/router.d.ts +695 -0
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/scroll-restoration.d.ts +1 -0
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/searchMiddleware.d.ts +1 -0
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/searchParams.d.ts +5 -0
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/ssr/serializer/RawStream.d.ts +38 -0
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/ssr/serializer/seroval-plugins.d.ts +1 -0
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/ssr/serializer/transformer.d.ts +65 -0
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/stores.d.ts +69 -0
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/structuralSharing.d.ts +1 -0
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/typePrimitives.d.ts +1 -0
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/useLoaderData.d.ts +1 -0
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/useLoaderDeps.d.ts +1 -0
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/useNavigate.d.ts +10 -0
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/useParams.d.ts +1 -0
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/useRouteContext.d.ts +1 -0
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/useSearch.d.ts +1 -0
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/utils.d.ts +28 -0
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/validators.d.ts +49 -0
- package/package.json +34 -12
- package/skills/camox-block/SKILL.md +4 -4
- package/skills/camox-cli/SKILL.md +3 -3
- package/skills/camox-layout/SKILL.md +2 -2
- package/dist/features/routes/ogRoute.d.ts +0 -12
- package/dist/features/routes/ogRoute.js +0 -20
- package/dist/features/routes/pageRoute.d.ts +0 -48
- package/dist/features/routes/pageRoute.js +0 -254
- package/dist/lib/api-client.d.ts +0 -7
- package/dist/lib/queries.d.ts +0 -12
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useNavigate } from "../../navigation/navigation.js";
|
|
1
2
|
import { useProjectSlug } from "../../../lib/auth.js";
|
|
2
3
|
import { blockQueries, layoutQueries, pageMutations, pageQueries, projectQueries } from "../../../lib/queries.js";
|
|
3
4
|
import { trackClientEvent } from "../../../lib/telemetry-client.js";
|
|
@@ -12,7 +13,6 @@ import { c } from "react/compiler-runtime";
|
|
|
12
13
|
import { Input } from "@camox/ui/input";
|
|
13
14
|
import { Label } from "@camox/ui/label";
|
|
14
15
|
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
15
|
-
import { useNavigate } from "@tanstack/react-router";
|
|
16
16
|
import * as React from "react";
|
|
17
17
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
18
18
|
import { toast } from "@camox/ui/toaster";
|
|
@@ -30,9 +30,9 @@ import { Tooltip, TooltipContent, TooltipTrigger } from "@camox/ui/tooltip";
|
|
|
30
30
|
//#region src/features/preview/components/PageInfoSidebar.tsx
|
|
31
31
|
const usePageMetadataData = (pageId) => {
|
|
32
32
|
const $ = c(29);
|
|
33
|
-
if ($[0] !== "
|
|
33
|
+
if ($[0] !== "c39febcc5c5794903cee3680a6ac31c541b522c2ffa947517d81cc13746b8b7a") {
|
|
34
34
|
for (let $i = 0; $i < 29; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
35
|
-
$[0] = "
|
|
35
|
+
$[0] = "c39febcc5c5794903cee3680a6ac31c541b522c2ffa947517d81cc13746b8b7a";
|
|
36
36
|
}
|
|
37
37
|
const projectSlug = useProjectSlug();
|
|
38
38
|
const camoxApp = useCamoxApp();
|
|
@@ -131,9 +131,9 @@ const usePageMetadataData = (pageId) => {
|
|
|
131
131
|
};
|
|
132
132
|
const PageInfoSidebar = (t0) => {
|
|
133
133
|
const $ = c(40);
|
|
134
|
-
if ($[0] !== "
|
|
134
|
+
if ($[0] !== "c39febcc5c5794903cee3680a6ac31c541b522c2ffa947517d81cc13746b8b7a") {
|
|
135
135
|
for (let $i = 0; $i < 40; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
136
|
-
$[0] = "
|
|
136
|
+
$[0] = "c39febcc5c5794903cee3680a6ac31c541b522c2ffa947517d81cc13746b8b7a";
|
|
137
137
|
}
|
|
138
138
|
const { pageId } = t0;
|
|
139
139
|
const data = usePageMetadataData(pageId);
|
|
@@ -341,9 +341,9 @@ const PageInfoSidebar = (t0) => {
|
|
|
341
341
|
};
|
|
342
342
|
const PageNicknameSidebarEditor = (t0) => {
|
|
343
343
|
const $ = c(21);
|
|
344
|
-
if ($[0] !== "
|
|
344
|
+
if ($[0] !== "c39febcc5c5794903cee3680a6ac31c541b522c2ffa947517d81cc13746b8b7a") {
|
|
345
345
|
for (let $i = 0; $i < 21; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
346
|
-
$[0] = "
|
|
346
|
+
$[0] = "c39febcc5c5794903cee3680a6ac31c541b522c2ffa947517d81cc13746b8b7a";
|
|
347
347
|
}
|
|
348
348
|
const { data } = t0;
|
|
349
349
|
const { page } = data;
|
|
@@ -452,9 +452,9 @@ const PageNicknameSidebarEditor = (t0) => {
|
|
|
452
452
|
};
|
|
453
453
|
const PageLayoutSidebarSelect = (t0) => {
|
|
454
454
|
const $ = c(30);
|
|
455
|
-
if ($[0] !== "
|
|
455
|
+
if ($[0] !== "c39febcc5c5794903cee3680a6ac31c541b522c2ffa947517d81cc13746b8b7a") {
|
|
456
456
|
for (let $i = 0; $i < 30; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
457
|
-
$[0] = "
|
|
457
|
+
$[0] = "c39febcc5c5794903cee3680a6ac31c541b522c2ffa947517d81cc13746b8b7a";
|
|
458
458
|
}
|
|
459
459
|
const { data } = t0;
|
|
460
460
|
const { page, layouts, camoxApp } = data;
|
|
@@ -586,9 +586,9 @@ const PageLayoutSidebarSelect = (t0) => {
|
|
|
586
586
|
};
|
|
587
587
|
const PageStructureModal = (t0) => {
|
|
588
588
|
const $ = c(10);
|
|
589
|
-
if ($[0] !== "
|
|
589
|
+
if ($[0] !== "c39febcc5c5794903cee3680a6ac31c541b522c2ffa947517d81cc13746b8b7a") {
|
|
590
590
|
for (let $i = 0; $i < 10; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
591
|
-
$[0] = "
|
|
591
|
+
$[0] = "c39febcc5c5794903cee3680a6ac31c541b522c2ffa947517d81cc13746b8b7a";
|
|
592
592
|
}
|
|
593
593
|
const { open, onOpenChange, pageId } = t0;
|
|
594
594
|
const data = usePageMetadataData(pageId);
|
|
@@ -762,9 +762,9 @@ const PageStructureEditor = ({ data, includeNickname = true, includeLayout = tru
|
|
|
762
762
|
};
|
|
763
763
|
const PageSeoModal = (t0) => {
|
|
764
764
|
const $ = c(11);
|
|
765
|
-
if ($[0] !== "
|
|
765
|
+
if ($[0] !== "c39febcc5c5794903cee3680a6ac31c541b522c2ffa947517d81cc13746b8b7a") {
|
|
766
766
|
for (let $i = 0; $i < 11; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
767
|
-
$[0] = "
|
|
767
|
+
$[0] = "c39febcc5c5794903cee3680a6ac31c541b522c2ffa947517d81cc13746b8b7a";
|
|
768
768
|
}
|
|
769
769
|
const { open, onOpenChange, pageId } = t0;
|
|
770
770
|
const { page, metaTitle, pageLayoutRecord, project } = usePageMetadataData(pageId);
|
|
@@ -809,9 +809,9 @@ const PageSeoModal = (t0) => {
|
|
|
809
809
|
};
|
|
810
810
|
const PageSeoEditor = (t0) => {
|
|
811
811
|
const $ = c(43);
|
|
812
|
-
if ($[0] !== "
|
|
812
|
+
if ($[0] !== "c39febcc5c5794903cee3680a6ac31c541b522c2ffa947517d81cc13746b8b7a") {
|
|
813
813
|
for (let $i = 0; $i < 43; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
814
|
-
$[0] = "
|
|
814
|
+
$[0] = "c39febcc5c5794903cee3680a6ac31c541b522c2ffa947517d81cc13746b8b7a";
|
|
815
815
|
}
|
|
816
816
|
const { page, metaTitle, layoutId, projectName } = t0;
|
|
817
817
|
let t1;
|
|
@@ -984,9 +984,9 @@ const PageSeoEditor = (t0) => {
|
|
|
984
984
|
};
|
|
985
985
|
const PageMarkdownModal = (t0) => {
|
|
986
986
|
const $ = c(10);
|
|
987
|
-
if ($[0] !== "
|
|
987
|
+
if ($[0] !== "c39febcc5c5794903cee3680a6ac31c541b522c2ffa947517d81cc13746b8b7a") {
|
|
988
988
|
for (let $i = 0; $i < 10; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
989
|
-
$[0] = "
|
|
989
|
+
$[0] = "c39febcc5c5794903cee3680a6ac31c541b522c2ffa947517d81cc13746b8b7a";
|
|
990
990
|
}
|
|
991
991
|
const { open, onOpenChange, pageId, metaTitle, metaDescription } = t0;
|
|
992
992
|
let t1;
|
|
@@ -1029,9 +1029,9 @@ function truncateText(text, maxLen) {
|
|
|
1029
1029
|
}
|
|
1030
1030
|
const SearchEnginePreview = (t0) => {
|
|
1031
1031
|
const $ = c(17);
|
|
1032
|
-
if ($[0] !== "
|
|
1032
|
+
if ($[0] !== "c39febcc5c5794903cee3680a6ac31c541b522c2ffa947517d81cc13746b8b7a") {
|
|
1033
1033
|
for (let $i = 0; $i < 17; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
1034
|
-
$[0] = "
|
|
1034
|
+
$[0] = "c39febcc5c5794903cee3680a6ac31c541b522c2ffa947517d81cc13746b8b7a";
|
|
1035
1035
|
}
|
|
1036
1036
|
const { page, metaTitle, metaDescription } = t0;
|
|
1037
1037
|
const url = `${typeof window !== "undefined" ? window.location.origin : ""}${page.fullPath}`;
|
|
@@ -1114,9 +1114,9 @@ const SearchEnginePreview = (t0) => {
|
|
|
1114
1114
|
};
|
|
1115
1115
|
const SocialPreviewSection = (t0) => {
|
|
1116
1116
|
const $ = c(60);
|
|
1117
|
-
if ($[0] !== "
|
|
1117
|
+
if ($[0] !== "c39febcc5c5794903cee3680a6ac31c541b522c2ffa947517d81cc13746b8b7a") {
|
|
1118
1118
|
for (let $i = 0; $i < 60; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
1119
|
-
$[0] = "
|
|
1119
|
+
$[0] = "c39febcc5c5794903cee3680a6ac31c541b522c2ffa947517d81cc13746b8b7a";
|
|
1120
1120
|
}
|
|
1121
1121
|
const { page, metaTitle, metaDescription, layoutId, projectName } = t0;
|
|
1122
1122
|
const pageMetaTitle = page.metaTitle ?? page.pathSegment;
|
|
@@ -1390,9 +1390,9 @@ const SocialPreviewSection = (t0) => {
|
|
|
1390
1390
|
};
|
|
1391
1391
|
const PageMarkdownPreview = (t0) => {
|
|
1392
1392
|
const $ = c(9);
|
|
1393
|
-
if ($[0] !== "
|
|
1393
|
+
if ($[0] !== "c39febcc5c5794903cee3680a6ac31c541b522c2ffa947517d81cc13746b8b7a") {
|
|
1394
1394
|
for (let $i = 0; $i < 9; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
1395
|
-
$[0] = "
|
|
1395
|
+
$[0] = "c39febcc5c5794903cee3680a6ac31c541b522c2ffa947517d81cc13746b8b7a";
|
|
1396
1396
|
}
|
|
1397
1397
|
const { pageId, metaTitle, metaDescription } = t0;
|
|
1398
1398
|
let t1;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useLocation } from "../../navigation/navigation.js";
|
|
1
2
|
import { actionsStore } from "../../provider/actionsStore.js";
|
|
2
3
|
import { useProjectSlug } from "../../../lib/auth.js";
|
|
3
4
|
import { pageMutations } from "../../../lib/queries.js";
|
|
@@ -11,11 +12,10 @@ import { PublishDialog } from "./PublishDialog.js";
|
|
|
11
12
|
import { c } from "react/compiler-runtime";
|
|
12
13
|
import { Label } from "@camox/ui/label";
|
|
13
14
|
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
14
|
-
import { useLocation } from "@tanstack/react-router";
|
|
15
15
|
import { useSelector } from "@xstate/store-react";
|
|
16
16
|
import * as React from "react";
|
|
17
|
-
import { queryKeys } from "@camox/api-contract/query-keys";
|
|
18
17
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
18
|
+
import { queryKeys } from "@camox/api-contract/query-keys";
|
|
19
19
|
import { toast } from "@camox/ui/toaster";
|
|
20
20
|
import { Button } from "@camox/ui/button";
|
|
21
21
|
import { MoreHorizontal } from "lucide-react";
|
|
@@ -28,9 +28,9 @@ import { Switch } from "@camox/ui/switch";
|
|
|
28
28
|
//#region src/features/preview/components/PageNavigatorSidebar.tsx
|
|
29
29
|
const PageNavigatorPublishRow = (t0) => {
|
|
30
30
|
const $ = c(102);
|
|
31
|
-
if ($[0] !== "
|
|
31
|
+
if ($[0] !== "a5c20885a61abde1950615d7a7429cbcd798dd8fc1df8fe6d4416f9d12ca4827") {
|
|
32
32
|
for (let $i = 0; $i < 102; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
33
|
-
$[0] = "
|
|
33
|
+
$[0] = "a5c20885a61abde1950615d7a7429cbcd798dd8fc1df8fe6d4416f9d12ca4827";
|
|
34
34
|
}
|
|
35
35
|
const { page } = t0;
|
|
36
36
|
const previewSource = useSelector(previewStore, _temp);
|
|
@@ -519,9 +519,9 @@ const PageNavigatorPublishRow = (t0) => {
|
|
|
519
519
|
};
|
|
520
520
|
const PageNavigatorSidebar = (t0) => {
|
|
521
521
|
const $ = c(8);
|
|
522
|
-
if ($[0] !== "
|
|
522
|
+
if ($[0] !== "a5c20885a61abde1950615d7a7429cbcd798dd8fc1df8fe6d4416f9d12ca4827") {
|
|
523
523
|
for (let $i = 0; $i < 8; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
524
|
-
$[0] = "
|
|
524
|
+
$[0] = "a5c20885a61abde1950615d7a7429cbcd798dd8fc1df8fe6d4416f9d12ca4827";
|
|
525
525
|
}
|
|
526
526
|
const { page } = t0;
|
|
527
527
|
let t1;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useLocation, useNavigate } from "../../navigation/navigation.js";
|
|
1
2
|
import { useProjectSlug } from "../../../lib/auth.js";
|
|
2
3
|
import { pageMutations, pageQueries, projectQueries } from "../../../lib/queries.js";
|
|
3
4
|
import { cn } from "../../../lib/utils.js";
|
|
@@ -5,7 +6,6 @@ import { previewStore } from "../previewStore.js";
|
|
|
5
6
|
import { PageStatusBadge } from "./PageStatusBadge.js";
|
|
6
7
|
import { Popover, PopoverContent, PopoverTrigger } from "@camox/ui/popover";
|
|
7
8
|
import { useMutation, useQuery } from "@tanstack/react-query";
|
|
8
|
-
import { useLocation, useNavigate } from "@tanstack/react-router";
|
|
9
9
|
import { useSelector } from "@xstate/store-react";
|
|
10
10
|
import * as React from "react";
|
|
11
11
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { useLocation } from "../../navigation/navigation.js";
|
|
1
2
|
import { blockMutations } from "../../../lib/queries.js";
|
|
2
3
|
import { previewStore } from "../previewStore.js";
|
|
3
4
|
import { c } from "react/compiler-runtime";
|
|
4
5
|
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
5
|
-
import { useLocation } from "@tanstack/react-router";
|
|
6
6
|
import { useSelector } from "@xstate/store-react";
|
|
7
7
|
import { generateKeyBetween } from "fractional-indexing";
|
|
8
8
|
import { queryKeys } from "@camox/api-contract/query-keys";
|
|
@@ -10,9 +10,9 @@ import { queryKeys } from "@camox/api-contract/query-keys";
|
|
|
10
10
|
//#region src/features/preview/components/useUpdateBlockPosition.ts
|
|
11
11
|
function useUpdateBlockPosition() {
|
|
12
12
|
const $ = c(5);
|
|
13
|
-
if ($[0] !== "
|
|
13
|
+
if ($[0] !== "c7adf6cdbf960268a5bfbb85b92c76404d7abbe36258eed14eb7062e652330a8") {
|
|
14
14
|
for (let $i = 0; $i < 5; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
15
|
-
$[0] = "
|
|
15
|
+
$[0] = "c7adf6cdbf960268a5bfbb85b92c76404d7abbe36258eed14eb7062e652330a8";
|
|
16
16
|
}
|
|
17
17
|
const queryClient = useQueryClient();
|
|
18
18
|
const { pathname } = useLocation();
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useLocation } from "../navigation/navigation.js";
|
|
1
2
|
import { actionsStore } from "./actionsStore.js";
|
|
2
3
|
import { AuthContext, createCamoxAuthClient, useAuthActions, useProcessOtt, useSignInRedirect } from "../../lib/auth.js";
|
|
3
4
|
import { initApiClient } from "../../lib/api-client.js";
|
|
@@ -15,7 +16,6 @@ import { CommandPalette, useCommandPaletteActions } from "./components/CommandPa
|
|
|
15
16
|
import { useAdminShortcuts } from "./useAdminShortcuts.js";
|
|
16
17
|
import { c } from "react/compiler-runtime";
|
|
17
18
|
import { useQuery } from "@tanstack/react-query";
|
|
18
|
-
import { useLocation } from "@tanstack/react-router";
|
|
19
19
|
import * as React from "react";
|
|
20
20
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
21
21
|
import { Toaster } from "@camox/ui/toaster";
|
|
@@ -74,9 +74,9 @@ const AuthenticatedCamoxProvider = ({ children }) => {
|
|
|
74
74
|
};
|
|
75
75
|
const UnauthenticatedLocalhostPreview = (t0) => {
|
|
76
76
|
const $ = c(21);
|
|
77
|
-
if ($[0] !== "
|
|
77
|
+
if ($[0] !== "b1c15713f3d5278144fdb4341407ebb87565133d460491e2bdc2f40d8bd07203") {
|
|
78
78
|
for (let $i = 0; $i < 21; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
79
|
-
$[0] = "
|
|
79
|
+
$[0] = "b1c15713f3d5278144fdb4341407ebb87565133d460491e2bdc2f40d8bd07203";
|
|
80
80
|
}
|
|
81
81
|
const { children } = t0;
|
|
82
82
|
const signInRedirect = useSignInRedirect();
|
|
@@ -211,9 +211,9 @@ const UnauthenticatedLocalhostPreview = (t0) => {
|
|
|
211
211
|
};
|
|
212
212
|
const UnauthenticatedPage = (t0) => {
|
|
213
213
|
const $ = c(9);
|
|
214
|
-
if ($[0] !== "
|
|
214
|
+
if ($[0] !== "b1c15713f3d5278144fdb4341407ebb87565133d460491e2bdc2f40d8bd07203") {
|
|
215
215
|
for (let $i = 0; $i < 9; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
216
|
-
$[0] = "
|
|
216
|
+
$[0] = "b1c15713f3d5278144fdb4341407ebb87565133d460491e2bdc2f40d8bd07203";
|
|
217
217
|
}
|
|
218
218
|
const { children } = t0;
|
|
219
219
|
const { theme } = useThemeValue();
|
|
@@ -252,9 +252,9 @@ const UnauthenticatedPage = (t0) => {
|
|
|
252
252
|
};
|
|
253
253
|
const UnauthenticatedCamoxProvider = (t0) => {
|
|
254
254
|
const $ = c(14);
|
|
255
|
-
if ($[0] !== "
|
|
255
|
+
if ($[0] !== "b1c15713f3d5278144fdb4341407ebb87565133d460491e2bdc2f40d8bd07203") {
|
|
256
256
|
for (let $i = 0; $i < 14; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
257
|
-
$[0] = "
|
|
257
|
+
$[0] = "b1c15713f3d5278144fdb4341407ebb87565133d460491e2bdc2f40d8bd07203";
|
|
258
258
|
}
|
|
259
259
|
const { children } = t0;
|
|
260
260
|
const { pathname } = useLocation();
|
|
@@ -335,6 +335,7 @@ function CamoxProvider({ children, camoxApp, authenticationUrl, apiUrl, projectS
|
|
|
335
335
|
initializedApiUrl.current = apiUrl;
|
|
336
336
|
}
|
|
337
337
|
if (!useProcessOtt(authClient)) return null;
|
|
338
|
+
const unauthenticated = /* @__PURE__ */ jsx(UnauthenticatedCamoxProvider, { children });
|
|
338
339
|
return /* @__PURE__ */ jsx(AuthContext.Provider, {
|
|
339
340
|
value: {
|
|
340
341
|
authClient,
|
|
@@ -350,7 +351,8 @@ function CamoxProvider({ children, camoxApp, authenticationUrl, apiUrl, projectS
|
|
|
350
351
|
rel: "stylesheet",
|
|
351
352
|
href: studioCssUrl
|
|
352
353
|
}), /* @__PURE__ */ jsx(AuthenticatedCamoxProvider, { children })] }),
|
|
353
|
-
|
|
354
|
+
loading: unauthenticated,
|
|
355
|
+
unauthenticated
|
|
354
356
|
})]
|
|
355
357
|
})
|
|
356
358
|
});
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { CamoxPreview, PageContent } from "../preview/CamoxPreview.js";
|
|
2
|
+
import { CamoxProvider } from "../provider/CamoxProvider.js";
|
|
3
|
+
import { PageNavigationProvider } from "./pageNavigation.js";
|
|
4
|
+
import { c } from "react/compiler-runtime";
|
|
5
|
+
import { HydrationBoundary, QueryClientProvider } from "@tanstack/react-query";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
|
|
8
|
+
//#region src/features/runtime/pageApp.tsx
|
|
9
|
+
function PageApp(t0) {
|
|
10
|
+
const $ = c(18);
|
|
11
|
+
if ($[0] !== "557a21bc6b4aed13935ede3368115a90db9c6fcffe823bb869ddbaeb394cf48e") {
|
|
12
|
+
for (let $i = 0; $i < 18; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
13
|
+
$[0] = "557a21bc6b4aed13935ede3368115a90db9c6fcffe823bb869ddbaeb394cf48e";
|
|
14
|
+
}
|
|
15
|
+
const { camoxApp, input, queryClient } = t0;
|
|
16
|
+
const t1 = input.dehydratedState;
|
|
17
|
+
let t2;
|
|
18
|
+
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
19
|
+
t2 = /* @__PURE__ */ jsx(CamoxPreview, { children: /* @__PURE__ */ jsx(PageContent, {}) });
|
|
20
|
+
$[1] = t2;
|
|
21
|
+
} else t2 = $[1];
|
|
22
|
+
let t3;
|
|
23
|
+
if ($[2] !== camoxApp || $[3] !== input.apiUrl || $[4] !== input.authenticationUrl || $[5] !== input.environmentName || $[6] !== input.projectSlug) {
|
|
24
|
+
t3 = /* @__PURE__ */ jsx(CamoxProvider, {
|
|
25
|
+
camoxApp,
|
|
26
|
+
authenticationUrl: input.authenticationUrl,
|
|
27
|
+
apiUrl: input.apiUrl,
|
|
28
|
+
projectSlug: input.projectSlug,
|
|
29
|
+
environmentName: input.environmentName,
|
|
30
|
+
children: t2
|
|
31
|
+
});
|
|
32
|
+
$[2] = camoxApp;
|
|
33
|
+
$[3] = input.apiUrl;
|
|
34
|
+
$[4] = input.authenticationUrl;
|
|
35
|
+
$[5] = input.environmentName;
|
|
36
|
+
$[6] = input.projectSlug;
|
|
37
|
+
$[7] = t3;
|
|
38
|
+
} else t3 = $[7];
|
|
39
|
+
let t4;
|
|
40
|
+
if ($[8] !== input || $[9] !== queryClient || $[10] !== t3) {
|
|
41
|
+
t4 = /* @__PURE__ */ jsx(PageNavigationProvider, {
|
|
42
|
+
initialInput: input,
|
|
43
|
+
queryClient,
|
|
44
|
+
children: t3
|
|
45
|
+
});
|
|
46
|
+
$[8] = input;
|
|
47
|
+
$[9] = queryClient;
|
|
48
|
+
$[10] = t3;
|
|
49
|
+
$[11] = t4;
|
|
50
|
+
} else t4 = $[11];
|
|
51
|
+
let t5;
|
|
52
|
+
if ($[12] !== t1 || $[13] !== t4) {
|
|
53
|
+
t5 = /* @__PURE__ */ jsx(HydrationBoundary, {
|
|
54
|
+
state: t1,
|
|
55
|
+
children: t4
|
|
56
|
+
});
|
|
57
|
+
$[12] = t1;
|
|
58
|
+
$[13] = t4;
|
|
59
|
+
$[14] = t5;
|
|
60
|
+
} else t5 = $[14];
|
|
61
|
+
let t6;
|
|
62
|
+
if ($[15] !== queryClient || $[16] !== t5) {
|
|
63
|
+
t6 = /* @__PURE__ */ jsx(QueryClientProvider, {
|
|
64
|
+
client: queryClient,
|
|
65
|
+
children: t5
|
|
66
|
+
});
|
|
67
|
+
$[15] = queryClient;
|
|
68
|
+
$[16] = t5;
|
|
69
|
+
$[17] = t6;
|
|
70
|
+
} else t6 = $[17];
|
|
71
|
+
return t6;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
//#endregion
|
|
75
|
+
export { PageApp };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CamoxApp } from "../../core/createApp.js";
|
|
2
|
+
|
|
3
|
+
//#region src/features/runtime/pageClient.d.ts
|
|
4
|
+
declare function hydratePageWithApp(camoxApp: CamoxApp): void;
|
|
5
|
+
declare function hydrateRuntimeWithApp(camoxApp: CamoxApp): void;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { hydratePageWithApp, hydrateRuntimeWithApp };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { PageApp } from "./pageApp.js";
|
|
2
|
+
import { StudioApp } from "./studioApp.js";
|
|
3
|
+
import { QueryClient } from "@tanstack/react-query";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { hydrateRoot } from "react-dom/client";
|
|
6
|
+
|
|
7
|
+
//#region src/features/runtime/pageClient.tsx
|
|
8
|
+
function readHydrationData() {
|
|
9
|
+
const script = document.getElementById("__CAMOX_DATA__");
|
|
10
|
+
if (!script?.textContent) throw new Error("Camox runtime hydration data was not found.");
|
|
11
|
+
return JSON.parse(script.textContent);
|
|
12
|
+
}
|
|
13
|
+
function hydratePageWithApp(camoxApp) {
|
|
14
|
+
hydrateRuntimeWithApp(camoxApp);
|
|
15
|
+
}
|
|
16
|
+
function hydrateRuntimeWithApp(camoxApp) {
|
|
17
|
+
const root = document.getElementById("root");
|
|
18
|
+
if (!root) throw new Error("Camox runtime root element was not found.");
|
|
19
|
+
const queryClient = new QueryClient();
|
|
20
|
+
const input = readHydrationData();
|
|
21
|
+
if (input.runtimeKind === "studio") {
|
|
22
|
+
hydrateRoot(root, /* @__PURE__ */ jsx(StudioApp, {
|
|
23
|
+
camoxApp,
|
|
24
|
+
input,
|
|
25
|
+
queryClient
|
|
26
|
+
}));
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
hydrateRoot(root, /* @__PURE__ */ jsx(PageApp, {
|
|
30
|
+
camoxApp,
|
|
31
|
+
input,
|
|
32
|
+
queryClient
|
|
33
|
+
}));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
//#endregion
|
|
37
|
+
export { hydratePageWithApp, hydrateRuntimeWithApp };
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { NavigationProvider } from "../navigation/navigation.js";
|
|
2
|
+
import { createPageHeadInput } from "./runtime.js";
|
|
3
|
+
import { hydrate } from "@tanstack/react-query";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
import { createHead, renderDOMHead } from "@unhead/react/client";
|
|
7
|
+
|
|
8
|
+
//#region src/features/runtime/pageNavigation.tsx
|
|
9
|
+
function normalizeRuntimeBasePath(basePath) {
|
|
10
|
+
if (!basePath || basePath === "/") return "";
|
|
11
|
+
return basePath.startsWith("/") ? basePath.replace(/\/+$/, "") : `/${basePath.replace(/\/+$/, "")}`;
|
|
12
|
+
}
|
|
13
|
+
function normalizePagePath(pathname, runtimeBasePath) {
|
|
14
|
+
const basePath = normalizeRuntimeBasePath(runtimeBasePath);
|
|
15
|
+
if (!basePath) return pathname || "/";
|
|
16
|
+
if (pathname === basePath) return "/";
|
|
17
|
+
if (pathname.startsWith(`${basePath}/`)) return pathname.slice(basePath.length) || "/";
|
|
18
|
+
return pathname || "/";
|
|
19
|
+
}
|
|
20
|
+
function toRuntimePathname(pagePathname, runtimeBasePath) {
|
|
21
|
+
const basePath = normalizeRuntimeBasePath(runtimeBasePath);
|
|
22
|
+
const normalizedPathname = pagePathname.startsWith("/") ? pagePathname : `/${pagePathname}`;
|
|
23
|
+
if (!basePath) return normalizedPathname;
|
|
24
|
+
if (normalizedPathname === "/") return `${basePath}/`;
|
|
25
|
+
if (normalizedPathname.startsWith(`${basePath}/`)) return normalizedPathname;
|
|
26
|
+
return `${basePath}${normalizedPathname}`;
|
|
27
|
+
}
|
|
28
|
+
function getRuntimeLocation(runtimeBasePath) {
|
|
29
|
+
return {
|
|
30
|
+
hash: window.location.hash,
|
|
31
|
+
href: window.location.href,
|
|
32
|
+
pathname: normalizePagePath(window.location.pathname, runtimeBasePath),
|
|
33
|
+
search: window.location.search
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function isReservedPagePath(pathname) {
|
|
37
|
+
return pathname.startsWith("/_camox/") || pathname === "/_camox" || pathname === "/camox" || pathname.startsWith("/camox/") || pathname === "/og" || pathname === "/sitemap.xml";
|
|
38
|
+
}
|
|
39
|
+
function getClientNavigationTarget(to, runtimeBasePath) {
|
|
40
|
+
const url = new URL(to, window.location.href);
|
|
41
|
+
if (url.origin !== window.location.origin) return null;
|
|
42
|
+
const pagePathname = normalizePagePath(url.pathname, runtimeBasePath);
|
|
43
|
+
if (isReservedPagePath(pagePathname)) return null;
|
|
44
|
+
url.pathname = toRuntimePathname(pagePathname, runtimeBasePath);
|
|
45
|
+
return url;
|
|
46
|
+
}
|
|
47
|
+
async function fetchPageData(pagePathname, runtimeBasePath) {
|
|
48
|
+
const dataUrl = new URL(toRuntimePathname("/_camox/data", runtimeBasePath), window.location.origin);
|
|
49
|
+
dataUrl.searchParams.set("path", pagePathname);
|
|
50
|
+
const response = await fetch(dataUrl, {
|
|
51
|
+
headers: { Accept: "application/json" },
|
|
52
|
+
credentials: "same-origin"
|
|
53
|
+
});
|
|
54
|
+
if (!response.ok) throw new Error(`Page data request failed: ${response.status}`);
|
|
55
|
+
return await response.json();
|
|
56
|
+
}
|
|
57
|
+
function isPageHead(head) {
|
|
58
|
+
return !!head && typeof head === "object";
|
|
59
|
+
}
|
|
60
|
+
function updateHead(head, manager) {
|
|
61
|
+
if (!isPageHead(head)) return;
|
|
62
|
+
if (!manager.removedServerPageHead) {
|
|
63
|
+
document.querySelectorAll("[data-camox-page-head]").forEach((element) => element.remove());
|
|
64
|
+
manager.removedServerPageHead = true;
|
|
65
|
+
}
|
|
66
|
+
manager.entry?.dispose();
|
|
67
|
+
manager.entry = manager.head.push(createPageHeadInput(head));
|
|
68
|
+
renderDOMHead(manager.head);
|
|
69
|
+
}
|
|
70
|
+
function hasSameLayoutIdentity(current, next) {
|
|
71
|
+
return !!current && !!next && current.id === next.id && current.layoutId === next.layoutId && current.version === next.version;
|
|
72
|
+
}
|
|
73
|
+
function isLayoutBlockQuery(query, layoutBlockIds) {
|
|
74
|
+
if (!query || typeof query !== "object") return false;
|
|
75
|
+
const queryKey = query.queryKey;
|
|
76
|
+
return Array.isArray(queryKey) && queryKey[0] === "camox" && queryKey[1] === "blocks" && queryKey[2] === "get" && typeof queryKey[3] === "number" && layoutBlockIds.has(queryKey[3]);
|
|
77
|
+
}
|
|
78
|
+
function preserveStableLayoutBlockCaches(dehydratedState, currentLayout, nextLayout) {
|
|
79
|
+
if (!hasSameLayoutIdentity(currentLayout, nextLayout)) return dehydratedState;
|
|
80
|
+
if (!dehydratedState || typeof dehydratedState !== "object") return dehydratedState;
|
|
81
|
+
if (!Array.isArray(dehydratedState.queries)) return dehydratedState;
|
|
82
|
+
const layoutBlockIds = new Set(currentLayout?.blockIds ?? []);
|
|
83
|
+
return {
|
|
84
|
+
...dehydratedState,
|
|
85
|
+
queries: dehydratedState.queries.filter((query) => !isLayoutBlockQuery(query, layoutBlockIds))
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
function PageNavigationProvider({ children, initialInput, queryClient }) {
|
|
89
|
+
const headManagerRef = React.useRef(null);
|
|
90
|
+
if (!headManagerRef.current) headManagerRef.current = {
|
|
91
|
+
head: createHead(),
|
|
92
|
+
removedServerPageHead: false
|
|
93
|
+
};
|
|
94
|
+
const headManager = headManagerRef.current;
|
|
95
|
+
const currentLayoutIdentityRef = React.useRef(initialInput.layoutIdentity);
|
|
96
|
+
const navigate = React.useCallback(async ({ replace, to }) => {
|
|
97
|
+
const target = getClientNavigationTarget(to, initialInput.runtimeBasePath);
|
|
98
|
+
if (!target) {
|
|
99
|
+
window.location.assign(to);
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
const pagePathname = normalizePagePath(target.pathname, initialInput.runtimeBasePath);
|
|
103
|
+
try {
|
|
104
|
+
const data = await fetchPageData(pagePathname, initialInput.runtimeBasePath);
|
|
105
|
+
if (data.dehydratedState) hydrate(queryClient, preserveStableLayoutBlockCaches(data.dehydratedState, currentLayoutIdentityRef.current, data.layoutIdentity));
|
|
106
|
+
currentLayoutIdentityRef.current = data.layoutIdentity ?? null;
|
|
107
|
+
updateHead(data.head, headManager);
|
|
108
|
+
} catch {
|
|
109
|
+
window.location.assign(target.href);
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
if (replace) window.history.replaceState(null, "", target.href);
|
|
113
|
+
else {
|
|
114
|
+
window.history.pushState(null, "", target.href);
|
|
115
|
+
window.scrollTo({ top: 0 });
|
|
116
|
+
}
|
|
117
|
+
window.dispatchEvent(new Event("camox:navigation"));
|
|
118
|
+
}, [
|
|
119
|
+
headManager,
|
|
120
|
+
initialInput.runtimeBasePath,
|
|
121
|
+
queryClient
|
|
122
|
+
]);
|
|
123
|
+
React.useEffect(() => {
|
|
124
|
+
const onClick = (event) => {
|
|
125
|
+
if (event.defaultPrevented) return;
|
|
126
|
+
if (event.button !== 0) return;
|
|
127
|
+
if (event.metaKey || event.altKey || event.ctrlKey || event.shiftKey) return;
|
|
128
|
+
const anchor = event.target?.closest("a");
|
|
129
|
+
if (!anchor) return;
|
|
130
|
+
if (anchor.hasAttribute("download")) return;
|
|
131
|
+
if (anchor.target && anchor.target !== "_self") return;
|
|
132
|
+
const target_0 = getClientNavigationTarget(anchor.href, initialInput.runtimeBasePath);
|
|
133
|
+
if (!target_0) return;
|
|
134
|
+
event.preventDefault();
|
|
135
|
+
navigate({ to: target_0.href });
|
|
136
|
+
};
|
|
137
|
+
document.addEventListener("click", onClick);
|
|
138
|
+
return () => document.removeEventListener("click", onClick);
|
|
139
|
+
}, [navigate]);
|
|
140
|
+
React.useEffect(() => {
|
|
141
|
+
const onPopState = () => {
|
|
142
|
+
fetchPageData(normalizePagePath(window.location.pathname, initialInput.runtimeBasePath), initialInput.runtimeBasePath).then((data_0) => {
|
|
143
|
+
if (data_0.dehydratedState) hydrate(queryClient, preserveStableLayoutBlockCaches(data_0.dehydratedState, currentLayoutIdentityRef.current, data_0.layoutIdentity));
|
|
144
|
+
currentLayoutIdentityRef.current = data_0.layoutIdentity ?? null;
|
|
145
|
+
updateHead(data_0.head, headManager);
|
|
146
|
+
window.dispatchEvent(new Event("camox:navigation"));
|
|
147
|
+
}).catch(() => window.location.reload());
|
|
148
|
+
};
|
|
149
|
+
window.addEventListener("popstate", onPopState);
|
|
150
|
+
return () => window.removeEventListener("popstate", onPopState);
|
|
151
|
+
}, [
|
|
152
|
+
headManager,
|
|
153
|
+
initialInput.runtimeBasePath,
|
|
154
|
+
queryClient
|
|
155
|
+
]);
|
|
156
|
+
return /* @__PURE__ */ jsx(NavigationProvider, {
|
|
157
|
+
getLocation: React.useCallback(() => getRuntimeLocation(initialInput.runtimeBasePath), [initialInput.runtimeBasePath]),
|
|
158
|
+
initialLocation: {
|
|
159
|
+
hash: new URL(initialInput.href).hash,
|
|
160
|
+
href: initialInput.href,
|
|
161
|
+
pathname: initialInput.pathname,
|
|
162
|
+
search: new URL(initialInput.href).search
|
|
163
|
+
},
|
|
164
|
+
navigate,
|
|
165
|
+
children
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
//#endregion
|
|
170
|
+
export { PageNavigationProvider };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CamoxApp } from "../../core/createApp.js";
|
|
2
|
+
import { PageRenderInput } from "./runtime.js";
|
|
3
|
+
|
|
4
|
+
//#region src/features/runtime/pageServer.d.ts
|
|
5
|
+
declare function renderPageWithApp(input: PageRenderInput & {
|
|
6
|
+
camoxApp: CamoxApp;
|
|
7
|
+
}): Promise<string>;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { renderPageWithApp };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { PageApp } from "./pageApp.js";
|
|
2
|
+
import { QueryClient, hydrate } from "@tanstack/react-query";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { renderToString } from "react-dom/server";
|
|
5
|
+
|
|
6
|
+
//#region src/features/runtime/pageServer.tsx
|
|
7
|
+
async function renderPageWithApp(input) {
|
|
8
|
+
const queryClient = new QueryClient();
|
|
9
|
+
hydrate(queryClient, input.dehydratedState);
|
|
10
|
+
return renderToString(/* @__PURE__ */ jsx(PageApp, {
|
|
11
|
+
camoxApp: input.camoxApp,
|
|
12
|
+
input,
|
|
13
|
+
queryClient
|
|
14
|
+
}));
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
export { renderPageWithApp };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { UseHeadInput } from "unhead/types";
|
|
2
|
+
|
|
3
|
+
//#region src/features/runtime/runtime.d.ts
|
|
4
|
+
interface LayoutIdentity {
|
|
5
|
+
blockIds: number[];
|
|
6
|
+
id: number;
|
|
7
|
+
layoutId: string;
|
|
8
|
+
version: string;
|
|
9
|
+
}
|
|
10
|
+
interface PageRenderInput {
|
|
11
|
+
apiUrl: string;
|
|
12
|
+
authenticationUrl: string;
|
|
13
|
+
dehydratedState: unknown;
|
|
14
|
+
environmentName?: string;
|
|
15
|
+
head: unknown;
|
|
16
|
+
href: string;
|
|
17
|
+
layoutIdentity: LayoutIdentity | null;
|
|
18
|
+
loaderData: unknown;
|
|
19
|
+
pathname: string;
|
|
20
|
+
projectSlug: string;
|
|
21
|
+
runtimeBasePath: string;
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
export { PageRenderInput };
|