camox 0.33.1 → 0.35.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.
Files changed (146) hide show
  1. package/dist/core/components/lexical/InlineLexicalEditor.js +1 -1
  2. package/dist/core/components/lexical/SidebarLexicalEditor.js +7 -7
  3. package/dist/core/components/lexical/TextLinkPopover.js +4 -4
  4. package/dist/core/createApp.d.ts +2 -1
  5. package/dist/core/createBlock.d.ts +5 -1451
  6. package/dist/core/createBlock.js +450 -1603
  7. package/dist/core/defineDocument.d.ts +7 -0
  8. package/dist/core/defineDocument.js +7 -0
  9. package/dist/core/editing/BlockEditingRuntime.js +36 -0
  10. package/dist/core/editing/CompleteBlockEditingRuntime.js +76 -0
  11. package/dist/core/editing/createEditableBlock.d.ts +1455 -0
  12. package/dist/core/editing/createEditableBlock.js +1751 -0
  13. package/dist/core/lib/lexicalState.js +1 -1
  14. package/dist/features/agent-chat/components/AgentChatSidebar.js +4 -4
  15. package/dist/features/agent-chat/components/AgentChatThread.js +5 -5
  16. package/dist/features/content/components/AssetCard.js +1 -1
  17. package/dist/features/navigation/navigation.d.ts +39 -0
  18. package/dist/features/navigation/navigation.js +231 -0
  19. package/dist/features/page/PublishedPageContent.js +236 -0
  20. package/dist/features/page/PublishedPageExperience.js +23 -0
  21. package/dist/features/preview/CamoxPreview.d.ts +4 -0
  22. package/dist/features/preview/CamoxPreview.js +16 -16
  23. package/dist/features/preview/EditablePageContent.js +3 -0
  24. package/dist/features/preview/EditablePageExperience.js +24 -0
  25. package/dist/features/preview/components/AddBlockSidebar.js +7 -7
  26. package/dist/features/preview/components/AssetFieldEditor.js +1 -1
  27. package/dist/features/preview/components/AssetLightbox.js +46 -110
  28. package/dist/features/preview/components/BlockActionsPopover.js +6 -6
  29. package/dist/features/preview/components/CreatePageModal.js +7 -7
  30. package/dist/features/preview/components/DebouncedFieldEditor.js +2 -2
  31. package/dist/features/preview/components/DraftSwitchDialog.js +1 -1
  32. package/dist/features/preview/components/FieldToolbar.js +4 -4
  33. package/dist/features/preview/components/Frame.js +1 -1
  34. package/dist/features/preview/components/ItemFieldsEditor.js +3 -3
  35. package/dist/features/preview/components/LeftSidebar.js +1 -1
  36. package/dist/features/preview/components/LinkFieldEditor.js +3 -3
  37. package/dist/features/preview/components/Metadata.js +87 -0
  38. package/dist/features/preview/components/MultipleAssetFieldEditor.js +1 -1
  39. package/dist/features/preview/components/OverlayTracker.js +3 -3
  40. package/dist/features/preview/components/Overlays.js +3 -3
  41. package/dist/features/preview/components/PageEditorSidebar.js +5 -5
  42. package/dist/features/preview/components/PageInfoSidebar.js +158 -74
  43. package/dist/features/preview/components/PageLocationFieldset.js +1 -1
  44. package/dist/features/preview/components/PageNavigatorSidebar.js +10 -10
  45. package/dist/features/preview/components/PageNicknameField.js +2 -2
  46. package/dist/features/preview/components/PagePicker.js +4 -4
  47. package/dist/features/preview/components/PageTree.js +3 -3
  48. package/dist/features/preview/components/PeekedBlock.js +2 -2
  49. package/dist/features/preview/components/PreviewPanel.js +2 -2
  50. package/dist/features/preview/components/PreviewToolbar.js +2 -2
  51. package/dist/features/preview/components/PublishDialog.js +2 -2
  52. package/dist/features/preview/components/RepeatableItemsList.js +1 -1
  53. package/dist/features/preview/components/RightSidebar.js +1 -1
  54. package/dist/features/preview/components/useRepeatableItemActions.js +1 -1
  55. package/dist/features/preview/components/useUpdateBlockPosition.js +4 -4
  56. package/dist/features/provider/AuthenticatedCamoxProvider.js +63 -0
  57. package/dist/features/provider/CamoxProvider.d.ts +5 -12
  58. package/dist/features/provider/CamoxProvider.js +81 -337
  59. package/dist/features/provider/CoreCamoxProvider.js +37 -0
  60. package/dist/features/provider/LocalhostPreviewProvider.js +159 -0
  61. package/dist/features/provider/components/CommandPalette.js +1 -1
  62. package/dist/features/provider/useAdminShortcuts.js +1 -1
  63. package/dist/features/routes/pageRuntime.js +6 -0
  64. package/dist/features/runtime/hydrationData.js +9 -0
  65. package/dist/features/runtime/pageApp.js +188 -0
  66. package/dist/features/runtime/pageClient.d.ts +6 -0
  67. package/dist/features/runtime/pageClient.js +20 -0
  68. package/dist/features/runtime/pageNavigation.js +170 -0
  69. package/dist/features/runtime/pageServer.d.ts +9 -0
  70. package/dist/features/runtime/pageServer.js +18 -0
  71. package/dist/features/runtime/runtime.d.ts +25 -0
  72. package/dist/features/runtime/runtime.js +44 -0
  73. package/dist/features/runtime/studioApp.d.ts +15 -0
  74. package/dist/features/runtime/studioApp.js +185 -0
  75. package/dist/features/runtime/studioClient.d.ts +6 -0
  76. package/dist/features/runtime/studioClient.js +20 -0
  77. package/dist/features/runtime/studioNavigation.js +115 -0
  78. package/dist/features/runtime/studioServer.d.ts +9 -0
  79. package/dist/features/runtime/studioServer.js +18 -0
  80. package/dist/features/studio/CamoxStudio.js +4 -4
  81. package/dist/features/studio/components/EnvironmentMenu.js +2 -2
  82. package/dist/features/studio/components/Navbar.js +7 -7
  83. package/dist/features/studio/components/ProjectMenu.js +9 -9
  84. package/dist/features/studio/components/UserButton.js +3 -3
  85. package/dist/features/studio/useTheme.js +1 -22
  86. package/dist/features/vite/appGeneration.js +16 -5
  87. package/dist/features/vite/blockBoilerplate.js +1 -1
  88. package/dist/features/vite/definitionsSync.js +4 -4
  89. package/dist/features/vite/routeGeneration.js +9 -156
  90. package/dist/features/vite/runtimeDev.js +291 -0
  91. package/dist/features/vite/utils.js +3 -1
  92. package/dist/features/vite/vite.d.ts +22 -3
  93. package/dist/features/vite/vite.js +42 -19
  94. package/dist/lib/auth.js +42 -68
  95. package/dist/lib/normalized-data.js +6 -6
  96. package/dist/lib/telemetry.js +1 -24
  97. package/dist/lib/utils.js +1 -1
  98. package/dist/lib/view-queries.js +28 -0
  99. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/Matches.d.ts +114 -0
  100. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/RouterProvider.d.ts +25 -0
  101. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/config.d.ts +1 -0
  102. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/defer.d.ts +1 -0
  103. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/fileRoute.d.ts +20 -0
  104. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/global.d.ts +8 -0
  105. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/hash-scroll.d.ts +1 -0
  106. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/index.d.ts +18 -0
  107. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/link.d.ts +161 -0
  108. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/load-matches.d.ts +6 -0
  109. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/location.d.ts +54 -0
  110. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/lru-cache.d.ts +8 -0
  111. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/manifest.d.ts +32 -0
  112. 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
  113. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/not-found.d.ts +1 -0
  114. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/redirect.d.ts +49 -0
  115. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/rewrite.d.ts +1 -0
  116. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/root.d.ts +6 -0
  117. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/route.d.ts +343 -0
  118. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/routeInfo.d.ts +48 -0
  119. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/router.d.ts +695 -0
  120. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/scroll-restoration.d.ts +1 -0
  121. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/searchMiddleware.d.ts +1 -0
  122. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/searchParams.d.ts +5 -0
  123. 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
  124. 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
  125. 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
  126. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/stores.d.ts +69 -0
  127. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/structuralSharing.d.ts +1 -0
  128. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/typePrimitives.d.ts +1 -0
  129. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/useLoaderData.d.ts +1 -0
  130. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/useLoaderDeps.d.ts +1 -0
  131. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/useNavigate.d.ts +10 -0
  132. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/useParams.d.ts +1 -0
  133. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/useRouteContext.d.ts +1 -0
  134. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/useSearch.d.ts +1 -0
  135. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/utils.d.ts +28 -0
  136. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/validators.d.ts +49 -0
  137. package/package.json +39 -12
  138. package/skills/camox-block/SKILL.md +4 -4
  139. package/skills/camox-cli/SKILL.md +3 -3
  140. package/skills/camox-layout/SKILL.md +2 -2
  141. package/dist/features/routes/ogRoute.d.ts +0 -12
  142. package/dist/features/routes/ogRoute.js +0 -20
  143. package/dist/features/routes/pageRoute.d.ts +0 -48
  144. package/dist/features/routes/pageRoute.js +0 -254
  145. package/dist/lib/api-client.d.ts +0 -7
  146. package/dist/lib/queries.d.ts +0 -12
