add components from angular-lib

This commit is contained in:
Tykayn 2025-08-07 14:24:23 +02:00 committed by tykayn
parent 3c429c42f4
commit 834d1521f0
100 changed files with 33352 additions and 0 deletions

View file

@ -0,0 +1,17 @@
# Editor configuration, see https://editorconfig.org
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
[*.ts]
quote_type = single
ij_typescript_use_double_quotes = false
[*.md]
max_line_length = off
trim_trailing_whitespace = false

42
my-workspace/.gitignore vendored Normal file
View file

@ -0,0 +1,42 @@
# See https://docs.github.com/get-started/getting-started-with-git/ignoring-files for more about ignoring files.
# Compiled output
/dist
/tmp
/out-tsc
/bazel-out
# Node
/node_modules
npm-debug.log
yarn-error.log
# IDEs and editors
.idea/
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace
# Visual Studio Code
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history/*
# Miscellaneous
/.angular/cache
.sass-cache/
/connect.lock
/coverage
/libpeerconnection.log
testem.log
/typings
# System files
.DS_Store
Thumbs.db

59
my-workspace/README.md Normal file
View file

@ -0,0 +1,59 @@
# MyWorkspace
This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 20.1.4.
## Development server
To start a local development server, run:
```bash
ng serve
```
Once the server is running, open your browser and navigate to `http://localhost:4200/`. The application will automatically reload whenever you modify any of the source files.
## Code scaffolding
Angular CLI includes powerful code scaffolding tools. To generate a new component, run:
```bash
ng generate component component-name
```
For a complete list of available schematics (such as `components`, `directives`, or `pipes`), run:
```bash
ng generate --help
```
## Building
To build the project run:
```bash
ng build
```
This will compile your project and store the build artifacts in the `dist/` directory. By default, the production build optimizes your application for performance and speed.
## Running unit tests
To execute unit tests with the [Karma](https://karma-runner.github.io) test runner, use the following command:
```bash
ng test
```
## Running end-to-end tests
For end-to-end (e2e) testing, run:
```bash
ng e2e
```
Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.
## Additional Resources
For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.

48
my-workspace/angular.json Normal file
View file

@ -0,0 +1,48 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"my-lib": {
"projectType": "library",
"root": "projects/my-lib",
"sourceRoot": "projects/my-lib/src",
"prefix": "lib",
"architect": {
"build": {
"builder": "@angular/build:ng-packagr",
"configurations": {
"production": {
"tsConfig": "projects/my-lib/tsconfig.lib.prod.json"
},
"development": {
"tsConfig": "projects/my-lib/tsconfig.lib.json"
}
},
"defaultConfiguration": "production"
},
"test": {
"builder": "@angular/build:karma",
"options": {
"tsConfig": "projects/my-lib/tsconfig.spec.json"
}
},
"lint": {
"builder": "@angular-eslint/builder:lint",
"options": {
"lintFilePatterns": [
"projects/my-lib/**/*.ts",
"projects/my-lib/**/*.html"
],
"eslintConfig": "projects/my-lib/eslint.config.js"
}
}
}
}
},
"cli": {
"schematicCollections": [
"angular-eslint"
]
}
}

View file

@ -0,0 +1,43 @@
// @ts-check
const eslint = require("@eslint/js");
const tseslint = require("typescript-eslint");
const angular = require("angular-eslint");
module.exports = tseslint.config(
{
files: ["**/*.ts"],
extends: [
eslint.configs.recommended,
...tseslint.configs.recommended,
...tseslint.configs.stylistic,
...angular.configs.tsRecommended,
],
processor: angular.processInlineTemplates,
rules: {
"@angular-eslint/directive-selector": [
"error",
{
type: "attribute",
prefix: "lib",
style: "camelCase",
},
],
"@angular-eslint/component-selector": [
"error",
{
type: "element",
prefix: "lib",
style: "kebab-case",
},
],
},
},
{
files: ["**/*.html"],
extends: [
...angular.configs.templateRecommended,
...angular.configs.templateAccessibility,
],
rules: {},
}
);

