@theaccessibleteam/a11y-feedback-angular 2.0.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/index.cjs ADDED
@@ -0,0 +1,243 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var __decorateClass = (decorators, target, key, kind) => {
20
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
21
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
22
+ if (decorator = decorators[i])
23
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
24
+ if (kind && result) __defProp(target, key, result);
25
+ return result;
26
+ };
27
+
28
+ // src/index.ts
29
+ var index_exports = {};
30
+ __export(index_exports, {
31
+ A11yFeedbackModule: () => A11yFeedbackModule,
32
+ A11yFeedbackService: () => A11yFeedbackService,
33
+ provideA11yFeedback: () => provideA11yFeedback
34
+ });
35
+ module.exports = __toCommonJS(index_exports);
36
+
37
+ // src/a11y-feedback.service.ts
38
+ var import_core = require("@angular/core");
39
+ var import_rxjs = require("rxjs");
40
+ var import_a11y_feedback = require("@theaccessibleteam/a11y-feedback");
41
+ var A11yFeedbackService = class {
42
+ _state = new import_rxjs.BehaviorSubject({
43
+ notifications: (0, import_a11y_feedback.getNotificationHistory)(),
44
+ unreadCount: (0, import_a11y_feedback.getUnreadCount)(),
45
+ config: (0, import_a11y_feedback.getConfig)()
46
+ });
47
+ updateHandler = () => this.updateState();
48
+ /**
49
+ * Observable of the current state
50
+ */
51
+ state$ = this._state.asObservable();
52
+ /**
53
+ * Observable of notifications
54
+ */
55
+ get notifications$() {
56
+ return new import_rxjs.Observable((subscriber) => {
57
+ const sub = this._state.subscribe((state) => {
58
+ subscriber.next(state.notifications);
59
+ });
60
+ return () => sub.unsubscribe();
61
+ });
62
+ }
63
+ /**
64
+ * Observable of unread count
65
+ */
66
+ get unreadCount$() {
67
+ return new import_rxjs.Observable((subscriber) => {
68
+ const sub = this._state.subscribe((state) => {
69
+ subscriber.next(state.unreadCount);
70
+ });
71
+ return () => sub.unsubscribe();
72
+ });
73
+ }
74
+ constructor() {
75
+ (0, import_a11y_feedback.onFeedback)("announced", this.updateHandler);
76
+ (0, import_a11y_feedback.onFeedback)("dismissed", this.updateHandler);
77
+ (0, import_a11y_feedback.onFeedback)("replaced", this.updateHandler);
78
+ }
79
+ ngOnDestroy() {
80
+ }
81
+ updateState() {
82
+ this._state.next({
83
+ notifications: (0, import_a11y_feedback.getNotificationHistory)(),
84
+ unreadCount: (0, import_a11y_feedback.getUnreadCount)(),
85
+ config: (0, import_a11y_feedback.getConfig)()
86
+ });
87
+ }
88
+ /**
89
+ * Send a notification
90
+ */
91
+ async notify(message, type, options) {
92
+ const result = await (0, import_a11y_feedback.notify)({ message, type, options });
93
+ this.updateState();
94
+ return result;
95
+ }
96
+ /**
97
+ * Send a success notification
98
+ */
99
+ async success(message, options) {
100
+ const result = await import_a11y_feedback.notify.success(message, options);
101
+ this.updateState();
102
+ return result;
103
+ }
104
+ /**
105
+ * Send an error notification
106
+ */
107
+ async error(message, options) {
108
+ const result = await import_a11y_feedback.notify.error(message, options);
109
+ this.updateState();
110
+ return result;
111
+ }
112
+ /**
113
+ * Send a warning notification
114
+ */
115
+ async warning(message, options) {
116
+ const result = await import_a11y_feedback.notify.warning(message, options);
117
+ this.updateState();
118
+ return result;
119
+ }
120
+ /**
121
+ * Send an info notification
122
+ */
123
+ async info(message, options) {
124
+ const result = await import_a11y_feedback.notify.info(message, options);
125
+ this.updateState();
126
+ return result;
127
+ }
128
+ /**
129
+ * Send a loading notification
130
+ */
131
+ async loading(message, options) {
132
+ const result = await import_a11y_feedback.notify.loading(message, options);
133
+ this.updateState();
134
+ return result;
135
+ }
136
+ /**
137
+ * Show a confirmation dialog
138
+ */
139
+ async confirm(message, options) {
140
+ return (0, import_a11y_feedback.confirm)(message, options);
141
+ }
142
+ /**
143
+ * Show a prompt dialog
144
+ */
145
+ async prompt(message, options) {
146
+ return (0, import_a11y_feedback.prompt)(message, options);
147
+ }
148
+ /**
149
+ * Create a progress notification
150
+ */
151
+ progress(message, options) {
152
+ return (0, import_a11y_feedback.createProgressController)(
153
+ `progress-${Date.now()}`,
154
+ message,
155
+ options
156
+ );
157
+ }
158
+ /**
159
+ * Dismiss a notification
160
+ */
161
+ dismiss(id) {
162
+ (0, import_a11y_feedback.dismissVisualFeedback)(id);
163
+ this.updateState();
164
+ }
165
+ /**
166
+ * Dismiss all notifications
167
+ */
168
+ dismissAll() {
169
+ (0, import_a11y_feedback.dismissAllVisualFeedback)();
170
+ this.updateState();
171
+ }
172
+ /**
173
+ * Update configuration
174
+ */
175
+ configure(config) {
176
+ (0, import_a11y_feedback.configureFeedback)(config);
177
+ this.updateState();
178
+ }
179
+ /**
180
+ * Reset configuration to defaults
181
+ */
182
+ resetConfig() {
183
+ (0, import_a11y_feedback.resetConfig)();
184
+ this.updateState();
185
+ }
186
+ /**
187
+ * Get current configuration
188
+ */
189
+ getConfig() {
190
+ return (0, import_a11y_feedback.getConfig)();
191
+ }
192
+ };
193
+ A11yFeedbackService = __decorateClass([
194
+ (0, import_core.Injectable)({
195
+ providedIn: "root"
196
+ })
197
+ ], A11yFeedbackService);
198
+
199
+ // src/a11y-feedback.module.ts
200
+ var import_core2 = require("@angular/core");
201
+ var A11yFeedbackModule = class {
202
+ /**
203
+ * Configure the module with options
204
+ */
205
+ static forRoot(options) {
206
+ return {
207
+ ngModule: A11yFeedbackModule,
208
+ providers: [
209
+ {
210
+ provide: A11yFeedbackService,
211
+ useFactory: () => {
212
+ const service = new A11yFeedbackService();
213
+ if (options?.config) {
214
+ service.configure(options.config);
215
+ }
216
+ return service;
217
+ }
218
+ }
219
+ ]
220
+ };
221
+ }
222
+ };
223
+ A11yFeedbackModule = __decorateClass([
224
+ (0, import_core2.NgModule)({})
225
+ ], A11yFeedbackModule);
226
+
227
+ // src/provide.ts
228
+ var import_core3 = require("@angular/core");
229
+ var import_a11y_feedback3 = require("@theaccessibleteam/a11y-feedback");
230
+ function provideA11yFeedback(options) {
231
+ if (options?.config) {
232
+ (0, import_a11y_feedback3.configureFeedback)(options.config);
233
+ }
234
+ return (0, import_core3.makeEnvironmentProviders)([
235
+ A11yFeedbackService
236
+ ]);
237
+ }
238
+ // Annotate the CommonJS export names for ESM import in node:
239
+ 0 && (module.exports = {
240
+ A11yFeedbackModule,
241
+ A11yFeedbackService,
242
+ provideA11yFeedback
243
+ });
@@ -0,0 +1,156 @@
1
+ import { OnDestroy, ModuleWithProviders, EnvironmentProviders } from '@angular/core';
2
+ import { Observable } from 'rxjs';
3
+ import { FeedbackEvent, FeedbackConfig, FeedbackType, FeedbackOptions, ConfirmOptions, ConfirmResult, PromptOptions, PromptResult, ProgressOptions, ProgressController } from '@theaccessibleteam/a11y-feedback';
4
+ export { ConfirmOptions, FeedbackConfig, FeedbackEvent, FeedbackOptions, FeedbackType, NotificationAction, ProgressController, ProgressOptions, PromptOptions, RichContent } from '@theaccessibleteam/a11y-feedback';
5
+
6
+ /**
7
+ * Angular service for a11y-feedback
8
+ */
9
+
10
+ /**
11
+ * State interface for the service
12
+ */
13
+ interface A11yFeedbackState {
14
+ notifications: readonly FeedbackEvent[];
15
+ unreadCount: number;
16
+ config: FeedbackConfig;
17
+ }
18
+ /**
19
+ * Angular service for accessible notifications
20
+ */
21
+ declare class A11yFeedbackService implements OnDestroy {
22
+ private readonly _state;
23
+ private readonly updateHandler;
24
+ /**
25
+ * Observable of the current state
26
+ */
27
+ readonly state$: Observable<A11yFeedbackState>;
28
+ /**
29
+ * Observable of notifications
30
+ */
31
+ get notifications$(): Observable<readonly FeedbackEvent[]>;
32
+ /**
33
+ * Observable of unread count
34
+ */
35
+ get unreadCount$(): Observable<number>;
36
+ constructor();
37
+ ngOnDestroy(): void;
38
+ private updateState;
39
+ /**
40
+ * Send a notification
41
+ */
42
+ notify(message: string, type: FeedbackType, options?: FeedbackOptions): Promise<FeedbackEvent>;
43
+ /**
44
+ * Send a success notification
45
+ */
46
+ success(message: string, options?: FeedbackOptions): Promise<FeedbackEvent>;
47
+ /**
48
+ * Send an error notification
49
+ */
50
+ error(message: string, options?: FeedbackOptions): Promise<FeedbackEvent>;
51
+ /**
52
+ * Send a warning notification
53
+ */
54
+ warning(message: string, options?: FeedbackOptions): Promise<FeedbackEvent>;
55
+ /**
56
+ * Send an info notification
57
+ */
58
+ info(message: string, options?: FeedbackOptions): Promise<FeedbackEvent>;
59
+ /**
60
+ * Send a loading notification
61
+ */
62
+ loading(message: string, options?: FeedbackOptions): Promise<FeedbackEvent>;
63
+ /**
64
+ * Show a confirmation dialog
65
+ */
66
+ confirm(message: string, options?: ConfirmOptions): Promise<ConfirmResult>;
67
+ /**
68
+ * Show a prompt dialog
69
+ */
70
+ prompt(message: string, options?: PromptOptions): Promise<PromptResult>;
71
+ /**
72
+ * Create a progress notification
73
+ */
74
+ progress(message: string, options?: ProgressOptions): ProgressController;
75
+ /**
76
+ * Dismiss a notification
77
+ */
78
+ dismiss(id: string): void;
79
+ /**
80
+ * Dismiss all notifications
81
+ */
82
+ dismissAll(): void;
83
+ /**
84
+ * Update configuration
85
+ */
86
+ configure(config: Partial<FeedbackConfig>): void;
87
+ /**
88
+ * Reset configuration to defaults
89
+ */
90
+ resetConfig(): void;
91
+ /**
92
+ * Get current configuration
93
+ */
94
+ getConfig(): FeedbackConfig;
95
+ }
96
+
97
+ /**
98
+ * Angular module for a11y-feedback
99
+ */
100
+
101
+ /**
102
+ * Configuration options for the module
103
+ */
104
+ interface A11yFeedbackModuleConfig {
105
+ config?: Partial<FeedbackConfig>;
106
+ }
107
+ /**
108
+ * Angular module for accessible notifications
109
+ *
110
+ * @example
111
+ * ```typescript
112
+ * @NgModule({
113
+ * imports: [
114
+ * A11yFeedbackModule.forRoot({
115
+ * config: { visual: true }
116
+ * })
117
+ * ]
118
+ * })
119
+ * export class AppModule {}
120
+ * ```
121
+ */
122
+ declare class A11yFeedbackModule {
123
+ /**
124
+ * Configure the module with options
125
+ */
126
+ static forRoot(options?: A11yFeedbackModuleConfig): ModuleWithProviders<A11yFeedbackModule>;
127
+ }
128
+
129
+ /**
130
+ * Standalone provider for a11y-feedback in Angular
131
+ */
132
+
133
+ /**
134
+ * Options for the standalone provider
135
+ */
136
+ interface A11yFeedbackProviderOptions {
137
+ config?: Partial<FeedbackConfig>;
138
+ }
139
+ /**
140
+ * Provide a11y-feedback for standalone Angular applications
141
+ *
142
+ * @example
143
+ * ```typescript
144
+ * // In app.config.ts
145
+ * export const appConfig: ApplicationConfig = {
146
+ * providers: [
147
+ * provideA11yFeedback({
148
+ * config: { visual: true }
149
+ * })
150
+ * ]
151
+ * }
152
+ * ```
153
+ */
154
+ declare function provideA11yFeedback(options?: A11yFeedbackProviderOptions): EnvironmentProviders;
155
+
156
+ export { A11yFeedbackModule, A11yFeedbackService, provideA11yFeedback };
@@ -0,0 +1,156 @@
1
+ import { OnDestroy, ModuleWithProviders, EnvironmentProviders } from '@angular/core';
2
+ import { Observable } from 'rxjs';
3
+ import { FeedbackEvent, FeedbackConfig, FeedbackType, FeedbackOptions, ConfirmOptions, ConfirmResult, PromptOptions, PromptResult, ProgressOptions, ProgressController } from '@theaccessibleteam/a11y-feedback';
4
+ export { ConfirmOptions, FeedbackConfig, FeedbackEvent, FeedbackOptions, FeedbackType, NotificationAction, ProgressController, ProgressOptions, PromptOptions, RichContent } from '@theaccessibleteam/a11y-feedback';
5
+
6
+ /**
7
+ * Angular service for a11y-feedback
8
+ */
9
+
10
+ /**
11
+ * State interface for the service
12
+ */
13
+ interface A11yFeedbackState {
14
+ notifications: readonly FeedbackEvent[];
15
+ unreadCount: number;
16
+ config: FeedbackConfig;
17
+ }
18
+ /**
19
+ * Angular service for accessible notifications
20
+ */
21
+ declare class A11yFeedbackService implements OnDestroy {
22
+ private readonly _state;
23
+ private readonly updateHandler;
24
+ /**
25
+ * Observable of the current state
26
+ */
27
+ readonly state$: Observable<A11yFeedbackState>;
28
+ /**
29
+ * Observable of notifications
30
+ */
31
+ get notifications$(): Observable<readonly FeedbackEvent[]>;
32
+ /**
33
+ * Observable of unread count
34
+ */
35
+ get unreadCount$(): Observable<number>;
36
+ constructor();
37
+ ngOnDestroy(): void;
38
+ private updateState;
39
+ /**
40
+ * Send a notification
41
+ */
42
+ notify(message: string, type: FeedbackType, options?: FeedbackOptions): Promise<FeedbackEvent>;
43
+ /**
44
+ * Send a success notification
45
+ */
46
+ success(message: string, options?: FeedbackOptions): Promise<FeedbackEvent>;
47
+ /**
48
+ * Send an error notification
49
+ */
50
+ error(message: string, options?: FeedbackOptions): Promise<FeedbackEvent>;
51
+ /**
52
+ * Send a warning notification
53
+ */
54
+ warning(message: string, options?: FeedbackOptions): Promise<FeedbackEvent>;
55
+ /**
56
+ * Send an info notification
57
+ */
58
+ info(message: string, options?: FeedbackOptions): Promise<FeedbackEvent>;
59
+ /**
60
+ * Send a loading notification
61
+ */
62
+ loading(message: string, options?: FeedbackOptions): Promise<FeedbackEvent>;
63
+ /**
64
+ * Show a confirmation dialog
65
+ */
66
+ confirm(message: string, options?: ConfirmOptions): Promise<ConfirmResult>;
67
+ /**
68
+ * Show a prompt dialog
69
+ */
70
+ prompt(message: string, options?: PromptOptions): Promise<PromptResult>;
71
+ /**
72
+ * Create a progress notification
73
+ */
74
+ progress(message: string, options?: ProgressOptions): ProgressController;
75
+ /**
76
+ * Dismiss a notification
77
+ */
78
+ dismiss(id: string): void;
79
+ /**
80
+ * Dismiss all notifications
81
+ */
82
+ dismissAll(): void;
83
+ /**
84
+ * Update configuration
85
+ */
86
+ configure(config: Partial<FeedbackConfig>): void;
87
+ /**
88
+ * Reset configuration to defaults
89
+ */
90
+ resetConfig(): void;
91
+ /**
92
+ * Get current configuration
93
+ */
94
+ getConfig(): FeedbackConfig;
95
+ }
96
+
97
+ /**
98
+ * Angular module for a11y-feedback
99
+ */
100
+
101
+ /**
102
+ * Configuration options for the module
103
+ */
104
+ interface A11yFeedbackModuleConfig {
105
+ config?: Partial<FeedbackConfig>;
106
+ }
107
+ /**
108
+ * Angular module for accessible notifications
109
+ *
110
+ * @example
111
+ * ```typescript
112
+ * @NgModule({
113
+ * imports: [
114
+ * A11yFeedbackModule.forRoot({
115
+ * config: { visual: true }
116
+ * })
117
+ * ]
118
+ * })
119
+ * export class AppModule {}
120
+ * ```
121
+ */
122
+ declare class A11yFeedbackModule {
123
+ /**
124
+ * Configure the module with options
125
+ */
126
+ static forRoot(options?: A11yFeedbackModuleConfig): ModuleWithProviders<A11yFeedbackModule>;
127
+ }
128
+
129
+ /**
130
+ * Standalone provider for a11y-feedback in Angular
131
+ */
132
+
133
+ /**
134
+ * Options for the standalone provider
135
+ */
136
+ interface A11yFeedbackProviderOptions {
137
+ config?: Partial<FeedbackConfig>;
138
+ }
139
+ /**
140
+ * Provide a11y-feedback for standalone Angular applications
141
+ *
142
+ * @example
143
+ * ```typescript
144
+ * // In app.config.ts
145
+ * export const appConfig: ApplicationConfig = {
146
+ * providers: [
147
+ * provideA11yFeedback({
148
+ * config: { visual: true }
149
+ * })
150
+ * ]
151
+ * }
152
+ * ```
153
+ */
154
+ declare function provideA11yFeedback(options?: A11yFeedbackProviderOptions): EnvironmentProviders;
155
+
156
+ export { A11yFeedbackModule, A11yFeedbackService, provideA11yFeedback };
package/dist/index.js ADDED
@@ -0,0 +1,230 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __decorateClass = (decorators, target, key, kind) => {
4
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
5
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
+ if (decorator = decorators[i])
7
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
+ if (kind && result) __defProp(target, key, result);
9
+ return result;
10
+ };
11
+
12
+ // src/a11y-feedback.service.ts
13
+ import { Injectable } from "@angular/core";
14
+ import { BehaviorSubject, Observable } from "rxjs";
15
+ import {
16
+ notify,
17
+ configureFeedback,
18
+ getConfig,
19
+ resetConfig,
20
+ dismissVisualFeedback,
21
+ dismissAllVisualFeedback,
22
+ getNotificationHistory,
23
+ getUnreadCount,
24
+ onFeedback,
25
+ confirm,
26
+ prompt,
27
+ createProgressController
28
+ } from "@theaccessibleteam/a11y-feedback";
29
+ var A11yFeedbackService = class {
30
+ _state = new BehaviorSubject({
31
+ notifications: getNotificationHistory(),
32
+ unreadCount: getUnreadCount(),
33
+ config: getConfig()
34
+ });
35
+ updateHandler = () => this.updateState();
36
+ /**
37
+ * Observable of the current state
38
+ */
39
+ state$ = this._state.asObservable();
40
+ /**
41
+ * Observable of notifications
42
+ */
43
+ get notifications$() {
44
+ return new Observable((subscriber) => {
45
+ const sub = this._state.subscribe((state) => {
46
+ subscriber.next(state.notifications);
47
+ });
48
+ return () => sub.unsubscribe();
49
+ });
50
+ }
51
+ /**
52
+ * Observable of unread count
53
+ */
54
+ get unreadCount$() {
55
+ return new Observable((subscriber) => {
56
+ const sub = this._state.subscribe((state) => {
57
+ subscriber.next(state.unreadCount);
58
+ });
59
+ return () => sub.unsubscribe();
60
+ });
61
+ }
62
+ constructor() {
63
+ onFeedback("announced", this.updateHandler);
64
+ onFeedback("dismissed", this.updateHandler);
65
+ onFeedback("replaced", this.updateHandler);
66
+ }
67
+ ngOnDestroy() {
68
+ }
69
+ updateState() {
70
+ this._state.next({
71
+ notifications: getNotificationHistory(),
72
+ unreadCount: getUnreadCount(),
73
+ config: getConfig()
74
+ });
75
+ }
76
+ /**
77
+ * Send a notification
78
+ */
79
+ async notify(message, type, options) {
80
+ const result = await notify({ message, type, options });
81
+ this.updateState();
82
+ return result;
83
+ }
84
+ /**
85
+ * Send a success notification
86
+ */
87
+ async success(message, options) {
88
+ const result = await notify.success(message, options);
89
+ this.updateState();
90
+ return result;
91
+ }
92
+ /**
93
+ * Send an error notification
94
+ */
95
+ async error(message, options) {
96
+ const result = await notify.error(message, options);
97
+ this.updateState();
98
+ return result;
99
+ }
100
+ /**
101
+ * Send a warning notification
102
+ */
103
+ async warning(message, options) {
104
+ const result = await notify.warning(message, options);
105
+ this.updateState();
106
+ return result;
107
+ }
108
+ /**
109
+ * Send an info notification
110
+ */
111
+ async info(message, options) {
112
+ const result = await notify.info(message, options);
113
+ this.updateState();
114
+ return result;
115
+ }
116
+ /**
117
+ * Send a loading notification
118
+ */
119
+ async loading(message, options) {
120
+ const result = await notify.loading(message, options);
121
+ this.updateState();
122
+ return result;
123
+ }
124
+ /**
125
+ * Show a confirmation dialog
126
+ */
127
+ async confirm(message, options) {
128
+ return confirm(message, options);
129
+ }
130
+ /**
131
+ * Show a prompt dialog
132
+ */
133
+ async prompt(message, options) {
134
+ return prompt(message, options);
135
+ }
136
+ /**
137
+ * Create a progress notification
138
+ */
139
+ progress(message, options) {
140
+ return createProgressController(
141
+ `progress-${Date.now()}`,
142
+ message,
143
+ options
144
+ );
145
+ }
146
+ /**
147
+ * Dismiss a notification
148
+ */
149
+ dismiss(id) {
150
+ dismissVisualFeedback(id);
151
+ this.updateState();
152
+ }
153
+ /**
154
+ * Dismiss all notifications
155
+ */
156
+ dismissAll() {
157
+ dismissAllVisualFeedback();
158
+ this.updateState();
159
+ }
160
+ /**
161
+ * Update configuration
162
+ */
163
+ configure(config) {
164
+ configureFeedback(config);
165
+ this.updateState();
166
+ }
167
+ /**
168
+ * Reset configuration to defaults
169
+ */
170
+ resetConfig() {
171
+ resetConfig();
172
+ this.updateState();
173
+ }
174
+ /**
175
+ * Get current configuration
176
+ */
177
+ getConfig() {
178
+ return getConfig();
179
+ }
180
+ };
181
+ A11yFeedbackService = __decorateClass([
182
+ Injectable({
183
+ providedIn: "root"
184
+ })
185
+ ], A11yFeedbackService);
186
+
187
+ // src/a11y-feedback.module.ts
188
+ import { NgModule } from "@angular/core";
189
+ var A11yFeedbackModule = class {
190
+ /**
191
+ * Configure the module with options
192
+ */
193
+ static forRoot(options) {
194
+ return {
195
+ ngModule: A11yFeedbackModule,
196
+ providers: [
197
+ {
198
+ provide: A11yFeedbackService,
199
+ useFactory: () => {
200
+ const service = new A11yFeedbackService();
201
+ if (options?.config) {
202
+ service.configure(options.config);
203
+ }
204
+ return service;
205
+ }
206
+ }
207
+ ]
208
+ };
209
+ }
210
+ };
211
+ A11yFeedbackModule = __decorateClass([
212
+ NgModule({})
213
+ ], A11yFeedbackModule);
214
+
215
+ // src/provide.ts
216
+ import { makeEnvironmentProviders } from "@angular/core";
217
+ import { configureFeedback as configureFeedback2 } from "@theaccessibleteam/a11y-feedback";
218
+ function provideA11yFeedback(options) {
219
+ if (options?.config) {
220
+ configureFeedback2(options.config);
221
+ }
222
+ return makeEnvironmentProviders([
223
+ A11yFeedbackService
224
+ ]);
225
+ }
226
+ export {
227
+ A11yFeedbackModule,
228
+ A11yFeedbackService,
229
+ provideA11yFeedback
230
+ };
package/package.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "@theaccessibleteam/a11y-feedback-angular",
3
+ "version": "2.0.0",
4
+ "description": "Angular bindings for a11y-feedback accessibility notification library",
5
+ "type": "module",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js",
13
+ "require": "./dist/index.cjs"
14
+ }
15
+ },
16
+ "files": [
17
+ "dist"
18
+ ],
19
+ "scripts": {
20
+ "build": "tsup src/index.ts --format cjs,esm --dts --clean",
21
+ "dev": "tsup src/index.ts --format cjs,esm --dts --watch"
22
+ },
23
+ "peerDependencies": {
24
+ "@theaccessibleteam/a11y-feedback": "^2.0.0",
25
+ "@angular/core": ">=15.0.0",
26
+ "rxjs": ">=7.0.0"
27
+ },
28
+ "devDependencies": {
29
+ "@angular/core": "^17.0.0",
30
+ "rxjs": "^7.8.0",
31
+ "tsup": "^8.0.0",
32
+ "typescript": "^5.0.0"
33
+ },
34
+ "keywords": [
35
+ "angular",
36
+ "a11y",
37
+ "accessibility",
38
+ "notifications",
39
+ "screen-reader",
40
+ "aria"
41
+ ],
42
+ "author": "The Accessible Team",
43
+ "license": "MIT",
44
+ "repository": {
45
+ "type": "git",
46
+ "url": "git+https://github.com/WOLFIEEEE/a11y-feedback.git",
47
+ "directory": "packages/angular"
48
+ },
49
+ "publishConfig": {
50
+ "access": "public"
51
+ }
52
+ }