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

next: update to angular v19 #31

Merged
merged 5 commits into from
Dec 10, 2024
Merged
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,5 @@ testem.log
Thumbs.db

.nx/cache
.nx/workspace-data
.angular
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
/coverage
/.nx/cache
.angular

/.nx/workspace-data
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import { toast, NgxSonnerToaster } from 'ngx-sonner';

@Component({
selector: 'app-root',
standalone: true,
imports: [NgxSonnerToaster],
template: `
<ngx-sonner-toaster />
Expand Down Expand Up @@ -206,7 +205,6 @@ You can use `toast.custom()` to render an unstyled toast with a custom component
```ts
@Component({
selector: 'app-custom',
standalone: true,
template: `
<div>
This is a custom component <button (click)="toastClick()">close</button>
Expand Down
3 changes: 2 additions & 1 deletion apps/docs/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"prefix": "docs",
"style": "kebab-case"
}
]
],
"@angular-eslint/prefer-standalone": "off"
}
},
{
Expand Down
29 changes: 14 additions & 15 deletions apps/docs/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,19 @@ import { TypeComponent } from './components/types.component';
import { UsageComponent } from './components/usage.component';

@Component({
selector: 'docs-root',
standalone: true,
imports: [
NgxSonnerToaster,
HeroComponent,
InstallationComponent,
UsageComponent,
TypeComponent,
PositionComponent,
ExpandComponent,
OtherComponent,
FooterComponent,
],
template: `
selector: 'docs-root',
imports: [
NgxSonnerToaster,
HeroComponent,
InstallationComponent,
UsageComponent,
TypeComponent,
PositionComponent,
ExpandComponent,
OtherComponent,
FooterComponent,
],
template: `
<ngx-sonner-toaster
[expand]="expand()"
[position]="position()"
Expand All @@ -43,7 +42,7 @@ import { UsageComponent } from './components/usage.component';
</main>
<docs-footer />
`,
changeDetection: ChangeDetectionStrategy.OnPush,
changeDetection: ChangeDetectionStrategy.OnPush
})
export class AppComponent {
expand = signal(false);
Expand Down
1 change: 0 additions & 1 deletion apps/docs/src/app/components/code-block.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ hljs.registerLanguage('xml', xml);

@Component({
selector: 'docs-code-block',
standalone: true,
template: `
<div class="outerWrapper">
<button class="copyButton" (click)="onCopy()" aria-label="Copy code">
Expand Down
1 change: 0 additions & 1 deletion apps/docs/src/app/components/code-snippets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ export const usageSnippet = `import { toast, NgxSonnerToaster } from 'ngx-sonner

@Component({
selector: 'app-root',
standalone: true,
imports: [NgxSonnerToaster],
template: \`
<ngx-sonner-toaster />
Expand Down
1 change: 0 additions & 1 deletion apps/docs/src/app/components/custom.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { ChangeDetectionStrategy, Component } from '@angular/core';

@Component({
selector: 'docs-custom',
standalone: true,
template: `
<div>A custom toast with default styling</div>
`,
Expand Down
9 changes: 4 additions & 5 deletions apps/docs/src/app/components/expand.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ import { toast } from 'ngx-sonner';
import { CodeBlockComponent } from './code-block.component';

@Component({
selector: 'docs-expand',
standalone: true,
imports: [CodeBlockComponent],
template: `
selector: 'docs-expand',
imports: [CodeBlockComponent],
template: `
<div>
<h2>Expand</h2>
<p>
Expand All @@ -36,7 +35,7 @@ import { CodeBlockComponent } from './code-block.component';
<docs-code-block [code]="expandSnippet()" />
</div>
`,
changeDetection: ChangeDetectionStrategy.OnPush,
changeDetection: ChangeDetectionStrategy.OnPush
})
export class ExpandComponent {
expand = model.required<boolean>();
Expand Down
1 change: 0 additions & 1 deletion apps/docs/src/app/components/footer.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { ChangeDetectionStrategy, Component } from '@angular/core';

@Component({
selector: 'docs-footer',
standalone: true,
template: `
<footer class="wrapper">
<div class="container">
Expand Down
3 changes: 1 addition & 2 deletions apps/docs/src/app/components/hero.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { toast } from 'ngx-sonner';

@Component({
selector: 'docs-hero',
standalone: true,
template: `
<div class="wrapper">
<div class="toastWrapper">
Expand All @@ -21,7 +20,7 @@ import { toast } from 'ngx-sonner';
data-primary
(click)="
toast('Sonner', {
description: 'An opinionated toast component for Angular.'
description: 'An opinionated toast component for Angular.',
})
"
class="button">
Expand Down
1 change: 0 additions & 1 deletion apps/docs/src/app/components/installation.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {

@Component({
selector: 'docs-installation',
standalone: true,
template: `
<div>
<h2>Installation</h2>
Expand Down
9 changes: 4 additions & 5 deletions apps/docs/src/app/components/other.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ import { TestWithInputsComponent } from './test-with-inputs.component';
import { TestComponent } from './test.component';

@Component({
selector: 'docs-other',
standalone: true,
imports: [CodeBlockComponent],
template: `
selector: 'docs-other',
imports: [CodeBlockComponent],
template: `
<div>
<h2>Other</h2>
<div class="buttons">
Expand All @@ -34,7 +33,7 @@ import { TestComponent } from './test.component';
<docs-code-block [code]="codeSnipped()" />
</div>
`,
changeDetection: ChangeDetectionStrategy.OnPush,
changeDetection: ChangeDetectionStrategy.OnPush
})
export class OtherComponent {
closeButton = model.required<boolean>();
Expand Down
9 changes: 4 additions & 5 deletions apps/docs/src/app/components/position.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@ const positions = [
type Position = (typeof positions)[number];

@Component({
selector: 'docs-position',
standalone: true,
imports: [CodeBlockComponent],
template: `
selector: 'docs-position',
imports: [CodeBlockComponent],
template: `
<div>
<h2>Position</h2>
<p>Swipe direction changes depending on the position.</p>
Expand All @@ -39,7 +38,7 @@ type Position = (typeof positions)[number];
<docs-code-block [code]="positionSnippet()" />
</div>
`,
changeDetection: ChangeDetectionStrategy.OnPush,
changeDetection: ChangeDetectionStrategy.OnPush
})
export class PositionComponent {
protected positions = positions;
Expand Down
1 change: 0 additions & 1 deletion apps/docs/src/app/components/test-with-inputs.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { ChangeDetectionStrategy, Component, input } from '@angular/core';

@Component({
selector: 'docs-test-with-inputs',
standalone: true,
template: `
<div [innerHTML]="message()"></div>
`,
Expand Down
1 change: 0 additions & 1 deletion apps/docs/src/app/components/test.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {

@Component({
selector: 'docs-test',
standalone: true,
template: `
<div class="headless">
<p class="headlessTitle">Event Created</p>
Expand Down
9 changes: 4 additions & 5 deletions apps/docs/src/app/components/types.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ import { CodeBlockComponent } from './code-block.component';
import { CustomComponent } from './custom.component';

@Component({
selector: 'docs-types',
standalone: true,
imports: [CodeBlockComponent],
template: `
selector: 'docs-types',
imports: [CodeBlockComponent],
template: `
<div>
<h2>Types</h2>
<p>
Expand All @@ -28,7 +27,7 @@ import { CustomComponent } from './custom.component';
<docs-code-block [code]="activeType().snippet" />
</div>
`,
changeDetection: ChangeDetectionStrategy.OnPush,
changeDetection: ChangeDetectionStrategy.OnPush
})
export class TypeComponent {
allTypes = [
Expand Down
9 changes: 4 additions & 5 deletions apps/docs/src/app/components/usage.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,16 @@ import { CodeBlockComponent } from './code-block.component';
import { usageSnippet } from './code-snippets';

@Component({
selector: 'docs-usage',
standalone: true,
imports: [CodeBlockComponent],
template: `
selector: 'docs-usage',
imports: [CodeBlockComponent],
template: `
<div>
<h2>Usage</h2>
<p>Render the toaster in the root of your app.</p>
<docs-code-block [code]="usageSnippet" />
</div>
`,
changeDetection: ChangeDetectionStrategy.OnPush,
changeDetection: ChangeDetectionStrategy.OnPush
})
export class UsageComponent {
protected readonly usageSnippet = usageSnippet;
Expand Down
8 changes: 4 additions & 4 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getJestProjects } from '@nx/jest';
import { getJestProjectsAsync } from '@nx/jest';

export default {
projects: getJestProjects(),
};
export default async () => ({
projects: await getJestProjectsAsync(),
});
3 changes: 2 additions & 1 deletion libs/ngx-sonner/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"prefix": "ngx-sonner",
"style": "kebab-case"
}
]
],
"@angular-eslint/prefer-standalone": "off"
}
},
{
Expand Down
3 changes: 1 addition & 2 deletions libs/ngx-sonner/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Based on [emilkowalski](https://github.com/emilkowalski)'s React [implementation

| ngx-sonner | @angular |
|------------|----------|
| 3.0.0 | ≥19.0.0 |
| 2.0.0 | ≥18.0.0 |
| 1.0.0 | ≥17.3.0 |

Expand All @@ -32,7 +33,6 @@ import { toast, NgxSonnerToaster } from 'ngx-sonner';

@Component({
selector: 'app-root',
standalone: true,
imports: [NgxSonnerToaster],
template: `
<ngx-sonner-toaster />
Expand Down Expand Up @@ -206,7 +206,6 @@ You can use `toast.custom()` to render an unstyled toast with a custom component
```ts
@Component({
selector: 'app-custom',
standalone: true,
template: `
<div>
This is a custom component <button (click)="toastClick()">close</button>
Expand Down
4 changes: 2 additions & 2 deletions libs/ngx-sonner/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
},
"license": "MIT",
"peerDependencies": {
"@angular/common": ">=18.0.0",
"@angular/core": ">=18.0.0"
"@angular/common": ">=19.0.0",
"@angular/core": ">=19.0.0"
},
"dependencies": {
"tslib": "^2.3.0"
Expand Down
1 change: 0 additions & 1 deletion libs/ngx-sonner/src/lib/icon.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { ToastTypes } from './types';

@Component({
selector: 'ngx-sonner-icon',
standalone: true,
template: `
@switch (type()) {
@case ('success') {
Expand Down
1 change: 0 additions & 1 deletion libs/ngx-sonner/src/lib/loader.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {

@Component({
selector: 'ngx-sonner-loader',
standalone: true,
template: `
<div class="sonner-loading-wrapper" [attr.data-visible]="isVisible()">
<div class="sonner-spinner">
Expand Down
2 changes: 1 addition & 1 deletion libs/ngx-sonner/src/lib/pipes/as-component.pipe.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Pipe, PipeTransform, Type } from '@angular/core';

@Pipe({ name: 'asComponent', standalone: true })
@Pipe({ name: 'asComponent' })
export class AsComponentPipe implements PipeTransform {
transform(value: unknown): Type<unknown> {
return value as Type<unknown>;
Expand Down
2 changes: 1 addition & 1 deletion libs/ngx-sonner/src/lib/pipes/is-string.pipe.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Pipe, PipeTransform } from '@angular/core';

@Pipe({ name: 'isString', standalone: true })
@Pipe({ name: 'isString' })
export class IsStringPipe implements PipeTransform {
transform(value: unknown): boolean {
return typeof value === 'string';
Expand Down
2 changes: 1 addition & 1 deletion libs/ngx-sonner/src/lib/pipes/toast-filter.pipe.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Pipe, PipeTransform } from '@angular/core';
import { Position, ToastT } from '../types';

@Pipe({ name: 'toastFilter', standalone: true })
@Pipe({ name: 'toastFilter' })
export class ToastFilterPipe implements PipeTransform {
transform(toasts: ToastT[], index: number, position: Position): ToastT[] {
return toasts.filter(
Expand Down
Loading
Loading