camox 0.34.0 → 0.36.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 (80) 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 +449 -1602
  7. package/dist/core/editing/BlockEditingRuntime.js +36 -0
  8. package/dist/core/editing/CompleteBlockEditingRuntime.js +76 -0
  9. package/dist/core/editing/createEditableBlock.d.ts +1455 -0
  10. package/dist/core/editing/createEditableBlock.js +1751 -0
  11. package/dist/core/lib/lexicalState.js +1 -1
  12. package/dist/features/agent-chat/components/AgentChatSidebar.js +1 -1
  13. package/dist/features/content/components/AssetCard.js +1 -1
  14. package/dist/features/page/PublishedPageContent.js +236 -0
  15. package/dist/features/page/PublishedPageExperience.js +23 -0
  16. package/dist/features/preview/CamoxPreview.d.ts +1 -0
  17. package/dist/features/preview/CamoxPreview.js +110 -93
  18. package/dist/features/preview/EditablePageContent.js +3 -0
  19. package/dist/features/preview/EditablePageExperience.js +24 -0
  20. package/dist/features/preview/components/AddBlockSidebar.js +3 -3
  21. package/dist/features/preview/components/AssetFieldEditor.js +1 -1
  22. package/dist/features/preview/components/AssetLightbox.js +47 -111
  23. package/dist/features/preview/components/BlockActionsPopover.js +6 -6
  24. package/dist/features/preview/components/CreatePageModal.js +4 -4
  25. package/dist/features/preview/components/DebouncedFieldEditor.js +2 -2
  26. package/dist/features/preview/components/DraftSwitchDialog.js +1 -1
  27. package/dist/features/preview/components/FieldToolbar.js +3 -3
  28. package/dist/features/preview/components/Frame.js +1 -1
  29. package/dist/features/preview/components/ItemFieldsEditor.js +3 -3
  30. package/dist/features/preview/components/LeftSidebar.js +1 -1
  31. package/dist/features/preview/components/LinkFieldEditor.js +3 -3
  32. package/dist/features/preview/components/Metadata.js +87 -0
  33. package/dist/features/preview/components/MultipleAssetFieldEditor.js +1 -1
  34. package/dist/features/preview/components/OverlayTracker.js +3 -3
  35. package/dist/features/preview/components/Overlays.js +3 -3
  36. package/dist/features/preview/components/PageEditorSidebar.js +40 -30
  37. package/dist/features/preview/components/PageInfoSidebar.js +158 -74
  38. package/dist/features/preview/components/PageLocationFieldset.js +1 -1
  39. package/dist/features/preview/components/PageNavigatorSidebar.js +244 -316
  40. package/dist/features/preview/components/PageNicknameField.js +2 -2
  41. package/dist/features/preview/components/PagePicker.js +3 -3
  42. package/dist/features/preview/components/PageTree.js +3 -3
  43. package/dist/features/preview/components/PeekedBlock.js +2 -2
  44. package/dist/features/preview/components/PreviewPanel.js +2 -2
  45. package/dist/features/preview/components/PreviewToolbar.js +77 -51
  46. package/dist/features/preview/components/PublishDialog.js +2 -2
  47. package/dist/features/preview/components/RepeatableItemsList.js +1 -1
  48. package/dist/features/preview/components/RightSidebar.js +1 -1
  49. package/dist/features/preview/components/useRepeatableItemActions.js +1 -1
  50. package/dist/features/preview/components/useUpdateBlockPosition.js +1 -1
  51. package/dist/features/preview/previewStore.js +13 -6
  52. package/dist/features/provider/AuthenticatedCamoxProvider.js +63 -0
  53. package/dist/features/provider/CamoxProvider.d.ts +5 -12
  54. package/dist/features/provider/CamoxProvider.js +80 -338
  55. package/dist/features/provider/CoreCamoxProvider.js +37 -0
  56. package/dist/features/provider/LocalhostPreviewProvider.js +159 -0
  57. package/dist/features/provider/components/CommandPalette.js +1 -1
  58. package/dist/features/provider/useAdminShortcuts.js +1 -1
  59. package/dist/features/runtime/hydrationData.js +9 -0
  60. package/dist/features/runtime/pageApp.js +148 -35
  61. package/dist/features/runtime/pageClient.d.ts +1 -2
  62. package/dist/features/runtime/pageClient.js +3 -20
  63. package/dist/features/runtime/runtime.d.ts +1 -0
  64. package/dist/features/runtime/studioApp.js +76 -8
  65. package/dist/features/runtime/studioClient.d.ts +6 -0
  66. package/dist/features/runtime/studioClient.js +20 -0
  67. package/dist/features/runtime/studioNavigation.js +7 -2
  68. package/dist/features/studio/CamoxStudio.js +1 -1
  69. package/dist/features/studio/components/EnvironmentMenu.js +2 -2
  70. package/dist/features/studio/components/Navbar.js +5 -5
  71. package/dist/features/studio/components/ProjectMenu.js +5 -5
  72. package/dist/features/studio/useTheme.js +1 -22
  73. package/dist/features/vite/runtimeDev.js +24 -3
  74. package/dist/features/vite/vite.d.ts +1 -1
  75. package/dist/features/vite/vite.js +9 -3
  76. package/dist/lib/normalized-data.js +6 -6
  77. package/dist/lib/telemetry-client.js +2 -2
  78. package/dist/lib/view-queries.js +28 -0
  79. package/dist/studio.css +1 -1
  80. package/package.json +9 -4
