diff --git a/.gitignore b/.gitignore index 73a3850..780d425 100644 --- a/.gitignore +++ b/.gitignore @@ -5,7 +5,7 @@ /tmp /out-tsc /bazel-out - +/cypress/screenshots # Node /node_modules npm-debug.log diff --git a/.stylelintignore b/.stylelintignore index 5ee26d2..2c98294 100644 --- a/.stylelintignore +++ b/.stylelintignore @@ -3,7 +3,7 @@ /tmp /out-tsc /bazel-out -/src/styles.scss + # Node /node_modules diff --git a/.stylelintrc.json b/.stylelintrc.json index ef12825..b877275 100644 --- a/.stylelintrc.json +++ b/.stylelintrc.json @@ -1,7 +1,7 @@ { "extends": ["stylelint-config-recommended-scss"], "customSyntax": "postcss-scss", - "plugins": ["stylelint-prettier"], + "plugins": ["stylelint-scss", "stylelint-prettier"], "rules": { "no-empty-source": null, "scss/comment-no-empty": null, @@ -12,6 +12,12 @@ { "ignoreTypes": ["/^mat-/", "markdown", ":host", ":root"] } + ], + "scss/at-rule-no-unknown": [ + true, + { + "ignoreAtRules": ["tailwind"] + } ] } } diff --git a/CHANGELOG.md b/CHANGELOG.md index dc5e7a2..5c7d030 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# 19.0.0(2024-11-21) + +### Feature + +- update ng 19.x + # 18.0.4(2024-10-25) ### Feature diff --git a/bun.lockb b/bun.lockb index fd6332c..286128b 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/eslint.config.js b/eslint.config.js index e3de632..028afda 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -38,11 +38,9 @@ module.exports = tseslint.config( extends: [ // Apply the recommended core rules eslint.configs.recommended, - // Apply the recommended TypeScript rules - ...tseslint.configs.recommended, - // Optionally apply stylistic rules from typescript-eslint that improve code consistency - ...tseslint.configs.stylistic, - // Apply the recommended Angular rules + ...tseslint.configs.recommendedTypeChecked, + ...tseslint.configs.strictTypeChecked, + ...tseslint.configs.stylisticTypeChecked, ...angular.configs.tsRecommended, ], // Set the custom processor which will allow us to have our inline Component templates extracted @@ -105,7 +103,6 @@ module.exports = tseslint.config( 'no-unused-private-class-members': 'error', 'no-invalid-regexp': 'error', curly: ['error', 'all'], - '@typescript-eslint/restrict-template-expressions': 'error', '@typescript-eslint/no-explicit-any': 'off', '@typescript-eslint/adjacent-overload-signatures': 'error', 'no-console': ['warn'], @@ -158,6 +155,14 @@ module.exports = tseslint.config( '@typescript-eslint/unbound-method': 'off', 'import/no-cycle': 'off', 'import/extensions': 'off', + '@typescript-eslint/no-unsafe-call': 'off', + '@typescript-eslint/restrict-template-expressions': [ + 'error', + { + allowNullish: true, + allowNumber: true, + }, + ], }, }, { diff --git a/package.json b/package.json index e049d6b..a656c7b 100644 --- a/package.json +++ b/package.json @@ -49,38 +49,39 @@ "url": "https://github.com/JsDaddy/ngx-copypaste.git" }, "dependencies": { - "@angular/animations": "18.2.9", - "@angular/common": "18.2.9", - "@angular/compiler": "18.2.9", - "@angular/core": "18.2.9", - "@angular/forms": "18.2.9", - "@angular/platform-browser": "18.2.9", - "@angular/platform-browser-dynamic": "18.2.9", - "@angular/router": "^18.2.9", + "@angular/animations": "19.0.0", + "@angular/common": "19.0.0", + "@angular/compiler": "19.0.0", + "@angular/core": "19.0.0", + "@angular/forms": "19.0.0", + "@angular/platform-browser": "19.0.0", + "@angular/platform-browser-dynamic": "19.0.0", + "@angular/router": "^19.0.0", "highlight.js": "^11.10.0", "ngx-highlightjs": "^12.0.0", + "ngxtension": "^4.1.0", "rxjs": "7.8.1", - "snyk": "^1.1294.0" + "snyk": "^1.1294.1" }, "devDependencies": { - "@angular-devkit/build-angular": "18.2.10", - "@angular-eslint/builder": "18.4.0", - "@angular-eslint/eslint-plugin": "18.4.0", - "@angular-eslint/eslint-plugin-template": "18.4.0", - "@angular-eslint/schematics": "18.4.0", - "@angular-eslint/template-parser": "18.4.0", - "@angular/cli": "18.2.10", - "@angular/compiler-cli": "18.2.9", - "@angular/language-service": "18.2.9", - "@commitlint/cli": "19.5.0", - "@commitlint/config-conventional": "19.5.0", + "@angular-devkit/build-angular": "19.0.0", + "@angular-eslint/builder": "18.4.1", + "@angular-eslint/eslint-plugin": "18.4.1", + "@angular-eslint/eslint-plugin-template": "18.4.1", + "@angular-eslint/schematics": "18.4.1", + "@angular-eslint/template-parser": "18.4.1", + "@angular/cli": "19.0.0", + "@angular/compiler-cli": "19.0.0", + "@angular/language-service": "19.0.0", + "@commitlint/cli": "19.6.0", + "@commitlint/config-conventional": "19.6.0", "@types/jasmine": "~5.1.4", - "@types/node": "22.7.9", - "@typescript-eslint/eslint-plugin": "^8.11.0", + "@types/node": "22.9.1", + "@typescript-eslint/eslint-plugin": "^8.15.0", "@web/test-runner": "^0.19.0", - "angular-eslint": "^18.4.0", - "cypress": "^13.15.1", - "eslint": "9.13.0", + "angular-eslint": "^18.4.1", + "cypress": "^13.16.0", + "eslint": "9.15.0", "eslint-config-prettier": "9.1.0", "eslint-plugin-import": "2.31.0", "eslint-plugin-json": "4.0.1", @@ -88,22 +89,25 @@ "jasmine-core": "5.4.0", "jasmine-spec-reporter": "7.0.0", "lint-staged": "15.2.10", - "ng-packagr": "18.2.1", - "npm-check-updates": "^17.1.6", - "postcss-scss": "4.0.9", + "ng-packagr": "19.0.0", + "npm-check-updates": "^17.1.11", "prettier": "3.3.3", - "puppeteer": "^23.6.0", - "semantic-release": "24.1.3", + "puppeteer": "^23.9.0", + "semantic-release": "24.2.0", "semantic-release-export-data": "^1.1.0", "stylelint": "16.10.0", "stylelint-config-prettier": "9.0.5", "stylelint-config-recommended-scss": "14.1.0", "stylelint-prettier": "5.0.2", "type-coverage": "^2.29.7", - "typescript": "5.4.5", - "typescript-eslint": "^8.11.0", - "tailwindcss": "^3.4.14", - "bun-types": "^1.1.33" + "typescript": "5.6.3", + "typescript-eslint": "^8.15.0", + "tailwindcss": "^3.4.15", + "bun-types": "^1.1.36", + "postcss": "8.4.49", + "postcss-nesting": "13.0.1", + "cssnano": "7.0.6", + "postcss-scss": "4.0.9" }, "typeCoverage": { "atLeast": 92, diff --git a/postcss.config.js b/postcss.config.js new file mode 100644 index 0000000..1c25a75 --- /dev/null +++ b/postcss.config.js @@ -0,0 +1,8 @@ +module.exports = { + plugins: { + 'postcss-nesting': {}, + tailwindcss: {}, + autoprefixer: {}, + cssnano: { preset: 'default' }, + }, +}; diff --git a/projects/ngx-copypaste-lib/package.json b/projects/ngx-copypaste-lib/package.json index 42c40fa..51fc640 100644 --- a/projects/ngx-copypaste-lib/package.json +++ b/projects/ngx-copypaste-lib/package.json @@ -1,6 +1,6 @@ { "name": "ngx-copypaste", - "version": "18.0.2", + "version": "19.0.0", "license": "MIT", "keywords": [ "ng2-copypaste", diff --git a/projects/ngx-copypaste-lib/src/lib/ngx-copypaste.directive.spec.ts b/projects/ngx-copypaste-lib/src/lib/ngx-copypaste.directive.spec.ts index c282b8f..c7d582c 100644 --- a/projects/ngx-copypaste-lib/src/lib/ngx-copypaste.directive.spec.ts +++ b/projects/ngx-copypaste-lib/src/lib/ngx-copypaste.directive.spec.ts @@ -1,5 +1,5 @@ describe('NgxCopyPasteDirective', () => { it('should create an instance', () => { - expect(1).toEqual(1); + void expect(1).toEqual(1); }); }); diff --git a/projects/ngx-copypaste-lib/src/lib/ngx-copypaste.directive.ts b/projects/ngx-copypaste-lib/src/lib/ngx-copypaste.directive.ts index 227976a..33e1c08 100644 --- a/projects/ngx-copypaste-lib/src/lib/ngx-copypaste.directive.ts +++ b/projects/ngx-copypaste-lib/src/lib/ngx-copypaste.directive.ts @@ -15,28 +15,30 @@ export class NgxCopyPasteDirective { if (select) { select.removeAllRanges(); } - const element: HTMLElement = this._elementRef.nativeElement; + const element = this._elementRef.nativeElement as HTMLElement; if (element instanceof HTMLInputElement || element instanceof HTMLTextAreaElement) { - this._elementRef.nativeElement.select(); + element.select(); } else { const range: Range = document.createRange(); - range.selectNodeContents(this._elementRef.nativeElement); + range.selectNodeContents(element); select = window.getSelection(); if (select) { select.addRange(range); } } this.successCb.emit(); + // eslint-disable-next-line @typescript-eslint/no-deprecated document.execCommand('copy'); } public async copy(): Promise { + this.copyWithSelection(); try { - if (!navigator.clipboard) { + if (typeof navigator.clipboard === 'undefined') { this.copyWithSelection(); return; } - const element: HTMLElement = this._elementRef.nativeElement; + const element = this._elementRef.nativeElement as HTMLElement; const value = element instanceof HTMLInputElement || element instanceof HTMLTextAreaElement ? element.value diff --git a/projects/ngx-copypaste-lib/src/test/copy.cy-spec.ts b/projects/ngx-copypaste-lib/src/test/copy.cy-spec.ts index e20c7ad..b40733d 100644 --- a/projects/ngx-copypaste-lib/src/test/copy.cy-spec.ts +++ b/projects/ngx-copypaste-lib/src/test/copy.cy-spec.ts @@ -1,11 +1,8 @@ -import { CypressTestMaskModule } from './utils/cypress-test.module'; import { CypressTestMaskComponent } from './utils/cypress-test.component'; describe('Test Date Hh:m0', () => { it('should return value from ctrl+V', () => { - cy.mount(CypressTestMaskComponent, { - imports: [CypressTestMaskModule], - }); + cy.mount(CypressTestMaskComponent); cy.get('#masked').type('testing').should('have.value', 'testing'); cy.get('#btn').click(); diff --git a/projects/ngx-copypaste-lib/src/test/utils/cypress-test.component.ts b/projects/ngx-copypaste-lib/src/test/utils/cypress-test.component.ts index f1895c5..cffe6af 100644 --- a/projects/ngx-copypaste-lib/src/test/utils/cypress-test.component.ts +++ b/projects/ngx-copypaste-lib/src/test/utils/cypress-test.component.ts @@ -1,8 +1,11 @@ import { Component } from '@angular/core'; -import { FormControl } from '@angular/forms'; +import { FormControl, ReactiveFormsModule } from '@angular/forms'; +import { NgxCopyPasteDirective } from 'ngx-copypaste'; @Component({ selector: 'jsdaddy-open-source-test', + standalone: true, + imports: [ReactiveFormsModule, NgxCopyPasteDirective], template: ` diff --git a/projects/ngx-copypaste-lib/src/test/utils/cypress-test.module.ts b/projects/ngx-copypaste-lib/src/test/utils/cypress-test.module.ts deleted file mode 100644 index 0e7b052..0000000 --- a/projects/ngx-copypaste-lib/src/test/utils/cypress-test.module.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { NgModule } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormsModule, ReactiveFormsModule } from '@angular/forms'; -import { NgxCopyPasteDirective } from 'ngx-copypaste'; -import { CypressTestMaskComponent } from './cypress-test.component'; - -@NgModule({ - imports: [CommonModule, ReactiveFormsModule, FormsModule, NgxCopyPasteDirective], - declarations: [CypressTestMaskComponent], - exports: [CypressTestMaskComponent], -}) -export class CypressTestMaskModule {} diff --git a/src/app/app.component.spec.ts b/src/app/app.component.spec.ts index 7787414..8e59092 100644 --- a/src/app/app.component.spec.ts +++ b/src/app/app.component.spec.ts @@ -1,5 +1,5 @@ describe('AppComponent', () => { it('First test', () => { - expect(1).toEqual(1); + void expect(1).toEqual(1); }); }); diff --git a/src/app/cards/cards.component.ts b/src/app/cards/cards.component.ts index 8745453..79adb42 100644 --- a/src/app/cards/cards.component.ts +++ b/src/app/cards/cards.component.ts @@ -3,7 +3,6 @@ import { NgOptimizedImage } from '@angular/common'; import { NgxCopyPasteDirective } from 'ngx-copypaste'; import { HighlightModule } from 'ngx-highlightjs'; import { AssetPipe } from '@libraries/asset/asset.pipe'; -import { ColorPipe } from '@open-source/color/color.pipe'; import { CardItem } from './cards.type'; import { CopiedComponent } from '../shared/copied/copied.component'; import { CardType } from './cards.enum'; @@ -14,14 +13,7 @@ import { toSignal } from '@angular/core/rxjs-interop'; @Component({ selector: 'jsdaddy-open-source-cards', standalone: true, - imports: [ - NgOptimizedImage, - NgxCopyPasteDirective, - HighlightModule, - AssetPipe, - ColorPipe, - CopiedComponent, - ], + imports: [NgOptimizedImage, NgxCopyPasteDirective, HighlightModule, AssetPipe, CopiedComponent], providers: [ScrollService], templateUrl: './cards.component.html', styleUrls: ['./cards.component.scss'], diff --git a/src/libraries b/src/libraries index 99c3b7a..44bebdf 160000 --- a/src/libraries +++ b/src/libraries @@ -1 +1 @@ -Subproject commit 99c3b7a084bc77dcdc22be4485024aaa24f280cc +Subproject commit 44bebdfba90c6534af67bf84d5f90f8f1b0b343b diff --git a/src/main.ts b/src/main.ts index 578a599..cb747c5 100644 --- a/src/main.ts +++ b/src/main.ts @@ -28,5 +28,7 @@ bootstrapApplication(AppComponent, { }, }, ], +}).catch((err: unknown) => { // eslint-disable-next-line no-console -}).catch((err) => console.error(err)); + console.error(err); +}); diff --git a/src/styles.scss b/src/styles.scss index b5c61c9..a065c93 100644 --- a/src/styles.scss +++ b/src/styles.scss @@ -1,3 +1,5 @@ +@use './libraries/styles/scroll-bar'; + @tailwind base; @tailwind components; @tailwind utilities; diff --git a/tsconfig.json b/tsconfig.json index 77b20c2..f18af41 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -26,14 +26,16 @@ "removeComments": true, "resolveJsonModule": true, "paths": { - "ngx-copypaste": ["./projects/ngx-copypaste-lib/src/public-api"], + "@libraries/*": ["./src/libraries/*"], "@open-source/*": ["./src/libraries/open-source/*"], - "@libraries/*": ["./src/libraries/*"] + "ngx-copypaste": ["./projects/ngx-copypaste-lib/src/public-api"] }, "skipLibCheck": true, - "noImplicitAny": true + "noImplicitAny": true, + "isolatedModules": true }, "angularCompilerOptions": { + "strictStandalone": true, "enableI18nLegacyMessageIdFormat": false, "strictInjectionParameters": true, "strictInputAccessModifiers": true, @@ -43,7 +45,8 @@ "extendedDiagnostics": { "checks": { "invalidBananaInBox": "error", - "nullishCoalescingNotNullable": "warning" + "nullishCoalescingNotNullable": "warning", + "unusedStandaloneImports": "suppress" }, "defaultCategory": "suppress" }