@fylib/adapter-angular 0.1.0 → 0.2.1

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 +80 -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,80 @@
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
+ const tasks_1 = require("@angular-devkit/schematics/tasks");
7
+ function ngAdd(options) {
8
+ return (tree, context) => {
9
+ return (0, schematics_1.chain)([
10
+ addFiles(),
11
+ updateAppConfig(),
12
+ updateAppComponent(),
13
+ installDependencies(),
14
+ ])(tree, context);
15
+ };
16
+ }
17
+ function addFiles() {
18
+ return (0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.url)('../templates'), [
19
+ (0, schematics_1.template)({
20
+ ...core_1.strings,
21
+ }),
22
+ (0, schematics_1.move)('src/fylib'),
23
+ ]));
24
+ }
25
+ function updateAppConfig() {
26
+ return (tree) => {
27
+ const configPath = 'src/app/app.config.ts';
28
+ if (!tree.exists(configPath))
29
+ return tree;
30
+ const content = tree.read(configPath)?.toString('utf-8') || '';
31
+ if (content.includes('provideFyLib'))
32
+ return tree;
33
+ let updatedContent = `import { provideFyLib } from '@fylib/adapter-angular';\n` +
34
+ `import { themeConfig } from '../fylib/theme.config';\n` +
35
+ `import { sseConfig } from '../fylib/sse.config';\n` +
36
+ `import { cryptoConfig } from '../fylib/crypto.config';\n` +
37
+ `import { loggingConfig } from '../fylib/logging.config';\n` +
38
+ content;
39
+ updatedContent = updatedContent.replace(/providers:\s*\[/, `providers: [\n provideFyLib({\n theme: themeConfig,\n sse: sseConfig,\n crypto: cryptoConfig,\n logging: loggingConfig\n }),`);
40
+ tree.overwrite(configPath, updatedContent);
41
+ return tree;
42
+ };
43
+ }
44
+ function updateAppComponent() {
45
+ return (tree) => {
46
+ const appPath = 'src/app/app.component.ts';
47
+ const altPath = 'src/app/app.ts';
48
+ const targetPath = tree.exists(appPath) ? appPath : (tree.exists(altPath) ? altPath : null);
49
+ if (!targetPath)
50
+ return tree;
51
+ const content = tree.read(targetPath)?.toString('utf-8') || '';
52
+ if (content.includes('FyLibService'))
53
+ return tree;
54
+ let updatedContent = `import { inject, OnInit, signal } from '@angular/core';\n` +
55
+ `import { FyLibService, FySSEService, FyThemeVarsDirective } from '@fylib/adapter-angular';\n` +
56
+ `import { themeConfig } from '../fylib/theme.config';\n` +
57
+ content;
58
+ updatedContent = updatedContent.replace(/imports:\s*\[/, `imports: [FyThemeVarsDirective, `);
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
+ function installDependencies() {
65
+ return (_tree, context) => {
66
+ context.addTask(new tasks_1.NodePackageInstallTask({
67
+ packageName: [
68
+ '@fylib/core',
69
+ '@fylib/config',
70
+ '@fylib/theme',
71
+ '@fylib/animation',
72
+ '@fylib/catalog',
73
+ '@fylib/crypto',
74
+ '@fylib/logger',
75
+ '@fylib/adapter-angular',
76
+ ].join(' '),
77
+ }));
78
+ };
79
+ }
80
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../schematics/ng-add/index.ts"],"names":[],"mappings":";;AAeA,sBASC;AAxBD,2DAWoC;AACpC,+CAA+C;AAC/C,4DAA0E;AAE1E,SAAgB,KAAK,CAAC,OAAY;IAChC,OAAO,CAAC,IAAU,EAAE,OAAyB,EAAE,EAAE;QAC/C,OAAO,IAAA,kBAAK,EAAC;YACX,QAAQ,EAAE;YACV,eAAe,EAAE;YACjB,kBAAkB,EAAE;YACpB,mBAAmB,EAAE;SACtB,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACpB,CAAC,CAAC;AACJ,CAAC;AAED,SAAS,QAAQ;IACf,OAAO,I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AO,IAAI,CAAC;QAE7B,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;QAC/D,IAAI,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC;YAAE,OAAO,IAAI,CAAC;QAElD,IAAI,cAAc,GAAG,2DAA2D;YAC9E,8FAA8F;YAC9F,wDAAwD;YACxD,OAAO,CAAC;QAEV,cAAc,GAAG,cAAc,CAAC,OAAO,CACrC,eAAe,EACf,kCAAkC,CACnC,CAAC;QAEF,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;AAED,SAAS,mBAAmB;IAC1B,OAAO,CAAC,KAAW,EAAE,OAAyB,EAAE,EAAE;QAChD,OAAO,CAAC,OAAO,CACb,IAAI,8BAAsB,CAAC;YACzB,WAAW,EAAE;gBACX,aAAa;gBACb,eAAe;gBACf,cAAc;gBACd,kBAAkB;gBAClB,gBAAgB;gBAChB,eAAe;gBACf,eAAe;gBACf,wBAAwB;aACzB,CAAC,IAAI,CAAC,GAAG,CAAC;SACZ,CAAC,CACH,CAAC;IACJ,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.1",
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/catalog": "0.2.0",
29
+ "@fylib/animation": "0.2.0",
30
+ "@fylib/config": "0.2.0",
31
+ "@fylib/crypto": "0.2.0",
32
+ "@fylib/theme": "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
+ }