From df25acb4cfd839e6cc43cc5301a2e2b00a506d11 Mon Sep 17 00:00:00 2001 From: Rolando Date: Fri, 30 Aug 2024 10:22:38 -0400 Subject: [PATCH 01/16] Updated uiSref directive to be an standalone directive --- src/directives/uiSref.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/directives/uiSref.ts b/src/directives/uiSref.ts index 3b9055f9..558b3735 100644 --- a/src/directives/uiSref.ts +++ b/src/directives/uiSref.ts @@ -17,7 +17,10 @@ import { ReplaySubject, Subscription } from 'rxjs'; * @internal * # blah blah blah */ -@Directive({ selector: 'a[uiSref]' }) +@Directive({ + selector: 'a[uiSref]', + standalone: true +}) export class AnchorUISref { constructor(public _el: ElementRef, public _renderer: Renderer2) {} @@ -78,6 +81,7 @@ export class AnchorUISref { @Directive({ selector: '[uiSref]', exportAs: 'uiSref', + standalone: true }) export class UISref implements OnChanges { /** From e89800e5ce29ea71fafaffc8f6074cf004aa258f Mon Sep 17 00:00:00 2001 From: Rolando Date: Fri, 30 Aug 2024 10:23:11 -0400 Subject: [PATCH 02/16] Updated uiSrefActive directive to be a standalone directive --- src/directives/uiSrefActive.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/directives/uiSrefActive.ts b/src/directives/uiSrefActive.ts index 2884d40b..3cd3a1c6 100644 --- a/src/directives/uiSrefActive.ts +++ b/src/directives/uiSrefActive.ts @@ -82,6 +82,7 @@ import { Subscription } from 'rxjs'; */ @Directive({ selector: '[uiSrefActive],[uiSrefActiveEq]', + standalone: true }) export class UISrefActive { private _classes: string[] = []; From ec0f5186579993f9c1a1ccfb1061a5c72ca6482c Mon Sep 17 00:00:00 2001 From: Rolando Date: Fri, 30 Aug 2024 10:23:30 -0400 Subject: [PATCH 03/16] Updated uiSrefStatus directive to be a standalone directive --- src/directives/uiSrefStatus.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/directives/uiSrefStatus.ts b/src/directives/uiSrefStatus.ts index 66cc8a71..48fedf0a 100644 --- a/src/directives/uiSrefStatus.ts +++ b/src/directives/uiSrefStatus.ts @@ -182,6 +182,7 @@ function mergeSrefStatus(left: SrefStatus, right: SrefStatus): SrefStatus { @Directive({ selector: '[uiSrefStatus],[uiSrefActive],[uiSrefActiveEq]', exportAs: 'uiSrefStatus', + standalone: true }) export class UISrefStatus { /** current statuses of the state/params the uiSref directive is linking to */ From 97cc602f8566a9969cd3937fc5bd74032f90b755 Mon Sep 17 00:00:00 2001 From: Rolando Date: Fri, 30 Aug 2024 10:24:11 -0400 Subject: [PATCH 04/16] Updated uiView component to be a standalone component --- src/directives/uiView.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/directives/uiView.ts b/src/directives/uiView.ts index 724978c7..8917ae0a 100755 --- a/src/directives/uiView.ts +++ b/src/directives/uiView.ts @@ -110,6 +110,7 @@ const ng2ComponentInputs = (factory: ComponentFactory): InputMapping[] => { @Component({ selector: 'ui-view, [ui-view]', exportAs: 'uiView', + standalone: true, template: ` From 4a8d1bbe084b91b1ff1a9b7c513da5cce4b2b5cd Mon Sep 17 00:00:00 2001 From: Rolando Date: Fri, 30 Aug 2024 10:25:10 -0400 Subject: [PATCH 05/16] Imported directives instead of declaring them in UIRouterModule --- src/uiRouterNgModule.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/uiRouterNgModule.ts b/src/uiRouterNgModule.ts index 033ec735..f0fb9727 100644 --- a/src/uiRouterNgModule.ts +++ b/src/uiRouterNgModule.ts @@ -71,8 +71,10 @@ export function locationStrategy(useHash) { * This enables UI-Router to automatically register the states with the [[StateRegistry]] at bootstrap (and during lazy load). */ @NgModule({ - imports: [CommonModule], - declarations: [_UIROUTER_DIRECTIVES], + imports: [ + CommonModule, + _UIROUTER_DIRECTIVES + ], exports: [_UIROUTER_DIRECTIVES], }) export class UIRouterModule { From 45d4103aebd8482eaf7e4490400f9e10666b4445 Mon Sep 17 00:00:00 2001 From: Rolando Date: Fri, 30 Aug 2024 10:26:14 -0400 Subject: [PATCH 06/16] Created a root provider function for UIRouter. --- src/provideUiRouter.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/provideUiRouter.ts diff --git a/src/provideUiRouter.ts b/src/provideUiRouter.ts new file mode 100644 index 00000000..d429019e --- /dev/null +++ b/src/provideUiRouter.ts @@ -0,0 +1,12 @@ +import { EnvironmentProviders, makeEnvironmentProviders } from "@angular/core"; +import { locationStrategy, makeRootProviders, RootModule } from "./uiRouterNgModule"; +import { _UIROUTER_INSTANCE_PROVIDERS, _UIROUTER_SERVICE_PROVIDERS } from "./providers"; + +export function provideUIRouter(config: RootModule = {}): EnvironmentProviders { + return makeEnvironmentProviders([ + _UIROUTER_INSTANCE_PROVIDERS, + _UIROUTER_SERVICE_PROVIDERS, + locationStrategy(config.useHash), + ...makeRootProviders(config), + ]); +} From 5e3de9becd0120635987400ab7082e82d402722b Mon Sep 17 00:00:00 2001 From: Rolando Date: Fri, 30 Aug 2024 15:05:46 -0400 Subject: [PATCH 07/16] Fixed bug in uiView component not loading the CommonModule. --- src/directives/uiView.ts | 2 ++ src/uiRouterNgModule.ts | 4 +--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/directives/uiView.ts b/src/directives/uiView.ts index 8917ae0a..dff42e14 100755 --- a/src/directives/uiView.ts +++ b/src/directives/uiView.ts @@ -33,6 +33,7 @@ import { } from '@uirouter/core'; import { Ng2ViewConfig } from '../statebuilders/views'; import { MergeInjector } from '../mergeInjector'; +import { CommonModule } from '@angular/common'; /** @hidden */ let id = 0; @@ -111,6 +112,7 @@ const ng2ComponentInputs = (factory: ComponentFactory): InputMapping[] => { selector: 'ui-view, [ui-view]', exportAs: 'uiView', standalone: true, + imports: [CommonModule], template: ` diff --git a/src/uiRouterNgModule.ts b/src/uiRouterNgModule.ts index f0fb9727..0275636e 100644 --- a/src/uiRouterNgModule.ts +++ b/src/uiRouterNgModule.ts @@ -7,9 +7,8 @@ import { Injector, APP_INITIALIZER, } from '@angular/core'; -import { CommonModule, LocationStrategy, HashLocationStrategy, PathLocationStrategy } from '@angular/common'; +import { LocationStrategy, HashLocationStrategy, PathLocationStrategy } from '@angular/common'; import { _UIROUTER_DIRECTIVES } from './directives/directives'; -import { UIView } from './directives/uiView'; import { UrlRuleHandlerFn, TargetState, TargetStateDef, UIRouter, TransitionService } from '@uirouter/core'; import { _UIROUTER_INSTANCE_PROVIDERS, _UIROUTER_SERVICE_PROVIDERS } from './providers'; @@ -72,7 +71,6 @@ export function locationStrategy(useHash) { */ @NgModule({ imports: [ - CommonModule, _UIROUTER_DIRECTIVES ], exports: [_UIROUTER_DIRECTIVES], From 2955b86a25166e33af77e82857d5abb891ee4900 Mon Sep 17 00:00:00 2001 From: Rolando Date: Fri, 30 Aug 2024 15:14:16 -0400 Subject: [PATCH 08/16] Updated downstream sample app for the tests. --- downstream_projects.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/downstream_projects.json b/downstream_projects.json index 9cbc3ee4..dfce8b08 100644 --- a/downstream_projects.json +++ b/downstream_projects.json @@ -1,7 +1,7 @@ { "packageDir": "./dist", "projects": { - "sample-app-angular": "https://github.com/ui-router/sample-app-angular.git", + "sample-app-angular": "https://github.com/lindolo25/sample-app-angular.git", "angular18": "./test-angular-versions/v18", "typescript54": "./test-typescript-versions/typescript5.4" } From 11fb548382cd799f528da944c95261fbe930c0bf Mon Sep 17 00:00:00 2001 From: Rolando Date: Fri, 30 Aug 2024 17:27:40 -0400 Subject: [PATCH 09/16] Updated UISrefActive to use hostDirectives to implement the UISrefStatus directive. --- src/directives/uiSrefActive.ts | 4 ++++ src/directives/uiSrefStatus.ts | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/directives/uiSrefActive.ts b/src/directives/uiSrefActive.ts index 3cd3a1c6..478dea2c 100644 --- a/src/directives/uiSrefActive.ts +++ b/src/directives/uiSrefActive.ts @@ -82,6 +82,10 @@ import { Subscription } from 'rxjs'; */ @Directive({ selector: '[uiSrefActive],[uiSrefActiveEq]', + hostDirectives: [{ + directive: UISrefStatus, + outputs: ['uiSrefStatus'] + }], standalone: true }) export class UISrefActive { diff --git a/src/directives/uiSrefStatus.ts b/src/directives/uiSrefStatus.ts index 48fedf0a..c86f52a9 100644 --- a/src/directives/uiSrefStatus.ts +++ b/src/directives/uiSrefStatus.ts @@ -180,7 +180,7 @@ function mergeSrefStatus(left: SrefStatus, right: SrefStatus): SrefStatus { * This API is subject to change. */ @Directive({ - selector: '[uiSrefStatus],[uiSrefActive],[uiSrefActiveEq]', + selector: '[uiSrefStatus]', exportAs: 'uiSrefStatus', standalone: true }) From f3e91c25e2bdf48f7b1a8ed6fe86f689615b0403 Mon Sep 17 00:00:00 2001 From: Rolando Date: Fri, 30 Aug 2024 17:28:13 -0400 Subject: [PATCH 10/16] Added provideUiRouter to global exports. --- src/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/index.ts b/src/index.ts index 111cd493..b497146b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -7,5 +7,6 @@ export * from './statebuilders/lazyLoad'; export * from './statebuilders/views'; export * from './uiRouterConfig'; export * from './uiRouterNgModule'; +export * from './provideUiRouter'; export * from '@uirouter/core'; From 22a86b1ce9cc837506ab769c690ffb5b9ec83d6f Mon Sep 17 00:00:00 2001 From: Rolando Date: Fri, 30 Aug 2024 17:47:23 -0400 Subject: [PATCH 11/16] added a standalone v18 test project. --- .../v18-standalone/README.md | 27 ++++ .../v18-standalone/angular.json | 124 ++++++++++++++++++ .../v18-standalone/cypress.config.ts | 10 ++ .../cypress/e2e/sample_app.cy.js | 69 ++++++++++ .../v18-standalone/package.json | 50 +++++++ .../v18-standalone/public/favicon.ico | Bin 0 -> 15086 bytes .../v18-standalone/src/app/about.component.ts | 8 ++ .../v18-standalone/src/app/app.component.ts | 35 +++++ .../v18-standalone/src/app/app.config.ts | 10 ++ .../v18-standalone/src/app/app.routes.ts | 13 ++ .../v18-standalone/src/app/home.component.ts | 8 ++ .../src/app/lazy/lazy.component.ts | 12 ++ .../src/app/lazy/lazy.module.ts | 23 ++++ .../v18-standalone/src/index.html | 13 ++ .../v18-standalone/src/main.ts | 6 + .../v18-standalone/src/styles.css | 1 + .../v18-standalone/tsconfig.app.json | 15 +++ .../v18-standalone/tsconfig.json | 33 +++++ .../v18-standalone/tsconfig.spec.json | 15 +++ 19 files changed, 472 insertions(+) create mode 100644 test-angular-versions/v18-standalone/README.md create mode 100644 test-angular-versions/v18-standalone/angular.json create mode 100644 test-angular-versions/v18-standalone/cypress.config.ts create mode 100644 test-angular-versions/v18-standalone/cypress/e2e/sample_app.cy.js create mode 100644 test-angular-versions/v18-standalone/package.json create mode 100644 test-angular-versions/v18-standalone/public/favicon.ico create mode 100644 test-angular-versions/v18-standalone/src/app/about.component.ts create mode 100644 test-angular-versions/v18-standalone/src/app/app.component.ts create mode 100644 test-angular-versions/v18-standalone/src/app/app.config.ts create mode 100644 test-angular-versions/v18-standalone/src/app/app.routes.ts create mode 100644 test-angular-versions/v18-standalone/src/app/home.component.ts create mode 100644 test-angular-versions/v18-standalone/src/app/lazy/lazy.component.ts create mode 100644 test-angular-versions/v18-standalone/src/app/lazy/lazy.module.ts create mode 100644 test-angular-versions/v18-standalone/src/index.html create mode 100644 test-angular-versions/v18-standalone/src/main.ts create mode 100644 test-angular-versions/v18-standalone/src/styles.css create mode 100644 test-angular-versions/v18-standalone/tsconfig.app.json create mode 100644 test-angular-versions/v18-standalone/tsconfig.json create mode 100644 test-angular-versions/v18-standalone/tsconfig.spec.json diff --git a/test-angular-versions/v18-standalone/README.md b/test-angular-versions/v18-standalone/README.md new file mode 100644 index 00000000..b3fa584f --- /dev/null +++ b/test-angular-versions/v18-standalone/README.md @@ -0,0 +1,27 @@ +# V18 + +This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 18.0.7. + +## Development server + +Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The application will automatically reload if you change any of the source files. + +## Code scaffolding + +Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`. + +## Build + +Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. + +## Running unit tests + +Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io). + +## Running end-to-end tests + +Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities. + +## Further help + +To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page. diff --git a/test-angular-versions/v18-standalone/angular.json b/test-angular-versions/v18-standalone/angular.json new file mode 100644 index 00000000..2e2421af --- /dev/null +++ b/test-angular-versions/v18-standalone/angular.json @@ -0,0 +1,124 @@ +{ + "$schema": "./node_modules/@angular/cli/lib/config/schema.json", + "version": 1, + "cli": { + "packageManager": "yarn" + }, + "newProjectRoot": "projects", + "projects": { + "v18": { + "projectType": "application", + "schematics": { + "@schematics/angular:class": { + "skipTests": true + }, + "@schematics/angular:component": { + "skipTests": true + }, + "@schematics/angular:directive": { + "skipTests": true + }, + "@schematics/angular:guard": { + "skipTests": true + }, + "@schematics/angular:interceptor": { + "skipTests": true + }, + "@schematics/angular:pipe": { + "skipTests": true + }, + "@schematics/angular:resolver": { + "skipTests": true + }, + "@schematics/angular:service": { + "skipTests": true + } + }, + "root": "", + "sourceRoot": "src", + "prefix": "app", + "architect": { + "build": { + "builder": "@angular-devkit/build-angular:application", + "options": { + "outputPath": "dist/v18", + "index": "src/index.html", + "browser": "src/main.ts", + "polyfills": [ + "zone.js" + ], + "tsConfig": "tsconfig.app.json", + "assets": [ + { + "glob": "**/*", + "input": "public" + } + ], + "styles": [ + "src/styles.css" + ], + "scripts": [] + }, + "configurations": { + "production": { + "budgets": [ + { + "type": "initial", + "maximumWarning": "500kB", + "maximumError": "1MB" + }, + { + "type": "anyComponentStyle", + "maximumWarning": "2kB", + "maximumError": "4kB" + } + ], + "outputHashing": "all" + }, + "development": { + "optimization": false, + "extractLicenses": false, + "sourceMap": true + } + }, + "defaultConfiguration": "production" + }, + "serve": { + "builder": "@angular-devkit/build-angular:dev-server", + "configurations": { + "production": { + "buildTarget": "v18:build:production" + }, + "development": { + "buildTarget": "v18:build:development" + } + }, + "defaultConfiguration": "development" + }, + "extract-i18n": { + "builder": "@angular-devkit/build-angular:extract-i18n" + }, + "test": { + "builder": "@angular-devkit/build-angular:karma", + "options": { + "polyfills": [ + "zone.js", + "zone.js/testing" + ], + "tsConfig": "tsconfig.spec.json", + "assets": [ + { + "glob": "**/*", + "input": "public" + } + ], + "styles": [ + "src/styles.css" + ], + "scripts": [] + } + } + } + } + } +} diff --git a/test-angular-versions/v18-standalone/cypress.config.ts b/test-angular-versions/v18-standalone/cypress.config.ts new file mode 100644 index 00000000..d764a065 --- /dev/null +++ b/test-angular-versions/v18-standalone/cypress.config.ts @@ -0,0 +1,10 @@ +import { defineConfig } from 'cypress'; + +export default defineConfig({ + video: false, + e2e: { + setupNodeEvents(on, config) {}, + baseUrl: 'http://localhost:4000', + supportFile: false + }, +}) diff --git a/test-angular-versions/v18-standalone/cypress/e2e/sample_app.cy.js b/test-angular-versions/v18-standalone/cypress/e2e/sample_app.cy.js new file mode 100644 index 00000000..f01159c7 --- /dev/null +++ b/test-angular-versions/v18-standalone/cypress/e2e/sample_app.cy.js @@ -0,0 +1,69 @@ +describe('Angular app', () => { + beforeEach(() => { + window.sessionStorage.clear(); + }); + + it('loads', () => { + cy.visit(''); + }); + + it('loads home state by default', () => { + cy.visit(''); + cy.url().should('include', '/home'); + }); + + it('renders uisref as links', () => { + cy.visit(''); + cy.get('a').contains('home'); + cy.get('a').contains('about'); + cy.get('a').contains('lazy'); + cy.get('a').contains('lazy.child'); + cy.get('a').contains('lazy.child.viewtarget'); + }); + + it('renders home', () => { + cy.visit('/home'); + cy.get('a').contains('home').should('have.class', 'active'); + cy.get('a').contains('about').should('not.have.class', 'active'); + cy.get('#default').contains('home works'); + }); + + it('renders about', () => { + cy.visit('/home'); + cy.visit('/about'); + cy.get('a').contains('home').should('not.have.class', 'active'); + cy.get('a').contains('about').should('have.class', 'active'); + cy.get('#default').contains('about works'); + }); + + it('loads lazy routes', () => { + cy.visit('/home'); + cy.visit('/lazy'); + cy.get('a').contains('home').should('not.have.class', 'active'); + cy.get('a').contains('lazy').should('have.class', 'active'); + cy.get('#default').contains('lazy works'); + }); + + it('routes to lazy routes', () => { + cy.visit('/lazy'); + cy.get('a').contains('home').should('not.have.class', 'active'); + cy.get('a').contains('lazy').should('have.class', 'active'); + cy.get('#default').contains('lazy works'); + }); + + it('routes to lazy child routes', () => { + cy.visit('/lazy/child'); + cy.get('a').contains('home').should('not.have.class', 'active'); + cy.get('a').contains('lazy.child').should('have.class', 'active'); + cy.get('#default').contains('lazy.child works'); + }); + + it('targets named views', () => { + cy.visit('/lazy/child/viewtarget'); + cy.get('a').contains('home').should('not.have.class', 'active'); + cy.get('a').contains('lazy.child').should('have.class', 'active'); + cy.get('#default').contains('lazy.child works'); + cy.get('#header').contains('lazy.child.viewtarget works'); + cy.get('#footer').contains('lazy.child.viewtarget works'); + }); +}); diff --git a/test-angular-versions/v18-standalone/package.json b/test-angular-versions/v18-standalone/package.json new file mode 100644 index 00000000..26365b60 --- /dev/null +++ b/test-angular-versions/v18-standalone/package.json @@ -0,0 +1,50 @@ +{ + "name": "v18", + "version": "0.0.0", + "scripts": { + "ng": "ng", + "start": "ng serve", + "build": "ng build", + "watch": "ng build --watch --configuration development", + "test": "npm run test:dev && npm run test:prod", + "test:dev": "ng build --configuration development && cypress-runner run --path dist/v18/browser", + "test:prod": "ng build --configuration production && cypress-runner run --path dist/v18/browser" + }, + "private": true, + "dependencies": { + "@angular/animations": "^18.0.0", + "@angular/common": "^18.0.0", + "@angular/compiler": "^18.0.0", + "@angular/core": "^18.0.0", + "@angular/forms": "^18.0.0", + "@angular/platform-browser": "^18.0.0", + "@angular/platform-browser-dynamic": "^18.0.0", + "@angular/router": "^18.0.0", + "rxjs": "~7.8.0", + "tslib": "^2.3.0", + "zone.js": "~0.14.3", + "@uirouter/angular": "*", + "@uirouter/cypress-runner": "*", + "@uirouter/core": "*", + "@uirouter/rx": "*" + }, + "devDependencies": { + "@angular-devkit/build-angular": "^18.0.7", + "@angular/cli": "^18.0.7", + "@angular/compiler-cli": "^18.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.1.0", + "typescript": "~5.4.5" + }, + "checkPeerDependencies": { + "ignore": [ + "ajv", + "terser" + ] + } +} diff --git a/test-angular-versions/v18-standalone/public/favicon.ico b/test-angular-versions/v18-standalone/public/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..57614f9c967596fad0a3989bec2b1deff33034f6 GIT binary patch literal 15086 zcmd^G33O9Omi+`8$@{|M-I6TH3wzF-p5CV8o}7f~KxR60LK+ApEFB<$bcciv%@SmA zV{n>g85YMFFeU*Uvl=i4v)C*qgnb;$GQ=3XTe9{Y%c`mO%su)noNCCQ*@t1WXn|B(hQ7i~ zrUK8|pUkD6#lNo!bt$6)jR!&C?`P5G(`e((P($RaLeq+o0Vd~f11;qB05kdbAOm?r zXv~GYr_sibQO9NGTCdT;+G(!{4Xs@4fPak8#L8PjgJwcs-Mm#nR_Z0s&u?nDX5^~@ z+A6?}g0|=4e_LoE69pPFO`yCD@BCjgKpzMH0O4Xs{Ahc?K3HC5;l=f zg>}alhBXX&);z$E-wai+9TTRtBX-bWYY@cl$@YN#gMd~tM_5lj6W%8ah4;uZ;jP@Q zVbuel1rPA?2@x9Y+u?e`l{Z4ngfG5q5BLH5QsEu4GVpt{KIp1?U)=3+KQ;%7ec8l* zdV=zZgN5>O3G(3L2fqj3;oBbZZw$Ij@`Juz@?+yy#OPw)>#wsTewVgTK9BGt5AbZ&?K&B3GVF&yu?@(Xj3fR3n+ZP0%+wo)D9_xp>Z$`A4 zfV>}NWj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)&sRbzH$9Rovzd?ZEY}GqX+~ zFbEbLz`BZ49=2Yh-|<`waK-_4!7`ro@zlC|r&I4fc4oyb+m=|c8)8%tZ-z5FwhzDt zL5kB@u53`d@%nHl0Sp)Dw`(QU&>vujEn?GPEXUW!Wi<+4e%BORl&BIH+SwRcbS}X@ z01Pk|vA%OdJKAs17zSXtO55k!;%m9>1eW9LnyAX4uj7@${O6cfii`49qTNItzny5J zH&Gj`e}o}?xjQ}r?LrI%FjUd@xflT3|7LA|ka%Q3i}a8gVm<`HIWoJGH=$EGClX^C0lysQJ>UO(q&;`T#8txuoQ_{l^kEV9CAdXuU1Ghg8 zN_6hHFuy&1x24q5-(Z7;!poYdt*`UTdrQOIQ!2O7_+AHV2hgXaEz7)>$LEdG z<8vE^Tw$|YwZHZDPM!SNOAWG$?J)MdmEk{U!!$M#fp7*Wo}jJ$Q(=8>R`Ats?e|VU?Zt7Cdh%AdnfyN3MBWw{ z$OnREvPf7%z6`#2##_7id|H%Y{vV^vWXb?5d5?a_y&t3@p9t$ncHj-NBdo&X{wrfJ zamN)VMYROYh_SvjJ=Xd!Ga?PY_$;*L=SxFte!4O6%0HEh%iZ4=gvns7IWIyJHa|hT z2;1+e)`TvbNb3-0z&DD_)Jomsg-7p_Uh`wjGnU1urmv1_oVqRg#=C?e?!7DgtqojU zWoAB($&53;TsXu^@2;8M`#z{=rPy?JqgYM0CDf4v@z=ZD|ItJ&8%_7A#K?S{wjxgd z?xA6JdJojrWpB7fr2p_MSsU4(R7=XGS0+Eg#xR=j>`H@R9{XjwBmqAiOxOL` zt?XK-iTEOWV}f>Pz3H-s*>W z4~8C&Xq25UQ^xH6H9kY_RM1$ch+%YLF72AA7^b{~VNTG}Tj#qZltz5Q=qxR`&oIlW Nr__JTFzvMr^FKp4S3v*( literal 0 HcmV?d00001 diff --git a/test-angular-versions/v18-standalone/src/app/about.component.ts b/test-angular-versions/v18-standalone/src/app/about.component.ts new file mode 100644 index 00000000..92e22051 --- /dev/null +++ b/test-angular-versions/v18-standalone/src/app/about.component.ts @@ -0,0 +1,8 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'app-about', + template: `

