ngwr 16.7.0 → 16.7.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.
@@ -1,7 +1,7 @@
1
1
  import * as i0 from "@angular/core";
2
2
  import { Directive, forwardRef, inject } from "@angular/core";
3
3
  import { LocationStrategy } from "@angular/common";
4
- import { ActivatedRoute, NavigationEnd, Router } from "@angular/router";
4
+ import { ActivatedRoute, NavigationEnd, Router, containsTree } from "@angular/router";
5
5
  import { toSignal } from "@angular/core/rxjs-interop";
6
6
  import { filter, map, startWith } from "rxjs";
7
7
  import { WR_TABS_ROUTING } from "ngwr/tabs";
@@ -31,8 +31,8 @@ var WrTabsRouting = class WrTabsRouting {
31
31
  return this.locationStrategy.prepareExternalUrl(this.router.serializeUrl(this.tree(commands)));
32
32
  }
33
33
  isActive(commands, exact = false) {
34
- this.url();
35
- return this.router.isActive(this.tree(commands), exact ? MATCH_EXACT : MATCH);
34
+ const current = this.router.lastSuccessfulNavigation()?.finalUrl ?? this.router.parseUrl(this.router.url);
35
+ return containsTree(current, this.tree(commands), exact ? MATCH_EXACT : MATCH);
36
36
  }
