electron-notify-manager 1.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/README.md +323 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/src/NotificationManager.d.ts +45 -0
- package/dist/src/NotificationManager.d.ts.map +1 -0
- package/dist/src/NotificationManager.js +337 -0
- package/dist/src/NotificationManager.js.map +1 -0
- package/dist/src/NotificationWindow.d.ts +19 -0
- package/dist/src/NotificationWindow.d.ts.map +1 -0
- package/dist/src/NotificationWindow.js +165 -0
- package/dist/src/NotificationWindow.js.map +1 -0
- package/dist/src/constants.d.ts +22 -0
- package/dist/src/constants.d.ts.map +1 -0
- package/dist/src/constants.js +39 -0
- package/dist/src/constants.js.map +1 -0
- package/dist/src/core/NotificationQueue.d.ts +14 -0
- package/dist/src/core/NotificationQueue.d.ts.map +1 -0
- package/dist/src/core/NotificationQueue.js +35 -0
- package/dist/src/core/NotificationQueue.js.map +1 -0
- package/dist/src/errors.d.ts +23 -0
- package/dist/src/errors.d.ts.map +1 -0
- package/dist/src/errors.js +43 -0
- package/dist/src/errors.js.map +1 -0
- package/dist/src/ipc/IpcChannels.d.ts +9 -0
- package/dist/src/ipc/IpcChannels.d.ts.map +1 -0
- package/dist/src/ipc/IpcChannels.js +11 -0
- package/dist/src/ipc/IpcChannels.js.map +1 -0
- package/dist/src/position/PositionCalculator.d.ts +22 -0
- package/dist/src/position/PositionCalculator.d.ts.map +1 -0
- package/dist/src/position/PositionCalculator.js +77 -0
- package/dist/src/position/PositionCalculator.js.map +1 -0
- package/dist/src/positionCalculator.d.ts +19 -0
- package/dist/src/positionCalculator.d.ts.map +1 -0
- package/dist/src/positionCalculator.js +50 -0
- package/dist/src/positionCalculator.js.map +1 -0
- package/dist/src/types/config.types.d.ts +11 -0
- package/dist/src/types/config.types.d.ts.map +1 -0
- package/dist/src/types/config.types.js +3 -0
- package/dist/src/types/config.types.js.map +1 -0
- package/dist/src/types/index.d.ts +8 -0
- package/dist/src/types/index.d.ts.map +1 -0
- package/dist/src/types/index.js +3 -0
- package/dist/src/types/index.js.map +1 -0
- package/dist/src/types/ipc.types.d.ts +12 -0
- package/dist/src/types/ipc.types.d.ts.map +1 -0
- package/dist/src/types/ipc.types.js +3 -0
- package/dist/src/types/ipc.types.js.map +1 -0
- package/dist/src/types/notification.types.d.ts +28 -0
- package/dist/src/types/notification.types.d.ts.map +1 -0
- package/dist/src/types/notification.types.js +3 -0
- package/dist/src/types/notification.types.js.map +1 -0
- package/dist/src/types/position.types.d.ts +12 -0
- package/dist/src/types/position.types.d.ts.map +1 -0
- package/dist/src/types/position.types.js +3 -0
- package/dist/src/types/position.types.js.map +1 -0
- package/dist/src/types/theme.types.d.ts +8 -0
- package/dist/src/types/theme.types.d.ts.map +1 -0
- package/dist/src/types/theme.types.js +3 -0
- package/dist/src/types/theme.types.js.map +1 -0
- package/dist/src/utils/idGenerator.d.ts +7 -0
- package/dist/src/utils/idGenerator.d.ts.map +1 -0
- package/dist/src/utils/idGenerator.js +16 -0
- package/dist/src/utils/idGenerator.js.map +1 -0
- package/dist/src/utils/logger.d.ts +12 -0
- package/dist/src/utils/logger.d.ts.map +1 -0
- package/dist/src/utils/logger.js +38 -0
- package/dist/src/utils/logger.js.map +1 -0
- package/dist/src/utils/themeDetector.d.ts +3 -0
- package/dist/src/utils/themeDetector.d.ts.map +1 -0
- package/dist/src/utils/themeDetector.js +11 -0
- package/dist/src/utils/themeDetector.js.map +1 -0
- package/dist/src/utils/validators.d.ts +10 -0
- package/dist/src/utils/validators.d.ts.map +1 -0
- package/dist/src/utils/validators.js +95 -0
- package/dist/src/utils/validators.js.map +1 -0
- package/dist/types.d.ts +4 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/package.json +50 -0
- package/renderer/notification.css +172 -0
- package/renderer/notification.html +52 -0
- package/renderer/notification.js +137 -0
- package/renderer/notification.ts +150 -0
- package/renderer/preload.js +38 -0
- package/renderer/preload.ts +56 -0
- package/renderer/scripts/animationController.ts +12 -0
- package/renderer/scripts/icons.ts +36 -0
- package/renderer/scripts/notification.js +188 -0
- package/renderer/scripts/progressBar.ts +10 -0
- package/renderer/styles/animations.css +28 -0
- package/renderer/styles/notification.css +186 -0
- package/renderer/styles/themes.css +94 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NotificationQueue = void 0;
|
|
4
|
+
const constants_1 = require("../constants");
|
|
5
|
+
class NotificationQueue {
|
|
6
|
+
constructor(maxVisible = constants_1.DEFAULTS.MAX_VISIBLE) {
|
|
7
|
+
this.queue = new Map();
|
|
8
|
+
this.maxVisible = maxVisible;
|
|
9
|
+
}
|
|
10
|
+
add(item) {
|
|
11
|
+
this.queue.set(item.id, item);
|
|
12
|
+
}
|
|
13
|
+
remove(id) {
|
|
14
|
+
const item = this.queue.get(id);
|
|
15
|
+
this.queue.delete(id);
|
|
16
|
+
return item;
|
|
17
|
+
}
|
|
18
|
+
getAll() {
|
|
19
|
+
return Array.from(this.queue.values());
|
|
20
|
+
}
|
|
21
|
+
getVisible() {
|
|
22
|
+
return this.getAll().slice(0, this.maxVisible);
|
|
23
|
+
}
|
|
24
|
+
has(id) {
|
|
25
|
+
return this.queue.has(id);
|
|
26
|
+
}
|
|
27
|
+
clear() {
|
|
28
|
+
this.queue.clear();
|
|
29
|
+
}
|
|
30
|
+
get size() {
|
|
31
|
+
return this.queue.size;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.NotificationQueue = NotificationQueue;
|
|
35
|
+
//# sourceMappingURL=NotificationQueue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotificationQueue.js","sourceRoot":"","sources":["../../../src/core/NotificationQueue.ts"],"names":[],"mappings":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_NOT_REGISTERED = "IPC_NOT_REGISTERED",
|
|
6
|
+
MANAGER_DESTROYED = "MANAGER_DESTROYED",
|
|
7
|
+
INVALID_OPTIONS = "INVALID_OPTIONS",
|
|
8
|
+
POSITION_CALCULATION_FAILED = "POSITION_CALCULATION_FAILED"
|
|
9
|
+
}
|
|
10
|
+
export declare class NotificationError extends Error {
|
|
11
|
+
readonly code: ErrorCode;
|
|
12
|
+
constructor(message: string, code: ErrorCode);
|
|
13
|
+
}
|
|
14
|
+
export declare class WindowCreationError extends NotificationError {
|
|
15
|
+
constructor(message: string);
|
|
16
|
+
}
|
|
17
|
+
export declare class PositionCalculationError extends NotificationError {
|
|
18
|
+
constructor(message: string);
|
|
19
|
+
}
|
|
20
|
+
export declare class IpcRegistrationError extends NotificationError {
|
|
21
|
+
constructor(message: string);
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA,oBAAY,SAAS;IACnB,sBAAsB,2BAA2B;IACjD,gBAAgB,qBAAqB;IACrC,sBAAsB,2BAA2B;IACjD,kBAAkB,uBAAuB;IACzC,iBAAiB,sBAAsB;IACvC,eAAe,oBAAoB;IACnC,2BAA2B,gCAAgC;CAC5D;AAED,qBAAa,iBAAkB,SAAQ,KAAK;IAC1C,SAAgB,IAAI,EAAE,SAAS,CAAC;gBAEb,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS;CAKpD;AAED,qBAAa,mBAAoB,SAAQ,iBAAiB;gBACrC,OAAO,EAAE,MAAM;CAInC;AAED,qBAAa,wBAAyB,SAAQ,iBAAiB;gBAC1C,OAAO,EAAE,MAAM;CAInC;AAED,qBAAa,oBAAqB,SAAQ,iBAAiB;gBACtC,OAAO,EAAE,MAAM;CAInC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IpcRegistrationError = exports.PositionCalculationError = exports.WindowCreationError = exports.NotificationError = exports.ErrorCode = void 0;
|
|
4
|
+
var ErrorCode;
|
|
5
|
+
(function (ErrorCode) {
|
|
6
|
+
ErrorCode["WINDOW_CREATION_FAILED"] = "WINDOW_CREATION_FAILED";
|
|
7
|
+
ErrorCode["INVALID_POSITION"] = "INVALID_POSITION";
|
|
8
|
+
ErrorCode["NOTIFICATION_NOT_FOUND"] = "NOTIFICATION_NOT_FOUND";
|
|
9
|
+
ErrorCode["IPC_NOT_REGISTERED"] = "IPC_NOT_REGISTERED";
|
|
10
|
+
ErrorCode["MANAGER_DESTROYED"] = "MANAGER_DESTROYED";
|
|
11
|
+
ErrorCode["INVALID_OPTIONS"] = "INVALID_OPTIONS";
|
|
12
|
+
ErrorCode["POSITION_CALCULATION_FAILED"] = "POSITION_CALCULATION_FAILED";
|
|
13
|
+
})(ErrorCode || (exports.ErrorCode = ErrorCode = {}));
|
|
14
|
+
class NotificationError extends Error {
|
|
15
|
+
constructor(message, code) {
|
|
16
|
+
super(message);
|
|
17
|
+
this.name = 'NotificationError';
|
|
18
|
+
this.code = code;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.NotificationError = NotificationError;
|
|
22
|
+
class WindowCreationError extends NotificationError {
|
|
23
|
+
constructor(message) {
|
|
24
|
+
super(message, ErrorCode.WINDOW_CREATION_FAILED);
|
|
25
|
+
this.name = 'WindowCreationError';
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.WindowCreationError = WindowCreationError;
|
|
29
|
+
class PositionCalculationError extends NotificationError {
|
|
30
|
+
constructor(message) {
|
|
31
|
+
super(message, ErrorCode.POSITION_CALCULATION_FAILED);
|
|
32
|
+
this.name = 'PositionCalculationError';
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.PositionCalculationError = PositionCalculationError;
|
|
36
|
+
class IpcRegistrationError extends NotificationError {
|
|
37
|
+
constructor(message) {
|
|
38
|
+
super(message, ErrorCode.IPC_NOT_REGISTERED);
|
|
39
|
+
this.name = 'IpcRegistrationError';
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.IpcRegistrationError = IpcRegistrationError;
|
|
43
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":";;;AAAA,IAAY,SAQX;AARD,WAAY,SAAS;IACnB,8DAAiD,CAAA;IACjD,kDAAqC,CAAA;IACrC,8DAAiD,CAAA;IACjD,sDAAyC,CAAA;IACzC,oDAAuC,CAAA;IACvC,gDAAmC,CAAA;IACnC,wEAA2D,CAAA;AAC7D,CAAC,EARW,SAAS,yBAAT,SAAS,QAQpB;AAED,MAAa,iBAAkB,SAAQ,KAAK;IAG1C,YAAmB,OAAe,EAAE,IAAe;QACjD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;QAChC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AARD,8CAQC;AAED,MAAa,mBAAoB,SAAQ,iBAAiB;IACxD,YAAmB,OAAe;QAChC,KAAK,CAAC,OAAO,EAAE,SAAS,CAAC,sBAAsB,CAAC,CAAC;QACjD,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACpC,CAAC;CACF;AALD,kDAKC;AAED,MAAa,wBAAyB,SAAQ,iBAAiB;IAC7D,YAAmB,OAAe;QAChC,KAAK,CAAC,OAAO,EAAE,SAAS,CAAC,2BAA2B,CAAC,CAAC;QACtD,IAAI,CAAC,IAAI,GAAG,0BAA0B,CAAC;IACzC,CAAC;CACF;AALD,4DAKC;AAED,MAAa,oBAAqB,SAAQ,iBAAiB;IACzD,YAAmB,OAAe;QAChC,KAAK,CAAC,OAAO,EAAE,SAAS,CAAC,kBAAkB,CAAC,CAAC;QAC7C,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;IACrC,CAAC;CACF;AALD,oDAKC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const IPC_CHANNELS: {
|
|
2
|
+
readonly NOTIFICATION_CLOSE: "notification:close";
|
|
3
|
+
readonly NOTIFICATION_CLICK: "notification:click";
|
|
4
|
+
readonly NOTIFICATION_REPOSITION: "notification:reposition";
|
|
5
|
+
readonly NOTIFICATION_READY: "notification:ready";
|
|
6
|
+
readonly NOTIFICATION_UPDATE: "notification:update";
|
|
7
|
+
};
|
|
8
|
+
export type IpcChannel = (typeof IPC_CHANNELS)[keyof typeof IPC_CHANNELS];
|
|
9
|
+
//# sourceMappingURL=IpcChannels.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IpcChannels.d.ts","sourceRoot":"","sources":["../../../src/ipc/IpcChannels.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY;;;;;;CAMf,CAAC;AAEX,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,OAAO,YAAY,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IPC_CHANNELS = void 0;
|
|
4
|
+
exports.IPC_CHANNELS = {
|
|
5
|
+
NOTIFICATION_CLOSE: 'notification:close',
|
|
6
|
+
NOTIFICATION_CLICK: 'notification:click',
|
|
7
|
+
NOTIFICATION_REPOSITION: 'notification:reposition',
|
|
8
|
+
NOTIFICATION_READY: 'notification:ready',
|
|
9
|
+
NOTIFICATION_UPDATE: 'notification:update',
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=IpcChannels.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IpcChannels.js","sourceRoot":"","sources":["../../../src/ipc/IpcChannels.ts"],"names":[],"mappings":";;;AAAa,QAAA,YAAY,GAAG;IAC1B,kBAAkB,EAAE,oBAAoB;IACxC,kBAAkB,EAAE,oBAAoB;IACxC,uBAAuB,EAAE,yBAAyB;IAClD,kBAAkB,EAAE,oBAAoB;IACxC,mBAAmB,EAAE,qBAAqB;CAClC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { NotificationPosition, PositionCoords, WorkArea } from '../types/position.types';
|
|
2
|
+
export interface PositionConfig {
|
|
3
|
+
position: NotificationPosition;
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
margin: number;
|
|
7
|
+
gap: number;
|
|
8
|
+
workArea: WorkArea;
|
|
9
|
+
indexTopToBottom: number;
|
|
10
|
+
count: number;
|
|
11
|
+
}
|
|
12
|
+
export interface PositionStrategy {
|
|
13
|
+
calculateX(config: PositionConfig): number;
|
|
14
|
+
calculateY(config: PositionConfig): number;
|
|
15
|
+
}
|
|
16
|
+
export declare class PositionCalculator {
|
|
17
|
+
private readonly strategies;
|
|
18
|
+
constructor();
|
|
19
|
+
calculate(config: PositionConfig): PositionCoords;
|
|
20
|
+
isTopStack(position: NotificationPosition): boolean;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=PositionCalculator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PositionCalculator.d.ts","sourceRoot":"","sources":["../../../src/position/PositionCalculator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAE9F,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,oBAAoB,CAAC;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,QAAQ,CAAC;IACnB,gBAAgB,EAAE,MAAM,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,gBAAgB;IAC/B,UAAU,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,CAAC;IAC3C,UAAU,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,CAAC;CAC5C;AAkDD,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAsD;;IAgB1E,SAAS,CAAC,MAAM,EAAE,cAAc,GAAG,cAAc;IAkBjD,UAAU,CAAC,QAAQ,EAAE,oBAAoB,GAAG,OAAO;CAG3D"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PositionCalculator = void 0;
|
|
4
|
+
const errors_1 = require("../errors");
|
|
5
|
+
function isTop(position) {
|
|
6
|
+
return position.startsWith('top');
|
|
7
|
+
}
|
|
8
|
+
function isLeft(position) {
|
|
9
|
+
return position.endsWith('Left');
|
|
10
|
+
}
|
|
11
|
+
function isCenter(position) {
|
|
12
|
+
return position.endsWith('Center');
|
|
13
|
+
}
|
|
14
|
+
function isRight(position) {
|
|
15
|
+
return position.endsWith('Right');
|
|
16
|
+
}
|
|
17
|
+
class BaseStrategy {
|
|
18
|
+
calculateX(config) {
|
|
19
|
+
if (isLeft(config.position))
|
|
20
|
+
return config.workArea.x + config.margin;
|
|
21
|
+
if (isCenter(config.position)) {
|
|
22
|
+
return config.workArea.x + Math.round((config.workArea.width - config.width) / 2);
|
|
23
|
+
}
|
|
24
|
+
if (isRight(config.position))
|
|
25
|
+
return config.workArea.x + config.workArea.width - config.margin - config.width;
|
|
26
|
+
throw new errors_1.NotificationError(`Invalid position: ${String(config.position)}`, errors_1.ErrorCode.INVALID_POSITION);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
class TopStrategy extends BaseStrategy {
|
|
30
|
+
calculateY(config) {
|
|
31
|
+
return config.workArea.y + config.margin + config.indexTopToBottom * (config.height + config.gap);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
class BottomStrategy extends BaseStrategy {
|
|
35
|
+
calculateY(config) {
|
|
36
|
+
const bottomAnchoredIndex = (config.count - 1) - config.indexTopToBottom;
|
|
37
|
+
return (config.workArea.y +
|
|
38
|
+
config.workArea.height -
|
|
39
|
+
config.margin -
|
|
40
|
+
config.height -
|
|
41
|
+
bottomAnchoredIndex * (config.height + config.gap));
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
class PositionCalculator {
|
|
45
|
+
constructor() {
|
|
46
|
+
const top = new TopStrategy();
|
|
47
|
+
const bottom = new BottomStrategy();
|
|
48
|
+
this.strategies = new Map([
|
|
49
|
+
['topLeft', top],
|
|
50
|
+
['topCenter', top],
|
|
51
|
+
['topRight', top],
|
|
52
|
+
['bottomLeft', bottom],
|
|
53
|
+
['bottomCenter', bottom],
|
|
54
|
+
['bottomRight', bottom],
|
|
55
|
+
]);
|
|
56
|
+
}
|
|
57
|
+
calculate(config) {
|
|
58
|
+
const strategy = this.strategies.get(config.position);
|
|
59
|
+
if (!strategy) {
|
|
60
|
+
throw new errors_1.NotificationError(`Invalid position: ${String(config.position)}`, errors_1.ErrorCode.INVALID_POSITION);
|
|
61
|
+
}
|
|
62
|
+
if (config.count <= 0) {
|
|
63
|
+
throw new errors_1.NotificationError('count must be > 0', errors_1.ErrorCode.POSITION_CALCULATION_FAILED);
|
|
64
|
+
}
|
|
65
|
+
if (config.indexTopToBottom < 0 || config.indexTopToBottom >= config.count) {
|
|
66
|
+
throw new errors_1.NotificationError('indexTopToBottom out of range', errors_1.ErrorCode.POSITION_CALCULATION_FAILED);
|
|
67
|
+
}
|
|
68
|
+
const x = strategy.calculateX(config);
|
|
69
|
+
const y = strategy.calculateY(config);
|
|
70
|
+
return { x: Math.round(x), y: Math.round(y) };
|
|
71
|
+
}
|
|
72
|
+
isTopStack(position) {
|
|
73
|
+
return isTop(position);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
exports.PositionCalculator = PositionCalculator;
|
|
77
|
+
//# sourceMappingURL=PositionCalculator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PositionCalculator.js","sourceRoot":"","sources":["../../../src/position/PositionCalculator.ts"],"names":[],"mappings":";;;AAAA,sCAAyD;AAmBzD,SAAS,KAAK,CAAC,QAA8B;IAC3C,OAAO,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;AACpC,CAAC;AAED,SAAS,MAAM,CAAC,QAA8B;IAC5C,OAAO,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AACnC,CAAC;AAED,SAAS,QAAQ,CAAC,QAA8B;IAC9C,OAAO,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AACrC,CAAC;AAED,SAAS,OAAO,CAAC,QAA8B;IAC7C,OAAO,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;AACpC,CAAC;AAED,MAAe,YAAY;IAClB,UAAU,CAAC,MAAsB;QACtC,IAAI,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC;YAAE,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC;QACtE,IAAI,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC9B,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;QACpF,CAAC;QACD,IAAI,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC;YAAE,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,GAAG,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC;QAC9G,MAAM,IAAI,0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AU,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QACtD,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,IAAI,0BAAiB,CAAC,qBAAqB,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,EAAE,kBAAS,CAAC,gBAAgB,CAAC,CAAC;QAC1G,CAAC;QAED,IAAI,MAAM,CAAC,KAAK,IAAI,CAAC,EAAE,CAAC;YACtB,MAAM,IAAI,0BAAiB,CAAC,mBAAmB,EAAE,kBAAS,CAAC,2BAA2B,CAAC,CAAC;QAC1F,CAAC;QACD,IAAI,MAAM,CAAC,gBAAgB,GAAG,CAAC,IAAI,MAAM,CAAC,gBAAgB,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;YAC3E,MAAM,IAAI,0BAAiB,CAAC,+BAA+B,EAAE,kBAAS,CAAC,2BAA2B,CAAC,CAAC;QACtG,CAAC;QAED,MAAM,CAAC,GAAG,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QACtC,MAAM,CAAC,GAAG,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QACtC,OAAO,EAAE,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;IAChD,CAAC;IAEM,UAAU,CAAC,QAA8B;QAC9C,OAAO,KAAK,CAAC,QAAQ,CAAC,CAAC;IACzB,CAAC;CACF;AAtCD,gDAsCC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { NotificationPosition, PositionCoords } from './types';
|
|
2
|
+
export declare function getBaseX(position: NotificationPosition, width: number, screenWidth: number, margin: number): number;
|
|
3
|
+
export declare function getYForIndex(position: NotificationPosition, index: number, height: number, gap: number, margin: number, screenHeight: number): number;
|
|
4
|
+
export declare function calculateCoordsInWorkArea(args: {
|
|
5
|
+
workArea: {
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
};
|
|
11
|
+
position: NotificationPosition;
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
14
|
+
margin: number;
|
|
15
|
+
gap: number;
|
|
16
|
+
indexTopToBottom: number;
|
|
17
|
+
count: number;
|
|
18
|
+
}): PositionCoords;
|
|
19
|
+
//# sourceMappingURL=positionCalculator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"positionCalculator.d.ts","sourceRoot":"","sources":["../../src/positionCalculator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAepE,wBAAgB,QAAQ,CACtB,QAAQ,EAAE,oBAAoB,EAC9B,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,MAAM,GACb,MAAM,CAKR;AAED,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,oBAAoB,EAC9B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,MAAM,GACnB,MAAM,CAWR;AAED,wBAAgB,yBAAyB,CAAC,IAAI,EAAE;IAC9C,QAAQ,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAClE,QAAQ,EAAE,oBAAoB,CAAC;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,gBAAgB,EAAE,MAAM,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;CACf,GAAG,cAAc,CAiBjB"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getBaseX = getBaseX;
|
|
4
|
+
exports.getYForIndex = getYForIndex;
|
|
5
|
+
exports.calculateCoordsInWorkArea = calculateCoordsInWorkArea;
|
|
6
|
+
function parsePosition(position) {
|
|
7
|
+
const vertical = position.startsWith('top') ? 'top' : 'bottom';
|
|
8
|
+
const horizontal = position.endsWith('Left')
|
|
9
|
+
? 'left'
|
|
10
|
+
: position.endsWith('Center')
|
|
11
|
+
? 'center'
|
|
12
|
+
: 'right';
|
|
13
|
+
return { vertical, horizontal };
|
|
14
|
+
}
|
|
15
|
+
function getBaseX(position, width, screenWidth, margin) {
|
|
16
|
+
const { horizontal } = parsePosition(position);
|
|
17
|
+
if (horizontal === 'left')
|
|
18
|
+
return margin;
|
|
19
|
+
if (horizontal === 'center')
|
|
20
|
+
return Math.round((screenWidth - width) / 2);
|
|
21
|
+
return screenWidth - margin - width;
|
|
22
|
+
}
|
|
23
|
+
function getYForIndex(position, index, height, gap, margin, screenHeight) {
|
|
24
|
+
const { vertical } = parsePosition(position);
|
|
25
|
+
if (vertical === 'top') {
|
|
26
|
+
return margin + index * (height + gap);
|
|
27
|
+
}
|
|
28
|
+
// Bottom stack. Here `index` is top->bottom; the bottom-most item is anchored to the bottom margin.
|
|
29
|
+
// We need the caller to pass the stackCount to compute absolute bottom anchoring, so we encode
|
|
30
|
+
// the bottom anchoring in the manager when iterating.
|
|
31
|
+
// This function is used with an index that is already bottom-anchored (0 = bottom-most).
|
|
32
|
+
return screenHeight - margin - height - index * (height + gap);
|
|
33
|
+
}
|
|
34
|
+
function calculateCoordsInWorkArea(args) {
|
|
35
|
+
const { workArea, position, width, height, margin, gap, indexTopToBottom, count } = args;
|
|
36
|
+
const { vertical } = parsePosition(position);
|
|
37
|
+
const baseX = getBaseX(position, width, workArea.width, margin);
|
|
38
|
+
const x = workArea.x + baseX;
|
|
39
|
+
let y;
|
|
40
|
+
if (vertical === 'top') {
|
|
41
|
+
y = workArea.y + getYForIndex(position, indexTopToBottom, height, gap, margin, workArea.height);
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
// bottom-most is anchored; convert top->bottom index to bottom-anchored index
|
|
45
|
+
const bottomAnchoredIndex = (count - 1) - indexTopToBottom;
|
|
46
|
+
y = workArea.y + getYForIndex(position, bottomAnchoredIndex, height, gap, margin, workArea.height);
|
|
47
|
+
}
|
|
48
|
+
return { x: Math.round(x), y: Math.round(y) };
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=positionCalculator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"positionCalculator.js","sourceRoot":"","sources":["../../src/positionCalculator.ts"],"names":[],"mappings":";;AAeA,4BAUC;AAED,oCAkBC;AAED,8DA0BC;AApED,SAAS,aAAa,CAAC,QAA8B;IACnD,MAAM,QAAQ,GAAa,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC;IACzE,MAAM,UAAU,GAAe,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC;QACtD,CAAC,CAAC,MAAM;QACR,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC;YAC3B,CAAC,CAAC,QAAQ;YACV,CAAC,CAAC,OAAO,CAAC;IACd,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC;AAClC,CAAC;AAED,SAAgB,QAAQ,CACtB,QAA8B,EAC9B,KAAa,EACb,WAAmB,EACnB,MAAc;IAEd,MAAM,EAAE,UAAU,EAAE,GAAG,aAAa,CAAC,QAAQ,CAAC,CAAC;IAC/C,IAAI,UAAU,KAAK,MAAM;QAAE,OAAO,MAAM,CAAC;IACzC,IAAI,UAAU,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,WAAW,GAAG,KAAK,CAAC,GAAG,CAAC,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G,CAAC,CAAC,GAAG,gBAAgB,CAAC;QAC3D,CAAC,GAAG,QAAQ,CAAC,CAAC,GAAG,YAAY,CAAC,QAAQ,EAAE,mBAAmB,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IACrG,CAAC;IAED,OAAO,EAAE,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;AAChD,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { NotificationPosition } from './position.types';
|
|
2
|
+
export interface NotificationManagerOptions {
|
|
3
|
+
position?: NotificationPosition;
|
|
4
|
+
width?: number;
|
|
5
|
+
height?: number;
|
|
6
|
+
margin?: number;
|
|
7
|
+
gap?: number;
|
|
8
|
+
debug?: boolean;
|
|
9
|
+
maxVisible?: number;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=config.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.types.d.ts","sourceRoot":"","sources":["../../../src/types/config.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAE7D,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,EAAE,oBAAoB,CAAC;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.types.js","sourceRoot":"","sources":["../../../src/types/config.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type { NotificationManagerOptions } from './config.types';
|
|
2
|
+
export type { NotificationOptions, NotificationItem, CloseReason } from './notification.types';
|
|
3
|
+
export type { NotificationPosition, PositionCoords, WorkArea } from './position.types';
|
|
4
|
+
export type { RepositionPayload, IpcNotificationConfig } from './ipc.types';
|
|
5
|
+
export type { NotificationVariant, ThemeMode } from './theme.types';
|
|
6
|
+
import type { NotificationManagerOptions } from './config.types';
|
|
7
|
+
export type RequiredManagerOptions = Required<NotificationManagerOptions>;
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AACjE,YAAY,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAC/F,YAAY,EAAE,oBAAoB,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACvF,YAAY,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAC5E,YAAY,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACpE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AAEjE,MAAM,MAAM,sBAAsB,GAAG,QAAQ,CAAC,0BAA0B,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface RepositionPayload {
|
|
2
|
+
id: string;
|
|
3
|
+
y: number;
|
|
4
|
+
}
|
|
5
|
+
export interface IpcNotificationConfig {
|
|
6
|
+
id: string;
|
|
7
|
+
title: string;
|
|
8
|
+
description: string;
|
|
9
|
+
image: string | null;
|
|
10
|
+
duration: number;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=ipc.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ipc.types.d.ts","sourceRoot":"","sources":["../../../src/types/ipc.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,CAAC,EAAE,MAAM,CAAC;CACX;AAED,MAAM,WAAW,qBAAqB;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;CAClB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ipc.types.js","sourceRoot":"","sources":["../../../src/types/ipc.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { BrowserWindow } from 'electron';
|
|
2
|
+
import type { NotificationVariant, ThemeMode } from './theme.types';
|
|
3
|
+
export interface NotificationOptions {
|
|
4
|
+
title: string;
|
|
5
|
+
description: string;
|
|
6
|
+
image?: string;
|
|
7
|
+
duration?: number;
|
|
8
|
+
variant?: NotificationVariant;
|
|
9
|
+
theme?: ThemeMode;
|
|
10
|
+
progress?: number;
|
|
11
|
+
progressLabel?: string;
|
|
12
|
+
loadingText?: string;
|
|
13
|
+
onClick?: () => void;
|
|
14
|
+
onClose?: () => void;
|
|
15
|
+
}
|
|
16
|
+
export type CloseReason = 'duration' | 'user' | 'programmatic' | 'app-quit';
|
|
17
|
+
export interface NotificationItem {
|
|
18
|
+
id: string;
|
|
19
|
+
window: BrowserWindow;
|
|
20
|
+
options: NotificationOptions;
|
|
21
|
+
timer: NodeJS.Timeout | null;
|
|
22
|
+
}
|
|
23
|
+
export interface NotificationUpdatePayload {
|
|
24
|
+
progress?: number;
|
|
25
|
+
loadingText?: string;
|
|
26
|
+
description?: string;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=notification.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notification.types.d.ts","sourceRoot":"","sources":["../../../src/types/notification.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,KAAK,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAEpE,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,mBAAmB,CAAC;IAC9B,KAAK,CAAC,EAAE,SAAS,CAAC;IAGlB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IAGvB,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,MAAM,MAAM,WAAW,GAAG,UAAU,GAAG,MAAM,GAAG,cAAc,GAAG,UAAU,CAAC;AAE5E,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,aAAa,CAAC;IACtB,OAAO,EAAE,mBAAmB,CAAC;IAC7B,KAAK,EAAE,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC;CAC9B;AAED,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notification.types.js","sourceRoot":"","sources":["../../../src/types/notification.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type NotificationPosition = 'topLeft' | 'topCenter' | 'topRight' | 'bottomLeft' | 'bottomCenter' | 'bottomRight';
|
|
2
|
+
export interface PositionCoords {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
}
|
|
6
|
+
export interface WorkArea {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=position.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"position.types.d.ts","sourceRoot":"","sources":["../../../src/types/position.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,oBAAoB,GAC5B,SAAS,GACT,WAAW,GACX,UAAU,GACV,YAAY,GACZ,cAAc,GACd,aAAa,CAAC;AAElB,MAAM,WAAW,cAAc;IAC7B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED,MAAM,WAAW,QAAQ;IACvB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"position.types.js","sourceRoot":"","sources":["../../../src/types/position.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type ThemeMode = 'dark' | 'light' | 'auto';
|
|
2
|
+
export type NotificationVariant = 'default' | 'success' | 'error' | 'warning' | 'loading' | 'progress';
|
|
3
|
+
export interface NotificationUpdatePayload {
|
|
4
|
+
progress?: number;
|
|
5
|
+
loadingText?: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=theme.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.types.d.ts","sourceRoot":"","sources":["../../../src/types/theme.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;AAElD,MAAM,MAAM,mBAAmB,GAC3B,SAAS,GACT,SAAS,GACT,OAAO,GACP,SAAS,GACT,SAAS,GACT,UAAU,CAAC;AAEf,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.types.js","sourceRoot":"","sources":["../../../src/types/theme.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"idGenerator.d.ts","sourceRoot":"","sources":["../../../src/utils/idGenerator.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,WAAW;IAC1B,IAAI,IAAI,MAAM,CAAC;CAChB;AAED,qBAAa,iBAAkB,YAAW,WAAW;IAC5C,IAAI,IAAI,MAAM;CAItB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.CryptoIdGenerator = void 0;
|
|
7
|
+
const crypto_1 = __importDefault(require("crypto"));
|
|
8
|
+
class CryptoIdGenerator {
|
|
9
|
+
next() {
|
|
10
|
+
if (typeof crypto_1.default.randomUUID === 'function')
|
|
11
|
+
return crypto_1.default.randomUUID();
|
|
12
|
+
return crypto_1.default.randomBytes(16).toString('hex');
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.CryptoIdGenerator = CryptoIdGenerator;
|
|
16
|
+
//# sourceMappingURL=idGenerator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"idGenerator.js","sourceRoot":"","sources":["../../../src/utils/idGenerator.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAM5B,MAAa,iBAAiB;IACrB,IAAI;QACT,IAAI,OAAO,gBAAM,CAAC,UAAU,KAAK,UAAU;YAAE,OAAO,gBAAM,CAAC,UAAU,EAAE,CAAC;QACxE,OAAO,gBAAM,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAChD,CAAC;CACF;AALD,8CAKC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { NotificationError } from '../errors';
|
|
2
|
+
export declare class Logger {
|
|
3
|
+
private readonly prefix;
|
|
4
|
+
private enabled;
|
|
5
|
+
constructor(debug?: boolean);
|
|
6
|
+
setEnabled(enabled: boolean): void;
|
|
7
|
+
info(message: string, ...args: readonly unknown[]): void;
|
|
8
|
+
warn(message: string, ...args: readonly unknown[]): void;
|
|
9
|
+
debug(message: string, ...args: readonly unknown[]): void;
|
|
10
|
+
error(message: string, error?: Error | NotificationError): void;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../src/utils/logger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAEnD,qBAAa,MAAM;IACjB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA+B;IACtD,OAAO,CAAC,OAAO,CAAU;gBAEN,KAAK,UAAQ;IAIzB,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAIlC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,SAAS,OAAO,EAAE,GAAG,IAAI;IAMxD,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,SAAS,OAAO,EAAE,GAAG,IAAI;IAMxD,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,SAAS,OAAO,EAAE,GAAG,IAAI;IAMzD,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK,GAAG,iBAAiB,GAAG,IAAI;CAKvE"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Logger = void 0;
|
|
4
|
+
class Logger {
|
|
5
|
+
constructor(debug = false) {
|
|
6
|
+
this.prefix = '[electron-notify-manager]';
|
|
7
|
+
this.enabled = debug;
|
|
8
|
+
}
|
|
9
|
+
setEnabled(enabled) {
|
|
10
|
+
this.enabled = enabled;
|
|
11
|
+
}
|
|
12
|
+
info(message, ...args) {
|
|
13
|
+
if (!this.enabled)
|
|
14
|
+
return;
|
|
15
|
+
// eslint-disable-next-line no-console
|
|
16
|
+
console.log(this.prefix, message, ...args);
|
|
17
|
+
}
|
|
18
|
+
warn(message, ...args) {
|
|
19
|
+
if (!this.enabled)
|
|
20
|
+
return;
|
|
21
|
+
// eslint-disable-next-line no-console
|
|
22
|
+
console.warn(this.prefix, message, ...args);
|
|
23
|
+
}
|
|
24
|
+
debug(message, ...args) {
|
|
25
|
+
if (!this.enabled)
|
|
26
|
+
return;
|
|
27
|
+
// eslint-disable-next-line no-console
|
|
28
|
+
console.debug(this.prefix, message, ...args);
|
|
29
|
+
}
|
|
30
|
+
error(message, error) {
|
|
31
|
+
if (!this.enabled)
|
|
32
|
+
return;
|
|
33
|
+
// eslint-disable-next-line no-console
|
|
34
|
+
console.error(this.prefix, message, error);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.Logger = Logger;
|
|
38
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../src/utils/logger.ts"],"names":[],"mappings":";;;AAEA,MAAa,MAAM;IAIjB,YAAmB,KAAK,GAAG,KAAK;QAHf,WAAM,GAAG,2BAA2B,CAAC;QAIpD,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;IACvB,CAAC;IAEM,UAAU,CAAC,OAAgB;QAChC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAEM,IAAI,CAAC,OAAe,EAAE,GAAG,IAAwB;QACtD,IAAI,CAAC,IAAI,CAAC,OAAO;YAAE,OAAO;QAC1B,sCAAsC;QACtC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;IAC7C,CAAC;IAEM,IAAI,CAAC,OAAe,EAAE,GAAG,IAAwB;QACtD,IAAI,CAAC,IAAI,CAAC,OAAO;YAAE,OAAO;QAC1B,sCAAsC;QACtC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;IAC9C,CAAC;IAEM,KAAK,CAAC,OAAe,EAAE,GAAG,IAAwB;QACvD,IAAI,CAAC,IAAI,CAAC,OAAO;YAAE,OAAO;QAC1B,sCAAsC;QACtC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;IAC/C,CAAC;IAEM,KAAK,CAAC,OAAe,EAAE,KAAiC;QAC7D,IAAI,CAAC,IAAI,CAAC,OAAO;YAAE,OAAO;QAC1B,sCAAsC;QACtC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;IAC7C,CAAC;CACF;AAnCD,wBAmCC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"themeDetector.d.ts","sourceRoot":"","sources":["../../../src/utils/themeDetector.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEtD,wBAAgB,YAAY,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM,GAAG,OAAO,CAKnE"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveTheme = resolveTheme;
|
|
4
|
+
const electron_1 = require("electron");
|
|
5
|
+
function resolveTheme(requested) {
|
|
6
|
+
if (requested === 'auto') {
|
|
7
|
+
return electron_1.nativeTheme.shouldUseDarkColors ? 'dark' : 'light';
|
|
8
|
+
}
|
|
9
|
+
return requested;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=themeDetector.js.map
|