@frontile/notifications 0.18.0-alpha.2 → 0.18.0-alpha.20
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/declarations/index.d.ts +1 -9
- package/declarations/services/notifications.d.ts +1 -19
- package/declarations/template-registry.d.ts +1 -5
- package/dist/index.js +13 -4
- package/dist/index.js.map +1 -1
- package/dist/services/notifications.js +1 -34
- package/dist/services/notifications.js.map +1 -1
- package/package.json +13 -19
- package/declarations/-private/get-config.d.ts +0 -2
- package/declarations/-private/manager.d.ts +0 -13
- package/declarations/-private/notification.d.ts +0 -15
- package/declarations/-private/timer.d.ts +0 -12
- package/declarations/-private/types.d.ts +0 -60
- package/declarations/components/notification-card.d.ts +0 -49
- package/declarations/components/notifications-container.d.ts +0 -46
- package/dist/_app_/components/notification-card.js +0 -1
- package/dist/_app_/components/notifications-container.js +0 -1
- package/dist/components/notification-card.js +0 -109
- package/dist/components/notification-card.js.map +0 -1
- package/dist/components/notifications-container.js +0 -61
- package/dist/components/notifications-container.js.map +0 -1
- package/dist/manager-C1Vyhk-A.js +0 -175
- package/dist/manager-C1Vyhk-A.js.map +0 -1
- package/dist/runtime-BPCpkOf1-B5Lbloj7.js +0 -67
- package/dist/runtime-BPCpkOf1-B5Lbloj7.js.map +0 -1
package/declarations/index.d.ts
CHANGED
|
@@ -1,9 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import Timer from './-private/timer';
|
|
3
|
-
import NotificationsService from './services/notifications';
|
|
4
|
-
import type { DefaultConfig, NotificationOptions, CustomAction } from './-private/types';
|
|
5
|
-
export { Notification, Timer };
|
|
6
|
-
export type { NotificationsService };
|
|
7
|
-
export type { NotificationOptions, DefaultConfig, CustomAction };
|
|
8
|
-
export * from './components/notification-card';
|
|
9
|
-
export * from './components/notifications-container';
|
|
1
|
+
export { NotificationsContainer, NotificationCard, type NotificationsContainerSignature, type NotificationCardSignature, type NotificationsService, Notification, Timer, type NotificationOptions, type NotificationContent, type NotificationIntent, type NotificationAppearance, type NotificationUpdate, type DefaultConfig, type CustomAction, type PromiseMessage, type PromiseNotificationOptions } from 'frontile/notifications';
|
|
@@ -1,19 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import Notification from '../-private/notification';
|
|
3
|
-
import NotificationsManager from '../-private/manager';
|
|
4
|
-
import type { NotificationOptions } from '../-private/types';
|
|
5
|
-
export default class NotificationsService extends Service {
|
|
6
|
-
onRemoveCallback?: (notification: Notification<Record<string, unknown>>) => void;
|
|
7
|
-
manager: NotificationsManager;
|
|
8
|
-
get notifications(): Notification<Record<string, unknown>>[];
|
|
9
|
-
add: <TMetadata extends Record<string, unknown> = Record<string, unknown>>(message: string, options?: NotificationOptions<TMetadata>) => Notification<TMetadata>;
|
|
10
|
-
remove: (notification?: Notification<Record<string, unknown>>) => void;
|
|
11
|
-
removeAll: () => void;
|
|
12
|
-
setOnRemoveCallback: (callback?: (notification: Notification<Record<string, unknown>>) => void) => void;
|
|
13
|
-
willDestroy(): void;
|
|
14
|
-
}
|
|
15
|
-
declare module '@ember/service' {
|
|
16
|
-
interface Registry {
|
|
17
|
-
notifications: NotificationsService;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
1
|
+
export { default } from 'frontile/services/notifications';
|
|
@@ -1,5 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export default interface Registry {
|
|
3
|
-
NotificationCard: typeof NotificationCard;
|
|
4
|
-
NotificationsContainer: typeof NotificationsContainer;
|
|
5
|
-
}
|
|
1
|
+
export type { default } from 'frontile/template-registry';
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { deprecate } from '@ember/debug';
|
|
2
|
+
export { Notification, NotificationCard, NotificationsContainer, Timer } from 'frontile/notifications';
|
|
3
|
+
|
|
4
|
+
deprecate('Importing from "@frontile/notifications" is deprecated. ' + 'Import from "frontile" or "frontile/notifications" instead. ' + 'See https://frontile.dev/docs/migrations/v0.18/package-consolidation', false, {
|
|
5
|
+
id: 'frontile.import-from-notifications',
|
|
6
|
+
until: '0.19.0',
|
|
7
|
+
for: 'frontile',
|
|
8
|
+
since: {
|
|
9
|
+
available: '0.18.0',
|
|
10
|
+
enabled: '0.18.0'
|
|
11
|
+
},
|
|
12
|
+
url: 'https://frontile.dev/docs/migrations/v0.18/package-consolidation'
|
|
13
|
+
});
|
|
5
14
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import { deprecate } from '@ember/debug';\n\ndeprecate(\n 'Importing from \"@frontile/notifications\" is deprecated. ' +\n 'Import from \"frontile\" or \"frontile/notifications\" instead. ' +\n 'See https://frontile.dev/docs/migrations/v0.18/package-consolidation',\n false,\n {\n id: 'frontile.import-from-notifications',\n until: '0.19.0',\n for: 'frontile',\n since: { available: '0.18.0', enabled: '0.18.0' },\n url: 'https://frontile.dev/docs/migrations/v0.18/package-consolidation'\n }\n);\n\nexport {\n NotificationsContainer,\n NotificationCard,\n type NotificationsContainerSignature,\n type NotificationCardSignature,\n type NotificationsService,\n Notification,\n Timer,\n type NotificationOptions,\n type NotificationContent,\n type NotificationIntent,\n type NotificationAppearance,\n type NotificationUpdate,\n type DefaultConfig,\n type CustomAction,\n type PromiseMessage,\n type PromiseNotificationOptions\n} from 'frontile/notifications';\n"],"names":["deprecate","id","until","for","since","available","enabled","url"],"mappings":";;;AAEAA,SAAS,CACP,0DAA0D,GACxD,8DAA8D,GAC9D,sEAAsE,EACxE,KAAK,EACL;AACEC,EAAAA,EAAE,EAAE,oCAAoC;AACxCC,EAAAA,KAAK,EAAE,QAAQ;AACfC,EAAAA,GAAG,EAAE,UAAU;AACfC,EAAAA,KAAK,EAAE;AAAEC,IAAAA,SAAS,EAAE,QAAQ;AAAEC,IAAAA,OAAO,EAAE;GAAU;AACjDC,EAAAA,GAAG,EAAE;AACP,CACF,CAAC"}
|
|
@@ -1,35 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { a as NotificationsManager } from '../manager-C1Vyhk-A.js';
|
|
3
|
-
|
|
4
|
-
class NotificationsService extends Service {
|
|
5
|
-
onRemoveCallback;
|
|
6
|
-
manager = new NotificationsManager(this, notification => {
|
|
7
|
-
if (this.onRemoveCallback) {
|
|
8
|
-
this.onRemoveCallback(notification);
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
get notifications() {
|
|
12
|
-
return this.manager.notifications;
|
|
13
|
-
}
|
|
14
|
-
add = (message, options) => {
|
|
15
|
-
return this.manager.add(message, options);
|
|
16
|
-
};
|
|
17
|
-
remove = notification => {
|
|
18
|
-
this.manager.remove(notification);
|
|
19
|
-
};
|
|
20
|
-
removeAll = () => {
|
|
21
|
-
this.manager.removeAll();
|
|
22
|
-
};
|
|
23
|
-
setOnRemoveCallback = callback => {
|
|
24
|
-
this.onRemoveCallback = callback;
|
|
25
|
-
};
|
|
26
|
-
willDestroy() {
|
|
27
|
-
this.removeAll();
|
|
28
|
-
super.willDestroy();
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// DO NOT DELETE: this is how TypeScript knows how to look up your services.
|
|
33
|
-
|
|
34
|
-
export { NotificationsService as default };
|
|
1
|
+
export { default } from 'frontile/services/notifications';
|
|
35
2
|
//# sourceMappingURL=notifications.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifications.js","sources":[
|
|
1
|
+
{"version":3,"file":"notifications.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontile/notifications",
|
|
3
|
-
"version": "0.18.0-alpha.
|
|
3
|
+
"version": "0.18.0-alpha.20",
|
|
4
4
|
"description": "Component Library for Ember Octane apps: Notifications",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon",
|
|
@@ -52,31 +52,27 @@
|
|
|
52
52
|
"test": "echo 'A v2 addon does not have tests, run tests in test-app'"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@embroider/addon-shim": "^1.
|
|
56
|
-
"
|
|
57
|
-
"@frontile/theme": "0.18.0-alpha.2",
|
|
58
|
-
"ember-auto-import": "^2.7.2",
|
|
59
|
-
"ember-css-transitions": "^4.4.0",
|
|
60
|
-
"ember-modifier": "^4.1.0"
|
|
55
|
+
"@embroider/addon-shim": "^1.10.3",
|
|
56
|
+
"frontile": "^0.18.0-alpha.20"
|
|
61
57
|
},
|
|
62
58
|
"devDependencies": {
|
|
63
59
|
"@babel/core": "7.26.7",
|
|
64
60
|
"@babel/plugin-transform-typescript": "^7.26.7",
|
|
65
|
-
"@embroider/addon-dev": "
|
|
66
|
-
"@glimmer/component": "^2.
|
|
61
|
+
"@embroider/addon-dev": "8.3.1",
|
|
62
|
+
"@glimmer/component": "^2.1.1",
|
|
67
63
|
"@glimmer/tracking": "^1.1.2",
|
|
68
64
|
"@glint/core": "1.5.2",
|
|
69
65
|
"@glint/environment-ember-loose": "1.5.2",
|
|
70
66
|
"@glint/environment-ember-template-imports": "1.5.2",
|
|
71
|
-
"@glint/template": "^1.
|
|
72
|
-
"@rollup/plugin-babel": "^
|
|
73
|
-
"@rollup/plugin-node-resolve": "^16.0.
|
|
74
|
-
"@tsconfig/ember": "^3.0.
|
|
67
|
+
"@glint/template": "^1.8.0",
|
|
68
|
+
"@rollup/plugin-babel": "^7.1.0",
|
|
69
|
+
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
70
|
+
"@tsconfig/ember": "^3.0.12",
|
|
75
71
|
"babel-plugin-ember-template-compilation": "^2.2.1",
|
|
76
|
-
"concurrently": "^
|
|
77
|
-
"decorator-transforms": "^2.
|
|
72
|
+
"concurrently": "^10.0.4",
|
|
73
|
+
"decorator-transforms": "^2.4.0",
|
|
78
74
|
"ember-source": "^6.1.0",
|
|
79
|
-
"rollup": "^4.
|
|
75
|
+
"rollup": "^4.62.4",
|
|
80
76
|
"rollup-plugin-copy": "^3.5.0",
|
|
81
77
|
"tailwindcss": "^3.4.17",
|
|
82
78
|
"typescript": "^5.7.3"
|
|
@@ -99,10 +95,8 @@
|
|
|
99
95
|
"type": "addon",
|
|
100
96
|
"main": "addon-main.js",
|
|
101
97
|
"app-js": {
|
|
102
|
-
"./components/notification-card.js": "./dist/_app_/components/notification-card.js",
|
|
103
|
-
"./components/notifications-container.js": "./dist/_app_/components/notifications-container.js",
|
|
104
98
|
"./services/notifications.js": "./dist/_app_/services/notifications.js"
|
|
105
99
|
}
|
|
106
100
|
},
|
|
107
|
-
"gitHead": "
|
|
101
|
+
"gitHead": "4ad0d3245ae37878e92ab6452d8c4ebe07a5a403"
|
|
108
102
|
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import Notification from './notification';
|
|
2
|
-
import type { DefaultConfig } from './types';
|
|
3
|
-
import type { NotificationOptions } from './types';
|
|
4
|
-
export default class NotificationsManager {
|
|
5
|
-
notifications: Notification<Record<string, unknown>>[];
|
|
6
|
-
config: DefaultConfig;
|
|
7
|
-
onRemove?: (notification: Notification<Record<string, unknown>>) => void;
|
|
8
|
-
constructor(context: object, onRemove?: (notification: Notification<Record<string, unknown>>) => void);
|
|
9
|
-
add<TMetadata extends Record<string, unknown> = Record<string, unknown>>(message: string, options?: NotificationOptions<TMetadata>): Notification<TMetadata>;
|
|
10
|
-
remove(notification?: Notification<Record<string, unknown>>): void;
|
|
11
|
-
removeAll(): void;
|
|
12
|
-
private setupAutoRemoval;
|
|
13
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import Timer from './timer';
|
|
2
|
-
import type { NotificationOptions, CustomAction, DefaultConfig } from './types';
|
|
3
|
-
export default class Notification<TMetadata extends Record<string, unknown> = Record<string, unknown>> {
|
|
4
|
-
readonly message: string;
|
|
5
|
-
readonly transitionDuration: number;
|
|
6
|
-
readonly appearance: NonNullable<NotificationOptions['appearance']>;
|
|
7
|
-
readonly customActions?: CustomAction[];
|
|
8
|
-
readonly allowClosing: boolean;
|
|
9
|
-
readonly duration: number;
|
|
10
|
-
readonly metadata?: TMetadata;
|
|
11
|
-
timer?: Timer;
|
|
12
|
-
isRemoving: boolean;
|
|
13
|
-
constructor(config: DefaultConfig, message: string, options?: NotificationOptions<TMetadata>);
|
|
14
|
-
remove(): void;
|
|
15
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export default class Timer {
|
|
2
|
-
remaining: number;
|
|
3
|
-
isRunning: boolean;
|
|
4
|
-
readonly onFinish: () => void;
|
|
5
|
-
private timer?;
|
|
6
|
-
private start;
|
|
7
|
-
constructor(duration: number, onFinish: () => void);
|
|
8
|
-
clear(): void;
|
|
9
|
-
pause(): void;
|
|
10
|
-
resume(): void;
|
|
11
|
-
private setup;
|
|
12
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
export type containerPlacement = 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
|
|
2
|
-
export interface CustomAction {
|
|
3
|
-
/**
|
|
4
|
-
* The label of the action
|
|
5
|
-
*/
|
|
6
|
-
label: string;
|
|
7
|
-
/**
|
|
8
|
-
* The function to be called when clicked
|
|
9
|
-
*/
|
|
10
|
-
onClick: () => void;
|
|
11
|
-
}
|
|
12
|
-
export interface NotificationOptions<TMetadata extends Record<string, unknown> = Record<string, unknown>> {
|
|
13
|
-
/**
|
|
14
|
-
* If set to false, the close button will not be displayed.
|
|
15
|
-
*
|
|
16
|
-
* @defaultValue true
|
|
17
|
-
*/
|
|
18
|
-
allowClosing?: boolean;
|
|
19
|
-
/**
|
|
20
|
-
* Preserve the notification open, no auto-dismiss.
|
|
21
|
-
*
|
|
22
|
-
* @defaultValue false
|
|
23
|
-
*/
|
|
24
|
-
preserve?: boolean;
|
|
25
|
-
/**
|
|
26
|
-
* Duration before the notification is auto-dismissed, in milliseconds.
|
|
27
|
-
*
|
|
28
|
-
* @defaultValue 5000
|
|
29
|
-
*/
|
|
30
|
-
duration?: number;
|
|
31
|
-
transitionDuration?: number;
|
|
32
|
-
/**
|
|
33
|
-
* The appearance of the notification
|
|
34
|
-
*
|
|
35
|
-
* @defaultValue 'info'
|
|
36
|
-
*/
|
|
37
|
-
appearance?: 'info' | 'success' | 'warning' | 'error';
|
|
38
|
-
/**
|
|
39
|
-
* A list of custom actions
|
|
40
|
-
*
|
|
41
|
-
* @defaultValue undefined
|
|
42
|
-
*/
|
|
43
|
-
customActions?: CustomAction[];
|
|
44
|
-
/**
|
|
45
|
-
* Additional metadata to attach to the notification
|
|
46
|
-
*
|
|
47
|
-
* @defaultValue undefined
|
|
48
|
-
*/
|
|
49
|
-
metadata?: TMetadata;
|
|
50
|
-
}
|
|
51
|
-
export interface DefaultConfig extends NotificationOptions {
|
|
52
|
-
/**
|
|
53
|
-
* If set to true, we will preserve the notification, therefore skiping the timer.
|
|
54
|
-
* This is useful in tests because Ember will wait for any runloop to
|
|
55
|
-
* finish before proceeding.
|
|
56
|
-
*
|
|
57
|
-
* @defaultValue false
|
|
58
|
-
*/
|
|
59
|
-
skipTimer?: boolean;
|
|
60
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import Component from '@glimmer/component';
|
|
2
|
-
import type NotificationsService from '../services/notifications';
|
|
3
|
-
import type Notification from '../-private/notification';
|
|
4
|
-
import type { CustomAction, containerPlacement } from '../-private/types';
|
|
5
|
-
interface NotificationCardSignature {
|
|
6
|
-
Args: {
|
|
7
|
-
notification: Notification<Record<string, unknown>>;
|
|
8
|
-
placement: containerPlacement;
|
|
9
|
-
/**
|
|
10
|
-
* Spacing for each notification, in px.
|
|
11
|
-
*
|
|
12
|
-
* @defaultValue 16
|
|
13
|
-
*/
|
|
14
|
-
spacing?: number;
|
|
15
|
-
};
|
|
16
|
-
Element: HTMLDivElement;
|
|
17
|
-
}
|
|
18
|
-
declare class NotificationCard extends Component<NotificationCardSignature> {
|
|
19
|
-
notifications: NotificationsService;
|
|
20
|
-
hasEntered: boolean;
|
|
21
|
-
get styles(): unknown;
|
|
22
|
-
transitionIn: import("ember-modifier").FunctionBasedModifier<{
|
|
23
|
-
Args: {
|
|
24
|
-
Positional: unknown[];
|
|
25
|
-
Named: import("ember-modifier/-private/signature").EmptyObject;
|
|
26
|
-
};
|
|
27
|
-
Element: HTMLElement;
|
|
28
|
-
}>;
|
|
29
|
-
transitionOut: import("ember-modifier").FunctionBasedModifier<{
|
|
30
|
-
Args: {
|
|
31
|
-
Positional: boolean[];
|
|
32
|
-
Named: import("ember-modifier/-private/signature").EmptyObject;
|
|
33
|
-
};
|
|
34
|
-
Element: HTMLElement;
|
|
35
|
-
}>;
|
|
36
|
-
remove: () => void;
|
|
37
|
-
pause: () => void;
|
|
38
|
-
resume: () => void;
|
|
39
|
-
handleClickCustomAction: (customAction: CustomAction) => void;
|
|
40
|
-
get classes(): {
|
|
41
|
-
base: string;
|
|
42
|
-
message: string;
|
|
43
|
-
customActions: string;
|
|
44
|
-
customActionButton: string;
|
|
45
|
-
closeButton: string;
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
export { NotificationCard, type NotificationCardSignature };
|
|
49
|
-
export default NotificationCard;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import Component from '@glimmer/component';
|
|
2
|
-
import type NotificationsService from '../services/notifications';
|
|
3
|
-
import type Notification from '../-private/notification';
|
|
4
|
-
import { type containerPlacement } from '../-private/types';
|
|
5
|
-
import type Owner from '@ember/owner';
|
|
6
|
-
interface NotificationsContainerSignature {
|
|
7
|
-
Args: {
|
|
8
|
-
/**
|
|
9
|
-
* The placement of the notifications
|
|
10
|
-
*
|
|
11
|
-
* @defaultValue 'bottom-right'
|
|
12
|
-
*/
|
|
13
|
-
placement?: containerPlacement;
|
|
14
|
-
/**
|
|
15
|
-
* Spacing for each notification, in px.
|
|
16
|
-
*
|
|
17
|
-
* @defaultValue 16
|
|
18
|
-
*/
|
|
19
|
-
spacing?: number;
|
|
20
|
-
/**
|
|
21
|
-
* Custom class name, it will override the default ones using Tailwind Merge library.
|
|
22
|
-
*/
|
|
23
|
-
class?: string;
|
|
24
|
-
/**
|
|
25
|
-
* Callback called when a notification is dismissed
|
|
26
|
-
*/
|
|
27
|
-
onDismiss?: (notification: Notification<Record<string, unknown>>) => void;
|
|
28
|
-
};
|
|
29
|
-
Element: HTMLDivElement;
|
|
30
|
-
}
|
|
31
|
-
declare class NotificationsContainer extends Component<NotificationsContainerSignature> {
|
|
32
|
-
notifications: NotificationsService;
|
|
33
|
-
constructor(owner: Owner, args: NotificationsContainerSignature['Args']);
|
|
34
|
-
get isTopPlacement(): boolean;
|
|
35
|
-
get sortedNotifications(): Notification[];
|
|
36
|
-
get classes(): string;
|
|
37
|
-
setupSpacing: import("ember-modifier").FunctionBasedModifier<{
|
|
38
|
-
Args: {
|
|
39
|
-
Positional: unknown[];
|
|
40
|
-
Named: import("ember-modifier/-private/signature").EmptyObject;
|
|
41
|
-
};
|
|
42
|
-
Element: HTMLElement;
|
|
43
|
-
}>;
|
|
44
|
-
}
|
|
45
|
-
export { NotificationsContainer, type NotificationsContainerSignature };
|
|
46
|
-
export default NotificationsContainer;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "@frontile/notifications/components/notification-card";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "@frontile/notifications/components/notifications-container";
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import Component from '@glimmer/component';
|
|
2
|
-
import { modifier } from 'ember-modifier';
|
|
3
|
-
import { tracked } from '@glimmer/tracking';
|
|
4
|
-
import { service } from '@ember/service';
|
|
5
|
-
import { htmlSafe } from '@ember/template';
|
|
6
|
-
import { later } from '@ember/runloop';
|
|
7
|
-
import { on } from '@ember/modifier';
|
|
8
|
-
import { fn, concat } from '@ember/helper';
|
|
9
|
-
import { CloseButton } from '@frontile/buttons';
|
|
10
|
-
import { cssTransition } from 'ember-css-transitions';
|
|
11
|
-
import { useStyles } from '@frontile/theme';
|
|
12
|
-
import { precompileTemplate } from '@ember/template-compilation';
|
|
13
|
-
import { setComponentTemplate } from '@ember/component';
|
|
14
|
-
import { d as decorateFieldV2, i as initializeDeferredDecorator } from '../runtime-BPCpkOf1-B5Lbloj7.js';
|
|
15
|
-
|
|
16
|
-
/* eslint-disable ember/no-runloop */
|
|
17
|
-
class NotificationCard extends Component {
|
|
18
|
-
static {
|
|
19
|
-
decorateFieldV2(this.prototype, "notifications", [service]);
|
|
20
|
-
}
|
|
21
|
-
#notifications = (initializeDeferredDecorator(this, "notifications"), void 0);
|
|
22
|
-
static {
|
|
23
|
-
decorateFieldV2(this.prototype, "hasEntered", [tracked], function () {
|
|
24
|
-
return false;
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
#hasEntered = (initializeDeferredDecorator(this, "hasEntered"), void 0);
|
|
28
|
-
get styles() {
|
|
29
|
-
const styles = [`transition-duration: ${this.args.notification.transitionDuration}ms`];
|
|
30
|
-
if (!this.hasEntered) {
|
|
31
|
-
styles.push(`transition-delay: ${this.args.notification.transitionDuration}ms`);
|
|
32
|
-
}
|
|
33
|
-
return htmlSafe(styles.join('; '));
|
|
34
|
-
}
|
|
35
|
-
transitionIn = modifier(element => {
|
|
36
|
-
const spacing = typeof this.args.spacing === 'undefined' ? 16 : this.args.spacing;
|
|
37
|
-
const expectedHeight = element.offsetHeight + spacing;
|
|
38
|
-
const duration = this.args.notification.transitionDuration / 2;
|
|
39
|
-
requestAnimationFrame(() => {
|
|
40
|
-
element.style.height = '0';
|
|
41
|
-
const transition = `height ${duration}ms ease-in ${duration}ms`;
|
|
42
|
-
element.style.transition = transition;
|
|
43
|
-
requestAnimationFrame(() => {
|
|
44
|
-
element.style.height = `${expectedHeight}px`;
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
|
-
later(this, () => {
|
|
48
|
-
this.hasEntered = true;
|
|
49
|
-
}, this.args.notification.transitionDuration);
|
|
50
|
-
});
|
|
51
|
-
transitionOut = modifier((element, [isExiting, ..._]) => {
|
|
52
|
-
if (isExiting) {
|
|
53
|
-
element.style.height = '0';
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
remove = () => {
|
|
57
|
-
this.notifications.remove(this.args.notification);
|
|
58
|
-
};
|
|
59
|
-
pause = () => {
|
|
60
|
-
if (this.args.notification.timer) {
|
|
61
|
-
this.args.notification.timer.pause();
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
resume = () => {
|
|
65
|
-
if (this.args.notification.timer) {
|
|
66
|
-
this.args.notification.timer.resume();
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
handleClickCustomAction = customAction => {
|
|
70
|
-
customAction.onClick();
|
|
71
|
-
this.notifications.remove(this.args.notification);
|
|
72
|
-
};
|
|
73
|
-
get classes() {
|
|
74
|
-
const {
|
|
75
|
-
notificationCard
|
|
76
|
-
} = useStyles();
|
|
77
|
-
let {
|
|
78
|
-
base,
|
|
79
|
-
message,
|
|
80
|
-
customActions,
|
|
81
|
-
customActionButton,
|
|
82
|
-
closeButton
|
|
83
|
-
} = notificationCard({
|
|
84
|
-
appearance: this.args.notification.appearance
|
|
85
|
-
});
|
|
86
|
-
return {
|
|
87
|
-
base: base(),
|
|
88
|
-
message: message(),
|
|
89
|
-
customActions: customActions(),
|
|
90
|
-
customActionButton: customActionButton(),
|
|
91
|
-
closeButton: closeButton()
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
static {
|
|
95
|
-
setComponentTemplate(precompileTemplate("\n {{!-- template-lint-disable no-invalid-interactive --}}\n {{!-- template-lint-disable no-unnecessary-concat --}}\n {{!-- template-lint-disable no-inline-styles --}}\n {{!-- template-lint-disable style-concatenation --}}\n <div {{this.transitionIn}} {{this.transitionOut @notification.isRemoving}}>\n {{#unless @notification.isRemoving}}\n <div {{on \"mouseenter\" this.pause}} {{on \"mouseleave\" this.resume}} {{cssTransition (concat \"notification-transition--slide-from-\" @placement) isEnabled=true}} class={{this.classes.base}} style=\"{{this.styles}}\" ...attributes>\n <div class={{this.classes.message}}>\n {{@notification.message}}\n </div>\n\n {{#if @notification.customActions}}\n <div class={{this.classes.customActions}}>\n {{#each @notification.customActions as |customAction|}}\n <button type=\"button\" class={{this.classes.customActionButton}} {{on \"click\" (fn this.handleClickCustomAction customAction)}}>\n {{customAction.label}}\n </button>\n {{/each}}\n </div>\n {{/if}}\n\n {{#if @notification.allowClosing}}\n <CloseButton @onPress={{this.remove}} @size=\"sm\" @class={{this.classes.closeButton}} />\n {{/if}}\n </div>\n {{/unless}}\n </div>\n ", {
|
|
96
|
-
strictMode: true,
|
|
97
|
-
scope: () => ({
|
|
98
|
-
on,
|
|
99
|
-
cssTransition,
|
|
100
|
-
concat,
|
|
101
|
-
fn,
|
|
102
|
-
CloseButton
|
|
103
|
-
})
|
|
104
|
-
}), this);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
export { NotificationCard, NotificationCard as default };
|
|
109
|
-
//# sourceMappingURL=notification-card.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"notification-card.js","sources":["../../src/components/notification-card.gts"],"sourcesContent":["/* eslint-disable ember/no-runloop */\nimport Component from '@glimmer/component';\nimport { modifier } from 'ember-modifier';\nimport { tracked } from '@glimmer/tracking';\nimport { service } from '@ember/service';\nimport { htmlSafe } from '@ember/template';\nimport { later } from '@ember/runloop';\nimport { on } from '@ember/modifier';\nimport { fn, concat } from '@ember/helper';\nimport { CloseButton } from '@frontile/buttons';\nimport { cssTransition } from 'ember-css-transitions';\nimport { useStyles } from '@frontile/theme';\n\nimport type NotificationsService from '../services/notifications';\nimport type Notification from '../-private/notification';\nimport type { CustomAction, containerPlacement } from '../-private/types';\n\ninterface NotificationCardSignature {\n Args: {\n notification: Notification<Record<string, unknown>>;\n placement: containerPlacement;\n\n /**\n * Spacing for each notification, in px.\n *\n * @defaultValue 16\n */\n spacing?: number;\n };\n Element: HTMLDivElement;\n}\n\nclass NotificationCard extends Component<NotificationCardSignature> {\n @service notifications!: NotificationsService;\n @tracked hasEntered = false;\n\n get styles(): unknown {\n const styles = [\n `transition-duration: ${this.args.notification.transitionDuration}ms`\n ];\n\n if (!this.hasEntered) {\n styles.push(\n `transition-delay: ${this.args.notification.transitionDuration}ms`\n );\n }\n\n return htmlSafe(styles.join('; '));\n }\n\n transitionIn = modifier((element: HTMLElement) => {\n const spacing =\n typeof this.args.spacing === 'undefined' ? 16 : this.args.spacing;\n const expectedHeight = element.offsetHeight + spacing;\n const duration = this.args.notification.transitionDuration / 2;\n\n requestAnimationFrame(() => {\n element.style.height = '0';\n const transition = `height ${duration}ms ease-in ${duration}ms`;\n element.style.transition = transition;\n\n requestAnimationFrame(() => {\n element.style.height = `${expectedHeight}px`;\n });\n });\n\n later(\n this,\n () => {\n this.hasEntered = true;\n },\n this.args.notification.transitionDuration\n );\n });\n\n transitionOut = modifier(\n (element: HTMLElement, [isExiting, ..._]: boolean[]) => {\n if (isExiting) {\n element.style.height = '0';\n }\n }\n );\n\n remove = () => {\n this.notifications.remove(this.args.notification);\n };\n\n pause = () => {\n if (this.args.notification.timer) {\n this.args.notification.timer.pause();\n }\n };\n\n resume = () => {\n if (this.args.notification.timer) {\n this.args.notification.timer.resume();\n }\n };\n\n handleClickCustomAction = (customAction: CustomAction) => {\n customAction.onClick();\n this.notifications.remove(this.args.notification);\n };\n\n get classes() {\n const { notificationCard } = useStyles();\n\n let { base, message, customActions, customActionButton, closeButton } =\n notificationCard({\n appearance: this.args.notification.appearance\n });\n\n return {\n base: base(),\n message: message(),\n customActions: customActions(),\n customActionButton: customActionButton(),\n closeButton: closeButton()\n };\n }\n\n <template>\n {{! template-lint-disable no-invalid-interactive }}\n {{! template-lint-disable no-unnecessary-concat }}\n {{! template-lint-disable no-inline-styles }}\n {{! template-lint-disable style-concatenation }}\n <div {{this.transitionIn}} {{this.transitionOut @notification.isRemoving}}>\n {{#unless @notification.isRemoving}}\n <div\n {{on \"mouseenter\" this.pause}}\n {{on \"mouseleave\" this.resume}}\n {{cssTransition\n (concat \"notification-transition--slide-from-\" @placement)\n isEnabled=true\n }}\n class={{this.classes.base}}\n style=\"{{this.styles}}\"\n ...attributes\n >\n <div class={{this.classes.message}}>\n {{@notification.message}}\n </div>\n\n {{#if @notification.customActions}}\n <div class={{this.classes.customActions}}>\n {{#each @notification.customActions as |customAction|}}\n <button\n type=\"button\"\n class={{this.classes.customActionButton}}\n {{on \"click\" (fn this.handleClickCustomAction customAction)}}\n >\n {{customAction.label}}\n </button>\n {{/each}}\n </div>\n {{/if}}\n\n {{#if @notification.allowClosing}}\n <CloseButton\n @onPress={{this.remove}}\n @size=\"sm\"\n @class={{this.classes.closeButton}}\n />\n {{/if}}\n </div>\n {{/unless}}\n </div>\n </template>\n}\n\nexport { NotificationCard, type NotificationCardSignature };\nexport default NotificationCard;\n"],"names":["NotificationCard","Component","g","prototype","service","i","void 0","tracked","styles","args","notification","transitionDuration","hasEntered","push","htmlSafe","join","transitionIn","modifier","element","spacing","expectedHeight","offsetHeight","duration","requestAnimationFrame","style","height","transition","later","transitionOut","isExiting","_","remove","notifications","pause","timer","resume","handleClickCustomAction","customAction","onClick","classes","notificationCard","useStyles","base","message","customActions","customActionButton","closeButton","appearance","setComponentTemplate","precompileTemplate","strictMode","scope","on","cssTransition","concat","fn","CloseButton"],"mappings":";;;;;;;;;;;;;;;AAAA;AAgCA,MAAMA,yBAAyBC,SAAA,CAAU;AAAA,EAAA;IAAAC,eAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,eAAA,EAAA,CACtCC,OAAA,CAAA,CAAA;AAAA;AAAA,EAAA,cAAA,IAAAC,2BAAA,CAAA,IAAA,EAAA,eAAA,CAAA,EAAAC,MAAA;AAAA,EAAA;IAAAJ,eAAA,CAAA,IAAA,CAAAC,SAAA,EA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E7B,IAAI;MAAEC,IAAI;MAAEC,OAAO;MAAEC,aAAa;MAAEC,kBAAkB;AAAEC,MAAAA;KAAa,GACnEN,gBAAA,CAAiB;AACfO,MAAAA,UAAA,EAAY,IAAI,CAACtC,IAAI,CAACC,YAAY,CAACqC;AACrC,KAAA,CAAA;IAEF,OAAO;MACLL,IAAA,EAAMA,IAAA,EAAA;MACNC,OAAA,EAASA,OAAA,EAAA;MACTC,aAAA,EAAeA,aAAA,EAAA;MACfC,kBAAA,EAAoBA,kBAAA,EAAA;MACpBC,WAAA,EAAaA,WAAA;KACf;AACF,EAAA;AAEA,EAAA;IAAAE,oBAAA,CAAAC,kBAAA,CAAA,62CAAA,EA8CA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,EAAA;QAAAC,aAAA;QAAAC,MAAA;QAAAC,EAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import Component from '@glimmer/component';
|
|
2
|
-
import { service } from '@ember/service';
|
|
3
|
-
import { modifier } from 'ember-modifier';
|
|
4
|
-
import { registerDestructor } from '@ember/destroyable';
|
|
5
|
-
import { NotificationCard } from './notification-card.js';
|
|
6
|
-
import { useStyles } from '@frontile/theme';
|
|
7
|
-
import { precompileTemplate } from '@ember/template-compilation';
|
|
8
|
-
import { setComponentTemplate } from '@ember/component';
|
|
9
|
-
import { d as decorateFieldV2, i as initializeDeferredDecorator } from '../runtime-BPCpkOf1-B5Lbloj7.js';
|
|
10
|
-
|
|
11
|
-
class NotificationsContainer extends Component {
|
|
12
|
-
static {
|
|
13
|
-
decorateFieldV2(this.prototype, "notifications", [service]);
|
|
14
|
-
}
|
|
15
|
-
#notifications = (initializeDeferredDecorator(this, "notifications"), void 0);
|
|
16
|
-
constructor(owner, args) {
|
|
17
|
-
super(owner, args);
|
|
18
|
-
// Set the onDismiss callback on the service
|
|
19
|
-
this.notifications.setOnRemoveCallback(this.args.onDismiss);
|
|
20
|
-
// Clean up when component is destroyed
|
|
21
|
-
registerDestructor(this, () => {
|
|
22
|
-
this.notifications.setOnRemoveCallback(undefined);
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
get isTopPlacement() {
|
|
26
|
-
return !!(this.args.placement && this.args.placement.includes('top'));
|
|
27
|
-
}
|
|
28
|
-
get sortedNotifications() {
|
|
29
|
-
if (this.isTopPlacement) {
|
|
30
|
-
return this.notifications.notifications.slice().reverse();
|
|
31
|
-
} else {
|
|
32
|
-
return this.notifications.notifications;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
get classes() {
|
|
36
|
-
const {
|
|
37
|
-
notificationsContainer
|
|
38
|
-
} = useStyles();
|
|
39
|
-
return notificationsContainer({
|
|
40
|
-
placement: this.args.placement,
|
|
41
|
-
class: this.args.class
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
setupSpacing = modifier(element => {
|
|
45
|
-
const spacing = typeof this.args.spacing === 'undefined' ? 16 : this.args.spacing;
|
|
46
|
-
if (this.isTopPlacement) {
|
|
47
|
-
element.style.marginTop = `${spacing}px`;
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
static {
|
|
51
|
-
setComponentTemplate(precompileTemplate("\n {{#if this.sortedNotifications}}\n <div {{this.setupSpacing @spacing @placement}} class={{this.classes}} role=\"alert\" aria-live=\"assertive\" aria-atomic=\"true\" ...attributes>\n {{#each this.sortedNotifications as |notification|}}\n <NotificationCard @spacing={{@spacing}} @placement={{if @placement @placement \"bottom-right\"}} @notification={{notification}} />\n {{/each}}\n </div>\n {{/if}}\n ", {
|
|
52
|
-
strictMode: true,
|
|
53
|
-
scope: () => ({
|
|
54
|
-
NotificationCard
|
|
55
|
-
})
|
|
56
|
-
}), this);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export { NotificationsContainer, NotificationsContainer as default };
|
|
61
|
-
//# sourceMappingURL=notifications-container.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"notifications-container.js","sources":["../../src/components/notifications-container.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { service } from '@ember/service';\nimport { modifier } from 'ember-modifier';\nimport { registerDestructor } from '@ember/destroyable';\nimport NotificationCard from './notification-card';\nimport type NotificationsService from '../services/notifications';\nimport type Notification from '../-private/notification';\nimport { type containerPlacement } from '../-private/types';\nimport { useStyles } from '@frontile/theme';\nimport type Owner from '@ember/owner';\n\ninterface NotificationsContainerSignature {\n Args: {\n /**\n * The placement of the notifications\n *\n * @defaultValue 'bottom-right'\n */\n placement?: containerPlacement;\n /**\n * Spacing for each notification, in px.\n *\n * @defaultValue 16\n */\n spacing?: number;\n\n /**\n * Custom class name, it will override the default ones using Tailwind Merge library.\n */\n class?: string;\n\n /**\n * Callback called when a notification is dismissed\n */\n onDismiss?: (notification: Notification<Record<string, unknown>>) => void;\n };\n Element: HTMLDivElement;\n}\n\nclass NotificationsContainer extends Component<NotificationsContainerSignature> {\n @service notifications!: NotificationsService;\n\n constructor(owner: Owner, args: NotificationsContainerSignature['Args']) {\n super(owner, args);\n\n // Set the onDismiss callback on the service\n this.notifications.setOnRemoveCallback(this.args.onDismiss);\n\n // Clean up when component is destroyed\n registerDestructor(this, () => {\n this.notifications.setOnRemoveCallback(undefined);\n });\n }\n\n get isTopPlacement(): boolean {\n return !!(this.args.placement && this.args.placement.includes('top'));\n }\n\n get sortedNotifications(): Notification[] {\n if (this.isTopPlacement) {\n return this.notifications.notifications.slice().reverse();\n } else {\n return this.notifications.notifications;\n }\n }\n\n get classes() {\n const { notificationsContainer } = useStyles();\n\n return notificationsContainer({\n placement: this.args.placement,\n class: this.args.class\n });\n }\n\n setupSpacing = modifier((element: HTMLElement) => {\n const spacing =\n typeof this.args.spacing === 'undefined' ? 16 : this.args.spacing;\n if (this.isTopPlacement) {\n element.style.marginTop = `${spacing}px`;\n }\n });\n\n <template>\n {{#if this.sortedNotifications}}\n <div\n {{this.setupSpacing @spacing @placement}}\n class={{this.classes}}\n role=\"alert\"\n aria-live=\"assertive\"\n aria-atomic=\"true\"\n ...attributes\n >\n {{#each this.sortedNotifications as |notification|}}\n <NotificationCard\n @spacing={{@spacing}}\n @placement={{if @placement @placement \"bottom-right\"}}\n @notification={{notification}}\n />\n {{/each}}\n </div>\n {{/if}}\n </template>\n}\n\nexport { NotificationsContainer, type NotificationsContainerSignature };\nexport default NotificationsContainer;\n"],"names":["NotificationsContainer","Component","g","prototype","service","i","void 0","constructor","owner","args","notifications","setOnRemoveCallback","onDismiss","registerDestructor","undefined","isTopPlacement","placement","includes","sortedNotifications","slice","reverse","classes","notificationsContainer","useStyles","class","setupSpacing","modifier","element","spacing","style","marginTop","setComponentTemplate","precompileTemplate","strictMode","scope","NotificationCard"],"mappings":";;;;;;;;;;AAuCA,MAAMA,+BAA+BC,SAAA,CAAU;AAAA,EAAA;IAAAC,eAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,eAAA,EAAA,CAC5CC,OAAA,CAAA,CAAA;AAAA;AAAA,EAAA,cAAA,IAAAC,2BAAA,CAAA,IAAA,EAAA,eAAA,CAAA,EAAAC,MAAA;AAEDC,EAAAA,WAAAA,CAAYC,KAAY,EAAEC,IAA6C,EAAE;AACvE,IAAA,KAAK,CAACD,KAAA,EAAOC,IAAA,CAAA;AAEb;IACA,IAAI,CAACC,aAAa,CAACC,mBAAmB,CAAC,IAAI,CAACF,IAAI,CAACG,SAAS,CAAA;AAE1D;IACAC,kBAAA,CAAmB,IAAI,EAAE,MAAA;AACvB,MAAA,IAAI,CAACH,aAAa,CAACC,mBAAmB,CAACG,SAAA,CAAA;AACzC,IAAA,CAAA,CAAA;AACF,EAAA;EAEA,IAAIC,cAAAA,GAA0B;AAC5B,IAAA,OAAO,CAAC,EAAE,IAAI,CAACN,IAAI,CAACO,SAAS,IAAI,IAAI,CAACP,IAAI,CAACO,SAAS,CAACC,QAAQ,CAAC,KAAA,CAAM,CAAA;AACtE,EAAA;EAEA,IAAIC,sBAAsC;IACxC,IAAI,IAAI,CAACH,cAAc,EAAE;AACvB,MAAA,OAAO,IAAI,CAACL,aAAa,CAACA,aAAa,CAACS,KAAK,GAAGC,OAAO,EAAA;AACzD,IAAA,CAAA,MAAO;AACL,MAAA,OAAO,IAAI,CAACV,aAAa,CAACA,aAAa;AACzC,IAAA;AACF,EAAA;EAEA,IAAIW,OAAAA,GAAU;IACZ,MAAM;AAAEC,MAAAA;KAAwB,GAAGC,SAAA,EAAA;AAEnC,IAAA,OAAOD,sBAAA,CAAuB;AAC5BN,MAAAA,SAAA,EAAW,IAAI,CAACP,IAAI,CAACO,SAAS;AAC9BQ,MAAAA,KAAA,EAAO,IAAI,CAACf,IAAI,CAACe;AACnB,KAAA,CAAA;AACF,EAAA;AAEAC,EAAAA,YAAA,GAAeC,QAAA,CAAUC,OAAS,IAAA;AAChC,IAAA,MAAMC,OAAA,GACJ,OAAO,IAAI,CAACnB,IAAI,CAACmB,OAAO,KAAK,WAAA,GAAc,EAAA,GAAK,IAAI,CAACnB,IAAI,CAACmB,OAAO;IACnE,IAAI,IAAI,CAACb,cAAc,EAAE;AACvBY,MAAAA,OAAA,CAAQE,KAAK,CAACC,SAAS,GAAG,CAAA,EAAGF,OAAA,CAAA,EAAA,CAAW;AAC1C,IAAA;AACF,EAAA,CAAA,CAAA;AAEA,EAAA;IAAAG,oBAAA,CAAAC,kBAAA,CAAA,8bAAA,EAmBA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
|
package/dist/manager-C1Vyhk-A.js
DELETED
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
import { tracked } from '@glimmer/tracking';
|
|
2
|
-
import { cancel, later } from '@ember/runloop';
|
|
3
|
-
import { action, get } from '@ember/object';
|
|
4
|
-
import { d as decorateFieldV2, i as initializeDeferredDecorator, a as decorateMethodV2 } from './runtime-BPCpkOf1-B5Lbloj7.js';
|
|
5
|
-
import { assert } from '@ember/debug';
|
|
6
|
-
import { getOwner } from '@ember/owner';
|
|
7
|
-
import { isDestroyed } from '@ember/destroyable';
|
|
8
|
-
|
|
9
|
-
/* eslint-disable ember/no-runloop */
|
|
10
|
-
class Timer {
|
|
11
|
-
static {
|
|
12
|
-
decorateFieldV2(this.prototype, "remaining", [tracked]);
|
|
13
|
-
}
|
|
14
|
-
#remaining = (initializeDeferredDecorator(this, "remaining"), void 0);
|
|
15
|
-
static {
|
|
16
|
-
decorateFieldV2(this.prototype, "isRunning", [tracked], function () {
|
|
17
|
-
return true;
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
#isRunning = (initializeDeferredDecorator(this, "isRunning"), void 0);
|
|
21
|
-
onFinish;
|
|
22
|
-
timer;
|
|
23
|
-
start;
|
|
24
|
-
constructor(duration, onFinish) {
|
|
25
|
-
this.remaining = duration;
|
|
26
|
-
this.onFinish = onFinish;
|
|
27
|
-
this.setup();
|
|
28
|
-
}
|
|
29
|
-
clear() {
|
|
30
|
-
this.isRunning = false;
|
|
31
|
-
if (this.timer) {
|
|
32
|
-
cancel(this.timer);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
static {
|
|
36
|
-
decorateMethodV2(this.prototype, "clear", [action]);
|
|
37
|
-
}
|
|
38
|
-
pause() {
|
|
39
|
-
this.clear();
|
|
40
|
-
this.remaining -= Date.now() - this.start;
|
|
41
|
-
}
|
|
42
|
-
static {
|
|
43
|
-
decorateMethodV2(this.prototype, "pause", [action]);
|
|
44
|
-
}
|
|
45
|
-
resume() {
|
|
46
|
-
this.clear();
|
|
47
|
-
this.setup();
|
|
48
|
-
}
|
|
49
|
-
static {
|
|
50
|
-
decorateMethodV2(this.prototype, "resume", [action]);
|
|
51
|
-
}
|
|
52
|
-
setup() {
|
|
53
|
-
this.start = Date.now();
|
|
54
|
-
this.isRunning = true;
|
|
55
|
-
this.timer = later(this, () => {
|
|
56
|
-
this.onFinish();
|
|
57
|
-
this.isRunning = false;
|
|
58
|
-
}, this.remaining);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function getConfigOption(config, key, defaultValue) {
|
|
63
|
-
const value = get(config, key);
|
|
64
|
-
if (value === undefined) {
|
|
65
|
-
return defaultValue;
|
|
66
|
-
}
|
|
67
|
-
return value;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
class Notification {
|
|
71
|
-
message;
|
|
72
|
-
transitionDuration;
|
|
73
|
-
appearance;
|
|
74
|
-
customActions;
|
|
75
|
-
allowClosing;
|
|
76
|
-
duration;
|
|
77
|
-
metadata;
|
|
78
|
-
static {
|
|
79
|
-
decorateFieldV2(this.prototype, "timer", [tracked]);
|
|
80
|
-
}
|
|
81
|
-
#timer = (initializeDeferredDecorator(this, "timer"), void 0);
|
|
82
|
-
static {
|
|
83
|
-
decorateFieldV2(this.prototype, "isRemoving", [tracked], function () {
|
|
84
|
-
return false;
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
#isRemoving = (initializeDeferredDecorator(this, "isRemoving"), void 0);
|
|
88
|
-
constructor(config, message, options = {}) {
|
|
89
|
-
this.message = message;
|
|
90
|
-
this.appearance = options.appearance || getConfigOption(config, 'appearance', 'info');
|
|
91
|
-
this.customActions = options.customActions;
|
|
92
|
-
this.duration = options.duration || getConfigOption(config, 'duration', 5000);
|
|
93
|
-
this.transitionDuration = typeof options.transitionDuration !== 'undefined' ? options.transitionDuration : getConfigOption(config, 'transitionDuration', 200);
|
|
94
|
-
this.metadata = options.metadata;
|
|
95
|
-
if (options.allowClosing === false) {
|
|
96
|
-
this.allowClosing = false;
|
|
97
|
-
} else {
|
|
98
|
-
this.allowClosing = true;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
remove() {
|
|
102
|
-
this.isRemoving = true;
|
|
103
|
-
if (this.timer) {
|
|
104
|
-
this.timer.clear();
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/* eslint-disable ember/no-runloop */
|
|
110
|
-
class NotificationsManager {
|
|
111
|
-
static {
|
|
112
|
-
decorateFieldV2(this.prototype, "notifications", [tracked], function () {
|
|
113
|
-
return [];
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
#notifications = (initializeDeferredDecorator(this, "notifications"), void 0);
|
|
117
|
-
config = {};
|
|
118
|
-
onRemove;
|
|
119
|
-
constructor(context, onRemove) {
|
|
120
|
-
if (isDestroyed(context)) {
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
const owner = getOwner(context);
|
|
124
|
-
assert('NotificationsManager context must have an owner', owner);
|
|
125
|
-
const configFactory = owner.factoryFor('config:environment');
|
|
126
|
-
if (configFactory && configFactory.class) {
|
|
127
|
-
this.config = configFactory.class['@frontile/notifications'] || {};
|
|
128
|
-
}
|
|
129
|
-
this.onRemove = onRemove;
|
|
130
|
-
}
|
|
131
|
-
add(message, options = {}) {
|
|
132
|
-
const notification = new Notification(this.config, message, options);
|
|
133
|
-
this.notifications = [...this.notifications, notification];
|
|
134
|
-
let preserve = typeof options.preserve === 'undefined' ? getConfigOption(this.config, 'preserve', false) : options.preserve;
|
|
135
|
-
|
|
136
|
-
// if default config has set skipTimer to true, we will preserve the
|
|
137
|
-
// notification, therefore skiping the timer
|
|
138
|
-
if (getConfigOption(this.config, 'skipTimer', false) === true) {
|
|
139
|
-
preserve = true;
|
|
140
|
-
}
|
|
141
|
-
if (preserve === false) {
|
|
142
|
-
this.setupAutoRemoval(notification, notification.duration);
|
|
143
|
-
}
|
|
144
|
-
return notification;
|
|
145
|
-
}
|
|
146
|
-
remove(notification) {
|
|
147
|
-
if (!notification) {
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
notification.remove();
|
|
151
|
-
later(this, () => {
|
|
152
|
-
this.notifications = this.notifications.filter(n => {
|
|
153
|
-
return n !== notification;
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
// Call the onRemove callback after the notification is actually removed
|
|
157
|
-
if (this.onRemove) {
|
|
158
|
-
this.onRemove(notification);
|
|
159
|
-
}
|
|
160
|
-
}, notification.transitionDuration);
|
|
161
|
-
}
|
|
162
|
-
removeAll() {
|
|
163
|
-
this.notifications.forEach(notification => {
|
|
164
|
-
this.remove(notification);
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
setupAutoRemoval(notification, duration) {
|
|
168
|
-
notification.timer = new Timer(duration, () => {
|
|
169
|
-
this.remove(notification);
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
export { Notification as N, Timer as T, NotificationsManager as a };
|
|
175
|
-
//# sourceMappingURL=manager-C1Vyhk-A.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"manager-C1Vyhk-A.js","sources":["../src/-private/timer.ts","../src/-private/get-config.ts","../src/-private/notification.ts","../src/-private/manager.ts"],"sourcesContent":["/* eslint-disable ember/no-runloop */\nimport { tracked } from '@glimmer/tracking';\nimport { later, cancel } from '@ember/runloop';\nimport type { Timer as EmberTimer } from '@ember/runloop';\nimport { action } from '@ember/object';\n\nexport default class Timer {\n @tracked remaining: number;\n @tracked isRunning = true;\n\n readonly onFinish: () => void;\n private timer?: EmberTimer;\n private start!: number;\n\n constructor(duration: number, onFinish: () => void) {\n this.remaining = duration;\n this.onFinish = onFinish;\n this.setup();\n }\n\n @action clear(): void {\n this.isRunning = false;\n\n if (this.timer) {\n cancel(this.timer);\n }\n }\n\n @action pause(): void {\n this.clear();\n this.remaining -= Date.now() - this.start;\n }\n\n @action resume(): void {\n this.clear();\n this.setup();\n }\n\n private setup(): void {\n this.start = Date.now();\n this.isRunning = true;\n\n this.timer = later(\n this,\n () => {\n this.onFinish();\n this.isRunning = false;\n },\n this.remaining\n );\n }\n}\n","import { get } from '@ember/object';\nimport type { DefaultConfig } from './types';\n\nexport function getConfigOption<T extends keyof DefaultConfig>(\n config: DefaultConfig,\n key: T,\n defaultValue: NonNullable<DefaultConfig[T]>\n): NonNullable<DefaultConfig[T]> {\n const value = get(config, key);\n\n if (value === undefined) {\n return defaultValue;\n }\n\n return value;\n}\n","import { tracked } from '@glimmer/tracking';\nimport Timer from './timer';\nimport { getConfigOption } from './get-config';\nimport type { NotificationOptions, CustomAction, DefaultConfig } from './types';\n\nexport default class Notification<\n TMetadata extends Record<string, unknown> = Record<string, unknown>\n> {\n readonly message: string;\n readonly transitionDuration: number;\n readonly appearance: NonNullable<NotificationOptions['appearance']>;\n readonly customActions?: CustomAction[];\n readonly allowClosing: boolean;\n readonly duration: number;\n readonly metadata?: TMetadata;\n\n @tracked timer?: Timer;\n @tracked isRemoving = false;\n\n constructor(\n config: DefaultConfig,\n message: string,\n options: NotificationOptions<TMetadata> = {}\n ) {\n this.message = message;\n this.appearance =\n options.appearance || getConfigOption(config, 'appearance', 'info');\n this.customActions = options.customActions;\n this.duration =\n options.duration || getConfigOption(config, 'duration', 5000);\n this.transitionDuration =\n typeof options.transitionDuration !== 'undefined'\n ? options.transitionDuration\n : getConfigOption(config, 'transitionDuration', 200);\n this.metadata = options.metadata;\n\n if (options.allowClosing === false) {\n this.allowClosing = false;\n } else {\n this.allowClosing = true;\n }\n }\n\n remove(): void {\n this.isRemoving = true;\n\n if (this.timer) {\n this.timer.clear();\n }\n }\n}\n","/* eslint-disable ember/no-runloop */\nimport Notification from './notification';\nimport Timer from './timer';\nimport { tracked } from '@glimmer/tracking';\nimport { assert } from '@ember/debug';\nimport { getConfigOption } from './get-config';\nimport { getOwner } from '@ember/owner';\nimport { isDestroyed } from '@ember/destroyable';\nimport { later } from '@ember/runloop';\nimport type Owner from '@ember/owner';\nimport type { DefaultConfig } from './types';\nimport type { NotificationOptions } from './types';\n\nexport default class NotificationsManager {\n @tracked notifications: Notification<Record<string, unknown>>[] = [];\n\n config: DefaultConfig = {};\n onRemove?: (notification: Notification<Record<string, unknown>>) => void;\n\n constructor(\n context: object,\n onRemove?: (notification: Notification<Record<string, unknown>>) => void\n ) {\n if (isDestroyed(context)) {\n return;\n }\n const owner = getOwner(context) as Owner;\n assert('NotificationsManager context must have an owner', owner);\n const configFactory = owner.factoryFor('config:environment');\n\n if (configFactory && configFactory.class) {\n this.config =\n (configFactory.class as never)['@frontile/notifications'] || {};\n }\n\n this.onRemove = onRemove;\n }\n\n add<TMetadata extends Record<string, unknown> = Record<string, unknown>>(\n message: string,\n options: NotificationOptions<TMetadata> = {}\n ): Notification<TMetadata> {\n const notification = new Notification<TMetadata>(\n this.config,\n message,\n options\n );\n this.notifications = [...this.notifications, notification];\n\n let preserve =\n typeof options.preserve === 'undefined'\n ? getConfigOption(this.config, 'preserve', false)\n : options.preserve;\n\n // if default config has set skipTimer to true, we will preserve the\n // notification, therefore skiping the timer\n if (getConfigOption(this.config, 'skipTimer', false) === true) {\n preserve = true;\n }\n\n if (preserve === false) {\n this.setupAutoRemoval(notification, notification.duration);\n }\n return notification;\n }\n\n remove(notification?: Notification<Record<string, unknown>>): void {\n if (!notification) {\n return;\n }\n\n notification.remove();\n\n later(\n this,\n () => {\n this.notifications = this.notifications.filter((n) => {\n return n !== notification;\n });\n\n // Call the onRemove callback after the notification is actually removed\n if (this.onRemove) {\n this.onRemove(notification);\n }\n },\n notification.transitionDuration\n );\n }\n\n removeAll(): void {\n this.notifications.forEach((notification) => {\n this.remove(notification);\n });\n }\n\n private setupAutoRemoval(\n notification: Notification<Record<string, unknown>>,\n duration: number\n ): void {\n notification.timer = new Timer(duration, () => {\n this.remove(notification);\n });\n }\n}\n"],"names":["Timer","g","prototype","tracked","i","void 0","onFinish","timer","start","constructor","duration","remaining","setup","clear","isRunning","cancel","n","action","pause","Date","now","resume","later","getConfigOption","config","key","defaultValue","value","get","undefined","Notification","message","transitionDuration","appearance","customActions","allowClosing","metadata","options","remove","isRemoving","NotificationsManager","onRemove","context","isDestroyed","owner","getOwner","assert","configFactory","factoryFor","class","add","notification","notifications","preserve","setupAutoRemoval","filter","removeAll","forEach"],"mappings":";;;;;;;;AAAA;AAMe,MAAMA,KAAK,CAAC;AAAA,EAAA;IAAAC,eAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,WAAA,EAAA,CACxBC,OAAO,CAAA,CAAA;AAAA;AAAA,EAAA,UAAA,IAAAC,2BAAA,CAAA,IAAA,EAAA,WAAA,CAAA,EAAAC,MAAA;AAAA,EAAA;IAAAJ,eAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,WAAA,EAAA,CACPC,OAAO,CAAA,EAAA,YAAA;AAAA,MAAA,OAAa,IAAI;AAAA,IAAA,CAAA,CAAA;AAAA;AAAA,EAAA,UAAA,IAAAC,2BAAA,CAAA,IAAA,EAAA,WAAA,CAAA,EAAAC,MAAA;EAEhBC,QAAQ;EACTC,KAAK;EACLC,KAAK;AAEbC,EAAAA,WAAWA,CAACC,QAAgB,EAAEJ,QAAoB,EAAE;IAClD,IAAI,CAACK,SAAS,GAAGD,QAAQ;IACzB,IAAI,CAACJ,QAAQ,GAAGA,QAAQ;IACxB,IAAI,CAACM,KAAK,EAAE;AACd,EAAA;AAEQC,EAAAA,KAAKA,GAAS;IACpB,IAAI,CAACC,SAAS,GAAG,KAAK;IAEtB,IAAI,IAAI,CAACP,KAAK,EAAE;AACdQ,MAAAA,MAAM,CAAC,IAAI,CAACR,KAAK,CAAC;AACpB,IAAA;AACF,EAAA;AAAC,EAAA;IAAAS,gBAAA,CAAA,IAAA,CAAAd,SAAA,EAAA,OAAA,EAAA,CANAe,MAAM,CAAA,CAAA;AAAA;AAQCC,EAAAA,KAAKA,GAAS;IACpB,IAAI,CAACL,KAAK,EAAE;IACZ,IAAI,CAACF,SAAS,IAAIQ,IAAI,CAACC,GAAG,EAAE,GAAG,IAAI,CAACZ,KAAK;AAC3C,EAAA;AAAC,EAAA;IAAAQ,gBAAA,CAAA,IAAA,CAAAd,SAAA,EAAA,OAAA,EAAA,C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IA,QAAQ,KAAK,KAAK,EAAE;MACtB,IAAI,CAACC,gBAAgB,CAACH,YAAY,EAAEA,YAAY,CAACzC,QAAQ,CAAC;AAC5D,IAAA;AACA,IAAA,OAAOyC,YAAY;AACrB,EAAA;EAEAb,MAAMA,CAACa,YAAoD,EAAQ;IACjE,IAAI,CAACA,YAAY,EAAE;AACjB,MAAA;AACF,IAAA;IAEAA,YAAY,CAACb,MAAM,EAAE;IAErBhB,KAAK,CACH,IAAI,EACJ,MAAM;MACJ,IAAI,CAAC8B,aAAa,GAAG,IAAI,CAACA,aAAa,CAACG,MAAM,CAAEvC,CAAC,IAAK;QACpD,OAAOA,CAAC,KAAKmC,YAAY;AAC3B,MAAA,CAAC,CAAC;;AAEF;MACA,IAAI,IAAI,CAACV,QAAQ,EAAE;AACjB,QAAA,IAAI,CAACA,QAAQ,CAACU,YAAY,CAAC;AAC7B,MAAA;AACF,IAAA,CAAC,EACDA,YAAY,CAACnB,kBACf,CAAC;AACH,EAAA;AAEAwB,EAAAA,SAASA,GAAS;AAChB,IAAA,IAAI,CAACJ,aAAa,CAACK,OAAO,CAAEN,YAAY,IAAK;AAC3C,MAAA,IAAI,CAACb,MAAM,CAACa,YAAY,CAAC;AAC3B,IAAA,CAAC,CAAC;AACJ,EAAA;AAEQG,EAAAA,gBAAgBA,CACtBH,YAAmD,EACnDzC,QAAgB,EACV;IACNyC,YAAY,CAAC5C,KAAK,GAAG,IAAIP,KAAK,CAACU,QAAQ,EAAE,MAAM;AAC7C,MAAA,IAAI,CAAC4B,MAAM,CAACa,YAAY,CAAC;AAC3B,IAAA,CAAC,CAAC;AACJ,EAAA;AACF;;;;"}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
const deferred = /* @__PURE__ */new WeakMap();
|
|
2
|
-
function deferDecorator(proto, prop, desc) {
|
|
3
|
-
let map = deferred.get(proto);
|
|
4
|
-
if (!map) {
|
|
5
|
-
map = /* @__PURE__ */new Map();
|
|
6
|
-
deferred.set(proto, map);
|
|
7
|
-
}
|
|
8
|
-
map.set(prop, desc);
|
|
9
|
-
}
|
|
10
|
-
function findDeferredDecorator(target, prop) {
|
|
11
|
-
var _a;
|
|
12
|
-
let cursor = target.prototype;
|
|
13
|
-
while (cursor) {
|
|
14
|
-
let desc = (_a = deferred.get(cursor)) == null ? void 0 : _a.get(prop);
|
|
15
|
-
if (desc) {
|
|
16
|
-
return desc;
|
|
17
|
-
}
|
|
18
|
-
cursor = cursor.prototype;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
function decorateFieldV2(prototype, prop, decorators, initializer) {
|
|
22
|
-
let desc = {
|
|
23
|
-
configurable: true,
|
|
24
|
-
enumerable: true,
|
|
25
|
-
writable: true,
|
|
26
|
-
initializer: null
|
|
27
|
-
};
|
|
28
|
-
if (initializer) {
|
|
29
|
-
desc.initializer = initializer;
|
|
30
|
-
}
|
|
31
|
-
for (let decorator of decorators) {
|
|
32
|
-
desc = decorator(prototype, prop, desc) || desc;
|
|
33
|
-
}
|
|
34
|
-
if (desc.initializer === void 0) {
|
|
35
|
-
Object.defineProperty(prototype, prop, desc);
|
|
36
|
-
} else {
|
|
37
|
-
deferDecorator(prototype, prop, desc);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
function decorateMethodV2(prototype, prop, decorators) {
|
|
41
|
-
const origDesc = Object.getOwnPropertyDescriptor(prototype, prop);
|
|
42
|
-
let desc = {
|
|
43
|
-
...origDesc
|
|
44
|
-
};
|
|
45
|
-
for (let decorator of decorators) {
|
|
46
|
-
desc = decorator(prototype, prop, desc) || desc;
|
|
47
|
-
}
|
|
48
|
-
if (desc.initializer !== void 0) {
|
|
49
|
-
desc.value = desc.initializer ? desc.initializer.call(prototype) : void 0;
|
|
50
|
-
desc.initializer = void 0;
|
|
51
|
-
}
|
|
52
|
-
Object.defineProperty(prototype, prop, desc);
|
|
53
|
-
}
|
|
54
|
-
function initializeDeferredDecorator(target, prop) {
|
|
55
|
-
let desc = findDeferredDecorator(target.constructor, prop);
|
|
56
|
-
if (desc) {
|
|
57
|
-
Object.defineProperty(target, prop, {
|
|
58
|
-
enumerable: desc.enumerable,
|
|
59
|
-
configurable: desc.configurable,
|
|
60
|
-
writable: desc.writable,
|
|
61
|
-
value: desc.initializer ? desc.initializer.call(target) : void 0
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export { decorateMethodV2 as a, decorateFieldV2 as d, initializeDeferredDecorator as i };
|
|
67
|
-
//# sourceMappingURL=runtime-BPCpkOf1-B5Lbloj7.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-BPCpkOf1-B5Lbloj7.js","sources":["../../../node_modules/.pnpm/decorator-transforms@2.3.0_@babel+core@7.26.7/node_modules/decorator-transforms/dist/runtime-BPCpkOf1.js"],"sourcesContent":["const deferred = /* @__PURE__ */ new WeakMap();\nfunction deferDecorator(proto, prop, desc) {\n let map = deferred.get(proto);\n if (!map) {\n map = /* @__PURE__ */ new Map();\n deferred.set(proto, map);\n }\n map.set(prop, desc);\n}\nfunction findDeferredDecorator(target, prop) {\n var _a;\n let cursor = target.prototype;\n while (cursor) {\n let desc = (_a = deferred.get(cursor)) == null ? void 0 : _a.get(prop);\n if (desc) {\n return desc;\n }\n cursor = cursor.prototype;\n }\n}\nfunction decorateFieldV1(target, prop, decorators, initializer) {\n return decorateFieldV2(target.prototype, prop, decorators, initializer);\n}\nfunction decorateFieldV2(prototype, prop, decorators, initializer) {\n let desc = {\n configurable: true,\n enumerable: true,\n writable: true,\n initializer: null\n };\n if (initializer) {\n desc.initializer = initializer;\n }\n for (let decorator of decorators) {\n desc = decorator(prototype, prop, desc) || desc;\n }\n if (desc.initializer === void 0) {\n Object.defineProperty(prototype, prop, desc);\n } else {\n deferDecorator(prototype, prop, desc);\n }\n}\nfunction decorateMethodV1({ prototype }, prop, decorators) {\n return decorateMethodV2(prototype, prop, decorators);\n}\nfunction decorateMethodV2(prototype, prop, decorators) {\n const origDesc = Object.getOwnPropertyDescriptor(prototype, prop);\n let desc = { ...origDesc };\n for (let decorator of decorators) {\n desc = decorator(prototype, prop, desc) || desc;\n }\n if (desc.initializer !== void 0) {\n desc.value = desc.initializer ? desc.initializer.call(prototype) : void 0;\n desc.initializer = void 0;\n }\n Object.defineProperty(prototype, prop, desc);\n}\nfunction initializeDeferredDecorator(target, prop) {\n let desc = findDeferredDecorator(target.constructor, prop);\n if (desc) {\n Object.defineProperty(target, prop, {\n enumerable: desc.enumerable,\n configurable: desc.configurable,\n writable: desc.writable,\n value: desc.initializer ? desc.initializer.call(target) : void 0\n });\n }\n}\nfunction decorateClass(target, decorators) {\n return decorators.reduce(\n (accum, decorator) => decorator(accum) || accum,\n target\n );\n}\nfunction decoratePOJO(pojo, decorated) {\n for (let [type, prop, decorators] of decorated) {\n if (type === \"field\") {\n decoratePojoField(pojo, prop, decorators);\n } else {\n decorateMethodV2(pojo, prop, decorators);\n }\n }\n return pojo;\n}\nfunction decoratePojoField(pojo, prop, decorators) {\n let desc = {\n configurable: true,\n enumerable: true,\n writable: true,\n initializer: () => {\n var _a;\n return (_a = Object.getOwnPropertyDescriptor(pojo, prop)) == null ? void 0 : _a.value;\n }\n };\n for (let decorator of decorators) {\n desc = decorator(pojo, prop, desc) || desc;\n }\n if (desc.initializer) {\n desc.value = desc.initializer.call(pojo);\n delete desc.initializer;\n }\n Object.defineProperty(pojo, prop, desc);\n}\nconst runtime = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({\n __proto__: null,\n c: decorateClass,\n f: decorateFieldV1,\n g: decorateFieldV2,\n i: initializeDeferredDecorator,\n m: decorateMethodV1,\n n: decorateMethodV2,\n p: decoratePOJO\n}, Symbol.toStringTag, { value: \"Module\" }));\nexport {\n decorateFieldV2 as a,\n decorateMethodV1 as b,\n decorateMethodV2 as c,\n decorateFieldV1 as d,\n decorateClass as e,\n decoratePOJO as f,\n initializeDeferredDecorator as i,\n runtime as r\n};\n//# sourceMappingURL=runtime-BPCpkOf1.js.map\n"],"names":["deferred","WeakMap","deferDecorator","proto","prop","desc","map","get","Map","set","findDeferredDecorator","target","_a","cursor","prototype","decorateFieldV2","decorators","initializer","configurable","enumerable","writable","decorator","Object","defineProperty","decorateMethodV2","origDesc","getOwnPropertyDescriptor","value","call","initializeDeferredDecorator","constructor"],"mappings":"AAuBA,MAAMA,QAAA,sBAGEC,OAAA,EAAA;AAER,SAASC,eACPC,KAAA,EACAC,IAAA,EACAC,IAAA,EACM;AACF,EAAA,IAAAC,GAAA,GAAMN,QAAA,CAASO,GAAA,CAAIJ,KAAK,CAAA;EAC5B,IAAI,CAACG,GAAA,EAAK;AACRA,IAAAA,GAAA,sBAAUE,GAAA,EAAA;AACDR,IAAAA,QAAA,CAAAS,GAAA,CAAIN,KAAA,EAAOG,GAAG,CAAA;AACzB,EAAA;AACIA,EAAAA,GAAA,CAAAG,GAAA,CAAIL,IAAA,EAAMC,IAAI,CAAA;AACpB;AAEA,SAASK,qBAAAA,CACPC,MAAA,EACAP,IAAA,EACwB;AArB1B,EAAA,IAAAQ,EAAA;AAsBE,EAAA,IAAIC,MAAA,GAAkBF,MAAA,CAAeG,SAAA;AACrC,EAAA,OAAOD,MAAA,EAAQ;AACb,IAAA,IAAIR,IAAA,GAAA,CAAOO,EAAA,GAAAZ,QAAA,CAASO,GAAA,CAAIM,MAAM,MAAnB,IAAA,GAAA,MAAA,GAAAD,EAAA,CAAsBL,GAAA,CAAIH,IAAA,CAAA;AACrC,IAAA,IAAIC,IAAA,EAAM;AACD,MAAA,OAAAA,IAAA;AACT,IAAA;IACAQ,MAAA,GAAUA,MAAA,CAAeC,SAAA;AAC3B,EAAA;AACF;AAWA,SAASC,eAAAA,CACPD,SAAA,EACAV,IAAA,EACAY,UAAA,EACAC,WAAA,EACM;AACN,EAAA,IAAIZ,IAAA,GAAmB;AACrBa,IAAAA,YAAA,EAAc,IAAA;AACdC,IAAAA,UAAA,EAAY,IAAA;AACZC,IAAAA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