@vokril/ui-solid 0.33.4 → 0.34.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 +30 -0
- package/README.md +40 -0
- package/dist/{StatusBarNotificationBell-DE1jIaBt.js → StatusBarNotificationBell-Lps0FfKd.js} +4241 -4154
- package/dist/StatusBarNotificationBell-pBGZ_2eb.cjs +53 -0
- package/dist/_internal/contract/browser/workspace.d.cts +5 -0
- package/dist/_internal/contract/browser/workspace.d.ts +5 -0
- package/dist/_internal/contract/notification.d.cts +30 -4
- package/dist/_internal/contract/notification.d.ts +30 -4
- package/dist/_internal/contract/notificationCatalog.d.cts +15 -1
- package/dist/_internal/contract/notificationCatalog.d.ts +15 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/notifications/createNotificationPreviewRuntime.d.cts +1 -0
- package/dist/notifications/createNotificationPreviewRuntime.d.ts +1 -0
- package/dist/notifications/fireNotification.d.cts +14 -7
- package/dist/notifications/fireNotification.d.ts +14 -7
- package/dist/notifications/index.cjs +1 -1
- package/dist/notifications/index.js +1 -1
- package/dist/notifications/nativeEngine.d.cts +8 -1
- package/dist/notifications/nativeEngine.d.ts +8 -1
- package/dist/notifications/notificationService.d.cts +2 -1
- package/dist/notifications/notificationService.d.ts +2 -1
- package/dist/notifications/notifications.notifications.d.cts +0 -1
- package/dist/notifications/notifications.notifications.d.ts +0 -1
- package/dist/notifications/toast.d.cts +19 -3
- package/dist/notifications/toast.d.ts +19 -3
- package/dist/notifications/toastFilterPolicy.d.cts +15 -1
- package/dist/notifications/toastFilterPolicy.d.ts +15 -1
- package/dist/server/StatusBarNotificationBell-D0UzYPs6.cjs +52 -0
- package/dist/server/{StatusBarNotificationBell-y5cPAlMY.js → StatusBarNotificationBell-DiVJ-EnY.js} +4255 -4168
- package/dist/server/index.cjs +1 -1
- package/dist/server/index.js +1 -1
- package/dist/server/notifications/index.cjs +1 -1
- package/dist/server/notifications/index.js +1 -1
- package/dist/solid/notifications/NotificationItem.jsx +4 -3
- package/dist/solid/notifications/catalogAdapter.js +8 -9
- package/dist/solid/notifications/createNotificationPreviewRuntime.js +34 -18
- package/dist/solid/notifications/fireNotification.js +9 -5
- package/dist/solid/notifications/notificationOverlaySnapshot.js +1 -0
- package/dist/solid/notifications/notificationService.js +1 -0
- package/dist/solid/notifications/notifications.notifications.js +8 -0
- package/dist/solid/notifications/toast.js +70 -31
- package/dist/solid/notifications/toastFilterPolicy.js +8 -0
- package/dist/style.css +1 -1
- package/dist/ui.css +1 -1
- package/package.json +1 -1
- package/dist/StatusBarNotificationBell-CLrNtOO9.cjs +0 -50
- package/dist/server/StatusBarNotificationBell-fLacxZ0X.cjs +0 -49
|
@@ -27,6 +27,7 @@ export const notificationReplayError = defineNotification({
|
|
|
27
27
|
severity: 'error',
|
|
28
28
|
priority: 'urgent',
|
|
29
29
|
delivery: 'in-app',
|
|
30
|
+
origin: 'user-action',
|
|
30
31
|
kind: 'message',
|
|
31
32
|
}, ({ timelineMessage, options, }) => withOptions(timelineMessage, options));
|
|
32
33
|
export const notificationReplayWarning = defineNotification({
|
|
@@ -35,6 +36,7 @@ export const notificationReplayWarning = defineNotification({
|
|
|
35
36
|
severity: 'warning',
|
|
36
37
|
priority: 'urgent',
|
|
37
38
|
delivery: 'in-app',
|
|
39
|
+
origin: 'user-action',
|
|
38
40
|
kind: 'message',
|
|
39
41
|
}, ({ timelineMessage, options, }) => withOptions(timelineMessage, options));
|
|
40
42
|
export const notificationReplaySuccess = defineNotification({
|
|
@@ -43,6 +45,7 @@ export const notificationReplaySuccess = defineNotification({
|
|
|
43
45
|
severity: 'success',
|
|
44
46
|
priority: 'urgent',
|
|
45
47
|
delivery: 'in-app',
|
|
48
|
+
origin: 'user-action',
|
|
46
49
|
kind: 'message',
|
|
47
50
|
}, ({ timelineMessage, options, }) => withOptions(timelineMessage, options));
|
|
48
51
|
export const notificationReplayInfo = defineNotification({
|
|
@@ -51,6 +54,7 @@ export const notificationReplayInfo = defineNotification({
|
|
|
51
54
|
severity: 'info',
|
|
52
55
|
priority: 'urgent',
|
|
53
56
|
delivery: 'in-app',
|
|
57
|
+
origin: 'user-action',
|
|
54
58
|
kind: 'message',
|
|
55
59
|
}, ({ timelineMessage, options, }) => withOptions(timelineMessage, options));
|
|
56
60
|
export const notificationTimelineExported = defineNotification({
|
|
@@ -59,6 +63,7 @@ export const notificationTimelineExported = defineNotification({
|
|
|
59
63
|
severity: 'success',
|
|
60
64
|
priority: 'default',
|
|
61
65
|
delivery: 'in-app',
|
|
66
|
+
origin: 'user-action',
|
|
62
67
|
kind: 'message',
|
|
63
68
|
}, ({ entryCount }) => ({
|
|
64
69
|
message: t('Exported {count} notifications', { count: entryCount }),
|
|
@@ -69,6 +74,7 @@ export const notificationTimelineExportFailed = defineNotification({
|
|
|
69
74
|
severity: 'error',
|
|
70
75
|
priority: 'default',
|
|
71
76
|
delivery: 'in-app',
|
|
77
|
+
origin: 'user-action',
|
|
72
78
|
kind: 'message',
|
|
73
79
|
}, ({ cause }, { errorText }) => ({
|
|
74
80
|
message: t('Export failed: {message}', {
|
|
@@ -82,6 +88,7 @@ export const errorActionFailed = defineNotification({
|
|
|
82
88
|
severity: 'error',
|
|
83
89
|
priority: 'default',
|
|
84
90
|
delivery: 'in-app',
|
|
91
|
+
origin: 'user-action',
|
|
85
92
|
kind: 'message',
|
|
86
93
|
}, ({ cause }, { errorText }) => ({
|
|
87
94
|
message: t('The action could not be completed: {message}', {
|
|
@@ -95,6 +102,7 @@ export const notificationSettingsUpdateFailed = defineNotification({
|
|
|
95
102
|
severity: 'error',
|
|
96
103
|
priority: 'default',
|
|
97
104
|
delivery: 'in-app',
|
|
105
|
+
origin: 'user-action',
|
|
98
106
|
kind: 'message',
|
|
99
107
|
}, ({ cause }, { errorText }) => ({
|
|
100
108
|
message: errorText(cause, t('Operation failed.')),
|
|
@@ -15,13 +15,28 @@ function toMessage(value) {
|
|
|
15
15
|
return '';
|
|
16
16
|
return String(value);
|
|
17
17
|
}
|
|
18
|
+
function joinBody(first, second) {
|
|
19
|
+
if (first && second)
|
|
20
|
+
return `${first}\n\n${second}`;
|
|
21
|
+
return first || second || undefined;
|
|
22
|
+
}
|
|
23
|
+
export function cardLines(message, options) {
|
|
24
|
+
const description = options.subtitle?.trim() || options.description?.trim() || undefined;
|
|
25
|
+
const title = options.title?.trim();
|
|
26
|
+
if (!title)
|
|
27
|
+
return { title: message, body: description };
|
|
28
|
+
return { title, body: joinBody(message.trim() ? message : undefined, description) };
|
|
29
|
+
}
|
|
30
|
+
function recordedText(titleLine, message, options) {
|
|
31
|
+
return options.title?.trim() && message.trim() ? `${titleLine}\n${message}` : titleLine;
|
|
32
|
+
}
|
|
18
33
|
export function enrichErrorToast(message, options, vendorMatch, onOpenDocs) {
|
|
19
34
|
const text = toMessage(message);
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
let displayText =
|
|
23
|
-
let bodyText =
|
|
24
|
-
if (vendorMatch && !
|
|
35
|
+
const titled = Boolean(options.title?.trim());
|
|
36
|
+
const lines = cardLines(text, options);
|
|
37
|
+
let displayText = lines.title;
|
|
38
|
+
let bodyText = lines.body;
|
|
39
|
+
if (vendorMatch && !titled) {
|
|
25
40
|
const formatted = vendorMatch.helpers.formatCode(vendorMatch.code);
|
|
26
41
|
const splitRegex = new RegExp(`^\\s*${escapeRegExpCharacters(formatted)}\\s*[:-]\\s*(.+)$`, 'i');
|
|
27
42
|
const match = text.match(splitRegex);
|
|
@@ -61,21 +76,28 @@ function issueKeysOf(options) {
|
|
|
61
76
|
remindKey: options.remindKey,
|
|
62
77
|
};
|
|
63
78
|
}
|
|
64
|
-
function applyNotificationRulesFromSettings(input) {
|
|
79
|
+
function applyNotificationRulesFromSettings(input, options) {
|
|
80
|
+
if (options.origin === 'user-action')
|
|
81
|
+
return input;
|
|
65
82
|
return applyNotificationRules(input, notificationSettings.get().notificationRules);
|
|
66
83
|
}
|
|
84
|
+
function successToastsOff(priority, options) {
|
|
85
|
+
return (!notificationSettings.get().showSuccessToasts &&
|
|
86
|
+
priority !== 'urgent' &&
|
|
87
|
+
options.origin !== 'user-action');
|
|
88
|
+
}
|
|
67
89
|
export function createToast(deps) {
|
|
68
90
|
const { sinks, timeline } = deps;
|
|
69
91
|
return {
|
|
70
92
|
success(message, options = {}) {
|
|
71
93
|
const text = toMessage(message);
|
|
72
|
-
const
|
|
94
|
+
const lines = cardLines(text, options);
|
|
73
95
|
const ruled = applyNotificationRulesFromSettings({
|
|
74
96
|
severity: 'success',
|
|
75
|
-
title:
|
|
97
|
+
title: lines.title,
|
|
76
98
|
priority: options.priority ?? 'default',
|
|
77
99
|
source: options.source ?? 'general',
|
|
78
|
-
});
|
|
100
|
+
}, options);
|
|
79
101
|
if (!ruled)
|
|
80
102
|
return '';
|
|
81
103
|
const decision = decideFilter({
|
|
@@ -85,15 +107,17 @@ export function createToast(deps) {
|
|
|
85
107
|
priority: ruled.priority,
|
|
86
108
|
recordTimeline: options.recordTimeline,
|
|
87
109
|
filter: deps.filter(),
|
|
110
|
+
origin: options.origin,
|
|
88
111
|
...issueKeysOf(options),
|
|
89
112
|
});
|
|
90
113
|
if (decision.recordTimeline)
|
|
91
|
-
timeline.add(ruled.title, ruled.severity, ruled.source, ruled.priority, toTimelineActions(options.action));
|
|
92
|
-
if (
|
|
114
|
+
timeline.add(recordedText(ruled.title, text, options), ruled.severity, ruled.source, ruled.priority, toTimelineActions(options.action));
|
|
115
|
+
if (successToastsOff(ruled.priority, options))
|
|
93
116
|
return '';
|
|
94
117
|
const handle = fire(sinks, {
|
|
95
118
|
severity: ruled.severity,
|
|
96
119
|
title: ruled.title,
|
|
120
|
+
body: lines.body,
|
|
97
121
|
options: { ...options, source: ruled.source, priority: ruled.priority },
|
|
98
122
|
decision,
|
|
99
123
|
...(options.action ? { primaryAction: options.action } : {}),
|
|
@@ -106,14 +130,14 @@ export function createToast(deps) {
|
|
|
106
130
|
const enrichment = enrichErrorToast(text, options, vendorMatch, deps.openExternal);
|
|
107
131
|
const hasVendorCode = vendorMatch !== null;
|
|
108
132
|
const bodyText = enrichment.bodyText;
|
|
109
|
-
const timelineText = bodyText ? `${enrichment.displayText}\n${bodyText}` :
|
|
133
|
+
const timelineText = bodyText ? `${enrichment.displayText}\n${bodyText}` : enrichment.displayText;
|
|
110
134
|
const vendorUrgent = hasVendorCode && notificationSettings.get().vendorCodesAreUrgent;
|
|
111
135
|
const ruled = applyNotificationRulesFromSettings({
|
|
112
136
|
severity: 'error',
|
|
113
137
|
title: enrichment.displayText,
|
|
114
138
|
priority: options.priority ?? (vendorUrgent ? 'urgent' : 'default'),
|
|
115
139
|
source: options.source ?? (hasVendorCode ? 'vendor-error' : 'general'),
|
|
116
|
-
});
|
|
140
|
+
}, options);
|
|
117
141
|
if (!ruled)
|
|
118
142
|
return '';
|
|
119
143
|
const { source, priority } = ruled;
|
|
@@ -124,6 +148,7 @@ export function createToast(deps) {
|
|
|
124
148
|
priority,
|
|
125
149
|
recordTimeline: options.recordTimeline,
|
|
126
150
|
filter: deps.filter(),
|
|
151
|
+
origin: options.origin,
|
|
127
152
|
...issueKeysOf(options),
|
|
128
153
|
});
|
|
129
154
|
if (decision.recordTimeline)
|
|
@@ -131,7 +156,8 @@ export function createToast(deps) {
|
|
|
131
156
|
const handle = fire(sinks, {
|
|
132
157
|
severity: ruled.severity,
|
|
133
158
|
title: ruled.title,
|
|
134
|
-
|
|
159
|
+
body: bodyText,
|
|
160
|
+
options: { ...options, source, priority },
|
|
135
161
|
decision,
|
|
136
162
|
...(enrichment.primaryAction ? { primaryAction: enrichment.primaryAction } : {}),
|
|
137
163
|
...(options.vendorError ? { vendorError: options.vendorError } : {}),
|
|
@@ -146,30 +172,33 @@ export function createToast(deps) {
|
|
|
146
172
|
},
|
|
147
173
|
queryCompleted(message, options = {}) {
|
|
148
174
|
const text = toMessage(message);
|
|
175
|
+
const lines = cardLines(text, options);
|
|
149
176
|
const settings = notificationSettings.get();
|
|
150
177
|
const source = options.source ?? 'sql-execution';
|
|
151
178
|
const priority = options.priority ?? 'default';
|
|
152
179
|
const decision = decideFilter({
|
|
153
180
|
source,
|
|
154
|
-
title:
|
|
181
|
+
title: lines.title,
|
|
155
182
|
severity: 'success',
|
|
156
183
|
priority,
|
|
157
184
|
recordTimeline: options.recordTimeline,
|
|
158
185
|
filter: deps.filter(),
|
|
186
|
+
origin: options.origin,
|
|
159
187
|
...issueKeysOf(options),
|
|
160
188
|
});
|
|
161
189
|
if (decision.recordTimeline)
|
|
162
|
-
timeline.add(text, 'success', source, priority, toTimelineActions(options.action));
|
|
190
|
+
timeline.add(recordedText(lines.title, text, options), 'success', source, priority, toTimelineActions(options.action));
|
|
163
191
|
if (settings.notificationsEnabled &&
|
|
164
192
|
settings.soundOnQueryCompletion &&
|
|
165
193
|
!(settings.quietHoursMutesSounds && isInQuietHours(settings, new Date()))) {
|
|
166
194
|
sinks.audio.playQueryCompletedCue();
|
|
167
195
|
}
|
|
168
|
-
if (
|
|
196
|
+
if (successToastsOff(priority, options))
|
|
169
197
|
return '';
|
|
170
198
|
const handle = fire(sinks, {
|
|
171
199
|
severity: 'success',
|
|
172
|
-
title:
|
|
200
|
+
title: lines.title,
|
|
201
|
+
body: lines.body,
|
|
173
202
|
options: { ...options, source, priority },
|
|
174
203
|
decision,
|
|
175
204
|
...(options.action ? { primaryAction: options.action } : {}),
|
|
@@ -183,19 +212,24 @@ export function createToast(deps) {
|
|
|
183
212
|
const priority = options.priority ?? 'default';
|
|
184
213
|
const explicitId = options.id !== undefined ? String(options.id) : undefined;
|
|
185
214
|
const keys = issueKeysOf(options);
|
|
215
|
+
const lines = cardLines(text, options);
|
|
216
|
+
const titled = Boolean(options.title?.trim());
|
|
217
|
+
const linesOf = (next) => titled ? { body: cardLines(next, options).body } : { title: next };
|
|
218
|
+
const recorded = (next) => titled ? recordedText(lines.title, next, options) : next;
|
|
186
219
|
const decision = decideFilter({
|
|
187
220
|
source,
|
|
188
|
-
title:
|
|
221
|
+
title: lines.title,
|
|
189
222
|
severity: 'info',
|
|
190
223
|
priority,
|
|
191
224
|
recordTimeline: options.recordTimeline,
|
|
192
225
|
filter: deps.filter(),
|
|
226
|
+
origin: options.origin,
|
|
193
227
|
...keys,
|
|
194
228
|
});
|
|
195
229
|
if (decision.recordTimeline)
|
|
196
|
-
timeline.add(text, 'info', source, priority);
|
|
230
|
+
timeline.add(recorded(text), 'info', source, priority);
|
|
197
231
|
if (!decision.showToast &&
|
|
198
|
-
(turnedDownOnCard(source,
|
|
232
|
+
(turnedDownOnCard(source, lines.title, keys) ||
|
|
199
233
|
priority === 'acknowledgment-required')) {
|
|
200
234
|
if (explicitId !== undefined)
|
|
201
235
|
sinks.engine.reject(explicitId);
|
|
@@ -207,18 +241,19 @@ export function createToast(deps) {
|
|
|
207
241
|
const handle = sinks.engine.notify({
|
|
208
242
|
id,
|
|
209
243
|
severity: 'info',
|
|
210
|
-
title:
|
|
244
|
+
title: lines.title,
|
|
245
|
+
...(lines.body ? { body: lines.body } : {}),
|
|
211
246
|
...cardPresentation({ ...options, source }),
|
|
212
247
|
source,
|
|
213
248
|
priority,
|
|
214
249
|
sticky: true,
|
|
215
250
|
progress: onCancel ? { onCancel } : {},
|
|
216
|
-
remindKey: keys.remindKey ?? keys.dontShowAgainKey ?? deriveImplicitRemindKey(source,
|
|
251
|
+
remindKey: keys.remindKey ?? keys.dontShowAgainKey ?? deriveImplicitRemindKey(source, lines.title),
|
|
217
252
|
...(actions.length > 0 ? { actions } : {}),
|
|
218
253
|
});
|
|
219
254
|
return {
|
|
220
255
|
update: (next, value) => {
|
|
221
|
-
handle.update(
|
|
256
|
+
handle.update(linesOf(next));
|
|
222
257
|
if (value !== undefined) {
|
|
223
258
|
handle.setProgress({
|
|
224
259
|
value: Math.max(0, Math.min(1, value)),
|
|
@@ -229,15 +264,15 @@ export function createToast(deps) {
|
|
|
229
264
|
success: (final) => {
|
|
230
265
|
const msg = final ?? text;
|
|
231
266
|
if (decision.recordTimeline)
|
|
232
|
-
timeline.add(msg, 'success', source, priority);
|
|
233
|
-
handle.update({
|
|
267
|
+
timeline.add(recorded(msg), 'success', source, priority);
|
|
268
|
+
handle.update({ ...linesOf(msg), severity: 'success', sticky: false, progress: { done: true } });
|
|
234
269
|
},
|
|
235
270
|
fail: (final) => {
|
|
236
271
|
const msg = final ?? text;
|
|
237
272
|
if (decision.recordTimeline)
|
|
238
|
-
timeline.add(msg, 'error', source, priority);
|
|
273
|
+
timeline.add(recorded(msg), 'error', source, priority);
|
|
239
274
|
handle.update({
|
|
240
|
-
|
|
275
|
+
...linesOf(msg),
|
|
241
276
|
severity: 'error',
|
|
242
277
|
sticky: true,
|
|
243
278
|
progress: { done: true },
|
|
@@ -258,12 +293,14 @@ export function createToast(deps) {
|
|
|
258
293
|
};
|
|
259
294
|
}
|
|
260
295
|
function plainVerb(deps, severity, message, options) {
|
|
296
|
+
const text = toMessage(message);
|
|
297
|
+
const lines = cardLines(text, options);
|
|
261
298
|
const ruled = applyNotificationRulesFromSettings({
|
|
262
299
|
severity,
|
|
263
|
-
title:
|
|
300
|
+
title: lines.title,
|
|
264
301
|
priority: options.priority ?? 'default',
|
|
265
302
|
source: options.source ?? 'general',
|
|
266
|
-
});
|
|
303
|
+
}, options);
|
|
267
304
|
if (!ruled)
|
|
268
305
|
return '';
|
|
269
306
|
const decision = decideFilter({
|
|
@@ -273,13 +310,15 @@ function plainVerb(deps, severity, message, options) {
|
|
|
273
310
|
priority: ruled.priority,
|
|
274
311
|
recordTimeline: options.recordTimeline,
|
|
275
312
|
filter: deps.filter(),
|
|
313
|
+
origin: options.origin,
|
|
276
314
|
...issueKeysOf(options),
|
|
277
315
|
});
|
|
278
316
|
if (decision.recordTimeline)
|
|
279
|
-
deps.timeline.add(ruled.title, ruled.severity, ruled.source, ruled.priority, toTimelineActions(options.action));
|
|
317
|
+
deps.timeline.add(recordedText(ruled.title, text, options), ruled.severity, ruled.source, ruled.priority, toTimelineActions(options.action));
|
|
280
318
|
const handle = fire(deps.sinks, {
|
|
281
319
|
severity: ruled.severity,
|
|
282
320
|
title: ruled.title,
|
|
321
|
+
body: lines.body,
|
|
283
322
|
options: { ...options, source: ruled.source, priority: ruled.priority },
|
|
284
323
|
decision,
|
|
285
324
|
...(options.action ? { primaryAction: options.action } : {}),
|
|
@@ -16,6 +16,14 @@ export function cardRemindKey(card) {
|
|
|
16
16
|
export function decideFilter(input, settings, gates) {
|
|
17
17
|
const { priority } = input;
|
|
18
18
|
const allowTimeline = input.recordTimeline !== false;
|
|
19
|
+
if (input.origin === 'user-action') {
|
|
20
|
+
const settled = decideFilter({ priority, recordTimeline: input.recordTimeline }, settings, gates);
|
|
21
|
+
return {
|
|
22
|
+
showToast: true,
|
|
23
|
+
recordTimeline: allowTimeline,
|
|
24
|
+
...(settled.showToast ? {} : { withoutSound: true }),
|
|
25
|
+
};
|
|
26
|
+
}
|
|
19
27
|
if (!settings.notificationsEnabled) {
|
|
20
28
|
return { showToast: false, recordTimeline: false };
|
|
21
29
|
}
|