@benjavicente/angular-router-experimental 1.142.13 → 1.142.15

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.
@@ -58,6 +58,19 @@ declare module '@benjavicente/router-core' {
58
58
  }
59
59
 
60
60
 
61
+ declare module '@benjavicente/router-core' {
62
+ interface LazyRoute<in out TRoute extends AnyRoute> {
63
+ injectMatch: InjectMatchRoute<TRoute['id']>;
64
+ injectRouteContext: InjectRouteContextRoute<TRoute['id']>;
65
+ injectSearch: InjectSearchRoute<TRoute['id']>;
66
+ injectParams: InjectParamsRoute<TRoute['id']>;
67
+ injectLoaderDeps: InjectLoaderDepsRoute<TRoute['id']>;
68
+ injectLoaderData: InjectLoaderDataRoute<TRoute['id']>;
69
+ injectNavigate: () => UseNavigateResult<TRoute['fullPath']>;
70
+ }
71
+ }
72
+
73
+
61
74
  declare module '@benjavicente/router-core' {
62
75
  interface UpdatableRouteOptionsExtensions {
63
76
  component?: RouteComponent;
@@ -79,19 +92,6 @@ declare module '@benjavicente/router-core' {
79
92
  }
80
93
 
81
94
 
82
- declare module '@benjavicente/router-core' {
83
- interface LazyRoute<in out TRoute extends AnyRoute> {
84
- injectMatch: InjectMatchRoute<TRoute['id']>;
85
- injectRouteContext: InjectRouteContextRoute<TRoute['id']>;
86
- injectSearch: InjectSearchRoute<TRoute['id']>;
87
- injectParams: InjectParamsRoute<TRoute['id']>;
88
- injectLoaderDeps: InjectLoaderDepsRoute<TRoute['id']>;
89
- injectLoaderData: InjectLoaderDataRoute<TRoute['id']>;
90
- injectNavigate: () => UseNavigateResult<TRoute['fullPath']>;
91
- }
92
- }
93
-
94
-
95
95
  declare module '@benjavicente/router-core' {
96
96
  interface RouterReadableStore<TValue> extends Readable<TValue> {
97
97
  }
@@ -693,6 +693,19 @@ declare module '@benjavicente/router-core' {
693
693
  }
694
694
 
695
695
 
696
+ declare module '@benjavicente/router-core' {
697
+ interface LazyRoute<in out TRoute extends AnyRoute> {
698
+ injectMatch: InjectMatchRoute<TRoute['id']>;
699
+ injectRouteContext: InjectRouteContextRoute<TRoute['id']>;
700
+ injectSearch: InjectSearchRoute<TRoute['id']>;
701
+ injectParams: InjectParamsRoute<TRoute['id']>;
702
+ injectLoaderDeps: InjectLoaderDepsRoute<TRoute['id']>;
703
+ injectLoaderData: InjectLoaderDataRoute<TRoute['id']>;
704
+ injectNavigate: () => UseNavigateResult<TRoute['fullPath']>;
705
+ }
706
+ }
707
+
708
+
696
709
  declare module '@benjavicente/router-core' {
697
710
  interface UpdatableRouteOptionsExtensions {
698
711
  component?: RouteComponent;
@@ -714,19 +727,6 @@ declare module '@benjavicente/router-core' {
714
727
  }
715
728
 
716
729
 
717
- declare module '@benjavicente/router-core' {
718
- interface LazyRoute<in out TRoute extends AnyRoute> {
719
- injectMatch: InjectMatchRoute<TRoute['id']>;
720
- injectRouteContext: InjectRouteContextRoute<TRoute['id']>;
721
- injectSearch: InjectSearchRoute<TRoute['id']>;
722
- injectParams: InjectParamsRoute<TRoute['id']>;
723
- injectLoaderDeps: InjectLoaderDepsRoute<TRoute['id']>;
724
- injectLoaderData: InjectLoaderDataRoute<TRoute['id']>;
725
- injectNavigate: () => UseNavigateResult<TRoute['fullPath']>;
726
- }
727
- }
728
-
729
-
730
730
  declare module '@benjavicente/router-core' {
731
731
  interface RouterReadableStore<TValue> extends Readable<TValue> {
732
732
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@benjavicente/angular-router-experimental",
3
- "version": "1.142.13",
3
+ "version": "1.142.15",
4
4
  "description": "Modern and scalable routing for Angular applications",
5
5
  "author": "Tanner Linsley",
6
6
  "license": "MIT",
@@ -53,12 +53,11 @@
53
53
  "@tanstack/store": "^0.9.3",
54
54
  "isbot": "^5.1.22",
55
55
  "tslib": "^2.3.0",
56
- "@benjavicente/router-core": "1.169.2",
57
- "@benjavicente/history": "1.161.6"
56
+ "@benjavicente/history": "1.161.6",
57
+ "@benjavicente/router-core": "1.169.2"
58
58
  },
59
59
  "devDependencies": {
60
60
  "@analogjs/vitest-angular": "^2.2.1",
61
- "@angular/common": "^21.2.6",
62
61
  "@angular/compiler": "^21.2.6",
63
62
  "@angular/compiler-cli": "^21.2.6",
64
63
  "@angular/core": "^21.2.6",
@@ -78,7 +77,6 @@
78
77
  "zod": "^3.24.2"
79
78
  },
80
79
  "peerDependencies": {
81
- "@angular/common": "^21.2.6",
82
80
  "@angular/core": "^21.2.6"
83
81
  },
84
82
  "scripts": {
@@ -1,4 +1,3 @@
1
- import { DOCUMENT } from '@angular/common'
2
1
  import * as Angular from '@angular/core'
3
2
  import { injectStore } from '../store/injectStore'
4
3
  import { buildMatchManagedDocumentContent } from './build-match-managed-document'
@@ -14,6 +13,10 @@ import type {
14
13
  ManagedTagCollection,
15
14
  } from './managed-document-types'
16
15
 
16
+ function hasManagedDocumentRoots(document: Document | null | undefined): document is Document {
17
+ return !!document?.head && !!document?.body
18
+ }
19
+
17
20
  function applyManagedDocumentContent({
18
21
  document,
19
22
  initialTitle,
@@ -42,7 +45,10 @@ function applyManagedDocumentContent({
42
45
  * Used by `provideTanstackDocument` when all features are enabled.
43
46
  */
44
47
  export function installUnifiedTanstackDocumentSync(injectedRouter: AnyRouter) {
45
- const document = Angular.inject(DOCUMENT)
48
+ const document = Angular.inject(Angular.DOCUMENT)
49
+ if (!hasManagedDocumentRoots(document)) {
50
+ return
51
+ }
46
52
  const rendererFactory = Angular.inject(Angular.RendererFactory2, {
47
53
  optional: true,
48
54
  })
@@ -1,4 +1,3 @@
1
- import { DOCUMENT } from '@angular/common'
2
1
  import * as Angular from '@angular/core'
3
2
  import { injectStore } from '../store/injectStore'
4
3
  import { buildMatchManagedDocumentContent } from './build-match-managed-document'
@@ -14,7 +13,10 @@ import type { ManagedTag } from './managed-document-types'
14
13
  * on the server only (call from an injection context).
15
14
  */
16
15
  export function installTanstackBodyManagedTags(injectedRouter: AnyRouter) {
17
- const document = Angular.inject(DOCUMENT)
16
+ const document = Angular.inject(Angular.DOCUMENT)
17
+ if (!document.body) {
18
+ return
19
+ }
18
20
  const rendererFactory = Angular.inject(Angular.RendererFactory2, {
19
21
  optional: true,
20
22
  })
@@ -1,4 +1,3 @@
1
- import { DOCUMENT } from '@angular/common'
2
1
  import * as Angular from '@angular/core'
3
2
  import { injectStore } from '../store/injectStore'
4
3
  import { buildMatchManagedDocumentContent } from './build-match-managed-document'
@@ -7,7 +6,7 @@ import type { AnyRouter } from '@benjavicente/router-core'
7
6
 
8
7
  /** Sync `document.title` from the router (call from an injection context). */
9
8
  export function installTanstackDocumentTitle(injectedRouter: AnyRouter) {
10
- const document = Angular.inject(DOCUMENT)
9
+ const document = Angular.inject(Angular.DOCUMENT)
11
10
  const destroyRef = Angular.inject(Angular.DestroyRef)
12
11
  const activeMatches = injectStore(
13
12
  injectedRouter.stores.matches,
@@ -1,4 +1,3 @@
1
- import { DOCUMENT } from '@angular/common'
2
1
  import * as Angular from '@angular/core'
3
2
  import { injectStore } from '../store/injectStore'
4
3
  import { buildMatchManagedDocumentContent } from './build-match-managed-document'
@@ -10,7 +9,10 @@ import type { ManagedTag } from './managed-document-types'
10
9
 
11
10
  /** Managed `<head>` tags from active matches (call from an injection context). */
12
11
  export function installTanstackHeadManagedTags(injectedRouter: AnyRouter) {
13
- const document = Angular.inject(DOCUMENT)
12
+ const document = Angular.inject(Angular.DOCUMENT)
13
+ if (!document.head) {
14
+ return
15
+ }
14
16
  const rendererFactory = Angular.inject(Angular.RendererFactory2, {
15
17
  optional: true,
16
18
  })
@@ -1,4 +1,4 @@
1
- import { DOCUMENT } from '@angular/common'
1
+ import { DOCUMENT } from '@angular/core'
2
2
  import { EnvironmentInjector, afterNextRender, inject } from '@angular/core'
3
3
  import { getScrollRestorationScriptForRouter } from '@benjavicente/router-core/scroll-restoration-script'
4
4
  import { injectRouter } from './injectRouter'