From efba9e637d802cef05cf299301125743bbc8d72c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=A1=E8=89=B2?= Date: Thu, 9 Nov 2023 11:50:01 +0800 Subject: [PATCH] build: bump angular to 17 (#126) --- .github/workflows/ci.yml | 21 ++-- .gitignore | 27 ++--- .nvmrc | 2 +- README.md | 14 ++- angular.json | 35 ++---- karma.conf.js | 101 +++++++++--------- lib/ng-package.json | 2 +- lib/package.json | 2 +- lib/spec/component.spec.ts | 25 +++++ lib/src/countdown.component.ts | 9 +- lib/src/countdown.config.ts | 3 +- lib/src/index.ts | 2 +- lib/src/{public_api.ts => public-api.ts} | 0 lib/test.ts | 4 - lib/tsconfig.lib.json | 4 +- package.json | 64 ++++++----- src/app/app.component.ts | 7 +- src/app/app.module.ts | 88 --------------- src/app/components/accuracy.component.ts | 4 + src/app/components/actions.component.ts | 5 +- src/app/components/alot.component.html | 5 - src/app/components/alot.component.ts | 11 +- src/app/components/basic.component.ts | 4 + .../custom-format-date.component.ts | 5 +- src/app/components/custom-format.component.ts | 4 + src/app/components/date-fns.component.ts | 5 +- src/app/components/demand.component.ts | 4 + src/app/components/demo.component.ts | 29 +++++ .../keeping-when-refresh.component.ts | 5 +- src/app/components/layout.component.ts | 9 +- .../more-than-24-hours.component.ts | 20 +++- src/app/components/nothing.component.html | 4 - src/app/components/nothing.component.ts | 3 +- src/app/components/notify.component.ts | 5 +- src/app/components/only-seconds.component.ts | 5 +- src/app/components/pretty-text.component.ts | 5 +- src/app/components/test.component.ts | 7 +- src/app/components/timestamp.component.ts | 5 +- src/app/components/view-code.component.ts | 1 + src/app/router.ts | 22 ++++ src/app/standalone.component.ts | 10 -- src/assets/fork.png | Bin 7791 -> 0 bytes src/environments/environment.prod.ts | 3 - src/environments/environment.ts | 8 -- src/index.html | 7 +- src/main.ts | 24 +++-- tsconfig.app.json | 8 +- tsconfig.json | 5 +- tsconfig.spec.json | 9 +- 49 files changed, 347 insertions(+), 304 deletions(-) rename lib/src/{public_api.ts => public-api.ts} (100%) delete mode 100644 lib/test.ts delete mode 100644 src/app/app.module.ts delete mode 100644 src/app/components/alot.component.html delete mode 100644 src/app/components/nothing.component.html create mode 100644 src/app/router.ts delete mode 100644 src/app/standalone.component.ts delete mode 100644 src/assets/fork.png delete mode 100644 src/environments/environment.prod.ts delete mode 100644 src/environments/environment.ts diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1f95b0b..58b8bda 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,11 +28,16 @@ jobs: cmd: install - name: run - run: | - yarn run test - cat ./coverage/lcov.info | ./node_modules/.bin/codecov - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + run: yarn run test + + - uses: codecov/codecov-action@v3 + name: upload + with: + token: ${{ secrets.CODECOV_TOKEN }} + flags: unittests + files: ./coverage/cobertura-coverage.xml + fail_ci_if_error: true + verbose: true lint: runs-on: ubuntu-latest @@ -61,11 +66,11 @@ jobs: - name: build run: | node --max_old_space_size=5120 ./node_modules/@angular/cli/bin/ng build --base-href /ngx-countdown/ - cp ./dist/index.html ./dist/404.html - ls ./dist + cp ./dist/browser/index.html ./dist/browser/404.html + ls ./dist/browser - name: deploy-to-gh-pages uses: peaceiris/actions-gh-pages@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./dist + publish_dir: ./dist/browser diff --git a/.gitignore b/.gitignore index 7a9d8f0..1f94fbe 100644 --- a/.gitignore +++ b/.gitignore @@ -1,18 +1,18 @@ # See http://help.github.com/ignore-files/ for more about ignoring files. -# compiled output +# Compiled output /dist /tmp /out-tsc -/publish -/yarn.lock -/.angular/cache +/bazel-out -# dependencies +# Node /node_modules +npm-debug.log +yarn-error.log # IDEs and editors -/.idea +.idea/ .project .classpath .c9/ @@ -20,23 +20,26 @@ .settings/ *.sublime-workspace -# IDE - VSCode +# Visual Studio Code .vscode/* !.vscode/settings.json !.vscode/tasks.json !.vscode/launch.json !.vscode/extensions.json +.history/* -# misc -/.sass-cache +# Miscellaneous +/.angular/cache +.sass-cache/ /connect.lock /coverage /libpeerconnection.log -npm-debug.log -yarn-error.log testem.log /typings -# System Files +# System files .DS_Store Thumbs.db + +/publish +/yarn.lock diff --git a/.nvmrc b/.nvmrc index 6b17d22..3e558c9 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -14.16.1 +18.12.0 diff --git a/README.md b/README.md index e8e5d47..c23e341 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ Simple, easy and performance countdown for angular [![NPM version](https://img.shields.io/npm/v/ngx-countdown.svg)](https://www.npmjs.com/package/ngx-countdown) [![Ci](https://github.com/cipchk/ngx-countdown/workflows/Ci/badge.svg)](https://github.com/cipchk/ngx-countdown/actions?query=workflow%3ACi) +[![codecov](https://codecov.io/github/cipchk/ngx-countdown/graph/badge.svg?token=SPQeYvppgH)](https://codecov.io/github/cipchk/ngx-countdown) ## Demo @@ -34,7 +35,7 @@ export class AppModule { } ### 2、Template ```html - + ``` **Method** @@ -54,6 +55,17 @@ export class AppModule { } this.countdown.begin(); ``` +### Standalone + +```ts +@Component({ + template: ``, + standalone: true, + imports: [CountdownComponent], +}) +export class App +``` + ## API ### countdown diff --git a/angular.json b/angular.json index 2168837..e9f97b3 100644 --- a/angular.json +++ b/angular.json @@ -14,15 +14,15 @@ } }, "root": "", - "sourceRoot": "src", + "sourceRoot": "", "prefix": "app", "architect": { "build": { - "builder": "@angular-devkit/build-angular:browser", + "builder": "@angular-devkit/build-angular:application", "options": { "outputPath": "dist", "index": "src/index.html", - "main": "src/main.ts", + "browser": "src/main.ts", "polyfills": [ "zone.js" ], @@ -49,21 +49,12 @@ "maximumError": "4kb" } ], - "fileReplacements": [ - { - "replace": "src/environments/environment.ts", - "with": "src/environments/environment.prod.ts" - } - ], "outputHashing": "all" }, "development": { - "buildOptimizer": false, "optimization": false, - "vendorChunk": true, "extractLicenses": false, - "sourceMap": true, - "namedChunks": true + "sourceMap": true } }, "defaultConfiguration": "production" @@ -72,10 +63,10 @@ "builder": "@angular-devkit/build-angular:dev-server", "configurations": { "production": { - "browserTarget": "ngx-countdown:build:production" + "buildTarget": "ngx-countdown:build:production" }, "development": { - "browserTarget": "ngx-countdown:build:development" + "buildTarget": "ngx-countdown:build:development" } }, "defaultConfiguration": "development" @@ -83,16 +74,14 @@ "test": { "builder": "@angular-devkit/build-angular:karma", "options": { - "main": "lib/test.ts", - "tsConfig": "tsconfig.spec.json", - "karmaConfig": "karma.conf.js", + "karmaConfig": "./karma.conf.js", "polyfills": [ "zone.js", "zone.js/testing" ], + "tsConfig": "tsconfig.spec.json", "include": [ - "../lib/test.ts", - "../lib/**/*.spec.ts" + "lib/**/*.spec.ts" ] } }, @@ -109,11 +98,5 @@ } } } - }, - "defaultProject": "ngx-countdown", - "cli": { - "schematicCollections": [ - "@angular-eslint/schematics" - ] } } diff --git a/karma.conf.js b/karma.conf.js index 5ccad91..91ca45a 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -1,50 +1,51 @@ -// Karma configuration file, see link for more information -// https://karma-runner.github.io/1.0/config/configuration-file.html - -module.exports = function (config) { - config.set({ - basePath: '', - frameworks: ['jasmine', '@angular-devkit/build-angular'], - plugins: [ - require('karma-jasmine'), - require('karma-chrome-launcher'), - require('karma-jasmine-html-reporter'), - require('karma-coverage'), - require('@angular-devkit/build-angular/plugins/karma') - ], - client: { - jasmine: { - // you can add configuration options for Jasmine here - // the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html - // for example, you can disable the random execution with `random: false` - // or set a specific seed with `seed: 4321` - }, - clearContext: false // leave Jasmine Spec Runner output visible in browser - }, - jasmineHtmlReporter: { - suppressAll: true // removes the duplicated traces - }, - coverageReporter: { - dir: require('path').join(__dirname, './coverage'), - subdir: '.', - reporters: [ - { type: 'html' }, - { type: 'text-summary' } - ] - }, - reporters: ['progress', 'kjhtml'], - port: 9876, - colors: true, - logLevel: config.LOG_INFO, - autoWatch: true, - browsers: ['Chrome'], - singleRun: false, - restartOnFileChange: true, - customLaunchers: { - ChromeHeadlessCI: { - base: 'ChromeHeadless', - flags: ['--no-sandbox'], - }, - } - }); -}; +// Karma configuration file, see link for more information +// https://karma-runner.github.io/1.0/config/configuration-file.html + +module.exports = function (config) { + config.set({ + basePath: '', + frameworks: ['jasmine', '@angular-devkit/build-angular'], + plugins: [ + require('karma-jasmine'), + require('karma-chrome-launcher'), + require('karma-jasmine-html-reporter'), + require('karma-coverage'), + require('@angular-devkit/build-angular/plugins/karma') + ], + client: { + jasmine: { + // you can add configuration options for Jasmine here + // the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html + // for example, you can disable the random execution with `random: false` + // or set a specific seed with `seed: 4321` + }, + clearContext: false // leave Jasmine Spec Runner output visible in browser + }, + jasmineHtmlReporter: { + suppressAll: true // removes the duplicated traces + }, + coverageReporter: { + dir: require('path').join(__dirname, './coverage'), + subdir: '.', + reporters: [ + { type: 'html' }, + { type: 'text-summary' }, + { type: 'cobertura' }, + ] + }, + reporters: ['progress', 'kjhtml'], + port: 9876, + colors: true, + logLevel: config.LOG_INFO, + autoWatch: true, + browsers: ['Chrome'], + singleRun: false, + restartOnFileChange: true, + customLaunchers: { + ChromeHeadlessCI: { + base: 'ChromeHeadless', + flags: ['--no-sandbox'], + }, + } + }); +}; diff --git a/lib/ng-package.json b/lib/ng-package.json index d8154f1..7e477c9 100644 --- a/lib/ng-package.json +++ b/lib/ng-package.json @@ -3,6 +3,6 @@ "dest": "../publish", "deleteDestPath": true, "lib": { - "entryFile": "src/public_api.ts" + "entryFile": "src/public-api.ts" } } diff --git a/lib/package.json b/lib/package.json index 36b822c..f9c84e1 100644 --- a/lib/package.json +++ b/lib/package.json @@ -1,6 +1,6 @@ { "name": "ngx-countdown", - "version": "16.0.0", + "version": "17.0.0", "description": "Simple, easy and performance countdown for angular", "keywords": [ "ngx-countdown", diff --git a/lib/spec/component.spec.ts b/lib/spec/component.spec.ts index 65def45..673f179 100644 --- a/lib/spec/component.spec.ts +++ b/lib/spec/component.spec.ts @@ -77,6 +77,31 @@ describe('Component: ngx-countdown', () => { expect(context.comp.i.text).toBe(`0`); tick(2000); })); + it('Support fractional seconds', fakeAsync(() => { + context.config = { leftTime: 2, format: 'S' }; + fixture.detectChanges(); + tick(250); + fixture.detectChanges(); + expect(context.comp.i.value).toBeGreaterThan(1001); + tick(2000); + })); + it('Pretty text', fakeAsync(() => { + context.config = { leftTime: 2, prettyText: jasmine.createSpy() }; + fixture.detectChanges(); + tick(250); + fixture.detectChanges(); + expect(context.config.prettyText).toHaveBeenCalled(); + tick(2000); + })); + describe('#stopTime', () => { + it('should be working', fakeAsync(() => { + context.config = { stopTime: new Date().getTime() + 1000 * 2 }; + fixture.detectChanges(); + tick(1001); + expect(context.comp.left).toBe(1000); + tick(3000); + })); + }); }); describe('[actions]', () => { diff --git a/lib/src/countdown.component.ts b/lib/src/countdown.component.ts index b5fa0fb..55266e4 100644 --- a/lib/src/countdown.component.ts +++ b/lib/src/countdown.component.ts @@ -20,7 +20,7 @@ import { import { CountdownConfig, CountdownStatus, CountdownEvent, CountdownEventAction, CountdownItem } from './interfaces'; import { CountdownTimer } from './countdown.timer'; import { CountdownGlobalConfig } from './countdown.config'; -import { CommonModule } from '@angular/common'; +import { NgIf, NgTemplateOutlet } from '@angular/common'; @Component({ selector: 'countdown', @@ -28,12 +28,12 @@ import { CommonModule } from '@angular/common'; - + `, host: { '[class.count-down]': 'true' }, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, - imports: [CommonModule], + imports: [NgIf, NgTemplateOutlet], providers: [CountdownTimer], standalone: true, }) @@ -56,7 +56,7 @@ export class CountdownComponent implements OnInit, OnChanges, OnDestroy { get config(): CountdownConfig { return this._config; } - @Input() render!: TemplateRef<{ $implicit: CountdownItem }>; + @Input() render?: TemplateRef<{ $implicit: CountdownItem }>; @Output() readonly event = new EventEmitter(); constructor( @@ -131,7 +131,6 @@ export class CountdownComponent implements OnInit, OnChanges, OnDestroy { ...defCog, ...this.config, }); - // tslint:disable-next-line: no-bitwise const frq = (this.frequency = ~config.format!.indexOf('S') ? 100 : 1000); this.status = config.demand ? CountdownStatus.pause : CountdownStatus.ing; diff --git a/lib/src/countdown.config.ts b/lib/src/countdown.config.ts index d8af3b0..80d6d98 100644 --- a/lib/src/countdown.config.ts +++ b/lib/src/countdown.config.ts @@ -1,4 +1,3 @@ -// tslint:disable: no-inferrable-types import { Injectable, Inject, LOCALE_ID } from '@angular/core'; import { formatDate } from '@angular/common'; import { CountdownFormatFn, CountdownConfig } from './interfaces'; @@ -17,5 +16,5 @@ export class CountdownGlobalConfig implements CountdownConfig { formatDate?: CountdownFormatFn = ({ date, formatStr, timezone }) => { return formatDate(new Date(date), formatStr, this.locale, timezone || this.timezone || '+0000'); - } + }; } diff --git a/lib/src/index.ts b/lib/src/index.ts index 4aaf8f9..7e1a213 100644 --- a/lib/src/index.ts +++ b/lib/src/index.ts @@ -1 +1 @@ -export * from './public_api'; +export * from './public-api'; diff --git a/lib/src/public_api.ts b/lib/src/public-api.ts similarity index 100% rename from lib/src/public_api.ts rename to lib/src/public-api.ts diff --git a/lib/test.ts b/lib/test.ts deleted file mode 100644 index 089ddda..0000000 --- a/lib/test.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { getTestBed } from '@angular/core/testing'; -import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing'; - -getTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting()); diff --git a/lib/tsconfig.lib.json b/lib/tsconfig.lib.json index 72c465b..e09fca8 100644 --- a/lib/tsconfig.lib.json +++ b/lib/tsconfig.lib.json @@ -6,14 +6,14 @@ "inlineSources": true, "declaration": true, "strictFunctionTypes": true, - "stripInternal": true + "stripInternal": true, + "declarationMap": false }, "files": ["./src/countdown.module.ts"], "include": [ "**/*.ts" ], "angularCompilerOptions": { - "enableIvy": true, "compilationMode": "partial" } } diff --git a/package.json b/package.json index ce0892d..118b2fd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ngx-countdown", - "version": "16.0.0", + "version": "17.0.0", "description": "Simple, easy and performance countdown for angular", "keywords": [ "ngx-countdown", @@ -22,50 +22,48 @@ }, "homepage": "https://cipchk.github.io/ngx-countdown/", "scripts": { - "analyze": "ng b --stats-json --source-map", "lint": "ng lint", - "test": "ng t --no-progress --browsers=ChromeHeadlessCI --code-coverage --no-watch", + "test": "ng t --no-progress --code-coverage --no-watch --browsers=ChromeHeadless", "build": "node scripts/build.js", - "release:next": "npm run build && cd publish && npm publish --access public --tag next", - "release": "npm run build && cd publish && npm publish --access public" + "release": "npm run build && cd publish && npm publish --access public", + "release:next": "npm run build && cd publish && npm publish --access public --tag next" }, "dependencies": { - "@angular/animations": "^16.0.0", - "@angular/common": "^16.0.0", - "@angular/compiler": "^16.0.0", - "@angular/core": "^16.0.0", - "@angular/forms": "^16.0.0", - "@angular/platform-browser": "^16.0.0", - "@angular/platform-browser-dynamic": "^16.0.0", - "@angular/router": "^16.0.0", + "@angular/animations": "^17.0.0", + "@angular/common": "^17.0.0", + "@angular/compiler": "^17.0.0", + "@angular/core": "^17.0.0", + "@angular/forms": "^17.0.0", + "@angular/platform-browser": "^17.0.0", + "@angular/platform-browser-dynamic": "^17.0.0", + "@angular/router": "^17.0.0", "rxjs": "~7.8.0", "tslib": "^2.3.0", - "zone.js": "~0.13.0", - "bootstrap": "^5.3.0", - "ngx-highlight-js": "^16.0.0", + "zone.js": "~0.14.2", + "bootstrap": "^5.3.2", + "ngx-highlight-js": "^17.0.0", "date-fns": "^2.30.0" }, "devDependencies": { - "@angular-devkit/build-angular": "^16.0.3", - "@angular/cli": "~16.0.3", - "@angular/compiler-cli": "^16.0.0", - "@types/jasmine": "~4.3.0", - "jasmine-core": "~4.6.0", + "@angular-devkit/build-angular": "^17.0.0", + "@angular/cli": "^17.0.0", + "@angular/compiler-cli": "^17.0.0", + "@types/jasmine": "~5.1.0", + "jasmine-core": "~5.1.0", "karma": "~6.4.0", "karma-chrome-launcher": "~3.2.0", "karma-coverage": "~2.2.0", "karma-jasmine": "~5.1.0", - "karma-jasmine-html-reporter": "~2.0.0", - "typescript": "~5.0.2", - "@angular-eslint/builder": "^16.0.3", - "@angular-eslint/eslint-plugin": "^16.0.3", - "@angular-eslint/eslint-plugin-template": "^16.0.3", - "@angular-eslint/schematics": "^16.0.3", - "@angular-eslint/template-parser": "^16.0.3", - "@typescript-eslint/eslint-plugin": "^5.59.8", - "@typescript-eslint/parser": "^5.59.8", - "codecov": "^3.8.3", - "eslint": "^8.42.0", - "ng-packagr": "^16.0.1" + "karma-jasmine-html-reporter": "~2.1.0", + "typescript": "~5.2.2", + "@angular-eslint/builder": "^17.0.0", + "@angular-eslint/eslint-plugin": "^17.0.0", + "@angular-eslint/eslint-plugin-template": "^17.0.0", + "@angular-eslint/schematics": "^17.0.0", + "@angular-eslint/template-parser": "^17.0.0", + "@typescript-eslint/eslint-plugin": "^6.10.0", + "@typescript-eslint/parser": "^6.10.0", + "eslint": "^8.53.0", + "ng-packagr": "^17.0.0" } } diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 1b647c4..324d083 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -1,9 +1,10 @@ import { Component } from '@angular/core'; +import { RouterOutlet } from '@angular/router'; @Component({ selector: 'app-root', - template: ` - - `, + template: ``, + standalone: true, + imports: [RouterOutlet], }) export class AppComponent {} diff --git a/src/app/app.module.ts b/src/app/app.module.ts deleted file mode 100644 index f20927f..0000000 --- a/src/app/app.module.ts +++ /dev/null @@ -1,88 +0,0 @@ -import { TestComponent } from './components/test.component'; -import { NgModule } from '@angular/core'; -import { FormsModule } from '@angular/forms'; -import { RouterModule } from '@angular/router'; -import { BrowserModule } from '@angular/platform-browser'; -import { CommonModule } from '@angular/common'; -import { HighlightJsModule } from 'ngx-highlight-js'; - -import { CountdownModule, CountdownGlobalConfig, CountdownConfig } from 'ngx-countdown'; - -import { AppComponent } from './app.component'; -import { LayoutComponent } from './components/layout.component'; -import { DemoComponent } from './components/demo.component'; -import { ALotComponent } from './components/alot.component'; -import { NothingComponent } from './components/nothing.component'; -import { OnlySecondsComponent } from './components/only-seconds.component'; -import { ViewCodeComponent } from './components/view-code.component'; -import { MoreThan24HoursComponent } from './components/more-than-24-hours.component'; -import { DatefnsComponent } from './components/date-fns.component'; -import { PrettyTextComponent } from './components/pretty-text.component'; -import { ActionsComponent } from './components/actions.component'; -import { DemandComponent } from './components/demand.component'; -import { CustomFormatDateComponent } from './components/custom-format-date.component'; -import { TimestampComponent } from './components/timestamp.component'; -import { NotifyComponent } from './components/notify.component'; -import { AccuracyComponent } from './components/accuracy.component'; -import { CustomFormatComponent } from './components/custom-format.component'; -import { BasicComponent } from './components/basic.component'; -import { KeepingWhenRefreshComponent } from './components/keeping-when-refresh.component'; -import { StandaloneComponent } from './standalone.component'; - -export function countdownConfigFactory(): CountdownConfig { - return {}; -} - -@NgModule({ - imports: [ - BrowserModule, - FormsModule, - CommonModule, - HighlightJsModule, - RouterModule.forRoot( - [ - { - path: '', - component: LayoutComponent, - children: [ - { path: '', component: DemoComponent }, - { path: 'alot', component: ALotComponent }, - { path: 'nothing', component: NothingComponent }, - { path: 'standalone', component: StandaloneComponent }, - ], - }, - { - path: 'test', - component: TestComponent, - }, - ], - { useHash: true }, - ), - CountdownModule, - ], - declarations: [ - AppComponent, - LayoutComponent, - DemoComponent, - ALotComponent, - NothingComponent, - TestComponent, - ViewCodeComponent, - BasicComponent, - CustomFormatComponent, - AccuracyComponent, - NotifyComponent, - TimestampComponent, - CustomFormatDateComponent, - DemandComponent, - ActionsComponent, - PrettyTextComponent, - DatefnsComponent, - MoreThan24HoursComponent, - OnlySecondsComponent, - KeepingWhenRefreshComponent, - ], - providers: [{ provide: CountdownGlobalConfig, useFactory: countdownConfigFactory }], - bootstrap: [AppComponent], -}) -export class AppDemoModule {} diff --git a/src/app/components/accuracy.component.ts b/src/app/components/accuracy.component.ts index 8de3f1e..4fdc85f 100644 --- a/src/app/components/accuracy.component.ts +++ b/src/app/components/accuracy.component.ts @@ -1,4 +1,6 @@ import { ChangeDetectionStrategy, Component } from '@angular/core'; +import { CountdownComponent } from 'ngx-countdown'; +import { ViewCodeComponent } from './view-code.component'; @Component({ selector: 'demo-accuracy', @@ -16,5 +18,7 @@ import { ChangeDetectionStrategy, Component } from '@angular/core'; '[class.text-center]': `true`, }, changeDetection: ChangeDetectionStrategy.OnPush, + standalone: true, + imports: [CountdownComponent, ViewCodeComponent], }) export class AccuracyComponent {} diff --git a/src/app/components/actions.component.ts b/src/app/components/actions.component.ts index 4b36d2f..b0d8e23 100644 --- a/src/app/components/actions.component.ts +++ b/src/app/components/actions.component.ts @@ -1,5 +1,6 @@ import { ChangeDetectionStrategy, Component } from '@angular/core'; -import { CountdownConfig, CountdownEvent } from 'ngx-countdown'; +import { CountdownComponent, CountdownConfig, CountdownEvent } from 'ngx-countdown'; +import { ViewCodeComponent } from './view-code.component'; @Component({ selector: 'demo-actions', @@ -24,6 +25,8 @@ import { CountdownConfig, CountdownEvent } from 'ngx-countdown'; '[class.text-center]': `true`, }, changeDetection: ChangeDetectionStrategy.OnPush, + standalone: true, + imports: [CountdownComponent, ViewCodeComponent], }) export class ActionsComponent { config: CountdownConfig = { diff --git a/src/app/components/alot.component.html b/src/app/components/alot.component.html deleted file mode 100644 index 1ad6990..0000000 --- a/src/app/components/alot.component.html +++ /dev/null @@ -1,5 +0,0 @@ -
-
- -
-
diff --git a/src/app/components/alot.component.ts b/src/app/components/alot.component.ts index c0e72a7..202b77e 100644 --- a/src/app/components/alot.component.ts +++ b/src/app/components/alot.component.ts @@ -1,8 +1,17 @@ +import { NgFor } from '@angular/common'; import { Component } from '@angular/core'; +import { CountdownComponent } from 'ngx-countdown'; +import { ViewCodeComponent } from './view-code.component'; @Component({ selector: 'demo-alot', - templateUrl: './alot.component.html', + template: `
+
+ +
+
`, + standalone: true, + imports: [NgFor, CountdownComponent, ViewCodeComponent], }) export class ALotComponent { arr = new Array(1000).fill({}); diff --git a/src/app/components/basic.component.ts b/src/app/components/basic.component.ts index 49c0653..6aef3a4 100644 --- a/src/app/components/basic.component.ts +++ b/src/app/components/basic.component.ts @@ -1,4 +1,6 @@ import { ChangeDetectionStrategy, Component } from '@angular/core'; +import { CountdownComponent } from 'ngx-countdown'; +import { ViewCodeComponent } from './view-code.component'; @Component({ selector: 'demo-basic', @@ -16,5 +18,7 @@ import { ChangeDetectionStrategy, Component } from '@angular/core'; '[class.text-center]': `true`, }, changeDetection: ChangeDetectionStrategy.OnPush, + standalone: true, + imports: [CountdownComponent, ViewCodeComponent], }) export class BasicComponent {} diff --git a/src/app/components/custom-format-date.component.ts b/src/app/components/custom-format-date.component.ts index 8bc12cb..8551600 100644 --- a/src/app/components/custom-format-date.component.ts +++ b/src/app/components/custom-format-date.component.ts @@ -1,6 +1,7 @@ import { ChangeDetectionStrategy, Component, Inject, LOCALE_ID } from '@angular/core'; -import { CountdownConfig } from 'ngx-countdown'; +import { CountdownComponent, CountdownConfig } from 'ngx-countdown'; import { formatDate } from '@angular/common'; +import { ViewCodeComponent } from './view-code.component'; const MINIUES = 1000 * 60; @@ -20,6 +21,8 @@ const MINIUES = 1000 * 60; '[class.text-center]': `true`, }, changeDetection: ChangeDetectionStrategy.OnPush, + standalone: true, + imports: [CountdownComponent, ViewCodeComponent], }) export class CustomFormatDateComponent { constructor(@Inject(LOCALE_ID) private locale: string) {} diff --git a/src/app/components/custom-format.component.ts b/src/app/components/custom-format.component.ts index 100f587..cc13391 100644 --- a/src/app/components/custom-format.component.ts +++ b/src/app/components/custom-format.component.ts @@ -1,4 +1,6 @@ import { ChangeDetectionStrategy, Component } from '@angular/core'; +import { CountdownComponent } from 'ngx-countdown'; +import { ViewCodeComponent } from './view-code.component'; @Component({ selector: 'demo-custom-format', @@ -16,5 +18,7 @@ import { ChangeDetectionStrategy, Component } from '@angular/core'; '[class.text-center]': `true`, }, changeDetection: ChangeDetectionStrategy.OnPush, + standalone: true, + imports: [CountdownComponent, ViewCodeComponent], }) export class CustomFormatComponent {} diff --git a/src/app/components/date-fns.component.ts b/src/app/components/date-fns.component.ts index b871282..60b7230 100644 --- a/src/app/components/date-fns.component.ts +++ b/src/app/components/date-fns.component.ts @@ -1,6 +1,7 @@ import { ChangeDetectionStrategy, Component } from '@angular/core'; -import { CountdownConfig } from 'ngx-countdown'; +import { CountdownComponent, CountdownConfig } from 'ngx-countdown'; import { format } from 'date-fns'; +import { ViewCodeComponent } from './view-code.component'; @Component({ selector: 'demo-date-fns', @@ -18,6 +19,8 @@ import { format } from 'date-fns'; '[class.text-center]': `true`, }, changeDetection: ChangeDetectionStrategy.OnPush, + standalone: true, + imports: [CountdownComponent, ViewCodeComponent], }) export class DatefnsComponent { config: CountdownConfig = { diff --git a/src/app/components/demand.component.ts b/src/app/components/demand.component.ts index 5fd5344..3a9952d 100644 --- a/src/app/components/demand.component.ts +++ b/src/app/components/demand.component.ts @@ -1,4 +1,6 @@ import { ChangeDetectionStrategy, Component } from '@angular/core'; +import { CountdownComponent } from 'ngx-countdown'; +import { ViewCodeComponent } from './view-code.component'; @Component({ selector: 'demo-demand', @@ -19,5 +21,7 @@ import { ChangeDetectionStrategy, Component } from '@angular/core'; '[class.text-center]': `true`, }, changeDetection: ChangeDetectionStrategy.OnPush, + standalone: true, + imports: [CountdownComponent, ViewCodeComponent], }) export class DemandComponent {} diff --git a/src/app/components/demo.component.ts b/src/app/components/demo.component.ts index fea1982..ef8084e 100644 --- a/src/app/components/demo.component.ts +++ b/src/app/components/demo.component.ts @@ -1,4 +1,17 @@ import { Component, ChangeDetectionStrategy } from '@angular/core'; +import { BasicComponent } from './basic.component'; +import { CustomFormatComponent } from './custom-format.component'; +import { AccuracyComponent } from './accuracy.component'; +import { NotifyComponent } from './notify.component'; +import { TimestampComponent } from './timestamp.component'; +import { CustomFormatDateComponent } from './custom-format-date.component'; +import { DemandComponent } from './demand.component'; +import { ActionsComponent } from './actions.component'; +import { DatefnsComponent } from './date-fns.component'; +import { PrettyTextComponent } from './pretty-text.component'; +import { MoreThan24HoursComponent } from './more-than-24-hours.component'; +import { OnlySecondsComponent } from './only-seconds.component'; +import { KeepingWhenRefreshComponent } from './keeping-when-refresh.component'; @Component({ selector: 'demo', @@ -18,5 +31,21 @@ import { Component, ChangeDetectionStrategy } from '@angular/core';
`, changeDetection: ChangeDetectionStrategy.OnPush, + standalone: true, + imports: [ + BasicComponent, + CustomFormatComponent, + AccuracyComponent, + NotifyComponent, + TimestampComponent, + CustomFormatDateComponent, + DemandComponent, + ActionsComponent, + DatefnsComponent, + PrettyTextComponent, + MoreThan24HoursComponent, + OnlySecondsComponent, + KeepingWhenRefreshComponent, + ], }) export class DemoComponent {} diff --git a/src/app/components/keeping-when-refresh.component.ts b/src/app/components/keeping-when-refresh.component.ts index c27f10d..db64d57 100644 --- a/src/app/components/keeping-when-refresh.component.ts +++ b/src/app/components/keeping-when-refresh.component.ts @@ -1,5 +1,6 @@ import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core'; -import { CountdownConfig, CountdownEvent } from 'ngx-countdown'; +import { CountdownComponent, CountdownConfig, CountdownEvent } from 'ngx-countdown'; +import { ViewCodeComponent } from './view-code.component'; const KEY = 'time'; const DEFAULT = 50; @@ -20,6 +21,8 @@ const DEFAULT = 50; '[class.text-center]': `true`, }, changeDetection: ChangeDetectionStrategy.OnPush, + standalone: true, + imports: [CountdownComponent, ViewCodeComponent], }) export class KeepingWhenRefreshComponent implements OnInit { config: CountdownConfig = { leftTime: DEFAULT, notify: 0 }; diff --git a/src/app/components/layout.component.ts b/src/app/components/layout.component.ts index 17a0d07..ff89a8d 100644 --- a/src/app/components/layout.component.ts +++ b/src/app/components/layout.component.ts @@ -1,4 +1,6 @@ import { Component } from '@angular/core'; +import { RouterLink, RouterOutlet } from '@angular/router'; + @Component({ selector: 'demo-layout', template: ` @@ -26,14 +28,13 @@ import { Component } from '@angular/core'; -

Simple, easy and performance countdown for angular

- + `, + standalone: true, + imports: [RouterOutlet, RouterLink], }) export class LayoutComponent {} diff --git a/src/app/components/more-than-24-hours.component.ts b/src/app/components/more-than-24-hours.component.ts index f69d7d7..202bb68 100644 --- a/src/app/components/more-than-24-hours.component.ts +++ b/src/app/components/more-than-24-hours.component.ts @@ -1,5 +1,6 @@ import { ChangeDetectionStrategy, Component } from '@angular/core'; -import { CountdownConfig } from 'ngx-countdown'; +import { CountdownComponent, CountdownConfig } from 'ngx-countdown'; +import { ViewCodeComponent } from './view-code.component'; const CountdownTimeUnits: Array<[string, number]> = [ ['Y', 1000 * 60 * 60 * 24 * 365], // years @@ -19,7 +20,13 @@ const CountdownTimeUnits: Array<[string, number]> = [
- + +
+ + + + +
`, host: { @@ -27,10 +34,13 @@ const CountdownTimeUnits: Array<[string, number]> = [ '[class.text-center]': `true`, }, changeDetection: ChangeDetectionStrategy.OnPush, + standalone: true, + imports: [CountdownComponent, ViewCodeComponent], }) export class MoreThan24HoursComponent { config: CountdownConfig = { - leftTime: 60 * 60 * 25, + leftTime: 60 * 60 * 24 + 3, + format: 'DD HH:mm:ss', formatDate: ({ date, formatStr }) => { let duration = Number(date || 0); @@ -39,6 +49,10 @@ export class MoreThan24HoursComponent { const v = Math.floor(duration / unit); duration -= v * unit; return current.replace(new RegExp(`${name}+`, 'g'), (match: string) => { + // When days is empty + if (name === 'D' && v <= 0) { + return ''; + } return v.toString().padStart(match.length, '0'); }); } diff --git a/src/app/components/nothing.component.html b/src/app/components/nothing.component.html deleted file mode 100644 index cab1630..0000000 --- a/src/app/components/nothing.component.html +++ /dev/null @@ -1,4 +0,0 @@ -

- Since there are no any countdown component on this page, Timer will automatically stop running. -

-

Confirm this and you can observe it in Chrome-Profiles.

diff --git a/src/app/components/nothing.component.ts b/src/app/components/nothing.component.ts index e3197f1..14ec242 100644 --- a/src/app/components/nothing.component.ts +++ b/src/app/components/nothing.component.ts @@ -2,6 +2,7 @@ import { Component } from '@angular/core'; @Component({ selector: 'demo-nothing', - templateUrl: './nothing.component.html', + template: `

Since there are no any countdown component on this page, Timer will automatically stop running.

+

Confirm this and you can observe it in Chrome-Profiles.

`, }) export class NothingComponent {} diff --git a/src/app/components/notify.component.ts b/src/app/components/notify.component.ts index c3810b8..7890c5c 100644 --- a/src/app/components/notify.component.ts +++ b/src/app/components/notify.component.ts @@ -1,5 +1,6 @@ import { ChangeDetectionStrategy, Component } from '@angular/core'; -import { CountdownConfig, CountdownEvent } from 'ngx-countdown'; +import { CountdownComponent, CountdownConfig, CountdownEvent } from 'ngx-countdown'; +import { ViewCodeComponent } from './view-code.component'; @Component({ selector: 'demo-notify', @@ -22,6 +23,8 @@ import { CountdownConfig, CountdownEvent } from 'ngx-countdown'; '[class.text-center]': `true`, }, changeDetection: ChangeDetectionStrategy.OnPush, + standalone: true, + imports: [CountdownComponent, ViewCodeComponent], }) export class NotifyComponent { config: CountdownConfig = { leftTime: 10, notify: [2, 5] }; diff --git a/src/app/components/only-seconds.component.ts b/src/app/components/only-seconds.component.ts index 6a65934..c29c29c 100644 --- a/src/app/components/only-seconds.component.ts +++ b/src/app/components/only-seconds.component.ts @@ -1,5 +1,6 @@ import { ChangeDetectionStrategy, Component } from '@angular/core'; -import { CountdownConfig } from 'ngx-countdown'; +import { CountdownComponent, CountdownConfig } from 'ngx-countdown'; +import { ViewCodeComponent } from './view-code.component'; @Component({ selector: 'demo-only-seconds', @@ -17,6 +18,8 @@ import { CountdownConfig } from 'ngx-countdown'; '[class.text-center]': `true`, }, changeDetection: ChangeDetectionStrategy.OnPush, + standalone: true, + imports: [CountdownComponent, ViewCodeComponent], }) export class OnlySecondsComponent { config: CountdownConfig = { diff --git a/src/app/components/pretty-text.component.ts b/src/app/components/pretty-text.component.ts index 1698a6a..b7be8a7 100644 --- a/src/app/components/pretty-text.component.ts +++ b/src/app/components/pretty-text.component.ts @@ -1,5 +1,6 @@ import { ChangeDetectionStrategy, Component } from '@angular/core'; -import { CountdownConfig } from 'ngx-countdown'; +import { CountdownComponent, CountdownConfig } from 'ngx-countdown'; +import { ViewCodeComponent } from './view-code.component'; @Component({ selector: 'demo-pretty-text', @@ -36,6 +37,8 @@ import { CountdownConfig } from 'ngx-countdown'; `, ], changeDetection: ChangeDetectionStrategy.OnPush, + standalone: true, + imports: [CountdownComponent, ViewCodeComponent], }) export class PrettyTextComponent { config: CountdownConfig = { diff --git a/src/app/components/test.component.ts b/src/app/components/test.component.ts index 1a44519..4befbde 100644 --- a/src/app/components/test.component.ts +++ b/src/app/components/test.component.ts @@ -1,9 +1,10 @@ import { Component } from '@angular/core'; +import { CountdownComponent } from 'ngx-countdown'; @Component({ selector: 'test', - template: ` - - `, + template: ``, + standalone: true, + imports: [CountdownComponent], }) export class TestComponent {} diff --git a/src/app/components/timestamp.component.ts b/src/app/components/timestamp.component.ts index a905f0e..4077f7d 100644 --- a/src/app/components/timestamp.component.ts +++ b/src/app/components/timestamp.component.ts @@ -1,5 +1,6 @@ import { ChangeDetectionStrategy, Component } from '@angular/core'; -import { CountdownConfig } from 'ngx-countdown'; +import { CountdownComponent, CountdownConfig } from 'ngx-countdown'; +import { ViewCodeComponent } from './view-code.component'; @Component({ selector: 'demo-timestamp', @@ -21,6 +22,8 @@ import { CountdownConfig } from 'ngx-countdown'; '[class.text-center]': `true`, }, changeDetection: ChangeDetectionStrategy.OnPush, + standalone: true, + imports: [CountdownComponent, ViewCodeComponent], }) export class TimestampComponent { config: CountdownConfig = { stopTime: new Date().getTime() + 1000 * 30 }; diff --git a/src/app/components/view-code.component.ts b/src/app/components/view-code.component.ts index be48253..c16c6a7 100644 --- a/src/app/components/view-code.component.ts +++ b/src/app/components/view-code.component.ts @@ -6,6 +6,7 @@ import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; (View Code) `, changeDetection: ChangeDetectionStrategy.OnPush, + standalone: true, }) export class ViewCodeComponent { @Input() name = ''; diff --git a/src/app/router.ts b/src/app/router.ts new file mode 100644 index 0000000..fc4602b --- /dev/null +++ b/src/app/router.ts @@ -0,0 +1,22 @@ +import { Route } from '@angular/router'; +import { LayoutComponent } from './components/layout.component'; +import { DemoComponent } from './components/demo.component'; +import { ALotComponent } from './components/alot.component'; +import { NothingComponent } from './components/nothing.component'; +import { TestComponent } from './components/test.component'; + +export const ROUTERS: Route[] = [ + { + path: '', + component: LayoutComponent, + children: [ + { path: '', component: DemoComponent }, + { path: 'alot', component: ALotComponent }, + { path: 'nothing', component: NothingComponent }, + ], + }, + { + path: 'test', + component: TestComponent, + }, +]; diff --git a/src/app/standalone.component.ts b/src/app/standalone.component.ts deleted file mode 100644 index d700561..0000000 --- a/src/app/standalone.component.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { Component } from '@angular/core'; -import { CountdownModule } from 'ngx-countdown'; - -@Component({ - selector: 'standalone-demo', - template: ` `, - standalone: true, - imports: [CountdownModule], -}) -export class StandaloneComponent {} diff --git a/src/assets/fork.png b/src/assets/fork.png deleted file mode 100644 index 146ef8a800602169cf78c686fc5a6d138a76bc0a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 7791 zcmV-#9+2UQP)O>+M%?x9Q-Aclg+SU{aR>iZ-V5ENM}s?g?o3TCz>p076pgIvo9@XSFn67!Z(L}aTexp zAcOn{GYF{63{x3Y|KXge7Rgs|WVGqumV|_UKRatZba(eaMP)S%4i5UolZ=m#gN&6H zmI^z-ZZEFv>uz~$@a{kh`_f(c8kBDZWBCYFpnBH^sV@HRRs-u`N=owgva>frJ9_~y z=NB-xxa}8DG&D36Hs@wTUtd2CdUUM)X%#d;KqN)YP2# z_^;<-cz77hCZpdx(Ob7}LG_JVh>MGXRhb#7OC#dmSQNY@PELi3`5Qx|LfHxOUyn#Cxw_JmE!)7C}zd2I%VPfy&CNs?N3sbt=3g7;AQ! zieJO>w_x=xDdui%V$*mbN0Lu~sdb3uD_gP4P(_*Zq z#wHuqu7V6fVDh7K!<{>KprN4&EU77wlbw|o9cL2a-N#JjF=K^CL@>sZ$_=F@<#g*0 z5wnaX3v>g(;b-KeR9gt$0Zy*d+o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 @@ -import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; -import { enableProdMode } from '@angular/core'; -import { environment } from './environments/environment'; -import { AppDemoModule } from './app/app.module'; +import { bootstrapApplication } from '@angular/platform-browser'; +import { AppComponent } from './app/app.component'; +import { provideHttpClient } from '@angular/common/http'; +import { provideRouter, withHashLocation } from '@angular/router'; +import { ROUTERS } from './app/router'; +import { CountdownConfig, CountdownGlobalConfig } from 'ngx-countdown'; -if (environment.production) { - enableProdMode(); +export function countdownConfigFactory(): CountdownConfig { + return {}; } -platformBrowserDynamic() - .bootstrapModule(AppDemoModule) - .catch((err) => console.error(err)); +bootstrapApplication(AppComponent, { + providers: [ + provideHttpClient(), + provideRouter(ROUTERS, withHashLocation()), + { provide: CountdownGlobalConfig, useFactory: countdownConfigFactory }, + ], +}).catch((err) => console.error(err)); diff --git a/tsconfig.app.json b/tsconfig.app.json index 84f1f99..374cc9d 100644 --- a/tsconfig.app.json +++ b/tsconfig.app.json @@ -5,6 +5,10 @@ "outDir": "./out-tsc/app", "types": [] }, - "files": ["src/main.ts"], - "include": ["src/**/*.d.ts"] + "files": [ + "src/main.ts" + ], + "include": [ + "src/**/*.d.ts" + ] } diff --git a/tsconfig.json b/tsconfig.json index 15292bc..d81c67b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -10,6 +10,7 @@ "noPropertyAccessFromIndexSignature": true, "noImplicitReturns": true, "noFallthroughCasesInSwitch": true, + "allowSyntheticDefaultImports": true, "sourceMap": true, "declaration": false, "downlevelIteration": true, @@ -24,7 +25,9 @@ "dom" ], "paths": { - "ngx-countdown": ["lib/src/index"] + "ngx-countdown": [ + "lib/src/index" + ] } }, "angularCompilerOptions": { diff --git a/tsconfig.spec.json b/tsconfig.spec.json index a0bad79..57f6f1d 100644 --- a/tsconfig.spec.json +++ b/tsconfig.spec.json @@ -3,8 +3,11 @@ "extends": "./tsconfig.json", "compilerOptions": { "outDir": "./out-tsc/spec", - "types": ["jasmine"] + "types": [ + "jasmine" + ] }, - "files": ["lib/test.ts"], - "include": ["lib/**/*.spec.ts", "lib/**/*.d.ts"] + "include": [ + "lib/**/*.spec.ts" + ] }