about works!

`, + standalone: true, +}) +export class AboutComponent {} diff --git a/test-angular-versions/v18-standalone/src/app/app.component.ts b/test-angular-versions/v18-standalone/src/app/app.component.ts new file mode 100644 index 00000000..ac0e6f53 --- /dev/null +++ b/test-angular-versions/v18-standalone/src/app/app.component.ts @@ -0,0 +1,35 @@ +import { Component } from '@angular/core'; +import { AnchorUISref, UISref, UISrefActive, UIView } from '@uirouter/angular'; + +@Component({ + selector: 'app-root', + template: ` + + + +`, + styles: [ + ` + .app { + text-align: center; + border: 1px solid; + } + .active { + font-weight: bold; + } + `, + ], + standalone: true, + imports: [UIView, AnchorUISref, UISref, UISrefActive] +}) +export class AppComponent {} diff --git a/test-angular-versions/v18-standalone/src/app/app.config.ts b/test-angular-versions/v18-standalone/src/app/app.config.ts new file mode 100644 index 00000000..e4f2f542 --- /dev/null +++ b/test-angular-versions/v18-standalone/src/app/app.config.ts @@ -0,0 +1,10 @@ +import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core'; +import { provideUIRouter } from '@uirouter/angular'; +import { states, config } from "./app.routes"; + +export const appConfig: ApplicationConfig = { + providers: [ + provideZoneChangeDetection({ eventCoalescing: true }), + provideUIRouter({ states: states, config: config }) + ] +}; diff --git a/test-angular-versions/v18-standalone/src/app/app.routes.ts b/test-angular-versions/v18-standalone/src/app/app.routes.ts new file mode 100644 index 00000000..defc3a10 --- /dev/null +++ b/test-angular-versions/v18-standalone/src/app/app.routes.ts @@ -0,0 +1,13 @@ +import { HomeComponent } from './home.component'; +import { AboutComponent } from './about.component'; +import { UIRouter } from '@uirouter/angular'; + +export const states = [ + { name: 'home', url: '/home', component: HomeComponent }, + { name: 'about', url: '/about', component: AboutComponent }, + { name: 'lazy.**', url: '/lazy', loadChildren: () => import('./lazy/lazy.module').then((m) => m.LazyModule) }, +]; + +export function config(router: UIRouter) { + router.urlService.rules.initial({ state: 'home' }); +} diff --git a/test-angular-versions/v18-standalone/src/app/home.component.ts b/test-angular-versions/v18-standalone/src/app/home.component.ts new file mode 100644 index 00000000..6fea45e5 --- /dev/null +++ b/test-angular-versions/v18-standalone/src/app/home.component.ts @@ -0,0 +1,8 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'app-home', + template: `

