Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
0ff5267
feat(*): update to angular 20
michaelwittwer Jun 4, 2025
ac9f9ee
feat(*): update the @angular/cdk to 20
michaelwittwer Jun 4, 2025
ba7a44f
fix(*): remove our ng-dev-mode type, since this is no part of @angula…
michaelwittwer Jun 4, 2025
192df50
build(*): update the package versions to 10 since we have an open Pul…
michaelwittwer Jun 4, 2025
7f9b9d2
docs(*): update the angular version mapping table
michaelwittwer Jun 4, 2025
1c40ac6
build(components): update version range
michaelwittwer Jun 4, 2025
578adc1
build(*): update to node ^22.12.0
michaelwittwer Jun 4, 2025
6f2b47f
build(*): update to node ^22.12.0
michaelwittwer Jun 4, 2025
89b62d5
build(release): next version [skip_build]
actions-user Jun 4, 2025
31fadb7
feat(core): update to angular 20
michaelwittwer Jun 4, 2025
6188a11
feat(components): update to angular 20
michaelwittwer Jun 4, 2025
a4a8e89
Merge remote-tracking branch 'origin/#50-angular20' into #50-angular20
michaelwittwer Jun 4, 2025
f4b3fef
build(release): next version [skip_build]
actions-user Jun 4, 2025
2006c1a
Merge branch 'main' into #50-angular20
michaelwittwer Jun 30, 2025
b823650
build(release): next version [skip_build]
actions-user Jun 30, 2025
2f2f686
feat(*): update to latest @shiftcode/eslint-config-recommended
michaelwittwer Jun 30, 2025
28d97ba
Merge remote-tracking branch 'origin/#50-angular20' into #50-angular20
michaelwittwer Jun 30, 2025
dafceb0
feat(*): run @angular/core:inject migration
michaelwittwer Jun 30, 2025
01f104f
build(release): next version [skip_build]
actions-user Jun 30, 2025
98d7f09
build(node): update version to match current lts
michaelwittwer Jun 30, 2025
5280f35
build(release): next version [skip_build]
actions-user Jun 30, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v20.11.1
lts/jod
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Shows the mapping between the angular version and our lib versions.

