angular-dev-utils 1.0.1 → 1.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.
Files changed (40) hide show
  1. package/esm2022/angular-dev-utils.mjs +5 -0
  2. package/esm2022/lib/components/button/button.component.mjs +68 -0
  3. package/esm2022/lib/components/card/card.component.mjs +78 -0
  4. package/esm2022/lib/components/input/input.component.mjs +141 -0
  5. package/esm2022/lib/components/modal/modal.component.mjs +102 -0
  6. package/esm2022/lib/components/spinner/spinner.component.mjs +44 -0
  7. package/esm2022/lib/components/table/table.component.mjs +240 -0
  8. package/esm2022/lib/models/types.mjs +2 -0
  9. package/esm2022/lib/services/modal.service.mjs +102 -0
  10. package/esm2022/public-api.mjs +15 -0
  11. package/fesm2022/angular-dev-utils.mjs +765 -0
  12. package/fesm2022/angular-dev-utils.mjs.map +1 -0
  13. package/index.d.ts +5 -0
  14. package/lib/components/button/button.component.d.ts +16 -0
  15. package/lib/components/card/card.component.d.ts +12 -0
  16. package/lib/components/input/input.component.d.ts +27 -0
  17. package/lib/components/modal/modal.component.d.ts +17 -0
  18. package/lib/components/spinner/spinner.component.d.ts +11 -0
  19. package/lib/components/table/table.component.d.ts +29 -0
  20. package/{src/lib/models/types.ts → lib/models/types.d.ts} +15 -20
  21. package/lib/services/modal.service.d.ts +21 -0
  22. package/package.json +15 -26
  23. package/{src/public-api.ts → public-api.d.ts} +0 -9
  24. package/.github/workflows/ci.yml +0 -39
  25. package/.github/workflows/publish.yml +0 -53
  26. package/angular.json +0 -43
  27. package/ng-package.json +0 -8
  28. package/src/lib/components/button/button.component.ts +0 -100
  29. package/src/lib/components/card/card.component.ts +0 -101
  30. package/src/lib/components/input/input.component.ts +0 -141
  31. package/src/lib/components/modal/modal.component.ts +0 -139
  32. package/src/lib/components/spinner/spinner.component.ts +0 -64
  33. package/src/lib/components/table/table.component.ts +0 -240
  34. package/src/lib/services/modal.service.ts +0 -120
  35. package/src/lib/styles.scss +0 -8
  36. package/tailwind.config.js +0 -25
  37. package/tsconfig.json +0 -32
  38. package/tsconfig.lib.json +0 -13
  39. package/tsconfig.lib.prod.json +0 -9
  40. package/tsconfig.spec.json +0 -13
