Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for v19 #537

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ Check [the documentation](https://ngxtension.netlify.app/).

<!-- UTILITIES:END -->

## Supported Versions

| `Angular` version | `ngxtension` version |
|-------------------|----------------------|
| 16.x.x | 0.0.1 |
| 16.x.x - 18.x.x | 1.0.0 - 4.2.0 |
| 19.x.x | 5.0.0 |

## Contributors ✨

Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { Component } from '@angular/core';
import { injectActiveElement } from 'ngxtension/active-element';

@Component({
standalone: true,
host: {
style: 'display: block; margin: 12px',
},
Expand Down
2 changes: 0 additions & 2 deletions apps/test-app/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { Component } from '@angular/core';
import { RouterLink, RouterOutlet } from '@angular/router';

@Component({
standalone: true,
imports: [RouterLink, RouterOutlet],
selector: 'ngxtension-platform-root',
template: `
Expand Down Expand Up @@ -61,7 +60,6 @@ import { RouterLink, RouterOutlet } from '@angular/router';
<hr />
<router-outlet />
`,

styles: `
ul {
display: flex;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { NgxControlError } from 'ngxtension/control-error';

@Component({
selector: 'ngxtension-platform-control-error',
standalone: true,
imports: [NgxControlError, FormsModule, ReactiveFormsModule],
template: `
<form [formGroup]="form">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ export class UserSelect {

@Component({
selector: 'ngxtension-platform-control-value-accessor',
standalone: true,
imports: [
CommonModule,
FormsModule,
Expand Down
1 change: 0 additions & 1 deletion apps/test-app/src/app/drag/drag.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ export class Box {
}

@Component({
standalone: true,
imports: [Box, BoxWithHost, NgxDrag],
template: `
<app-box />
Expand Down
1 change: 0 additions & 1 deletion apps/test-app/src/app/form-events/form-events.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { allEventsObservable, allEventsSignal } from 'ngxtension/form-events';

@Component({
selector: 'ngxtension-platform-intl',
standalone: true,
imports: [ReactiveFormsModule, JsonPipe, AsyncPipe],
template: `
<form [formGroup]="form">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { FormControl, ReactiveFormsModule, Validators } from '@angular/forms';
import { ifValidator } from 'ngxtension/if-validator';

@Component({
standalone: true,
imports: [CommonModule, ReactiveFormsModule],
host: {
style: 'display: block; margin: 12px',
Expand Down
1 change: 0 additions & 1 deletion apps/test-app/src/app/intl/intl.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {

@Component({
selector: 'ngxtension-platform-intl',
standalone: true,
imports: [
CommonModule,
DisplayNamesPipe,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { FormsModule } from '@angular/forms';
import { linkedQueryParam } from 'ngxtension/linked-query-param';

@Component({
standalone: true,
template: `
<div>
@for (id of IDs; track $index) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { Title } from '@angular/platform-browser';
import { linkedQueryParam } from 'ngxtension/linked-query-param';

@Component({
standalone: true,
template: `
<div>
<pre>SearchQuery: {{ searchQuery() | json }}</pre>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
} from 'ngxtension/linked-query-param';

@Component({
standalone: true,
template: `
<div>
<pre>Show Deleted: {{ showDeleted() | json }}</pre>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { Router } from '@angular/router';
import { linkedQueryParam } from 'ngxtension/linked-query-param';

@Component({
standalone: true,
template: `
<div>
<label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { FormsModule } from '@angular/forms';
import { linkedQueryParam, paramToNumber } from 'ngxtension/linked-query-param';

@Component({
standalone: true,
template: `
<div>
<pre>Page Number: {{ pageNumber() | json }}</pre>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ interface MyFilters {
}

@Component({
standalone: true,
template: `
<div>
MyFilters:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { Component } from '@angular/core';
import { RouterLink, RouterLinkActive, RouterOutlet } from '@angular/router';

@Component({
standalone: true,
template: `
<div>
<a routerLink="/linked-query-param/string" routerLinkActive="active">
Expand Down
1 change: 0 additions & 1 deletion apps/test-app/src/app/resize/resize.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { toSignal } from '@angular/core/rxjs-interop';
import { injectResize } from 'ngxtension/resize';

@Component({
standalone: true,
template: `
<pre>{{ resize() | json }}</pre>
`,
Expand Down
1 change: 0 additions & 1 deletion apps/test-app/src/app/svg-sprite/svg-sprite.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ export class FaBrandDirective {

@Component({
selector: 'ngxtension-platform-svg-sprite',
standalone: true,
imports: [
NgxSvgSpriteFragment,
FaRegularDirective,
Expand Down
1 change: 0 additions & 1 deletion apps/test-app/src/app/track-by/track-by.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
import { TrackById, TrackByProp } from 'ngxtension/trackby-id-prop';

@Component({
standalone: true,
template: `
<ul #parentNoTrackBy>
<li *ngFor="let person of people">
Expand Down
15 changes: 0 additions & 15 deletions docs/src/content/docs/utilities/Signals/signal-slice.md
Original file line number Diff line number Diff line change
Expand Up @@ -261,18 +261,3 @@ effect(() => {
}
});
```

If you intend to trigger another `actionSource` from within your effects, it will be necessary to enable `allowSignalWrites` as triggering an `actionSource` will cause a value to be written to the state signal, e.g:

```ts
effect(
() => {
const status = state.status();

if (state.status() === 'complete') {
state.uploadAudio();
}
},
{ allowSignalWrites: true },
);
```
8 changes: 8 additions & 0 deletions libs/ngxtension/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,11 @@ nx generate ngxtension:init
Check [the documentation](https://ngxtension.netlify.app/).

<!-- UTILITIES:END -->

## Supported Versions

| `Angular` version | `ngxtension` version |
|-------------------|----------------------|
| 16.x.x | 0.0.1 |
| 16.x.x - 18.x.x | 1.0.0 - 4.2.0 |
| 19.x.x | 5.0.0 |
5 changes: 1 addition & 4 deletions libs/ngxtension/connect/src/connect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,7 @@ export function connect(signal: WritableSignal<unknown>, ...args: any[]) {
return { ...prev, ...(originSignal() as object) };
});
},
{
allowSignalWrites: true,
injector,
},
{ injector },
);
}

Expand Down
12 changes: 4 additions & 8 deletions libs/ngxtension/inject-lazy/src/inject-lazy-impl.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import {
DestroyRef,
ENVIRONMENT_INITIALIZER,
EnvironmentInjector,
Injectable,
Injector,
Type,
createEnvironmentInjector,
inject,
provideEnvironmentInitializer,
type Provider,
type ProviderToken,
} from '@angular/core';
Expand Down Expand Up @@ -85,12 +85,8 @@ export class InjectLazyImpl<T> {
*/
export function mockLazyProvider<T>(type: Type<T>, mock: Type<unknown>) {
return [
{
provide: ENVIRONMENT_INITIALIZER,
multi: true,
useValue: () => {
inject(InjectLazyImpl).override(type, mock);
},
},
provideEnvironmentInitializer(() => {
inject(InjectLazyImpl).override(type, mock);
}),
];
}
Original file line number Diff line number Diff line change
Expand Up @@ -192,19 +192,14 @@ describe('injectLocalStorage', () => {

const effectConsumer = await new Promise<ReactiveNode | null>(
(resolve) => {
const effectRef = effect(
() => {
localStorageSignal.set(newValue1);
localStorageSignal.update(() => newValue2);

resolve(getActiveConsumer());

effectRef.destroy();
},
{
allowSignalWrites: true,
},
);
const effectRef = effect(() => {
localStorageSignal.set(newValue1);
localStorageSignal.update(() => newValue2);

resolve(getActiveConsumer());

effectRef.destroy();
});

TestBed.flushEffects();
},
Expand Down
6 changes: 3 additions & 3 deletions libs/ngxtension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
"signals"
],
"peerDependencies": {
"@angular/common": ">=16.0.0",
"@angular/core": ">=16.0.0",
"@angular/common": ">=19.0.0",
"@angular/core": ">=19.0.0",
"@use-gesture/vanilla": "^10.0.0",
"rxjs": "^6.0.0 || ^7.0.0"
},
Expand All @@ -30,7 +30,7 @@
},
"dependencies": {
"tslib": "^2.3.0",
"@angular-eslint/bundled-angular-compiler": "^18.0.1",
"@angular-eslint/bundled-angular-compiler": "^19.0.1",
"@nx/devkit": "^20.0.0",
"nx": "^20.0.0",
"ts-morph": "^22.0.0"
Expand Down
13 changes: 6 additions & 7 deletions libs/ngxtension/svg-sprite/src/svg-sprite.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { DOCUMENT } from '@angular/common';
import {
Directive,
ENVIRONMENT_INITIALIZER,
ElementRef,
Injectable,
Input,
Expand All @@ -10,6 +9,7 @@ import {
computed,
inject,
makeEnvironmentProviders,
provideEnvironmentInitializer,
signal,
type OnInit,
} from '@angular/core';
Expand Down Expand Up @@ -135,17 +135,16 @@ export type CreateNgxSvgSpriteOptions = Omit<NgxSvgSprite, 'url'> &
*/
export const provideSvgSprites = (...sprites: CreateNgxSvgSpriteOptions[]) =>
makeEnvironmentProviders([
{
provide: ENVIRONMENT_INITIALIZER,
multi: true,
useFactory: () => {
provideEnvironmentInitializer(() => {
const initializerFn = (() => {
const service = inject(NgxSvgSprites);
return () =>
sprites.forEach((sprite) =>
service.register(createSvgSprite(sprite)),
);
},
},
})();
return initializerFn();
}),
]);

/**
Expand Down
Loading
Loading