camox 0.33.0 → 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.
Files changed (100) hide show
  1. package/dist/components/AuthGate.js +5 -4
  2. package/dist/core/createBlock.js +19 -19
  3. package/dist/core/defineDocument.d.ts +7 -0
  4. package/dist/core/defineDocument.js +7 -0
  5. package/dist/features/agent-chat/components/AgentChatSidebar.js +3 -3
  6. package/dist/features/agent-chat/components/AgentChatThread.js +10 -11
  7. package/dist/features/navigation/navigation.d.ts +39 -0
  8. package/dist/features/navigation/navigation.js +231 -0
  9. package/dist/features/preview/CamoxPreview.d.ts +3 -0
  10. package/dist/features/preview/CamoxPreview.js +12 -12
  11. package/dist/features/preview/components/AddBlockSidebar.js +4 -4
  12. package/dist/features/preview/components/AssetLightbox.js +10 -9
  13. package/dist/features/preview/components/CreatePageModal.js +3 -3
  14. package/dist/features/preview/components/FieldToolbar.js +1 -1
  15. package/dist/features/preview/components/PageInfoSidebar.js +23 -23
  16. package/dist/features/preview/components/PageNavigatorSidebar.js +6 -6
  17. package/dist/features/preview/components/PagePicker.js +1 -1
  18. package/dist/features/preview/components/PreviewToolbar.js +3 -3
  19. package/dist/features/preview/components/useUpdateBlockPosition.js +3 -3
  20. package/dist/features/provider/CamoxProvider.js +10 -8
  21. package/dist/features/routes/pageRuntime.js +6 -0
  22. package/dist/features/runtime/pageApp.js +75 -0
  23. package/dist/features/runtime/pageClient.d.ts +7 -0
  24. package/dist/features/runtime/pageClient.js +37 -0
  25. package/dist/features/runtime/pageNavigation.js +170 -0
  26. package/dist/features/runtime/pageServer.d.ts +9 -0
  27. package/dist/features/runtime/pageServer.js +18 -0
  28. package/dist/features/runtime/runtime.d.ts +24 -0
  29. package/dist/features/runtime/runtime.js +44 -0
  30. package/dist/features/runtime/studioApp.d.ts +15 -0
  31. package/dist/features/runtime/studioApp.js +117 -0
  32. package/dist/features/runtime/studioNavigation.js +115 -0
  33. package/dist/features/runtime/studioServer.d.ts +9 -0
  34. package/dist/features/runtime/studioServer.js +18 -0
  35. package/dist/features/studio/CamoxStudio.js +3 -3
  36. package/dist/features/studio/components/Navbar.js +7 -7
  37. package/dist/features/studio/components/ProjectMenu.js +9 -9
  38. package/dist/features/studio/components/UserButton.js +3 -3
  39. package/dist/features/vite/appGeneration.js +16 -5
  40. package/dist/features/vite/blockBoilerplate.js +1 -1
  41. package/dist/features/vite/definitionsSync.js +4 -4
  42. package/dist/features/vite/routeGeneration.js +9 -156
  43. package/dist/features/vite/runtimeDev.js +270 -0
  44. package/dist/features/vite/utils.js +3 -1
  45. package/dist/features/vite/vite.d.ts +22 -3
  46. package/dist/features/vite/vite.js +36 -19
  47. package/dist/hooks/use-file-upload.js +3 -1
  48. package/dist/lib/api-client.js +6 -3
  49. package/dist/lib/auth.js +45 -68
  50. package/dist/lib/queries.js +6 -4
  51. package/dist/lib/telemetry.js +1 -24
  52. package/dist/lib/utils.js +1 -1
  53. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/Matches.d.ts +114 -0
  54. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/RouterProvider.d.ts +25 -0
  55. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/config.d.ts +1 -0
  56. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/defer.d.ts +1 -0
  57. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/fileRoute.d.ts +20 -0
  58. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/global.d.ts +8 -0
  59. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/hash-scroll.d.ts +1 -0
  60. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/index.d.ts +18 -0
  61. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/link.d.ts +161 -0
  62. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/load-matches.d.ts +6 -0
  63. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/location.d.ts +54 -0
  64. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/lru-cache.d.ts +8 -0
  65. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/manifest.d.ts +32 -0
  66. 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
  67. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/not-found.d.ts +1 -0
  68. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/redirect.d.ts +49 -0
  69. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/rewrite.d.ts +1 -0
  70. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/root.d.ts +6 -0
  71. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/route.d.ts +343 -0
  72. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/routeInfo.d.ts +48 -0
  73. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/router.d.ts +695 -0
  74. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/scroll-restoration.d.ts +1 -0
  75. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/searchMiddleware.d.ts +1 -0
  76. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/searchParams.d.ts +5 -0
  77. 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
  78. 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
  79. 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
  80. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/stores.d.ts +69 -0
  81. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/structuralSharing.d.ts +1 -0
  82. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/typePrimitives.d.ts +1 -0
  83. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/useLoaderData.d.ts +1 -0
  84. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/useLoaderDeps.d.ts +1 -0
  85. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/useNavigate.d.ts +10 -0
  86. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/useParams.d.ts +1 -0
  87. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/useRouteContext.d.ts +1 -0
  88. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/useSearch.d.ts +1 -0
  89. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/utils.d.ts +28 -0
  90. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/validators.d.ts +49 -0
  91. package/package.json +34 -12
  92. package/skills/camox-block/SKILL.md +4 -4
  93. package/skills/camox-cli/SKILL.md +3 -3
  94. package/skills/camox-layout/SKILL.md +2 -2
  95. package/dist/features/routes/ogRoute.d.ts +0 -12
  96. package/dist/features/routes/ogRoute.js +0 -20
  97. package/dist/features/routes/pageRoute.d.ts +0 -48
  98. package/dist/features/routes/pageRoute.js +0 -254
  99. package/dist/lib/api-client.d.ts +0 -7
  100. package/dist/lib/queries.d.ts +0 -12
