Skip to content

Commit

Permalink
feat: migration to Angular 19
Browse files Browse the repository at this point in the history
  • Loading branch information
sroucheray committed Dec 11, 2024
1 parent 4190062 commit 51c933d
Show file tree
Hide file tree
Showing 26 changed files with 4,920 additions and 4,062 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
dist
tmp
/out-tsc
storybook-static

# dependencies
node_modules
Expand Down Expand Up @@ -40,4 +41,5 @@ Thumbs.db

.angular

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

/.nx/cache
/.nx/cache
/.nx/workspace-data
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## [Unreleased]

### BREAKING CHANGES

- **Dependency**: Require Angular 19

## [18.0.0] - 2024-05-30

### BREAKING CHANGES
Expand Down
3 changes: 2 additions & 1 deletion apps/demo/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"prefix": "app",
"style": "kebab-case"
}
]
],
"@angular-eslint/prefer-standalone": "off"
}
},
{
Expand Down
11 changes: 6 additions & 5 deletions apps/demo/src/app-demo/app-demo.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import {
} from '@perfectmemory/ngx-contextmenu';

@Component({
selector: 'app-demo-context-menu',
styles: [
`
selector: 'app-demo-context-menu',
styles: [
`
.dashboardContainer {
width: 100%;
height: 100%;
Expand All @@ -32,8 +32,9 @@ import {
position: absolute;
}
`,
],
templateUrl: './app-demo.component.html',
],
templateUrl: './app-demo.component.html',
standalone: false
})
export class AppDemoComponent {
@Input()
Expand Down
11 changes: 6 additions & 5 deletions apps/demo/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import {
} from '@perfectmemory/ngx-contextmenu';

@Component({
selector: 'demo-context-menu-demo',
styles: [
`
selector: 'demo-context-menu-demo',
styles: [
`
.dashboardContainer {
width: 100%;
height: 100%;
Expand All @@ -32,8 +32,9 @@ import {
position: absolute;
}
`,
],
templateUrl: './app.component.html',
],
templateUrl: './app.component.html',
standalone: false
})
export class AppComponent {
@Input()
Expand Down
9 changes: 7 additions & 2 deletions apps/demo/src/styles.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
@use 'sass:meta';
/* You can add global styles to this file, and also import other style files */

@import '@angular/cdk/overlay-prebuilt.css';
@import '../../../libs/ngx-contextmenu/src/assets/stylesheets/base.scss';
@import '../../../libs/ngx-contextmenu/src/assets/stylesheets/dark-theme.scss';
@include meta.load-css(
'../../../libs/ngx-contextmenu/src/assets/stylesheets/base.scss'
);
@include meta.load-css(
'../../../libs/ngx-contextmenu/src/assets/stylesheets/dark-theme.scss'
);
3 changes: 2 additions & 1 deletion libs/ngx-contextmenu/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"prefix": "context-menu",
"style": "kebab-case"
}
]
],
"@angular-eslint/prefer-standalone": "off"
}
},
{
Expand Down
4 changes: 1 addition & 3 deletions libs/ngx-contextmenu/.storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ const config: StorybookConfig = {
},
],

docs: {
autodocs: false,
},
docs: {},
};