12142
my-workspace/package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

50
my-workspace/package.json Normal file
View file

@ -0,0 +1,50 @@
{
"name": "my-workspace",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "ng test",
"lint": "ng lint"
},
"prettier": {
"overrides": [
{
"files": "*.html",
"options": {
"parser": "angular"
}
}
]
},
"private": true,
"dependencies": {
"@angular/common": "^20.1.0",
"@angular/compiler": "^20.1.0",
"@angular/core": "^20.1.0",
"@angular/forms": "^20.1.0",
"@angular/platform-browser": "^20.1.0",
"@angular/router": "^20.1.0",
"rxjs": "~7.8.0",
"tslib": "^2.3.0"
},
"devDependencies": {
"@angular/build": "^20.1.5",
"@angular/cli": "^20.1.4",
"@angular/compiler-cli": "^20.1.0",
"@types/jasmine": "~5.1.0",
"angular-eslint": "20.1.1",
"eslint": "^9.29.0",
"jasmine-core": "~5.8.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",
"ng-packagr": "^20.1.0",
"typescript": "~5.8.2",
"typescript-eslint": "8.34.1"
}
}

View file

@ -0,0 +1,63 @@
# MyLib
This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 20.1.0.
## Code scaffolding
Angular CLI includes powerful code scaffolding tools. To generate a new component, run:
```bash
ng generate component component-name
```
For a complete list of available schematics (such as `components`, `directives`, or `pipes`), run:
```bash
ng generate --help
```
## Building
To build the library, run:
```bash
ng build my-lib
```
This command will compile your project, and the build artifacts will be placed in the `dist/` directory.
### Publishing the Library
Once the project is built, you can publish your library by following these steps:
1. Navigate to the `dist` directory:
```bash
cd dist/my-lib
```
2. Run the `npm publish` command to publish your library to the npm registry:
```bash
npm publish
```
## Running unit tests
To execute unit tests with the [Karma](https://karma-runner.github.io) test runner, use the following command:
```bash
ng test
```
## Running end-to-end tests
For end-to-end (e2e) testing, run:
```bash
ng e2e
```
Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.
## Additional Resources
For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.

View file

@ -0,0 +1,15 @@
<div class="color-box"
[ngStyle]="{ background: backgroundColor, 'border-color': backgroundColor }"
>
<div class="top" >
</div>
<div class="bottom">
<div class="name">
{{name}}
</div>
<div class="hexacode">
{{hexaCode}}
</div>
</div>
</div>

View file

@ -0,0 +1,31 @@
:host {
display: inline-block;
width: 100%;
height: 11.4rem;
border-radius: 0.5rem;
border: solid 2px transparent;
box-shadow: 0 5px 10px #eee;
color: #aaa;
.top {
height: 8rem;
}
.bottom {
border: solid 1px #aaa;
border-bottom-left-radius: 0.25rem;
border-bottom-right-radius: 0.25rem;
}
.name{
color: #333;
}
.name, .hexacode {
padding: 0.5rem;
background: white;
}
.hexacode{
padding-top:0;
font-size: 0.8rem;
}
}

View file

@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ColorDisplay } from './color-display';
describe('ColorDisplay', () => {
let component: ColorDisplay;
let fixture: ComponentFixture<ColorDisplay>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [ColorDisplay]
})
.compileComponents();
fixture = TestBed.createComponent(ColorDisplay);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View file

@ -0,0 +1,23 @@
import {Component, Input, OnInit} from '@angular/core';
import {CommonModule} from '@angular/common';
@Component({
selector: 'lib-color-display',
standalone: true,
imports: [
CommonModule
],
templateUrl: './color-display.html',
styleUrl: './color-display.scss'
})
export class ColorDisplay implements OnInit {
@Input() public hexaCode: string = '#cc0000';
@Input() public name: string = 'color name';
@Input() public backgroundColor: string = '';
ngOnInit() {
if (this.hexaCode) {
this.backgroundColor = this.hexaCode
}
}
}

