ngx-kit 2.0.2 → 3.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/fesm2022/ngx-kit-menu.mjs +8 -13
- package/fesm2022/ngx-kit-menu.mjs.map +1 -1
- package/fesm2022/ngx-kit-message.mjs +350 -0
- package/fesm2022/ngx-kit-message.mjs.map +1 -0
- package/fesm2022/ngx-kit-notify.mjs +157 -90
- package/fesm2022/ngx-kit-notify.mjs.map +1 -1
- package/fesm2022/ngx-kit-shared.mjs +9 -4
- package/fesm2022/ngx-kit-shared.mjs.map +1 -1
- package/package.json +5 -1
- package/types/ngx-kit-menu.d.ts +1 -1
- package/types/ngx-kit-message.d.ts +276 -0
- package/types/ngx-kit-notify.d.ts +92 -8
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, output, signal, inject, DOCUMENT, ElementRef, afterNextRender, Input, Component, EnvironmentInjector, ApplicationRef, createComponent, Injectable, makeEnvironmentProviders, provideEnvironmentInitializer, Injector } from '@angular/core';
|
|
2
|
+
import { InjectionToken, input, viewChild, output, signal, inject, DOCUMENT, ElementRef, ChangeDetectorRef, afterNextRender, effect, Input, Component, EnvironmentInjector, ApplicationRef, EventEmitter, createComponent, Injectable, makeEnvironmentProviders, provideEnvironmentInitializer, Injector } from '@angular/core';
|
|
3
3
|
import { WINDOW } from 'ngx-kit/shared';
|
|
4
4
|
import { CommonModule } from '@angular/common';
|
|
5
|
+
import { DomSanitizer } from '@angular/platform-browser';
|
|
5
6
|
|
|
6
7
|
const NGX_NOTIFY_CONFIG = new InjectionToken('NgxNotifyOption');
|
|
7
8
|
const NGX_NOTIFY_API = new InjectionToken('NgxNotifyService');
|
|
@@ -12,6 +13,7 @@ const NGX_NOTIFY_DEFAULTS = {
|
|
|
12
13
|
allowHtml: false,
|
|
13
14
|
pauseOnHover: true,
|
|
14
15
|
dismissible: true,
|
|
16
|
+
closeOnTap: true,
|
|
15
17
|
containerClass: 'ngx-bg-notify',
|
|
16
18
|
notificationClass: 'ngx-notify',
|
|
17
19
|
};
|
|
@@ -22,121 +24,160 @@ const NGX_NOTIFY_DEFAULTS = {
|
|
|
22
24
|
*/
|
|
23
25
|
class Notify {
|
|
24
26
|
static injector;
|
|
25
|
-
static show(
|
|
27
|
+
static show(type = 'info', message, description, options) {
|
|
26
28
|
if (!Notify.injector) {
|
|
27
|
-
|
|
28
|
-
return;
|
|
29
|
+
throw new Error('ngx-kit: Error on EnvironmentProvider. Ensure "provideNotify()" in root provider.');
|
|
29
30
|
}
|
|
30
|
-
Notify.injector.get(NGX_NOTIFY_API).show(message, type, options);
|
|
31
|
+
return Notify.injector.get(NGX_NOTIFY_API).show(message, description, type, options);
|
|
31
32
|
}
|
|
32
|
-
static info(message, options) {
|
|
33
|
-
this.show(
|
|
33
|
+
static info(message, description, options) {
|
|
34
|
+
return this.show('info', message, description, options);
|
|
34
35
|
}
|
|
35
|
-
static success(message, options) {
|
|
36
|
-
this.show(
|
|
36
|
+
static success(message, description, options) {
|
|
37
|
+
return this.show('success', message, description, options);
|
|
37
38
|
}
|
|
38
|
-
static warning(message, options) {
|
|
39
|
-
this.show(
|
|
39
|
+
static warning(message, description, options) {
|
|
40
|
+
return this.show('warning', message, description, options);
|
|
40
41
|
}
|
|
41
|
-
static error(message, options) {
|
|
42
|
-
this.show(
|
|
42
|
+
static error(message, description, options) {
|
|
43
|
+
return this.show('error', message, description, options);
|
|
43
44
|
}
|
|
44
45
|
}
|
|
45
46
|
|
|
46
|
-
class
|
|
47
|
-
|
|
48
|
-
payload;
|
|
47
|
+
class NgxNotificationComponent {
|
|
48
|
+
payload = input.required(/* @ts-ignore */
|
|
49
|
+
...(ngDevMode ? [{ debugName: "payload" }] : /* istanbul ignore next */ []));
|
|
49
50
|
containerClass = 'ngx-notify';
|
|
51
|
+
bar = viewChild('bar', /* @ts-ignore */
|
|
52
|
+
...(ngDevMode ? [{ debugName: "bar" }] : /* istanbul ignore next */ []));
|
|
50
53
|
onClose = output();
|
|
51
54
|
onFinish = output();
|
|
52
|
-
|
|
55
|
+
_rafId = 0;
|
|
56
|
+
_duration = 0;
|
|
53
57
|
_remaining = 0;
|
|
54
58
|
_endTs = 0;
|
|
55
59
|
_paused = false;
|
|
56
60
|
safeMessage = '';
|
|
61
|
+
safeDescription = '';
|
|
57
62
|
showClass = signal('', /* @ts-ignore */
|
|
58
63
|
...(ngDevMode ? [{ debugName: "showClass" }] : /* istanbul ignore next */ []));
|
|
59
64
|
doc = inject(DOCUMENT);
|
|
60
65
|
el = inject(ElementRef);
|
|
61
|
-
|
|
62
|
-
|
|
66
|
+
sanitizer = inject(DomSanitizer);
|
|
67
|
+
chdr = inject(ChangeDetectorRef);
|
|
68
|
+
constructor() {
|
|
63
69
|
afterNextRender(() => {
|
|
64
70
|
this.showClass.set('ngx-show');
|
|
71
|
+
this.chdr.detectChanges();
|
|
72
|
+
});
|
|
73
|
+
effect(() => {
|
|
74
|
+
const payload = this.payload();
|
|
75
|
+
// decide how to render message
|
|
76
|
+
if (payload.options.allowHtml) {
|
|
77
|
+
this.safeMessage = this.sanitizer.bypassSecurityTrustHtml(payload.message);
|
|
78
|
+
this.safeDescription = this.sanitizer.bypassSecurityTrustHtml(payload.description ?? '');
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
this.safeMessage = this.escapeHtml(payload.message);
|
|
82
|
+
this.safeDescription = this.escapeHtml(payload.description);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
effect(() => {
|
|
86
|
+
const timeout = this.payload().options.timeout ?? 0;
|
|
87
|
+
this.startTimer(timeout);
|
|
65
88
|
});
|
|
66
89
|
}
|
|
67
|
-
ngOnInit() {
|
|
68
|
-
// decide how to render message
|
|
69
|
-
if (this.payload.options.allowHtml) {
|
|
70
|
-
this.safeMessage = this.payload.message;
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
this.safeMessage = this.escapeHtml(this.payload.message);
|
|
74
|
-
}
|
|
75
|
-
if (this.payload.options.timeout && this.payload.options.timeout > 0) {
|
|
76
|
-
this.startTimer(this.payload.options.timeout);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
90
|
+
ngOnInit() { }
|
|
79
91
|
ngOnDestroy() {
|
|
80
92
|
this.clearTimer();
|
|
81
93
|
}
|
|
82
94
|
// Public API to start timer (used by service when created)
|
|
83
95
|
startTimer(ms) {
|
|
84
96
|
this.clearTimer();
|
|
97
|
+
if (!this._paused) {
|
|
98
|
+
this._duration = ms;
|
|
99
|
+
}
|
|
85
100
|
this._remaining = ms;
|
|
86
|
-
this._endTs =
|
|
87
|
-
|
|
101
|
+
this._endTs = performance.now() + ms;
|
|
102
|
+
const bar = this.bar()?.nativeElement;
|
|
103
|
+
if (bar) {
|
|
104
|
+
bar.style.transition = `transform ${ms}ms linear`;
|
|
105
|
+
bar.style.transform = 'scaleX(1)';
|
|
106
|
+
}
|
|
107
|
+
this.animateProgress();
|
|
88
108
|
}
|
|
89
109
|
pauseTimer() {
|
|
90
|
-
if (!this._timeoutId)
|
|
91
|
-
return;
|
|
92
110
|
this._paused = true;
|
|
93
|
-
|
|
94
|
-
this._remaining = Math.max(0, this._endTs -
|
|
111
|
+
cancelAnimationFrame(this._rafId);
|
|
112
|
+
this._remaining = Math.max(0, this._endTs - performance.now());
|
|
113
|
+
const bar = this.bar()?.nativeElement;
|
|
114
|
+
if (bar) {
|
|
115
|
+
const matrix = getComputedStyle(bar).transform;
|
|
116
|
+
bar.style.transition = 'none';
|
|
117
|
+
bar.style.transform = matrix;
|
|
118
|
+
}
|
|
95
119
|
}
|
|
96
120
|
resumeTimer() {
|
|
97
|
-
if (!this._paused || this._remaining <= 0)
|
|
121
|
+
if (!this._paused || this._remaining <= 0) {
|
|
98
122
|
return;
|
|
123
|
+
}
|
|
99
124
|
this._paused = false;
|
|
100
125
|
this.startTimer(this._remaining);
|
|
101
126
|
}
|
|
127
|
+
clearTimer() {
|
|
128
|
+
cancelAnimationFrame(this._rafId);
|
|
129
|
+
this._rafId = 0;
|
|
130
|
+
}
|
|
131
|
+
animateProgress() {
|
|
132
|
+
const update = () => {
|
|
133
|
+
const remaining = Math.max(0, this._endTs - performance.now());
|
|
134
|
+
if (remaining <= 0) {
|
|
135
|
+
this.onFinish.emit({
|
|
136
|
+
id: this.payload().id,
|
|
137
|
+
el: this.el.nativeElement,
|
|
138
|
+
});
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
this._rafId = requestAnimationFrame(update);
|
|
142
|
+
};
|
|
143
|
+
this._rafId = requestAnimationFrame(update);
|
|
144
|
+
}
|
|
102
145
|
close(ev) {
|
|
103
146
|
if (ev)
|
|
104
147
|
ev.stopPropagation();
|
|
105
|
-
this.onClose.emit({ id: this.payload.id, el: this.el.nativeElement });
|
|
148
|
+
this.onClose.emit({ id: this.payload().id, el: this.el.nativeElement });
|
|
106
149
|
}
|
|
107
150
|
onMouseEnter() {
|
|
108
|
-
if (this.payload.options.pauseOnHover)
|
|
151
|
+
if (this.payload().options.pauseOnHover)
|
|
109
152
|
this.pauseTimer();
|
|
110
153
|
}
|
|
111
154
|
onMouseLeave() {
|
|
112
|
-
if (this.payload.options.pauseOnHover)
|
|
155
|
+
if (this.payload().options.pauseOnHover)
|
|
113
156
|
this.resumeTimer();
|
|
114
157
|
}
|
|
158
|
+
onTap() {
|
|
159
|
+
if (this.payload().options.closeOnTap)
|
|
160
|
+
this.close();
|
|
161
|
+
}
|
|
115
162
|
escapeHtml(input) {
|
|
163
|
+
if (!input)
|
|
164
|
+
return '';
|
|
116
165
|
const div = this.doc.createElement('div');
|
|
117
166
|
div.appendChild(this.doc.createTextNode(input));
|
|
118
|
-
return div.
|
|
167
|
+
return div.textContent;
|
|
119
168
|
}
|
|
120
169
|
ngOnDestroyCleanup() {
|
|
121
170
|
this.clearTimer();
|
|
122
171
|
}
|
|
123
|
-
|
|
124
|
-
if (
|
|
125
|
-
clearTimeout(this._timeoutId);
|
|
126
|
-
this._timeoutId = null;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: NgxPgNotificationComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
130
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.4", type: NgxPgNotificationComponent, isStandalone: true, selector: "ngx-notification", inputs: { payload: "payload", containerClass: "containerClass" }, outputs: { onClose: "onClose", onFinish: "onFinish" }, ngImport: i0, template: "<div\n class=\"{{ containerClass }} {{ containerClass }}-{{ payload.type }} {{ showClass() }}\"\n role=\"status\"\n (mouseenter)=\"onMouseEnter()\"\n (mouseleave)=\"onMouseLeave()\"\n [attr.aria-live]=\"payload.type === 'error' || payload.type === 'warning' ? 'assertive' : 'polite'\"\n [attr.data-id]=\"payload.id\">\n <span [innerHTML]=\"safeMessage\"></span>\n @if (payload.options.dismissible) {\n <button class=\"ngx-close\" (click)=\"close($event)\" aria-label=\"close\">\u00D7</button>\n }\n</div>\n", styles: [":host{display:block;margin:8px 0}.ngx-notify{min-width:240px;width:500px;max-width:100%;padding:14px 18px;border-radius:8px;box-shadow:0 10px 30px #00000014;font-family:Inter,Roboto,Arial,sans-serif;font-size:14px;text-align:center;opacity:0;transform:translateY(-8px);transition:opacity .28s ease,transform .28s ease;pointer-events:auto}.ngx-show{opacity:1;transform:translateY(0)}.ngx-notify-info{background:#0a78cc;color:#e8f3ff}.ngx-notify-success{background:#03bc50;color:#ebeceb}.ngx-notify-warning{background:#e28408;color:#fff4e5}.ngx-notify-error{background:#e7012b;color:#ffecec}.ngx-close{position:absolute;right:8px;top:6px;background:transparent;border:none;font-size:18px;cursor:pointer}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }] });
|
|
172
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: NgxNotificationComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
173
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.4", type: NgxNotificationComponent, isStandalone: true, selector: "ngx-notification", inputs: { payload: { classPropertyName: "payload", publicName: "payload", isSignal: true, isRequired: true, transformFunction: null }, containerClass: { classPropertyName: "containerClass", publicName: "containerClass", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { onClose: "onClose", onFinish: "onFinish" }, viewQueries: [{ propertyName: "bar", first: true, predicate: ["bar"], descendants: true, isSignal: true }], ngImport: i0, template: "<div\n class=\"{{ containerClass }} {{ containerClass }}-{{ payload().type }} {{ showClass() }}\"\n role=\"status\"\n (mouseenter)=\"onMouseEnter()\"\n (mouseleave)=\"onMouseLeave()\"\n (click)=\"onTap()\"\n [attr.aria-live]=\"\n payload().type === 'error' || payload().type === 'warning' ? 'assertive' : 'polite'\n \"\n [attr.data-id]=\"payload().id\">\n <div class=\"ngx-notify-icon-container\">\n <div class=\"ngx-notify-icon\">\n @switch (payload().type) {\n @case ('success') {\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <path\n fill=\"currentColor\"\n d=\"M235.3 331.3C229.1 337.6 218.9 337.6 212.7 331.3L148.7 267.3C142.4 261.1 142.4 250.9 148.7 244.7C154.9 238.4 165.1 238.4 171.3 244.7L224 297.4L340.7 180.7C346.9 174.4 357.1 174.4 363.3 180.7C369.6 186.9 369.6 197.1 363.3 203.3L235.3 331.3zM512 256C512 397.4 397.4 512 256 512C114.6 512 0 397.4 0 256C0 114.6 114.6 0 256 0C397.4 0 512 114.6 512 256zM256 32C132.3 32 32 132.3 32 256C32 379.7 132.3 480 256 480C379.7 480 480 379.7 480 256C480 132.3 379.7 32 256 32z\" />\n </svg>\n }\n @case ('error') {\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <path\n fill=\"currentColor\"\n d=\"M180.7 180.7C186.9 174.4 197.1 174.4 203.3 180.7L256 233.4L308.7 180.7C314.9 174.4 325.1 174.4 331.3 180.7C337.6 186.9 337.6 197.1 331.3 203.3L278.6 255.1L331.3 308.7C337.6 314.9 337.6 325.1 331.3 331.3C325.1 337.6 314.9 337.6 308.7 331.3L256 278.6L203.3 331.3C197.1 337.6 186.9 337.6 180.7 331.3C174.4 325.1 174.4 314.9 180.7 308.7L233.4 255.1L180.7 203.3C174.4 197.1 174.4 186.9 180.7 180.7V180.7zM.0669 191.5C.0669 172.4 7.652 154.1 21.16 140.6L140.6 21.15C154.1 7.648 172.4 .0625 191.5 .0625H320.5C339.6 .0625 357.9 7.648 371.4 21.15L490.8 140.6C504.3 154.1 511.9 172.4 511.9 191.5V320.5C511.9 339.6 504.3 357.9 490.8 371.4L371.4 490.8C357.9 504.3 339.6 511.9 320.5 511.9H191.5C172.4 511.9 154.1 504.3 140.6 490.8L21.15 371.4C7.652 357.9 .0666 339.6 .0666 320.5L.0669 191.5zM43.78 163.2C36.28 170.7 32.07 180.9 32.07 191.5V320.5C32.07 331.1 36.28 341.3 43.78 348.8L163.2 468.2C170.7 475.7 180.9 479.9 191.5 479.9H320.5C331.1 479.9 341.3 475.7 348.8 468.2L468.2 348.8C475.7 341.3 479.9 331.1 479.9 320.5V191.5C479.9 180.9 475.7 170.7 468.2 163.2L348.8 43.78C341.3 36.28 331.1 32.06 320.5 32.06H191.5C180.9 32.06 170.7 36.28 163.2 43.78L43.78 163.2zM43.78 348.8L21.15 371.4z\" />\n </svg>\n }\n @case ('warning') {\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <path\n fill=\"currentColor\"\n d=\"M256 360c-13.25 0-23.1 10.74-23.1 24c0 13.25 10.75 24 23.1 24c13.25 0 23.1-10.75 23.1-24C280 370.7 269.3 360 256 360zM256 320c8.843 0 15.1-7.156 15.1-16V160c0-8.844-7.155-16-15.1-16S240 151.2 240 160v144C240 312.8 247.2 320 256 320zM504.3 397.3L304.5 59.38C294.4 42.27 276.2 32.03 256 32C235.8 32 217.7 42.22 207.5 59.36l-199.9 338c-10.05 16.97-10.2 37.34-.4218 54.5C17.29 469.5 35.55 480 56.1 480h399.9c20.51 0 38.75-10.53 48.81-28.17C514.6 434.7 514.4 414.3 504.3 397.3zM476.1 435.1C472.7 443.5 464.8 448 455.1 448H56.1c-8.906 0-16.78-4.484-21.08-12c-4.078-7.156-4.015-15.3 .1562-22.36L235.1 75.66C239.4 68.36 247.2 64 256 64c0 0-.0156 0 0 0c8.765 .0156 16.56 4.359 20.86 11.64l199.9 338C480.1 420.7 481.1 428.8 476.1 435.1z\" />\n </svg>\n }\n @case ('info') {\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <path\n fill=\"currentColor\"\n d=\"M256 0C114.6 0 0 114.6 0 256s114.6 256 256 256s256-114.6 256-256S397.4 0 256 0zM256 480c-123.5 0-224-100.5-224-224s100.5-224 224-224s224 100.5 224 224S379.5 480 256 480zM256 184c13.25 0 24-10.74 24-24c0-13.25-10.75-24-24-24S232 146.7 232 160C232 173.3 242.7 184 256 184zM304 352h-32V240C272 231.2 264.8 224 256 224H224C215.2 224 208 231.2 208 240S215.2 256 224 256h16v96h-32C199.2 352 192 359.2 192 368C192 376.8 199.2 384 208 384h96c8.836 0 16-7.164 16-16C320 359.2 312.8 352 304 352z\" />\n </svg>\n }\n }\n </div>\n </div>\n\n <div class=\"ngx-notify-content\">\n <div class=\"ngx-notify-title\" [innerHTML]=\"safeMessage\"></div>\n <div class=\"ngx-notify-description\" [innerHTML]=\"safeDescription\"></div>\n </div>\n\n @if (payload().options.dismissible) {\n <div class=\"ngx-notify-close-container\">\n <button class=\"ngx-notify-close\" (click)=\"close($event)\" aria-label=\"close\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 320 512\">\n <path\n fill=\"currentColor\"\n d=\"M315.3 411.3c-6.253 6.253-16.37 6.253-22.63 0L160 278.6l-132.7 132.7c-6.253 6.253-16.37 6.253-22.63 0c-6.253-6.253-6.253-16.37 0-22.63L137.4 256L4.69 123.3c-6.253-6.253-6.253-16.37 0-22.63c6.253-6.253 16.37-6.253 22.63 0L160 233.4l132.7-132.7c6.253-6.253 16.37-6.253 22.63 0c6.253 6.253 6.253 16.37 0 22.63L182.6 256l132.7 132.7C321.6 394.9 321.6 405.1 315.3 411.3z\" />\n </svg>\n </button>\n </div>\n }\n\n <div class=\"ngx-notify-progress\">\n <div class=\"progress-bar\" #bar></div>\n </div>\n</div>\n", styles: [":host{display:block;margin:8px 0;--ngx-notify-content-bg: light-dark(#ffffff, #262b35);--ngx-notify-content-fg: light-dark(#000, #fff)}.ngx-notify{display:flex;min-width:240px;width:500px;max-width:100%;border-radius:8px;box-shadow:0 0 30px #6766667c;opacity:0;transform:translateY(-8px);transition:opacity .28s ease,transform .28s ease;pointer-events:auto;overflow:hidden}.ngx-notify-icon-container{width:60px;min-width:60px;display:flex;align-items:center;justify-content:center}.ngx-notify-icon-container .ngx-notify-icon{padding:15px}.ngx-notify-icon-container .ngx-notify-icon svg{width:100%;height:100%}.ngx-notify-content{background-color:var(--ngx-notify-content-bg);color:var(--ngx-notify-content-fg);padding:15px;border-radius:0 0 0 15px;flex:auto}.ngx-notify-content .ngx-notify-title{font-size:1rem}.ngx-notify-content .ngx-notify-description{opacity:.8;font-size:.8rem}.ngx-show{opacity:1;transform:translateY(0)}.ngx-notify-info{background:#1cacff;--var-ngx-progress-bar-bg: #1cacff;color:#e8f3ff}.ngx-notify-success{background:#54c999;--var-ngx-progress-bar-bg: #54c999;color:#ebeceb}.ngx-notify-warning{background:#ffb242;--var-ngx-progress-bar-bg: #ffb242;color:#ffecec}.ngx-notify-error{background:#ff3c39;--var-ngx-progress-bar-bg: #ff3c39;color:#ffecec}.ngx-notify-close-container{background-color:var(--ngx-notify-content-bg);color:var(--ngx-notify-content-fg);display:flex;align-items:center;justify-content:center}.ngx-notify-close-container .ngx-notify-close{background:transparent;border:none;width:22px;height:22px;line-height:0;margin:0 5px;cursor:pointer;transform:rotate(0);transition:transform .4s}.ngx-notify-close-container .ngx-notify-close:hover{transform:rotate(90deg)}.ngx-notify-progress{position:absolute;bottom:0;height:4px;left:60px;right:0;overflow:hidden}.ngx-notify-progress .progress-bar{background-color:var(--var-ngx-progress-bar-bg);height:100%;transform:scaleX(0);transform-origin:left}::ng-deep html[dir=rtl] .ngx-notify-content,::ng-deep body[dir=ltr] .ngx-notify-content{border-radius:0 0 15px}::ng-deep html[dir=rtl] .ngx-notify-progress,::ng-deep body[dir=ltr] .ngx-notify-progress{left:0;right:60px}::ng-deep html[dir=rtl] .ngx-notify-progress .progress-bar,::ng-deep body[dir=ltr] .ngx-notify-progress .progress-bar{transform-origin:right!important}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }] });
|
|
131
174
|
}
|
|
132
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type:
|
|
175
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: NgxNotificationComponent, decorators: [{
|
|
133
176
|
type: Component,
|
|
134
|
-
args: [{ selector: 'ngx-notification', imports: [CommonModule], template: "<div\n class=\"{{ containerClass }} {{ containerClass }}-{{ payload.type }} {{ showClass() }}\"\n role=\"status\"\n (mouseenter)=\"onMouseEnter()\"\n (mouseleave)=\"onMouseLeave()\"\n [attr.aria-live]=\"payload.type === 'error' || payload.type === 'warning' ? 'assertive' : 'polite'\"\n [attr.data-id]=\"payload.id\">\n <
|
|
135
|
-
}], ctorParameters: () => [{ type: i0.
|
|
136
|
-
type: Input
|
|
137
|
-
}], containerClass: [{
|
|
177
|
+
args: [{ selector: 'ngx-notification', imports: [CommonModule], template: "<div\n class=\"{{ containerClass }} {{ containerClass }}-{{ payload().type }} {{ showClass() }}\"\n role=\"status\"\n (mouseenter)=\"onMouseEnter()\"\n (mouseleave)=\"onMouseLeave()\"\n (click)=\"onTap()\"\n [attr.aria-live]=\"\n payload().type === 'error' || payload().type === 'warning' ? 'assertive' : 'polite'\n \"\n [attr.data-id]=\"payload().id\">\n <div class=\"ngx-notify-icon-container\">\n <div class=\"ngx-notify-icon\">\n @switch (payload().type) {\n @case ('success') {\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <path\n fill=\"currentColor\"\n d=\"M235.3 331.3C229.1 337.6 218.9 337.6 212.7 331.3L148.7 267.3C142.4 261.1 142.4 250.9 148.7 244.7C154.9 238.4 165.1 238.4 171.3 244.7L224 297.4L340.7 180.7C346.9 174.4 357.1 174.4 363.3 180.7C369.6 186.9 369.6 197.1 363.3 203.3L235.3 331.3zM512 256C512 397.4 397.4 512 256 512C114.6 512 0 397.4 0 256C0 114.6 114.6 0 256 0C397.4 0 512 114.6 512 256zM256 32C132.3 32 32 132.3 32 256C32 379.7 132.3 480 256 480C379.7 480 480 379.7 480 256C480 132.3 379.7 32 256 32z\" />\n </svg>\n }\n @case ('error') {\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <path\n fill=\"currentColor\"\n d=\"M180.7 180.7C186.9 174.4 197.1 174.4 203.3 180.7L256 233.4L308.7 180.7C314.9 174.4 325.1 174.4 331.3 180.7C337.6 186.9 337.6 197.1 331.3 203.3L278.6 255.1L331.3 308.7C337.6 314.9 337.6 325.1 331.3 331.3C325.1 337.6 314.9 337.6 308.7 331.3L256 278.6L203.3 331.3C197.1 337.6 186.9 337.6 180.7 331.3C174.4 325.1 174.4 314.9 180.7 308.7L233.4 255.1L180.7 203.3C174.4 197.1 174.4 186.9 180.7 180.7V180.7zM.0669 191.5C.0669 172.4 7.652 154.1 21.16 140.6L140.6 21.15C154.1 7.648 172.4 .0625 191.5 .0625H320.5C339.6 .0625 357.9 7.648 371.4 21.15L490.8 140.6C504.3 154.1 511.9 172.4 511.9 191.5V320.5C511.9 339.6 504.3 357.9 490.8 371.4L371.4 490.8C357.9 504.3 339.6 511.9 320.5 511.9H191.5C172.4 511.9 154.1 504.3 140.6 490.8L21.15 371.4C7.652 357.9 .0666 339.6 .0666 320.5L.0669 191.5zM43.78 163.2C36.28 170.7 32.07 180.9 32.07 191.5V320.5C32.07 331.1 36.28 341.3 43.78 348.8L163.2 468.2C170.7 475.7 180.9 479.9 191.5 479.9H320.5C331.1 479.9 341.3 475.7 348.8 468.2L468.2 348.8C475.7 341.3 479.9 331.1 479.9 320.5V191.5C479.9 180.9 475.7 170.7 468.2 163.2L348.8 43.78C341.3 36.28 331.1 32.06 320.5 32.06H191.5C180.9 32.06 170.7 36.28 163.2 43.78L43.78 163.2zM43.78 348.8L21.15 371.4z\" />\n </svg>\n }\n @case ('warning') {\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <path\n fill=\"currentColor\"\n d=\"M256 360c-13.25 0-23.1 10.74-23.1 24c0 13.25 10.75 24 23.1 24c13.25 0 23.1-10.75 23.1-24C280 370.7 269.3 360 256 360zM256 320c8.843 0 15.1-7.156 15.1-16V160c0-8.844-7.155-16-15.1-16S240 151.2 240 160v144C240 312.8 247.2 320 256 320zM504.3 397.3L304.5 59.38C294.4 42.27 276.2 32.03 256 32C235.8 32 217.7 42.22 207.5 59.36l-199.9 338c-10.05 16.97-10.2 37.34-.4218 54.5C17.29 469.5 35.55 480 56.1 480h399.9c20.51 0 38.75-10.53 48.81-28.17C514.6 434.7 514.4 414.3 504.3 397.3zM476.1 435.1C472.7 443.5 464.8 448 455.1 448H56.1c-8.906 0-16.78-4.484-21.08-12c-4.078-7.156-4.015-15.3 .1562-22.36L235.1 75.66C239.4 68.36 247.2 64 256 64c0 0-.0156 0 0 0c8.765 .0156 16.56 4.359 20.86 11.64l199.9 338C480.1 420.7 481.1 428.8 476.1 435.1z\" />\n </svg>\n }\n @case ('info') {\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <path\n fill=\"currentColor\"\n d=\"M256 0C114.6 0 0 114.6 0 256s114.6 256 256 256s256-114.6 256-256S397.4 0 256 0zM256 480c-123.5 0-224-100.5-224-224s100.5-224 224-224s224 100.5 224 224S379.5 480 256 480zM256 184c13.25 0 24-10.74 24-24c0-13.25-10.75-24-24-24S232 146.7 232 160C232 173.3 242.7 184 256 184zM304 352h-32V240C272 231.2 264.8 224 256 224H224C215.2 224 208 231.2 208 240S215.2 256 224 256h16v96h-32C199.2 352 192 359.2 192 368C192 376.8 199.2 384 208 384h96c8.836 0 16-7.164 16-16C320 359.2 312.8 352 304 352z\" />\n </svg>\n }\n }\n </div>\n </div>\n\n <div class=\"ngx-notify-content\">\n <div class=\"ngx-notify-title\" [innerHTML]=\"safeMessage\"></div>\n <div class=\"ngx-notify-description\" [innerHTML]=\"safeDescription\"></div>\n </div>\n\n @if (payload().options.dismissible) {\n <div class=\"ngx-notify-close-container\">\n <button class=\"ngx-notify-close\" (click)=\"close($event)\" aria-label=\"close\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 320 512\">\n <path\n fill=\"currentColor\"\n d=\"M315.3 411.3c-6.253 6.253-16.37 6.253-22.63 0L160 278.6l-132.7 132.7c-6.253 6.253-16.37 6.253-22.63 0c-6.253-6.253-6.253-16.37 0-22.63L137.4 256L4.69 123.3c-6.253-6.253-6.253-16.37 0-22.63c6.253-6.253 16.37-6.253 22.63 0L160 233.4l132.7-132.7c6.253-6.253 16.37-6.253 22.63 0c6.253 6.253 6.253 16.37 0 22.63L182.6 256l132.7 132.7C321.6 394.9 321.6 405.1 315.3 411.3z\" />\n </svg>\n </button>\n </div>\n }\n\n <div class=\"ngx-notify-progress\">\n <div class=\"progress-bar\" #bar></div>\n </div>\n</div>\n", styles: [":host{display:block;margin:8px 0;--ngx-notify-content-bg: light-dark(#ffffff, #262b35);--ngx-notify-content-fg: light-dark(#000, #fff)}.ngx-notify{display:flex;min-width:240px;width:500px;max-width:100%;border-radius:8px;box-shadow:0 0 30px #6766667c;opacity:0;transform:translateY(-8px);transition:opacity .28s ease,transform .28s ease;pointer-events:auto;overflow:hidden}.ngx-notify-icon-container{width:60px;min-width:60px;display:flex;align-items:center;justify-content:center}.ngx-notify-icon-container .ngx-notify-icon{padding:15px}.ngx-notify-icon-container .ngx-notify-icon svg{width:100%;height:100%}.ngx-notify-content{background-color:var(--ngx-notify-content-bg);color:var(--ngx-notify-content-fg);padding:15px;border-radius:0 0 0 15px;flex:auto}.ngx-notify-content .ngx-notify-title{font-size:1rem}.ngx-notify-content .ngx-notify-description{opacity:.8;font-size:.8rem}.ngx-show{opacity:1;transform:translateY(0)}.ngx-notify-info{background:#1cacff;--var-ngx-progress-bar-bg: #1cacff;color:#e8f3ff}.ngx-notify-success{background:#54c999;--var-ngx-progress-bar-bg: #54c999;color:#ebeceb}.ngx-notify-warning{background:#ffb242;--var-ngx-progress-bar-bg: #ffb242;color:#ffecec}.ngx-notify-error{background:#ff3c39;--var-ngx-progress-bar-bg: #ff3c39;color:#ffecec}.ngx-notify-close-container{background-color:var(--ngx-notify-content-bg);color:var(--ngx-notify-content-fg);display:flex;align-items:center;justify-content:center}.ngx-notify-close-container .ngx-notify-close{background:transparent;border:none;width:22px;height:22px;line-height:0;margin:0 5px;cursor:pointer;transform:rotate(0);transition:transform .4s}.ngx-notify-close-container .ngx-notify-close:hover{transform:rotate(90deg)}.ngx-notify-progress{position:absolute;bottom:0;height:4px;left:60px;right:0;overflow:hidden}.ngx-notify-progress .progress-bar{background-color:var(--var-ngx-progress-bar-bg);height:100%;transform:scaleX(0);transform-origin:left}::ng-deep html[dir=rtl] .ngx-notify-content,::ng-deep body[dir=ltr] .ngx-notify-content{border-radius:0 0 15px}::ng-deep html[dir=rtl] .ngx-notify-progress,::ng-deep body[dir=ltr] .ngx-notify-progress{left:0;right:60px}::ng-deep html[dir=rtl] .ngx-notify-progress .progress-bar,::ng-deep body[dir=ltr] .ngx-notify-progress .progress-bar{transform-origin:right!important}\n"] }]
|
|
178
|
+
}], ctorParameters: () => [], propDecorators: { payload: [{ type: i0.Input, args: [{ isSignal: true, alias: "payload", required: true }] }], containerClass: [{
|
|
138
179
|
type: Input
|
|
139
|
-
}], onClose: [{ type: i0.Output, args: ["onClose"] }], onFinish: [{ type: i0.Output, args: ["onFinish"] }] } });
|
|
180
|
+
}], bar: [{ type: i0.ViewChild, args: ['bar', { isSignal: true }] }], onClose: [{ type: i0.Output, args: ["onClose"] }], onFinish: [{ type: i0.Output, args: ["onFinish"] }] } });
|
|
140
181
|
|
|
141
182
|
// We'll include a tiny inline uuid fallback if uuid package is not available
|
|
142
183
|
function makeId() {
|
|
@@ -154,50 +195,68 @@ class NgxNotifyService {
|
|
|
154
195
|
defaultOptions = inject(NGX_NOTIFY_CONFIG);
|
|
155
196
|
constructor() { }
|
|
156
197
|
configureContainer(position, containerClass) {
|
|
157
|
-
if (this.container)
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
container.
|
|
162
|
-
container.style.
|
|
198
|
+
if (!this.container) {
|
|
199
|
+
this.container = this.doc.createElement('div');
|
|
200
|
+
this.doc.body.appendChild(this.container);
|
|
201
|
+
}
|
|
202
|
+
this.container.className = containerClass + ' ngx-notify-container ' + `ngx-pos-${position}`;
|
|
203
|
+
this.container.style.position = 'fixed';
|
|
204
|
+
this.container.style.zIndex = '99999';
|
|
163
205
|
// center special
|
|
164
206
|
if (position === 'center') {
|
|
165
|
-
container.style.left = '50%';
|
|
166
|
-
container.style.top = '50%';
|
|
167
|
-
container.style.transform = 'translate(-50%,-50%)';
|
|
168
|
-
container.style.display = 'flex';
|
|
169
|
-
container.style.flexDirection = 'column';
|
|
170
|
-
container.style.alignItems = 'center';
|
|
171
|
-
container.style.pointerEvents = 'none';
|
|
207
|
+
this.container.style.left = '50%';
|
|
208
|
+
this.container.style.top = '50%';
|
|
209
|
+
this.container.style.transform = 'translate(-50%,-50%)';
|
|
210
|
+
this.container.style.display = 'flex';
|
|
211
|
+
this.container.style.flexDirection = 'column';
|
|
212
|
+
this.container.style.alignItems = 'center';
|
|
213
|
+
this.container.style.pointerEvents = 'none';
|
|
172
214
|
}
|
|
173
215
|
else {
|
|
174
216
|
if (position?.includes('center')) {
|
|
175
|
-
container.style.left = '50%';
|
|
176
|
-
container.style.transform = 'translateX(-50%)';
|
|
217
|
+
this.container.style.left = '50%';
|
|
218
|
+
this.container.style.transform = 'translateX(-50%)';
|
|
219
|
+
}
|
|
220
|
+
else {
|
|
221
|
+
this.container.style.transform = 'translateX(0)';
|
|
177
222
|
}
|
|
178
223
|
// corners
|
|
179
|
-
if (position?.includes('top'))
|
|
180
|
-
container.style.top = '20px';
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
224
|
+
if (position?.includes('top')) {
|
|
225
|
+
this.container.style.top = '20px';
|
|
226
|
+
}
|
|
227
|
+
else {
|
|
228
|
+
this.container.style.bottom = '20px';
|
|
229
|
+
}
|
|
230
|
+
if (position?.includes('left')) {
|
|
231
|
+
this.container.style.left = '20px';
|
|
232
|
+
this.container.style.right = 'auto';
|
|
233
|
+
}
|
|
234
|
+
if (position?.includes('right')) {
|
|
235
|
+
this.container.style.right = '20px';
|
|
236
|
+
this.container.style.left = 'auto';
|
|
237
|
+
}
|
|
185
238
|
// else container.style.right = '20px';
|
|
186
|
-
container.style.display = 'flex';
|
|
187
|
-
container.style.flexDirection = 'column';
|
|
239
|
+
this.container.style.display = 'flex';
|
|
240
|
+
this.container.style.flexDirection = 'column';
|
|
188
241
|
if (position?.includes('bottom'))
|
|
189
|
-
container.style.flexDirection = 'column-reverse';
|
|
190
|
-
container.style.pointerEvents = 'none';
|
|
242
|
+
this.container.style.flexDirection = 'column-reverse';
|
|
243
|
+
this.container.style.pointerEvents = 'none';
|
|
191
244
|
}
|
|
192
|
-
this.doc.body.appendChild(container);
|
|
193
|
-
this.container = container;
|
|
194
245
|
}
|
|
195
|
-
show(message, type = 'info', options) {
|
|
246
|
+
show(message, description, type = 'info', options) {
|
|
196
247
|
const opts = { ...this.defaultOptions, ...(options || {}) };
|
|
197
248
|
const id = typeof this.win.crypto?.randomUUID === 'function'
|
|
198
249
|
? this.win.crypto.randomUUID()
|
|
199
250
|
: makeId();
|
|
200
|
-
const payload = {
|
|
251
|
+
const payload = {
|
|
252
|
+
id,
|
|
253
|
+
message,
|
|
254
|
+
description,
|
|
255
|
+
type,
|
|
256
|
+
options: opts,
|
|
257
|
+
onClose: new EventEmitter(),
|
|
258
|
+
onFinish: new EventEmitter(),
|
|
259
|
+
};
|
|
201
260
|
this.configureContainer(opts.position, opts.containerClass);
|
|
202
261
|
// queue or show immediately
|
|
203
262
|
if (this.visible.length >= opts.maxVisible) {
|
|
@@ -206,19 +265,27 @@ class NgxNotifyService {
|
|
|
206
265
|
else {
|
|
207
266
|
this._createAndShow(payload);
|
|
208
267
|
}
|
|
268
|
+
return payload;
|
|
209
269
|
}
|
|
210
270
|
_createAndShow(payload) {
|
|
211
271
|
if (!this.container)
|
|
212
272
|
this.configureContainer(payload.options.position, payload.options.containerClass);
|
|
213
273
|
const host = document.createElement('div');
|
|
214
274
|
this.container.appendChild(host);
|
|
215
|
-
const compRef = createComponent(
|
|
275
|
+
const compRef = createComponent(NgxNotificationComponent, {
|
|
216
276
|
environmentInjector: this.envInjector,
|
|
217
277
|
hostElement: host,
|
|
218
278
|
});
|
|
219
|
-
compRef.
|
|
220
|
-
compRef.instance.onClose.subscribe((d) =>
|
|
221
|
-
|
|
279
|
+
compRef.setInput('payload', payload);
|
|
280
|
+
compRef.instance.onClose.subscribe((d) => {
|
|
281
|
+
this.removeEl(d);
|
|
282
|
+
payload.onClose.emit(d);
|
|
283
|
+
});
|
|
284
|
+
compRef.instance.onFinish.subscribe((d) => {
|
|
285
|
+
this.removeEl(d);
|
|
286
|
+
payload.onFinish.emit(d);
|
|
287
|
+
payload.onClose.emit(d);
|
|
288
|
+
});
|
|
222
289
|
// Registers the component’s view so it participates in change detection cycle.
|
|
223
290
|
this.appRef.attachView(compRef.hostView);
|
|
224
291
|
// store visible
|
|
@@ -288,5 +355,5 @@ function provideNotify(options) {
|
|
|
288
355
|
* Generated bundle index. Do not edit.
|
|
289
356
|
*/
|
|
290
357
|
|
|
291
|
-
export { Notify, provideNotify };
|
|
358
|
+
export { NGX_NOTIFY_API, NGX_NOTIFY_CONFIG, NGX_NOTIFY_DEFAULTS, NgxNotificationComponent, Notify, provideNotify };
|
|
292
359
|
//# sourceMappingURL=ngx-kit-notify.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngx-kit-notify.mjs","sources":["../../../projects/libs/notify/models/notify-config.ts","../../../projects/libs/notify/notify-facade.ts","../../../projects/libs/notify/components/notification.component.ts","../../../projects/libs/notify/components/notification.component.html","../../../projects/libs/notify/services/notify.service.ts","../../../projects/libs/notify/notify-provider.ts","../../../projects/libs/notify/ngx-kit-notify.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\nimport { NgxNotifyOptions } from './notify-options';\nimport { NgxNotifyService } from '../services/notify.service';\n\nexport const NGX_NOTIFY_CONFIG = new InjectionToken<NgxNotifyOptions>('NgxNotifyOption');\nexport const NGX_NOTIFY_API = new InjectionToken<NgxNotifyService>('NgxNotifyService');\n\nexport const NGX_NOTIFY_DEFAULTS: Required<NgxNotifyOptions> = {\n timeout: 3000,\n position: 'top-center',\n maxVisible: 10,\n allowHtml: false,\n pauseOnHover: true,\n dismissible: true,\n containerClass: 'ngx-bg-notify',\n notificationClass: 'ngx-notify',\n};\n","import { Injector } from '@angular/core';\nimport { NgxNotifyOptions } from './models/notify-options';\nimport { NGX_NOTIFY_API } from './models/notify-config';\n\n/**\n * Static facade so call sites can use: Notify.warn('msg', opts)\n * Module will set the service instance in its constructor.\n */\nexport class Notify {\n static injector: Injector;\n\n static show(\n message: string,\n type: 'info' | 'success' | 'warning' | 'error' = 'info',\n options?: NgxNotifyOptions,\n ) {\n if (!Notify.injector) {\n console.error(\n 'ngx-notify: Error on EnvironmentProvider. Ensure \"provideNotify()\" in root provider.',\n );\n return;\n }\n Notify.injector.get(NGX_NOTIFY_API).show(message, type, options);\n }\n\n static info(message: string, options?: NgxNotifyOptions) {\n this.show(message, 'info', options);\n }\n static success(message: string, options?: NgxNotifyOptions) {\n this.show(message, 'success', options);\n }\n static warning(message: string, options?: NgxNotifyOptions) {\n this.show(message, 'warning', options);\n }\n static error(message: string, options?: NgxNotifyOptions) {\n this.show(message, 'error', options);\n }\n}\n","import {\n Component,\n OnInit,\n OnDestroy,\n Input,\n ChangeDetectorRef,\n DOCUMENT,\n inject,\n ElementRef,\n Renderer2,\n afterNextRender,\n signal,\n output,\n} from '@angular/core';\nimport { INotifyEnd, NgxNotifyPayload } from '../models/notify.model';\nimport { CommonModule } from '@angular/common';\n\n@Component({\n selector: 'ngx-notification',\n templateUrl: './notification.component.html',\n styleUrls: ['./notification.component.scss'],\n imports: [CommonModule],\n})\nexport class NgxPgNotificationComponent implements OnInit, OnDestroy {\n @Input() payload!: NgxNotifyPayload;\n @Input() containerClass = 'ngx-notify';\n\n onClose = output<INotifyEnd>();\n onFinish = output<INotifyEnd>();\n\n private _timeoutId: any = null;\n private _remaining = 0;\n private _endTs = 0;\n private _paused = false;\n\n safeMessage = '';\n showClass = signal('');\n private doc = inject(DOCUMENT);\n private el = inject(ElementRef);\n constructor(private cdr: ChangeDetectorRef) {\n afterNextRender(() => {\n this.showClass.set('ngx-show');\n });\n }\n\n ngOnInit(): void {\n // decide how to render message\n if (this.payload.options.allowHtml) {\n this.safeMessage = this.payload.message;\n } else {\n this.safeMessage = this.escapeHtml(this.payload.message);\n }\n\n if (this.payload.options.timeout && this.payload.options.timeout > 0) {\n this.startTimer(this.payload.options.timeout);\n }\n }\n\n ngOnDestroy(): void {\n this.clearTimer();\n }\n\n // Public API to start timer (used by service when created)\n startTimer(ms: number) {\n this.clearTimer();\n this._remaining = ms;\n this._endTs = Date.now() + ms;\n this._timeoutId = setTimeout(\n () => this.onFinish.emit({ id: this.payload.id, el: this.el.nativeElement }),\n ms,\n );\n }\n pauseTimer() {\n if (!this._timeoutId) return;\n this._paused = true;\n clearTimeout(this._timeoutId);\n this._remaining = Math.max(0, this._endTs - Date.now());\n }\n\n resumeTimer() {\n if (!this._paused || this._remaining <= 0) return;\n this._paused = false;\n this.startTimer(this._remaining);\n }\n\n close(ev?: Event) {\n if (ev) ev.stopPropagation();\n this.onClose.emit({ id: this.payload.id, el: this.el.nativeElement });\n }\n\n onMouseEnter() {\n if (this.payload.options.pauseOnHover) this.pauseTimer();\n }\n onMouseLeave() {\n if (this.payload.options.pauseOnHover) this.resumeTimer();\n }\n\n escapeHtml(input: string) {\n const div = this.doc.createElement('div');\n div.appendChild(this.doc.createTextNode(input));\n return div.innerHTML;\n }\n\n ngOnDestroyCleanup() {\n this.clearTimer();\n }\n\n private clearTimer() {\n if (this._timeoutId) {\n clearTimeout(this._timeoutId);\n this._timeoutId = null;\n }\n }\n}\n","<div\n class=\"{{ containerClass }} {{ containerClass }}-{{ payload.type }} {{ showClass() }}\"\n role=\"status\"\n (mouseenter)=\"onMouseEnter()\"\n (mouseleave)=\"onMouseLeave()\"\n [attr.aria-live]=\"payload.type === 'error' || payload.type === 'warning' ? 'assertive' : 'polite'\"\n [attr.data-id]=\"payload.id\">\n <span [innerHTML]=\"safeMessage\"></span>\n @if (payload.options.dismissible) {\n <button class=\"ngx-close\" (click)=\"close($event)\" aria-label=\"close\">×</button>\n }\n</div>\n","import {\n Injectable,\n ComponentRef,\n DOCUMENT,\n inject,\n createComponent,\n Injector,\n EnvironmentInjector,\n ApplicationRef,\n} from '@angular/core';\nimport { NgxNotifyOptions } from '../models/notify-options';\nimport { INotifyEnd, NgxNotifyPayload, NgxPgNotifyType } from '../models/notify.model';\nimport { WINDOW } from 'ngx-kit/shared';\nimport { NGX_NOTIFY_CONFIG } from '../models/notify-config';\nimport { NgxPgNotificationComponent } from '../components/notification.component';\n\n// We'll include a tiny inline uuid fallback if uuid package is not available\nfunction makeId() {\n // simple random id\n return 'n_' + Math.random().toString(36).substr(2, 9);\n}\n\n@Injectable({ providedIn: 'root' })\nexport class NgxNotifyService {\n private queue: NgxNotifyPayload[] = [];\n private visible: { ref: ComponentRef<any>; payload: NgxNotifyPayload }[] = [];\n private container: HTMLElement | null = null;\n\n private envInjector = inject(EnvironmentInjector);\n private appRef = inject(ApplicationRef);\n private doc = inject(DOCUMENT);\n private win = inject(WINDOW);\n private defaultOptions = inject(NGX_NOTIFY_CONFIG);\n constructor() {}\n\n configureContainer(position: NgxNotifyOptions['position'], containerClass: string) {\n if (this.container) return; // created already\n\n const container = this.doc.createElement('div');\n container.className = containerClass + ' ngx-notify-container ' + `ngx-pos-${position}`;\n container.style.position = 'fixed';\n container.style.zIndex = '99999';\n\n // center special\n if (position === 'center') {\n container.style.left = '50%';\n container.style.top = '50%';\n container.style.transform = 'translate(-50%,-50%)';\n container.style.display = 'flex';\n container.style.flexDirection = 'column';\n container.style.alignItems = 'center';\n container.style.pointerEvents = 'none';\n } else {\n if (position?.includes('center')) {\n container.style.left = '50%';\n container.style.transform = 'translateX(-50%)';\n }\n // corners\n if (position?.includes('top')) container.style.top = '20px';\n else container.style.bottom = '20px';\n if (position?.includes('left')) container.style.left = '20px';\n // else container.style.right = '20px';\n container.style.display = 'flex';\n container.style.flexDirection = 'column';\n if (position?.includes('bottom')) container.style.flexDirection = 'column-reverse';\n container.style.pointerEvents = 'none';\n }\n\n this.doc.body.appendChild(container);\n this.container = container;\n }\n\n show(message: string, type: NgxPgNotifyType = 'info', options?: NgxNotifyOptions) {\n const opts: NgxNotifyOptions = { ...this.defaultOptions, ...(options || {}) };\n const id =\n typeof (this.win as any).crypto?.randomUUID === 'function'\n ? (this.win as any).crypto.randomUUID()\n : makeId();\n\n const payload: NgxNotifyPayload = { id, message, type, options: opts };\n\n this.configureContainer(opts.position!, opts.containerClass!);\n\n // queue or show immediately\n if (this.visible.length >= opts.maxVisible!) {\n this.queue.push(payload);\n } else {\n this._createAndShow(payload);\n }\n }\n\n private _createAndShow(payload: NgxNotifyPayload) {\n if (!this.container)\n this.configureContainer(payload.options.position!, payload.options.containerClass!);\n const host = document.createElement('div');\n this.container!.appendChild(host);\n\n const compRef = createComponent(NgxPgNotificationComponent, {\n environmentInjector: this.envInjector,\n hostElement: host,\n });\n compRef.instance.payload = payload;\n compRef.instance.onClose.subscribe((d) => this.removeEl(d));\n compRef.instance.onFinish.subscribe((d) => this.removeEl(d));\n\n // Registers the component’s view so it participates in change detection cycle.\n this.appRef.attachView(compRef.hostView);\n // store visible\n this.visible.push({ ref: compRef, payload });\n }\n private removeNode(node: HTMLElement, id: string) {\n node.style.opacity = '0';\n node.style.transform = 'translateY(-30px)';\n node.style.transition = 'all 300ms';\n setTimeout(() => {\n const item = this.visible.find((x) => x.payload.id === id);\n if (item) {\n this.appRef.attachView(item.ref.hostView);\n item.ref.destroy();\n }\n this.visible = this.visible.filter((v) => v.payload.id !== id);\n // show next in queue\n this._showNextIfPossible();\n }, 300);\n }\n\n private removeEl(d: INotifyEnd) {\n if (d.el) this.removeNode(d.el, d.id);\n else {\n // if in queue remove it\n this.queue = this.queue.filter((q) => q.id !== d.id);\n }\n }\n\n private _showNextIfPossible() {\n if (!this.queue.length) return;\n const next = this.queue.shift()!;\n // ensure we don't exceed maxVisible\n if (this.visible.length < next.options.maxVisible!) {\n this._createAndShow(next);\n } else {\n // push back\n this.queue.unshift(next);\n }\n }\n}\n","import {\r\n EnvironmentProviders,\r\n inject,\r\n Injector,\r\n makeEnvironmentProviders,\r\n provideEnvironmentInitializer,\r\n} from '@angular/core';\r\nimport { NGX_NOTIFY_API, NGX_NOTIFY_CONFIG, NGX_NOTIFY_DEFAULTS } from './models/notify-config';\r\nimport { NgxNotifyOptions } from './models/notify-options';\r\nimport { Notify as NotifyFacade } from './notify-facade';\r\nimport { NgxNotifyService } from './services/notify.service';\r\nexport function provideNotify(options?: NgxNotifyOptions): EnvironmentProviders {\r\n return makeEnvironmentProviders([\r\n {\r\n provide: NGX_NOTIFY_CONFIG,\r\n useValue: { ...NGX_NOTIFY_DEFAULTS, ...(options || {}) },\r\n },\r\n {\r\n provide: NGX_NOTIFY_API,\r\n useExisting: NgxNotifyService,\r\n },\r\n provideEnvironmentInitializer(() => {\r\n NotifyFacade.injector = inject(Injector);\r\n }),\r\n ]);\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["NotifyFacade"],"mappings":";;;;;AAIO,MAAM,iBAAiB,GAAG,IAAI,cAAc,CAAmB,iBAAiB,CAAC;AACjF,MAAM,cAAc,GAAG,IAAI,cAAc,CAAmB,kBAAkB,CAAC;AAE/E,MAAM,mBAAmB,GAA+B;AAC7D,IAAA,OAAO,EAAE,IAAI;AACb,IAAA,QAAQ,EAAE,YAAY;AACtB,IAAA,UAAU,EAAE,EAAE;AACd,IAAA,SAAS,EAAE,KAAK;AAChB,IAAA,YAAY,EAAE,IAAI;AAClB,IAAA,WAAW,EAAE,IAAI;AACjB,IAAA,cAAc,EAAE,eAAe;AAC/B,IAAA,iBAAiB,EAAE,YAAY;CAChC;;ACZD;;;AAGG;MACU,MAAM,CAAA;IACjB,OAAO,QAAQ;IAEf,OAAO,IAAI,CACT,OAAe,EACf,IAAA,GAAiD,MAAM,EACvD,OAA0B,EAAA;AAE1B,QAAA,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE;AACpB,YAAA,OAAO,CAAC,KAAK,CACX,sFAAsF,CACvF;YACD;QACF;AACA,QAAA,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC;IAClE;AAEA,IAAA,OAAO,IAAI,CAAC,OAAe,EAAE,OAA0B,EAAA;QACrD,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC;IACrC;AACA,IAAA,OAAO,OAAO,CAAC,OAAe,EAAE,OAA0B,EAAA;QACxD,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,SAAS,EAAE,OAAO,CAAC;IAC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AAgB;AAC9B,SAAA;QACD,6BAA6B,CAAC,MAAK;AACjC,YAAAA,MAAY,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;AAC1C,QAAA,CAAC,CAAC;AACH,KAAA,CAAC;AACJ;;ACzBA;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"ngx-kit-notify.mjs","sources":["../../../projects/libs/notify/models/notify-config.ts","../../../projects/libs/notify/notify-facade.ts","../../../projects/libs/notify/components/notification.component.ts","../../../projects/libs/notify/components/notification.component.html","../../../projects/libs/notify/services/notify.service.ts","../../../projects/libs/notify/notify-provider.ts","../../../projects/libs/notify/ngx-kit-notify.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\nimport { NgxNotifyOptions } from './notify-options';\nimport { NgxNotifyService } from '../services/notify.service';\n\nexport const NGX_NOTIFY_CONFIG = new InjectionToken<NgxNotifyOptions>('NgxNotifyOption');\nexport const NGX_NOTIFY_API = new InjectionToken<NgxNotifyService>('NgxNotifyService');\n\nexport const NGX_NOTIFY_DEFAULTS: Required<NgxNotifyOptions> = {\n timeout: 3000,\n position: 'top-center',\n maxVisible: 10,\n allowHtml: false,\n pauseOnHover: true,\n dismissible: true,\n closeOnTap: true,\n containerClass: 'ngx-bg-notify',\n notificationClass: 'ngx-notify',\n};\n","import { Injector } from '@angular/core';\nimport { NgxNotifyOptions } from './models/notify-options';\nimport { NGX_NOTIFY_API } from './models/notify-config';\nimport { NgxNotifyPayload } from './models/notify.model';\n\n/**\n * Static facade so call sites can use: Notify.warn('msg', opts)\n * Module will set the service instance in its constructor.\n */\nexport class Notify {\n static injector: Injector;\n\n static show(\n type: 'info' | 'success' | 'warning' | 'error' = 'info',\n message: string,\n description?: string,\n options?: NgxNotifyOptions,\n ): NgxNotifyPayload {\n if (!Notify.injector) {\n throw new Error(\n 'ngx-kit: Error on EnvironmentProvider. Ensure \"provideNotify()\" in root provider.',\n );\n }\n return Notify.injector.get(NGX_NOTIFY_API).show(message, description, type, options);\n }\n\n static info(message: string, description?: string, options?: NgxNotifyOptions) {\n return this.show('info', message, description, options);\n }\n\n static success(message: string, description?: string, options?: NgxNotifyOptions) {\n return this.show('success', message, description, options);\n }\n static warning(message: string, description?: string, options?: NgxNotifyOptions) {\n return this.show('warning', message, description, options);\n }\n static error(message: string, description?: string, options?: NgxNotifyOptions) {\n return this.show('error', message, description, options);\n }\n}\n","import {\n Component,\n OnInit,\n OnDestroy,\n Input,\n ChangeDetectorRef,\n DOCUMENT,\n inject,\n ElementRef,\n afterNextRender,\n signal,\n output,\n input,\n effect,\n viewChild,\n} from '@angular/core';\nimport { INotifyEnd, NgxNotifyPayload } from '../models/notify.model';\nimport { CommonModule } from '@angular/common';\nimport { DomSanitizer, SafeHtml } from '@angular/platform-browser';\n\n@Component({\n selector: 'ngx-notification',\n templateUrl: './notification.component.html',\n styleUrls: ['./notification.component.scss'],\n imports: [CommonModule],\n})\nexport class NgxNotificationComponent implements OnInit, OnDestroy {\n payload = input.required<NgxNotifyPayload>();\n @Input() containerClass = 'ngx-notify';\n\n bar = viewChild<ElementRef<HTMLElement>>('bar');\n onClose = output<INotifyEnd>();\n onFinish = output<INotifyEnd>();\n\n private _rafId = 0;\n private _duration = 0;\n private _remaining = 0;\n private _endTs = 0;\n private _paused = false;\n\n safeMessage: SafeHtml | string = '';\n safeDescription: SafeHtml | string = '';\n showClass = signal('');\n protected doc = inject(DOCUMENT);\n protected el = inject(ElementRef);\n protected sanitizer = inject(DomSanitizer);\n protected chdr = inject(ChangeDetectorRef);\n constructor() {\n afterNextRender(() => {\n this.showClass.set('ngx-show');\n this.chdr.detectChanges();\n });\n effect(() => {\n const payload = this.payload();\n\n // decide how to render message\n if (payload.options.allowHtml) {\n this.safeMessage = this.sanitizer.bypassSecurityTrustHtml(payload.message);\n this.safeDescription = this.sanitizer.bypassSecurityTrustHtml(payload.description ?? '');\n } else {\n this.safeMessage = this.escapeHtml(payload.message);\n this.safeDescription = this.escapeHtml(payload.description);\n }\n });\n effect(() => {\n const timeout = this.payload().options.timeout ?? 0;\n this.startTimer(timeout);\n });\n }\n\n ngOnInit(): void {}\n\n ngOnDestroy(): void {\n this.clearTimer();\n }\n\n // Public API to start timer (used by service when created)\n startTimer(ms: number) {\n this.clearTimer();\n\n if (!this._paused) {\n this._duration = ms;\n }\n this._remaining = ms;\n this._endTs = performance.now() + ms;\n\n const bar = this.bar()?.nativeElement;\n if (bar) {\n bar.style.transition = `transform ${ms}ms linear`;\n bar.style.transform = 'scaleX(1)';\n }\n\n this.animateProgress();\n }\n pauseTimer() {\n this._paused = true;\n cancelAnimationFrame(this._rafId);\n this._remaining = Math.max(0, this._endTs - performance.now());\n const bar = this.bar()?.nativeElement;\n if (bar) {\n const matrix = getComputedStyle(bar).transform;\n bar.style.transition = 'none';\n bar.style.transform = matrix;\n }\n }\n\n resumeTimer() {\n if (!this._paused || this._remaining <= 0) {\n return;\n }\n\n this._paused = false;\n\n this.startTimer(this._remaining);\n }\n\n private clearTimer() {\n cancelAnimationFrame(this._rafId);\n this._rafId = 0;\n }\n\n private animateProgress() {\n const update = () => {\n const remaining = Math.max(0, this._endTs - performance.now());\n if (remaining <= 0) {\n this.onFinish.emit({\n id: this.payload().id,\n el: this.el.nativeElement,\n });\n return;\n }\n\n this._rafId = requestAnimationFrame(update);\n };\n\n this._rafId = requestAnimationFrame(update);\n }\n\n close(ev?: Event) {\n if (ev) ev.stopPropagation();\n this.onClose.emit({ id: this.payload().id, el: this.el.nativeElement });\n }\n\n onMouseEnter() {\n if (this.payload().options.pauseOnHover) this.pauseTimer();\n }\n onMouseLeave() {\n if (this.payload().options.pauseOnHover) this.resumeTimer();\n }\n onTap() {\n if (this.payload().options.closeOnTap) this.close();\n }\n\n escapeHtml(input?: string) {\n if (!input) return '';\n const div = this.doc.createElement('div');\n div.appendChild(this.doc.createTextNode(input));\n return div.textContent;\n }\n\n ngOnDestroyCleanup() {\n this.clearTimer();\n }\n}\n","<div\n class=\"{{ containerClass }} {{ containerClass }}-{{ payload().type }} {{ showClass() }}\"\n role=\"status\"\n (mouseenter)=\"onMouseEnter()\"\n (mouseleave)=\"onMouseLeave()\"\n (click)=\"onTap()\"\n [attr.aria-live]=\"\n payload().type === 'error' || payload().type === 'warning' ? 'assertive' : 'polite'\n \"\n [attr.data-id]=\"payload().id\">\n <div class=\"ngx-notify-icon-container\">\n <div class=\"ngx-notify-icon\">\n @switch (payload().type) {\n @case ('success') {\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <path\n fill=\"currentColor\"\n d=\"M235.3 331.3C229.1 337.6 218.9 337.6 212.7 331.3L148.7 267.3C142.4 261.1 142.4 250.9 148.7 244.7C154.9 238.4 165.1 238.4 171.3 244.7L224 297.4L340.7 180.7C346.9 174.4 357.1 174.4 363.3 180.7C369.6 186.9 369.6 197.1 363.3 203.3L235.3 331.3zM512 256C512 397.4 397.4 512 256 512C114.6 512 0 397.4 0 256C0 114.6 114.6 0 256 0C397.4 0 512 114.6 512 256zM256 32C132.3 32 32 132.3 32 256C32 379.7 132.3 480 256 480C379.7 480 480 379.7 480 256C480 132.3 379.7 32 256 32z\" />\n </svg>\n }\n @case ('error') {\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <path\n fill=\"currentColor\"\n d=\"M180.7 180.7C186.9 174.4 197.1 174.4 203.3 180.7L256 233.4L308.7 180.7C314.9 174.4 325.1 174.4 331.3 180.7C337.6 186.9 337.6 197.1 331.3 203.3L278.6 255.1L331.3 308.7C337.6 314.9 337.6 325.1 331.3 331.3C325.1 337.6 314.9 337.6 308.7 331.3L256 278.6L203.3 331.3C197.1 337.6 186.9 337.6 180.7 331.3C174.4 325.1 174.4 314.9 180.7 308.7L233.4 255.1L180.7 203.3C174.4 197.1 174.4 186.9 180.7 180.7V180.7zM.0669 191.5C.0669 172.4 7.652 154.1 21.16 140.6L140.6 21.15C154.1 7.648 172.4 .0625 191.5 .0625H320.5C339.6 .0625 357.9 7.648 371.4 21.15L490.8 140.6C504.3 154.1 511.9 172.4 511.9 191.5V320.5C511.9 339.6 504.3 357.9 490.8 371.4L371.4 490.8C357.9 504.3 339.6 511.9 320.5 511.9H191.5C172.4 511.9 154.1 504.3 140.6 490.8L21.15 371.4C7.652 357.9 .0666 339.6 .0666 320.5L.0669 191.5zM43.78 163.2C36.28 170.7 32.07 180.9 32.07 191.5V320.5C32.07 331.1 36.28 341.3 43.78 348.8L163.2 468.2C170.7 475.7 180.9 479.9 191.5 479.9H320.5C331.1 479.9 341.3 475.7 348.8 468.2L468.2 348.8C475.7 341.3 479.9 331.1 479.9 320.5V191.5C479.9 180.9 475.7 170.7 468.2 163.2L348.8 43.78C341.3 36.28 331.1 32.06 320.5 32.06H191.5C180.9 32.06 170.7 36.28 163.2 43.78L43.78 163.2zM43.78 348.8L21.15 371.4z\" />\n </svg>\n }\n @case ('warning') {\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <path\n fill=\"currentColor\"\n d=\"M256 360c-13.25 0-23.1 10.74-23.1 24c0 13.25 10.75 24 23.1 24c13.25 0 23.1-10.75 23.1-24C280 370.7 269.3 360 256 360zM256 320c8.843 0 15.1-7.156 15.1-16V160c0-8.844-7.155-16-15.1-16S240 151.2 240 160v144C240 312.8 247.2 320 256 320zM504.3 397.3L304.5 59.38C294.4 42.27 276.2 32.03 256 32C235.8 32 217.7 42.22 207.5 59.36l-199.9 338c-10.05 16.97-10.2 37.34-.4218 54.5C17.29 469.5 35.55 480 56.1 480h399.9c20.51 0 38.75-10.53 48.81-28.17C514.6 434.7 514.4 414.3 504.3 397.3zM476.1 435.1C472.7 443.5 464.8 448 455.1 448H56.1c-8.906 0-16.78-4.484-21.08-12c-4.078-7.156-4.015-15.3 .1562-22.36L235.1 75.66C239.4 68.36 247.2 64 256 64c0 0-.0156 0 0 0c8.765 .0156 16.56 4.359 20.86 11.64l199.9 338C480.1 420.7 481.1 428.8 476.1 435.1z\" />\n </svg>\n }\n @case ('info') {\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <path\n fill=\"currentColor\"\n d=\"M256 0C114.6 0 0 114.6 0 256s114.6 256 256 256s256-114.6 256-256S397.4 0 256 0zM256 480c-123.5 0-224-100.5-224-224s100.5-224 224-224s224 100.5 224 224S379.5 480 256 480zM256 184c13.25 0 24-10.74 24-24c0-13.25-10.75-24-24-24S232 146.7 232 160C232 173.3 242.7 184 256 184zM304 352h-32V240C272 231.2 264.8 224 256 224H224C215.2 224 208 231.2 208 240S215.2 256 224 256h16v96h-32C199.2 352 192 359.2 192 368C192 376.8 199.2 384 208 384h96c8.836 0 16-7.164 16-16C320 359.2 312.8 352 304 352z\" />\n </svg>\n }\n }\n </div>\n </div>\n\n <div class=\"ngx-notify-content\">\n <div class=\"ngx-notify-title\" [innerHTML]=\"safeMessage\"></div>\n <div class=\"ngx-notify-description\" [innerHTML]=\"safeDescription\"></div>\n </div>\n\n @if (payload().options.dismissible) {\n <div class=\"ngx-notify-close-container\">\n <button class=\"ngx-notify-close\" (click)=\"close($event)\" aria-label=\"close\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 320 512\">\n <path\n fill=\"currentColor\"\n d=\"M315.3 411.3c-6.253 6.253-16.37 6.253-22.63 0L160 278.6l-132.7 132.7c-6.253 6.253-16.37 6.253-22.63 0c-6.253-6.253-6.253-16.37 0-22.63L137.4 256L4.69 123.3c-6.253-6.253-6.253-16.37 0-22.63c6.253-6.253 16.37-6.253 22.63 0L160 233.4l132.7-132.7c6.253-6.253 16.37-6.253 22.63 0c6.253 6.253 6.253 16.37 0 22.63L182.6 256l132.7 132.7C321.6 394.9 321.6 405.1 315.3 411.3z\" />\n </svg>\n </button>\n </div>\n }\n\n <div class=\"ngx-notify-progress\">\n <div class=\"progress-bar\" #bar></div>\n </div>\n</div>\n","import {\n Injectable,\n ComponentRef,\n DOCUMENT,\n inject,\n createComponent,\n EnvironmentInjector,\n ApplicationRef,\n EventEmitter,\n} from '@angular/core';\nimport { NgxNotifyOptions } from '../models/notify-options';\nimport { INotifyEnd, NgxNotifyPayload, NgxNotifyType } from '../models/notify.model';\nimport { WINDOW } from 'ngx-kit/shared';\nimport { NGX_NOTIFY_CONFIG } from '../models/notify-config';\nimport { NgxNotificationComponent } from '../components/notification.component';\n\n// We'll include a tiny inline uuid fallback if uuid package is not available\nfunction makeId() {\n // simple random id\n return 'n_' + Math.random().toString(36).substr(2, 9);\n}\n\n@Injectable({ providedIn: 'root' })\nexport class NgxNotifyService {\n private queue: NgxNotifyPayload[] = [];\n private visible: { ref: ComponentRef<any>; payload: NgxNotifyPayload }[] = [];\n private container: HTMLElement | null = null;\n\n private envInjector = inject(EnvironmentInjector);\n private appRef = inject(ApplicationRef);\n private doc = inject(DOCUMENT);\n private win = inject(WINDOW);\n private defaultOptions = inject(NGX_NOTIFY_CONFIG);\n constructor() {}\n\n configureContainer(position: NgxNotifyOptions['position'], containerClass: string) {\n if (!this.container) {\n this.container = this.doc.createElement('div');\n this.doc.body.appendChild(this.container);\n }\n\n this.container.className = containerClass + ' ngx-notify-container ' + `ngx-pos-${position}`;\n this.container.style.position = 'fixed';\n this.container.style.zIndex = '99999';\n\n // center special\n if (position === 'center') {\n this.container.style.left = '50%';\n this.container.style.top = '50%';\n this.container.style.transform = 'translate(-50%,-50%)';\n this.container.style.display = 'flex';\n this.container.style.flexDirection = 'column';\n this.container.style.alignItems = 'center';\n this.container.style.pointerEvents = 'none';\n } else {\n if (position?.includes('center')) {\n this.container.style.left = '50%';\n this.container.style.transform = 'translateX(-50%)';\n } else {\n this.container.style.transform = 'translateX(0)';\n }\n // corners\n if (position?.includes('top')) {\n this.container.style.top = '20px';\n } else {\n this.container.style.bottom = '20px';\n }\n if (position?.includes('left')) {\n this.container.style.left = '20px';\n this.container.style.right = 'auto';\n }\n if (position?.includes('right')) {\n this.container.style.right = '20px';\n this.container.style.left = 'auto';\n }\n // else container.style.right = '20px';\n this.container.style.display = 'flex';\n this.container.style.flexDirection = 'column';\n if (position?.includes('bottom')) this.container.style.flexDirection = 'column-reverse';\n this.container.style.pointerEvents = 'none';\n }\n }\n\n show(\n message: string,\n description?: string,\n type: NgxNotifyType = 'info',\n options?: NgxNotifyOptions,\n ) {\n const opts: NgxNotifyOptions = { ...this.defaultOptions, ...(options || {}) };\n const id =\n typeof (this.win as any).crypto?.randomUUID === 'function'\n ? (this.win as any).crypto.randomUUID()\n : makeId();\n\n const payload: NgxNotifyPayload = {\n id,\n message,\n description,\n type,\n options: opts,\n onClose: new EventEmitter(),\n onFinish: new EventEmitter(),\n };\n\n this.configureContainer(opts.position!, opts.containerClass!);\n\n // queue or show immediately\n if (this.visible.length >= opts.maxVisible!) {\n this.queue.push(payload);\n } else {\n this._createAndShow(payload);\n }\n return payload;\n }\n\n private _createAndShow(payload: NgxNotifyPayload) {\n if (!this.container)\n this.configureContainer(payload.options.position!, payload.options.containerClass!);\n const host = document.createElement('div');\n this.container!.appendChild(host);\n\n const compRef = createComponent(NgxNotificationComponent, {\n environmentInjector: this.envInjector,\n hostElement: host,\n });\n compRef.setInput('payload', payload);\n compRef.instance.onClose.subscribe((d) => {\n this.removeEl(d);\n payload.onClose.emit(d);\n });\n compRef.instance.onFinish.subscribe((d) => {\n this.removeEl(d);\n payload.onFinish.emit(d);\n payload.onClose.emit(d);\n });\n\n // Registers the component’s view so it participates in change detection cycle.\n this.appRef.attachView(compRef.hostView);\n // store visible\n this.visible.push({ ref: compRef, payload });\n }\n private removeNode(node: HTMLElement, id: string) {\n node.style.opacity = '0';\n node.style.transform = 'translateY(-30px)';\n node.style.transition = 'all 300ms';\n setTimeout(() => {\n const item = this.visible.find((x) => x.payload.id === id);\n if (item) {\n this.appRef.attachView(item.ref.hostView);\n item.ref.destroy();\n }\n this.visible = this.visible.filter((v) => v.payload.id !== id);\n // show next in queue\n this._showNextIfPossible();\n }, 300);\n }\n\n private removeEl(d: INotifyEnd) {\n if (d.el) this.removeNode(d.el, d.id);\n else {\n // if in queue remove it\n this.queue = this.queue.filter((q) => q.id !== d.id);\n }\n }\n\n private _showNextIfPossible() {\n if (!this.queue.length) return;\n const next = this.queue.shift()!;\n // ensure we don't exceed maxVisible\n if (this.visible.length < next.options.maxVisible!) {\n this._createAndShow(next);\n } else {\n // push back\n this.queue.unshift(next);\n }\n }\n}\n","import {\r\n EnvironmentProviders,\r\n inject,\r\n Injector,\r\n makeEnvironmentProviders,\r\n provideEnvironmentInitializer,\r\n} from '@angular/core';\r\nimport { NGX_NOTIFY_API, NGX_NOTIFY_CONFIG, NGX_NOTIFY_DEFAULTS } from './models/notify-config';\r\nimport { NgxNotifyOptions } from './models/notify-options';\r\nimport { Notify as NotifyFacade } from './notify-facade';\r\nimport { NgxNotifyService } from './services/notify.service';\r\nexport function provideNotify(options?: NgxNotifyOptions): EnvironmentProviders {\r\n return makeEnvironmentProviders([\r\n {\r\n provide: NGX_NOTIFY_CONFIG,\r\n useValue: { ...NGX_NOTIFY_DEFAULTS, ...(options || {}) },\r\n },\r\n {\r\n provide: NGX_NOTIFY_API,\r\n useExisting: NgxNotifyService,\r\n },\r\n provideEnvironmentInitializer(() => {\r\n NotifyFacade.injector = inject(Injector);\r\n }),\r\n ]);\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["NotifyFacade"],"mappings":";;;;;;MAIa,iBAAiB,GAAG,IAAI,cAAc,CAAmB,iBAAiB;MAC1E,cAAc,GAAG,IAAI,cAAc,CAAmB,kBAAkB;AAE9E,MAAM,mBAAmB,GAA+B;AAC7D,IAAA,OAAO,EAAE,IAAI;AACb,IAAA,QAAQ,EAAE,YAAY;AACtB,IAAA,UAAU,EAAE,EAAE;AACd,IAAA,SAAS,EAAE,KAAK;AAChB,IAAA,YAAY,EAAE,IAAI;AAClB,IAAA,WAAW,EAAE,IAAI;AACjB,IAAA,UAAU,EAAE,IAAI;AAChB,IAAA,cAAc,EAAE,eAAe;AAC/B,IAAA,iBAAiB,EAAE,YAAY;;;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mB,EAAE,IAAI,OAAO,IAAI,EAAE,CAAC,EAAE;AACzD,SAAA;AACD,QAAA;AACE,YAAA,OAAO,EAAE,cAAc;AACvB,YAAA,WAAW,EAAE,gBAAgB;AAC9B,SAAA;QACD,6BAA6B,CAAC,MAAK;AACjC,YAAAA,MAAY,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;AAC1C,QAAA,CAAC,CAAC;AACH,KAAA,CAAC;AACJ;;ACzBA;;AAEG;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as i1 from '@angular/common';
|
|
2
|
-
import { CommonModule, isPlatformBrowser, DOCUMENT } from '@angular/common';
|
|
2
|
+
import { CommonModule, isPlatformBrowser, DOCUMENT as DOCUMENT$1 } from '@angular/common';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
|
-
import { EventEmitter, forwardRef, HostListener, ViewChild, Output, Input, ChangeDetectionStrategy, Component, InjectionToken, PLATFORM_ID, Inject, Injectable, inject } from '@angular/core';
|
|
4
|
+
import { EventEmitter, forwardRef, HostListener, ViewChild, Output, Input, ChangeDetectionStrategy, Component, InjectionToken, PLATFORM_ID, Inject, Injectable, inject, DOCUMENT } from '@angular/core';
|
|
5
5
|
import { NG_VALUE_ACCESSOR, NG_VALIDATORS, FormControl, Validators } from '@angular/forms';
|
|
6
6
|
|
|
7
7
|
function getOffsetPosition(evt, parent) {
|
|
@@ -724,6 +724,11 @@ class OverlayRef {
|
|
|
724
724
|
}
|
|
725
725
|
}
|
|
726
726
|
|
|
727
|
+
function IsRtl() {
|
|
728
|
+
const doc = inject(DOCUMENT);
|
|
729
|
+
return getComputedStyle(doc.documentElement).direction === 'rtl';
|
|
730
|
+
}
|
|
731
|
+
|
|
727
732
|
const FOCUSABLE_SELECTOR = 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])';
|
|
728
733
|
const DIALOG_OVERLAY_CLASSNAME = 'ngx-ui-overlay';
|
|
729
734
|
class OverlayService {
|
|
@@ -731,7 +736,7 @@ class OverlayService {
|
|
|
731
736
|
zIndexCounter = 1000;
|
|
732
737
|
listenersAttached = false;
|
|
733
738
|
resizeRafPending = false;
|
|
734
|
-
doc = inject(DOCUMENT);
|
|
739
|
+
doc = inject(DOCUMENT$1);
|
|
735
740
|
abortController = new AbortController();
|
|
736
741
|
ngOnDestroy() {
|
|
737
742
|
this.closeAll();
|
|
@@ -954,7 +959,7 @@ class OverlayService {
|
|
|
954
959
|
const dialogRect = dialog.getBoundingClientRect();
|
|
955
960
|
const vw = Math.min(document.body.clientWidth, window.innerWidth);
|
|
956
961
|
const vh = Math.min(document.body.clientHeight, window.innerHeight);
|
|
957
|
-
const isRTL =
|
|
962
|
+
const isRTL = IsRtl();
|
|
958
963
|
let top = 0;
|
|
959
964
|
let left = 'auto';
|
|
960
965
|
let right = 'auto';
|