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
package/dist/lib/auth.js CHANGED
@@ -18,16 +18,6 @@ function writeServerAuthCookie(cookie) {
18
18
  }
19
19
  document.cookie = `${SERVER_AUTH_COOKIE_NAME}=${encodeURIComponent(cookie)}; Path=/; SameSite=Lax; Max-Age=2592000${secure}`;
20
20
  }
21
- function getServerAuthCookieHeader(headers) {
22
- const authCookie = (headers.get("Cookie") ?? headers.get("cookie") ?? "").split(";").map((part) => part.trim()).find((part) => part.startsWith(`${SERVER_AUTH_COOKIE_NAME}=`));
23
- if (!authCookie) return "";
24
- const value = authCookie.slice(18);
25
- try {
26
- return decodeURIComponent(value);
27
- } catch {
28
- return "";
29
- }
30
- }
31
21
  function parseSetCookieHeader(header) {
32
22
  const cookieMap = /* @__PURE__ */ new Map();
33
23
  header.split(", ").forEach((cookie) => {
@@ -160,7 +150,7 @@ function crossDomainClient(opts = {}) {
160
150
  options.credentials = getAuthRequestCredentials(cookie);
161
151
  options.headers = {
162
152
  ...options.headers,
163
- ...cookie ? { "Better-Auth-Cookie": cookie } : {}
153
+ "Better-Auth-Cookie": cookie
164
154
  };
165
155
  if (url.includes("/sign-out")) {
166
156
  await storage.setItem(cookieName, "{}");
@@ -197,55 +187,39 @@ function createCamoxAuthClient(apiUrl) {
197
187
  * Returns `true` once processing is complete (or if there was no OTT).
198
188
  */
199
189
  function useProcessOtt(authClient) {
200
- const $ = c(5);
201
- if ($[0] !== "de1e25b4541f6fe08a345d66b09411c24ed6cbe00d71d076f92227895feaae4a") {
202
- for (let $i = 0; $i < 5; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
203
- $[0] = "de1e25b4541f6fe08a345d66b09411c24ed6cbe00d71d076f92227895feaae4a";
204
- }
205
- const [ready, setReady] = React.useState(_temp);
206
- let t0;
207
- let t1;
208
- if ($[1] !== authClient || $[2] !== ready) {
209
- t0 = () => {
210
- if (ready) return;
211
- const url = new URL(window.location.href);
212
- const ott = url.searchParams.get("ott");
213
- if (!ott) {
214
- setReady(true);
190
+ const [ready, setReady] = React.useState(() => {
191
+ if (typeof window === "undefined") return true;
192
+ return !new URL(window.location.href).searchParams.has("ott");
193
+ });
194
+ React.useEffect(() => {
195
+ if (ready) return;
196
+ const url = new URL(window.location.href);
197
+ const ott = url.searchParams.get("ott");
198
+ if (!ott) {
199
+ setReady(true);
200
+ return;
201
+ }
202
+ url.searchParams.delete("ott");
203
+ window.history.replaceState({}, "", url);
204
+ (async () => {
205
+ try {
206
+ const verification = await authClient.oneTimeToken.verify({ token: ott });
207
+ if (verification.error) throw verification.error;
208
+ if (!verification.data) throw new Error("OTT verification returned no session");
209
+ window.location.reload();
215
210
  return;
216
- }
217
- url.searchParams.delete("ott");
218
- window.history.replaceState({}, "", url);
219
- (async () => {
220
- try {
221
- await authClient.oneTimeToken.verify({ token: ott });
222
- await authClient.updateSession();
223
- } catch {}
224
- setReady(true);
225
- })();
226
- };
227
- t1 = [authClient, ready];
228
- $[1] = authClient;
229
- $[2] = ready;
230
- $[3] = t0;
231
- $[4] = t1;
232
- } else {
233
- t0 = $[3];
234
- t1 = $[4];
235
- }
236
- React.useEffect(t0, t1);
211
+ } catch {}
212
+ setReady(true);
213
+ })();
214
+ }, [authClient, ready]);
237
215
  return ready;
238
216
  }
239
- function _temp() {
240
- if (typeof window === "undefined") return true;
241
- return !new URL(window.location.href).searchParams.has("ott");
242
- }
243
217
  const AuthContext = React.createContext(null);
244
218
  function useAuthContext() {
245
219
  const $ = c(1);
246
- if ($[0] !== "de1e25b4541f6fe08a345d66b09411c24ed6cbe00d71d076f92227895feaae4a") {
220
+ if ($[0] !== "96393d5626632a69960ca7e18d98e06ae87b8528faab082732a3cc7b48adfd93") {
247
221
  for (let $i = 0; $i < 1; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
248
- $[0] = "de1e25b4541f6fe08a345d66b09411c24ed6cbe00d71d076f92227895feaae4a";
222
+ $[0] = "96393d5626632a69960ca7e18d98e06ae87b8528faab082732a3cc7b48adfd93";
249
223
  }
250
224
  const ctx = React.useContext(AuthContext);
251
225
  if (!ctx) throw new Error("Missing CamoxProvider");
@@ -253,9 +227,9 @@ function useAuthContext() {
253
227
  }
254
228
  function useProjectSlug() {
255
229
  const $ = c(1);
256
- if ($[0] !== "de1e25b4541f6fe08a345d66b09411c24ed6cbe00d71d076f92227895feaae4a") {
230
+ if ($[0] !== "96393d5626632a69960ca7e18d98e06ae87b8528faab082732a3cc7b48adfd93") {
257
231
  for (let $i = 0; $i < 1; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
258
- $[0] = "de1e25b4541f6fe08a345d66b09411c24ed6cbe00d71d076f92227895feaae4a";
232
+ $[0] = "96393d5626632a69960ca7e18d98e06ae87b8528faab082732a3cc7b48adfd93";
259
233
  }
260
234
  return useAuthContext().projectSlug;
261
235
  }
@@ -269,18 +243,18 @@ function useAuthState() {
269
243
  }
270
244
  function useIsAuthenticated() {
271
245
  const $ = c(1);
272
- if ($[0] !== "de1e25b4541f6fe08a345d66b09411c24ed6cbe00d71d076f92227895feaae4a") {
246
+ if ($[0] !== "96393d5626632a69960ca7e18d98e06ae87b8528faab082732a3cc7b48adfd93") {
273
247
  for (let $i = 0; $i < 1; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
274
- $[0] = "de1e25b4541f6fe08a345d66b09411c24ed6cbe00d71d076f92227895feaae4a";
248
+ $[0] = "96393d5626632a69960ca7e18d98e06ae87b8528faab082732a3cc7b48adfd93";
275
249
  }
276
250
  const { isAuthenticated } = useAuthState();
277
251
  return isAuthenticated;
278
252
  }
279
253
  function useSignInRedirect(callbackHref) {
280
254
  const $ = c(4);
281
- if ($[0] !== "de1e25b4541f6fe08a345d66b09411c24ed6cbe00d71d076f92227895feaae4a") {
255
+ if ($[0] !== "96393d5626632a69960ca7e18d98e06ae87b8528faab082732a3cc7b48adfd93") {
282
256
  for (let $i = 0; $i < 4; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
283
- $[0] = "de1e25b4541f6fe08a345d66b09411c24ed6cbe00d71d076f92227895feaae4a";
257
+ $[0] = "96393d5626632a69960ca7e18d98e06ae87b8528faab082732a3cc7b48adfd93";
284
258
  }
285
259
  const { authenticationUrl } = useAuthContext();
286
260
  let t0;
@@ -302,9 +276,9 @@ function useSignInRedirect(callbackHref) {
302
276
  */
303
277
  function useAuthActions() {
304
278
  const $ = c(5);
305
- if ($[0] !== "de1e25b4541f6fe08a345d66b09411c24ed6cbe00d71d076f92227895feaae4a") {
279
+ if ($[0] !== "96393d5626632a69960ca7e18d98e06ae87b8528faab082732a3cc7b48adfd93") {
306
280
  for (let $i = 0; $i < 5; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
307
- $[0] = "de1e25b4541f6fe08a345d66b09411c24ed6cbe00d71d076f92227895feaae4a";
281
+ $[0] = "96393d5626632a69960ca7e18d98e06ae87b8528faab082732a3cc7b48adfd93";
308
282
  }
309
283
  const { authClient, authenticationUrl } = useAuthContext();
310
284
  let t0;
@@ -322,7 +296,7 @@ function useAuthActions() {
322
296
  "User settings"
323
297
  ],
324
298
  groupLabel: "Studio",
325
- checkIfAvailable: _temp2,
299
+ checkIfAvailable: _temp,
326
300
  execute: () => {
327
301
  window.open(`${authenticationUrl}/profile`, "_blank");
328
302
  }
@@ -331,11 +305,11 @@ function useAuthActions() {
331
305
  label: "Log out",
332
306
  aliases: ["Sign out", "Logout"],
333
307
  groupLabel: "Studio",
334
- checkIfAvailable: _temp3,
308
+ checkIfAvailable: _temp2,
335
309
  execute: () => authClient.signOut()
336
310
  }]
337
311
  });
338
- return _temp4;
312
+ return _temp3;
339
313
  };
340
314
  t1 = [authClient, authenticationUrl];
341
315
  $[1] = authClient;
@@ -348,18 +322,18 @@ function useAuthActions() {
348
322
  }
349
323
  React.useEffect(t0, t1);
350
324
  }
351
- function _temp4() {
325
+ function _temp3() {
352
326
  actionsStore.send({
353
327
  type: "unregisterManyActions",
354
328
  ids: ["manage-account", "log-out"]
355
329
  });
356
330
  }
357
- function _temp3() {
331
+ function _temp2() {
358
332
  return true;
359
333
  }
360
- function _temp2() {
334
+ function _temp() {
361
335
  return true;
362
336
  }
363
337
 
364
338
  //#endregion
365
- export { AuthContext, buildClearServerAuthCookieHeader, createCamoxAuthClient, getAuthCookieHeader, getAuthRequestCredentials, getServerAuthCookieHeader, useAuthActions, useAuthContext, useAuthState, useIsAuthenticated, useProcessOtt, useProjectSlug, useSignInRedirect };
339
+ export { AuthContext, createCamoxAuthClient, getAuthCookieHeader, getAuthRequestCredentials, useAuthActions, useAuthContext, useAuthState, useIsAuthenticated, useProcessOtt, useProjectSlug, useSignInRedirect };
@@ -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;
@@ -1,26 +1,3 @@
1
1
  import { POSTHOG_PUBLIC_KEY } from "@camox/api-contract";
2
2
 
3
- //#region src/lib/telemetry.ts
4
- let client = null;
5
- async function getClient() {
6
- if (__CAMOX_TELEMETRY_DISABLED__) return null;
7
- if (!client) {
8
- const { PostHog } = await import("posthog-node");
9
- client = new PostHog(POSTHOG_PUBLIC_KEY, { host: "https://us.i.posthog.com" });
10
- }
11
- return client;
12
- }
13
- /** Server-side tracking for page views (used in pageRoute.tsx) */
14
- async function trackEvent(event, properties) {
15
- const posthog = await getClient();
16
- if (!posthog) return;
17
- const distinctId = properties.projectId ?? "unknown";
18
- posthog.capture({
19
- distinctId,
20
- event,
21
- properties
22
- });
23
- }
24
-
25
- //#endregion
26
- export { trackEvent };
3
+ export { };
package/dist/lib/utils.js CHANGED
@@ -1,5 +1,5 @@
1
- import { Kbd } from "@camox/ui/kbd";
2
1
  import { jsxs } from "react/jsx-runtime";
2
+ import { Kbd } from "@camox/ui/kbd";
3
3
  import { INPUT_BASE_STYLES, INPUT_FOCUS_STYLES, cn } from "@camox/ui/utils";
4
4
 
5
5
  //#region src/lib/utils.tsx
@@ -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 };
@@ -0,0 +1,114 @@
1
+ import { ControlledPromise } from "./utils.js";
2
+ import { ParseRoute } from "./routeInfo.js";
3
+ import { AnyRoute, StaticDataRouteOption } from "./route.js";
4
+ import { AnyRouter, RegisteredRouter, SSROption } from "./router.js";
5
+
6
+ //#region ../../node_modules/.pnpm/@tanstack+router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/Matches.d.ts
7
+ interface DefaultRouteMatchExtensions {
8
+ scripts?: unknown;
9
+ links?: unknown;
10
+ headScripts?: unknown;
11
+ meta?: unknown;
12
+ styles?: unknown;
13
+ }
14
+ interface RouteMatchExtensions extends DefaultRouteMatchExtensions {}
15
+ interface RouteMatch<out TRouteId, out TFullPath, out TAllParams, out TFullSearchSchema, out TLoaderData, out TAllContext, out TLoaderDeps> extends RouteMatchExtensions {
16
+ id: string;
17
+ routeId: TRouteId;
18
+ fullPath: TFullPath;
19
+ index: number;
20
+ pathname: string;
21
+ params: TAllParams;
22
+ _strictParams: TAllParams;
23
+ status: 'pending' | 'success' | 'error' | 'redirected' | 'notFound';
24
+ isFetching: false | 'beforeLoad' | 'loader';
25
+ error: unknown;
26
+ paramsError: unknown;
27
+ searchError: unknown;
28
+ updatedAt: number;
29
+ _nonReactive: {
30
+ loadPromise?: ControlledPromise<void>;
31
+ displayPendingPromise?: Promise<void>;
32
+ minPendingPromise?: ControlledPromise<void>;
33
+ dehydrated?: boolean;
34
+ };
35
+ loaderData?: TLoaderData;
36
+ context: TAllContext;
37
+ search: TFullSearchSchema;
38
+ _strictSearch: TFullSearchSchema;
39
+ fetchCount: number;
40
+ abortController: AbortController;
41
+ cause: 'preload' | 'enter' | 'stay';
42
+ loaderDeps: TLoaderDeps;
43
+ preload: boolean;
44
+ invalid: boolean;
45
+ headers?: Record<string, string>;
46
+ globalNotFound?: boolean;
47
+ staticData: StaticDataRouteOption;
48
+ /** This attribute is not reactive */
49
+ ssr?: SSROption;
50
+ _forcePending?: boolean;
51
+ _displayPending?: boolean;
52
+ }
53
+ interface PreValidationErrorHandlingRouteMatch<TRouteId, TFullPath, TAllParams, TFullSearchSchema> {
54
+ id: string;
55
+ routeId: TRouteId;
56
+ fullPath: TFullPath;
57
+ index: number;
58
+ pathname: string;
59
+ search: {
60
+ status: 'success';
61
+ value: TFullSearchSchema;
62
+ } | {
63
+ status: 'error';
64
+ error: unknown;
65
+ };
66
+ params: {
67
+ status: 'success';
68
+ value: TAllParams;
69
+ } | {
70
+ status: 'error';
71
+ error: unknown;
72
+ };
73
+ staticData: StaticDataRouteOption;
74
+ ssr?: boolean | 'data-only';
75
+ }
76
+ type MakePreValidationErrorHandlingRouteMatchUnion<TRouter extends AnyRouter = RegisteredRouter, TRoute extends AnyRoute = ParseRoute<TRouter['routeTree']>> = TRoute extends any ? PreValidationErrorHandlingRouteMatch<TRoute['id'], TRoute['fullPath'], TRoute['types']['allParams'], TRoute['types']['fullSearchSchema']> : never;
77
+ type MakeRouteMatchFromRoute<TRoute extends AnyRoute> = RouteMatch<TRoute['types']['id'], TRoute['types']['fullPath'], TRoute['types']['allParams'], TRoute['types']['fullSearchSchema'], TRoute['types']['loaderData'], TRoute['types']['allContext'], TRoute['types']['loaderDeps']>;
78
+ type AnyRouteMatch = RouteMatch<any, any, any, any, any, any, any>;
79
+ type MakeRouteMatchUnion<TRouter extends AnyRouter = RegisteredRouter, TRoute extends AnyRoute = ParseRoute<TRouter['routeTree']>> = TRoute extends any ? RouteMatch<TRoute['id'], TRoute['fullPath'], TRoute['types']['allParams'], TRoute['types']['fullSearchSchema'], TRoute['types']['loaderData'], TRoute['types']['allContext'], TRoute['types']['loaderDeps']> : never;
80
+ /**
81
+ * The `MatchRouteOptions` type is used to describe the options that can be used when matching a route.
82
+ *
83
+ * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/MatchRouteOptionsType#matchrouteoptions-type)
84
+ */
85
+ interface MatchRouteOptions {
86
+ /**
87
+ * If `true`, will match against pending location instead of the current location.
88
+ *
89
+ * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/MatchRouteOptionsType#pending-property)
90
+ */
91
+ pending?: boolean;
92
+ /**
93
+ * If `true`, will match against the current location with case sensitivity.
94
+ *
95
+ * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/MatchRouteOptionsType#casesensitive-property)
96
+ *
97
+ * @deprecated Declare case sensitivity in the route definition instead, or globally for all routes using the `caseSensitive` option on the router.
98
+ */
99
+ caseSensitive?: boolean;
100
+ /**
101
+ * If `true`, will match against the current location's search params using a deep inclusive check. e.g. `{ a: 1 }` will match for a current location of `{ a: 1, b: 2 }`.
102
+ *
103
+ * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/MatchRouteOptionsType#includesearch-property)
104
+ */
105
+ includeSearch?: boolean;
106
+ /**
107
+ * If `true`, will match against the current location using a fuzzy match. e.g. `/posts` will match for a current location of `/posts/123`.
108
+ *
109
+ * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/MatchRouteOptionsType#fuzzy-property)
110
+ */
111
+ fuzzy?: boolean;
112
+ }
113
+ //#endregion
114
+ export { AnyRouteMatch, MakePreValidationErrorHandlingRouteMatchUnion, MakeRouteMatchFromRoute, MakeRouteMatchUnion, MatchRouteOptions, RouteMatch, RouteMatchExtensions };
@@ -0,0 +1,25 @@
1
+ import { NavigateOptions, ToOptions } from "./link.js";
2
+ import { RoutePaths } from "./routeInfo.js";
3
+ import { ParsedLocation } from "./location.js";
4
+ import { RegisteredRouter, ViewTransitionOptions } from "./router.js";
5
+
6
+ //#region ../../node_modules/.pnpm/@tanstack+router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/RouterProvider.d.ts
7
+ interface CommitLocationOptions {
8
+ replace?: boolean;
9
+ resetScroll?: boolean;
10
+ hashScrollIntoView?: boolean | ScrollIntoViewOptions;
11
+ viewTransition?: boolean | ViewTransitionOptions;
12
+ /**
13
+ * @deprecated All navigations use transitions under the hood now
14
+ **/
15
+ startTransition?: boolean;
16
+ ignoreBlocker?: boolean;
17
+ }
18
+ type NavigateFn = <TRouter extends RegisteredRouter, TTo extends string | undefined, TFrom extends RoutePaths<TRouter['routeTree']> | string = string, TMaskFrom extends RoutePaths<TRouter['routeTree']> | string = TFrom, TMaskTo extends string = ''>(opts: NavigateOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>) => Promise<void>;
19
+ type BuildLocationFn = <TRouter extends RegisteredRouter, TTo extends string | undefined, TFrom extends RoutePaths<TRouter['routeTree']> | string = string, TMaskFrom extends RoutePaths<TRouter['routeTree']> | string = TFrom, TMaskTo extends string = ''>(opts: ToOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo> & {
20
+ leaveParams?: boolean;
21
+ _includeValidateSearch?: boolean;
22
+ _isNavigate?: boolean;
23
+ }) => ParsedLocation;
24
+ //#endregion
25
+ export { BuildLocationFn, CommitLocationOptions, NavigateFn };
@@ -0,0 +1,20 @@
1
+ import { AnyContext, AnyPathParams, AnyRoute, UpdatableRouteOptions } from "./route.js";
2
+ import { AnyValidator } from "./validators.js";
3
+ //#region ../../node_modules/.pnpm/@tanstack+router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/fileRoute.d.ts
4
+ interface FileRouteTypes {
5
+ fileRoutesByFullPath: any;
6
+ fullPaths: any;
7
+ to: any;
8
+ fileRoutesByTo: any;
9
+ id: any;
10
+ fileRoutesById: any;
11
+ }
12
+ type InferFileRouteTypes<TRouteTree extends AnyRoute> = unknown extends TRouteTree['types']['fileRouteTypes'] ? never : TRouteTree['types']['fileRouteTypes'] extends FileRouteTypes ? TRouteTree['types']['fileRouteTypes'] : never;
13
+ type LazyRouteOptions = Pick<UpdatableRouteOptions<AnyRoute, string, string, AnyPathParams, AnyValidator, {}, AnyContext, AnyContext, AnyContext, AnyContext>, 'component' | 'errorComponent' | 'pendingComponent' | 'notFoundComponent'>;
14
+ interface LazyRoute<in out TRoute extends AnyRoute> {
15
+ options: {
16
+ id: string;
17
+ } & LazyRouteOptions;
18
+ }
19
+ //#endregion
20
+ export { FileRouteTypes, InferFileRouteTypes, LazyRoute, LazyRouteOptions };
@@ -0,0 +1,8 @@
1
+ import { AnyRouter } from "./router.js";
2
+
3
+ //#region ../../node_modules/.pnpm/@tanstack+router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/global.d.ts
4
+ declare global {
5
+ interface Window {
6
+ __TSR_ROUTER__?: AnyRouter;
7
+ }
8
+ }
@@ -0,0 +1,18 @@
1
+ import { FileRouteTypes, InferFileRouteTypes, LazyRoute, LazyRouteOptions } from "./fileRoute.js";
2
+ import { Assign, Awaitable, Constrain, ConstrainLiteral, ControlledPromise, Expand, ExtractObjects, ExtractPrimitives, IntersectAssign, IsNonEmptyObject, LooseAsyncReturnType, LooseReturnType, MakeDifferenceOptional, MergeAllPrimitive, NoInfer, NonNullableUpdater, PartialMergeAll, PartialMergeAllObject, PickAsRequired, Updater } from "./utils.js";
3
+ import { AbsoluteToPath, AddLeadingSlash, AddTrailingSlash, FindDescendantToPaths, FromPathOption, InferDescendantToPaths, IsRequiredParams, MakeOptionalPathParams, MakeOptionalSearchParams, MaskOptions, NavigateOptions, PathParamOptions, RelativeToCurrentPath, RelativeToParentPath, RelativeToPath, RelativeToPathAutoComplete, RemoveLeadingSlashes, RemoveTrailingSlashes, RequiredToOptions, ResolveCurrentPath, ResolveParentPath, ResolveRelativePath, ResolveRoute, SearchParamOptions, ToMaskOptions, ToOptions, ToPathOption, ToSubOptions, ToSubOptionsProps } from "./link.js";
4
+ import { AllParams, CodeRouteToPath, FullSearchSchema, FullSearchSchemaInput, ParseRoute, RouteById, RouteByPath, RoutePaths, RouteToPath, RoutesById, RoutesByPath, TrailingSlashOptionByRouter } from "./routeInfo.js";
5
+ import { AnyRedirect, Redirect, RedirectFnRoute, RedirectOptions, RedirectOptionsRoute } from "./redirect.js";
6
+ import { AnyRouteMatch, MakeRouteMatchFromRoute, MakeRouteMatchUnion, MatchRouteOptions, RouteMatch, RouteMatchExtensions } from "./Matches.js";
7
+ import { RootRouteId, rootRouteId } from "./root.js";
8
+ import { BuildLocationFn, CommitLocationOptions, NavigateFn } from "./RouterProvider.js";
9
+ import { RawStream, RawStreamHint, RawStreamOptions } from "./ssr/serializer/RawStream.js";
10
+ import { AnySerializationAdapter, DefaultSerializable, RegisteredSerializableInput, Serializable, SerializableExtensions, SerializationAdapter, SerializationError, SerializerExtensions, TSR_SERIALIZABLE, TsrSerializable, ValidateSerializable, ValidateSerializableInput } from "./ssr/serializer/transformer.js";
11
+ import { AnyContext, AnyPathParams, AnyRoute, BaseRouteOptions, BeforeLoadContextOptions, BeforeLoadContextParameter, ContextAsyncReturnType, ContextOptions, ContextReturnType, FileBaseRouteOptions, FilebaseRouteOptionsInterface, FullSearchSchemaOption, InferAllContext, InferAllParams, InferFullSearchSchema, InferFullSearchSchemaInput, LoaderFnContext, LoaderStaleReloadMode, MakeRemountDepsOptionsUnion, ParamsOptions, ParseParamsFn, RemountDepsOptions, ResolveAllContext, ResolveAllParamsFromParent, ResolveFullSearchSchema, ResolveFullSearchSchemaInput, ResolveLoaderData, ResolveOptionalParams, ResolveParams, ResolveRequiredParams, ResolveRouteContext, Route, RouteAddChildrenFn, RouteAddFileChildrenFn, RouteAddFileTypesFn, RouteContextOptions, RouteContextParameter, RouteExtensions, RouteLazyFn, RouteLoaderFn, RouteMask, RouteOptions, RoutePathOptions, RouteTypes, SearchFilter, SearchMiddleware, SearchMiddlewareContext, SearchSchemaInput, StaticDataRouteOption, StringifyParamsFn, TrimPathRight, UpdatableRouteOptions, UpdatableRouteOptionsExtensions, UpdatableStaticRouteOption } from "./route.js";
12
+ import { AnySchema, AnyStandardSchemaValidate, AnyStandardSchemaValidateFailure, AnyStandardSchemaValidateIssue, AnyStandardSchemaValidateSuccess, AnyStandardSchemaValidator, AnyValidator, AnyValidatorAdapter, AnyValidatorObj, DefaultValidator, ResolveSearchValidatorInput, ResolveSearchValidatorInputFn, ResolveValidatorOutput, ResolveValidatorOutputFn, StandardSchemaValidator, StandardSchemaValidatorProps, StandardSchemaValidatorTypes, Validator, ValidatorAdapter, ValidatorFn, ValidatorObj } from "./validators.js";
13
+ import { ParsedLocation } from "./location.js";
14
+ import { SearchParser, SearchSerializer } from "./searchParams.js";
15
+ import { AssetCrossOrigin, Manifest, ManifestAssetLink, RouterManagedTag } from "./manifest.js";
16
+ import { GetStoreConfig, RouterBatchFn, RouterReadableStore, RouterStores, RouterWritableStore } from "./stores.js";
17
+ import { AnyRouter, BuildNextOptions, ClearCacheFn, CommitLocationFn, DefaultRemountDepsFn, EmitFn, GetMatchFn, GetMatchRoutesFn, InvalidateFn, ListenerFn, LoadFn, LocationRewrite, LocationRewriteFunction, MatchRouteFn, MatchRoutesFn, MatchRoutesOpts, ParseLocationFn, PreloadRouteFn, Register, RegisteredRouter, RouterConstructorOptions, RouterContextOptions, RouterCore, RouterEvent, RouterEvents, RouterListener, RouterOptions, RouterOptionsExtensions, RouterState, SSROption, StartTransitionFn, SubscribeFn, TrailingSlashOption, UpdateFn, UpdateMatchFn, ViewTransitionOptions, trailingSlashOptions } from "./router.js";
18
+ import { UseNavigateResult } from "./useNavigate.js";