@bleedingdev/modern-js-renderer-solid 0.0.0-stage → 3.9.3-ultramodern.1
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/dist/esm/actions.js +283 -0
- package/dist/esm/application-router.js +25 -0
- package/dist/esm/client.js +49 -0
- package/dist/esm/entry-application.js +60 -0
- package/dist/esm/entry-client.js +23 -0
- package/dist/esm/federation-context.js +25 -0
- package/dist/esm/federation-ssr.js +84 -0
- package/dist/esm/federation.js +83 -0
- package/dist/esm/i18n/I18nProvider.js +33 -0
- package/dist/esm/i18n/LocalizedLink.js +74 -0
- package/dist/esm/i18n/context.js +3 -0
- package/dist/esm/i18n/index.js +8 -0
- package/dist/esm/i18n/languageSync.js +50 -0
- package/dist/esm/i18n/types.js +0 -0
- package/dist/esm/i18n/useI18n.js +74 -0
- package/dist/esm/index.js +58 -0
- package/dist/esm/manifest.js +150 -0
- package/dist/esm/route-completion.js +150 -0
- package/dist/esm/route-data-error.js +108 -0
- package/dist/esm/router-binding/Asset.js +201 -0
- package/dist/esm/router-binding/CatchBoundary.js +94 -0
- package/dist/esm/router-binding/ClientOnly.js +26 -0
- package/dist/esm/router-binding/HeadContent.js +8 -0
- package/dist/esm/router-binding/LICENSE +21 -0
- package/dist/esm/router-binding/Match.js +319 -0
- package/dist/esm/router-binding/Matches.js +117 -0
- package/dist/esm/router-binding/PROVENANCE.json +94 -0
- package/dist/esm/router-binding/RouterProvider.js +51 -0
- package/dist/esm/router-binding/SafeFragment.js +5 -0
- package/dist/esm/router-binding/ScriptOnce.js +15 -0
- package/dist/esm/router-binding/Scripts.js +30 -0
- package/dist/esm/router-binding/ScrollRestoration.js +16 -0
- package/dist/esm/router-binding/Transitioner.js +103 -0
- package/dist/esm/router-binding/awaited.js +48 -0
- package/dist/esm/router-binding/fileRoute.js +83 -0
- package/dist/esm/router-binding/flightData.js +23 -0
- package/dist/esm/router-binding/headContentUtils.js +162 -0
- package/dist/esm/router-binding/history.js +0 -0
- package/dist/esm/router-binding/index.js +35 -0
- package/dist/esm/router-binding/lazyRouteComponent.js +30 -0
- package/dist/esm/router-binding/link.js +389 -0
- package/dist/esm/router-binding/matchContext.js +7 -0
- package/dist/esm/router-binding/nonRouteComponentContext.js +13 -0
- package/dist/esm/router-binding/not-found.js +35 -0
- package/dist/esm/router-binding/publicMatchData.js +447 -0
- package/dist/esm/router-binding/registryTransfer.js +210 -0
- package/dist/esm/router-binding/renderRouteNotFound.js +23 -0
- package/dist/esm/router-binding/route.js +143 -0
- package/dist/esm/router-binding/router.js +13 -0
- package/dist/esm/router-binding/routerContext.js +3 -0
- package/dist/esm/router-binding/routerStores.js +50 -0
- package/dist/esm/router-binding/scroll-restoration.js +13 -0
- package/dist/esm/router-binding/typePrimitives.js +0 -0
- package/dist/esm/router-binding/useBlocker.js +152 -0
- package/dist/esm/router-binding/useCanGoBack.js +7 -0
- package/dist/esm/router-binding/useLoaderData.js +9 -0
- package/dist/esm/router-binding/useLoaderDeps.js +8 -0
- package/dist/esm/router-binding/useLocation.js +14 -0
- package/dist/esm/router-binding/useMatch.js +28 -0
- package/dist/esm/router-binding/useNavigate.js +19 -0
- package/dist/esm/router-binding/useParams.js +13 -0
- package/dist/esm/router-binding/useRouteContext.js +8 -0
- package/dist/esm/router-binding/useRouter.js +10 -0
- package/dist/esm/router-binding/useRouterState.js +19 -0
- package/dist/esm/router-binding/useSearch.js +13 -0
- package/dist/esm/router-binding/utils.js +23 -0
- package/dist/esm/router.js +187 -0
- package/dist/esm-node/actions.js +263 -0
- package/dist/esm-node/application-router.js +25 -0
- package/dist/esm-node/client.js +49 -0
- package/dist/esm-node/entry-application.js +110 -0
- package/dist/esm-node/entry-client.js +23 -0
- package/dist/esm-node/entry-server.js +47 -0
- package/dist/esm-node/federation-context.js +25 -0
- package/dist/esm-node/federation-ssr.js +84 -0
- package/dist/esm-node/federation.js +83 -0
- package/dist/esm-node/i18n/I18nProvider.js +42 -0
- package/dist/esm-node/i18n/LocalizedLink.js +142 -0
- package/dist/esm-node/i18n/context.js +3 -0
- package/dist/esm-node/i18n/index.js +8 -0
- package/dist/esm-node/i18n/languageSync.js +50 -0
- package/dist/esm-node/i18n/types.js +1 -0
- package/dist/esm-node/i18n/useI18n.js +74 -0
- package/dist/esm-node/index.js +58 -0
- package/dist/esm-node/manifest.js +150 -0
- package/dist/esm-node/native-promise-serialization.js +113 -0
- package/dist/esm-node/plugin/compiler.js +209 -0
- package/dist/esm-node/plugin/create.js +235 -0
- package/dist/esm-node/plugin/index.js +73 -0
- package/dist/esm-node/plugin/profile.js +52 -0
- package/dist/esm-node/route-completion.js +160 -0
- package/dist/esm-node/route-data-error.js +108 -0
- package/dist/esm-node/router-binding/Asset.js +171 -0
- package/dist/esm-node/router-binding/CatchBoundary.js +136 -0
- package/dist/esm-node/router-binding/ClientOnly.js +46 -0
- package/dist/esm-node/router-binding/HeadContent.js +8 -0
- package/dist/esm-node/router-binding/LICENSE +21 -0
- package/dist/esm-node/router-binding/Match.js +660 -0
- package/dist/esm-node/router-binding/Matches.js +161 -0
- package/dist/esm-node/router-binding/PROVENANCE.json +94 -0
- package/dist/esm-node/router-binding/RouterProvider.js +87 -0
- package/dist/esm-node/router-binding/SafeFragment.js +5 -0
- package/dist/esm-node/router-binding/ScriptOnce.js +16 -0
- package/dist/esm-node/router-binding/Scripts.js +49 -0
- package/dist/esm-node/router-binding/ScrollRestoration.js +16 -0
- package/dist/esm-node/router-binding/Transitioner.js +103 -0
- package/dist/esm-node/router-binding/awaited.js +75 -0
- package/dist/esm-node/router-binding/fileRoute.js +83 -0
- package/dist/esm-node/router-binding/flightData.js +23 -0
- package/dist/esm-node/router-binding/headContentUtils.js +162 -0
- package/dist/esm-node/router-binding/history.js +1 -0
- package/dist/esm-node/router-binding/index.js +35 -0
- package/dist/esm-node/router-binding/lazyRouteComponent.js +30 -0
- package/dist/esm-node/router-binding/link.js +399 -0
- package/dist/esm-node/router-binding/matchContext.js +7 -0
- package/dist/esm-node/router-binding/nonRouteComponentContext.js +22 -0
- package/dist/esm-node/router-binding/not-found.js +49 -0
- package/dist/esm-node/router-binding/publicMatchData.js +447 -0
- package/dist/esm-node/router-binding/registryTransfer.js +210 -0
- package/dist/esm-node/router-binding/renderRouteNotFound.js +22 -0
- package/dist/esm-node/router-binding/route.js +162 -0
- package/dist/esm-node/router-binding/router.js +13 -0
- package/dist/esm-node/router-binding/routerContext.js +3 -0
- package/dist/esm-node/router-binding/routerStores.js +50 -0
- package/dist/esm-node/router-binding/scroll-restoration.js +12 -0
- package/dist/esm-node/router-binding/typePrimitives.js +1 -0
- package/dist/esm-node/router-binding/useBlocker.js +152 -0
- package/dist/esm-node/router-binding/useCanGoBack.js +7 -0
- package/dist/esm-node/router-binding/useLoaderData.js +9 -0
- package/dist/esm-node/router-binding/useLoaderDeps.js +8 -0
- package/dist/esm-node/router-binding/useLocation.js +14 -0
- package/dist/esm-node/router-binding/useMatch.js +28 -0
- package/dist/esm-node/router-binding/useNavigate.js +19 -0
- package/dist/esm-node/router-binding/useParams.js +13 -0
- package/dist/esm-node/router-binding/useRouteContext.js +8 -0
- package/dist/esm-node/router-binding/useRouter.js +10 -0
- package/dist/esm-node/router-binding/useRouterState.js +19 -0
- package/dist/esm-node/router-binding/useSearch.js +13 -0
- package/dist/esm-node/router-binding/utils.js +23 -0
- package/dist/esm-node/router.js +187 -0
- package/dist/esm-node/server.js +396 -0
- package/dist/types/actions.d.ts +45 -0
- package/dist/types/application-router.d.ts +5 -0
- package/dist/types/client.d.ts +23 -0
- package/dist/types/entry-application.d.ts +10 -0
- package/dist/types/entry-client.d.ts +5 -0
- package/dist/types/entry-server.d.ts +5 -0
- package/dist/types/federation-context.d.ts +16 -0
- package/dist/types/federation-ssr.d.ts +21 -0
- package/dist/types/federation.d.ts +30 -0
- package/dist/types/i18n/I18nProvider.d.ts +21 -0
- package/dist/types/i18n/LocalizedLink.d.ts +43 -0
- package/dist/types/i18n/context.d.ts +11 -0
- package/dist/types/i18n/index.d.ts +9 -0
- package/dist/types/i18n/languageSync.d.ts +31 -0
- package/dist/types/i18n/types.d.ts +33 -0
- package/dist/types/i18n/useI18n.d.ts +24 -0
- package/dist/types/index.d.ts +41 -0
- package/dist/types/manifest.d.ts +55 -0
- package/dist/types/native-promise-serialization.d.ts +9 -0
- package/dist/types/plugin/compiler.d.ts +6 -0
- package/dist/types/plugin/create.d.ts +21 -0
- package/dist/types/plugin/index.d.ts +3 -0
- package/dist/types/plugin/lazy-modules.d.cts +15 -0
- package/dist/types/plugin/preserve-import-loader.d.cts +3 -0
- package/dist/types/plugin/profile.d.ts +2 -0
- package/dist/types/plugin/solid-loader.d.cts +2 -0
- package/dist/types/plugin/svg-component-template.d.cts +6 -0
- package/dist/types/route-completion.d.ts +21 -0
- package/dist/types/route-data-error.d.ts +17 -0
- package/dist/types/router-binding/Asset.d.ts +3 -0
- package/dist/types/router-binding/CatchBoundary.d.ts +13 -0
- package/dist/types/router-binding/ClientOnly.d.ts +31 -0
- package/dist/types/router-binding/HeadContent.d.ts +13 -0
- package/dist/types/router-binding/Match.d.ts +6 -0
- package/dist/types/router-binding/Matches.d.ts +26 -0
- package/dist/types/router-binding/RouterProvider.d.ts +10 -0
- package/dist/types/router-binding/SafeFragment.d.ts +2 -0
- package/dist/types/router-binding/ScriptOnce.d.ts +6 -0
- package/dist/types/router-binding/Scripts.d.ts +2 -0
- package/dist/types/router-binding/ScrollRestoration.d.ts +14 -0
- package/dist/types/router-binding/Transitioner.d.ts +2 -0
- package/dist/types/router-binding/awaited.d.ts +11 -0
- package/dist/types/router-binding/fileRoute.d.ts +54 -0
- package/dist/types/router-binding/flightData.d.ts +38 -0
- package/dist/types/router-binding/headContentUtils.d.ts +15 -0
- package/dist/types/router-binding/history.d.ts +8 -0
- package/dist/types/router-binding/index.d.ts +45 -0
- package/dist/types/router-binding/lazyRouteComponent.d.ts +2 -0
- package/dist/types/router-binding/link.d.ts +43 -0
- package/dist/types/router-binding/matchContext.d.ts +7 -0
- package/dist/types/router-binding/nonRouteComponentContext.d.ts +5 -0
- package/dist/types/router-binding/not-found.d.ts +11 -0
- package/dist/types/router-binding/publicMatchData.d.ts +19 -0
- package/dist/types/router-binding/registryTransfer.d.ts +47 -0
- package/dist/types/router-binding/renderRouteNotFound.d.ts +11 -0
- package/dist/types/router-binding/route.d.ts +105 -0
- package/dist/types/router-binding/router.d.ts +70 -0
- package/dist/types/router-binding/routerContext.d.ts +3 -0
- package/dist/types/router-binding/routerStores.d.ts +2 -0
- package/dist/types/router-binding/scroll-restoration.d.ts +2 -0
- package/dist/types/router-binding/typePrimitives.d.ts +10 -0
- package/dist/types/router-binding/useBlocker.d.ts +70 -0
- package/dist/types/router-binding/useCanGoBack.d.ts +2 -0
- package/dist/types/router-binding/useLoaderData.d.ts +8 -0
- package/dist/types/router-binding/useLoaderDeps.d.ts +8 -0
- package/dist/types/router-binding/useLocation.d.ts +7 -0
- package/dist/types/router-binding/useMatch.d.ts +10 -0
- package/dist/types/router-binding/useNavigate.d.ts +5 -0
- package/dist/types/router-binding/useParams.d.ts +9 -0
- package/dist/types/router-binding/useRouteContext.d.ts +4 -0
- package/dist/types/router-binding/useRouter.d.ts +4 -0
- package/dist/types/router-binding/useRouterState.d.ts +8 -0
- package/dist/types/router-binding/useSearch.d.ts +9 -0
- package/dist/types/router-binding/utils.d.ts +25 -0
- package/dist/types/router.d.ts +31 -0
- package/dist/types/server.d.ts +47 -0
- package/package.json +123 -4
- package/src/actions.tsx +437 -0
- package/src/application-router.tsx +41 -0
- package/src/client.ts +106 -0
- package/src/entry-application.tsx +73 -0
- package/src/entry-client.tsx +48 -0
- package/src/entry-server.tsx +85 -0
- package/src/federation-context.ts +47 -0
- package/src/federation-ssr.ts +117 -0
- package/src/federation.tsx +193 -0
- package/src/i18n/I18nProvider.tsx +54 -0
- package/src/i18n/LocalizedLink.tsx +122 -0
- package/src/i18n/context.ts +13 -0
- package/src/i18n/index.ts +35 -0
- package/src/i18n/languageSync.ts +113 -0
- package/src/i18n/types.ts +35 -0
- package/src/i18n/useI18n.ts +121 -0
- package/src/index.ts +41 -0
- package/src/manifest.ts +337 -0
- package/src/native-promise-serialization.ts +167 -0
- package/src/plugin/compiler.ts +320 -0
- package/src/plugin/create.ts +270 -0
- package/src/plugin/index.ts +72 -0
- package/src/plugin/lazy-modules.cjs +146 -0
- package/src/plugin/preserve-import-loader.cjs +46 -0
- package/src/plugin/profile.ts +42 -0
- package/src/plugin/solid-loader.cjs +83 -0
- package/src/plugin/svg-component-template.cjs +19 -0
- package/src/route-completion.tsx +222 -0
- package/src/route-data-error.ts +175 -0
- package/src/router-binding/Asset.tsx +283 -0
- package/src/router-binding/CatchBoundary.tsx +130 -0
- package/src/router-binding/ClientOnly.tsx +76 -0
- package/src/router-binding/HeadContent.tsx +23 -0
- package/src/router-binding/LICENSE +21 -0
- package/src/router-binding/Match.tsx +397 -0
- package/src/router-binding/Matches.tsx +242 -0
- package/src/router-binding/PROVENANCE.json +94 -0
- package/src/router-binding/RouterProvider.tsx +129 -0
- package/src/router-binding/SafeFragment.tsx +5 -0
- package/src/router-binding/ScriptOnce.tsx +23 -0
- package/src/router-binding/Scripts.tsx +44 -0
- package/src/router-binding/ScrollRestoration.tsx +49 -0
- package/src/router-binding/Transitioner.tsx +172 -0
- package/src/router-binding/awaited.tsx +71 -0
- package/src/router-binding/fileRoute.ts +268 -0
- package/src/router-binding/flightData.ts +90 -0
- package/src/router-binding/headContentUtils.tsx +290 -0
- package/src/router-binding/history.ts +9 -0
- package/src/router-binding/index.tsx +318 -0
- package/src/router-binding/lazyRouteComponent.tsx +70 -0
- package/src/router-binding/link.tsx +865 -0
- package/src/router-binding/matchContext.tsx +15 -0
- package/src/router-binding/nonRouteComponentContext.tsx +23 -0
- package/src/router-binding/not-found.tsx +65 -0
- package/src/router-binding/publicMatchData.ts +674 -0
- package/src/router-binding/registryTransfer.ts +383 -0
- package/src/router-binding/renderRouteNotFound.tsx +53 -0
- package/src/router-binding/route.tsx +665 -0
- package/src/router-binding/router.ts +121 -0
- package/src/router-binding/routerContext.tsx +6 -0
- package/src/router-binding/routerStores.ts +85 -0
- package/src/router-binding/scroll-restoration.tsx +15 -0
- package/src/router-binding/typePrimitives.ts +74 -0
- package/src/router-binding/useBlocker.tsx +359 -0
- package/src/router-binding/useCanGoBack.ts +9 -0
- package/src/router-binding/useLoaderData.tsx +50 -0
- package/src/router-binding/useLoaderDeps.tsx +46 -0
- package/src/router-binding/useLocation.tsx +43 -0
- package/src/router-binding/useMatch.tsx +111 -0
- package/src/router-binding/useNavigate.tsx +43 -0
- package/src/router-binding/useParams.tsx +72 -0
- package/src/router-binding/useRouteContext.ts +30 -0
- package/src/router-binding/useRouter.tsx +17 -0
- package/src/router-binding/useRouterState.tsx +50 -0
- package/src/router-binding/useSearch.tsx +72 -0
- package/src/router-binding/utils.ts +59 -0
- package/src/router.ts +376 -0
- package/src/server.ts +645 -0
- package/README.md +0 -3
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { LocalisedUrlsOption } from '@modern-js/i18n-runtime-extensions/paths';
|
|
2
|
+
import { type NativeI18nInstance, type NativeServerEntry, type NativeServerEntryOptions } from '@modern-js/renderer-core/entry-server';
|
|
3
|
+
export type SolidServerEntryOptions = NativeServerEntryOptions<NativeI18nInstance, LocalisedUrlsOption>;
|
|
4
|
+
/** The native transport handlers of a generated Solid server entry. */
|
|
5
|
+
export declare function createNativeServerEntry(options: SolidServerEntryOptions): NativeServerEntry;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type FederationInstance, type NativeFederationBinding } from '@modern-js/renderer-core/federation';
|
|
2
|
+
import type { JSX } from '@solidjs/web';
|
|
3
|
+
/** One application owns its host runtime; each response owns its render scope. */
|
|
4
|
+
export interface SolidFederationScope {
|
|
5
|
+
readonly instance: FederationInstance | undefined;
|
|
6
|
+
/** Server scopes: the host's client module that hydrates a remote. */
|
|
7
|
+
readonly hydrationModule?: string;
|
|
8
|
+
}
|
|
9
|
+
/** Outside a generated entry, remote ids have no host; custom loaders work. */
|
|
10
|
+
export declare const FederationContext: import("solid-js").Context<SolidFederationScope>;
|
|
11
|
+
export declare function createFederationScope(binding: NativeFederationBinding | undefined): SolidFederationScope | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* Provide the scope to an application view. The server and the browser wrap
|
|
14
|
+
* the same view, so both render the provider at the same hydration position.
|
|
15
|
+
*/
|
|
16
|
+
export declare function provideFederation(scope: SolidFederationScope | undefined, view: () => JSX.Element): () => JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { SolidFederationScope } from './federation-context.js';
|
|
2
|
+
/**
|
|
3
|
+
* The server half of same-renderer Module Federation. federatedComponent()
|
|
4
|
+
* names each remote it server-rendered by an asset key, and the response's
|
|
5
|
+
* document resolves that key through the same host's federation scope.
|
|
6
|
+
*/
|
|
7
|
+
/** Asset keys for server-rendered remotes, e.g. `ultramodern-federation:remote/Widget`. */
|
|
8
|
+
export declare const FEDERATED_ASSET_PREFIX = "ultramodern-federation:";
|
|
9
|
+
/** The host's server state for a remote: its browser assets and hydration module. */
|
|
10
|
+
export declare function federatedServerAssets(scope: SolidFederationScope | undefined, id: string): {
|
|
11
|
+
hydration: string;
|
|
12
|
+
assets: import("@modern-js/renderer-core/federation").FederatedAssets;
|
|
13
|
+
} | undefined;
|
|
14
|
+
export declare function federatedAssetKey(id: string): string;
|
|
15
|
+
/**
|
|
16
|
+
* Extend a static Solid asset manifest with the remotes this response
|
|
17
|
+
* server-rendered through its host. The first module is the host's hydration
|
|
18
|
+
* module for that remote, which Solid imports before hydrating the boundary
|
|
19
|
+
* that rendered it.
|
|
20
|
+
*/
|
|
21
|
+
export declare function withFederatedAssets<Manifest>(manifest: Manifest, scope: SolidFederationScope | undefined): Manifest;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type JSX } from '@solidjs/web';
|
|
2
|
+
import { type Component } from 'solid-js';
|
|
3
|
+
/** The module shape a same-renderer Module Federation remote exposes. */
|
|
4
|
+
export interface FederatedModule<P extends object> {
|
|
5
|
+
readonly default: Component<P>;
|
|
6
|
+
}
|
|
7
|
+
export interface FederatedComponentOptions {
|
|
8
|
+
/** Rendered while the remote loads, and on the server when it cannot load. */
|
|
9
|
+
readonly fallback?: () => JSX.Element;
|
|
10
|
+
/**
|
|
11
|
+
* Milliseconds a remote load may take before it fails. Defaults to 3000 on
|
|
12
|
+
* the server, so an unavailable remote cannot hold the document; the
|
|
13
|
+
* browser waits without a limit unless one is given.
|
|
14
|
+
*/
|
|
15
|
+
readonly timeout?: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Render a Solid component exposed by a Module Federation remote, by its
|
|
19
|
+
* `remote/Expose` id or a custom loader.
|
|
20
|
+
*
|
|
21
|
+
* A remote id loads through the federation instance of the application that
|
|
22
|
+
* renders it, so co-located hosts keep their own remotes. On the server it
|
|
23
|
+
* renders into the document with the remote's stylesheets and module
|
|
24
|
+
* preloads; the browser loads the same remote before hydrating it.
|
|
25
|
+
* A remote that fails or exceeds its timeout on the server renders the
|
|
26
|
+
* fallback, and the browser retries it after hydration. Custom loaders render
|
|
27
|
+
* in the browser only. Browser load and renderer-admission failures throw to
|
|
28
|
+
* the nearest `Errored` boundary.
|
|
29
|
+
*/
|
|
30
|
+
export declare function federatedComponent<P extends object = Record<string, never>>(remote: string | (() => Promise<FederatedModule<P>>), options?: FederatedComponentOptions): Component<P>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { JSX } from '@solidjs/web';
|
|
2
|
+
import type { I18nContextValue } from './types.js';
|
|
3
|
+
export interface I18nProviderProps extends Omit<I18nContextValue, 'language'> {
|
|
4
|
+
children: JSX.Element;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Provides a per-request i18next-shaped instance to the Solid tree. The
|
|
8
|
+
* instance must come from the caller (created with `cloneInstance` per
|
|
9
|
+
* request on the server, and the same instance reused on hydration) — this
|
|
10
|
+
* provider holds no module-level state of its own beyond the one reactive
|
|
11
|
+
* `language` signal it derives from `instance` and shares with every
|
|
12
|
+
* consumer through context (see `I18nContextValue.language`'s doc for why
|
|
13
|
+
* that single shared subscription matters, instead of each consumer
|
|
14
|
+
* subscribing to `languageChanged` independently).
|
|
15
|
+
*
|
|
16
|
+
* In Solid 2 a `Context` doubles as its own provider component: `value` is
|
|
17
|
+
* read reactively off `props` here, so an ancestor re-rendering this
|
|
18
|
+
* provider with a new `instance`/`languages`/`localisedUrls` propagates
|
|
19
|
+
* without needing a `.Provider` subcomponent.
|
|
20
|
+
*/
|
|
21
|
+
export declare function I18nProvider(props: I18nProviderProps): JSX.Element;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { JSX } from '@solidjs/web';
|
|
2
|
+
import { type LinkComponentProps } from '../router.js';
|
|
3
|
+
export interface LocalizedLinkProps {
|
|
4
|
+
/** A canonical, language-agnostic target, e.g. `/products/red-shoe`. */
|
|
5
|
+
to: string;
|
|
6
|
+
/** Localize for a specific language instead of the current one. */
|
|
7
|
+
language?: string;
|
|
8
|
+
children?: LinkComponentProps<'a'>['children'];
|
|
9
|
+
class?: string;
|
|
10
|
+
activeProps?: LinkComponentProps<'a'>['activeProps'];
|
|
11
|
+
inactiveProps?: LinkComponentProps<'a'>['inactiveProps'];
|
|
12
|
+
activeOptions?: LinkComponentProps<'a'>['activeOptions'];
|
|
13
|
+
replace?: boolean;
|
|
14
|
+
preload?: LinkComponentProps<'a'>['preload'];
|
|
15
|
+
[key: `data-${string}`]: unknown;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* A thin wrapper over the native Solid router `Link` that localizes a
|
|
19
|
+
* canonical `to` for the current (or an explicit) language before handing it
|
|
20
|
+
* to the real link, the same contract as `@modern-js/plugin-i18n`'s React
|
|
21
|
+
* `Link`. It resolves the href itself via the shared pathname helpers, so it
|
|
22
|
+
* works with or without the router's i18n `rewrite`. Every link, including
|
|
23
|
+
* one to another language, is the native `Link`: navigation, preloading and
|
|
24
|
+
* active state stay with the router.
|
|
25
|
+
*
|
|
26
|
+
* Under the i18n `rewrite` the router matches canonical paths and localizes
|
|
27
|
+
* outgoing locations to the current language, so a link to another language
|
|
28
|
+
* routes to the canonical `to` and publishes the target language's URL as a
|
|
29
|
+
* route mask (the rewrite keeps a mask's explicit language). The entry's
|
|
30
|
+
* router language synchronization (`syncWithRouter`) switches the i18next
|
|
31
|
+
* instance from the navigated URL, as it does for history navigation.
|
|
32
|
+
*
|
|
33
|
+
* Props are forwarded explicitly (not via object-rest or a missing
|
|
34
|
+
* `splitProps`/`mergeProps` primitive — Solid 2 only exports `merge`) so
|
|
35
|
+
* each one is read directly from `props` in JSX position and keeps its
|
|
36
|
+
* per-key reactivity.
|
|
37
|
+
*/
|
|
38
|
+
export declare function LocalizedLink(props: LocalizedLinkProps): JSX.Element;
|
|
39
|
+
/**
|
|
40
|
+
* Language-invariant active check: `to="/products"` is active whether the
|
|
41
|
+
* current location is `/en/products` or `/produkty` under a mapped locale.
|
|
42
|
+
*/
|
|
43
|
+
export declare function useIsLocalizedActive(canonicalTarget: string): () => boolean;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as Solid from 'solid-js';
|
|
2
|
+
import type { I18nContextValue } from './types.js';
|
|
3
|
+
export type { I18nContextValue, I18nInstanceLike } from './types.js';
|
|
4
|
+
/**
|
|
5
|
+
* Default-less form (Solid 2): `useContext` on this throws
|
|
6
|
+
* `ContextNotFoundError` when no `I18nProvider` is mounted, instead of
|
|
7
|
+
* silently reading a shared fallback instance across requests — exactly the
|
|
8
|
+
* failure mode a per-request i18n instance needs. The context object is
|
|
9
|
+
* itself the provider component: render `<I18nContext value={...}>`.
|
|
10
|
+
*/
|
|
11
|
+
export declare const I18nContext: Solid.Context<I18nContextValue>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { createRequestLanguageRedirect, detectRequestLanguage, languageFromPathname, type RequestLanguageDetection, type ResolvedRequestLanguage, type ResolveRequestLanguageOptions, resolveRequestLanguage, } from '@modern-js/i18n-runtime-extensions/request-language';
|
|
2
|
+
export { createI18nSsrHandoffInlineData, I18N_SSR_HANDOFF_ELEMENT_ID, type I18nSsrHandoffPayload, type I18nSsrHandoffResources, readI18nSsrHandoff, } from '@modern-js/i18n-runtime-extensions/ssrLanguageHandoff';
|
|
3
|
+
export { type CreateI18nUrlRewriteOptions, createI18nUrlRewrite, type I18nLocationRewrite, } from '@modern-js/i18n-runtime-extensions/urlRewrite';
|
|
4
|
+
export { I18nContext } from './context.js';
|
|
5
|
+
export { I18nProvider, type I18nProviderProps } from './I18nProvider.js';
|
|
6
|
+
export { LocalizedLink, type LocalizedLinkProps, useIsLocalizedActive, } from './LocalizedLink.js';
|
|
7
|
+
export { createLatestLanguageSync, type SolidLatestLanguageSyncOptions, } from './languageSync.js';
|
|
8
|
+
export type { I18nContextValue, I18nInstanceLike } from './types.js';
|
|
9
|
+
export { type UseI18nReturn, useI18n } from './useI18n.js';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type LanguageSyncFailure, type LanguageSyncPolicy } from '@modern-js/i18n-runtime-extensions/language-sync/controller';
|
|
2
|
+
import * as Solid from 'solid-js';
|
|
3
|
+
export interface SolidLatestLanguageSyncOptions<TTarget extends object> {
|
|
4
|
+
/** The sync target, e.g. the per-request i18next instance. Reactive. */
|
|
5
|
+
target: Solid.Accessor<TTarget | undefined>;
|
|
6
|
+
/** The language the URL (or other source of truth) currently wants. Reactive. */
|
|
7
|
+
desiredLanguage: Solid.Accessor<string | undefined>;
|
|
8
|
+
changeLanguage: (target: TTarget, language: string) => PromiseLike<unknown> | unknown;
|
|
9
|
+
commitLanguage: (target: TTarget, language: string) => void;
|
|
10
|
+
/** @default () => true */
|
|
11
|
+
enabled?: Solid.Accessor<boolean>;
|
|
12
|
+
policy?: LanguageSyncPolicy;
|
|
13
|
+
readLanguage?: (target: TTarget) => string | undefined;
|
|
14
|
+
reportFailure?: (failure: LanguageSyncFailure) => void;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Solid binding over the fork's renderer-neutral `Coordinator`/`Binding` pair
|
|
18
|
+
* (`@modern-js/i18n-runtime-extensions`'s `createLatestLanguageSyncBinding`):
|
|
19
|
+
* the same "latest intent wins, retry with backoff, report terminal failure"
|
|
20
|
+
* policy the React `useLatestLanguageSync` hook drives.
|
|
21
|
+
*
|
|
22
|
+
* Solid 2's `createEffect` has a compute/effect split (`compute(prev)` is
|
|
23
|
+
* tracked, `effect(next)` runs imperatively and may return a cleanup run
|
|
24
|
+
* before the next invocation or on disposal) rather than Solid 1's
|
|
25
|
+
* single-phase `createEffect(fn)` — reactive reads happen in `compute`,
|
|
26
|
+
* subscriptions happen in `effect`, which returns their cleanup.
|
|
27
|
+
*
|
|
28
|
+
* Returns a function to request a language change (e.g. from a language
|
|
29
|
+
* switcher), independent of the reactive `desiredLanguage` source.
|
|
30
|
+
*/
|
|
31
|
+
export declare function createLatestLanguageSync<TTarget extends object>(options: SolidLatestLanguageSyncOptions<TTarget>): (language: string) => void;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { LocalisedUrlsOption } from '@modern-js/i18n-runtime-extensions/paths';
|
|
2
|
+
/**
|
|
3
|
+
* The slice of an i18next-shaped instance this binding needs. Deliberately
|
|
4
|
+
* not `@modern-js/plugin-i18n`'s `I18nInstance`: that type is intentionally
|
|
5
|
+
* narrowed (no index signature, non-overloaded methods — see plugin-i18n's
|
|
6
|
+
* fork notes) and, more importantly, the plugin package's peer dependencies
|
|
7
|
+
* require React/ReactDOM, which a Solid-only application must never need to
|
|
8
|
+
* install. `on`/`off` are real i18next `EventEmitter` methods this interface
|
|
9
|
+
* adds back for the reactive `languageChanged` subscription.
|
|
10
|
+
*/
|
|
11
|
+
export interface I18nInstanceLike {
|
|
12
|
+
language: string;
|
|
13
|
+
t(key: string | string[], options?: Record<string, unknown>): string;
|
|
14
|
+
changeLanguage?(lng?: string): Promise<unknown> | unknown;
|
|
15
|
+
on?(event: 'languageChanged', callback: (lng: string) => void): void;
|
|
16
|
+
off?(event: 'languageChanged', callback: (lng: string) => void): void;
|
|
17
|
+
/** SSR per-request isolation: the server clones a base instance per request. */
|
|
18
|
+
cloneInstance?(options?: Record<string, unknown>): I18nInstanceLike;
|
|
19
|
+
}
|
|
20
|
+
export interface I18nContextValue {
|
|
21
|
+
/** Per-request instance. Never a module-level singleton. */
|
|
22
|
+
instance: I18nInstanceLike;
|
|
23
|
+
languages: readonly string[];
|
|
24
|
+
localisedUrls?: LocalisedUrlsOption;
|
|
25
|
+
/**
|
|
26
|
+
* Reactive current language, owned by `I18nProvider`. Every consumer
|
|
27
|
+
* (`useI18n`, `LocalizedLink`) reads this single shared signal rather than
|
|
28
|
+
* each subscribing to `instance`'s `languageChanged` event independently —
|
|
29
|
+
* `instance.language` is a plain mutable field, not itself reactive, so
|
|
30
|
+
* reading it directly would silently never update a Solid computation.
|
|
31
|
+
*/
|
|
32
|
+
language: () => string;
|
|
33
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as Solid from 'solid-js';
|
|
2
|
+
import type { I18nInstanceLike } from './types.js';
|
|
3
|
+
export interface UseI18nReturn {
|
|
4
|
+
/** Reactive: re-evaluates when i18next fires `languageChanged`. */
|
|
5
|
+
t: I18nInstanceLike['t'];
|
|
6
|
+
/** Reactive current language accessor, shared with every other consumer. */
|
|
7
|
+
language: Solid.Accessor<string>;
|
|
8
|
+
languages: readonly string[];
|
|
9
|
+
/** The raw per-request instance, for advanced use (namespaces, `exists`, ...). */
|
|
10
|
+
instance: I18nInstanceLike;
|
|
11
|
+
/**
|
|
12
|
+
* Switches the i18next instance's language. Inside a router, also replaces
|
|
13
|
+
* the current URL with the localized path for the new language.
|
|
14
|
+
*/
|
|
15
|
+
changeLanguage: (language: string) => Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Must render under `I18nProvider`; `useContext` on the default-less
|
|
19
|
+
* `I18nContext` throws `ContextNotFoundError` otherwise, rather than
|
|
20
|
+
* silently reading a fallback instance. The reactive `language` signal lives
|
|
21
|
+
* on the provider (one `languageChanged` subscription per request, shared by
|
|
22
|
+
* every consumer) — this hook just reads it.
|
|
23
|
+
*/
|
|
24
|
+
export declare function useI18n(): UseI18nReturn;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/** This entry contains identity only. Select client, router or server explicitly. */
|
|
2
|
+
export declare const SOLID_RENDERER_PROFILE: {
|
|
3
|
+
readonly renderer: 'solid';
|
|
4
|
+
readonly solid: '2.0.0-rc.13';
|
|
5
|
+
readonly web: '2.0.0-rc.13';
|
|
6
|
+
readonly router: '@modern-js/renderer-solid/router@3.8.3';
|
|
7
|
+
readonly routerSource: '4fbd65c5c3b40be87a6248867c22021c1c19bba8';
|
|
8
|
+
readonly routerCore: '1.171.34';
|
|
9
|
+
readonly history: '1.162.4';
|
|
10
|
+
readonly publicRouteData: {
|
|
11
|
+
readonly containers: readonly ['plain-record', 'null-record', 'array'];
|
|
12
|
+
readonly values: 'canonical-scalars';
|
|
13
|
+
readonly deferred: 'checked-top-level-native-promises';
|
|
14
|
+
readonly mutation: 'immutable-public-snapshot';
|
|
15
|
+
readonly unsupported: readonly ['Date', 'RegExp', 'Map', 'Set', 'AsyncIterable'];
|
|
16
|
+
};
|
|
17
|
+
readonly publicContext: {
|
|
18
|
+
readonly source: 'managed-constructor-route-context-and-before-load';
|
|
19
|
+
readonly providerOverrides: 'unsupported';
|
|
20
|
+
};
|
|
21
|
+
readonly nativePromiseMetadata: {
|
|
22
|
+
readonly runtime: '2.0.0-rc.13';
|
|
23
|
+
readonly fields: readonly ['s', 'v'];
|
|
24
|
+
readonly status: readonly [0, 1, 2];
|
|
25
|
+
readonly handle: 'sealed-with-checked-metadata';
|
|
26
|
+
};
|
|
27
|
+
readonly nativeRegistry: {
|
|
28
|
+
readonly source: 'managed-router-match-transfer';
|
|
29
|
+
readonly rawRejectedMatchInjection: 'unsupported';
|
|
30
|
+
};
|
|
31
|
+
readonly nativeRequestContext: {
|
|
32
|
+
readonly scope: 'complete-native-request-handler';
|
|
33
|
+
readonly event: 'one-per-request-session';
|
|
34
|
+
};
|
|
35
|
+
readonly nativeResponseHead: {
|
|
36
|
+
readonly statusText: 'fetch-response-status-text';
|
|
37
|
+
readonly terminalOutcome: 'authoritative';
|
|
38
|
+
readonly cache: 'intersect-with-session-policy';
|
|
39
|
+
};
|
|
40
|
+
readonly dataHttpTransport: 'renderer-core-rich-public-data';
|
|
41
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { NativeCompilerArtifacts } from '@modern-js/renderer-core/adapter';
|
|
2
|
+
import { type RendererIdentity } from '@modern-js/renderer-core/identity';
|
|
3
|
+
export declare const SOLID_COMPILER_VERSION = "2.0.0-rc.13";
|
|
4
|
+
export declare function solidModuleManifestFilename(entryName: string): string;
|
|
5
|
+
/** The compiler's structural JSON boundary matches native Solid AssetManifest. */
|
|
6
|
+
interface SolidPreloadAttributes {
|
|
7
|
+
type?: string;
|
|
8
|
+
crossorigin?: '' | true | 'anonymous' | 'use-credentials';
|
|
9
|
+
integrity?: string;
|
|
10
|
+
referrerpolicy?: 'no-referrer' | 'no-referrer-when-downgrade' | 'origin' | 'origin-when-cross-origin' | 'same-origin' | 'strict-origin' | 'strict-origin-when-cross-origin' | 'unsafe-url';
|
|
11
|
+
fetchpriority?: 'high' | 'low' | 'auto';
|
|
12
|
+
media?: string;
|
|
13
|
+
}
|
|
14
|
+
export type SolidPreloadLink = SolidPreloadAttributes & ({
|
|
15
|
+
href: string;
|
|
16
|
+
as: 'fetch' | 'font' | 'script' | 'style' | 'track';
|
|
17
|
+
imagesrcset?: never;
|
|
18
|
+
imagesizes?: never;
|
|
19
|
+
} | {
|
|
20
|
+
href: string;
|
|
21
|
+
as: 'image';
|
|
22
|
+
imagesrcset?: string;
|
|
23
|
+
imagesizes?: string;
|
|
24
|
+
} | {
|
|
25
|
+
href?: never;
|
|
26
|
+
as: 'image';
|
|
27
|
+
imagesrcset: string;
|
|
28
|
+
imagesizes?: string;
|
|
29
|
+
});
|
|
30
|
+
export interface SolidAssetChunk {
|
|
31
|
+
file: string;
|
|
32
|
+
css?: string[];
|
|
33
|
+
imports?: string[];
|
|
34
|
+
isEntry?: boolean;
|
|
35
|
+
preloads?: SolidPreloadLink[];
|
|
36
|
+
}
|
|
37
|
+
export type SolidAssetManifest = Record<string, SolidAssetChunk> & {
|
|
38
|
+
_base?: string;
|
|
39
|
+
};
|
|
40
|
+
export interface SolidModuleManifest {
|
|
41
|
+
schemaVersion: 1;
|
|
42
|
+
renderer: 'solid';
|
|
43
|
+
compilerVersion: typeof SOLID_COMPILER_VERSION;
|
|
44
|
+
/** The shared source-build identity owner stamps this before runtime use. */
|
|
45
|
+
rendererIdentity: RendererIdentity;
|
|
46
|
+
modules: SolidAssetManifest;
|
|
47
|
+
}
|
|
48
|
+
export declare function validateSolidModuleManifest(value: unknown, expectedIdentity: RendererIdentity, requiredModuleKeys?: readonly string[]): SolidModuleManifest;
|
|
49
|
+
/**
|
|
50
|
+
* The compiler artifact ABI. It lives in this runtime module, not in the
|
|
51
|
+
* build-only `./plugin`, because the production server validates manifests
|
|
52
|
+
* with it and deployments trace it from there.
|
|
53
|
+
*/
|
|
54
|
+
export declare const compilerArtifacts: NativeCompilerArtifacts;
|
|
55
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type SerovalNode } from '@solidjs/web/serialization';
|
|
2
|
+
type PromiseInfo = {
|
|
3
|
+
resolver: SerovalNode;
|
|
4
|
+
};
|
|
5
|
+
/** Internal SSR-only native plugin. It is deliberately not an application
|
|
6
|
+
* codec or a public client decoder. Seroval owns indexing and settlement
|
|
7
|
+
* chunks; Solid retains its ordinary Promise, s/v and truncation semantics. */
|
|
8
|
+
export declare const nativePromiseSerializationPlugin: import("@solidjs/web/serialization").SerializerPlugin<Promise<unknown>, PromiseInfo>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { NativeRendererCompilerOptions } from '@modern-js/renderer-core/adapter';
|
|
2
|
+
import type { RsbuildPlugin } from '@rsbuild/core';
|
|
3
|
+
/** Private loaders remain in the package's shipped src tree in every format. */
|
|
4
|
+
export declare function pluginSourceDirectory(): string;
|
|
5
|
+
/** Own Solid's native compiler, refresh and lazy assets. */
|
|
6
|
+
export declare function pluginSolidRenderer(options: NativeRendererCompilerOptions): RsbuildPlugin;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type SolidAppSourceOptions = {
|
|
2
|
+
appId: string;
|
|
3
|
+
title: string;
|
|
4
|
+
entryName?: string;
|
|
5
|
+
appRole?: 'shell' | 'vertical';
|
|
6
|
+
capabilities: {
|
|
7
|
+
ssr: boolean;
|
|
8
|
+
federation: boolean;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export type SolidAppSourceArtifact = {
|
|
12
|
+
path: string;
|
|
13
|
+
content: string;
|
|
14
|
+
};
|
|
15
|
+
export type SolidAppSources = {
|
|
16
|
+
sourceExtension: '.tsx';
|
|
17
|
+
jsxImportSource: '@solidjs/web';
|
|
18
|
+
artifacts: SolidAppSourceArtifact[];
|
|
19
|
+
};
|
|
20
|
+
/** The adapter owns the entry, route tree, document and hydration bootstrap. */
|
|
21
|
+
export declare function generateSolidAppSources(options: SolidAppSourceOptions): SolidAppSources;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
declare const _exports: {
|
|
2
|
+
collectLazyModules: typeof collectLazyModules;
|
|
3
|
+
markerVisitor: typeof markerVisitor;
|
|
4
|
+
resolveLazyModule: typeof resolveLazyModule;
|
|
5
|
+
};
|
|
6
|
+
export = _exports;
|
|
7
|
+
declare function resolveLazyModule(filename: any, specifier: any, projectRoot: any, sourceExtensions: string[] | undefined, dependencies: any): {
|
|
8
|
+
filename: string;
|
|
9
|
+
request: string;
|
|
10
|
+
key: string;
|
|
11
|
+
};
|
|
12
|
+
declare function markerVisitor(onMarker: any): {
|
|
13
|
+
StringLiteral(marker: any): void;
|
|
14
|
+
};
|
|
15
|
+
declare function collectLazyModules(projectRoot: any, entryDirectories: any[] | undefined, sourceExtensions: string[] | undefined, dependencies: any): any[];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { RequestSession } from '@modern-js/renderer-core/session';
|
|
2
|
+
import type { AnyRouter, CreateRouterFn } from '@tanstack/router-core';
|
|
3
|
+
import type { AnyRoute, RouteComponent } from './router-binding/index.js';
|
|
4
|
+
interface PublicDataGeneration {
|
|
5
|
+
readonly owner: Pick<RequestSession, 'fail' | 'signal'>;
|
|
6
|
+
publish(value: unknown, completion?: Promise<void>): void;
|
|
7
|
+
}
|
|
8
|
+
export interface RouteCompletionScope {
|
|
9
|
+
readonly hydrationOwner: Pick<RequestSession, 'fail' | 'signal'>;
|
|
10
|
+
readonly privateRoots: readonly object[];
|
|
11
|
+
attach(router: AnyRouter): void;
|
|
12
|
+
begin(signal: AbortSignal, cancel: () => void): PublicDataGeneration;
|
|
13
|
+
component(component: RouteComponent): RouteComponent;
|
|
14
|
+
dispose(): void;
|
|
15
|
+
}
|
|
16
|
+
export declare function registerRouteCompletionScope(route: AnyRoute, scope: RouteCompletionScope): void;
|
|
17
|
+
export declare const createApplicationRouter: CreateRouterFn;
|
|
18
|
+
export declare function ownApplicationRouteData(router: AnyRouter): void;
|
|
19
|
+
/** A framing failure belongs to the exact native loader generation that read it. */
|
|
20
|
+
export declare function createRouteCompletionScope(privateRoots?: readonly object[], session?: RequestSession): RouteCompletionScope;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { RouteDataError } from '@modern-js/renderer-core/router';
|
|
2
|
+
export interface RouteDataErrorSnapshot {
|
|
3
|
+
kind: 'ultramodern-route-data-error';
|
|
4
|
+
version: 1;
|
|
5
|
+
routeId: string;
|
|
6
|
+
status: number;
|
|
7
|
+
data: unknown;
|
|
8
|
+
error: {
|
|
9
|
+
name: string;
|
|
10
|
+
message: string;
|
|
11
|
+
stack?: string;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
/** Preserve the known public route error without serializing its Error object. */
|
|
15
|
+
export declare function projectRouteDataError(error: unknown, production?: boolean): RouteDataErrorSnapshot;
|
|
16
|
+
/** Reconstruct only the validated route error tag produced by this adapter. */
|
|
17
|
+
export declare function restoreRouteDataError(snapshot: unknown): RouteDataError;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { JSX } from '@solidjs/web';
|
|
2
|
+
import * as Solid from 'solid-js';
|
|
3
|
+
import type { ErrorRouteComponent } from './route.js';
|
|
4
|
+
export declare function CatchBoundary(props: {
|
|
5
|
+
getResetKey: () => unknown;
|
|
6
|
+
children?: JSX.Element;
|
|
7
|
+
render?: () => JSX.Element;
|
|
8
|
+
errorComponent?: ErrorRouteComponent;
|
|
9
|
+
onCatch?: (error: Error) => void;
|
|
10
|
+
} & Solid.ParentProps): JSX.Element;
|
|
11
|
+
export declare function ErrorComponent({ error }: {
|
|
12
|
+
error: any;
|
|
13
|
+
}): JSX.Element;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { JSX } from '@solidjs/web';
|
|
2
|
+
import * as Solid from 'solid-js';
|
|
3
|
+
export interface ClientOnlyProps {
|
|
4
|
+
/**
|
|
5
|
+
* The children to render when the JS is loaded.
|
|
6
|
+
*/
|
|
7
|
+
children: JSX.Element;
|
|
8
|
+
/**
|
|
9
|
+
* The fallback component to render if the JS is not yet loaded.
|
|
10
|
+
*/
|
|
11
|
+
fallback?: JSX.Element;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Render the children only after the JS has loaded client-side. Use an optional
|
|
15
|
+
* fallback component if the JS is not yet loaded.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* Render a Chart component if JS loads, renders a simple FakeChart
|
|
19
|
+
* component server-side or if there is no JS. The FakeChart can have only the
|
|
20
|
+
* UI without the behavior or be a loading spinner or skeleton.
|
|
21
|
+
*
|
|
22
|
+
* ```tsx
|
|
23
|
+
* return (
|
|
24
|
+
* <ClientOnly fallback={<FakeChart />}>
|
|
25
|
+
* <Chart />
|
|
26
|
+
* </ClientOnly>
|
|
27
|
+
* )
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare function ClientOnly(props: ClientOnlyProps): JSX.Element;
|
|
31
|
+
export declare function useHydrated(): Solid.Accessor<boolean>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { JSX } from '@solidjs/web';
|
|
2
|
+
import type { AssetCrossOriginConfig } from '@tanstack/router-core';
|
|
3
|
+
export interface HeadContentProps {
|
|
4
|
+
assetCrossOrigin?: AssetCrossOriginConfig;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* @description The `HeadContent` component registers the current route's meta
|
|
8
|
+
* tags, links, and scripts with Solid's head registry, which owns emission
|
|
9
|
+
* into `<head>` (SSR splicing/streaming and client-side patching alike). It
|
|
10
|
+
* can be rendered anywhere in the tree, though placing it inside the `<head>`
|
|
11
|
+
* of your document keeps the hydration script in the right place.
|
|
12
|
+
*/
|
|
13
|
+
export declare function HeadContent(props: HeadContentProps): JSX.Element;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { JSX } from '@solidjs/web';
|
|
2
|
+
import type { AnyRouter, DeepPartial, Expand, MakeOptionalPathParams, MakeOptionalSearchParams, MakeRouteMatchUnion, MaskOptions, MatchRouteOptions, RegisteredRouter, ResolveRoute, ToSubOptionsProps } from '@tanstack/router-core';
|
|
3
|
+
import * as Solid from 'solid-js';
|
|
4
|
+
declare module '@tanstack/router-core' {
|
|
5
|
+
interface RouteMatchExtensions {
|
|
6
|
+
meta?: Array<JSX.IntrinsicElements['meta'] | undefined>;
|
|
7
|
+
links?: Array<JSX.IntrinsicElements['link'] | undefined>;
|
|
8
|
+
scripts?: Array<JSX.IntrinsicElements['script'] | undefined>;
|
|
9
|
+
styles?: Array<JSX.IntrinsicElements['style'] | undefined>;
|
|
10
|
+
headScripts?: Array<JSX.IntrinsicElements['script'] | undefined>;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export declare function Matches(): JSX.Element;
|
|
14
|
+
export type UseMatchRouteOptions<TRouter extends AnyRouter = RegisteredRouter, TFrom extends string = string, TTo extends string | undefined = undefined, TMaskFrom extends string = TFrom, TMaskTo extends string = ''> = ToSubOptionsProps<TRouter, TFrom, TTo> & DeepPartial<MakeOptionalSearchParams<TRouter, TFrom, TTo>> & DeepPartial<MakeOptionalPathParams<TRouter, TFrom, TTo>> & MaskOptions<TRouter, TMaskFrom, TMaskTo> & MatchRouteOptions;
|
|
15
|
+
export declare function useMatchRoute<TRouter extends AnyRouter = RegisteredRouter>(): <const TFrom extends string = string, const TTo extends string | undefined = undefined, const TMaskFrom extends string = TFrom, const TMaskTo extends string = ''>(opts: UseMatchRouteOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>) => Solid.Accessor<false | Expand<ResolveRoute<TRouter, TFrom, TTo>['types']['allParams']>>;
|
|
16
|
+
export type MakeMatchRouteOptions<TRouter extends AnyRouter = RegisteredRouter, TFrom extends string = string, TTo extends string | undefined = undefined, TMaskFrom extends string = TFrom, TMaskTo extends string = ''> = UseMatchRouteOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo> & {
|
|
17
|
+
children?: ((params?: Expand<ResolveRoute<TRouter, TFrom, TTo>['types']['allParams']>) => JSX.Element) | JSX.Element;
|
|
18
|
+
};
|
|
19
|
+
export declare function MatchRoute<TRouter extends AnyRouter = RegisteredRouter, const TFrom extends string = string, const TTo extends string | undefined = undefined, const TMaskFrom extends string = TFrom, const TMaskTo extends string = ''>(props: MakeMatchRouteOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>): any;
|
|
20
|
+
export interface UseMatchesBaseOptions<TRouter extends AnyRouter, TSelected> {
|
|
21
|
+
select?: (matches: Array<MakeRouteMatchUnion<TRouter>>) => TSelected;
|
|
22
|
+
}
|
|
23
|
+
export type UseMatchesResult<TRouter extends AnyRouter, TSelected> = unknown extends TSelected ? Array<MakeRouteMatchUnion<TRouter>> : TSelected;
|
|
24
|
+
export declare function useMatches<TRouter extends AnyRouter = RegisteredRouter, TSelected = unknown>(opts?: UseMatchesBaseOptions<TRouter, TSelected>): Solid.Accessor<UseMatchesResult<TRouter, TSelected>>;
|
|
25
|
+
export declare function useParentMatches<TRouter extends AnyRouter = RegisteredRouter, TSelected = unknown>(opts?: UseMatchesBaseOptions<TRouter, TSelected>): Solid.Accessor<UseMatchesResult<TRouter, TSelected>>;
|
|
26
|
+
export declare function useChildMatches<TRouter extends AnyRouter = RegisteredRouter, TSelected = unknown>(opts?: UseMatchesBaseOptions<TRouter, TSelected>): Solid.Accessor<UseMatchesResult<TRouter, TSelected>>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { JSX } from '@solidjs/web';
|
|
2
|
+
import type { AnyRouter, RegisteredRouter, RouterOptions } from '@tanstack/router-core';
|
|
3
|
+
export declare function RouterContextProvider<TRouter extends AnyRouter = RegisteredRouter, TDehydrated extends Record<string, any> = Record<string, any>>({ router, children, ...rest }: RouterProps<TRouter, TDehydrated> & {
|
|
4
|
+
children: () => JSX.Element;
|
|
5
|
+
}): JSX.Element;
|
|
6
|
+
export declare function RouterProvider<TRouter extends AnyRouter = RegisteredRouter, TDehydrated extends Record<string, any> = Record<string, any>>({ router, ...rest }: RouterProps<TRouter, TDehydrated>): JSX.Element;
|
|
7
|
+
export type RouterProps<TRouter extends AnyRouter = RegisteredRouter, TDehydrated extends Record<string, any> = Record<string, any>> = Omit<RouterOptions<TRouter['routeTree'], NonNullable<TRouter['options']['trailingSlash']>, false, TRouter['history'], TDehydrated>, 'context'> & {
|
|
8
|
+
router: TRouter;
|
|
9
|
+
context?: Partial<RouterOptions<TRouter['routeTree'], NonNullable<TRouter['options']['trailingSlash']>, false, TRouter['history'], TDehydrated>['context']>;
|
|
10
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ParsedLocation, ScrollRestorationEntry, ScrollRestorationOptions } from '@tanstack/router-core';
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated use createRouter's `scrollRestoration` option instead
|
|
4
|
+
*/
|
|
5
|
+
export declare function ScrollRestoration(_props: ScrollRestorationOptions): null;
|
|
6
|
+
export declare function useElementScrollRestoration(options: ({
|
|
7
|
+
id: string;
|
|
8
|
+
getElement?: () => Window | Element | undefined | null;
|
|
9
|
+
} | {
|
|
10
|
+
id?: string;
|
|
11
|
+
getElement: () => Window | Element | undefined | null;
|
|
12
|
+
}) & {
|
|
13
|
+
getKey?: (location: ParsedLocation) => string;
|
|
14
|
+
}): ScrollRestorationEntry | undefined;
|