home works!

`, + standalone: true, +}) +export class HomeComponent {} diff --git a/test-angular-versions/v18-standalone/src/app/lazy/lazy.component.ts b/test-angular-versions/v18-standalone/src/app/lazy/lazy.component.ts new file mode 100644 index 00000000..60b4fbf2 --- /dev/null +++ b/test-angular-versions/v18-standalone/src/app/lazy/lazy.component.ts @@ -0,0 +1,12 @@ +import { Component, Input } from '@angular/core'; + +@Component({ + selector: 'app-lazy', + template: ` +

{{ state.name }} works!

+ + `, +}) +export class LazyComponent { + @Input('$state$') state: any; +} diff --git a/test-angular-versions/v18-standalone/src/app/lazy/lazy.module.ts b/test-angular-versions/v18-standalone/src/app/lazy/lazy.module.ts new file mode 100644 index 00000000..2ca79698 --- /dev/null +++ b/test-angular-versions/v18-standalone/src/app/lazy/lazy.module.ts @@ -0,0 +1,23 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { UIRouterModule } from '@uirouter/angular'; +import { LazyComponent } from './lazy.component'; + +export const states = [ + { name: 'lazy', url: '/lazy', component: LazyComponent }, + { name: 'lazy.child', url: '/child', component: LazyComponent }, + { + name: 'lazy.child.viewtarget', + url: '/viewtarget', + views: { + '!header': { component: LazyComponent }, + 'footer@': { component: LazyComponent }, + }, + }, +]; + +@NgModule({ + imports: [CommonModule, UIRouterModule.forChild({ states: states })], + declarations: [LazyComponent], +}) +export class LazyModule {} diff --git a/test-angular-versions/v18-standalone/src/index.html b/test-angular-versions/v18-standalone/src/index.html new file mode 100644 index 00000000..9a21ef6c --- /dev/null +++ b/test-angular-versions/v18-standalone/src/index.html @@ -0,0 +1,13 @@ + + + + + V18 + + + + + + + + diff --git a/test-angular-versions/v18-standalone/src/main.ts b/test-angular-versions/v18-standalone/src/main.ts new file mode 100644 index 00000000..35b00f34 --- /dev/null +++ b/test-angular-versions/v18-standalone/src/main.ts @@ -0,0 +1,6 @@ +import { bootstrapApplication } from '@angular/platform-browser'; +import { appConfig } from './app/app.config'; +import { AppComponent } from './app/app.component'; + +bootstrapApplication(AppComponent, appConfig) + .catch((err) => console.error(err)); diff --git a/test-angular-versions/v18-standalone/src/styles.css b/test-angular-versions/v18-standalone/src/styles.css new file mode 100644 index 00000000..90d4ee00 --- /dev/null +++ b/test-angular-versions/v18-standalone/src/styles.css @@ -0,0 +1 @@ +/* You can add global styles to this file, and also import other style files */ diff --git a/test-angular-versions/v18-standalone/tsconfig.app.json b/test-angular-versions/v18-standalone/tsconfig.app.json new file mode 100644 index 00000000..3775b37e --- /dev/null +++ b/test-angular-versions/v18-standalone/tsconfig.app.json @@ -0,0 +1,15 @@ +/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */ +/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "./out-tsc/app", + "types": [] + }, + "files": [ + "src/main.ts" + ], + "include": [ + "src/**/*.d.ts" + ] +} diff --git a/test-angular-versions/v18-standalone/tsconfig.json b/test-angular-versions/v18-standalone/tsconfig.json new file mode 100644 index 00000000..7f6dcedf --- /dev/null +++ b/test-angular-versions/v18-standalone/tsconfig.json @@ -0,0 +1,33 @@ +/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */ +/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */ +{ + "compileOnSave": false, + "compilerOptions": { + "outDir": "./dist/out-tsc", + "strict": true, + "noImplicitOverride": true, + "noPropertyAccessFromIndexSignature": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "skipLibCheck": true, + "esModuleInterop": true, + "sourceMap": true, + "declaration": false, + "experimentalDecorators": true, + "moduleResolution": "node", + "importHelpers": true, + "target": "ES2022", + "module": "ES2022", + "useDefineForClassFields": false, + "lib": [ + "ES2022", + "dom" + ] + }, + "angularCompilerOptions": { + "enableI18nLegacyMessageIdFormat": false, + "strictInjectionParameters": true, + "strictInputAccessModifiers": true, + "strictTemplates": true + } +} diff --git a/test-angular-versions/v18-standalone/tsconfig.spec.json b/test-angular-versions/v18-standalone/tsconfig.spec.json new file mode 100644 index 00000000..5fb748d9 --- /dev/null +++ b/test-angular-versions/v18-standalone/tsconfig.spec.json @@ -0,0 +1,15 @@ +/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */ +/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "./out-tsc/spec", + "types": [ + "jasmine" + ] + }, + "include": [ + "src/**/*.spec.ts", + "src/**/*.d.ts" + ] +} From 6942ca9d9ee08c8fc06fa44cbb8e1385127c131c Mon Sep 17 00:00:00 2001 From: Rolando Date: Fri, 30 Aug 2024 17:47:58 -0400 Subject: [PATCH 12/16] Added standalone version for downstream projects. --- downstream_projects.json | 1 + 1 file changed, 1 insertion(+) diff --git a/downstream_projects.json b/downstream_projects.json index dfce8b08..3f8d8d66 100644 --- a/downstream_projects.json +++ b/downstream_projects.json @@ -3,6 +3,7 @@ "projects": { "sample-app-angular": "https://github.com/lindolo25/sample-app-angular.git", "angular18": "./test-angular-versions/v18", + "angular18standalone": "./test-angular-versions/v18-standalone", "typescript54": "./test-typescript-versions/typescript5.4" } } From 810ea5baaa2b8e1bf73468aa559bc1369f1c4b80 Mon Sep 17 00:00:00 2001 From: Rolando Date: Fri, 30 Aug 2024 17:54:47 -0400 Subject: [PATCH 13/16] Updated package minor version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 304e7dda..90b77308 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@uirouter/angular", "description": "State-based routing for Angular", - "version": "14.0.0", + "version": "14.1.0", "scripts": { "clean": "shx rm -rf lib lib-esm _bundles _doc dist", "compile": "npm run clean && ngc", From 749a695d2e8f961975a72e7d5959cb0d15fb2db3 Mon Sep 17 00:00:00 2001 From: Rolando Date: Fri, 25 Oct 2024 22:19:21 -0400 Subject: [PATCH 14/16] Add documentation for provideUIRouter() function. --- src/provideUiRouter.ts | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/provideUiRouter.ts b/src/provideUiRouter.ts index d429019e..4cfe3390 100644 --- a/src/provideUiRouter.ts +++ b/src/provideUiRouter.ts @@ -2,6 +2,31 @@ import { EnvironmentProviders, makeEnvironmentProviders } from "@angular/core"; import { locationStrategy, makeRootProviders, RootModule } from "./uiRouterNgModule"; import { _UIROUTER_INSTANCE_PROVIDERS, _UIROUTER_SERVICE_PROVIDERS } from "./providers"; +/** + * Sets up providers necessary to enable UI-Router for the application. Intended as a replacement + * for [[UIRouterModule.forRoot]] in newer standalone based applications. + * + * Example: + * ```js + * const routerConfig = { + * otherwise: '/home', + * states: [homeState, aboutState] + * }; + * + * const appConfig: ApplicationConfig = { + * providers: [ + * provideZoneChangeDetection({ eventCoalescing: true }), + * provideUIRouter(routerConfig) + * ] + * }; + * + * bootstrapApplication(AppComponent, appConfig) + * .catch((err) => console.error(err)); + * ``` + * + * @param config declarative UI-Router configuration + * @returns an `EnvironmentProviders` which provides the [[UIRouter]] singleton instance + */ export function provideUIRouter(config: RootModule = {}): EnvironmentProviders { return makeEnvironmentProviders([ _UIROUTER_INSTANCE_PROVIDERS, From 631857664321a04c305111408d5fa7e0fcdd9440 Mon Sep 17 00:00:00 2001 From: Rolando Date: Tue, 29 Oct 2024 20:47:53 -0400 Subject: [PATCH 15/16] Revert "Updated downstream sample app for the tests." This reverts commit 2955b86a25166e33af77e82857d5abb891ee4900. --- downstream_projects.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/downstream_projects.json b/downstream_projects.json index 3f8d8d66..3b0d6723 100644 --- a/downstream_projects.json +++ b/downstream_projects.json @@ -1,7 +1,7 @@ { "packageDir": "./dist", "projects": { - "sample-app-angular": "https://github.com/lindolo25/sample-app-angular.git", + "sample-app-angular": "https://github.com/ui-router/sample-app-angular.git", "angular18": "./test-angular-versions/v18", "angular18standalone": "./test-angular-versions/v18-standalone", "typescript54": "./test-typescript-versions/typescript5.4" From e765688ddbd2b4318016c2466575062819947584 Mon Sep 17 00:00:00 2001 From: Rolando Date: Wed, 30 Oct 2024 13:47:05 -0400 Subject: [PATCH 16/16] updated package version from 14.1.0 to 15.0.0. This change is introducing a potencial breaking change if projects use ui-view component as the bootstrap component. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 90b77308..d6b9a4de 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@uirouter/angular", "description": "State-based routing for Angular", - "version": "14.1.0", + "version": "15.0.0", "scripts": { "clean": "shx rm -rf lib lib-esm _bundles _doc dist", "compile": "npm run clean && ngc",