@timber-js/app 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/timber.mjs +5 -0
- package/dist/_chunks/error-boundary-dj-WO5uq.js +121 -0
- package/dist/_chunks/error-boundary-dj-WO5uq.js.map +1 -0
- package/dist/_chunks/format-DNt20Kt8.js +163 -0
- package/dist/_chunks/format-DNt20Kt8.js.map +1 -0
- package/dist/_chunks/interception-DIaZN1bF.js +669 -0
- package/dist/_chunks/interception-DIaZN1bF.js.map +1 -0
- package/dist/_chunks/metadata-routes-BDnswgRO.js +141 -0
- package/dist/_chunks/metadata-routes-BDnswgRO.js.map +1 -0
- package/dist/_chunks/registry-DUIpYD_x.js +20 -0
- package/dist/_chunks/registry-DUIpYD_x.js.map +1 -0
- package/dist/_chunks/request-context-D6XHINkR.js +330 -0
- package/dist/_chunks/request-context-D6XHINkR.js.map +1 -0
- package/dist/_chunks/tracing-BtOwb8O6.js +174 -0
- package/dist/_chunks/tracing-BtOwb8O6.js.map +1 -0
- package/dist/_chunks/use-cookie-8ZlA0rr3.js +125 -0
- package/dist/_chunks/use-cookie-8ZlA0rr3.js.map +1 -0
- package/dist/adapters/cloudflare.d.ts +92 -0
- package/dist/adapters/cloudflare.d.ts.map +1 -0
- package/dist/adapters/cloudflare.js +188 -0
- package/dist/adapters/cloudflare.js.map +1 -0
- package/dist/adapters/nitro.d.ts +72 -0
- package/dist/adapters/nitro.d.ts.map +1 -0
- package/dist/adapters/nitro.js +217 -0
- package/dist/adapters/nitro.js.map +1 -0
- package/dist/adapters/types.d.ts +53 -0
- package/dist/adapters/types.d.ts.map +1 -0
- package/dist/cache/index.d.ts +52 -0
- package/dist/cache/index.d.ts.map +1 -0
- package/dist/cache/index.js +283 -0
- package/dist/cache/index.js.map +1 -0
- package/dist/cache/redis-handler.d.ts +45 -0
- package/dist/cache/redis-handler.d.ts.map +1 -0
- package/dist/cache/register-cached-function.d.ts +17 -0
- package/dist/cache/register-cached-function.d.ts.map +1 -0
- package/dist/cache/singleflight.d.ts +11 -0
- package/dist/cache/singleflight.d.ts.map +1 -0
- package/dist/cache/stable-stringify.d.ts +7 -0
- package/dist/cache/stable-stringify.d.ts.map +1 -0
- package/dist/cache/timber-cache.d.ts +21 -0
- package/dist/cache/timber-cache.d.ts.map +1 -0
- package/dist/cli.d.ts +44 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +135 -0
- package/dist/cli.js.map +1 -0
- package/dist/client/browser-entry.d.ts +22 -0
- package/dist/client/browser-entry.d.ts.map +1 -0
- package/dist/client/error-boundary.d.ts +42 -0
- package/dist/client/error-boundary.d.ts.map +1 -0
- package/dist/client/form.d.ts +115 -0
- package/dist/client/form.d.ts.map +1 -0
- package/dist/client/head.d.ts +16 -0
- package/dist/client/head.d.ts.map +1 -0
- package/dist/client/history.d.ts +29 -0
- package/dist/client/history.d.ts.map +1 -0
- package/dist/client/index.d.ts +32 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +1218 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/link-navigate-interceptor.d.ts +28 -0
- package/dist/client/link-navigate-interceptor.d.ts.map +1 -0
- package/dist/client/link-status-provider.d.ts +11 -0
- package/dist/client/link-status-provider.d.ts.map +1 -0
- package/dist/client/link.d.ts +119 -0
- package/dist/client/link.d.ts.map +1 -0
- package/dist/client/nuqs-adapter.d.ts +11 -0
- package/dist/client/nuqs-adapter.d.ts.map +1 -0
- package/dist/client/router-ref.d.ts +11 -0
- package/dist/client/router-ref.d.ts.map +1 -0
- package/dist/client/router.d.ts +85 -0
- package/dist/client/router.d.ts.map +1 -0
- package/dist/client/segment-cache.d.ts +88 -0
- package/dist/client/segment-cache.d.ts.map +1 -0
- package/dist/client/segment-context.d.ts +32 -0
- package/dist/client/segment-context.d.ts.map +1 -0
- package/dist/client/ssr-data.d.ts +64 -0
- package/dist/client/ssr-data.d.ts.map +1 -0
- package/dist/client/types.d.ts +5 -0
- package/dist/client/types.d.ts.map +1 -0
- package/dist/client/unload-guard.d.ts +18 -0
- package/dist/client/unload-guard.d.ts.map +1 -0
- package/dist/client/use-cookie.d.ts +37 -0
- package/dist/client/use-cookie.d.ts.map +1 -0
- package/dist/client/use-link-status.d.ts +35 -0
- package/dist/client/use-link-status.d.ts.map +1 -0
- package/dist/client/use-navigation-pending.d.ts +26 -0
- package/dist/client/use-navigation-pending.d.ts.map +1 -0
- package/dist/client/use-params.d.ts +50 -0
- package/dist/client/use-params.d.ts.map +1 -0
- package/dist/client/use-pathname.d.ts +20 -0
- package/dist/client/use-pathname.d.ts.map +1 -0
- package/dist/client/use-query-states.d.ts +36 -0
- package/dist/client/use-query-states.d.ts.map +1 -0
- package/dist/client/use-router.d.ts +39 -0
- package/dist/client/use-router.d.ts.map +1 -0
- package/dist/client/use-search-params.d.ts +24 -0
- package/dist/client/use-search-params.d.ts.map +1 -0
- package/dist/client/use-selected-layout-segment.d.ts +68 -0
- package/dist/client/use-selected-layout-segment.d.ts.map +1 -0
- package/dist/content/index.d.ts +11 -0
- package/dist/content/index.d.ts.map +1 -0
- package/dist/content/index.js +2 -0
- package/dist/cookies/define-cookie.d.ts +61 -0
- package/dist/cookies/define-cookie.d.ts.map +1 -0
- package/dist/cookies/index.d.ts +3 -0
- package/dist/cookies/index.d.ts.map +1 -0
- package/dist/cookies/index.js +82 -0
- package/dist/cookies/index.js.map +1 -0
- package/dist/fonts/ast.d.ts +38 -0
- package/dist/fonts/ast.d.ts.map +1 -0
- package/dist/fonts/css.d.ts +43 -0
- package/dist/fonts/css.d.ts.map +1 -0
- package/dist/fonts/fallbacks.d.ts +36 -0
- package/dist/fonts/fallbacks.d.ts.map +1 -0
- package/dist/fonts/google.d.ts +122 -0
- package/dist/fonts/google.d.ts.map +1 -0
- package/dist/fonts/local.d.ts +76 -0
- package/dist/fonts/local.d.ts.map +1 -0
- package/dist/fonts/types.d.ts +85 -0
- package/dist/fonts/types.d.ts.map +1 -0
- package/dist/index.d.ts +150 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14701 -0
- package/dist/index.js.map +1 -0
- package/dist/plugins/adapter-build.d.ts +18 -0
- package/dist/plugins/adapter-build.d.ts.map +1 -0
- package/dist/plugins/build-manifest.d.ts +79 -0
- package/dist/plugins/build-manifest.d.ts.map +1 -0
- package/dist/plugins/build-report.d.ts +63 -0
- package/dist/plugins/build-report.d.ts.map +1 -0
- package/dist/plugins/cache-transform.d.ts +36 -0
- package/dist/plugins/cache-transform.d.ts.map +1 -0
- package/dist/plugins/chunks.d.ts +45 -0
- package/dist/plugins/chunks.d.ts.map +1 -0
- package/dist/plugins/content.d.ts +19 -0
- package/dist/plugins/content.d.ts.map +1 -0
- package/dist/plugins/dev-error-overlay.d.ts +60 -0
- package/dist/plugins/dev-error-overlay.d.ts.map +1 -0
- package/dist/plugins/dev-logs.d.ts +46 -0
- package/dist/plugins/dev-logs.d.ts.map +1 -0
- package/dist/plugins/dev-server.d.ts +22 -0
- package/dist/plugins/dev-server.d.ts.map +1 -0
- package/dist/plugins/dynamic-transform.d.ts +72 -0
- package/dist/plugins/dynamic-transform.d.ts.map +1 -0
- package/dist/plugins/entries.d.ts +21 -0
- package/dist/plugins/entries.d.ts.map +1 -0
- package/dist/plugins/fonts.d.ts +77 -0
- package/dist/plugins/fonts.d.ts.map +1 -0
- package/dist/plugins/mdx.d.ts +21 -0
- package/dist/plugins/mdx.d.ts.map +1 -0
- package/dist/plugins/react-prod.d.ts +18 -0
- package/dist/plugins/react-prod.d.ts.map +1 -0
- package/dist/plugins/routing.d.ts +13 -0
- package/dist/plugins/routing.d.ts.map +1 -0
- package/dist/plugins/server-action-exports.d.ts +26 -0
- package/dist/plugins/server-action-exports.d.ts.map +1 -0
- package/dist/plugins/server-bundle.d.ts +15 -0
- package/dist/plugins/server-bundle.d.ts.map +1 -0
- package/dist/plugins/shims.d.ts +18 -0
- package/dist/plugins/shims.d.ts.map +1 -0
- package/dist/plugins/static-build.d.ts +55 -0
- package/dist/plugins/static-build.d.ts.map +1 -0
- package/dist/routing/codegen.d.ts +29 -0
- package/dist/routing/codegen.d.ts.map +1 -0
- package/dist/routing/index.d.ts +8 -0
- package/dist/routing/index.d.ts.map +1 -0
- package/dist/routing/index.js +2 -0
- package/dist/routing/interception.d.ts +46 -0
- package/dist/routing/interception.d.ts.map +1 -0
- package/dist/routing/scanner.d.ts +28 -0
- package/dist/routing/scanner.d.ts.map +1 -0
- package/dist/routing/status-file-lint.d.ts +33 -0
- package/dist/routing/status-file-lint.d.ts.map +1 -0
- package/dist/routing/types.d.ts +81 -0
- package/dist/routing/types.d.ts.map +1 -0
- package/dist/search-params/analyze.d.ts +54 -0
- package/dist/search-params/analyze.d.ts.map +1 -0
- package/dist/search-params/codecs.d.ts +53 -0
- package/dist/search-params/codecs.d.ts.map +1 -0
- package/dist/search-params/create.d.ts +106 -0
- package/dist/search-params/create.d.ts.map +1 -0
- package/dist/search-params/index.d.ts +7 -0
- package/dist/search-params/index.d.ts.map +1 -0
- package/dist/search-params/index.js +300 -0
- package/dist/search-params/index.js.map +1 -0
- package/dist/search-params/registry.d.ts +20 -0
- package/dist/search-params/registry.d.ts.map +1 -0
- package/dist/server/access-gate.d.ts +42 -0
- package/dist/server/access-gate.d.ts.map +1 -0
- package/dist/server/action-client.d.ts +190 -0
- package/dist/server/action-client.d.ts.map +1 -0
- package/dist/server/action-handler.d.ts +48 -0
- package/dist/server/action-handler.d.ts.map +1 -0
- package/dist/server/actions.d.ts +108 -0
- package/dist/server/actions.d.ts.map +1 -0
- package/dist/server/asset-headers.d.ts +42 -0
- package/dist/server/asset-headers.d.ts.map +1 -0
- package/dist/server/body-limits.d.ts +30 -0
- package/dist/server/body-limits.d.ts.map +1 -0
- package/dist/server/build-manifest.d.ts +120 -0
- package/dist/server/build-manifest.d.ts.map +1 -0
- package/dist/server/canonicalize.d.ts +30 -0
- package/dist/server/canonicalize.d.ts.map +1 -0
- package/dist/server/client-module-map.d.ts +47 -0
- package/dist/server/client-module-map.d.ts.map +1 -0
- package/dist/server/csrf.d.ts +34 -0
- package/dist/server/csrf.d.ts.map +1 -0
- package/dist/server/deny-renderer.d.ts +49 -0
- package/dist/server/deny-renderer.d.ts.map +1 -0
- package/dist/server/dev-logger.d.ts +44 -0
- package/dist/server/dev-logger.d.ts.map +1 -0
- package/dist/server/dev-span-processor.d.ts +29 -0
- package/dist/server/dev-span-processor.d.ts.map +1 -0
- package/dist/server/dev-warnings.d.ts +129 -0
- package/dist/server/dev-warnings.d.ts.map +1 -0
- package/dist/server/early-hints-sender.d.ts +38 -0
- package/dist/server/early-hints-sender.d.ts.map +1 -0
- package/dist/server/early-hints.d.ts +83 -0
- package/dist/server/early-hints.d.ts.map +1 -0
- package/dist/server/error-boundary-wrapper.d.ts +17 -0
- package/dist/server/error-boundary-wrapper.d.ts.map +1 -0
- package/dist/server/error-formatter.d.ts +17 -0
- package/dist/server/error-formatter.d.ts.map +1 -0
- package/dist/server/flush.d.ts +74 -0
- package/dist/server/flush.d.ts.map +1 -0
- package/dist/server/form-data.d.ts +60 -0
- package/dist/server/form-data.d.ts.map +1 -0
- package/dist/server/form-flash.d.ts +78 -0
- package/dist/server/form-flash.d.ts.map +1 -0
- package/dist/server/html-injectors.d.ts +101 -0
- package/dist/server/html-injectors.d.ts.map +1 -0
- package/dist/server/index.d.ts +54 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +2925 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/instrumentation.d.ts +61 -0
- package/dist/server/instrumentation.d.ts.map +1 -0
- package/dist/server/logger.d.ts +83 -0
- package/dist/server/logger.d.ts.map +1 -0
- package/dist/server/manifest-status-resolver.d.ts +58 -0
- package/dist/server/manifest-status-resolver.d.ts.map +1 -0
- package/dist/server/metadata-render.d.ts +20 -0
- package/dist/server/metadata-render.d.ts.map +1 -0
- package/dist/server/metadata-routes.d.ts +67 -0
- package/dist/server/metadata-routes.d.ts.map +1 -0
- package/dist/server/metadata.d.ts +67 -0
- package/dist/server/metadata.d.ts.map +1 -0
- package/dist/server/middleware-runner.d.ts +21 -0
- package/dist/server/middleware-runner.d.ts.map +1 -0
- package/dist/server/nuqs-ssr-provider.d.ts +28 -0
- package/dist/server/nuqs-ssr-provider.d.ts.map +1 -0
- package/dist/server/pipeline.d.ts +81 -0
- package/dist/server/pipeline.d.ts.map +1 -0
- package/dist/server/prerender.d.ts +77 -0
- package/dist/server/prerender.d.ts.map +1 -0
- package/dist/server/primitives.d.ts +131 -0
- package/dist/server/primitives.d.ts.map +1 -0
- package/dist/server/proxy.d.ts +23 -0
- package/dist/server/proxy.d.ts.map +1 -0
- package/dist/server/request-context.d.ts +175 -0
- package/dist/server/request-context.d.ts.map +1 -0
- package/dist/server/route-element-builder.d.ts +66 -0
- package/dist/server/route-element-builder.d.ts.map +1 -0
- package/dist/server/route-handler.d.ts +35 -0
- package/dist/server/route-handler.d.ts.map +1 -0
- package/dist/server/route-matcher.d.ts +78 -0
- package/dist/server/route-matcher.d.ts.map +1 -0
- package/dist/server/rsc-entry/api-handler.d.ts +11 -0
- package/dist/server/rsc-entry/api-handler.d.ts.map +1 -0
- package/dist/server/rsc-entry/error-renderer.d.ts +30 -0
- package/dist/server/rsc-entry/error-renderer.d.ts.map +1 -0
- package/dist/server/rsc-entry/helpers.d.ts +73 -0
- package/dist/server/rsc-entry/helpers.d.ts.map +1 -0
- package/dist/server/rsc-entry/index.d.ts +11 -0
- package/dist/server/rsc-entry/index.d.ts.map +1 -0
- package/dist/server/rsc-entry/ssr-bridge.d.ts +6 -0
- package/dist/server/rsc-entry/ssr-bridge.d.ts.map +1 -0
- package/dist/server/slot-resolver.d.ts +34 -0
- package/dist/server/slot-resolver.d.ts.map +1 -0
- package/dist/server/ssr-entry.d.ts +73 -0
- package/dist/server/ssr-entry.d.ts.map +1 -0
- package/dist/server/ssr-render.d.ts +67 -0
- package/dist/server/ssr-render.d.ts.map +1 -0
- package/dist/server/status-code-resolver.d.ts +77 -0
- package/dist/server/status-code-resolver.d.ts.map +1 -0
- package/dist/server/tracing.d.ts +99 -0
- package/dist/server/tracing.d.ts.map +1 -0
- package/dist/server/tree-builder.d.ts +116 -0
- package/dist/server/tree-builder.d.ts.map +1 -0
- package/dist/server/types.d.ts +231 -0
- package/dist/server/types.d.ts.map +1 -0
- package/dist/shims/font-google.d.ts +41 -0
- package/dist/shims/font-google.d.ts.map +1 -0
- package/dist/shims/headers.d.ts +11 -0
- package/dist/shims/headers.d.ts.map +1 -0
- package/dist/shims/image.d.ts +328 -0
- package/dist/shims/image.d.ts.map +1 -0
- package/dist/shims/link.d.ts +9 -0
- package/dist/shims/link.d.ts.map +1 -0
- package/dist/shims/navigation-client.d.ts +25 -0
- package/dist/shims/navigation-client.d.ts.map +1 -0
- package/dist/shims/navigation.d.ts +25 -0
- package/dist/shims/navigation.d.ts.map +1 -0
- package/dist/utils/directive-parser.d.ts +70 -0
- package/dist/utils/directive-parser.d.ts.map +1 -0
- package/dist/utils/format.d.ts +6 -0
- package/dist/utils/format.d.ts.map +1 -0
- package/dist/utils/startup-timer.d.ts +34 -0
- package/dist/utils/startup-timer.d.ts.map +1 -0
- package/package.json +140 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Segment Context — provides layout segment position for useSelectedLayoutSegment hooks.
|
|
3
|
+
*
|
|
4
|
+
* Each layout in the segment tree is wrapped with a SegmentProvider that stores
|
|
5
|
+
* the URL segments from root to the current layout level. The hooks read this
|
|
6
|
+
* context to determine which child segments are active below the calling layout.
|
|
7
|
+
*
|
|
8
|
+
* The context value is intentionally minimal: just the segment path array and
|
|
9
|
+
* parallel route keys. No internal cache details are exposed.
|
|
10
|
+
*
|
|
11
|
+
* Design docs: design/19-client-navigation.md, design/14-ecosystem.md
|
|
12
|
+
*/
|
|
13
|
+
export interface SegmentContextValue {
|
|
14
|
+
/** URL segments from root to this layout (e.g. ['', 'dashboard', 'settings']) */
|
|
15
|
+
segments: string[];
|
|
16
|
+
/** Parallel route slot keys available at this layout level (e.g. ['sidebar', 'modal']) */
|
|
17
|
+
parallelRouteKeys: string[];
|
|
18
|
+
}
|
|
19
|
+
/** Read the segment context. Returns null if no provider is above this component. */
|
|
20
|
+
export declare function useSegmentContext(): SegmentContextValue | null;
|
|
21
|
+
interface SegmentProviderProps {
|
|
22
|
+
segments: string[];
|
|
23
|
+
parallelRouteKeys: string[];
|
|
24
|
+
children: React.ReactNode;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Wraps each layout to provide segment position context.
|
|
28
|
+
* Injected by rsc-entry.ts during element tree construction.
|
|
29
|
+
*/
|
|
30
|
+
export declare function SegmentProvider({ segments, parallelRouteKeys, children }: SegmentProviderProps): import("react").FunctionComponentElement<import("react").ProviderProps<SegmentContextValue | null>>;
|
|
31
|
+
export {};
|
|
32
|
+
//# sourceMappingURL=segment-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"segment-context.d.ts","sourceRoot":"","sources":["../../src/client/segment-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAQH,MAAM,WAAW,mBAAmB;IAClC,iFAAiF;IACjF,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,0FAA0F;IAC1F,iBAAiB,EAAE,MAAM,EAAE,CAAC;CAC7B;AAMD,qFAAqF;AACrF,wBAAgB,iBAAiB,IAAI,mBAAmB,GAAG,IAAI,CAE9D;AAID,UAAU,oBAAoB;IAC5B,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,EAAE,QAAQ,EAAE,iBAAiB,EAAE,QAAQ,EAAE,EAAE,oBAAoB,uGAS9F"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SSR Data — per-request state for client hooks during server-side rendering.
|
|
3
|
+
*
|
|
4
|
+
* RSC and SSR are separate Vite module graphs (see design/18-build-system.md),
|
|
5
|
+
* so the RSC environment's request-context ALS is not visible to SSR modules.
|
|
6
|
+
* This module provides getter/setter functions that ssr-entry.ts uses to
|
|
7
|
+
* populate per-request data for React's render.
|
|
8
|
+
*
|
|
9
|
+
* Request isolation: On the server, ssr-entry.ts registers an ALS-backed
|
|
10
|
+
* provider via registerSsrDataProvider(). getSsrData() reads from the ALS
|
|
11
|
+
* store, ensuring correct per-request data even when Suspense boundaries
|
|
12
|
+
* resolve asynchronously across concurrent requests. The module-level
|
|
13
|
+
* setSsrData/clearSsrData functions are kept as a fallback for tests
|
|
14
|
+
* and environments without ALS.
|
|
15
|
+
*
|
|
16
|
+
* IMPORTANT: This module must NOT import node:async_hooks or any Node.js-only
|
|
17
|
+
* APIs, as it's imported by 'use client' hooks that are bundled for the browser.
|
|
18
|
+
* The ALS instance lives in ssr-entry.ts (server-only); this module only holds
|
|
19
|
+
* a reference to the provider function.
|
|
20
|
+
*/
|
|
21
|
+
export interface SsrData {
|
|
22
|
+
/** The request's URL pathname (e.g. '/dashboard/settings') */
|
|
23
|
+
pathname: string;
|
|
24
|
+
/** The request's search params as a plain record */
|
|
25
|
+
searchParams: Record<string, string>;
|
|
26
|
+
/** The request's cookies as name→value pairs */
|
|
27
|
+
cookies: Map<string, string>;
|
|
28
|
+
/** The request's route params (e.g. { id: '123' }) */
|
|
29
|
+
params: Record<string, string | string[]>;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Register an ALS-backed SSR data provider. Called once at module load
|
|
33
|
+
* by ssr-entry.ts to wire up per-request data via AsyncLocalStorage.
|
|
34
|
+
*
|
|
35
|
+
* When registered, getSsrData() reads from the provider (ALS store)
|
|
36
|
+
* instead of module-level state, ensuring correct isolation for
|
|
37
|
+
* concurrent requests with streaming Suspense.
|
|
38
|
+
*/
|
|
39
|
+
export declare function registerSsrDataProvider(provider: () => SsrData | undefined): void;
|
|
40
|
+
/**
|
|
41
|
+
* Set the SSR data for the current request via module-level state.
|
|
42
|
+
*
|
|
43
|
+
* In production, ssr-entry.ts uses ALS (runWithSsrData) instead.
|
|
44
|
+
* This function is retained for tests and as a fallback.
|
|
45
|
+
*/
|
|
46
|
+
export declare function setSsrData(data: SsrData): void;
|
|
47
|
+
/**
|
|
48
|
+
* Clear the SSR data after rendering completes.
|
|
49
|
+
*
|
|
50
|
+
* In production, ALS scope handles cleanup automatically.
|
|
51
|
+
* This function is retained for tests and as a fallback.
|
|
52
|
+
*/
|
|
53
|
+
export declare function clearSsrData(): void;
|
|
54
|
+
/**
|
|
55
|
+
* Read the current request's SSR data. Returns undefined when called
|
|
56
|
+
* outside an SSR render (i.e. on the client after hydration).
|
|
57
|
+
*
|
|
58
|
+
* Prefers the ALS-backed provider when registered (server-side),
|
|
59
|
+
* falling back to module-level state (tests, legacy).
|
|
60
|
+
*
|
|
61
|
+
* Used by client hooks' server snapshot functions.
|
|
62
|
+
*/
|
|
63
|
+
export declare function getSsrData(): SsrData | undefined;
|
|
64
|
+
//# sourceMappingURL=ssr-data.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ssr-data.d.ts","sourceRoot":"","sources":["../../src/client/ssr-data.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAIH,MAAM,WAAW,OAAO;IACtB,8DAA8D;IAC9D,QAAQ,EAAE,MAAM,CAAC;IACjB,oDAAoD;IACpD,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,gDAAgD;IAChD,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,sDAAsD;IACtD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;CAC3C;AAUD;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,OAAO,GAAG,SAAS,GAAG,IAAI,CAEjF;AAQD;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAE9C;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,IAAI,IAAI,CAEnC;AAED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,IAAI,OAAO,GAAG,SAAS,CAKhD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/client/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB,CAAC,IAAI,SAAS,MAAM,GAAG,MAAM,EAAE,IAAI,GAAG,OAAO;IAC7E,IAAI,EAAE,IAAI,CAAC;IACX,IAAI,EAAE,IAAI,CAAC;CACZ"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Page unload detection — suppresses spurious errors during page refresh/navigation.
|
|
3
|
+
*
|
|
4
|
+
* When the user refreshes the page or navigates away while React is still
|
|
5
|
+
* streaming Suspense content, the aborted connection causes streaming errors.
|
|
6
|
+
* These are not application errors — they're a side effect of the browser
|
|
7
|
+
* tearing down the connection. This module tracks whether the page is being
|
|
8
|
+
* unloaded so error boundaries and error handlers can suppress abort-related
|
|
9
|
+
* errors during the unload window.
|
|
10
|
+
*
|
|
11
|
+
* See design/10-error-handling.md §"Known limitation: deny() inside Suspense and hydration"
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Returns true if the page is currently being unloaded (user refreshed
|
|
15
|
+
* or navigated away). Error boundaries should suppress errors in this state.
|
|
16
|
+
*/
|
|
17
|
+
export declare function isPageUnloading(): boolean;
|
|
18
|
+
//# sourceMappingURL=unload-guard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unload-guard.d.ts","sourceRoot":"","sources":["../../src/client/unload-guard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAgBH;;;GAGG;AACH,wBAAgB,eAAe,IAAI,OAAO,CAEzC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useCookie — reactive client-side cookie hook.
|
|
3
|
+
*
|
|
4
|
+
* Uses useSyncExternalStore for SSR-safe, reactive cookie access.
|
|
5
|
+
* All components reading the same cookie name re-render on change.
|
|
6
|
+
* No cross-tab sync (intentional — see design/29-cookies.md).
|
|
7
|
+
*
|
|
8
|
+
* See design/29-cookies.md §"useCookie(name) Hook"
|
|
9
|
+
*/
|
|
10
|
+
export interface ClientCookieOptions {
|
|
11
|
+
/** URL path scope. Default: '/'. */
|
|
12
|
+
path?: string;
|
|
13
|
+
/** Domain scope. Default: omitted (current domain). */
|
|
14
|
+
domain?: string;
|
|
15
|
+
/** Max age in seconds. */
|
|
16
|
+
maxAge?: number;
|
|
17
|
+
/** Expiration date. */
|
|
18
|
+
expires?: Date;
|
|
19
|
+
/** Cross-site policy. Default: 'lax'. */
|
|
20
|
+
sameSite?: 'strict' | 'lax' | 'none';
|
|
21
|
+
/** Only send over HTTPS. Default: true in production. */
|
|
22
|
+
secure?: boolean;
|
|
23
|
+
}
|
|
24
|
+
export type CookieSetter = (value: string, options?: ClientCookieOptions) => void;
|
|
25
|
+
/**
|
|
26
|
+
* Reactive hook for reading/writing a client-side cookie.
|
|
27
|
+
*
|
|
28
|
+
* Returns `[value, setCookie, deleteCookie]`:
|
|
29
|
+
* - `value`: current cookie value (string | undefined)
|
|
30
|
+
* - `setCookie`: sets the cookie and triggers re-renders
|
|
31
|
+
* - `deleteCookie`: deletes the cookie and triggers re-renders
|
|
32
|
+
*
|
|
33
|
+
* @param name - Cookie name.
|
|
34
|
+
* @param defaultOptions - Default options for setCookie calls.
|
|
35
|
+
*/
|
|
36
|
+
export declare function useCookie(name: string, defaultOptions?: ClientCookieOptions): [value: string | undefined, setCookie: CookieSetter, deleteCookie: () => void];
|
|
37
|
+
//# sourceMappingURL=use-cookie.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-cookie.d.ts","sourceRoot":"","sources":["../../src/client/use-cookie.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAOH,MAAM,WAAW,mBAAmB;IAClC,oCAAoC;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uDAAuD;IACvD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,0BAA0B;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,uBAAuB;IACvB,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,yCAAyC;IACzC,QAAQ,CAAC,EAAE,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAC;IACrC,yDAAyD;IACzD,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,MAAM,YAAY,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,mBAAmB,KAAK,IAAI,CAAC;AA0ClF;;;;;;;;;;GAUG;AACH,wBAAgB,SAAS,CACvB,IAAI,EAAE,MAAM,EACZ,cAAc,CAAC,EAAE,mBAAmB,GACnC,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC,CAmChF"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export interface LinkStatus {
|
|
2
|
+
pending: boolean;
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* React context provided by <Link>. Holds the pending status
|
|
6
|
+
* for that specific link's navigation.
|
|
7
|
+
*/
|
|
8
|
+
export declare const LinkStatusContext: import("react").Context<LinkStatus>;
|
|
9
|
+
/**
|
|
10
|
+
* Returns `{ pending: true }` while the nearest parent `<Link>` component's
|
|
11
|
+
* navigation is in flight. Must be used inside a `<Link>` component's children.
|
|
12
|
+
*
|
|
13
|
+
* Unlike `useNavigationPending()` which is global, this hook is scoped to
|
|
14
|
+
* the nearest parent `<Link>` — only the link the user clicked shows pending.
|
|
15
|
+
*
|
|
16
|
+
* ```tsx
|
|
17
|
+
* 'use client'
|
|
18
|
+
* import { Link, useLinkStatus } from '@timber/app/client'
|
|
19
|
+
*
|
|
20
|
+
* function Hint() {
|
|
21
|
+
* const { pending } = useLinkStatus()
|
|
22
|
+
* return <span className={pending ? 'opacity-50' : ''} />
|
|
23
|
+
* }
|
|
24
|
+
*
|
|
25
|
+
* export function NavLink({ href, children }) {
|
|
26
|
+
* return (
|
|
27
|
+
* <Link href={href}>
|
|
28
|
+
* {children} <Hint />
|
|
29
|
+
* </Link>
|
|
30
|
+
* )
|
|
31
|
+
* }
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare function useLinkStatus(): LinkStatus;
|
|
35
|
+
//# sourceMappingURL=use-link-status.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-link-status.d.ts","sourceRoot":"","sources":["../../src/client/use-link-status.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;;GAGG;AACH,eAAO,MAAM,iBAAiB,qCAAgD,CAAC;AAE/E;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,aAAa,IAAI,UAAU,CAE1C"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns true while an RSC navigation is in flight.
|
|
3
|
+
*
|
|
4
|
+
* The pending state is true from the moment the RSC fetch starts until
|
|
5
|
+
* React reconciliation completes. This includes the fetch itself,
|
|
6
|
+
* RSC stream parsing, and React tree reconciliation.
|
|
7
|
+
*
|
|
8
|
+
* It does NOT include Suspense streaming after the shell — only the
|
|
9
|
+
* initial shell reconciliation.
|
|
10
|
+
*
|
|
11
|
+
* ```tsx
|
|
12
|
+
* 'use client'
|
|
13
|
+
* import { useNavigationPending } from '@timber/app/client'
|
|
14
|
+
*
|
|
15
|
+
* export function NavBar() {
|
|
16
|
+
* const isPending = useNavigationPending()
|
|
17
|
+
* return (
|
|
18
|
+
* <nav className={isPending ? 'opacity-50' : ''}>
|
|
19
|
+
* <Link href="/dashboard">Dashboard</Link>
|
|
20
|
+
* </nav>
|
|
21
|
+
* )
|
|
22
|
+
* }
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare function useNavigationPending(): boolean;
|
|
26
|
+
//# sourceMappingURL=use-navigation-pending.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-navigation-pending.d.ts","sourceRoot":"","sources":["../../src/client/use-navigation-pending.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,oBAAoB,IAAI,OAAO,CAgB9C"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useParams() — client-side hook for accessing route params.
|
|
3
|
+
*
|
|
4
|
+
* Returns the dynamic route parameters for the current URL.
|
|
5
|
+
* When called with a route pattern argument, TypeScript narrows
|
|
6
|
+
* the return type to the exact params shape for that route.
|
|
7
|
+
*
|
|
8
|
+
* Two layers of type narrowing work together:
|
|
9
|
+
* 1. The generic overload here uses the Routes interface directly —
|
|
10
|
+
* `useParams<R>()` returns `Routes[R]['params']`.
|
|
11
|
+
* 2. Build-time codegen generates per-route string-literal overloads
|
|
12
|
+
* in the .d.ts file for IDE autocomplete (see routing/codegen.ts).
|
|
13
|
+
*
|
|
14
|
+
* When the Routes interface is empty (no codegen yet), the generic
|
|
15
|
+
* overload has `keyof Routes = never`, so only the fallback matches.
|
|
16
|
+
*
|
|
17
|
+
* During SSR, params are read from the ALS-backed SSR data context
|
|
18
|
+
* (populated by ssr-entry.ts) to ensure correct per-request isolation
|
|
19
|
+
* across concurrent requests with streaming Suspense.
|
|
20
|
+
*
|
|
21
|
+
* Design doc: design/09-typescript.md §"Typed Routes"
|
|
22
|
+
*/
|
|
23
|
+
import type { Routes } from '#/index.js';
|
|
24
|
+
/**
|
|
25
|
+
* Set the current route params. Called by the framework internals
|
|
26
|
+
* during navigation — not intended for direct use by app code.
|
|
27
|
+
*
|
|
28
|
+
* On the client, the segment router calls this on each navigation.
|
|
29
|
+
* During SSR, params are also available via getSsrData().params
|
|
30
|
+
* (ALS-backed), but setCurrentParams is still called for the
|
|
31
|
+
* module-level fallback path.
|
|
32
|
+
*/
|
|
33
|
+
export declare function setCurrentParams(params: Record<string, string | string[]>): void;
|
|
34
|
+
/**
|
|
35
|
+
* Read the current route's dynamic params.
|
|
36
|
+
*
|
|
37
|
+
* The optional `_route` argument exists only for TypeScript narrowing —
|
|
38
|
+
* it does not affect the runtime return value.
|
|
39
|
+
*
|
|
40
|
+
* During SSR, reads from the ALS-backed SSR data context to ensure
|
|
41
|
+
* per-request isolation. On the client, reads from module-level state
|
|
42
|
+
* (set by the segment router on each navigation).
|
|
43
|
+
*
|
|
44
|
+
* @overload Typed — when a known route path is passed, returns the
|
|
45
|
+
* exact params shape from the generated Routes interface.
|
|
46
|
+
* @overload Fallback — returns the generic params record.
|
|
47
|
+
*/
|
|
48
|
+
export declare function useParams<R extends keyof Routes>(route: R): Routes[R]['params'];
|
|
49
|
+
export declare function useParams(route?: string): Record<string, string | string[]>;
|
|
50
|
+
//# sourceMappingURL=use-params.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-params.d.ts","sourceRoot":"","sources":["../../src/client/use-params.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AASzC;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,GAAG,IAAI,CAEhF;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;AACjF,wBAAgB,SAAS,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* usePathname() — client-side hook for reading the current pathname.
|
|
3
|
+
*
|
|
4
|
+
* Returns the pathname portion of the current URL (e.g. '/dashboard/settings').
|
|
5
|
+
* Updates when client-side navigation changes the URL.
|
|
6
|
+
*
|
|
7
|
+
* This is a thin wrapper over window.location.pathname, provided for
|
|
8
|
+
* Next.js API compatibility (libraries like nuqs import usePathname
|
|
9
|
+
* from next/navigation).
|
|
10
|
+
*
|
|
11
|
+
* During SSR, reads the request pathname from the SSR ALS context
|
|
12
|
+
* (populated by ssr-entry.ts) instead of window.location.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Read the current URL pathname.
|
|
16
|
+
*
|
|
17
|
+
* Compatible with Next.js's `usePathname()` from `next/navigation`.
|
|
18
|
+
*/
|
|
19
|
+
export declare function usePathname(): string;
|
|
20
|
+
//# sourceMappingURL=use-pathname.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-pathname.d.ts","sourceRoot":"","sources":["../../src/client/use-pathname.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAuBH;;;;GAIG;AACH,wBAAgB,WAAW,IAAI,MAAM,CAEpC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useQueryStates — client-side hook for URL-synced search params.
|
|
3
|
+
*
|
|
4
|
+
* Delegates to nuqs for URL synchronization, batching, React 19 transitions,
|
|
5
|
+
* and throttled URL writes. Bridges timber's SearchParamCodec protocol to
|
|
6
|
+
* nuqs-compatible parsers.
|
|
7
|
+
*
|
|
8
|
+
* Design doc: design/23-search-params.md §"Codec Bridge"
|
|
9
|
+
*/
|
|
10
|
+
import type { SearchParamCodec, SearchParamsDefinition, SetParams, QueryStatesOptions } from '#/search-params/create.js';
|
|
11
|
+
/**
|
|
12
|
+
* Read and write typed search params from/to the URL.
|
|
13
|
+
*
|
|
14
|
+
* Delegates to nuqs internally. The timber nuqs adapter (auto-injected in
|
|
15
|
+
* browser-entry.ts) handles RSC navigation on non-shallow updates.
|
|
16
|
+
*
|
|
17
|
+
* Usage:
|
|
18
|
+
* ```ts
|
|
19
|
+
* // Via a SearchParamsDefinition
|
|
20
|
+
* const [params, setParams] = definition.useQueryStates()
|
|
21
|
+
*
|
|
22
|
+
* // Standalone with inline codecs
|
|
23
|
+
* const [params, setParams] = useQueryStates({
|
|
24
|
+
* page: fromSchema(z.coerce.number().int().min(1).default(1)),
|
|
25
|
+
* })
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare function useQueryStates<T extends Record<string, unknown>>(codecsOrRoute: {
|
|
29
|
+
[K in keyof T]: SearchParamCodec<T[K]>;
|
|
30
|
+
} | string, _options?: QueryStatesOptions, urlKeys?: Readonly<Record<string, string>>): [T, SetParams<T>];
|
|
31
|
+
/**
|
|
32
|
+
* Create a useQueryStates binding for a SearchParamsDefinition.
|
|
33
|
+
* This is used internally by SearchParamsDefinition.useQueryStates().
|
|
34
|
+
*/
|
|
35
|
+
export declare function bindUseQueryStates<T extends Record<string, unknown>>(definition: SearchParamsDefinition<T>): (options?: QueryStatesOptions) => [T, SetParams<T>];
|
|
36
|
+
//# sourceMappingURL=use-query-states.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-query-states.d.ts","sourceRoot":"","sources":["../../src/client/use-query-states.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,OAAO,KAAK,EACV,gBAAgB,EAChB,sBAAsB,EACtB,SAAS,EACT,kBAAkB,EACnB,MAAM,2BAA2B,CAAC;AAoCnC;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9D,aAAa,EAAE;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,GAAG,MAAM,EAClE,QAAQ,CAAC,EAAE,kBAAkB,EAC7B,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GACzC,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CA0CnB;AAID;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClE,UAAU,EAAE,sBAAsB,CAAC,CAAC,CAAC,GACpC,CAAC,OAAO,CAAC,EAAE,kBAAkB,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAIrD"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useRouter() — client-side hook for programmatic navigation.
|
|
3
|
+
*
|
|
4
|
+
* Returns a router instance with push, replace, refresh, back, forward,
|
|
5
|
+
* and prefetch methods. Compatible with Next.js's `useRouter()` from
|
|
6
|
+
* `next/navigation` (App Router).
|
|
7
|
+
*
|
|
8
|
+
* This wraps timber's internal RouterInstance in the Next.js-compatible
|
|
9
|
+
* AppRouterInstance shape that ecosystem libraries expect.
|
|
10
|
+
*/
|
|
11
|
+
export interface AppRouterInstance {
|
|
12
|
+
/** Navigate to a URL, pushing a new history entry */
|
|
13
|
+
push(href: string, options?: {
|
|
14
|
+
scroll?: boolean;
|
|
15
|
+
}): void;
|
|
16
|
+
/** Navigate to a URL, replacing the current history entry */
|
|
17
|
+
replace(href: string, options?: {
|
|
18
|
+
scroll?: boolean;
|
|
19
|
+
}): void;
|
|
20
|
+
/** Refresh the current page (re-fetch RSC payload) */
|
|
21
|
+
refresh(): void;
|
|
22
|
+
/** Navigate back in history */
|
|
23
|
+
back(): void;
|
|
24
|
+
/** Navigate forward in history */
|
|
25
|
+
forward(): void;
|
|
26
|
+
/** Prefetch an RSC payload for a URL */
|
|
27
|
+
prefetch(href: string): void;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Get a router instance for programmatic navigation.
|
|
31
|
+
*
|
|
32
|
+
* Compatible with Next.js's `useRouter()` from `next/navigation`.
|
|
33
|
+
*
|
|
34
|
+
* Returns a no-op router during SSR or before the client router is bootstrapped,
|
|
35
|
+
* so components that call useRouter() at the function level (e.g. TransitionLink)
|
|
36
|
+
* do not crash during server-side rendering.
|
|
37
|
+
*/
|
|
38
|
+
export declare function useRouter(): AppRouterInstance;
|
|
39
|
+
//# sourceMappingURL=use-router.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-router.d.ts","sourceRoot":"","sources":["../../src/client/use-router.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,MAAM,WAAW,iBAAiB;IAChC,qDAAqD;IACrD,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;IACzD,6DAA6D;IAC7D,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;IAC5D,sDAAsD;IACtD,OAAO,IAAI,IAAI,CAAC;IAChB,+BAA+B;IAC/B,IAAI,IAAI,IAAI,CAAC;IACb,kCAAkC;IAClC,OAAO,IAAI,IAAI,CAAC;IAChB,wCAAwC;IACxC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAYD;;;;;;;;GAQG;AACH,wBAAgB,SAAS,IAAI,iBAAiB,CA6B7C"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useSearchParams() — client-side hook for reading URL search params.
|
|
3
|
+
*
|
|
4
|
+
* Returns a read-only URLSearchParams instance reflecting the current
|
|
5
|
+
* URL's query string. Updates when client-side navigation changes the URL.
|
|
6
|
+
*
|
|
7
|
+
* This is a thin wrapper over window.location.search, provided for
|
|
8
|
+
* Next.js API compatibility (libraries like nuqs import useSearchParams
|
|
9
|
+
* from next/navigation).
|
|
10
|
+
*
|
|
11
|
+
* Unlike Next.js's ReadonlyURLSearchParams, this returns a standard
|
|
12
|
+
* URLSearchParams. Mutation methods (set, delete, append) work on the
|
|
13
|
+
* local copy but do NOT affect the URL — use the router or nuqs for that.
|
|
14
|
+
*
|
|
15
|
+
* During SSR, reads the request search params from the SSR ALS context
|
|
16
|
+
* (populated by ssr-entry.ts) instead of window.location.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Read the current URL search params.
|
|
20
|
+
*
|
|
21
|
+
* Compatible with Next.js's `useSearchParams()` from `next/navigation`.
|
|
22
|
+
*/
|
|
23
|
+
export declare function useSearchParams(): URLSearchParams;
|
|
24
|
+
//# sourceMappingURL=use-search-params.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-search-params.d.ts","sourceRoot":"","sources":["../../src/client/use-search-params.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AA8CH;;;;GAIG;AACH,wBAAgB,eAAe,IAAI,eAAe,CAMjD"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useSelectedLayoutSegment / useSelectedLayoutSegments — client-side hooks
|
|
3
|
+
* for reading the active segment(s) below the current layout.
|
|
4
|
+
*
|
|
5
|
+
* These hooks are used by navigation UIs to highlight active sections.
|
|
6
|
+
* They match Next.js's API from next/navigation.
|
|
7
|
+
*
|
|
8
|
+
* How they work:
|
|
9
|
+
* 1. Each layout is wrapped with a SegmentProvider that records its depth
|
|
10
|
+
* (the URL segments from root to that layout level).
|
|
11
|
+
* 2. The hooks read the current URL pathname via usePathname().
|
|
12
|
+
* 3. They compare the layout's segment depth against the full URL segments
|
|
13
|
+
* to determine which child segments are "selected" below.
|
|
14
|
+
*
|
|
15
|
+
* Example: For URL "/dashboard/settings/profile"
|
|
16
|
+
* - Root layout (depth 0, segments: ['']): selected segment = "dashboard"
|
|
17
|
+
* - Dashboard layout (depth 1, segments: ['', 'dashboard']): selected = "settings"
|
|
18
|
+
* - Settings layout (depth 2, segments: ['', 'dashboard', 'settings']): selected = "profile"
|
|
19
|
+
*
|
|
20
|
+
* Design docs: design/19-client-navigation.md, design/14-ecosystem.md
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* Split a pathname into URL segments.
|
|
24
|
+
* "/" → [""]
|
|
25
|
+
* "/dashboard" → ["", "dashboard"]
|
|
26
|
+
* "/dashboard/settings" → ["", "dashboard", "settings"]
|
|
27
|
+
*/
|
|
28
|
+
export declare function pathnameToSegments(pathname: string): string[];
|
|
29
|
+
/**
|
|
30
|
+
* Pure function: compute the selected child segment given a layout's segment
|
|
31
|
+
* depth and the current URL pathname.
|
|
32
|
+
*
|
|
33
|
+
* @param contextSegments — segments from root to the calling layout, or null if no context
|
|
34
|
+
* @param pathname — current URL pathname
|
|
35
|
+
* @returns the active child segment one level below, or null if at the leaf
|
|
36
|
+
*/
|
|
37
|
+
export declare function getSelectedSegment(contextSegments: string[] | null, pathname: string): string | null;
|
|
38
|
+
/**
|
|
39
|
+
* Pure function: compute all selected segments below a layout's depth.
|
|
40
|
+
*
|
|
41
|
+
* @param contextSegments — segments from root to the calling layout, or null if no context
|
|
42
|
+
* @param pathname — current URL pathname
|
|
43
|
+
* @returns all active segments below the layout
|
|
44
|
+
*/
|
|
45
|
+
export declare function getSelectedSegments(contextSegments: string[] | null, pathname: string): string[];
|
|
46
|
+
/**
|
|
47
|
+
* Returns the active child segment one level below the layout where this
|
|
48
|
+
* hook is called. Returns `null` if the layout is the leaf (no child segment).
|
|
49
|
+
*
|
|
50
|
+
* Compatible with Next.js's `useSelectedLayoutSegment()` from `next/navigation`.
|
|
51
|
+
*
|
|
52
|
+
* @param parallelRouteKey — Optional parallel route key. Currently unused
|
|
53
|
+
* (parallel route segment tracking is not yet implemented). Accepted for
|
|
54
|
+
* API compatibility with Next.js.
|
|
55
|
+
*/
|
|
56
|
+
export declare function useSelectedLayoutSegment(parallelRouteKey?: string): string | null;
|
|
57
|
+
/**
|
|
58
|
+
* Returns all active segments below the layout where this hook is called.
|
|
59
|
+
* Returns an empty array if the layout is the leaf (no child segments).
|
|
60
|
+
*
|
|
61
|
+
* Compatible with Next.js's `useSelectedLayoutSegments()` from `next/navigation`.
|
|
62
|
+
*
|
|
63
|
+
* @param parallelRouteKey — Optional parallel route key. Currently unused
|
|
64
|
+
* (parallel route segment tracking is not yet implemented). Accepted for
|
|
65
|
+
* API compatibility with Next.js.
|
|
66
|
+
*/
|
|
67
|
+
export declare function useSelectedLayoutSegments(parallelRouteKey?: string): string[];
|
|
68
|
+
//# sourceMappingURL=use-selected-layout-segment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-selected-layout-segment.d.ts","sourceRoot":"","sources":["../../src/client/use-selected-layout-segment.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAOH;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAE7D;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAChC,eAAe,EAAE,MAAM,EAAE,GAAG,IAAI,EAChC,QAAQ,EAAE,MAAM,GACf,MAAM,GAAG,IAAI,CASf;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,eAAe,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAShG;AAED;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,CAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAKjF;AAED;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAK7E"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @timber/app/content — Public API for content collections.
|
|
3
|
+
*
|
|
4
|
+
* Re-exports from content-collections and provides timber-specific utilities.
|
|
5
|
+
* Users can import directly from 'content-collections' for generated types,
|
|
6
|
+
* or use this module for the re-exports.
|
|
7
|
+
*
|
|
8
|
+
* Design doc: 20-content-collections.md §"Querying Collections"
|
|
9
|
+
*/
|
|
10
|
+
export { defineCollection, defineConfig } from '@content-collections/core';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/content/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* defineCookie — typed cookie definitions.
|
|
3
|
+
*
|
|
4
|
+
* Bundles name + codec + options into a reusable CookieDefinition<T>
|
|
5
|
+
* with .get(), .set(), .delete() server methods and a .useCookie() client hook.
|
|
6
|
+
*
|
|
7
|
+
* Reuses the SearchParamCodec protocol via fromSchema() bridge.
|
|
8
|
+
* Validation on read returns the codec default (never throws).
|
|
9
|
+
*
|
|
10
|
+
* See design/29-cookies.md §"Typed Cookies with Schema Validation"
|
|
11
|
+
*/
|
|
12
|
+
import type { CookieOptions } from '#/server/request-context.js';
|
|
13
|
+
/**
|
|
14
|
+
* A codec that converts between string cookie values and typed values.
|
|
15
|
+
* Intentionally identical to SearchParamCodec<T>.
|
|
16
|
+
*/
|
|
17
|
+
export interface CookieCodec<T> {
|
|
18
|
+
parse(value: string | string[] | undefined): T;
|
|
19
|
+
serialize(value: T): string | null;
|
|
20
|
+
}
|
|
21
|
+
/** Options for defineCookie: codec + CookieOptions merged. */
|
|
22
|
+
export interface DefineCookieOptions<T> extends Omit<CookieOptions, 'signed'> {
|
|
23
|
+
/** Codec for parsing/serializing the cookie value. */
|
|
24
|
+
codec: CookieCodec<T>;
|
|
25
|
+
/** Sign the cookie with HMAC-SHA256. */
|
|
26
|
+
signed?: boolean;
|
|
27
|
+
}
|
|
28
|
+
/** A fully typed cookie definition with server and client methods. */
|
|
29
|
+
export interface CookieDefinition<T> {
|
|
30
|
+
/** The cookie name. */
|
|
31
|
+
readonly name: string;
|
|
32
|
+
/** The resolved cookie options (without codec). */
|
|
33
|
+
readonly options: CookieOptions;
|
|
34
|
+
/** The codec used for parsing/serializing. */
|
|
35
|
+
readonly codec: CookieCodec<T>;
|
|
36
|
+
/** Server: read the typed value from the current request. */
|
|
37
|
+
get(): T;
|
|
38
|
+
/** Server: set the typed value on the response. */
|
|
39
|
+
set(value: T): void;
|
|
40
|
+
/** Server: delete the cookie. */
|
|
41
|
+
delete(): void;
|
|
42
|
+
/** Client: React hook for reading/writing this cookie. Returns [value, setter, deleter]. */
|
|
43
|
+
useCookie(): [T, (value: T) => void, () => void];
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Define a typed cookie.
|
|
47
|
+
*
|
|
48
|
+
* ```ts
|
|
49
|
+
* import { defineCookie } from '@timber/app/cookies';
|
|
50
|
+
* import { fromSchema } from '@timber/app/search-params';
|
|
51
|
+
* import { z } from 'zod/v4';
|
|
52
|
+
*
|
|
53
|
+
* export const themeCookie = defineCookie('theme', {
|
|
54
|
+
* codec: fromSchema(z.enum(['light', 'dark', 'system']).default('system')),
|
|
55
|
+
* httpOnly: false,
|
|
56
|
+
* maxAge: 60 * 60 * 24 * 365,
|
|
57
|
+
* });
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
export declare function defineCookie<T>(name: string, options: DefineCookieOptions<T>): CookieDefinition<T>;
|
|
61
|
+
//# sourceMappingURL=define-cookie.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define-cookie.d.ts","sourceRoot":"","sources":["../../src/cookies/define-cookie.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAMjE;;;GAGG;AACH,MAAM,WAAW,WAAW,CAAC,CAAC;IAC5B,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,GAAG,CAAC,CAAC;IAC/C,SAAS,CAAC,KAAK,EAAE,CAAC,GAAG,MAAM,GAAG,IAAI,CAAC;CACpC;AAED,8DAA8D;AAC9D,MAAM,WAAW,mBAAmB,CAAC,CAAC,CAAE,SAAQ,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC;IAC3E,sDAAsD;IACtD,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;IACtB,wCAAwC;IACxC,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,sEAAsE;AACtE,MAAM,WAAW,gBAAgB,CAAC,CAAC;IACjC,uBAAuB;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,mDAAmD;IACnD,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC;IAChC,8CAA8C;IAC9C,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;IAE/B,6DAA6D;IAC7D,GAAG,IAAI,CAAC,CAAC;IACT,mDAAmD;IACnD,GAAG,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;IACpB,iCAAiC;IACjC,MAAM,IAAI,IAAI,CAAC;IAEf,4FAA4F;IAC5F,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,EAAE,MAAM,IAAI,CAAC,CAAC;CAClD;AAID;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAC5B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,mBAAmB,CAAC,CAAC,CAAC,GAC9B,gBAAgB,CAAC,CAAC,CAAC,CA4DrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cookies/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,YAAY,EACV,gBAAgB,EAChB,WAAW,EACX,mBAAmB,GACpB,MAAM,oBAAoB,CAAC"}
|