@fylib/adapter-angular 0.1.0 → 0.2.0
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/dist/components/accordion.component.js +128 -128
- package/dist/components/badge.component.js +43 -43
- package/dist/components/button.component.js +103 -103
- package/dist/components/card.component.js +103 -103
- package/dist/components/chart.component.js +72 -72
- package/dist/components/icon.component.js +29 -29
- package/dist/components/input.component.js +111 -111
- package/dist/components/modal.component.js +122 -122
- package/dist/components/nav-link.component.js +56 -56
- package/dist/components/notification-menu.component.js +388 -388
- package/dist/components/select.component.js +122 -122
- package/dist/components/table.component.js +371 -371
- package/dist/components/text.component.js +2 -2
- package/dist/components/toast.component.js +115 -115
- package/dist/directives/theme-vars.directive.js +10 -10
- package/dist/directives/wallpaper.directive.js +5 -5
- package/dist/layouts/layout.component.js +69 -69
- package/dist/layouts/slot.component.js +584 -584
- package/dist/schematics/collection.json +9 -0
- package/dist/schematics/ng-add/index.d.ts +2 -0
- package/dist/schematics/ng-add/index.js +64 -0
- package/dist/schematics/ng-add/index.js.map +1 -0
- package/dist/schematics/ng-add/schema.json +8 -0
- package/dist/schematics/templates/fylib/crypto.config.ts.template +7 -0
- package/dist/schematics/templates/fylib/logging.config.ts.template +9 -0
- package/dist/schematics/templates/fylib/sse.config.ts.template +7 -0
- package/dist/schematics/templates/fylib/theme.config.ts.template +9 -0
- package/package.json +46 -43
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ngAdd = ngAdd;
|
|
4
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
|
+
const core_1 = require("@angular-devkit/core");
|
|
6
|
+
function ngAdd(_options) {
|
|
7
|
+
return (tree, _context) => {
|
|
8
|
+
return (0, schematics_1.chain)([
|
|
9
|
+
addFiles(),
|
|
10
|
+
updateAppConfig(),
|
|
11
|
+
updateAppComponent(),
|
|
12
|
+
])(tree, _context);
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
function addFiles() {
|
|
16
|
+
return (0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.url)('./templates'), [
|
|
17
|
+
(0, schematics_1.template)({
|
|
18
|
+
...core_1.strings,
|
|
19
|
+
}),
|
|
20
|
+
(0, schematics_1.move)('src'),
|
|
21
|
+
]));
|
|
22
|
+
}
|
|
23
|
+
function updateAppConfig() {
|
|
24
|
+
return (tree) => {
|
|
25
|
+
const configPath = 'src/app/app.config.ts';
|
|
26
|
+
if (!tree.exists(configPath))
|
|
27
|
+
return tree;
|
|
28
|
+
const content = tree.read(configPath)?.toString('utf-8') || '';
|
|
29
|
+
if (content.includes('provideFyLib'))
|
|
30
|
+
return tree;
|
|
31
|
+
let updatedContent = `import { provideFyLib } from '@fylib/adapter-angular';\n` +
|
|
32
|
+
`import { themeConfig } from '../fylib/theme.config';\n` +
|
|
33
|
+
`import { sseConfig } from '../fylib/sse.config';\n` +
|
|
34
|
+
`import { cryptoConfig } from '../fylib/crypto.config';\n` +
|
|
35
|
+
`import { loggingConfig } from '../fylib/logging.config';\n` +
|
|
36
|
+
content;
|
|
37
|
+
updatedContent = updatedContent.replace(/providers:\s*\[/, `providers: [\n provideFyLib({\n theme: themeConfig,\n sse: sseConfig,\n crypto: cryptoConfig,\n logging: loggingConfig\n }),`);
|
|
38
|
+
tree.overwrite(configPath, updatedContent);
|
|
39
|
+
return tree;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function updateAppComponent() {
|
|
43
|
+
return (tree) => {
|
|
44
|
+
const appPath = 'src/app/app.component.ts';
|
|
45
|
+
const altPath = 'src/app/app.ts';
|
|
46
|
+
const targetPath = tree.exists(appPath) ? appPath : (tree.exists(altPath) ? altPath : null);
|
|
47
|
+
if (!targetPath)
|
|
48
|
+
return tree;
|
|
49
|
+
const content = tree.read(targetPath)?.toString('utf-8') || '';
|
|
50
|
+
if (content.includes('FyLibService'))
|
|
51
|
+
return tree;
|
|
52
|
+
let updatedContent = `import { inject, OnInit, signal } from '@angular/core';\n` +
|
|
53
|
+
`import { FyLibService, FySSEService, FyThemeVarsDirective } from '@fylib/adapter-angular';\n` +
|
|
54
|
+
`import { themeConfig } from '../fylib/theme.config';\n` +
|
|
55
|
+
content;
|
|
56
|
+
// Adiciona imports no @Component
|
|
57
|
+
updatedContent = updatedContent.replace(/imports:\s*\[/, `imports: [FyThemeVarsDirective, `);
|
|
58
|
+
// Adiciona lógica na classe
|
|
59
|
+
updatedContent = updatedContent.replace(/export class (\w+) \{/, `export class $1 implements OnInit {\n private fylib = inject(FyLibService);\n private sse = inject(FySSEService);\n protected readonly mode = signal<'light' | 'dark'>('light');\n\n ngOnInit() {\n this.fylib.setTheme(themeConfig.theme);\n this.fylib.setMode(this.mode());\n }\n`);
|
|
60
|
+
tree.overwrite(targetPath, updatedContent);
|
|
61
|
+
return tree;
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../schematics/ng-add/index.ts"],"names":[],"mappings":";;AAaA,sBAQC;AArBD,2DAUoC;AACpC,+CAA+C;AAE/C,SAAgB,KAAK,CAAC,QAAa;IACjC,OAAO,CAAC,IAAU,EAAE,QAA0B,EAAE,EAAE;QAChD,OAAO,IAAA,kBAAK,EAAC;YACX,QAAQ,EAAE;YACV,eAAe,EAAE;YACjB,kBAAkB,EAAE;SACrB,CAAC,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IACrB,CAAC,CAAC;AACJ,CAAC;AAED,SAAS,QAAQ;IACf,OAAO,IAAA,sBAAS,EACd,IAAA,kBAAK,EAAC,IAAA,gBAAG,EAAC,aAAa,CAAC,EAAE;QACxB,IAAA,qBAAQ,EAAC;YACP,GAAG,cAAO;SACX,CAAC;QACF,IAAA,iBAAI,EAAC,KAAK,CAAC;KACZ,CAAC,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;YAAE,OAAO,IAAI,CAAC;QAElD,IAAI,cAAc,GAAG,2DAA2D;YAC9E,8FAA8F;YAC9F,wDAAwD;YACxD,OAAO,CAAC;QAEV,iCAAiC;QACjC,cAAc,GAAG,cAAc,CAAC,OAAO,CACrC,eAAe,EACf,kCAAkC,CACnC,CAAC;QAEF,4BAA4B;QAC5B,cAAc,GAAG,cAAc,CAAC,OAAO,CACrC,uBAAuB,EACvB,iSAAiS,CAClS,CAAC;QAEF,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;QAC3C,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,43 +1,46 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@fylib/adapter-angular",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"main": "dist/index.js",
|
|
5
|
-
"types": "dist/index.d.ts",
|
|
6
|
-
"files": [
|
|
7
|
-
"dist"
|
|
8
|
-
],
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"@fylib/
|
|
28
|
-
"@fylib/
|
|
29
|
-
"@fylib/
|
|
30
|
-
"@fylib/
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
"
|
|
38
|
-
"@angular/
|
|
39
|
-
"@angular/
|
|
40
|
-
"@
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@fylib/adapter-angular",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"main": "dist/index.js",
|
|
5
|
+
"types": "dist/index.d.ts",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist"
|
|
8
|
+
],
|
|
9
|
+
"schematics": "./dist/schematics/collection.json",
|
|
10
|
+
"publishConfig": {
|
|
11
|
+
"access": "public"
|
|
12
|
+
},
|
|
13
|
+
"peerDependencies": {
|
|
14
|
+
"@angular/common": "^18.0.0 || ^21.0.0",
|
|
15
|
+
"@angular/core": "^18.0.0 || ^21.0.0",
|
|
16
|
+
"chart.js": "^4.5.1",
|
|
17
|
+
"ng2-charts": "^10.0.0",
|
|
18
|
+
"rxjs": "~7.8.0"
|
|
19
|
+
},
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@angular-devkit/schematics": "^18.2.21",
|
|
22
|
+
"@angular-devkit/core": "^18.2.21",
|
|
23
|
+
"chart.js": "^4.5.1",
|
|
24
|
+
"ng2-charts": "^10.0.0",
|
|
25
|
+
"rxjs": "~7.8.0",
|
|
26
|
+
"tslib": "^2.3.0",
|
|
27
|
+
"@fylib/core": "0.2.0",
|
|
28
|
+
"@fylib/theme": "0.2.0",
|
|
29
|
+
"@fylib/animation": "0.2.0",
|
|
30
|
+
"@fylib/catalog": "0.2.0",
|
|
31
|
+
"@fylib/config": "0.2.0",
|
|
32
|
+
"@fylib/crypto": "0.2.0",
|
|
33
|
+
"@fylib/logger": "0.2.0"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"typescript": "^5.9.3",
|
|
37
|
+
"@angular/common": "^18.0.0 || ^21.0.0",
|
|
38
|
+
"@angular/core": "^18.0.0 || ^21.0.0",
|
|
39
|
+
"@angular/compiler": "^18.0.0 || ^21.0.0",
|
|
40
|
+
"@types/node": "^20.17.19"
|
|
41
|
+
},
|
|
42
|
+
"scripts": {
|
|
43
|
+
"build": "tsc -p tsconfig.json && tsc -p tsconfig.schematics.json && node scripts/copy-schematics.js",
|
|
44
|
+
"test": "vitest run --passWithNoTests"
|
|
45
|
+
}
|
|
46
|
+
}
|