@benjavicente/angular-router-experimental 1.142.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +15 -0
  3. package/dist/fesm2022/tanstack-angular-router-experimental-experimental.mjs +920 -0
  4. package/dist/fesm2022/tanstack-angular-router-experimental.mjs +4131 -0
  5. package/dist/types/tanstack-angular-router-experimental-experimental.d.ts +110 -0
  6. package/dist/types/tanstack-angular-router-experimental.d.ts +733 -0
  7. package/experimental/injectRouteErrorHandler.ts +51 -0
  8. package/experimental/public_api.ts +8 -0
  9. package/package.json +98 -0
  10. package/src/DefaultNotFound.ts +9 -0
  11. package/src/Link.ts +352 -0
  12. package/src/Match.ts +338 -0
  13. package/src/Matches.ts +37 -0
  14. package/src/RouterProvider.ts +162 -0
  15. package/src/document/build-match-managed-document.ts +308 -0
  16. package/src/document/document-dehydration.ts +27 -0
  17. package/src/document/document-equality.ts +29 -0
  18. package/src/document/document-router-token.ts +6 -0
  19. package/src/document/index.ts +33 -0
  20. package/src/document/install-unified-document-sync.ts +108 -0
  21. package/src/document/managed-document-types.ts +36 -0
  22. package/src/document/managed-dom.ts +307 -0
  23. package/src/document/provide-tanstack-body-managed-tags.ts +78 -0
  24. package/src/document/provide-tanstack-document-title.ts +59 -0
  25. package/src/document/provide-tanstack-document.ts +62 -0
  26. package/src/document/provide-tanstack-head-managed-tags.ts +63 -0
  27. package/src/fileRoute.ts +232 -0
  28. package/src/index.ts +173 -0
  29. package/src/injectBlocker.ts +196 -0
  30. package/src/injectCanGoBack.ts +11 -0
  31. package/src/injectErrorState.ts +21 -0
  32. package/src/injectIntersectionObserver.ts +28 -0
  33. package/src/injectLoaderData.ts +49 -0
  34. package/src/injectLoaderDeps.ts +45 -0
  35. package/src/injectLocation.ts +38 -0
  36. package/src/injectMatch.ts +122 -0
  37. package/src/injectMatchRoute.ts +58 -0
  38. package/src/injectMatches.ts +79 -0
  39. package/src/injectNavigate.ts +24 -0
  40. package/src/injectParams.ts +71 -0
  41. package/src/injectRouteContext.ts +31 -0
  42. package/src/injectRouter.ts +17 -0
  43. package/src/injectRouterState.ts +53 -0
  44. package/src/injectSearch.ts +71 -0
  45. package/src/injectStore.ts +87 -0
  46. package/src/matchInjectorToken.ts +23 -0
  47. package/src/renderer/injectIsCatchingError.ts +40 -0
  48. package/src/renderer/injectRender.ts +69 -0
  49. package/src/route.ts +641 -0
  50. package/src/router.ts +141 -0
  51. package/src/routerInjectionToken.ts +24 -0
  52. package/src/routerStores.ts +107 -0
  53. package/src/ssr-scroll-restoration.ts +48 -0
  54. package/src/transitioner.ts +255 -0
