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,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"
]
}