export default config;
6 changes: 3 additions & 3 deletions libs/ngx-contextmenu/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
"url": "git+ssh://[email protected]:PerfectMemory/ngx-contextmenu.git"
},
"peerDependencies": {
"@angular/cdk": "^18.0.0",
"@angular/common": "^18.0.0",
"@angular/core": "^18.0.0"
"@angular/cdk": "^19.0.0",
"@angular/common": "^19.0.0",
"@angular/core": "^19.0.0"
},
"dependencies": {
"tslib": "^2.3.0"
Expand Down
2 changes: 1 addition & 1 deletion libs/ngx-contextmenu/src/assets/stylesheets/base.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import './button-reset.scss';
@use 'button-reset.scss';

:root {
// Styling of the element where a context menu can appear
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import './base.scss';
@use 'base.scss';

.dark-theme {
// Styling of the element where a context menu can appear
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,15 @@ export const TESTING_WRAPPER = {
};

@Component({
selector: 'context-menu-content',
templateUrl: './context-menu-content.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
host: {
tabindex: '0',
role: 'dialog',
class: 'ngx-contextmenu',
},
selector: 'context-menu-content',
templateUrl: './context-menu-content.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
host: {
tabindex: '0',
role: 'dialog',
class: 'ngx-contextmenu',
},
standalone: false
})
export class ContextMenuContentComponent<T>
implements OnDestroy, AfterViewInit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ import {
} from './context-menu.component.interface';

@Component({
encapsulation: ViewEncapsulation.None,
selector: 'context-menu',
template: '',
encapsulation: ViewEncapsulation.None,
selector: 'context-menu',
template: '',
standalone: false
})
export class ContextMenuComponent<T> implements OnInit, OnDestroy {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { ContextMenuContentItemDirective } from './context-menu-content-item.dir

@Component({
template: '<div [contextMenuContentItem]="contextMenuItem"></div>',
standalone: false,
})
class TestHostComponent {
@Input()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ import { evaluateIfFunction } from '../../helper/evaluate';
import { ContextMenuItemDirective } from '../context-menu-item/context-menu-item.directive';

@Directive({
selector: '[contextMenuContentItem]',
exportAs: 'contextMenuContentItem',
host: {
class: 'ngx-context-menu-item',
},
selector: '[contextMenuContentItem]',
exportAs: 'contextMenuContentItem',
host: {
class: 'ngx-context-menu-item',
},
standalone: false
})
export class ContextMenuContentItemDirective<T> implements FocusableOption {
@Input()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { ContextMenuItemDirective } from './context-menu-item.directive';

@Component({
template: '<div contextMenuItem></div>',
standalone: false,
})
class TestHostComponent {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import type { ContextMenuComponent } from '../../components/context-menu/context
import { evaluateIfFunction } from '../../helper/evaluate';

@Directive({
selector: '[contextMenuItem]',
selector: '[contextMenuItem]',
standalone: false
})
export class ContextMenuItemDirective<T> {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { ContextMenuDirective } from './context-menu.directive';

@Component({
template: '<div contextMenu></div>',
standalone: false,
})
class TestHostComponent {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ import type { ContextMenuComponent } from '../../components/context-menu/context
import { ContextMenuOverlaysService } from '../../services/context-menu-overlays/context-menu-overlays.service';

@Directive({
selector: '[contextMenu]',
exportAs: 'ngxContextMenu',
host: {
role: 'button',
'attr.aria-haspopup': 'menu',
},
selector: '[contextMenu]',
exportAs: 'ngxContextMenu',
host: {
role: 'button',
'attr.aria-haspopup': 'menu',
},
standalone: false
})
export class ContextMenuDirective<T> {
/**
Expand Down
1 change: 1 addition & 0 deletions libs/ngx-contextmenu/src/stories/Setup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ yarn add @perfectmemory/ngx-contextmenu @angular/cdk

| Angular | @perfectmemory/ngx-contextmenu | Main purpose |
| --------- | ------------------------------ | ----------------------------------------------------------------------------- |
| `^19.0.0` | `^19.0.0` | Align version with Angular 19 |
| `^18.0.0` | `^18.0.0` | Align version with Angular 18 |
| `^17.0.0` | `^17.0.0` | Align version with Angular 17 |
| `^16.0.0` | `^16.0.0` | Align version with Angular 16 |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ import { ContextMenuDirective } from '../../lib/directives/context-menu/context-
import { ContextMenuService } from '../../lib/services/context-menu/context-menu.service';

@Component({
selector: 'storybook-context-menu',
templateUrl: 'ngx-contextmenu.component.html',
styleUrls: ['./ngx-contextmenu.component.scss'],
selector: 'storybook-context-menu',
templateUrl: 'ngx-contextmenu.component.html',
styleUrls: ['./ngx-contextmenu.component.scss'],
standalone: false
})
export default class StorybookContextMenuComponent {
@Input()
Expand Down
14 changes: 6 additions & 8 deletions libs/ngx-contextmenu/src/test-setup.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// @ts-expect-error https://thymikee.github.io/jest-preset-angular/docs/getting-started/test-environment
globalThis.ngJest = {
testEnvironmentOptions: {
errorOnUnknownElements: true,
errorOnUnknownProperties: true,
},
};
import 'jest-preset-angular/setup-jest';
import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone';

setupZoneTestEnv({
errorOnUnknownElements: true,
errorOnUnknownProperties: true,
});
Loading

0 comments on commit 51c933d

Please sign in to comment.