@@ -1,120 +0,0 @@
1
- import { Injectable, ComponentRef, ApplicationRef, createComponent, EnvironmentInjector, Type } from '@angular/core';
2
- import { Subject } from 'rxjs';
3
- import { ModalConfig } from '../models/types';
4
-
5
- export interface ModalRef<T = any> {
6
- close: (result?: T) => void;
7
- afterClosed: () => Subject<T | undefined>;
8
- }
9
-
10
- @Injectable({
11
- providedIn: 'root'
12
- })
13
- export class ModalService {
14
- private modalComponentRef: ComponentRef<any> | null = null;
15
- private closeSubject = new Subject<any>();
16
-
17
- constructor(
18
- private appRef: ApplicationRef,
19
- private injector: EnvironmentInjector
20
- ) { }
21
-
22
- open<T, R = any>(component: Type<T>, config: ModalConfig = {}): ModalRef<R> {
23
- // Close existing modal if any
24
- if (this.modalComponentRef) {
25
- this.close();
26
- }
27
-
28
- // Create modal wrapper
29
- const modalWrapper = document.createElement('div');
30
- modalWrapper.className = this.getModalWrapperClasses(config);
31
-
32
- // Create backdrop
33
- const backdrop = document.createElement('div');
34
- backdrop.className = 'adu-modal-backdrop';
35
- if (config.closeOnBackdrop !== false) {
36
- backdrop.onclick = () => this.close();
37
- }
38
-
39
- // Create modal content
40
- const modalContent = document.createElement('div');
41
- modalContent.className = this.getModalContentClasses(config);
42
- modalContent.onclick = (e) => e.stopPropagation();
43
-
44
- // Create close button if needed
45
- if (config.showCloseButton !== false) {
46
- const closeBtn = document.createElement('button');
47
- closeBtn.className = 'adu-modal-close';
48
- closeBtn.innerHTML = '×';
49
- closeBtn.onclick = () => this.close();
50
- modalContent.appendChild(closeBtn);
51
- }
52
-
53
- // Add title if provided
54
- if (config.title) {
55
- const titleEl = document.createElement('div');
56
- titleEl.className = 'adu-modal-title';
57
- titleEl.textContent = config.title;
58
- modalContent.appendChild(titleEl);
59
- }
60
-
61
- // Create component container
62
- const componentContainer = document.createElement('div');
63
- componentContainer.className = 'adu-modal-body';
64
- modalContent.appendChild(componentContainer);
65
-
66
- // Assemble modal
67
- modalWrapper.appendChild(backdrop);
68
- modalWrapper.appendChild(modalContent);
69
- document.body.appendChild(modalWrapper);
70
-
71
- // Create and attach component
72
- this.modalComponentRef = createComponent(component, {
73
- environmentInjector: this.injector,
74
- hostElement: componentContainer
75
- });
76
-
77
- this.appRef.attachView(this.modalComponentRef.hostView);
78
-
79
- // Handle ESC key
80
- if (config.closeOnEscape !== false) {
81
- const escHandler = (e: KeyboardEvent) => {
82
- if (e.key === 'Escape') {
83
- this.close();
84
- document.removeEventListener('keydown', escHandler);
85
- }
86
- };
87
- document.addEventListener('keydown', escHandler);
88
- }
89
-
90
- return {
91
- close: (result?: R) => this.close(result),
92
- afterClosed: () => this.closeSubject as Subject<R | undefined>
93
- };
94
- }
95
-
96
- close(result?: any): void {
97
- if (this.modalComponentRef) {
98
- this.appRef.detachView(this.modalComponentRef.hostView);
99
- this.modalComponentRef.destroy();
100
- this.modalComponentRef = null;
101
-
102
- // Remove modal from DOM
103
- const modals = document.querySelectorAll('.adu-modal-wrapper');
104
- modals.forEach(modal => modal.remove());
105
-
106
- this.closeSubject.next(result);
107
- this.closeSubject.complete();
108
- this.closeSubject = new Subject<any>();
109
- }
110
- }
111
-
112
- private getModalWrapperClasses(config: ModalConfig): string {
113
- return 'adu-modal-wrapper';
114
- }
115
-
116
- private getModalContentClasses(config: ModalConfig): string {
117
- const size = config.size || 'md';
118
- return `adu-modal-content adu-modal-${size}`;
119
- }
120
- }
@@ -1,8 +0,0 @@
1
- @tailwind base;
2
- @tailwind components;
3
- @tailwind utilities;
4
-
5
- /* Angular Dev Utils - Base Styles */
6
- .adu-component {
7
- @apply transition-all duration-200 ease-in-out;
8
- }
@@ -1,25 +0,0 @@
1
- /** @type {import('tailwindcss').Config} */
2
- module.exports = {
3
- content: [
4
- "./projects/angular-dev-utils/src/**/*.{html,ts}",
5
- ],
6
- theme: {
7
- extend: {
8
- colors: {
9
- primary: {
10
- 50: '#eff6ff',
11
- 100: '#dbeafe',
12
- 200: '#bfdbfe',
13
- 300: '#93c5fd',
14
- 400: '#60a5fa',
15
- 500: '#3b82f6',
16
- 600: '#2563eb',
17
- 700: '#1d4ed8',
18
- 800: '#1e40af',
19
- 900: '#1e3a8a',
20
- },
21
- },
22
- },
23
- },
24
- plugins: [],
25
- }
package/tsconfig.json DELETED
@@ -1,32 +0,0 @@
1
- {
2
- "compileOnSave": false,
3
- "compilerOptions": {
4
- "outDir": "./dist/out-tsc",
5
- "forceConsistentCasingInFileNames": true,
6
- "strict": true,
7
- "noImplicitOverride": true,
8
- "noPropertyAccessFromIndexSignature": true,
9
- "noImplicitReturns": true,
10
- "noFallthroughCasesInSwitch": true,
11
- "skipLibCheck": true,
12
- "esModuleInterop": true,
13
- "sourceMap": true,
14
- "declaration": false,
15
- "experimentalDecorators": true,
16
- "moduleResolution": "node",
17
- "importHelpers": true,
18
- "target": "ES2022",
19
- "module": "ES2022",
20
- "useDefineForClassFields": false,
21
- "lib": [
22
- "ES2022",
23
- "dom"
24
- ]
25
- },
26
- "angularCompilerOptions": {
27
- "enableI18nLegacyMessageIdFormat": false,
28
- "strictInjectionParameters": true,
29
- "strictInputAccessModifiers": true,
30
- "strictTemplates": true
31
- }
32
- }
package/tsconfig.lib.json DELETED
@@ -1,13 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "compilerOptions": {
4
- "outDir": "./out-tsc/lib",
5
- "declaration": true,
6
- "declarationMap": true,
7
- "inlineSources": true,
8
- "types": []
9
- },
10
- "exclude": [
11
- "**/*.spec.ts"
12
- ]
13
- }
@@ -1,9 +0,0 @@
1
- {
2
- "extends": "./tsconfig.lib.json",
3
- "compilerOptions": {
4
- "declarationMap": false
5
- },
6
- "angularCompilerOptions": {
7
- "compilationMode": "partial"
8
- }
9
- }
@@ -1,13 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "compilerOptions": {
4
- "outDir": "./out-tsc/spec",
5
- "types": [
6
- "jasmine"
7
- ]
8
- },
9
- "include": [
10
- "**/*.spec.ts",
11
- "**/*.d.ts"
12
- ]
13
- }