@@ -0,0 +1,5 @@
1
+ //#region ../../node_modules/.pnpm/@tanstack+router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/searchParams.d.ts
2
+ type SearchSerializer = (searchObj: Record<string, any>) => string;
3
+ type SearchParser = (searchStr: string) => Record<string, any>;
4
+ //#endregion
5
+ export { SearchParser, SearchSerializer };
@@ -0,0 +1,38 @@
1
+ //#region ../../node_modules/.pnpm/@tanstack+router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/ssr/serializer/RawStream.d.ts
2
+ /**
3
+ * Hint for RawStream encoding strategy during SSR serialization.
4
+ * - 'binary': Always use base64 encoding (best for binary data like files, images)
5
+ * - 'text': Try UTF-8 first, fallback to base64 (best for text-heavy data like RSC payloads)
6
+ */
7
+ type RawStreamHint = 'binary' | 'text';
8
+ /**
9
+ * Options for RawStream configuration.
10
+ */
11
+ interface RawStreamOptions {
12
+ /**
13
+ * Encoding hint for SSR serialization.
14
+ * - 'binary' (default): Always use base64 encoding
15
+ * - 'text': Try UTF-8 first, fallback to base64 for invalid UTF-8 chunks
16
+ */
17
+ hint?: RawStreamHint;
18
+ }
19
+ /**
20
+ * Marker class for ReadableStream<Uint8Array> that should be serialized
21
+ * with base64 encoding (SSR) or binary framing (server functions).
22
+ *
23
+ * Wrap your binary streams with this to get efficient serialization:
24
+ * ```ts
25
+ * // For binary data (files, images, etc.)
26
+ * return { data: new RawStream(file.stream()) }
27
+ *
28
+ * // For text-heavy data (RSC payloads, etc.)
29
+ * return { data: new RawStream(rscStream, { hint: 'text' }) }
30
+ * ```
31
+ */
32
+ declare class RawStream {
33
+ readonly stream: ReadableStream<Uint8Array>;
34
+ readonly hint: RawStreamHint;
35
+ constructor(stream: ReadableStream<Uint8Array>, options?: RawStreamOptions);
36
+ }
37
+ //#endregion
38
+ export { RawStream, RawStreamHint, RawStreamOptions };
@@ -0,0 +1,65 @@
1
+ import { LooseReturnType } from "../../utils.js";
2
+ import { RawStream } from "./RawStream.js";
3
+ import { AnyRoute, ResolveAllSSR } from "../../route.js";
4
+ import { RegisteredConfigType, RegisteredSsr, SSROption } from "../../router.js";
5
+ //#region ../../node_modules/.pnpm/@tanstack+router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/ssr/serializer/transformer.d.ts
6
+ declare const TSR_SERIALIZABLE: unique symbol;
7
+ type TSR_SERIALIZABLE = typeof TSR_SERIALIZABLE;
8
+ type TsrSerializable = {
9
+ [TSR_SERIALIZABLE]: true;
10
+ };
11
+ interface DefaultSerializable {
12
+ number: number;
13
+ string: string;
14
+ boolean: boolean;
15
+ null: null;
16
+ undefined: undefined;
17
+ bigint: bigint;
18
+ Date: Date;
19
+ Uint8Array: Uint8Array;
20
+ RawStream: RawStream;
21
+ TsrSerializable: TsrSerializable;
22
+ void: void;
23
+ }
24
+ interface SerializableExtensions extends DefaultSerializable {}
25
+ type Serializable = SerializableExtensions[keyof SerializableExtensions];
26
+ type UnionizeSerializationAdaptersInput<TAdapters extends ReadonlyArray<AnySerializationAdapter>> = TAdapters[number]['~types']['input'];
27
+ type ValidateSerializable<T, TSerializable> = T extends TSerializable ? T : T extends ((...args: Array<any>) => any) ? SerializationError<'Function may not be serializable'> : T extends RegisteredReadableStream ? SerializationError<'JSX is not be serializable'> : T extends ReadonlyArray<any> ? ValidateSerializableArray<T, TSerializable> : T extends Promise<any> ? ValidateSerializablePromise<T, TSerializable> : T extends ReadableStream<any> ? ValidateReadableStream<T, TSerializable> : T extends Set<any> ? ValidateSerializableSet<T, TSerializable> : T extends Map<any, any> ? ValidateSerializableMap<T, TSerializable> : T extends AsyncGenerator<any, any> ? ValidateSerializableAsyncGenerator<T, TSerializable> : T extends object ? ValidateSerializableMapped<T, TSerializable> : SerializationError<'Type may not be serializable'>;
28
+ type ValidateSerializableAsyncGenerator<T, TSerializable> = T extends AsyncGenerator<infer T, infer TReturn, infer TNext> ? AsyncGenerator<ValidateSerializable<T, TSerializable>, ValidateSerializable<TReturn, TSerializable>, TNext> : never;
29
+ type ValidateSerializablePromise<T, TSerializable> = T extends Promise<infer TAwaited> ? Promise<ValidateSerializable<TAwaited, TSerializable>> : never;
30
+ type ValidateReadableStream<T, TSerializable> = T extends ReadableStream<infer TStreamed> ? ReadableStream<ValidateSerializable<TStreamed, TSerializable>> : never;
31
+ type ValidateSerializableSet<T, TSerializable> = T extends Set<infer TItem> ? Set<ValidateSerializable<TItem, TSerializable>> : never;
32
+ type ValidateSerializableMap<T, TSerializable> = T extends Map<infer TKey, infer TValue> ? Map<ValidateSerializable<TKey, TSerializable>, ValidateSerializable<TValue, TSerializable>> : never;
33
+ type ValidateSerializableArray<T, TSerializable> = T extends readonly [any, ...Array<any>] ? ValidateSerializableMapped<T, TSerializable> : T extends Array<infer U> ? Array<ValidateSerializable<U, TSerializable>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<ValidateSerializable<U, TSerializable>> : never;
34
+ type ValidateSerializableMapped<T, TSerializable> = { [K in keyof T]: ValidateSerializable<T[K], TSerializable> };
35
+ declare const SERIALIZATION_ERROR: unique symbol;
36
+ interface SerializationError<in out TMessage extends string> {
37
+ [SERIALIZATION_ERROR]: TMessage;
38
+ }
39
+ interface SerializationAdapter<TInput, TOutput, TExtendsAdapters extends ReadonlyArray<AnySerializationAdapter>> {
40
+ '~types': SerializationAdapterTypes<TInput, TOutput, TExtendsAdapters>;
41
+ key: string;
42
+ extends?: TExtendsAdapters;
43
+ test: (value: unknown) => value is TInput;
44
+ toSerializable: (value: TInput) => TOutput;
45
+ fromSerializable: (value: TOutput) => TInput;
46
+ }
47
+ interface SerializationAdapterTypes<TInput, TOutput, TExtendsAdapters extends ReadonlyArray<AnySerializationAdapter>> {
48
+ input: TInput | UnionizeSerializationAdaptersInput<TExtendsAdapters>;
49
+ output: TOutput;
50
+ extends: TExtendsAdapters;
51
+ }
52
+ type AnySerializationAdapter = SerializationAdapter<any, any, any>;
53
+ type ValidateSerializableInput<TRegister, T> = ValidateSerializable<T, RegisteredSerializableInput<TRegister>>;
54
+ type RegisteredSerializableInput<TRegister> = (unknown extends RegisteredSerializationAdapters<TRegister> ? never : RegisteredSerializationAdapters<TRegister> extends ReadonlyArray<AnySerializationAdapter> ? RegisteredSerializationAdapters<TRegister>[number]['~types']['input'] : never) | Serializable;
55
+ type RegisteredSerializationAdapters<TRegister> = RegisteredConfigType<TRegister, 'serializationAdapters'>;
56
+ type RegisteredSSROption<TRegister> = unknown extends RegisteredConfigType<TRegister, 'defaultSsr'> ? SSROption : RegisteredConfigType<TRegister, 'defaultSsr'>;
57
+ type ValidateSerializableLifecycleResult<TRegister, TParentRoute extends AnyRoute, TSSR, TFn> = false extends RegisteredSsr<TRegister> ? any : ValidateSerializableLifecycleResultSSR<TRegister, TParentRoute, TSSR, TFn> extends infer TInput ? TInput : never;
58
+ type ValidateSerializableLifecycleResultSSR<TRegister, TParentRoute extends AnyRoute, TSSR, TFn> = ResolveAllSSR<TParentRoute, TSSR> extends false ? any : RegisteredSSROption<TRegister> extends false ? any : ValidateSerializableInput<TRegister, LooseReturnType<TFn>>;
59
+ type RegisteredReadableStream = unknown extends SerializerExtensions['ReadableStream'] ? never : SerializerExtensions['ReadableStream'];
60
+ interface DefaultSerializerExtensions {
61
+ ReadableStream: unknown;
62
+ }
63
+ interface SerializerExtensions extends DefaultSerializerExtensions {}
64
+ //#endregion
65
+ export { AnySerializationAdapter, DefaultSerializable, RegisteredSerializableInput, Serializable, SerializableExtensions, SerializationAdapter, SerializationError, SerializerExtensions, TSR_SERIALIZABLE, TsrSerializable, ValidateSerializable, ValidateSerializableInput, ValidateSerializableLifecycleResult };
@@ -0,0 +1,69 @@
1
+ import { FullSearchSchema } from "./routeInfo.js";
2
+ import { AnyRedirect } from "./redirect.js";
3
+ import { AnyRouteMatch } from "./Matches.js";
4
+ import { AnyRoute } from "./route.js";
5
+ import { ParsedLocation } from "./location.js";
6
+ import { RouterState } from "./router.js";
7
+
8
+ //#region ../../node_modules/.pnpm/@tanstack+router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/stores.d.ts
9
+ interface RouterReadableStore<TValue> {
10
+ get: () => TValue;
11
+ }
12
+ interface RouterWritableStore<TValue> extends RouterReadableStore<TValue> {
13
+ set: ((updater: (prev: TValue) => TValue) => void) & ((value: TValue) => void);
14
+ }
15
+ type RouterBatchFn = (fn: () => void) => void;
16
+ type MutableStoreFactory = <TValue>(initialValue: TValue) => RouterWritableStore<TValue>;
17
+ type ReadonlyStoreFactory = <TValue>(read: () => TValue) => RouterReadableStore<TValue>;
18
+ type GetStoreConfig = (opts: {
19
+ isServer?: boolean;
20
+ }) => StoreConfig;
21
+ type StoreConfig = {
22
+ createMutableStore: MutableStoreFactory;
23
+ createReadonlyStore: ReadonlyStoreFactory;
24
+ batch: RouterBatchFn;
25
+ init?: (stores: RouterStores<AnyRoute>) => void;
26
+ };
27
+ type MatchStore = RouterWritableStore<AnyRouteMatch> & {
28
+ routeId?: string;
29
+ };
30
+ type ReadableStore<TValue> = RouterReadableStore<TValue>;
31
+ /** SSR non-reactive createMutableStore */
32
+ interface RouterStores<in out TRouteTree extends AnyRoute> {
33
+ status: RouterWritableStore<RouterState<TRouteTree>['status']>;
34
+ loadedAt: RouterWritableStore<number>;
35
+ isLoading: RouterWritableStore<boolean>;
36
+ isTransitioning: RouterWritableStore<boolean>;
37
+ location: RouterWritableStore<ParsedLocation<FullSearchSchema<TRouteTree>>>;
38
+ resolvedLocation: RouterWritableStore<ParsedLocation<FullSearchSchema<TRouteTree>> | undefined>;
39
+ statusCode: RouterWritableStore<number>;
40
+ redirect: RouterWritableStore<AnyRedirect | undefined>;
41
+ matchesId: RouterWritableStore<Array<string>>;
42
+ pendingIds: RouterWritableStore<Array<string>>;
43
+ matches: ReadableStore<Array<AnyRouteMatch>>;
44
+ pendingMatches: ReadableStore<Array<AnyRouteMatch>>;
45
+ cachedMatches: ReadableStore<Array<AnyRouteMatch>>;
46
+ firstId: ReadableStore<string | undefined>;
47
+ hasPending: ReadableStore<boolean>;
48
+ matchRouteDeps: ReadableStore<{
49
+ locationHref: string;
50
+ resolvedLocationHref: string | undefined;
51
+ status: RouterState<TRouteTree>['status'];
52
+ }>;
53
+ __store: RouterReadableStore<RouterState<TRouteTree>>;
54
+ matchStores: Map<string, MatchStore>;
55
+ pendingMatchStores: Map<string, MatchStore>;
56
+ cachedMatchStores: Map<string, MatchStore>;
57
+ /**
58
+ * Get a computed store that resolves a routeId to its current match state.
59
+ * Returns the same cached store instance for repeated calls with the same key.
60
+ * The computed depends on matchesId + the individual match store, so
61
+ * subscribers are only notified when the resolved match state changes.
62
+ */
63
+ getRouteMatchStore: (routeId: string) => RouterReadableStore<AnyRouteMatch | undefined>;
64
+ setMatches: (nextMatches: Array<AnyRouteMatch>) => void;
65
+ setPending: (nextMatches: Array<AnyRouteMatch>) => void;
66
+ setCached: (nextMatches: Array<AnyRouteMatch>) => void;
67
+ }
68
+ //#endregion
69
+ export { GetStoreConfig, RouterBatchFn, RouterReadableStore, RouterStores, RouterWritableStore };
@@ -0,0 +1,10 @@
1
+ import { NavigateOptions } from "./link.js";
2
+ import { RegisteredRouter } from "./router.js";
3
+
4
+ //#region ../../node_modules/.pnpm/@tanstack+router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/useNavigate.d.ts
5
+ type UseNavigateResult<TDefaultFrom extends string> = <TRouter extends RegisteredRouter, TTo extends string | undefined, TFrom extends string = TDefaultFrom, TMaskFrom extends string = TFrom, TMaskTo extends string = ''>({
6
+ from,
7
+ ...rest
8
+ }: NavigateOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>) => Promise<void>;
9
+ //#endregion
10
+ export { UseNavigateResult };
@@ -0,0 +1,28 @@
1
+ //#region ../../node_modules/.pnpm/@tanstack+router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/utils.d.ts
2
+ type Awaitable<T> = T | Promise<T>;
3
+ type NoInfer<T> = [T][T extends any ? 0 : never];
4
+ type PickAsRequired<TValue, TKey extends keyof TValue> = Omit<TValue, TKey> & Required<Pick<TValue, TKey>>;
5
+ type Expand<T> = T extends object ? T extends infer O ? O extends Function ? O : { [K in keyof O]: O[K] } : never : T;
6
+ type MakeDifferenceOptional<TLeft, TRight> = keyof TLeft & keyof TRight extends never ? TRight : Omit<TRight, keyof TLeft & keyof TRight> & { [K in keyof TLeft & keyof TRight]?: TRight[K] };
7
+ type IsNonEmptyObject<T> = T extends object ? keyof T extends never ? false : true : false;
8
+ type Assign<TLeft, TRight> = TLeft extends any ? TRight extends any ? IsNonEmptyObject<TLeft> extends false ? TRight : IsNonEmptyObject<TRight> extends false ? TLeft : keyof TLeft & keyof TRight extends never ? TLeft & TRight : Omit<TLeft, keyof TRight> & TRight : never : never;
9
+ type IntersectAssign<TLeft, TRight> = TLeft extends any ? TRight extends any ? IsNonEmptyObject<TLeft> extends false ? TRight : IsNonEmptyObject<TRight> extends false ? TLeft : TRight & TLeft : never : never;
10
+ type Updater<TPrevious, TResult = TPrevious> = TResult | ((prev?: TPrevious) => TResult);
11
+ type NonNullableUpdater<TPrevious, TResult = TPrevious> = TResult | ((prev: TPrevious) => TResult);
12
+ type ExtractObjects<TUnion> = TUnion extends MergeAllPrimitive ? never : TUnion;
13
+ type PartialMergeAllObject<TUnion> = ExtractObjects<TUnion> extends infer TObj ? [TObj] extends [never] ? never : { [TKey in TObj extends any ? keyof TObj : never]?: TObj extends any ? TKey extends keyof TObj ? TObj[TKey] : never : never } : never;
14
+ type MergeAllPrimitive = ReadonlyArray<any> | number | string | bigint | boolean | symbol | undefined | null;
15
+ type ExtractPrimitives<TUnion> = TUnion extends MergeAllPrimitive ? TUnion : TUnion extends object ? never : TUnion;
16
+ type PartialMergeAll<TUnion> = ExtractPrimitives<TUnion> | PartialMergeAllObject<TUnion>;
17
+ type Constrain<T, TConstraint, TDefault = TConstraint> = (T extends TConstraint ? T : never) | TDefault;
18
+ type ConstrainLiteral<T, TConstraint, TDefault = TConstraint> = (T & TConstraint) | TDefault;
19
+ type LooseReturnType<T> = T extends ((...args: Array<any>) => infer TReturn) ? TReturn : never;
20
+ type LooseAsyncReturnType<T> = T extends ((...args: Array<any>) => infer TReturn) ? TReturn extends Promise<infer TReturn> ? TReturn : TReturn : never;
21
+ type ControlledPromise<T> = Promise<T> & {
22
+ resolve: (value: T) => void;
23
+ reject: (value: any) => void;
24
+ status: 'pending' | 'resolved' | 'rejected';
25
+ value?: T;
26
+ };
27
+ //#endregion
28
+ export { Assign, Awaitable, Constrain, ConstrainLiteral, ControlledPromise, Expand, ExtractObjects, ExtractPrimitives, IntersectAssign, IsNonEmptyObject, LooseAsyncReturnType, LooseReturnType, MakeDifferenceOptional, MergeAllPrimitive, NoInfer, NonNullableUpdater, PartialMergeAll, PartialMergeAllObject, PickAsRequired, Updater };
@@ -0,0 +1,49 @@
1
+ import { SearchSchemaInput } from "./route.js";
2
+
3
+ //#region ../../node_modules/.pnpm/@tanstack+router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/validators.d.ts
4
+ interface StandardSchemaValidatorProps<TInput, TOutput> {
5
+ readonly types?: StandardSchemaValidatorTypes<TInput, TOutput> | undefined;
6
+ readonly validate: AnyStandardSchemaValidate;
7
+ }
8
+ interface StandardSchemaValidator<TInput, TOutput> {
9
+ readonly '~standard': StandardSchemaValidatorProps<TInput, TOutput>;
10
+ }
11
+ type AnyStandardSchemaValidator = StandardSchemaValidator<any, any>;
12
+ interface StandardSchemaValidatorTypes<TInput, TOutput> {
13
+ readonly input: TInput;
14
+ readonly output: TOutput;
15
+ }
16
+ interface AnyStandardSchemaValidateSuccess {
17
+ readonly value: any;
18
+ readonly issues?: undefined;
19
+ }
20
+ interface AnyStandardSchemaValidateFailure {
21
+ readonly issues: ReadonlyArray<AnyStandardSchemaValidateIssue>;
22
+ }
23
+ interface AnyStandardSchemaValidateIssue {
24
+ readonly message: string;
25
+ }
26
+ type AnyStandardSchemaValidate = (value: unknown) => (AnyStandardSchemaValidateSuccess | AnyStandardSchemaValidateFailure) | Promise<AnyStandardSchemaValidateSuccess | AnyStandardSchemaValidateFailure>;
27
+ interface ValidatorObj<TInput, TOutput> {
28
+ parse: ValidatorFn<TInput, TOutput>;
29
+ }
30
+ type AnyValidatorObj = ValidatorObj<any, any>;
31
+ interface ValidatorAdapter<TInput, TOutput> {
32
+ types: {
33
+ input: TInput;
34
+ output: TOutput;
35
+ };
36
+ parse: (input: unknown) => TOutput;
37
+ }
38
+ type AnyValidatorAdapter = ValidatorAdapter<any, any>;
39
+ type ValidatorFn<TInput, TOutput> = (input: TInput) => TOutput;
40
+ type Validator<TInput, TOutput> = ValidatorObj<TInput, TOutput> | ValidatorFn<TInput, TOutput> | ValidatorAdapter<TInput, TOutput> | StandardSchemaValidator<TInput, TOutput> | undefined;
41
+ type AnyValidator = Validator<any, any>;
42
+ type AnySchema = {};
43
+ type DefaultValidator = Validator<Record<string, unknown>, AnySchema>;
44
+ type ResolveSearchValidatorInputFn<TValidator> = TValidator extends ((input: infer TSchemaInput) => any) ? TSchemaInput extends SearchSchemaInput ? Omit<TSchemaInput, keyof SearchSchemaInput> : ResolveValidatorOutputFn<TValidator> : AnySchema;
45
+ type ResolveSearchValidatorInput<TValidator> = TValidator extends AnyStandardSchemaValidator ? NonNullable<TValidator['~standard']['types']>['input'] : TValidator extends AnyValidatorAdapter ? TValidator['types']['input'] : TValidator extends AnyValidatorObj ? ResolveSearchValidatorInputFn<TValidator['parse']> : ResolveSearchValidatorInputFn<TValidator>;
46
+ type ResolveValidatorOutputFn<TValidator> = TValidator extends ((...args: any) => infer TSchema) ? TSchema : AnySchema;
47
+ type ResolveValidatorOutput<TValidator> = unknown extends TValidator ? TValidator : TValidator extends AnyStandardSchemaValidator ? NonNullable<TValidator['~standard']['types']>['output'] : TValidator extends AnyValidatorAdapter ? TValidator['types']['output'] : TValidator extends AnyValidatorObj ? ResolveValidatorOutputFn<TValidator['parse']> : ResolveValidatorOutputFn<TValidator>;
48
+ //#endregion
49
+ export { AnySchema, AnyStandardSchemaValidate, AnyStandardSchemaValidateFailure, AnyStandardSchemaValidateIssue, AnyStandardSchemaValidateSuccess, AnyStandardSchemaValidator, AnyValidator, AnyValidatorAdapter, AnyValidatorObj, DefaultValidator, ResolveSearchValidatorInput, ResolveSearchValidatorInputFn, ResolveValidatorOutput, ResolveValidatorOutputFn, StandardSchemaValidator, StandardSchemaValidatorProps, StandardSchemaValidatorTypes, Validator, ValidatorAdapter, ValidatorFn, ValidatorObj };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "camox",
3
- "version": "0.33.0",
3
+ "version": "0.34.0",
4
4
  "license": "MIT",