@@ -19,6 +19,10 @@ const VIRTUAL_PAGE_CLIENT = "virtual:camox/page-client";
19
19
  const RESOLVED_VIRTUAL_PAGE_CLIENT = "\0" + VIRTUAL_PAGE_CLIENT;
20
20
  const VIRTUAL_PAGE_CLIENT_URL = "virtual:camox/page-client-url";
21
21
  const RESOLVED_VIRTUAL_PAGE_CLIENT_URL = "\0" + VIRTUAL_PAGE_CLIENT_URL;
22
+ const VIRTUAL_STUDIO_CLIENT = "virtual:camox/studio-client";
23
+ const RESOLVED_VIRTUAL_STUDIO_CLIENT = "\0" + VIRTUAL_STUDIO_CLIENT;
24
+ const VIRTUAL_STUDIO_CLIENT_URL = "virtual:camox/studio-client-url";
25
+ const RESOLVED_VIRTUAL_STUDIO_CLIENT_URL = "\0" + VIRTUAL_STUDIO_CLIENT_URL;
22
26
  const VIRTUAL_APP_STYLESHEET_URL = "virtual:camox/app-stylesheet-url";
23
27
  const RESOLVED_VIRTUAL_APP_STYLESHEET_URL = "\0" + VIRTUAL_APP_STYLESHEET_URL;
24
28
  const VIRTUAL_STUDIO_CSS = "virtual:camox-studio-css";
@@ -56,6 +60,7 @@ function resolveCamoxSourceImport(id) {
56
60
  "camox/navigation": resolve(sdkRoot, "src/features/navigation/navigation.tsx"),
57
61
  "camox/_internal/pageServer": resolve(sdkRoot, "src/features/runtime/pageServer.tsx"),
58
62
  "camox/_internal/pageClient": resolve(sdkRoot, "src/features/runtime/pageClient.tsx"),
63
+ "camox/_internal/studioClient": resolve(sdkRoot, "src/features/runtime/studioClient.tsx"),
59
64
  "camox/_internal/studioServer": resolve(sdkRoot, "src/features/runtime/studioServer.tsx"),
60
65
  "camox/_internal/runtime": resolve(sdkRoot, "src/features/runtime/runtime.ts")
61
66
  }[id];
@@ -106,10 +111,17 @@ export async function renderStudio(input) {
106
111
  `;
107
112
  }
108
113
  function generateVirtualPageClient() {
109
- return `import { hydrateRuntimeWithApp } from "camox/_internal/pageClient";
114
+ return `import { hydratePageWithApp } from "camox/_internal/pageClient";
110
115
  import { camoxApp } from "virtual:camox/app";
111
116
 
112
- hydrateRuntimeWithApp(camoxApp);
117
+ hydratePageWithApp(camoxApp);
118
+ `;
119
+ }
120
+ function generateVirtualStudioClient() {
121
+ return `import { hydrateStudioWithApp } from "camox/_internal/studioClient";
122
+ import { camoxApp } from "virtual:camox/app";
123
+
124
+ hydrateStudioWithApp(camoxApp);
113
125
  `;
114
126
  }
