@vokril/ui-solid 0.28.0 → 0.29.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/CHANGELOG.md +10 -0
- package/README.md +21 -4
- package/dist/{StatusBarNotificationBell-yryWdwyX.js → StatusBarNotificationBell-7Izs_msz.js} +4083 -4058
- package/dist/StatusBarNotificationBell-BJiORN4s.cjs +50 -0
- package/dist/_internal/contract/notification.d.cts +4 -3
- package/dist/_internal/contract/notification.d.ts +4 -3
- package/dist/index.cjs +1 -1
- package/dist/index.js +153 -152
- package/dist/notifications/NotificationItem.d.cts +3 -3
- package/dist/notifications/NotificationItem.d.ts +3 -3
- package/dist/notifications/StatusBarNotificationBell.d.cts +18 -6
- package/dist/notifications/StatusBarNotificationBell.d.ts +18 -6
- package/dist/notifications/dismissableToastIds.d.cts +2 -1
- package/dist/notifications/dismissableToastIds.d.ts +2 -1
- package/dist/notifications/index.cjs +1 -1
- package/dist/notifications/index.js +41 -40
- package/dist/notifications/nativeEngine.d.cts +50 -13
- package/dist/notifications/nativeEngine.d.ts +50 -13
- package/dist/notifications/notificationCardServices.d.cts +2 -1
- package/dist/notifications/notificationCardServices.d.ts +2 -1
- package/dist/notifications/notificationCommands.d.cts +3 -3
- package/dist/notifications/notificationCommands.d.ts +3 -3
- package/dist/notifications/notificationService.d.cts +10 -1
- package/dist/notifications/notificationService.d.ts +10 -1
- package/dist/server/{StatusBarNotificationBell-DdAdsduo.js → StatusBarNotificationBell-D8Jt3PXI.js} +3885 -3860
- package/dist/server/StatusBarNotificationBell-LJHLMT9F.cjs +49 -0
- package/dist/server/index.cjs +1 -1
- package/dist/server/index.js +138 -137
- package/dist/server/notifications/index.cjs +1 -1
- package/dist/server/notifications/index.js +41 -40
- package/dist/solid/notifications/NotificationHost.jsx +1 -11
- package/dist/solid/notifications/StatusBarNotificationBell.jsx +14 -17
- package/dist/solid/notifications/nativeEngine.js +51 -11
- package/dist/solid/notifications/notificationService.js +2 -0
- package/dist/style.css +1 -1
- package/dist/ui.css +1 -1
- package/package.json +1 -1
- package/dist/StatusBarNotificationBell-CJ3HuhRu.cjs +0 -50
- package/dist/server/StatusBarNotificationBell-Z2LmIkM1.cjs +0 -49
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
import { d as
|
|
3
|
-
import { n as
|
|
1
|
+
import { A as s, C as a, H as t, L as o, N as r, a as n, b as c, c as l, d as N, e as I, f as S, g as f, h as T, S as d, i as m, j as u, k as O, l as p, m as A, n as C, o as R, p as g, q as E, r as v, s as _, t as y, u as h, v as F, w as P, x, y as k, z as D, B as K, D as b, E as H, F as M, G as U, I as W, J as L, K as V, M as Y, O as w, P as B, Q, R as J, T as j, U as q, V as z, W as G, X, Y as Z, Z as $, _ as ii, $ as ei, a0 as si, a1 as ai, a2 as ti, a3 as oi, a4 as ri, a5 as ni, a6 as ci, a7 as li } from "../StatusBarNotificationBell-D8Jt3PXI.js";
|
|
2
|
+
import { d as Ii, a as Si } from "../mainRealmDom-DPNaDWtw.js";
|
|
3
|
+
import { n as Ti } from "../useSettingsSubscription-DLEk4k4j.js";
|
|
4
4
|
export {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
s as ACCEPT_PRIMARY_ACTION_NOTIFICATION,
|
|
6
|
+
a as CLEAR_NOTIFICATION,
|
|
7
7
|
t as HIDE_NOTIFICATION_TOASTS,
|
|
8
8
|
o as LogFilterBar,
|
|
9
9
|
r as NOTIFICATION_SOURCES,
|
|
@@ -15,20 +15,20 @@ export {
|
|
|
15
15
|
S as NotificationService,
|
|
16
16
|
f as NotificationTimeline,
|
|
17
17
|
T as NotificationsCenter,
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
d as SEVERITY_ORDER,
|
|
19
|
+
m as SEVERITY_TONES,
|
|
20
20
|
u as StatusBarNotificationBell,
|
|
21
21
|
O as appWindowNotificationOverlay,
|
|
22
22
|
p as applyNotificationRules,
|
|
23
23
|
A as clearCompiledRuleRegexCache,
|
|
24
24
|
C as compileNotificationSearchMatcher,
|
|
25
25
|
R as createNativeNotificationEngine,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
g as createNotificationPreviewRuntime,
|
|
27
|
+
E as decideFilter,
|
|
28
|
+
Ii as defineNotification,
|
|
29
|
+
Si as defineNotificationScenario,
|
|
30
|
+
v as deleteWebhookUrl,
|
|
31
|
+
_ as deriveImplicitRemindKey,
|
|
32
32
|
y as dismissKey,
|
|
33
33
|
h as dismissableToastIds,
|
|
34
34
|
F as entryVendorMatch,
|
|
@@ -38,32 +38,33 @@ export {
|
|
|
38
38
|
D as getSmtpPass,
|
|
39
39
|
K as getWebhookUrl,
|
|
40
40
|
b as groupTimelineEntries,
|
|
41
|
-
H as
|
|
42
|
-
M as
|
|
43
|
-
U as
|
|
44
|
-
W as
|
|
45
|
-
L as
|
|
46
|
-
V as
|
|
47
|
-
Y as
|
|
48
|
-
w as
|
|
49
|
-
B as
|
|
50
|
-
Q as
|
|
51
|
-
J as
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
q as
|
|
55
|
-
z as
|
|
56
|
-
G as
|
|
57
|
-
X as
|
|
58
|
-
Z as
|
|
59
|
-
$ as
|
|
60
|
-
ii as
|
|
61
|
-
ei as
|
|
41
|
+
H as hiddenRunningProgress,
|
|
42
|
+
M as isInQuietHours,
|
|
43
|
+
U as isKeyDismissed,
|
|
44
|
+
W as isKeyRemindSuppressed,
|
|
45
|
+
L as isNotificationSourceId,
|
|
46
|
+
V as isNotificationSticky,
|
|
47
|
+
Y as isOnToastStack,
|
|
48
|
+
w as isProgressRunning,
|
|
49
|
+
B as isSourceMuted,
|
|
50
|
+
Q as isSpamDropHandle,
|
|
51
|
+
J as listNotificationSources,
|
|
52
|
+
j as nextQuietHoursStart,
|
|
53
|
+
Ti as notificationSettings,
|
|
54
|
+
q as pruneOrphanWebhookSecrets,
|
|
55
|
+
z as registerFenceAliases,
|
|
56
|
+
G as registerNotificationCommands,
|
|
57
|
+
X as remindLater,
|
|
58
|
+
Z as resolveCatalogPreviewPriority,
|
|
59
|
+
$ as resolveNotificationDuration,
|
|
60
|
+
ii as resolveNotificationSource,
|
|
61
|
+
ei as resolveSeverityTone,
|
|
62
|
+
si as restoreAllKeys,
|
|
62
63
|
ai as restoreKey,
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
64
|
+
ti as setSmtpPass,
|
|
65
|
+
oi as setSourceMuted,
|
|
66
|
+
ri as setWebhookUrl,
|
|
67
|
+
ni as shouldFireOsNative,
|
|
68
|
+
ci as toTimelineActions,
|
|
69
|
+
li as unmuteAllSources
|
|
69
70
|
};
|
|
@@ -36,7 +36,6 @@ export const NotificationHost = (props) => {
|
|
|
36
36
|
const [position, setPosition] = createSignal(initial.toastPosition);
|
|
37
37
|
const effectivePosition = () => position();
|
|
38
38
|
const [width, setWidth] = createSignal(initial.notificationWidth);
|
|
39
|
-
const [maxVisible, setMaxVisible] = createSignal(initial.maxVisibleNotifications);
|
|
40
39
|
const [animationDuration, setAnimationDuration] = createSignal(initial.animationDuration);
|
|
41
40
|
const [reduceMotion, setReduceMotion] = createSignal(initial.reduceMotion);
|
|
42
41
|
const [hostEl, setHostEl] = createSignal();
|
|
@@ -45,13 +44,7 @@ export const NotificationHost = (props) => {
|
|
|
45
44
|
const controller = realmCardController(host, itemSettings);
|
|
46
45
|
const shell = realmNotificationShell(host);
|
|
47
46
|
const ackItems = () => store.items.filter((it) => it.priority === 'acknowledgment-required');
|
|
48
|
-
const visible = () =>
|
|
49
|
-
const cap = Math.max(1, maxVisible());
|
|
50
|
-
const items = store.items.filter(isOnToastStack);
|
|
51
|
-
if (items.length <= cap)
|
|
52
|
-
return items;
|
|
53
|
-
return items.slice(items.length - cap);
|
|
54
|
-
};
|
|
47
|
+
const visible = () => store.items.filter((item) => isOnToastStack(item) && item.outOfSightSince === undefined);
|
|
55
48
|
const currentAckItem = () => ackItems()[0] ?? null;
|
|
56
49
|
const isCenterOpen = () => props.centerOpen();
|
|
57
50
|
const handleSettingsChange = (detail) => {
|
|
@@ -63,9 +56,6 @@ export const NotificationHost = (props) => {
|
|
|
63
56
|
if (typeof detail.notificationWidth === 'number') {
|
|
64
57
|
setWidth(detail.notificationWidth);
|
|
65
58
|
}
|
|
66
|
-
if (typeof detail.maxVisibleNotifications === 'number') {
|
|
67
|
-
setMaxVisible(detail.maxVisibleNotifications);
|
|
68
|
-
}
|
|
69
59
|
if (detail.animationDuration === 'fast' ||
|
|
70
60
|
detail.animationDuration === 'normal' ||
|
|
71
61
|
detail.animationDuration === 'slow') {
|
|
@@ -1,49 +1,46 @@
|
|
|
1
|
-
import { Show, createSignal, onCleanup, onMount } from 'solid-js';
|
|
1
|
+
import { Show, createEffect, createSignal, on, onCleanup, onMount } from 'solid-js';
|
|
2
2
|
import { PressableSurface } from '../forms/PressableSurface';
|
|
3
3
|
import { VpBell, VpBellOff } from '@vokril/icons';
|
|
4
4
|
import { Popover } from '../overlay/popover/Popover';
|
|
5
5
|
import { NotificationsCenter } from './NotificationsCenter';
|
|
6
6
|
import { useKitHost } from '../host/kitHost';
|
|
7
|
-
import { useHostWindow } from '../_internal/app/windows/window/HostWindowContext';
|
|
8
7
|
import { notificationSettings } from '../_internal/app/settings/descriptors/notification';
|
|
9
8
|
import { useSettingsSubscription } from '../_internal/app/settings/useSettingsSubscription';
|
|
10
|
-
import {
|
|
11
|
-
import { useRunningProgressCards } from './RunningProgressCards';
|
|
9
|
+
import { hiddenRunningProgress } from './nativeEngine';
|
|
12
10
|
import { t } from '../i18n/i18n';
|
|
13
11
|
import styles from './StatusBarNotificationBell.module.css.js';
|
|
14
12
|
export function StatusBarNotificationBell(props) {
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
onCleanup(display.dispose);
|
|
19
|
-
const [open, setOpenSignal] = createSignal(false);
|
|
13
|
+
const { timeline, stack } = useKitHost().notifications;
|
|
14
|
+
const [ownOpen, setOwnOpen] = createSignal(false);
|
|
15
|
+
const open = () => props.open ?? ownOpen();
|
|
20
16
|
const [unread, setUnread] = createSignal(0);
|
|
21
17
|
const [dnd, setDnd] = createSignal(notificationSettings.get().doNotDisturb);
|
|
22
|
-
const [
|
|
23
|
-
const running = useRunningProgressCards();
|
|
18
|
+
const [outOfSight, setOutOfSight] = createSignal(0);
|
|
24
19
|
let buttonRef;
|
|
25
20
|
onMount(() => {
|
|
26
21
|
const unsubscribeUnread = timeline.subscribeUnread(setUnread);
|
|
27
|
-
const unsubscribeStack = stack.subscribe((items) =>
|
|
22
|
+
const unsubscribeStack = stack.subscribe((items) => setOutOfSight(hiddenRunningProgress(items).length));
|
|
28
23
|
onCleanup(() => {
|
|
29
24
|
unsubscribeUnread();
|
|
30
25
|
unsubscribeStack();
|
|
31
26
|
});
|
|
32
27
|
});
|
|
33
|
-
const toastsShown = () => stackHasToasts() && display.ownsDisplay();
|
|
34
28
|
useSettingsSubscription(notificationSettings, () => {
|
|
35
29
|
setDnd(notificationSettings.get().doNotDisturb);
|
|
36
30
|
});
|
|
37
31
|
const setOpen = (next) => {
|
|
38
32
|
if (next === open())
|
|
39
33
|
return;
|
|
40
|
-
if (
|
|
41
|
-
|
|
42
|
-
setOpenSignal(next);
|
|
34
|
+
if (props.open === undefined)
|
|
35
|
+
setOwnOpen(next);
|
|
43
36
|
props.onOpenChange?.(next);
|
|
44
37
|
};
|
|
38
|
+
createEffect(on(open, (isOpen) => {
|
|
39
|
+
if (isOpen)
|
|
40
|
+
timeline.markSeen();
|
|
41
|
+
}));
|
|
45
42
|
onCleanup(() => setOpen(false));
|
|
46
|
-
const inProgress = () => open()
|
|
43
|
+
const inProgress = () => (open() ? 0 : outOfSight());
|
|
47
44
|
const label = () => {
|
|
48
45
|
const count = inProgress();
|
|
49
46
|
if (dnd()) {
|
|
@@ -43,10 +43,26 @@ export function isProgressRunning(item) {
|
|
|
43
43
|
export function isOnToastStack(item) {
|
|
44
44
|
return item.priority !== 'acknowledgment-required' && item.hidden !== true;
|
|
45
45
|
}
|
|
46
|
+
export function hiddenRunningProgress(items) {
|
|
47
|
+
return items
|
|
48
|
+
.flatMap((item) => item.outOfSightSince !== undefined && isProgressRunning(item)
|
|
49
|
+
? [{ item, since: item.outOfSightSince }]
|
|
50
|
+
: [])
|
|
51
|
+
.reverse()
|
|
52
|
+
.sort((a, b) => b.since - a.since)
|
|
53
|
+
.map(({ item }) => item);
|
|
54
|
+
}
|
|
55
|
+
function withSight(item, since) {
|
|
56
|
+
if (since !== undefined)
|
|
57
|
+
return { ...item, outOfSightSince: since };
|
|
58
|
+
const { outOfSightSince: _inSight, ...card } = item;
|
|
59
|
+
return card;
|
|
60
|
+
}
|
|
46
61
|
export function createNativeNotificationEngine(dependencies) {
|
|
47
62
|
const { getSettings, warn } = dependencies;
|
|
48
63
|
const isSilenced = dependencies.isSilenced ?? (() => false);
|
|
49
64
|
const isTurnedDown = dependencies.isTurnedDown ?? (() => false);
|
|
65
|
+
const centerReachable = dependencies.centerReachable ?? (() => true);
|
|
50
66
|
const now = dependencies.now ?? (() => Date.now());
|
|
51
67
|
const setTimer = dependencies.setTimeout ??
|
|
52
68
|
((callback, timeoutMs) => window.setTimeout(callback, timeoutMs));
|
|
@@ -57,20 +73,37 @@ export function createNativeNotificationEngine(dependencies) {
|
|
|
57
73
|
const listeners = new Set();
|
|
58
74
|
const timers = new Map();
|
|
59
75
|
const runs = new Map();
|
|
76
|
+
const outOfSight = new Map();
|
|
60
77
|
function snapshot() {
|
|
61
78
|
return [...items.values()].sort((a, b) => a.createdAt - b.createdAt);
|
|
62
79
|
}
|
|
63
|
-
function
|
|
64
|
-
const settings = getSettings();
|
|
65
|
-
if (!settings.pauseTimerWhileHidden)
|
|
66
|
-
return false;
|
|
80
|
+
function clippedIds() {
|
|
67
81
|
const stack = snapshot().filter(isOnToastStack);
|
|
68
|
-
const cap = Math.max(1,
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
82
|
+
const cap = Math.max(1, getSettings().maxVisibleNotifications);
|
|
83
|
+
return new Set(stack.slice(0, Math.max(0, stack.length - cap)).map(({ id }) => id));
|
|
84
|
+
}
|
|
85
|
+
function isClipped(id) {
|
|
86
|
+
return getSettings().pauseTimerWhileHidden && clippedIds().has(id);
|
|
87
|
+
}
|
|
88
|
+
function recordSight() {
|
|
89
|
+
const clipped = clippedIds();
|
|
90
|
+
for (const id of outOfSight.keys()) {
|
|
91
|
+
if (!items.has(id))
|
|
92
|
+
outOfSight.delete(id);
|
|
93
|
+
}
|
|
94
|
+
let changed = false;
|
|
95
|
+
for (const [id, item] of items) {
|
|
96
|
+
if (item.hidden !== true && !clipped.has(id))
|
|
97
|
+
outOfSight.delete(id);
|
|
98
|
+
else if (!outOfSight.has(id))
|
|
99
|
+
outOfSight.set(id, now());
|
|
100
|
+
const since = outOfSight.get(id);
|
|
101
|
+
if (item.outOfSightSince === since)
|
|
102
|
+
continue;
|
|
103
|
+
items.set(id, withSight(item, since));
|
|
104
|
+
changed = true;
|
|
105
|
+
}
|
|
106
|
+
return changed;
|
|
74
107
|
}
|
|
75
108
|
function reevaluateSchedules() {
|
|
76
109
|
for (const id of items.keys()) {
|
|
@@ -83,6 +116,7 @@ export function createNativeNotificationEngine(dependencies) {
|
|
|
83
116
|
}
|
|
84
117
|
}
|
|
85
118
|
function emit() {
|
|
119
|
+
recordSight();
|
|
86
120
|
const snap = snapshot();
|
|
87
121
|
for (const l of Array.from(listeners)) {
|
|
88
122
|
try {
|
|
@@ -328,7 +362,7 @@ export function createNativeNotificationEngine(dependencies) {
|
|
|
328
362
|
closeCard(id, 'dismissed');
|
|
329
363
|
return;
|
|
330
364
|
}
|
|
331
|
-
if (cur.hidden)
|
|
365
|
+
if (cur.hidden || !centerReachable())
|
|
332
366
|
return;
|
|
333
367
|
items.set(id, sendToCenter(cur));
|
|
334
368
|
emit();
|
|
@@ -356,11 +390,16 @@ export function createNativeNotificationEngine(dependencies) {
|
|
|
356
390
|
return;
|
|
357
391
|
closeCard(id, 'suppressed');
|
|
358
392
|
}
|
|
393
|
+
function refresh() {
|
|
394
|
+
if (recordSight())
|
|
395
|
+
emit();
|
|
396
|
+
}
|
|
359
397
|
function dispose() {
|
|
360
398
|
for (const id of timers.keys())
|
|
361
399
|
cancelHide(id);
|
|
362
400
|
const ended = [...runs.keys()].map((id) => endRun(id, 'closed'));
|
|
363
401
|
items.clear();
|
|
402
|
+
outOfSight.clear();
|
|
364
403
|
listeners.clear();
|
|
365
404
|
for (const run of ended)
|
|
366
405
|
announceEnd(run);
|
|
@@ -375,6 +414,7 @@ export function createNativeNotificationEngine(dependencies) {
|
|
|
375
414
|
dismiss: dismissNotification,
|
|
376
415
|
suppress: suppressNotifications,
|
|
377
416
|
reject: rejectNotification,
|
|
417
|
+
refresh,
|
|
378
418
|
dispose,
|
|
379
419
|
};
|
|
380
420
|
}
|
|
@@ -51,6 +51,7 @@ export class NotificationService {
|
|
|
51
51
|
warn: (message, error) => log.warn(message, error),
|
|
52
52
|
isSilenced: silencedCard,
|
|
53
53
|
isTurnedDown: turnedDownCard,
|
|
54
|
+
centerReachable: deps.centerReachable,
|
|
54
55
|
});
|
|
55
56
|
this.stack = this.engine;
|
|
56
57
|
this.timeline = new NotificationTimeline({
|
|
@@ -95,6 +96,7 @@ export class NotificationService {
|
|
|
95
96
|
this.sounds.invalidate();
|
|
96
97
|
this.timeline.refreshBadge();
|
|
97
98
|
this.takeBackSilencedCards();
|
|
99
|
+
this.engine.refresh();
|
|
98
100
|
if (this.watchingQuietHours)
|
|
99
101
|
this.watchQuietHoursStart();
|
|
100
102
|
};
|