@@ -0,0 +1,110 @@
1
+ import { AnyRouter } from '@benjavicente/router-core';
2
+ import { FromPathOption } from '@benjavicente/router-core';
3
+ import { RegisteredRouter } from '@benjavicente/router-core';
4
+
5
+ /**
6
+ * EXPERIMENTAL
7
+ *
8
+ * While in other adapters you can use build-in error boundaries,
9
+ * Angular does not provide any. As an workarraound, we export a function
10
+ * to simulate an error boundary by changing the router state to show
11
+ * the error component.
12
+ *
13
+ * Note that an equivalent for suspense can't exist since we can't restore
14
+ * the component state when the promise is resolved as is with other adapters.
15
+ */
16
+ export declare function injectRouteErrorHandler<TRouter extends AnyRouter = RegisteredRouter, TDefaultFrom extends string = string>(options: {
17
+ from?: FromPathOption<TRouter, TDefaultFrom>;
18
+ }): {
19
+ throw: (error: Error) => void;
20
+ };
21
+
22
+ export { }
23
+
24
+
25
+ declare module '@benjavicente/router-core' {
26
+ interface UpdatableRouteOptionsExtensions {
27
+ component?: RouteComponent;
28
+ errorComponent?: false | null | undefined | ErrorRouteComponent;
29
+ notFoundComponent?: NotFoundRouteComponent;
30
+ pendingComponent?: RouteComponent;
31
+ }
32
+ interface RootRouteOptionsExtensions {
33
+ shellComponent?: Angular.Type<{
34
+ children: any;
35
+ }>;
36
+ }
37
+ interface RouteExtensions<in out TId extends string, in out TFullPath extends string> {
38
+ injectMatch: InjectMatchRoute<TId>;
39
+ injectRouteContext: InjectRouteContextRoute<TId>;
40
+ injectSearch: InjectSearchRoute<TId>;
41
+ injectParams: InjectParamsRoute<TId>;
42
+ injectLoaderDeps: InjectLoaderDepsRoute<TId>;
43
+ injectLoaderData: InjectLoaderDataRoute<TId>;
44
+ injectNavigate: () => UseNavigateResult<TFullPath>;
45
+ }
46
+ }
47
+
48
+
49
+ declare module '@benjavicente/router-core' {
50
+ interface LazyRoute<in out TRoute extends AnyRoute> {
51
+ injectMatch: InjectMatchRoute<TRoute['id']>;
52
+ injectRouteContext: InjectRouteContextRoute<TRoute['id']>;
53
+ injectSearch: InjectSearchRoute<TRoute['id']>;
54
+ injectParams: InjectParamsRoute<TRoute['id']>;
55
+ injectLoaderDeps: InjectLoaderDepsRoute<TRoute['id']>;
56
+ injectLoaderData: InjectLoaderDataRoute<TRoute['id']>;
57
+ injectNavigate: () => UseNavigateResult<TRoute['fullPath']>;
58
+ }
59
+ }
60
+
61
+
62
+ declare module '@benjavicente/router-core' {
63
+ interface RouterOptionsExtensions {
64
+ /**
65
+ * The default `component` a route should use if no component is provided.
66
+ *
67
+ * @default Outlet
68
+ * @link [API Docs](https://tanstack.com/router/latest/docs/framework/solid/api/router/RouterOptionsType#defaultcomponent-property)
69
+ */
70
+ defaultComponent?: RouteComponent;
71
+ /**
72
+ * The default `errorComponent` a route should use if no error component is provided.
73
+ *
74
+ * @default ErrorComponent
75
+ * @link [API Docs](https://tanstack.com/router/latest/docs/framework/solid/api/router/RouterOptionsType#defaulterrorcomponent-property)
76
+ * @link [Guide](https://tanstack.com/router/latest/docs/framework/solid/guide/data-loading#handling-errors-with-routeoptionserrorcomponent)
77
+ */
78
+ defaultErrorComponent?: ErrorRouteComponent;
79
+ /**
80
+ * The default `pendingComponent` a route should use if no pending component is provided.
81
+ *
82
+ * @link [API Docs](https://tanstack.com/router/latest/docs/framework/solid/api/router/RouterOptionsType#defaultpendingcomponent-property)
83
+ * @link [Guide](https://tanstack.com/router/latest/docs/framework/solid/guide/data-loading#showing-a-pending-component)
84
+ */
85
+ defaultPendingComponent?: RouteComponent;
86
+ /**
87
+ * The default `notFoundComponent` a route should use if no notFound component is provided.
88
+ *
89
+ * @default NotFound
90
+ * @link [API Docs](https://tanstack.com/router/latest/docs/framework/solid/api/router/RouterOptionsType#defaultnotfoundcomponent-property)
91
+ * @link [Guide](https://tanstack.com/router/latest/docs/framework/solid/guide/not-found-errors#default-router-wide-not-found-handling)
92
+ */
93
+ defaultNotFoundComponent?: RouteComponent;
94
+ }
95
+ }
96
+
97
+
98
+ declare module '@benjavicente/router-core' {
99
+ interface RouterStores<in out TRouteTree extends AnyRoute> {
100
+ childMatchIdByRouteId: RouterReadableStore<Record<string, string>>;
101
+ pendingRouteIds: RouterReadableStore<Record<string, boolean>>;
102
+ }
103
+ }
104
+
105
+
106
+ declare global {
107
+ interface Window {
108
+ __TSR_ROUTER_INJECTION_KEY__?: Angular.InjectionToken<AnyRouter>;
109
+ }
110
+ }