115
127
  function wrapViteDevId(id) {
@@ -118,6 +130,9 @@ function wrapViteDevId(id) {
118
130
  function generateVirtualPageClientUrl() {
119
131
  return `export default ${JSON.stringify(wrapViteDevId(RESOLVED_VIRTUAL_PAGE_CLIENT))};`;
120
132
  }
133
+ function generateVirtualStudioClientUrl() {
134
+ return `export default ${JSON.stringify(wrapViteDevId(RESOLVED_VIRTUAL_STUDIO_CLIENT))};`;
135
+ }
121
136
  function generateVirtualAppStylesheetUrl() {
122
137
  return `import stylesheetUrl from "/src/styles.css?url";
123
138
 
@@ -130,6 +145,7 @@ import { camoxApp } from "virtual:camox/app";
130
145
  import { camoxDocument } from "virtual:camox/document";
131
146
  import appStylesheetUrl from "virtual:camox/app-stylesheet-url";
132
147
  import pageClientEntryUrl from "virtual:camox/page-client-url";
148
+ import studioClientEntryUrl from "virtual:camox/studio-client-url";
133
149
  import { renderPage } from "virtual:camox/page-server";
134
150
  import { renderStudio } from "virtual:camox/studio-server";
135
151
 
@@ -137,7 +153,8 @@ export async function handleCamoxRequest(request) {
137
153
  return handleRuntimeRequest(request, {
138
154
  apiUrl: __CAMOX_API_URL__,
139
155
  authenticationUrl: __CAMOX_AUTHENTICATION_URL__,
140
- clientEntryUrl: pageClientEntryUrl,
156
+ pageClientEntryUrl,
157
+ studioClientEntryUrl,
141
158
  environmentName: __CAMOX_ENVIRONMENT_NAME__,
142
159
  getCamoxApp: async () => camoxApp,
143
160
  getDocument: async () => camoxDocument,
@@ -228,6 +245,8 @@ function resolveRuntimeDevId(id, importer) {
228
245
  if (id === VIRTUAL_STUDIO_SERVER) return RESOLVED_VIRTUAL_STUDIO_SERVER;
229
246
  if (id === VIRTUAL_PAGE_CLIENT) return RESOLVED_VIRTUAL_PAGE_CLIENT;
230
247
  if (id === VIRTUAL_PAGE_CLIENT_URL) return RESOLVED_VIRTUAL_PAGE_CLIENT_URL;
248
+ if (id === VIRTUAL_STUDIO_CLIENT) return RESOLVED_VIRTUAL_STUDIO_CLIENT;
249
+ if (id === VIRTUAL_STUDIO_CLIENT_URL) return RESOLVED_VIRTUAL_STUDIO_CLIENT_URL;
231
250
  if (id === VIRTUAL_APP_STYLESHEET_URL) return RESOLVED_VIRTUAL_APP_STYLESHEET_URL;
232
251
  if (id === VIRTUAL_STUDIO_CSS) return RESOLVED_VIRTUAL_STUDIO_CSS;
233
252
  if (id === VIRTUAL_OVERLAY_CSS) return RESOLVED_VIRTUAL_OVERLAY_CSS;
@@ -241,6 +260,8 @@ function loadRuntimeDevModule(id, options = {}) {
241
260
  if (id === RESOLVED_VIRTUAL_STUDIO_SERVER) return generateVirtualStudioServer();
242
261
  if (id === RESOLVED_VIRTUAL_PAGE_CLIENT) return generateVirtualPageClient();
243
262
  if (id === RESOLVED_VIRTUAL_PAGE_CLIENT_URL) return generateVirtualPageClientUrl();
263
+ if (id === RESOLVED_VIRTUAL_STUDIO_CLIENT) return generateVirtualStudioClient();
264
+ if (id === RESOLVED_VIRTUAL_STUDIO_CLIENT_URL) return generateVirtualStudioClientUrl();
244
265
  if (id === RESOLVED_VIRTUAL_APP_STYLESHEET_URL) return generateVirtualAppStylesheetUrl();
245
266
  if (id === RESOLVED_VIRTUAL_STUDIO_CSS) return `export default "/@fs/${resolve(sdkRoot, "dist/studio.css")}";`;
246
267
  if (id === RESOLVED_VIRTUAL_OVERLAY_CSS) return `export default ${JSON.stringify(readFileSync(resolve(sdkRoot, "dist/studio-overlays.css"), "utf-8"))};`;
@@ -28,7 +28,7 @@ interface CamoxPluginOptions {
28
28
  disableTelemetry?: boolean;
29
29
  /** Internal options (intended for Camox contributors in development, not for public use) */
30
30
  _internal?: {
31
- /** URL of the Camox API backend, used for data fetching */apiUrl?: string; /** URL of the Camox authentication backend (default: https://app.camox.ai) */
31
+ /** URL of the Camox API backend, used for data fetching */apiUrl?: string; /** URL of the Camox authentication backend (default: https://app.camox.dev) */
32
32
  authenticationUrl?: string; /** Show Tanstack query devtools (default: false) */
33
33
  enableTanstackDevtools?: boolean; /** Disable automatic code generation (route files, app file, skill files) (default: false) */
34
34
  disableCodeGen?: boolean; /** Mount the Camox-owned dev runtime at this base path. Use "/" for root mode. */
@@ -19,9 +19,11 @@ const VIRTUAL_OVERLAY_CSS = "virtual:camox-overlay-css";
19
19
  const RESOLVED_VIRTUAL_OVERLAY_CSS = "\0" + VIRTUAL_OVERLAY_CSS;
20
20
  const VIRTUAL_PAGE_CLIENT = "virtual:camox/page-client";
21
21
  const RESOLVED_VIRTUAL_PAGE_CLIENT_URL = "\0virtual:camox/page-client-url";
22
- const PRODUCTION_API_URL = "https://api.camox.ai";
22
+ const VIRTUAL_STUDIO_CLIENT = "virtual:camox/studio-client";
23
+ const RESOLVED_VIRTUAL_STUDIO_CLIENT_URL = "\0virtual:camox/studio-client-url";
24
+ const PRODUCTION_API_URL = "https://api.camox.dev";
23
25
  /** Authentication URL to use for Camox authentication (production Camox Dashboard) */
24
- const DEFAULT_AUTHENTICATION_URL = "https://app.camox.ai";
26
+ const DEFAULT_AUTHENTICATION_URL = "https://app.camox.dev";
25
27
  const authTokenSchema = z.object({
26
28
  token: z.string(),
27
29
  name: z.string(),
@@ -97,6 +99,7 @@ function camox(options) {
97
99
  return `export default ${JSON.stringify(css)};`;
98
100
  }
99
101
  if (id === RESOLVED_VIRTUAL_PAGE_CLIENT_URL && isBuild) return "export default \"/_chunks/camox-page-client.mjs\";";
102
+ if (id === RESOLVED_VIRTUAL_STUDIO_CLIENT_URL && isBuild) return "export default \"/_chunks/camox-studio-client.mjs\";";
100
103
  return loadRuntimeDevModule(id, { runtimeBasePath });
101
104
  },
102
105
  nitro: { setup(nitro) {
@@ -121,7 +124,10 @@ function camox(options) {
121
124
  __CAMOX_PROJECT_SLUG__: JSON.stringify(options.projectSlug)
122
125
  },
123
126
  environments: { client: { build: { rollupOptions: {
124
- input: { "camox-page-client": VIRTUAL_PAGE_CLIENT },
127
+ input: {
128
+ "camox-page-client": VIRTUAL_PAGE_CLIENT,
129
+ "camox-studio-client": VIRTUAL_STUDIO_CLIENT
130
+ },
125
131
  output: {
126
132
  assetFileNames: "assets/[name]-[hash][extname]",
127
133
  chunkFileNames: "_chunks/[name]-[hash].mjs",
@@ -1,4 +1,4 @@
1
- import { blockQueries } from "./queries.js";
1
+ import { viewBlockQueries } from "./view-queries.js";
2
2
  import { c } from "react/compiler-runtime";
3
3
  import { useQueries } from "@tanstack/react-query";
4
4
  import * as React from "react";
@@ -11,9 +11,9 @@ const NormalizedDataContext = React.createContext({
11
11
  });
12
12
  const NormalizedDataProvider = (t0) => {
13
13
  const $ = c(13);
14
- if ($[0] !== "08bed558b0a428c072e8a0761d5efbb6bd49b29518144153bf64ed61004f9dda") {
14
+ if ($[0] !== "9680f54d18eb424030716d5c43a9901462a27cc0d8227fb40b5d6abb9b464a89") {
15
15
  for (let $i = 0; $i < 13; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
16
- $[0] = "08bed558b0a428c072e8a0761d5efbb6bd49b29518144153bf64ed61004f9dda";
16
+ $[0] = "9680f54d18eb424030716d5c43a9901462a27cc0d8227fb40b5d6abb9b464a89";
17
17
  }
18
18
  const { files, repeatableItems, children } = t0;
19
19
  let t1;
@@ -74,9 +74,9 @@ function useStableArray(next) {
74
74
  }
75
75
  function usePageBlocks(pageStructure, t0) {
76
76
  const $ = c(37);
77
- if ($[0] !== "08bed558b0a428c072e8a0761d5efbb6bd49b29518144153bf64ed61004f9dda") {
77
+ if ($[0] !== "9680f54d18eb424030716d5c43a9901462a27cc0d8227fb40b5d6abb9b464a89") {
78
78
  for (let $i = 0; $i < 37; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
79
- $[0] = "08bed558b0a428c072e8a0761d5efbb6bd49b29518144153bf64ed61004f9dda";
79
+ $[0] = "9680f54d18eb424030716d5c43a9901462a27cc0d8227fb40b5d6abb9b464a89";
80
80
  }
81
81
  const source = t0 === void 0 ? "draft" : t0;
82
82
  const blockIds = pageStructure.page.blockIds;
@@ -97,7 +97,7 @@ function usePageBlocks(pageStructure, t0) {
97
97
  const allIds = t1;
98
98
  let t2;
99
99
  if ($[5] !== allIds || $[6] !== source) {
100
- t2 = { queries: allIds.map((id) => blockQueries.get(id, source)) };
100
+ t2 = { queries: allIds.map((id) => viewBlockQueries.get(id, source)) };
101
101
  $[5] = allIds;
102
102
  $[6] = source;
103
103
  $[7] = t2;
@@ -8,7 +8,7 @@ function ensureInitialized() {
8
8
  if (typeof window === "undefined") return false;
9
9
  if (initialized) return true;
10
10
  posthog.init(POSTHOG_PUBLIC_KEY, {
11
- api_host: "https://t.camox.ai",
11
+ api_host: "https://t.camox.dev",
12
12
  ui_host: "https://us.posthog.com",
13
13
  defaults: "2026-01-30",
14
14
  autocapture: false,
@@ -56,7 +56,7 @@ function identifyProject(options) {
56
56
  slug: options.projectSlug
57
57
  });
58
58
  }
59
- /** Client-side tracking for CMS actions. Events route through t.camox.ai reverse proxy. */
59
+ /** Client-side tracking for CMS actions. Events route through t.camox.dev reverse proxy. */
60
60
  function trackClientEvent(event, properties) {
61
61
  if (!ensureInitialized()) return;
62
62
  posthog.capture(event, properties);
@@ -0,0 +1,28 @@
1
+ import { getOrpc } from "./api-client.js";
2
+ import { queryKeys } from "@camox/api-contract/query-keys";
3
+
4
+ //#region src/lib/view-queries.ts
5
+ const viewPageQueries = { list: (projectId) => ({
6
+ ...getOrpc().pages.list.queryOptions({
7
+ input: { projectId },
8
+ staleTime: Infinity
9
+ }),
10
+ queryKey: queryKeys.pages.list
11
+ }) };
12
+ const viewProjectQueries = { getBySlug: (slug) => ({ ...getOrpc().projects.getBySlug.queryOptions({
13
+ input: { slug },
14
+ staleTime: Infinity
15
+ }) }) };
16
+ const viewBlockQueries = { get: (id, source) => ({
17
+ ...getOrpc().blocks.get.queryOptions({
18
+ input: {
19
+ id,
20
+ source
21
+ },
22
+ staleTime: Infinity
23
+ }),
24
+ queryKey: queryKeys.blocks.get(id, source)
25
+ }) };
26
+
27
+ //#endregion
28
+ export { viewBlockQueries, viewPageQueries, viewProjectQueries };