37
37
  navigate(commands, event) {
38
38
  if (event.button !== 0 || event.ctrlKey || event.shiftKey || event.altKey || event.metaKey) return;
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-tabs-router.mjs","names":[],"sources":["../../../projects/lib/tabs/router/tabs-routing.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { LocationStrategy } from '@angular/common';\nimport { Directive, forwardRef, inject } from '@angular/core';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport { ActivatedRoute, type IsActiveMatchOptions, NavigationEnd, Router, type UrlTree } from '@angular/router';\n\nimport { filter, map, startWith } from 'rxjs';\n\nimport { WR_TABS_ROUTING, type WrTabsRoutingAdapter } from 'ngwr/tabs';\n\n/**\n * How `routerLinkActive` matches when no `[routerLinkActiveOptions]` is given:\n * a path PREFIX, so `/settings/profile` still selects a `/settings` tab, and a\n * fragment or a matrix param never unselects one.\n */\nconst MATCH: IsActiveMatchOptions = {\n paths: 'subset',\n queryParams: 'subset',\n fragment: 'ignored',\n matrixParams: 'ignored',\n};\n\n/** `exact` on a tab: the path must match whole, everything else as in `MATCH`. */\nconst MATCH_EXACT: IsActiveMatchOptions = { ...MATCH, paths: 'exact' };\n\n/**\n * Router support for `<wr-tabs>`. Add it to the `imports` of the component that\n * declares a strip whose `<wr-tab>`s carry a `routerLink`:\n *\n * @example\n * ```ts\n * import { WrTab, WrTabs } from 'ngwr/tabs';\n * import { WrTabsRouting } from 'ngwr/tabs/router';\n *\n * @Component({ imports: [WrTabs, WrTab, WrTabsRouting], template: `\n * <wr-tabs wrTabsRouting>\n * <wr-tab title=\"Overview\" routerLink=\"overview\" />\n * <wr-tab title=\"Details\" routerLink=\"details\" />\n * </wr-tabs>\n * <router-outlet />\n * ` })\n * export class SettingsPage {}\n * ```\n *\n * Two mechanical edits per strip, both codemoddable: the symbol in `imports`,\n * and `wrTabsRouting` on the element. An attribute rather than a selector on\n * `wr-tabs` itself, for two reasons — where the router enters a template should\n * be visible in that template, and the docs' selector map keys a `wr-` tag\n * even when it is qualified, so `wr-tabs[wrTabsRouting]` would be a second claim\n * on the `wr-tabs` tag. Putting it on an ANCESTOR of the strip also works: the\n * token is read through the element injector, which walks up.\n *\n * **Why it is a separate entry point.** A directive listed in `imports: []`\n * lands in the compiled component's `dependencies` whether or not the branch of\n * the template that matches it ever runs, so `RouterLink` + `RouterLinkActive`\n * on the strip charged every CONTENT tab strip 73.9 kB of `@angular/router` —\n * 51% of what `ngwr/tabs` cost in an app that declares no routes. Measured with\n * source-map attribution against a routerless baseline. `@angular/router` is\n * already an optional peer dependency of the package; this is what makes that\n * true in bytes.\n *\n * **Why a directive rather than a provider function.** A relative `routerLink`\n * (`routerLink=\"overview\"`) resolves against the `ActivatedRoute` of the\n * component that declares the strip. A root-level provider would resolve every\n * one of them against the root route instead, and quietly build the wrong\n * hrefs; a directive on the element reads the same `ActivatedRoute` the old\n * `RouterLink` inside the strip's template did.\n */\n@Directive({\n selector: '[wrTabsRouting]',\n exportAs: 'wrTabsRouting',\n providers: [\n {\n provide: WR_TABS_ROUTING,\n // eslint-disable-next-line @angular-eslint/no-forward-ref\n useExisting: forwardRef(() => WrTabsRouting),\n },\n ],\n})\nexport class WrTabsRouting implements WrTabsRoutingAdapter {\n private readonly router = inject(Router);\n private readonly locationStrategy = inject(LocationStrategy);\n private readonly route = inject(ActivatedRoute);\n\n /**\n * The current URL, as a signal, so `href()` and `isActive()` are reactive to\n * navigation when read from a computed. `isActive` obviously has to be; so\n * does `href`, because a RELATIVE link is resolved against the active route\n * and its target moves when the route does — which is why `RouterLink`\n * recomputes its own href on every navigation too.\n */\n private readonly url = toSignal(\n this.router.events.pipe(\n filter((e): e is NavigationEnd => e instanceof NavigationEnd),\n map(e => e.urlAfterRedirects),\n startWith(this.router.url)\n ),\n { initialValue: this.router.url }\n );\n\n href(commands: string | readonly string[]): string {\n // Read for the dependency, the same reason `isActive` does: a RELATIVE link\n // resolves against the active route, so its target moves when the route\n // does. Without this a strip inside `/users/:id` kept rendering\n // `/users/1/profile` after navigating to user 2 — the click still routed,\n // because `navigate()` rebuilds the tree, but the visible href pointed at\n // the previous user. The docblock above already promised this; the code did\n // not do it.\n this.url();\n\n // `prepareExternalUrl`, not a bare `serializeUrl`, because that is what\n // `RouterLink` writes and the href exists precisely so the BROWSER can use\n // it. Under `withHashLocation()` a serialized `/one` renders as an href the\n // app does not serve: a plain click survives (`navigateByUrl` ignores the\n // strategy and `preventDefault` stops the bad navigation) but cmd-click,\n // middle-click, \"open in new tab\" and \"copy link address\" all take the href\n // at face value — the four things rendering one is for. A `--base-href` is\n // the same defect by another door.\n return this.locationStrategy.prepareExternalUrl(this.router.serializeUrl(this.tree(commands)));\n }\n\n isActive(commands: string | readonly string[], exact = false): boolean {\n // Read for the dependency, not for the value: `isActive` asks the router,\n // which is not a signal, so without this the computed that calls it would\n // never recompute and the strip would announce its first selection forever.\n this.url();\n return this.router.isActive(this.tree(commands), exact ? MATCH_EXACT : MATCH);\n }\n\n navigate(commands: string | readonly string[], event: MouseEvent): void {\n // Exactly the guard `RouterLink` applies: a middle click, or any click with\n // a modifier held, belongs to the browser — preventing it would make a tab\n // the one link on the page that cannot be opened in a new window.\n if (event.button !== 0 || event.ctrlKey || event.shiftKey || event.altKey || event.metaKey) return;\n event.preventDefault();\n void this.router.navigateByUrl(this.tree(commands));\n }\n\n private tree(commands: string | readonly string[]): UrlTree {\n // A bare string is one command, the way `[routerLink]=\"'overview'\"` is —\n // spread as characters it would navigate to `/o/v/e/r/v/i/e/w`.\n const segments = typeof commands === 'string' ? [commands] : [...commands];\n return this.router.createUrlTree(segments, { relativeTo: this.route });\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAqBA,MAAM,QAA8B;CAClC,OAAO;CACP,aAAa;CACb,UAAU;CACV,cAAc;AACf;AAGD,MAAM,cAAoC;CAAE,GAAG;CAAO,OAAO;AAAO;AAwDpE,IAAa,gBAAb,MAAa,cAAa;CACP,SAAS,OAAO,MAAM;CACtB,mBAAmB,OAAO,gBAAgB;CAC1C,QAAQ,OAAO,cAAc;CAS7B,MAAM,SACrB,KAAK,OAAO,OAAO,KACjB,QAAQ,MAA0B,aAAa,aAAa,GAC5D,KAAI,MAAK,EAAE,iBAAiB,GAC5B,UAAU,KAAK,OAAO,GAAG,CAAC,GAE5B,EAAE,cAAc,KAAK,OAAO,IAAG,CAAE;CAGnC,KAAK,UAAoC;EAQvC,KAAK,IAAG;EAUR,OAAO,KAAK,iBAAiB,mBAAmB,KAAK,OAAO,aAAa,KAAK,KAAK,QAAQ,CAAC,CAAC;CAC/F;CAEA,SAAS,UAAsC,QAAQ,OAAK;EAI1D,KAAK,IAAG;EACR,OAAO,KAAK,OAAO,SAAS,KAAK,KAAK,QAAQ,GAAG,QAAQ,cAAc,KAAK;CAC9E;CAEA,SAAS,UAAsC,OAAiB;EAI9D,IAAI,MAAM,WAAW,KAAK,MAAM,WAAW,MAAM,YAAY,MAAM,UAAU,MAAM,SAAS;EAC5F,MAAM,eAAc;EACpB,AAAK,KAAK,OAAO,cAAc,KAAK,KAAK,QAAQ,CAAC;CACpD;CAEQ,KAAK,UAAoC;EAG/C,MAAM,WAAW,OAAO,aAAa,WAAW,CAAC,QAAQ,IAAI,CAAC,GAAG,QAAQ;EACzE,OAAO,KAAK,OAAO,cAAc,UAAU,EAAE,YAAY,KAAK,MAAK,CAAE;CACvE;CAhEW,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAa,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAb,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAa,cAAA;EAAA,UAAA;EAAA,WARb,CACT;GACE,SAAS;GAET,aAAa,iBAAiB,aAAa;EAC5C,CACF;EAAA,UAAA,CAAA,eAAA;EAAA,UAAA;CAAA,CAAA;;AAEU,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAa,YAAA,CAAA;EAXzB,MAAA;EAAU,MAAA,CAAA;GACT,UAAU;GACV,UAAU;GACV,WAAW,CACT;IACE,SAAS;IAET,aAAa,iBAAgB,aAAc;GAC5C,CACF;EACF,CAAA"}
1
+ {"version":3,"file":"ngwr-tabs-router.mjs","names":[],"sources":["../../../projects/lib/tabs/router/tabs-routing.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { LocationStrategy } from '@angular/common';\nimport { Directive, forwardRef, inject } from '@angular/core';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport {\n ActivatedRoute,\n containsTree,\n type IsActiveMatchOptions,\n NavigationEnd,\n Router,\n type UrlTree,\n} from '@angular/router';\n\nimport { filter, map, startWith } from 'rxjs';\n\nimport { WR_TABS_ROUTING, type WrTabsRoutingAdapter } from 'ngwr/tabs';\n\n/**\n * How `routerLinkActive` matches when no `[routerLinkActiveOptions]` is given:\n * a path PREFIX, so `/settings/profile` still selects a `/settings` tab, and a\n * fragment or a matrix param never unselects one.\n */\nconst MATCH: IsActiveMatchOptions = {\n paths: 'subset',\n queryParams: 'subset',\n fragment: 'ignored',\n matrixParams: 'ignored',\n};\n\n/** `exact` on a tab: the path must match whole, everything else as in `MATCH`. */\nconst MATCH_EXACT: IsActiveMatchOptions = { ...MATCH, paths: 'exact' };\n\n/**\n * Router support for `<wr-tabs>`. Add it to the `imports` of the component that\n * declares a strip whose `<wr-tab>`s carry a `routerLink`:\n *\n * @example\n * ```ts\n * import { WrTab, WrTabs } from 'ngwr/tabs';\n * import { WrTabsRouting } from 'ngwr/tabs/router';\n *\n * @Component({ imports: [WrTabs, WrTab, WrTabsRouting], template: `\n * <wr-tabs wrTabsRouting>\n * <wr-tab title=\"Overview\" routerLink=\"overview\" />\n * <wr-tab title=\"Details\" routerLink=\"details\" />\n * </wr-tabs>\n * <router-outlet />\n * ` })\n * export class SettingsPage {}\n * ```\n *\n * Two mechanical edits per strip, both codemoddable: the symbol in `imports`,\n * and `wrTabsRouting` on the element. An attribute rather than a selector on\n * `wr-tabs` itself, for two reasons — where the router enters a template should\n * be visible in that template, and the docs' selector map keys a `wr-` tag\n * even when it is qualified, so `wr-tabs[wrTabsRouting]` would be a second claim\n * on the `wr-tabs` tag. Putting it on an ANCESTOR of the strip also works: the\n * token is read through the element injector, which walks up.\n *\n * **Why it is a separate entry point.** A directive listed in `imports: []`\n * lands in the compiled component's `dependencies` whether or not the branch of\n * the template that matches it ever runs, so `RouterLink` + `RouterLinkActive`\n * on the strip charged every CONTENT tab strip 73.9 kB of `@angular/router` —\n * 51% of what `ngwr/tabs` cost in an app that declares no routes. Measured with\n * source-map attribution against a routerless baseline. `@angular/router` is\n * already an optional peer dependency of the package; this is what makes that\n * true in bytes.\n *\n * **Why a directive rather than a provider function.** A relative `routerLink`\n * (`routerLink=\"overview\"`) resolves against the `ActivatedRoute` of the\n * component that declares the strip. A root-level provider would resolve every\n * one of them against the root route instead, and quietly build the wrong\n * hrefs; a directive on the element reads the same `ActivatedRoute` the old\n * `RouterLink` inside the strip's template did.\n */\n@Directive({\n selector: '[wrTabsRouting]',\n exportAs: 'wrTabsRouting',\n providers: [\n {\n provide: WR_TABS_ROUTING,\n // eslint-disable-next-line @angular-eslint/no-forward-ref\n useExisting: forwardRef(() => WrTabsRouting),\n },\n ],\n})\nexport class WrTabsRouting implements WrTabsRoutingAdapter {\n private readonly router = inject(Router);\n private readonly locationStrategy = inject(LocationStrategy);\n private readonly route = inject(ActivatedRoute);\n\n /**\n * The current URL, as a signal, so `href()` is reactive to navigation when\n * read from a computed: a RELATIVE link is resolved against the active route\n * and its target moves when the route does, which is why `RouterLink`\n * recomputes its own href on every navigation too.\n */\n private readonly url = toSignal(\n this.router.events.pipe(\n filter((e): e is NavigationEnd => e instanceof NavigationEnd),\n map(e => e.urlAfterRedirects),\n startWith(this.router.url)\n ),\n { initialValue: this.router.url }\n );\n\n href(commands: string | readonly string[]): string {\n // Read for the dependency, the same reason `isActive` does: a RELATIVE link\n // resolves against the active route, so its target moves when the route\n // does. Without this a strip inside `/users/:id` kept rendering\n // `/users/1/profile` after navigating to user 2 — the click still routed,\n // because `navigate()` rebuilds the tree, but the visible href pointed at\n // the previous user. The docblock above already promised this; the code did\n // not do it.\n this.url();\n\n // `prepareExternalUrl`, not a bare `serializeUrl`, because that is what\n // `RouterLink` writes and the href exists precisely so the BROWSER can use\n // it. Under `withHashLocation()` a serialized `/one` renders as an href the\n // app does not serve: a plain click survives (`navigateByUrl` ignores the\n // strategy and `preventDefault` stops the bad navigation) but cmd-click,\n // middle-click, \"open in new tab\" and \"copy link address\" all take the href\n // at face value — the four things rendering one is for. A `--base-href` is\n // the same defect by another door.\n return this.locationStrategy.prepareExternalUrl(this.router.serializeUrl(this.tree(commands)));\n }\n\n isActive(commands: string | readonly string[], exact = false): boolean {\n // What Angular's own `isActive` function reads: a signal, already the new URL\n // when `NavigationEnd` is emitted, and the tree as navigated, not reparsed.\n const current = this.router.lastSuccessfulNavigation()?.finalUrl ?? this.router.parseUrl(this.router.url);\n return containsTree(current, this.tree(commands), exact ? MATCH_EXACT : MATCH);\n }\n\n navigate(commands: string | readonly string[], event: MouseEvent): void {\n // Exactly the guard `RouterLink` applies: a middle click, or any click with\n // a modifier held, belongs to the browser — preventing it would make a tab\n // the one link on the page that cannot be opened in a new window.\n if (event.button !== 0 || event.ctrlKey || event.shiftKey || event.altKey || event.metaKey) return;\n event.preventDefault();\n void this.router.navigateByUrl(this.tree(commands));\n }\n\n private tree(commands: string | readonly string[]): UrlTree {\n // A bare string is one command, the way `[routerLink]=\"'overview'\"` is —\n // spread as characters it would navigate to `/o/v/e/r/v/i/e/w`.\n const segments = typeof commands === 'string' ? [commands] : [...commands];\n return this.router.createUrlTree(segments, { relativeTo: this.route });\n }\n}\n"],"mappings":";;;;;;;;;;;;;AA4BA,MAAM,QAA8B;CAClC,OAAO;CACP,aAAa;CACb,UAAU;CACV,cAAc;AACf;AAGD,MAAM,cAAoC;CAAE,GAAG;CAAO,OAAO;AAAO;AAwDpE,IAAa,gBAAb,MAAa,cAAa;CACP,SAAS,OAAO,MAAM;CACtB,mBAAmB,OAAO,gBAAgB;CAC1C,QAAQ,OAAO,cAAc;CAQ7B,MAAM,SACrB,KAAK,OAAO,OAAO,KACjB,QAAQ,MAA0B,aAAa,aAAa,GAC5D,KAAI,MAAK,EAAE,iBAAiB,GAC5B,UAAU,KAAK,OAAO,GAAG,CAAC,GAE5B,EAAE,cAAc,KAAK,OAAO,IAAG,CAAE;CAGnC,KAAK,UAAoC;EAQvC,KAAK,IAAG;EAUR,OAAO,KAAK,iBAAiB,mBAAmB,KAAK,OAAO,aAAa,KAAK,KAAK,QAAQ,CAAC,CAAC;CAC/F;CAEA,SAAS,UAAsC,QAAQ,OAAK;EAG1D,MAAM,UAAU,KAAK,OAAO,yBAAwB,CAAE,EAAE,YAAY,KAAK,OAAO,SAAS,KAAK,OAAO,GAAG;EACxG,OAAO,aAAa,SAAS,KAAK,KAAK,QAAQ,GAAG,QAAQ,cAAc,KAAK;CAC/E;CAEA,SAAS,UAAsC,OAAiB;EAI9D,IAAI,MAAM,WAAW,KAAK,MAAM,WAAW,MAAM,YAAY,MAAM,UAAU,MAAM,SAAS;EAC5F,MAAM,eAAc;EACpB,AAAK,KAAK,OAAO,cAAc,KAAK,KAAK,QAAQ,CAAC;CACpD;CAEQ,KAAK,UAAoC;EAG/C,MAAM,WAAW,OAAO,aAAa,WAAW,CAAC,QAAQ,IAAI,CAAC,GAAG,QAAQ;EACzE,OAAO,KAAK,OAAO,cAAc,UAAU,EAAE,YAAY,KAAK,MAAK,CAAE;CACvE;CA9DW,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAa,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAb,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAa,cAAA;EAAA,UAAA;EAAA,WARb,CACT;GACE,SAAS;GAET,aAAa,iBAAiB,aAAa;EAC5C,CACF;EAAA,UAAA,CAAA,eAAA;EAAA,UAAA;CAAA,CAAA;;AAEU,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAa,YAAA,CAAA;EAXzB,MAAA;EAAU,MAAA,CAAA;GACT,UAAU;GACV,UAAU;GACV,WAAW,CACT;IACE,SAAS;IAET,aAAa,iBAAgB,aAAc;GAC5C,CACF;EACF,CAAA"}
@@ -5,7 +5,7 @@ import { InjectionToken } from "@angular/core";
5
5
  * Use of this source code is governed by an MIT-style license that can be
6
6
  * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
7
7
  */
8
- const NGWR_VERSION = "16.7.0";
8
+ const NGWR_VERSION = "16.7.1";
9
9
  /**
10
10
  * @license
11
11
  *
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-version.mjs","names":[],"sources":["../../../projects/lib/version/version.ts","../../../projects/lib/version/version.token.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\n/**\n * The ngwr library version string, kept in sync with\n * `projects/lib/package.json` by `scripts/release/prepare.ts`.\n *\n * Prefer this over reading `package.json` at runtime — that requires a JSON\n * import or `require`, neither of which tree-shakes well in Angular builds.\n *\n * Distinct from `Version` exported by `@angular/core`, which reports the\n * loaded Angular runtime version (e.g. `'22.0.0'`), not ngwr's.\n */\nexport const NGWR_VERSION = '16.7.0';\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { InjectionToken } from '@angular/core';\n\nimport { NGWR_VERSION } from './version';\n\n/**\n * Injection token holding the ngwr library version string.\n *\n * Default factory returns {@link NGWR_VERSION}. Override it in tests or in\n * apps that want to surface a custom build identifier.\n *\n * @example\n * ```ts\n * @Component({...})\n * export class FooterComponent {\n * readonly version = inject(NGWR_VERSION_TOKEN);\n * }\n * ```\n */\nexport const NGWR_VERSION_TOKEN = new InjectionToken<string>('NGWR_VERSION_TOKEN', {\n providedIn: 'root',\n factory: () => NGWR_VERSION,\n});\n"],"mappings":";;;;;;;AAiBA,MAAa,eAAe;;;;;;;ACQ5B,MAAa,qBAAqB,IAAI,eAAuB,sBAAsB;CACjF,YAAY;CACZ,eAAe;AAChB,CAAA"}
1
+ {"version":3,"file":"ngwr-version.mjs","names":[],"sources":["../../../projects/lib/version/version.ts","../../../projects/lib/version/version.token.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\n/**\n * The ngwr library version string, kept in sync with\n * `projects/lib/package.json` by `scripts/release/prepare.ts`.\n *\n * Prefer this over reading `package.json` at runtime — that requires a JSON\n * import or `require`, neither of which tree-shakes well in Angular builds.\n *\n * Distinct from `Version` exported by `@angular/core`, which reports the\n * loaded Angular runtime version (e.g. `'22.0.0'`), not ngwr's.\n */\nexport const NGWR_VERSION = '16.7.1';\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { InjectionToken } from '@angular/core';\n\nimport { NGWR_VERSION } from './version';\n\n/**\n * Injection token holding the ngwr library version string.\n *\n * Default factory returns {@link NGWR_VERSION}. Override it in tests or in\n * apps that want to surface a custom build identifier.\n *\n * @example\n * ```ts\n * @Component({...})\n * export class FooterComponent {\n * readonly version = inject(NGWR_VERSION_TOKEN);\n * }\n * ```\n */\nexport const NGWR_VERSION_TOKEN = new InjectionToken<string>('NGWR_VERSION_TOKEN', {\n providedIn: 'root',\n factory: () => NGWR_VERSION,\n});\n"],"mappings":";;;;;;;AAiBA,MAAa,eAAe;;;;;;;ACQ5B,MAAa,qBAAqB,IAAI,eAAuB,sBAAsB;CACjF,YAAY;CACZ,eAAe;AAChB,CAAA"}
package/package.json CHANGED
@@ -1226,5 +1226,5 @@
1226
1226
  "sass": "./styles/_typography.scss"
1227
1227
  }
1228
1228
  },
1229
- "version": "16.7.0"
1229
+ "version": "16.7.1"
1230
1230
  }
@@ -26,6 +26,10 @@
26
26
  --wr-radio-dot: transparent;
27
27
  --wr-radio-color: var(--wr-color-on-surface);
28
28
 
29
+ // The containing block of the visually hidden input: without it the input is
30
+ // placed against a positioned ancestor outside any scroller between them, and
31
+ // focusing it scrolls that ancestor.
32
+ position: relative;
29
33
  display: inline-flex;
30
34
  vertical-align: middle;
31
35
  color: var(--wr-radio-color);
@@ -15,6 +15,10 @@
15
15
  --wr-switch-thumb: var(--wr-color-surface);
16
16
  --wr-switch-color: var(--wr-color-on-surface);
17
17
 
18
+ // The containing block of the visually hidden input: without it the input is
19
+ // placed against a positioned ancestor outside any scroller between them, and
20
+ // focusing it scrolls that ancestor.
21
+ position: relative;
18
22
  display: inline-flex;
19
23
  vertical-align: middle;
20
24
  color: var(--wr-switch-color);
@@ -1569,6 +1569,13 @@ $row-controls: "a[href], button, input, select, textarea, label, [role='button']
1569
1569
  transition: none;
1570
1570
  }
1571
1571
 
1572
+ // The preview of a `size="sm"` table: the table restates the padding hooks on
1573
+ // itself, which the preview has left, so the same values are the fallbacks here.
1574
+ .cdk-drag-preview.wr-table__th.wr-table__th--preview-sm {
1575
+ padding: calc(var(--wr-table-cell-padding-y, var(--wr-space-xs)) * var(--wr-density-y, 1))
1576
+ calc(var(--wr-table-cell-padding-x, var(--wr-space-sm)) * var(--wr-density-x, 1));
1577
+ }
1578
+
1572
1579
  // The cursor of a column drag. The CDK preview takes no pointer events, so the
1573
1580
  // cursor comes from a class on `<html>` for the length of the drag, set by the
1574
1581
  // table; `!important` because every control under the pointer has its own.
@@ -92,8 +92,14 @@ type WrDatePickerSize = 'sm' | 'md' | 'lg';
92
92
  * `'day'` is a `YYYY-MM-DD` string, the browser-local day `wrToDay` writes.
93
93
  */
94
94
  type WrDatePickerValueFormat = 'date' | 'day';
95
- /** The `value` type of `<wr-date-picker>` under a {@link WrDatePickerValueFormat}. */
96
- type WrDatePickerValue<F extends WrDatePickerValueFormat = 'date'> = F extends 'day' ? string : Date;
95
+ /**
96
+ * The `value` type of `<wr-date-picker>` under a {@link WrDatePickerValueFormat}:
97
+ * `Date` for `'date'`, a string for `'day'`, either for a format that can be both.
98
+ * The first check is on `[F]`, not `F`: with no `valueFormat` binding the
99
+ * template type-checker passes the format as `any`, which a conditional on a
100
+ * bare `F` reads as both branches, and the value must then be the default `Date`.
101
+ */
102
+ type WrDatePickerValue<F extends WrDatePickerValueFormat = 'date'> = [F] extends ['date'] ? Date : 'date' extends F ? Date | string : string;
97
103
  /**
98
104
  * @license
99
105
  *
@@ -540,9 +540,9 @@ export declare class WrPopover implements AfterViewInit {
540
540
  * Short form of `[wrPopover]` with `mode="tooltip"`: the same panel, delays,
541
541
  * hover and keyboard-focus trigger, and the same naming of an icon-only button.
542
542
  *
543
- * It is `WrPopover` as a host directive, so `exportAs` and `isOpen()` work
544
- * through `#tip="wrTooltip"` and the inputs keep their `wrPopover` names. Do not
545
- * put `[wrPopover]` on the same element.
543
+ * It is `WrPopover` as a host directive, so the inputs keep their `wrPopover`
544
+ * names, and `#tip="wrTooltip"` reaches it as `tip.popover` (`tip.popover.isOpen()`).
545
+ * Do not put `[wrPopover]` on the same element.
546
546
  *
547
547
  * @example
548
548
  * ```html
@@ -124,8 +124,9 @@ export declare class WrScrollFollow {
124
124
  private onScroll;
125
125
  /**
126
126
  * Any move up stops the following, so a reader can leave while text streams
127
- * in; within a pixel of the end it is the browser clamping to shorter content.
128
- * Only a move down resumes it: the directive's own writes are never read as one.
127
+ * in; one that lands within a pixel of the end is the browser clamping to
128
+ * shorter content, and it follows again, since nothing is left to scroll back
129
+ * to. Only a move down resumes it: the directive's own writes are never read as one.
129
130
  */
130
131
  private read;
131
132
  /** Content or the container changed size: hold the end, or hold the reader's place. */
@@ -134,6 +135,14 @@ export declare class WrScrollFollow {
134
135
  private move;
135
136
  /** Remember the lowest row in view. A row at the top would be the "load older" button. */
136
137
  private capture;
138
+ /**
139
+ * The last child of `parent` that starts above the bottom of `box`, found by
140
+ * bisection: rows stack top to bottom, so only the ones around the view are
141
+ * measured, not every row below it. A child without a box (`display: none`,
142
+ * `display: contents`) has nothing to hold on to and is stepped over.
143
+ * `others` is whether `parent` has a second child with a box.
144
+ */
145
+ private lowestInView;
137
146
  /** Put the remembered row back where it was. */
138
147
  private restore;
139
148
  static ɵfac: i0.ɵɵFactoryDeclaration<WrScrollFollow, never>;
@@ -1085,6 +1085,7 @@ export declare class WrTable<T extends WrTableRow = WrTableRow> {
1085
1085
  readonly rowLink: import("@angular/core").InputSignal<WrTableRowLink<T> | null>;
1086
1086
  /** The routing adapter, when `WrTableRouting` from `ngwr/table/router` is on the table. */
1087
1087
  private readonly routing;
1088
+ private warnedNoRouting;
1088
1089
  /** The link of every rendered row that has one, so a virtualized body resolves its window only. */
1089
1090
  protected readonly rowLinks: import("@angular/core").Signal<ReadonlyMap<Record<string, unknown>, RowLink>>;
1090
1091
  /**
@@ -54,10 +54,9 @@ export declare class WrTabsRouting implements WrTabsRoutingAdapter {
54
54
  private readonly locationStrategy;
55
55
  private readonly route;
56
56
  /**
57
- * The current URL, as a signal, so `href()` and `isActive()` are reactive to
58
- * navigation when read from a computed. `isActive` obviously has to be; so
59
- * does `href`, because a RELATIVE link is resolved against the active route
60
- * and its target moves when the route does — which is why `RouterLink`
57
+ * The current URL, as a signal, so `href()` is reactive to navigation when
58
+ * read from a computed: a RELATIVE link is resolved against the active route
59
+ * and its target moves when the route does, which is why `RouterLink`
61
60
  * recomputes its own href on every navigation too.
62
61
  */
63
62
  private readonly url;
@@ -15,7 +15,7 @@ import { InjectionToken } from "@angular/core";
15
15
  * Distinct from `Version` exported by `@angular/core`, which reports the
16
16
  * loaded Angular runtime version (e.g. `'22.0.0'`), not ngwr's.
17
17
  */
18
- export declare const NGWR_VERSION = "16.7.0";
18
+ export declare const NGWR_VERSION = "16.7.1";
19
19
  /**
20
20
  * Injection token holding the ngwr library version string.
21
21
  *