@@ -1,5 +1,5 @@
1
- import { FORMAT_FLAGS, lexicalTextToMarkdown } from "./modifierFormats.js";
2
1
  import { isValidTextLinkTarget } from "./textLinks.js";
2
+ import { FORMAT_FLAGS, lexicalTextToMarkdown } from "./modifierFormats.js";
3
3
 
4
4
  //#region src/core/lib/lexicalState.ts
5
5
  function isLexicalState(value) {
@@ -1,13 +1,13 @@
1
+ import { useLocation } from "../../navigation/navigation.js";
1
2
  import { useProjectSlug } from "../../../lib/auth.js";
2
3
  import { projectQueries } from "../../../lib/queries.js";
3
4
  import { previewStore } from "../../preview/previewStore.js";
4
5
  import { AgentChatThread } from "./AgentChatThread.js";
5
6
  import { c } from "react/compiler-runtime";
6
7
  import { useQuery } from "@tanstack/react-query";
7
- import { useLocation } from "@tanstack/react-router";
8
- import { useSelector } from "@xstate/store-react";
9
8
  import * as React from "react";
10
9
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
10
+ import { useSelector } from "@xstate/store-react";
11
11
  import { Button } from "@camox/ui/button";
12
12
  import { Lock, Plus, X } from "lucide-react";
13
13
  import { Alert, AlertDescription, AlertTitle } from "@camox/ui/alert";
@@ -15,9 +15,9 @@ import { Alert, AlertDescription, AlertTitle } from "@camox/ui/alert";
15
15
  //#region src/features/agent-chat/components/AgentChatSidebar.tsx
16
16
  const AgentChatSidebar = () => {
17
17
  const $ = c(20);
18
- if ($[0] !== "fa80c907e2ec181da4f3cb91fbf7d8dc7f1330b0892397f5d2dd7e7058b18f66") {
18
+ if ($[0] !== "0cd25adb7637781b4a21ccdb22bb01ea44234579d0d340e1a833455c0506f264") {
19
19
  for (let $i = 0; $i < 20; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
20
- $[0] = "fa80c907e2ec181da4f3cb91fbf7d8dc7f1330b0892397f5d2dd7e7058b18f66";
20
+ $[0] = "0cd25adb7637781b4a21ccdb22bb01ea44234579d0d340e1a833455c0506f264";
21
21
  }
22
22
  const previewSource = useSelector(previewStore, _temp);
23
23
  const pageScaffoldContext = useSelector(previewStore, _temp2);
@@ -1,3 +1,4 @@
1
+ import { useNavigate } from "../../navigation/navigation.js";
1
2
  import { getAuthCookieHeader, getAuthRequestCredentials } from "../../../lib/auth.js";
2
3
  import { getApiClient, getApiUrl, getEnvironmentName } from "../../../lib/api-client.js";
3
4
  import { cn } from "../../../lib/utils.js";
@@ -5,7 +6,6 @@ import { previewStore } from "../../preview/previewStore.js";
5
6
  import { buildAgentChatToolLabelContext, getToolCallLabel } from "../agent-chat-labels.js";
6
7
  import { AgentToolCallCard } from "./AgentToolCallCard.js";
7
8
  import { c } from "react/compiler-runtime";
8
- import { useNavigate } from "@tanstack/react-router";
9
9
  import * as React from "react";
10
10
  import { jsx, jsxs } from "react/jsx-runtime";
11
11
  import { Button } from "@camox/ui/button";
@@ -106,9 +106,9 @@ const markdownComponents = {
106
106
  };
107
107
  const MessageBubble = (t0) => {
108
108
  const $ = c(34);
109
- if ($[0] !== "72801e2c76f8ef7f0ac3d1552518592bffad57042b24f366613bc1344cfe95d3") {
109
+ if ($[0] !== "2567c826f7e9a4c13b5857bd7da85cb17fb8cc96c39c6c50398fc8a1ce17f1d3") {
110
110
  for (let $i = 0; $i < 34; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
111
- $[0] = "72801e2c76f8ef7f0ac3d1552518592bffad57042b24f366613bc1344cfe95d3";
111
+ $[0] = "2567c826f7e9a4c13b5857bd7da85cb17fb8cc96c39c6c50398fc8a1ce17f1d3";
112
112
  }
113
113
  const { message, source, isThinkingActive, activeThinkingDurationKeys, thinkingDurations, toolLabelContext, onApprovalResponse } = t0;
114
114
  const isUser = message.role === "user";
@@ -226,9 +226,9 @@ const MessageBubble = (t0) => {
226
226
  };
227
227
  const AgentThinkingIndicator = (t0) => {
228
228
  const $ = c(7);
229
- if ($[0] !== "72801e2c76f8ef7f0ac3d1552518592bffad57042b24f366613bc1344cfe95d3") {
229
+ if ($[0] !== "2567c826f7e9a4c13b5857bd7da85cb17fb8cc96c39c6c50398fc8a1ce17f1d3") {
230
230
  for (let $i = 0; $i < 7; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
231
- $[0] = "72801e2c76f8ef7f0ac3d1552518592bffad57042b24f366613bc1344cfe95d3";
231
+ $[0] = "2567c826f7e9a4c13b5857bd7da85cb17fb8cc96c39c6c50398fc8a1ce17f1d3";
232
232
  }
233
233
  const { durationSeconds } = t0;
234
234
  if (durationSeconds !== void 0) {
@@ -1,5 +1,5 @@
1
- import { cn } from "../../../lib/utils.js";
2
1
  import { transformImageUrl } from "../../../core/lib/imageTransform.js";
2
+ import { cn } from "../../../lib/utils.js";
3
3
  import { c } from "react/compiler-runtime";
4
4
  import { jsx, jsxs } from "react/jsx-runtime";
5
5
  import { FileIcon } from "lucide-react";
@@ -0,0 +1,39 @@
1
+ import { UseNavigateResult } from "../../node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/useNavigate.js";
2
+ import * as React from "react";
3
+ import { LinkProps as LinkProps$1 } from "@tanstack/react-router";
4
+ import * as _$react_jsx_runtime0 from "react/jsx-runtime";
5
+
6
+ //#region src/features/navigation/navigation.d.ts
7
+ interface LocationState {
8
+ hash: string;
9
+ href: string;
10
+ pathname: string;
11
+ search: string;
12
+ }
13
+ interface NavigateOptions {
14
+ replace?: boolean;
15
+ to: string;
16
+ }
17
+ type LinkProps = LinkProps$1 & React.AnchorHTMLAttributes<HTMLAnchorElement>;
18
+ declare function NavigationProvider({
19
+ children,
20
+ getLocation,
21
+ initialLocation,
22
+ navigate
23
+ }: {
24
+ children: React.ReactNode;
25
+ getLocation?: () => LocationState;
26
+ initialLocation?: LocationState;
27
+ navigate?: (options: NavigateOptions) => Promise<void> | void;
28
+ }): _$react_jsx_runtime0.JSX.Element;
29
+ declare function useLocation<T = LocationState>(options?: {
30
+ select?: (location: LocationState) => T;
31
+ }): T;
32
+ declare function useNavigate(): ((options: NavigateOptions) => Promise<void> | void) | UseNavigateResult<string>;
33
+ declare const Link: React.ForwardRefExoticComponent<LinkProps & React.RefAttributes<HTMLAnchorElement>>;
34
+ declare function Navigate({
35
+ replace,
36
+ to
37
+ }: NavigateOptions): _$react_jsx_runtime0.JSX.Element | null;
38
+ //#endregion
39
+ export { Link, LinkProps, Navigate, NavigationProvider, useLocation, useNavigate };
@@ -0,0 +1,231 @@
1
+ import { c } from "react/compiler-runtime";
2
+ import * as React from "react";
3
+ import { Link as Link$1, Navigate as Navigate$1, useLocation as useLocation$1, useNavigate as useNavigate$1 } from "@tanstack/react-router";
4
+ import { jsx } from "react/jsx-runtime";
5
+
6
+ //#region src/features/navigation/navigation.tsx
7
+ const NavigationContext = React.createContext(null);
8
+ function getBrowserLocation() {
9
+ if (typeof window === "undefined") return {
10
+ hash: "",
11
+ href: "",
12
+ pathname: "/",
13
+ search: ""
14
+ };
15
+ return {
16
+ hash: window.location.hash,
17
+ href: window.location.href,
18
+ pathname: window.location.pathname,
19
+ search: window.location.search
20
+ };
21
+ }
22
+ function toHref(to) {
23
+ if (to.startsWith("#")) return `${getBrowserLocation().pathname}${to}`;
24
+ return to;
25
+ }
26
+ async function browserNavigate({ replace, to }) {
27
+ if (typeof window === "undefined") return;
28
+ const href = toHref(to);
29
+ if (replace) window.history.replaceState(null, "", href);
30
+ else window.history.pushState(null, "", href);
31
+ window.dispatchEvent(new PopStateEvent("popstate"));
32
+ }
33
+ function NavigationProvider(t0) {
34
+ const $ = c(10);
35
+ if ($[0] !== "ddcd98e64cdc09695f4e9227379a4d90d1598ced9253a16b3dee21623e108a54") {
36
+ for (let $i = 0; $i < 10; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
37
+ $[0] = "ddcd98e64cdc09695f4e9227379a4d90d1598ced9253a16b3dee21623e108a54";
38
+ }
39
+ const { children, getLocation: t1, initialLocation, navigate: t2 } = t0;
40
+ const getLocation = t1 === void 0 ? getBrowserLocation : t1;
41
+ const navigate = t2 === void 0 ? browserNavigate : t2;
42
+ const [location, setLocation] = React.useState(initialLocation ?? getLocation);
43
+ let t3;
44
+ let t4;
45
+ if ($[1] !== getLocation) {
46
+ t3 = () => {
47
+ const updateLocation = () => setLocation(getLocation());
48
+ window.addEventListener("popstate", updateLocation);
49
+ window.addEventListener("camox:navigation", updateLocation);
50
+ return () => {
51
+ window.removeEventListener("popstate", updateLocation);
52
+ window.removeEventListener("camox:navigation", updateLocation);
53
+ };
54
+ };
55
+ t4 = [getLocation];
56
+ $[1] = getLocation;
57
+ $[2] = t3;
58
+ $[3] = t4;
59
+ } else {
60
+ t3 = $[2];
61
+ t4 = $[3];
62
+ }
63
+ React.useEffect(t3, t4);
64
+ let t5;
65
+ if ($[4] !== location || $[5] !== navigate) {
66
+ t5 = {
67
+ location,
68
+ navigate
69
+ };
70
+ $[4] = location;
71
+ $[5] = navigate;
72
+ $[6] = t5;
73
+ } else t5 = $[6];
74
+ const value = t5;
75
+ let t6;
76
+ if ($[7] !== children || $[8] !== value) {
77
+ t6 = /* @__PURE__ */ jsx(NavigationContext.Provider, {
78
+ value,
79
+ children
80
+ });
81
+ $[7] = children;
82
+ $[8] = value;
83
+ $[9] = t6;
84
+ } else t6 = $[9];
85
+ return t6;
86
+ }
87
+ function useLocation(options) {
88
+ const context = React.useContext(NavigationContext);
89
+ if (context) {
90
+ if (options?.select) return options.select(context.location);
91
+ return context.location;
92
+ }
93
+ return useLocation$1(options);
94
+ }
95
+ function useNavigate() {
96
+ const context = React.useContext(NavigationContext);
97
+ if (context) return context.navigate;
98
+ return useNavigate$1();
99
+ }
100
+ const Link = React.forwardRef(function Link(props, ref) {
101
+ const $ = c(33);
102
+ if ($[0] !== "ddcd98e64cdc09695f4e9227379a4d90d1598ced9253a16b3dee21623e108a54") {
103
+ for (let $i = 0; $i < 33; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
104
+ $[0] = "ddcd98e64cdc09695f4e9227379a4d90d1598ced9253a16b3dee21623e108a54";
105
+ }
106
+ const context = React.useContext(NavigationContext);
107
+ if (!context) {
108
+ let t0;
109
+ if ($[1] !== props || $[2] !== ref) {
110
+ t0 = /* @__PURE__ */ jsx(Link$1, {
111
+ ...props,
112
+ ref
113
+ });
114
+ $[1] = props;
115
+ $[2] = ref;
116
+ $[3] = t0;
117
+ } else t0 = $[3];
118
+ return t0;
119
+ }
120
+ let activeProps;
121
+ let children;
122
+ let onClick;
123
+ let rest;
124
+ let target;
125
+ let to;
126
+ if ($[4] !== props) {
127
+ ({activeProps, children, onClick, target, to, ...rest} = props);
128
+ $[4] = props;
129
+ $[5] = activeProps;
130
+ $[6] = children;
131
+ $[7] = onClick;
132
+ $[8] = rest;
133
+ $[9] = target;
134
+ $[10] = to;
135
+ } else {
136
+ activeProps = $[5];
137
+ children = $[6];
138
+ onClick = $[7];
139
+ rest = $[8];
140
+ target = $[9];
141
+ to = $[10];
142
+ }
143
+ let href;
144
+ let t0;
145
+ let t1;
146
+ if ($[11] !== context.location.pathname || $[12] !== to) {
147
+ href = toHref(String(to));
148
+ t0 = context.location.pathname;
149
+ t1 = new URL(href, "http://camox.local");
150
+ $[11] = context.location.pathname;
151
+ $[12] = to;
152
+ $[13] = href;
153
+ $[14] = t0;
154
+ $[15] = t1;
155
+ } else {
156
+ href = $[13];
157
+ t0 = $[14];
158
+ t1 = $[15];
159
+ }
160
+ const activeAnchorProps = t0 === t1.pathname ? activeProps : void 0;
161
+ const t2 = activeAnchorProps?.className;
162
+ let t3;
163
+ if ($[16] !== rest.className || $[17] !== t2) {
164
+ t3 = [rest.className, t2].filter(Boolean);
165
+ $[16] = rest.className;
166
+ $[17] = t2;
167
+ $[18] = t3;
168
+ } else t3 = $[18];
169
+ const t4 = t3.join(" ") || void 0;
170
+ let t5;
171
+ if ($[19] !== context || $[20] !== href || $[21] !== onClick || $[22] !== target) {
172
+ t5 = (event) => {
173
+ onClick?.(event);
174
+ if (event.defaultPrevented) return;
175
+ if (target && target !== "_self") return;
176
+ if (event.metaKey || event.altKey || event.ctrlKey || event.shiftKey) return;
177
+ if (event.button !== 0) return;
178
+ event.preventDefault();
179
+ context.navigate({ to: href });
180
+ };
181
+ $[19] = context;
182
+ $[20] = href;
183
+ $[21] = onClick;
184
+ $[22] = target;
185
+ $[23] = t5;
186
+ } else t5 = $[23];
187
+ let t6;
188
+ if ($[24] !== activeAnchorProps || $[25] !== children || $[26] !== href || $[27] !== ref || $[28] !== rest || $[29] !== t4 || $[30] !== t5 || $[31] !== target) {
189
+ t6 = /* @__PURE__ */ jsx("a", {
190
+ ...rest,
191
+ ...activeAnchorProps,
192
+ ref,
193
+ href,
194
+ target,
195
+ className: t4,
196
+ onClick: t5,
197
+ children
198
+ });
199
+ $[24] = activeAnchorProps;
200
+ $[25] = children;
201
+ $[26] = href;
202
+ $[27] = ref;
203
+ $[28] = rest;
204
+ $[29] = t4;
205
+ $[30] = t5;
206
+ $[31] = target;
207
+ $[32] = t6;
208
+ } else t6 = $[32];
209
+ return t6;
210
+ });
211
+ function Navigate({ replace, to }) {
212
+ const context = React.useContext(NavigationContext);
213
+ if (!context) return /* @__PURE__ */ jsx(Navigate$1, {
214
+ replace,
215
+ to
216
+ });
217
+ React.useEffect(() => {
218
+ context.navigate({
219
+ replace,
220
+ to
221
+ });
222
+ }, [
223
+ context,
224
+ replace,
225
+ to
226
+ ]);
227
+ return null;
228
+ }
229
+
230
+ //#endregion
231
+ export { Link, Navigate, NavigationProvider, useLocation, useNavigate };
@@ -0,0 +1,236 @@
1
+ import { useLocation } from "../navigation/navigation.js";
2
+ import { useProjectSlug } from "../../lib/auth.js";
3
+ import { getApiClient } from "../../lib/api-client.js";
4
+ import { viewBlockQueries } from "../../lib/view-queries.js";
5
+ import { NormalizedDataProvider, usePageBlocks } from "../../lib/normalized-data.js";
6
+ import { BlockErrorBoundary } from "../preview/components/BlockErrorBoundary.js";
7
+ import { useCamoxApp } from "../provider/components/CamoxAppContext.js";
8
+ import { c } from "react/compiler-runtime";
9
+ import { useSuspenseQuery } from "@tanstack/react-query";
10
+ import "react";
11
+ import { jsx } from "react/jsx-runtime";
12
+ import { queryKeys } from "@camox/api-contract/query-keys";
13
+
14
+ //#region src/features/page/PublishedPageContent.tsx
15
+ function pageStructureQueryFn(path, projectSlug, source) {
16
+ return () => getApiClient().pages.getStructure({
17
+ path,
18
+ projectSlug,
19
+ source
20
+ });
21
+ }
22
+ function PublishedBlock(t0) {
23
+ const $ = c(21);
24
+ if ($[0] !== "6b1d872701fbf673bbf88f17d9fcd827a3ba76fd3c668c35080c3a59e9b03bf1") {
25
+ for (let $i = 0; $i < 21; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
26
+ $[0] = "6b1d872701fbf673bbf88f17d9fcd827a3ba76fd3c668c35080c3a59e9b03bf1";
27
+ }
28
+ const { blockId, mode, source } = t0;
29
+ let t1;
30
+ if ($[1] !== blockId || $[2] !== source) {
31
+ t1 = viewBlockQueries.get(blockId, source);
32
+ $[1] = blockId;
33
+ $[2] = source;
34
+ $[3] = t1;
35
+ } else t1 = $[3];
36
+ const { data } = useSuspenseQuery(t1);
37
+ const camoxApp = useCamoxApp();
38
+ let t2;
39
+ if ($[4] !== camoxApp || $[5] !== data.block.type) {
40
+ t2 = camoxApp.getBlockById(data.block.type);
41
+ $[4] = camoxApp;
42
+ $[5] = data.block.type;
43
+ $[6] = t2;
44
+ } else t2 = $[6];
45
+ const blockDef = t2;
46
+ if (!blockDef) return null;
47
+ const t3 = data.files;
48
+ const t4 = data.repeatableItems;
49
+ const T0 = blockDef._internal.Component;
50
+ const t5 = data.block.id;
51
+ const t6 = data.block.type;
52
+ const t7 = data.block.content;
53
+ const t8 = data.block.settings;
54
+ const t9 = String(data.block.position);
55
+ let t10;
56
+ if ($[7] !== data.block.id || $[8] !== data.block.type || $[9] !== t7 || $[10] !== t8 || $[11] !== t9) {
57
+ t10 = {
58
+ _id: t5,
59
+ type: t6,
60
+ content: t7,
61
+ settings: t8,
62
+ position: t9
63
+ };
64
+ $[7] = data.block.id;
65
+ $[8] = data.block.type;
66
+ $[9] = t7;
67
+ $[10] = t8;
68
+ $[11] = t9;
69
+ $[12] = t10;
70
+ } else t10 = $[12];
71
+ let t11;
72
+ if ($[13] !== blockDef._internal.Component || $[14] !== mode || $[15] !== t10) {
73
+ t11 = /* @__PURE__ */ jsx(T0, {
74
+ blockData: t10,
75
+ mode,
76
+ showAddBlockTop: false,
77
+ showAddBlockBottom: false
78
+ });
79
+ $[13] = blockDef._internal.Component;
80
+ $[14] = mode;
81
+ $[15] = t10;
82
+ $[16] = t11;
83
+ } else t11 = $[16];
84
+ let t12;
85
+ if ($[17] !== data.files || $[18] !== data.repeatableItems || $[19] !== t11) {
86
+ t12 = /* @__PURE__ */ jsx(NormalizedDataProvider, {
87
+ files: t3,
88
+ repeatableItems: t4,
89
+ children: t11
90
+ });
91
+ $[17] = data.files;
92
+ $[18] = data.repeatableItems;
93
+ $[19] = t11;
94
+ $[20] = t12;
95
+ } else t12 = $[20];
96
+ return t12;
97
+ }
98
+ function PublishedPageContent(t0) {
99
+ const $ = c(35);
100
+ if ($[0] !== "6b1d872701fbf673bbf88f17d9fcd827a3ba76fd3c668c35080c3a59e9b03bf1") {
101
+ for (let $i = 0; $i < 35; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
102
+ $[0] = "6b1d872701fbf673bbf88f17d9fcd827a3ba76fd3c668c35080c3a59e9b03bf1";
103
+ }
104
+ const { source } = t0;
105
+ const { pathname } = useLocation();
106
+ const projectSlug = useProjectSlug();
107
+ const camoxApp = useCamoxApp();
108
+ let t1;
109
+ if ($[1] !== pathname || $[2] !== source) {
110
+ t1 = queryKeys.pages.getByPath(pathname, source);
111
+ $[1] = pathname;
112
+ $[2] = source;
113
+ $[3] = t1;
114
+ } else t1 = $[3];
115
+ let t2;
116
+ if ($[4] !== pathname || $[5] !== projectSlug || $[6] !== source) {
117
+ t2 = pageStructureQueryFn(pathname, projectSlug, source);
118
+ $[4] = pathname;
119
+ $[5] = projectSlug;
120
+ $[6] = source;
121
+ $[7] = t2;
122
+ } else t2 = $[7];
123
+ let t3;
124
+ if ($[8] !== t1 || $[9] !== t2) {
125
+ t3 = {
126
+ queryKey: t1,
127
+ queryFn: t2,
128
+ staleTime: Infinity
129
+ };
130
+ $[8] = t1;
131
+ $[9] = t2;
132
+ $[10] = t3;
133
+ } else t3 = $[10];
134
+ const { data: pageData } = useSuspenseQuery(t3);
135
+ const { pageBlocks, beforeBlocks, afterBlocks, layoutFiles, layoutItems } = usePageBlocks(pageData, source);
136
+ let t4;
137
+ if ($[11] !== camoxApp || $[12] !== pageData.layout) {
138
+ t4 = pageData.layout ? camoxApp.getLayoutById(pageData.layout.layoutId) : void 0;
139
+ $[11] = camoxApp;
140
+ $[12] = pageData.layout;
141
+ $[13] = t4;
142
+ } else t4 = $[13];
143
+ const layout = t4;
144
+ let t5;
145
+ bb0: {
146
+ if (!pageData.layout) {
147
+ t5 = null;
148
+ break bb0;
149
+ }
150
+ let blocks;
151
+ if ($[14] !== afterBlocks || $[15] !== beforeBlocks) {
152
+ blocks = {};
153
+ for (const block of [...beforeBlocks, ...afterBlocks]) blocks[block.type] = {
154
+ _id: block.id,
155
+ type: block.type,
156
+ content: block.content,
157
+ settings: block.settings,
158
+ position: String(block.position)
159
+ };
160
+ $[14] = afterBlocks;
161
+ $[15] = beforeBlocks;
162
+ $[16] = blocks;
163
+ } else blocks = $[16];
164
+ t5 = blocks;
165
+ }
166
+ const layoutBlocksMap = t5;
167
+ let t6;
168
+ if ($[17] !== pageBlocks || $[18] !== source) {
169
+ let t7;
170
+ if ($[20] !== source) {
171
+ t7 = (block_0) => /* @__PURE__ */ jsx(BlockErrorBoundary, {
172
+ blockId: block_0.id,
173
+ blockType: block_0.type,
174
+ children: /* @__PURE__ */ jsx(PublishedBlock, {
175
+ blockId: block_0.id,
176
+ mode: "site",
177
+ source
178
+ })
179
+ }, block_0.id);
180
+ $[20] = source;
181
+ $[21] = t7;
182
+ } else t7 = $[21];
183
+ t6 = pageBlocks.map(t7);
184
+ $[17] = pageBlocks;
185
+ $[18] = source;
186
+ $[19] = t6;
187
+ } else t6 = $[19];
188
+ const pageBlocksContent = t6;
189
+ if (!layout || !layoutBlocksMap) {
190
+ let t7;
191
+ if ($[22] !== pageBlocksContent) {
192
+ t7 = /* @__PURE__ */ jsx("main", {
193
+ className: "flex min-h-screen flex-col",
194
+ children: pageBlocksContent
195
+ });
196
+ $[22] = pageBlocksContent;
197
+ $[23] = t7;
198
+ } else t7 = $[23];
199
+ return t7;
200
+ }
201
+ const LayoutComponent = layout._internal.component;
202
+ let t7;
203
+ if ($[24] !== LayoutComponent || $[25] !== pageBlocksContent) {
204
+ t7 = /* @__PURE__ */ jsx(LayoutComponent, { children: pageBlocksContent });
205
+ $[24] = LayoutComponent;
206
+ $[25] = pageBlocksContent;
207
+ $[26] = t7;
208
+ } else t7 = $[26];
209
+ let t8;
210
+ if ($[27] !== layout._internal.Provider || $[28] !== layoutBlocksMap || $[29] !== t7) {
211
+ t8 = /* @__PURE__ */ jsx(layout._internal.Provider, {
212
+ layoutBlocks: layoutBlocksMap,
213
+ children: t7
214
+ });
215
+ $[27] = layout._internal.Provider;
216
+ $[28] = layoutBlocksMap;
217
+ $[29] = t7;
218
+ $[30] = t8;
219
+ } else t8 = $[30];
220
+ let t9;
221
+ if ($[31] !== layoutFiles || $[32] !== layoutItems || $[33] !== t8) {
222
+ t9 = /* @__PURE__ */ jsx(NormalizedDataProvider, {
223
+ files: layoutFiles,
224
+ repeatableItems: layoutItems,
225
+ children: t8
226
+ });
227
+ $[31] = layoutFiles;
228
+ $[32] = layoutItems;
229
+ $[33] = t8;
230
+ $[34] = t9;
231
+ } else t9 = $[34];
232
+ return t9;
233
+ }
234
+
235
+ //#endregion
236
+ export { PublishedPageContent };
@@ -0,0 +1,23 @@
1
+ import { PublishedPageContent } from "./PublishedPageContent.js";
2
+ import { c } from "react/compiler-runtime";
3
+ import { jsx } from "react/jsx-runtime";
4
+
5
+ //#region src/features/page/PublishedPageExperience.tsx
6
+ function PublishedPageExperience(t0) {
7
+ const $ = c(3);
8
+ if ($[0] !== "f8c4ab62f3391b7d7d7c339075d7595002caf53b46af25469e17c7fecd4d7d52") {
9
+ for (let $i = 0; $i < 3; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
10
+ $[0] = "f8c4ab62f3391b7d7d7c339075d7595002caf53b46af25469e17c7fecd4d7d52";
11
+ }
12
+ const { source } = t0;
13
+ let t1;
14
+ if ($[1] !== source) {
15
+ t1 = /* @__PURE__ */ jsx(PublishedPageContent, { source });
16
+ $[1] = source;
17
+ $[2] = t1;
18
+ } else t1 = $[2];
19
+ return t1;
20
+ }
21
+
22
+ //#endregion
23
+ export { PublishedPageExperience };
@@ -22,6 +22,7 @@ declare function usePreviewedPage(): {
22
22
  customOgImageUrl: string | null;
23
23
  livePublishedCheckpointId: number | null;
24
24
  contentUpdatedAt: number;
25
+ createdById: string | null;
25
26
  createdAt: number;
26
27
  updatedAt: number;
27
28
  };
@@ -33,6 +34,9 @@ declare function usePreviewedPage(): {
33
34
  layout: {
34
35
  id: number;
35
36
  layoutId: string;
37
+ contentUpdatedAt: number;
38
+ livePublishedCheckpointId: number | null;
39
+ updatedAt: number;
36
40
  beforeBlockIds: number[];
37
41
  afterBlockIds: number[];
38
42
  } | null;