@wanderleedev/color-lib 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +64 -0
- package/fesm2022/color-lib.mjs +42 -0
- package/fesm2022/color-lib.mjs.map +1 -0
- package/package.json +28 -0
- package/schematics/collection.json +10 -0
- package/schematics/ng-add/files/color-lib.config.ts.template +4 -0
- package/schematics/ng-add/index.d.ts +3 -0
- package/schematics/ng-add/index.js +104 -0
- package/schematics/ng-add/index.js.map +1 -0
- package/schematics/ng-add/schema.d.ts +6 -0
- package/schematics/ng-add/schema.js +3 -0
- package/schematics/ng-add/schema.js.map +1 -0
- package/schematics/ng-add/schema.json +21 -0
- package/types/color-lib.d.ts +22 -0
package/README.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# ColorLib
|
|
2
|
+
|
|
3
|
+
This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 21.2.0.
|
|
4
|
+
|
|
5
|
+
## Code scaffolding
|
|
6
|
+
|
|
7
|
+
Angular CLI includes powerful code scaffolding tools. To generate a new component, run:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
ng generate component component-name
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
For a complete list of available schematics (such as `components`, `directives`, or `pipes`), run:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
ng generate --help
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Building
|
|
20
|
+
|
|
21
|
+
To build the library, run:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
ng build color-lib
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
This command will compile your project, and the build artifacts will be placed in the `dist/` directory.
|
|
28
|
+
|
|
29
|
+
### Publishing the Library
|
|
30
|
+
|
|
31
|
+
Once the project is built, you can publish your library by following these steps:
|
|
32
|
+
|
|
33
|
+
1. Navigate to the `dist` directory:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
cd dist/color-lib
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
2. Run the `npm publish` command to publish your library to the npm registry:
|
|
40
|
+
```bash
|
|
41
|
+
npm publish
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Running unit tests
|
|
45
|
+
|
|
46
|
+
To execute unit tests with the [Karma](https://karma-runner.github.io) test runner, use the following command:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
ng test
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Running end-to-end tests
|
|
53
|
+
|
|
54
|
+
For end-to-end (e2e) testing, run:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
ng e2e
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.
|
|
61
|
+
|
|
62
|
+
## Additional Resources
|
|
63
|
+
|
|
64
|
+
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.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { InjectionToken, inject, Injectable } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Token para inyectar el color favorito configurado via ng-add.
|
|
6
|
+
*
|
|
7
|
+
* Registro manual (si no usaste ng-add):
|
|
8
|
+
* providers: [{ provide: COLOR_LIB_COLOR, useValue: 'blue' }]
|
|
9
|
+
*/
|
|
10
|
+
const COLOR_LIB_COLOR = new InjectionToken('COLOR_LIB_COLOR', {
|
|
11
|
+
providedIn: 'root',
|
|
12
|
+
factory: () => 'blue', // valor por defecto
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
class ColorService {
|
|
16
|
+
color = inject(COLOR_LIB_COLOR);
|
|
17
|
+
/** Retorna el color favorito configurado. */
|
|
18
|
+
getColor() {
|
|
19
|
+
return this.color;
|
|
20
|
+
}
|
|
21
|
+
/** Loguea el color favorito en consola con estilo CSS. */
|
|
22
|
+
logColor() {
|
|
23
|
+
console.log(`%c 🎨 Tu color favorito es: ${this.color} `, `background:${this.color}; color:#fff; font-size:14px; padding:4px 8px; border-radius:4px;`);
|
|
24
|
+
}
|
|
25
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.7", ngImport: i0, type: ColorService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
26
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.7", ngImport: i0, type: ColorService, providedIn: 'root' });
|
|
27
|
+
}
|
|
28
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.7", ngImport: i0, type: ColorService, decorators: [{
|
|
29
|
+
type: Injectable,
|
|
30
|
+
args: [{ providedIn: 'root' }]
|
|
31
|
+
}] });
|
|
32
|
+
|
|
33
|
+
/*
|
|
34
|
+
* Public API Surface of color-lib
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Generated bundle index. Do not edit.
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
export { COLOR_LIB_COLOR, ColorService };
|
|
42
|
+
//# sourceMappingURL=color-lib.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color-lib.mjs","sources":["../../../projects/color-lib/src/lib/color.token.ts","../../../projects/color-lib/src/lib/color.service.ts","../../../projects/color-lib/src/public-api.ts","../../../projects/color-lib/src/color-lib.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\n\n/**\n * Token para inyectar el color favorito configurado via ng-add.\n *\n * Registro manual (si no usaste ng-add):\n * providers: [{ provide: COLOR_LIB_COLOR, useValue: 'blue' }]\n */\nexport const COLOR_LIB_COLOR = new InjectionToken<string>('COLOR_LIB_COLOR', {\n providedIn: 'root',\n factory: () => 'blue', // valor por defecto\n});\n","import { Injectable, inject } from '@angular/core';\nimport { COLOR_LIB_COLOR } from './color.token';\n\n@Injectable({ providedIn: 'root' })\nexport class ColorService {\n private readonly color = inject(COLOR_LIB_COLOR);\n\n /** Retorna el color favorito configurado. */\n getColor(): string {\n return this.color;\n }\n\n /** Loguea el color favorito en consola con estilo CSS. */\n logColor(): void {\n console.log(\n `%c 🎨 Tu color favorito es: ${this.color} `,\n `background:${this.color}; color:#fff; font-size:14px; padding:4px 8px; border-radius:4px;`\n );\n }\n}\n","/*\n * Public API Surface of color-lib\n */\n\nexport { ColorService } from './lib/color.service';\nexport { COLOR_LIB_COLOR } from './lib/color.token';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;AAEA;;;;;AAKG;MACU,eAAe,GAAG,IAAI,cAAc,CAAS,iBAAiB,EAAE;AAC3E,IAAA,UAAU,EAAE,MAAM;AAClB,IAAA,OAAO,EAAE,MAAM,MAAM;AACtB,CAAA;;MCPY,YAAY,CAAA;AACN,IAAA,KAAK,GAAG,MAAM,CAAC,eAAe,CAAC;;IAGhD,QAAQ,GAAA;QACN,OAAO,IAAI,CAAC,KAAK;IACnB;;IAGA,QAAQ,GAAA;AACN,QAAA,OAAO,CAAC,GAAG,CACT,CAAA,4BAAA,EAA+B,IAAI,CAAC,KAAK,CAAA,CAAA,CAAG,EAC5C,cAAc,IAAI,CAAC,KAAK,CAAA,iEAAA,CAAmE,CAC5F;IACH;uGAdW,YAAY,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAZ,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,YAAY,cADC,MAAM,EAAA,CAAA;;2FACnB,YAAY,EAAA,UAAA,EAAA,CAAA;kBADxB,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;ACHlC;;AAEG;;ACFH;;AAEG;;;;"}
|
package/package.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@wanderleedev/color-lib",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"peerDependencies": {
|
|
5
|
+
"@angular/common": "^21.2.0",
|
|
6
|
+
"@angular/core": "^21.2.0"
|
|
7
|
+
},
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"tslib": "^2.3.0"
|
|
10
|
+
},
|
|
11
|
+
"sideEffects": false,
|
|
12
|
+
"schematics": "./schematics/collection.json",
|
|
13
|
+
"ng-add": {
|
|
14
|
+
"save": "dependencies"
|
|
15
|
+
},
|
|
16
|
+
"module": "fesm2022/color-lib.mjs",
|
|
17
|
+
"typings": "types/color-lib.d.ts",
|
|
18
|
+
"exports": {
|
|
19
|
+
"./package.json": {
|
|
20
|
+
"default": "./package.json"
|
|
21
|
+
},
|
|
22
|
+
".": {
|
|
23
|
+
"types": "./types/color-lib.d.ts",
|
|
24
|
+
"default": "./fesm2022/color-lib.mjs"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"type": "module"
|
|
28
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ngAdd = ngAdd;
|
|
13
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
14
|
+
const core_1 = require("@angular-devkit/core");
|
|
15
|
+
function createHost(tree) {
|
|
16
|
+
return {
|
|
17
|
+
readFile(path) {
|
|
18
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
const data = tree.read(path);
|
|
20
|
+
if (!data) {
|
|
21
|
+
throw new schematics_1.SchematicsException(`File not found: ${path}`);
|
|
22
|
+
}
|
|
23
|
+
return data.toString('utf-8');
|
|
24
|
+
});
|
|
25
|
+
},
|
|
26
|
+
writeFile(path, data) {
|
|
27
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
return tree.overwrite(path, data);
|
|
29
|
+
});
|
|
30
|
+
},
|
|
31
|
+
isDirectory(path) {
|
|
32
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
return !tree.exists(path) && tree.getDir(path).subfiles.length > 0;
|
|
34
|
+
});
|
|
35
|
+
},
|
|
36
|
+
isFile(path) {
|
|
37
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
return tree.exists(path);
|
|
39
|
+
});
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
function ngAdd(options) {
|
|
44
|
+
return (tree) => __awaiter(this, void 0, void 0, function* () {
|
|
45
|
+
var _a;
|
|
46
|
+
// ── 1. Leer workspace angular.json ────────────────────────────────────
|
|
47
|
+
const host = createHost(tree);
|
|
48
|
+
const { workspace } = yield core_1.workspaces.readWorkspace('/', host);
|
|
49
|
+
// ── 2. Resolver el proyecto destino ───────────────────────────────────
|
|
50
|
+
const projectName = (_a = options.project) !== null && _a !== void 0 ? _a : workspace.extensions['defaultProject'];
|
|
51
|
+
const project = projectName ? workspace.projects.get(projectName) : null;
|
|
52
|
+
if (!project) {
|
|
53
|
+
throw new schematics_1.SchematicsException(`Proyecto "${projectName}" no encontrado en angular.json. ` +
|
|
54
|
+
`Usa --project=<nombre> para especificarlo.`);
|
|
55
|
+
}
|
|
56
|
+
const projectType = project.extensions['projectType'] === 'application' ? 'app' : 'lib';
|
|
57
|
+
const srcPath = `${project.sourceRoot}/${projectType}`;
|
|
58
|
+
// ── 3. Generar color-lib.config.ts desde template ─────────────────────
|
|
59
|
+
const templateSource = (0, schematics_1.apply)((0, schematics_1.url)('./files'), [
|
|
60
|
+
(0, schematics_1.applyTemplates)({
|
|
61
|
+
color: options.color,
|
|
62
|
+
projectName: projectName,
|
|
63
|
+
}),
|
|
64
|
+
(0, schematics_1.move)((0, core_1.normalize)(srcPath)),
|
|
65
|
+
]);
|
|
66
|
+
// ── 4. Inyectar provider en app.config.ts o app.module.ts ─────────────
|
|
67
|
+
const registerProvider = (hostTree) => {
|
|
68
|
+
const appConfigPath = `${srcPath}/app.config.ts`;
|
|
69
|
+
const appModulePath = `${srcPath}/app.module.ts`;
|
|
70
|
+
if (hostTree.exists(appConfigPath)) {
|
|
71
|
+
let content = hostTree.read(appConfigPath).toString('utf-8');
|
|
72
|
+
if (!content.includes('color-lib')) {
|
|
73
|
+
const importLine = `import { COLOR_LIB_COLOR } from 'color-lib';\n` +
|
|
74
|
+
`import { COLOR } from './color-lib.config';\n`;
|
|
75
|
+
content = importLine + content;
|
|
76
|
+
content = content.replace(/providers\s*:\s*\[/, `providers: [\n { provide: COLOR_LIB_COLOR, useValue: COLOR },`);
|
|
77
|
+
hostTree.overwrite(appConfigPath, content);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
else if (hostTree.exists(appModulePath)) {
|
|
81
|
+
let content = hostTree.read(appModulePath).toString('utf-8');
|
|
82
|
+
if (!content.includes('color-lib')) {
|
|
83
|
+
const importLine = `import { COLOR_LIB_COLOR } from 'color-lib';\n` +
|
|
84
|
+
`import { COLOR } from './color-lib.config';\n`;
|
|
85
|
+
content = importLine + content;
|
|
86
|
+
content = content.replace(/providers\s*:\s*\[/, `providers: [\n { provide: COLOR_LIB_COLOR, useValue: COLOR },`);
|
|
87
|
+
hostTree.overwrite(appModulePath, content);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
console.warn(`\n⚠️ No se encontró app.config.ts ni app.module.ts en "${srcPath}".\n` +
|
|
92
|
+
` Registra manualmente el provider:\n` +
|
|
93
|
+
` { provide: COLOR_LIB_COLOR, useValue: COLOR }\n` +
|
|
94
|
+
` importando COLOR desde './color-lib.config'\n`);
|
|
95
|
+
}
|
|
96
|
+
return hostTree;
|
|
97
|
+
};
|
|
98
|
+
return (0, schematics_1.chain)([
|
|
99
|
+
(0, schematics_1.mergeWith)(templateSource),
|
|
100
|
+
registerProvider,
|
|
101
|
+
]);
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../projects/color-lib/schematics/ng-add/index.ts"],"names":[],"mappings":";;;;;;;;;;;AAmCA,sBAmFC;AAtHD,2DAUoC;AACpC,+CAA6D;AAG7D,SAAS,UAAU,CAAC,IAAU;IAC5B,OAAO;QACC,QAAQ,CAAC,IAAY;;gBACzB,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBAC7B,IAAI,CAAC,IAAI,EAAE,CAAC;oBACV,MAAM,IAAI,gCAAmB,CAAC,mBAAmB,IAAI,EAAE,CAAC,CAAC;gBAC3D,CAAC;gBACD,OAAO,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;YAChC,CAAC;SAAA;QACK,SAAS,CAAC,IAAY,EAAE,IAAY;;gBACxC,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;YACpC,CAAC;SAAA;QACK,WAAW,CAAC,IAAY;;gBAC5B,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,QAAQ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AO,MAAM;oBACxE,wCAAwC;oBACxC,oDAAoD;oBACpD,kDAAkD,CACnD,CAAC;YACJ,CAAC;YAED,OAAO,QAAQ,CAAC;QAClB,CAAC,CAAC;QAEF,OAAO,IAAA,kBAAK,EAAC;YACX,IAAA,sBAAS,EAAC,cAAc,CAAC;YACzB,gBAAgB;SACjB,CAAC,CAAC;IACL,CAAC,CAAA,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../projects/color-lib/schematics/ng-add/schema.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "ColorLibNgAdd",
|
|
4
|
+
"title": "Color Lib ng-add Schema",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"color": {
|
|
8
|
+
"description": "¿Cuál es tu color favorito? (ej: blue, #ff6600, tomato)",
|
|
9
|
+
"type": "string",
|
|
10
|
+
"x-prompt": "¿Cuál es tu color favorito? (ej: blue, #ff6600, tomato)"
|
|
11
|
+
},
|
|
12
|
+
"project": {
|
|
13
|
+
"type": "string",
|
|
14
|
+
"description": "El nombre del proyecto Angular donde instalar la lib.",
|
|
15
|
+
"$default": {
|
|
16
|
+
"$source": "projectName"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"required": ["color"]
|
|
21
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { InjectionToken } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
declare class ColorService {
|
|
5
|
+
private readonly color;
|
|
6
|
+
/** Retorna el color favorito configurado. */
|
|
7
|
+
getColor(): string;
|
|
8
|
+
/** Loguea el color favorito en consola con estilo CSS. */
|
|
9
|
+
logColor(): void;
|
|
10
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ColorService, never>;
|
|
11
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<ColorService>;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Token para inyectar el color favorito configurado via ng-add.
|
|
16
|
+
*
|
|
17
|
+
* Registro manual (si no usaste ng-add):
|
|
18
|
+
* providers: [{ provide: COLOR_LIB_COLOR, useValue: 'blue' }]
|
|
19
|
+
*/
|
|
20
|
+
declare const COLOR_LIB_COLOR: InjectionToken<string>;
|
|
21
|
+
|
|
22
|
+
export { COLOR_LIB_COLOR, ColorService };
|