forked from tomalaforge/angular-challenges
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c079542
commit e04ac11
Showing
25 changed files
with
369 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"extends": ["../../../.eslintrc.json"], | ||
"ignorePatterns": ["!**/*"], | ||
"overrides": [ | ||
{ | ||
"files": ["*.ts"], | ||
"extends": [ | ||
"plugin:@nx/angular", | ||
"plugin:@angular-eslint/template/process-inline-templates" | ||
], | ||
"rules": { | ||
"@angular-eslint/directive-selector": [ | ||
"error", | ||
{ | ||
"type": "attribute", | ||
"prefix": "app", | ||
"style": "camelCase" | ||
} | ||
], | ||
"@angular-eslint/component-selector": [ | ||
"error", | ||
{ | ||
"type": "element", | ||
"prefix": "app", | ||
"style": "kebab-case" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"files": ["*.html"], | ||
"extends": ["plugin:@nx/angular-template"], | ||
"rules": {} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# View Transition | ||
|
||
> author: thomas-laforge | ||
### Run Application | ||
|
||
```bash | ||
npx nx serve angular-view-transition | ||
``` | ||
|
||
### Documentation and Instruction | ||
|
||
Challenge documentation is [here](https://angular-challenges.vercel.app/challenges/angular/44-view-transition/). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
{ | ||
"name": "angular-view-transition", | ||
"$schema": "../../../node_modules/nx/schemas/project-schema.json", | ||
"projectType": "application", | ||
"prefix": "app", | ||
"sourceRoot": "apps/angular/view-transition/src", | ||
"tags": [], | ||
"targets": { | ||
"build": { | ||
"executor": "@angular-devkit/build-angular:application", | ||
"outputs": ["{options.outputPath}"], | ||
"options": { | ||
"outputPath": "dist/apps/angular/view-transition", | ||
"index": "apps/angular/view-transition/src/index.html", | ||
"browser": "apps/angular/view-transition/src/main.ts", | ||
"polyfills": ["zone.js"], | ||
"tsConfig": "apps/angular/view-transition/tsconfig.app.json", | ||
"inlineStyleLanguage": "scss", | ||
"assets": [ | ||
"apps/angular/view-transition/src/favicon.ico", | ||
"apps/angular/view-transition/src/assets" | ||
], | ||
"styles": ["apps/angular/view-transition/src/styles.scss"], | ||
"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": { | ||
"executor": "@angular-devkit/build-angular:dev-server", | ||
"configurations": { | ||
"production": { | ||
"buildTarget": "angular-view-transition:build:production" | ||
}, | ||
"development": { | ||
"buildTarget": "angular-view-transition:build:development" | ||
} | ||
}, | ||
"defaultConfiguration": "development" | ||
}, | ||
"extract-i18n": { | ||
"executor": "@angular-devkit/build-angular:extract-i18n", | ||
"options": { | ||
"buildTarget": "angular-view-transition:build" | ||
} | ||
}, | ||
"lint": { | ||
"executor": "@nx/eslint:lint", | ||
"outputs": ["{options.outputFile}"] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { Component } from '@angular/core'; | ||
import { RouterLink, RouterOutlet } from '@angular/router'; | ||
|
||
@Component({ | ||
standalone: true, | ||
imports: [RouterLink, RouterOutlet], | ||
selector: 'app-root', | ||
template: ` | ||
<div class="flex gap-3"> | ||
<button | ||
class="rounded-md border border-blue-500 bg-blue-200 px-4 py-2 text-xl" | ||
routerLink="foo"> | ||
Foo | ||
</button> | ||
<button | ||
class="rounded-md border border-blue-500 bg-blue-200 px-4 py-2 text-xl" | ||
routerLink="bar"> | ||
Bar | ||
</button> | ||
</div> | ||
<router-outlet /> | ||
`, | ||
host: { | ||
class: 'flex flex-col gap-10 border p-10 h-screen', | ||
}, | ||
styles: [''], | ||
}) | ||
export class AppComponent {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { ApplicationConfig } from '@angular/core'; | ||
import { provideRouter, withViewTransitions } from '@angular/router'; | ||
|
||
export const appConfig: ApplicationConfig = { | ||
providers: [ | ||
provideRouter( | ||
[ | ||
{ path: 'bar', loadComponent: () => import('./bar.component') }, | ||
{ path: 'foo', loadComponent: () => import('./foo.component') }, | ||
], | ||
withViewTransitions(), | ||
), | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { Component } from '@angular/core'; | ||
@Component({ | ||
selector: 'app-bar', | ||
standalone: true, | ||
imports: [], | ||
template: ` | ||
bar-component | ||
`, | ||
host: { | ||
class: 'block h-full bg-green-500', | ||
}, | ||
}) | ||
export default class BarComponent {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'app-foo', | ||
standalone: true, | ||
imports: [], | ||
template: ` | ||
<div class="count">app-foo</div> | ||
`, | ||
host: { | ||
class: 'block h-full bg-red-500', | ||
}, | ||
styles: ` | ||
.count { | ||
view-transition-name: count; | ||
width: fit-content | ||
} | ||
`, | ||
}) | ||
export default class FooComponent {} |
Empty file.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>angular-view-transition</title> | ||
<base href="/" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<link rel="icon" type="image/x-icon" href="favicon.ico" /> | ||
</head> | ||
<body> | ||
<app-root></app-root> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { bootstrapApplication } from '@angular/platform-browser'; | ||
import { AppComponent } from './app/app.component'; | ||
import { appConfig } from './app/app.config'; | ||
|
||
bootstrapApplication(AppComponent, appConfig).catch((err) => | ||
console.error(err), | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
@tailwind base; | ||
@tailwind components; | ||
@tailwind utilities; | ||
|
||
@keyframes fade-in { | ||
from { | ||
opacity: 0; | ||
} | ||
} | ||
|
||
@keyframes fade-out { | ||
to { | ||
opacity: 0; | ||
} | ||
} | ||
|
||
@keyframes slide-from-right { | ||
from { | ||
transform: translateX(30px); | ||
} | ||
} | ||
|
||
@keyframes slide-to-left { | ||
to { | ||
transform: translateX(-30px); | ||
} | ||
} | ||
|
||
::view-transition-old(root) { | ||
animation: | ||
90ms cubic-bezier(0.4, 0, 1, 1) both fade-out, | ||
300ms cubic-bezier(0.4, 0, 0.2, 1) both slide-to-left; | ||
} | ||
|
||
::view-transition-new(root) { | ||
animation: | ||
210ms cubic-bezier(0, 0, 0.2, 1) 90ms both fade-in, | ||
300ms cubic-bezier(0.4, 0, 0.2, 1) both slide-from-right; | ||
} | ||
|
||
@keyframes rotate { | ||
from { | ||
transform: rotate(0deg); | ||
} | ||
to { | ||
transform: rotate(360deg); | ||
} | ||
} | ||
::view-transition-new(count) { | ||
animation: rotate 2s linear; | ||
} | ||
::view-transition-old(count) { | ||
animation: rotate 0.5s linear; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
const { createGlobPatternsForDependencies } = require('@nx/angular/tailwind'); | ||
const { join } = require('path'); | ||
|
||
/** @type {import('tailwindcss').Config} */ | ||
module.exports = { | ||
content: [ | ||
join(__dirname, 'src/**/!(*.stories|*.spec).{ts,html}'), | ||
...createGlobPatternsForDependencies(__dirname), | ||
], | ||
theme: { | ||
extend: {}, | ||
}, | ||
plugins: [], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "../../../dist/out-tsc", | ||
"types": [] | ||
}, | ||
"files": ["src/main.ts"], | ||
"include": ["src/**/*.d.ts"], | ||
"exclude": ["jest.config.ts", "src/**/*.test.ts", "src/**/*.spec.ts"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"include": ["src/**/*.ts"], | ||
"compilerOptions": { | ||
"types": [] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es2022", | ||
"useDefineForClassFields": false, | ||
"esModuleInterop": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"strict": true, | ||
"noImplicitOverride": true, | ||
"noPropertyAccessFromIndexSignature": true, | ||
"noImplicitReturns": true, | ||
"noFallthroughCasesInSwitch": true, | ||
}, | ||
"files": [], | ||
"include": [], | ||
"references": [ | ||
{ | ||
"path": "./tsconfig.app.json", | ||
}, | ||
{ | ||
"path": "./tsconfig.editor.json", | ||
}, | ||
], | ||
"extends": "../../../tsconfig.base.json", | ||
"angularCompilerOptions": { | ||
"enableI18nLegacyMessageIdFormat": false, | ||
"strictInjectionParameters": true, | ||
"strictInputAccessModifiers": true, | ||
"strictTemplates": true, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"total": 43, | ||
"total": 44, | ||
"🟢": 16, | ||
"🟠": 120, | ||
"🟠": 121, | ||
"🔴": 207 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,6 @@ challengeNumber: 43 | |
command: angular-signal-input | ||
sidebar: | ||
order: 16 | ||
badge: New | ||
--- | ||
|
||
## Information | ||
|
20 changes: 20 additions & 0 deletions
20
docs/src/content/docs/challenges/angular/44-view-transition.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
title: 🟠 View Transition | ||
description: Challenge 44 is about ... | ||
author: thomas-laforge | ||
challengeNumber: 44 | ||
command: angular-view-transition | ||
sidebar: | ||
order: 121 | ||
badge: New | ||
--- | ||
|
||
:::note | ||
WIP: The following documentation need to be written. | ||
::: | ||
|
||
## Information | ||
|
||
## Statement | ||
|
||
## Constraints |
Oops, something went wrong.