@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.
Files changed (28) hide show
  1. package/dist/components/accordion.component.js +128 -128
  2. package/dist/components/badge.component.js +43 -43
  3. package/dist/components/button.component.js +103 -103
  4. package/dist/components/card.component.js +103 -103
  5. package/dist/components/chart.component.js +72 -72
  6. package/dist/components/icon.component.js +29 -29
  7. package/dist/components/input.component.js +111 -111
  8. package/dist/components/modal.component.js +122 -122
  9. package/dist/components/nav-link.component.js +56 -56
  10. package/dist/components/notification-menu.component.js +388 -388
  11. package/dist/components/select.component.js +122 -122
  12. package/dist/components/table.component.js +371 -371
  13. package/dist/components/text.component.js +2 -2
  14. package/dist/components/toast.component.js +115 -115
  15. package/dist/directives/theme-vars.directive.js +10 -10
  16. package/dist/directives/wallpaper.directive.js +5 -5
  17. package/dist/layouts/layout.component.js +69 -69
  18. package/dist/layouts/slot.component.js +584 -584
  19. package/dist/schematics/collection.json +9 -0
  20. package/dist/schematics/ng-add/index.d.ts +2 -0
  21. package/dist/schematics/ng-add/index.js +64 -0
  22. package/dist/schematics/ng-add/index.js.map +1 -0
  23. package/dist/schematics/ng-add/schema.json +8 -0
  24. package/dist/schematics/templates/fylib/crypto.config.ts.template +7 -0
  25. package/dist/schematics/templates/fylib/logging.config.ts.template +9 -0
  26. package/dist/schematics/templates/fylib/sse.config.ts.template +7 -0
  27. package/dist/schematics/templates/fylib/theme.config.ts.template +9 -0
  28. package/package.json +46 -43
@@ -0,0 +1,9 @@
1
+ {
2
+ "$schema": "../../node_modules/@angular-devkit/schematics/collection-schema.json",
3
+ "schematics": {
4
+ "ng-add": {
5
+ "description": "Configura o fyLib no seu projeto Angular automaticamente.",
6
+ "factory": "./ng-add/index#ngAdd"
7
+ }
8
+ }
9
+ }
@@ -0,0 +1,2 @@
1
+ import { Rule } from '@angular-devkit/schematics';
2
+ export declare function ngAdd(_options: any): Rule;
@@ -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,CACH,CAAC;AACJ,CAAC;AAED,SAAS,eAAe;IACtB,OAAO,CAAC,IAAU,EAAE,EAAE;QACpB,MAAM,UAAU,GAAG,uBAAuB,CAAC;QAC3C,IAAI,C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AAc,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"}
@@ -0,0 +1,8 @@
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "id": "FyLibNgAddSchema",
4
+ "title": "FyLib Ng Add Schema",
5
+ "type": "object",
6
+ "properties": {},
7
+ "additionalProperties": false
8
+ }
@@ -0,0 +1,7 @@
1
+ import { CryptoConfig } from '@fylib/config';
2
+
3
+ export const cryptoConfig: CryptoConfig = {
4
+ enabled: true,
5
+ algorithm: 'AES-GCM',
6
+ // Configuration for your crypto engine
7
+ };
@@ -0,0 +1,9 @@
1
+ import { LoggingConfig } from '@fylib/config';
2
+
3
+ export const loggingConfig: LoggingConfig = {
4
+ enabled: true,
5
+ level: 'info',
6
+ console: { enabled: true },
7
+ localFiles: { enabled: false, path: 'logs' },
8
+ remote: { enabled: false, endpoint: '' }
9
+ };
@@ -0,0 +1,7 @@
1
+ import { SSEConfig } from '@fylib/config';
2
+
3
+ export const sseConfig: SSEConfig = {
4
+ enabled: false,
5
+ endpoint: 'http://localhost:3000/sse',
6
+ reconnectDelay: 3000
7
+ };
@@ -0,0 +1,9 @@
1
+ import { AppConfig } from '@fylib/config';
2
+
3
+ export const themeConfig: AppConfig = {
4
+ theme: 'default',
5
+ animationsEnabled: true,
6
+ effectsEnabled: true,
7
+ themeEffectsEnabled: true,
8
+ wallpaperEnabled: true
9
+ };
package/package.json CHANGED
@@ -1,43 +1,46 @@
1
- {
2
- "name": "@fylib/adapter-angular",
3
- "version": "0.1.0",
4
- "main": "dist/index.js",
5
- "types": "dist/index.d.ts",
6
- "files": [
7
- "dist"
8
- ],
9
- "publishConfig": {
10
- "access": "public"
11
- },
12
- "scripts": {
13
- "build": "tsc -p tsconfig.json",
14
- "test": "vitest run --passWithNoTests"
15
- },
16
- "peerDependencies": {
17
- "@angular/common": "catalog:",
18
- "@angular/core": "catalog:",
19
- "chart.js": "catalog:",
20
- "ng2-charts": "catalog:",
21
- "rxjs": "catalog:"
22
- },
23
- "dependencies": {
24
- "@fylib/core": "workspace:*",
25
- "@fylib/theme": "workspace:*",
26
- "@fylib/animation": "workspace:*",
27
- "@fylib/catalog": "workspace:*",
28
- "@fylib/config": "workspace:*",
29
- "@fylib/crypto": "workspace:*",
30
- "@fylib/logger": "workspace:*",
31
- "chart.js": "catalog:",
32
- "ng2-charts": "catalog:",
33
- "rxjs": "catalog:",
34
- "tslib": "catalog:"
35
- },
36
- "devDependencies": {
37
- "typescript": "catalog:",
38
- "@angular/common": "catalog:",
39
- "@angular/core": "catalog:",
40
- "@angular/compiler": "catalog:",
41
- "@types/node": "catalog:"
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
+ }