View file

@ -0,0 +1,32 @@
// @ts-check
const tseslint = require("typescript-eslint");
const rootConfig = require("../../eslint.config.js");
module.exports = tseslint.config(
...rootConfig,
{
files: ["**/*.ts"],
rules: {
"@angular-eslint/directive-selector": [
"error",
{
type: "attribute",
prefix: "lib",
style: "camelCase",
},
],
"@angular-eslint/component-selector": [
"error",
{
type: "element",
prefix: "lib",
style: "kebab-case",
},
],
},
},
{
files: ["**/*.html"],
rules: {},
}
);

View file

@ -0,0 +1,3 @@
<div class="essai">
<h1>essai composant depuis la lib</h1>
</div>

View file

@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { Essai } from './essai';
describe('Essai', () => {
let component: Essai;
let fixture: ComponentFixture<Essai>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [Essai]
})
.compileComponents();
fixture = TestBed.createComponent(Essai);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View file

@ -0,0 +1,11 @@
import { Component } from '@angular/core';
@Component({
selector: 'lib-essai',
imports: [],
templateUrl: './essai.html',
styleUrl: './essai.css'
})
export class Essai {
}

View file

@ -0,0 +1,7 @@
{
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../dist/my-lib",
"lib": {
"entryFile": "src/public-api.ts"
}
}

View file

@ -0,0 +1,12 @@
{
"name": "my-lib",
"version": "0.0.1",
"peerDependencies": {
"@angular/common": "^20.1.0",
"@angular/core": "^20.1.0"
},
"dependencies": {
"tslib": "^2.3.0"
},
"sideEffects": false
}

View file

@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { MyLib } from './my-lib';
describe('MyLib', () => {
let component: MyLib;
let fixture: ComponentFixture<MyLib>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [MyLib]
})
.compileComponents();
fixture = TestBed.createComponent(MyLib);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View file

@ -0,0 +1,15 @@
import { Component } from '@angular/core';
@Component({
selector: 'lib-my-lib',
imports: [],
template: `
<p>
my-lib works!
</p>
`,
styles: ``
})
export class MyLib {
}

View file

@ -0,0 +1,5 @@
/*
* Public API Surface of my-lib
*/
export * from './lib/my-lib';

View file

@ -0,0 +1,18 @@
/* 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/lib",
"declaration": true,
"declarationMap": true,
"inlineSources": true,
"types": []
},
"include": [
"src/**/*.ts"
],
"exclude": [
"**/*.spec.ts"
]
}

View file

@ -0,0 +1,11 @@
/* 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.lib.json",
"compilerOptions": {
"declarationMap": false
},
"angularCompilerOptions": {
"compilationMode": "partial"
}
}

View file

@ -0,0 +1,14 @@
/* 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/**/*.ts"
]
}

View file

@ -0,0 +1,39 @@
/* 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": {
"strict": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"noImplicitReturns": true,
"paths": {
"my-lib": [
"./dist/my-lib"
]
},
"noFallthroughCasesInSwitch": true,
"skipLibCheck": true,
"isolatedModules": true,
"experimentalDecorators": true,
"importHelpers": true,
"target": "ES2022",
"module": "preserve"
},
"angularCompilerOptions": {
"enableI18nLegacyMessageIdFormat": false,
"strictInjectionParameters": true,
"strictInputAccessModifiers": true,
"typeCheckHostBindings": true,
"strictTemplates": true
},
"files": [],
"references": [
{
"path": "./projects/my-lib/tsconfig.lib.json"
},
{
"path": "./projects/my-lib/tsconfig.spec.json"
}
]
}