| Angular Version | Lib Version |
|-----------------|-------------------------------|
| `^20` | `^11` |
| `^19` | `^7 \|\| ^8 \|\| ^9 \|\| ^10` |
| `^18` | `^6` |
| `^17` | `^5` |
Expand Down
24 changes: 20 additions & 4 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -138,17 +138,33 @@
"displayBlock": true,
"changeDetection": "OnPush",
"viewEncapsulation": "None",
"skipTests": true
"skipTests": true,
"type": "component"
},
"@schematics/angular:directive": {
"prefix": "sc",
"skipTests": true
"skipTests": true,
"type": "directive"
},
"@schematics/angular:pipe": {
"skipTests": true
"skipTests": true,
"typeSeparator": "."
},
"@schematics/angular:service": {
"skipTests": true
"skipTests": true,
"type": "service"
},
"@schematics/angular:guard": {
"typeSeparator": "."
},
"@schematics/angular:interceptor": {
"typeSeparator": "."
},
"@schematics/angular:module": {
"typeSeparator": "."
},
"@schematics/angular:resolver": {
"typeSeparator": "."
}
}
}
4 changes: 3 additions & 1 deletion apps/styleguide/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ export class AppComponent {

private readonly logger: Logger = inject(LoggerService).getInstance('AppComponent')

constructor(clientIdService: ClientIdService) {
constructor() {
const clientIdService = inject(ClientIdService)

this.logger.debug('constructor()')
this.logger.debug('clientId', clientIdService.clientId)
}
Expand Down
12 changes: 4 additions & 8 deletions apps/styleguide/src/routes/sg-button/sg-button.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { DOCUMENT } from '@angular/common'
import { ChangeDetectionStrategy, Component, Inject, OnDestroy, Optional } from '@angular/core'
import { ChangeDetectionStrategy, Component, OnDestroy, DOCUMENT, inject } from '@angular/core'
import { ButtonComponent } from '@shiftcode/ngx-components'

@Component({
Expand All @@ -18,11 +17,10 @@ export class SgButtonComponent implements OnDestroy {

isToggled = false

private document?: Document
private readonly document = inject(DOCUMENT, { optional: true })
private intervalId: any

constructor(@Optional() @Inject(DOCUMENT) document?: any) {
this.document = document
constructor() {
this.intervalId = setInterval(this.updateActiveEl, 100)
}

Expand All @@ -32,9 +30,7 @@ export class SgButtonComponent implements OnDestroy {

private updateActiveEl = (): string | null => {
return (this.activeEl =
(this.document &&
this.document.activeElement &&
`${this.document.activeElement.tagName}#${this.document.activeElement.id}`) ||
(this.document?.activeElement && `${this.document.activeElement.tagName}#${this.document.activeElement.id}`) ||
null)
}
}
6 changes: 4 additions & 2 deletions apps/styleguide/src/routes/sg-tooltip/sg-tooltip.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChangeDetectionStrategy, Component, inject, Inject, Optional } from '@angular/core'
import { ChangeDetectionStrategy, Component, inject } from '@angular/core'
import { FormControl, ReactiveFormsModule } from '@angular/forms'
import { TOOLTIP_DEFAULT_OPTIONS, TooltipDirective, TooltipOptions, TooltipPosition } from '@shiftcode/ngx-components'
import { LoggerService } from '@shiftcode/ngx-core'
Expand Down Expand Up @@ -30,7 +30,9 @@ export class SgTooltipComponent {
readonly positionCtrl = new FormControl<TooltipPosition>(this.tooltipPositions[0], { nonNullable: true })
private readonly logger = inject(LoggerService).getInstance('SgTooltipComponent')

constructor(@Optional() @Inject(TOOLTIP_DEFAULT_OPTIONS) opts: TooltipOptions) {
constructor() {
const opts = inject<TooltipOptions>(TOOLTIP_DEFAULT_OPTIONS, { optional: true })

this.logger.debug('tooltipDefaultOptions', opts)
}
}
3 changes: 0 additions & 3 deletions apps/styleguide/tsconfig.app.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "../../out-tsc/app",
"types": [
"../../ng-dev-mode"
]
},
"files": [
"src/main.ts"
Expand Down
16 changes: 8 additions & 8 deletions libs/components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@shiftcode/ngx-components",
"version": "10.0.0",
"version": "11.0.0-pr50.4",
"repository": "https://github.com/shiftcode/sc-ng-commons-public",
"license": "MIT",
"author": "shiftcode GmbH <team@shiftcode.ch>",
Expand All @@ -18,14 +18,14 @@
"tslib": "^2.5.0"
},
"peerDependencies": {
"@angular/animations": "^19.0.0",
"@angular/cdk": "^19.0.0",
"@angular/common": "^19.0.0",
"@angular/core": "^19.0.0",
"@angular/forms": "^19.0.0",
"@angular/router": "^19.0.0",
"@angular/animations": "^20.0.0",
"@angular/cdk": "^20.0.0",
"@angular/common": "^20.0.0",
"@angular/core": "^20.0.0",
"@angular/forms": "^20.0.0",
"@angular/router": "^20.0.0",
"@shiftcode/logger": "^3.0.0",
"@shiftcode/ngx-core": "^9.0.0 || ^10.0.0 || ^10.0.0-pr48",
"@shiftcode/ngx-core": "^11.0.0 || ^11.0.0-pr50",
"rxjs": "^6.5.3 || ^7.4.0"
}
}
3 changes: 1 addition & 2 deletions libs/components/src/lib/auto-focus/auto-focus.directive.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { DOCUMENT } from '@angular/common'
import { AfterViewInit, Directive, ElementRef, inject } from '@angular/core'
import { AfterViewInit, Directive, ElementRef, inject, DOCUMENT } from '@angular/core'
import { isInputElement, LoggerService } from '@shiftcode/ngx-core'
import { Logger } from '@shiftcode/logger'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ export class ClickOutsideDirective implements OnDestroy, OnChanges {

private subscription?: Subscription
private readonly element: HTMLElement = inject(ElementRef).nativeElement

constructor(private uiEventService: UIEventService) {}
private readonly uiEventService = inject(UIEventService)

ngOnChanges(): void {
// as there is only one input, ngOnChanges is only called when `isActive` changes
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DOCUMENT, isPlatformServer } from '@angular/common'
import { isPlatformServer } from '@angular/common'
import {
ChangeDetectionStrategy,
ChangeDetectorRef,
Expand All @@ -7,6 +7,7 @@ import {
inject,
OnInit,
PLATFORM_ID,
DOCUMENT,
} from '@angular/core'
import { WindowRef } from '@shiftcode/ngx-core'
import { fromEvent } from 'rxjs'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Directive, Input, ViewContainerRef, ViewRef } from '@angular/core'
import { Directive, Input, ViewContainerRef, ViewRef, inject } from '@angular/core'

/**
* Directive to insert a viewRef to the template.
Expand All @@ -15,6 +15,8 @@ import { Directive, Input, ViewContainerRef, ViewRef } from '@angular/core'
*/
@Directive({ selector: '[scInsertViewRef]', standalone: true })
export class InsertViewRefDirective {
private readonly container = inject(ViewContainerRef)

@Input()
set scInsertViewRef(val: ViewRef | null | undefined) {
this.container.clear()
Expand All @@ -27,8 +29,6 @@ export class InsertViewRefDirective {
return this.container.length > 0
}

constructor(private container: ViewContainerRef) {}

/**
* Inserts a view into the container.
* @throws when a view is already attached
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { DOCUMENT } from '@angular/common'
import { EnvironmentProviders, makeEnvironmentProviders, inject, provideAppInitializer } from '@angular/core'
import { EnvironmentProviders, makeEnvironmentProviders, inject, provideAppInitializer, DOCUMENT } from '@angular/core'
import { NavigationCancel, NavigationEnd, NavigationError, NavigationStart, Router } from '@angular/router'
import { delay, filter, switchMap, take, tap } from 'rxjs'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { animate, style, transition, trigger } from '@angular/animations'
import { Component, ElementRef, HostBinding, Input, OnChanges } from '@angular/core'
import { Component, ElementRef, HostBinding, Input, OnChanges, inject } from '@angular/core'

/**
* Standalone Component to smoothly animate height changes.
Expand All @@ -25,8 +25,7 @@ export class SmoothHeightComponent implements OnChanges {
trigger: any

private startHeight: number

constructor(private element: ElementRef) {}
private readonly element = inject(ElementRef)

@HostBinding('@grow')
get grow() {
Expand Down
8 changes: 2 additions & 6 deletions libs/components/src/lib/svg-animate/svg-animate.directive.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { BooleanInput, coerceBooleanProperty } from '@angular/cdk/coercion'
import { AfterViewInit, Directive, ElementRef, Input, OnChanges, OnInit } from '@angular/core'
import { AfterViewInit, Directive, ElementRef, Input, OnChanges, OnInit, inject } from '@angular/core'

/**
* Standalone Directive to animate SVG parts by calling beginElement method
Expand Down Expand Up @@ -34,13 +34,9 @@ export class SvgAnimateDirective implements OnChanges, AfterViewInit, OnInit {
return this._withInitAnimation
}

readonly element: HTMLElement
readonly element = inject(ElementRef).nativeElement
private _withInitAnimation = false

constructor(elementRef: ElementRef<HTMLElement>) {
this.element = elementRef.nativeElement
}

ngOnInit() {
if (!this.withInitAnimation) {
// set initial state without animation
Expand Down
6 changes: 2 additions & 4 deletions libs/components/src/lib/svg/svg-registry.service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { DOCUMENT } from '@angular/common'
import { HttpClient, HttpErrorResponse } from '@angular/common/http'
import { inject, Injectable } from '@angular/core'
import { inject, Injectable, DOCUMENT } from '@angular/core'
import { firstValueFrom } from 'rxjs'

/**
Expand All @@ -10,6 +9,7 @@ import { firstValueFrom } from 'rxjs'
export class SvgRegistry {
private readonly cache = new Map<string, Promise<SVGElement>>()
private readonly document = inject(DOCUMENT)
private readonly httpClient = inject(HttpClient)

/**
* Creates a DOM element from the given SVG string, and adds default attributes.
Expand Down Expand Up @@ -40,8 +40,6 @@ export class SvgRegistry {
return svg
}

constructor(private httpClient: HttpClient) {}

/**
* Returns a Promise that produces the icon (as an <svg> DOM element) from the given URL.
* The response from the URL may be cached so this will not always cause an HTTP request, but
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AfterViewInit, Directive, ElementRef, HostBinding, inject, Inject, Input, OnDestroy } from '@angular/core'
import { AfterViewInit, Directive, ElementRef, HostBinding, inject, Input, OnDestroy } from '@angular/core'
import { FormControlDirective } from '@angular/forms'
import { LoggerService, ResizeService } from '@shiftcode/ngx-core'
import { Logger } from '@shiftcode/logger'
Expand All @@ -24,14 +24,12 @@ export class TextareaAutosizeDirective implements AfterViewInit, OnDestroy {

readonly element: HTMLTextAreaElement = inject(ElementRef).nativeElement

private readonly formControlDir = inject(FormControlDirective)
private readonly logger: Logger = inject(LoggerService).getInstance('TextareaAutosizeDirective')
private readonly onDestroy = new Subject<void>()

constructor(
resizeService: ResizeService,
@Inject(FormControlDirective) private readonly formControlDir: FormControlDirective,
) {
resizeService.observe(this.element).pipe(takeUntil(this.onDestroy)).subscribe(this.resize.bind(this))
constructor() {
inject(ResizeService).observe(this.element).pipe(takeUntil(this.onDestroy)).subscribe(this.resize.bind(this))
}

ngAfterViewInit() {
Expand Down
12 changes: 10 additions & 2 deletions libs/components/src/lib/tooltip/tooltip.component.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
import { AnimationEvent, trigger } from '@angular/animations'
import { ConnectedOverlayPositionChange } from '@angular/cdk/overlay'
import { NgClass } from '@angular/common'
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, OnDestroy, ViewChild } from '@angular/core'
import {
ChangeDetectionStrategy,
ChangeDetectorRef,
Component,
ElementRef,
OnDestroy,
ViewChild,
inject,
} from '@angular/core'
import { Observable, Subject } from 'rxjs'
import { TooltipNotchPosition, TooltipPosition, TooltipPositionSimple } from './tooltip-position.type'
import { TooltipVisibility } from './tooltip-visibility.type'
Expand Down Expand Up @@ -75,7 +83,7 @@ export class TooltipComponent implements OnDestroy {
/** Subject for notifying that the tooltip has been hidden from the view */
private readonly onHide = new Subject<void>()

constructor(private changeDetectorRef: ChangeDetectorRef) {}
private readonly changeDetectorRef = inject(ChangeDetectorRef)

/**
* Shows the tooltip with an animation originating from the provided origin
Expand Down
Loading