5
5
  "bin": {
6
6
  "camox": "./bin/camox.mjs"
@@ -27,6 +27,11 @@
27
27
  "types": "./dist/core/createLayout.d.ts",
28
28
  "import": "./dist/core/createLayout.js"
29
29
  },
30
+ "./document": {
31
+ "source": "./src/core/defineDocument.ts",
32
+ "types": "./dist/core/defineDocument.d.ts",
33
+ "import": "./dist/core/defineDocument.js"
34
+ },
30
35
  "./CamoxPreview": {
31
36
  "source": "./src/features/preview/CamoxPreview.tsx",
32
37
  "types": "./dist/features/preview/CamoxPreview.d.ts",
@@ -47,6 +52,11 @@
47
52
  "types": "./dist/features/studio/CamoxStudio.d.ts",
48
53
  "import": "./dist/features/studio/CamoxStudio.js"
49
54
  },
55
+ "./navigation": {
56
+ "source": "./src/features/navigation/navigation.tsx",
57
+ "types": "./dist/features/navigation/navigation.d.ts",
58
+ "import": "./dist/features/navigation/navigation.js"
59
+ },
50
60
  "./vite": {
51
61
  "source": "./src/features/vite/vite.ts",
52
62
  "types": "./dist/features/vite/vite.d.ts",
@@ -57,15 +67,25 @@
57
67
  "types": "./dist/features/metadata/sitemap.d.ts",
58
68
  "import": "./dist/features/metadata/sitemap.js"
59
69
  },
60
- "./_internal/pageRoute": {
61
- "source": "./src/features/routes/pageRoute.tsx",
62
- "types": "./dist/features/routes/pageRoute.d.ts",
63
- "import": "./dist/features/routes/pageRoute.js"
70
+ "./_internal/pageServer": {
71
+ "source": "./src/features/runtime/pageServer.tsx",
72
+ "types": "./dist/features/runtime/pageServer.d.ts",
73
+ "import": "./dist/features/runtime/pageServer.js"
74
+ },
75
+ "./_internal/pageClient": {
76
+ "source": "./src/features/runtime/pageClient.tsx",
77
+ "types": "./dist/features/runtime/pageClient.d.ts",
78
+ "import": "./dist/features/runtime/pageClient.js"
79
+ },
80
+ "./_internal/studioServer": {
81
+ "source": "./src/features/runtime/studioServer.tsx",
82
+ "types": "./dist/features/runtime/studioServer.d.ts",
83
+ "import": "./dist/features/runtime/studioServer.js"
64
84
  },
65
- "./_internal/ogRoute": {
66
- "source": "./src/features/routes/ogRoute.ts",
67
- "types": "./dist/features/routes/ogRoute.d.ts",
68
- "import": "./dist/features/routes/ogRoute.js"
85
+ "./_internal/runtime": {
86
+ "source": "./src/features/runtime/runtime.ts",
87
+ "types": "./dist/features/runtime/runtime.d.ts",
88
+ "import": "./dist/features/runtime/runtime.js"
69
89
  },
70
90
  "./_internal/imageResponse": {
71
91
  "workerd": {
@@ -113,6 +133,7 @@
113
133
  "@tanstack/ai-react": "^0.11.7",
114
134
  "@tanstack/react-form": "^1.32.0",
115
135
  "@tanstack/react-query-devtools": "^5.100.11",
136
+ "@unhead/react": "^3.1.7",
116
137
  "@xstate/store": "3.17.1",
117
138
  "@xstate/store-react": "^1.0.1",
118
139
  "better-auth": "^1.6.11",
@@ -129,10 +150,11 @@
129
150
  "react-og-preview": "^0.2.0",
130
151
  "shiki": "^4.1.0",
131
152
  "streamdown": "^2.5.0",
153
+ "unhead": "^3.1.7",
132
154
  "zod": "^4.4.3",
133
- "@camox/api-contract": "0.33.0",
134
- "@camox/ui": "0.33.0",
135
- "@camox/cli": "0.33.0"
155
+ "@camox/api-contract": "0.34.0",
156
+ "@camox/cli": "0.34.0",
157
+ "@camox/ui": "0.34.0"
136
158
  },
137
159
  "devDependencies": {
138
160
  "@babel/core": "^7.29.0",
@@ -13,7 +13,7 @@ A definition only adds a new _type_ of block to the catalog — it doesn't put o
13
13
 
14
14
  ## Quick Start
15
15
 
16
- A block file lives in the app's `src/camox/blocks/` folder, is a `.tsx` file, and exports `block`:
16
+ A block file lives in the app's `src/blocks/` folder, is a `.tsx` file, and exports `block`:
17
17
 
18
18
  ```tsx
19
19
  import { Type, createBlock } from "camox/createBlock";
@@ -337,10 +337,10 @@ When the content needs to be placed inside a more complex structure, use `props.
337
337
 
338
338
  ### Rendering Link fields — `block.Link`
339
339
 
340
- Inside the render prop, use the `Link` component from `@tanstack/react-router` instead of a plain `<a>` tag. This enables client-side navigation for internal links. The framework computes `to`, `target`, and `rel` from the link value — just spread `props`.
340
+ Inside the render prop, use the `Link` component from `camox/navigation` instead of a plain `<a>` tag. This enables client-side navigation for internal links. The framework computes `to`, `target`, and `rel` from the link value — just spread `props`.
341
341
 
342
342
  ```tsx
343
- import { Link } from "@tanstack/react-router";
343
+ import { Link } from "camox/navigation";
344
344
 
345
345
  <myBlock.Link name="cta">{(props) => <Link {...props} />}</myBlock.Link>;
346
346
  ```
@@ -462,7 +462,7 @@ Renders content outside the block's DOM container. Useful for fixed/floating ele
462
462
 
463
463
  ## Rules and Conventions
464
464
 
465
- 1. **File = one block.** One `.tsx` file per block in `src/camox/blocks/`. The `id` must match the filename (without `.tsx`).
465
+ 1. **File = one block.** One `.tsx` file per block in `src/blocks/`. The `id` must match the filename (without `.tsx`).
466
466
  2. **Named export as `block`.** Always: `export { myVar as block }`. Not a default export.
467
467
  3. **Named function component.** Use `function MyComponent()`, not an arrow function. Reference it in `createBlock` before its declaration is fine (hoisting).
468
468
  4. **All fields need defaults.** Every `Type.*` call requires a default value (images and files get automatic placeholders).
@@ -11,11 +11,11 @@ The Camox CLI is the right tool for any **CRUD operation on CMS content** — pa
11
11
 
12
12
  This skill (`camox-cli`) is for **content** — the actual pages, the actual block instances on those pages, the wording and images visitors see. If the user wants to add a section to a specific page, change copy, reorder blocks, create a new route, swap which layout a page uses, or fix a meta title, you're editing content and you want the CLI.
13
13
 
14
- The `camox-block` skill is for **block definitions** — the `.tsx` files in `src/camox/blocks/` that define what _kinds_ of blocks exist (their schema, fields, and rendering). Reach for it only when the user wants to introduce a new type of section that doesn't exist yet (e.g. "we need a pricing-table section and we've never built one"), or change the schema or rendering of an existing block type.
14
+ The `camox-block` skill is for **block definitions** — the `.tsx` files in `src/blocks/` that define what _kinds_ of blocks exist (their schema, fields, and rendering). Reach for it only when the user wants to introduce a new type of section that doesn't exist yet (e.g. "we need a pricing-table section and we've never built one"), or change the schema or rendering of an existing block type.
15
15
 
16
- The `camox-layout` skill is for **layout definitions** — the `.tsx` files in `src/camox/layouts/` that define the shared shells around page content (which navbar/footer blocks wrap pages, how meta titles are built, OG images, etc.). Reach for it when the user wants a new kind of page wrapper, a different shared structure, or to change how titles or social previews are constructed. _Assigning_ an existing layout to a page is content — that's the CLI.
16
+ The `camox-layout` skill is for **layout definitions** — the `.tsx` files in `src/layouts/` that define the shared shells around page content (which navbar/footer blocks wrap pages, how meta titles are built, OG images, etc.). Reach for it when the user wants a new kind of page wrapper, a different shared structure, or to change how titles or social previews are constructed. _Assigning_ an existing layout to a page is content — that's the CLI.
17
17
 
18
- Rule of thumb: if the change should be visible on the live site without a code deploy, it's content → use the CLI. If it requires editing source files in `src/camox/blocks/` or `src/camox/layouts/`, it's a definition → use `camox-block` or `camox-layout`. Some requests need both (e.g. "add a pricing section the site has never had before" = define the block via `camox-block`, then create an instance on a page via the CLI).
18
+ Rule of thumb: if the change should be visible on the live site without a code deploy, it's content → use the CLI. If it requires editing source files in `src/blocks/` or `src/layouts/`, it's a definition → use `camox-block` or `camox-layout`. Some requests need both (e.g. "add a pricing section the site has never had before" = define the block via `camox-block`, then create an instance on a page via the CLI).
19
19
 
20
20
  ## Running the CLI
21
21
 
@@ -13,7 +13,7 @@ A definition only adds a new layout to the catalog — it doesn't apply it to an
13
13
 
14
14
  ## Quick Start
15
15
 
16
- A layout file lives in the app's `src/camox/layouts/` folder, is a `.tsx` file, and exports `layout`:
16
+ A layout file lives in the app's `src/layouts/` folder, is a `.tsx` file, and exports `layout`:
17
17
 
18
18
  ```tsx
19
19
  import { createLayout } from "camox/createLayout";
@@ -199,7 +199,7 @@ buildOgImage: ({ title, description, projectName }) => (
199
199
 
200
200
  ## Rules and Conventions
201
201
 
202
- 1. **File = one layout.** One `.tsx` file per layout in `src/camox/layouts/`. The `id` must match the filename (without `.tsx`).
202
+ 1. **File = one layout.** One `.tsx` file per layout in `src/layouts/`. The `id` must match the filename (without `.tsx`).
203
203
  2. **Named export as `layout`.** Always: `export { myVar as layout }`. Not a default export.
204
204
  3. **Named function component.** Use `function MyComponent()`, not an arrow function. Reference it in `createLayout` before its declaration is fine (hoisting).
205
205
  4. **Import path is `"camox/createLayout"`.** The `createLayout` function comes from this import.
@@ -1,12 +0,0 @@
1
- import { CamoxApp } from "../../core/createApp.js";
2
-
3
- //#region src/features/routes/ogRoute.d.ts
4
- declare function createOgHandler(camoxApp: CamoxApp): {
5
- GET: ({
6
- request
7
- }: {
8
- request: Request;
9
- }) => Promise<Response>;
10
- };
11
- //#endregion
12
- export { createOgHandler };
@@ -1,20 +0,0 @@
1
- //#region src/features/routes/ogRoute.ts
2
- function createOgHandler(camoxApp) {
3
- return { GET: async ({ request }) => {
4
- const url = new URL(request.url);
5
- const layoutId = url.searchParams.get("layoutId") || "";
6
- const title = url.searchParams.get("title") || "";
7
- const description = url.searchParams.get("description") || "";
8
- const projectName = url.searchParams.get("projectName") || "";
9
- const layout = camoxApp.getLayoutById(layoutId);
10
- if (!layout?._internal.buildOgImage) return new Response("Not found", { status: 404 });
11
- return layout._internal.buildOgImage({
12
- title,
13
- description,
14
- projectName
15
- });
16
- } };
17
- }
18
-
19
- //#endregion
20
- export { createOgHandler };
@@ -1,48 +0,0 @@
1
- import { CamoxApp } from "../../core/createApp.js";
2
- import { PageStructure } from "../../lib/queries.js";
3
- import { QueryClient } from "@tanstack/react-query";
4
- import * as _$react_jsx_runtime0 from "react/jsx-runtime";
5
- import * as _$_tanstack_react_start0 from "@tanstack/react-start";
6
-
7
- //#region src/features/routes/pageRoute.d.ts
8
- declare function parseQuality(part: string): number;
9
- declare function prefersMarkdown(accept: string): boolean;
10
- declare const getOrigin: _$_tanstack_react_start0.OptionalFetcher<undefined, undefined, Promise<string>>;
11
- declare const getServerLoaderAuthCookieHeader: _$_tanstack_react_start0.OptionalFetcher<undefined, undefined, Promise<string>>;
12
- declare function createMarkdownMiddleware(apiUrl: string, projectSlug: string, environmentName?: string): _$_tanstack_react_start0.RequestMiddlewareAfterServer<{}, undefined, undefined>;
13
- declare function createPageLoader(apiUrl: string, projectSlug: string, environmentName?: string): ({
14
- location,
15
- context
16
- }: {
17
- location: {
18
- pathname: string;
19
- };
20
- context: {
21
- queryClient: QueryClient;
22
- };
23
- }) => Promise<{
24
- page: PageStructure;
25
- origin: string;
26
- faviconUrl: string;
27
- }>;
28
- declare function createPageHead(camoxApp: CamoxApp): ({
29
- loaderData
30
- }: {
31
- loaderData?: {
32
- page: PageStructure;
33
- origin: string;
34
- faviconUrl: string;
35
- };
36
- }) => {
37
- meta?: undefined;
38
- links?: undefined;
39
- } | {
40
- meta: Record<string, string>[];
41
- links: {
42
- rel: string;
43
- href: string;
44
- }[];
45
- };
46
- declare const PageRouteComponent: () => _$react_jsx_runtime0.JSX.Element;
47
- //#endregion
48
- export { PageRouteComponent, createMarkdownMiddleware, createPageHead, createPageLoader, getOrigin, getServerLoaderAuthCookieHeader, parseQuality, prefersMarkdown };