@crvouga/mockingbird-notifications 0.2.1 → 0.3.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/dist/{chunk-3HF2NSFV.js → chunk-4BPQC52H.js} +68 -1
- package/dist/chunk-4BPQC52H.js.map +7 -0
- package/dist/{chunk-FBJ2DRHH.js → chunk-OR6VYHWA.js} +3 -1
- package/dist/chunk-OR6VYHWA.js.map +7 -0
- package/dist/{chunk-SNOESDNW.js → chunk-TN2LRJAM.js} +2 -2
- package/dist/chunk-ZRI5NLWC.js +1177 -0
- package/dist/chunk-ZRI5NLWC.js.map +7 -0
- package/dist/cli.js +3 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -3
- package/dist/server.js +3 -3
- package/dist/{types-C4yF6DQp.d.ts → types-B--Ql-Jg.d.ts} +4 -1
- package/dist/ui.d.ts +1 -1
- package/dist/ui.js +25 -10
- package/dist/ui.js.map +2 -2
- package/package.json +1 -1
- package/dist/chunk-3HF2NSFV.js.map +0 -7
- package/dist/chunk-FBJ2DRHH.js.map +0 -7
- package/dist/chunk-GHIEYY5B.js +0 -1177
- package/dist/chunk-GHIEYY5B.js.map +0 -7
- /package/dist/{chunk-SNOESDNW.js.map → chunk-TN2LRJAM.js.map} +0 -0
package/dist/cli.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import {
|
|
3
3
|
DEFAULT_PORT,
|
|
4
4
|
createServer
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-TN2LRJAM.js";
|
|
6
|
+
import "./chunk-ZRI5NLWC.js";
|
|
7
|
+
import "./chunk-4BPQC52H.js";
|
|
8
8
|
|
|
9
9
|
// src/cli.ts
|
|
10
10
|
import { parseArgs } from "node:util";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { N as NotificationFilter, a as Notification, S as SourceStatus, C as Channel, E as EmailAttachment } from './types-CU0LKNyA.js';
|
|
2
2
|
export { A as Address, b as AdminGateway, c as AdminGatewayContext, d as AdminGatewayFactory, e as AdminTarget, f as CHANNELS, g as ChatContent, h as ChatReaction, i as EmailContent, j as Endpoint, F as FetchLike, k as FleetManifest, H as HarnessOptions, l as NotificationHarness, P as PushContent, m as PushPlatform, n as SERVICE_KINDS, o as SERVICE_LABELS, p as ServiceInput, q as ServiceKind, r as SmsContent, W as WaitOptions, s as createNotificationHarness, t as matches } from './types-CU0LKNyA.js';
|
|
3
|
-
export { T as TEST_IDS, a as TestId, s as selectors } from './types-
|
|
3
|
+
export { T as TEST_IDS, a as TestId, s as selectors } from './types-B--Ql-Jg.js';
|
|
4
4
|
|
|
5
5
|
type NotificationClientOptions = {
|
|
6
6
|
/** Default namespace for every call that does not name one. */
|
package/dist/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TEST_IDS,
|
|
3
3
|
selectors
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-OR6VYHWA.js";
|
|
5
5
|
import {
|
|
6
6
|
createNotificationHarness,
|
|
7
7
|
parseMime
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-ZRI5NLWC.js";
|
|
9
9
|
import {
|
|
10
10
|
CHANNELS,
|
|
11
11
|
SERVICE_KINDS,
|
|
12
12
|
SERVICE_LABELS,
|
|
13
13
|
filterToSearch,
|
|
14
14
|
matches
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-4BPQC52H.js";
|
|
16
16
|
|
|
17
17
|
// src/client.ts
|
|
18
18
|
var NotificationClient = class {
|
package/dist/server.js
CHANGED
|
@@ -4,9 +4,9 @@ import {
|
|
|
4
4
|
adminGateway,
|
|
5
5
|
createServer,
|
|
6
6
|
manifestFile
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-TN2LRJAM.js";
|
|
8
|
+
import "./chunk-ZRI5NLWC.js";
|
|
9
|
+
import "./chunk-4BPQC52H.js";
|
|
10
10
|
export {
|
|
11
11
|
ADMIN_BRANDS_URL,
|
|
12
12
|
DEFAULT_PORT,
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
* The UI root (`TEST_IDS.app`) reports its state the same way: `data-ready` ("true" once the first
|
|
12
12
|
* read finished), `data-view`, `data-namespace`, `data-count`, `data-version`, `data-connected`,
|
|
13
13
|
* `data-sound`, `data-motion`, `data-layout` ("grid" = devices side by side, "tabs" = one device at
|
|
14
|
-
* a time)
|
|
14
|
+
* a time), `data-size` ("phone" = a one-row top bar and the open device filling the screen, else
|
|
15
|
+
* "wide") and `data-tab` (the selected channel tab: "all", "sms", "push", "email" or "chat").
|
|
15
16
|
*
|
|
16
17
|
* This module has no dependencies, so Playwright, Cypress or WebdriverIO specs can import it.
|
|
17
18
|
*/
|
|
@@ -21,6 +22,8 @@ declare const TEST_IDS: {
|
|
|
21
22
|
readonly topbar: "topbar";
|
|
22
23
|
/** `<select>` of namespaces. */
|
|
23
24
|
readonly namespace: "namespace";
|
|
25
|
+
/** Narrow screens: shows or hides the rest of the top bar; `aria-expanded`. */
|
|
26
|
+
readonly menu: "topbar-menu";
|
|
24
27
|
/** Filter `<input>` (recipient, sender, text). */
|
|
25
28
|
readonly search: "search";
|
|
26
29
|
/** View tabs; `aria-pressed="true"` on the active one. */
|
package/dist/ui.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { T as TEST_IDS, a as TestId, s as selectors } from './types-
|
|
1
|
+
export { T as TEST_IDS, a as TestId, s as selectors } from './types-B--Ql-Jg.js';
|
|
2
2
|
import { Notification, Channel, SourceStatus, NotificationHarness } from './index.js';
|
|
3
3
|
|
|
4
4
|
/** The class on the UI root. Every rule below is scoped to it. */
|
package/dist/ui.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TEST_IDS,
|
|
3
3
|
selectors
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-OR6VYHWA.js";
|
|
5
5
|
import {
|
|
6
6
|
CHANNELS,
|
|
7
7
|
DASHBOARD_ROOT_CLASS,
|
|
8
8
|
DASHBOARD_STYLES,
|
|
9
9
|
ROOT_CLASS,
|
|
10
10
|
STYLES
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-4BPQC52H.js";
|
|
12
12
|
|
|
13
13
|
// src/ui/chat.ts
|
|
14
14
|
var isRow = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -274,9 +274,9 @@ var icons = {
|
|
|
274
274
|
15
|
|
275
275
|
),
|
|
276
276
|
menu: () => material("M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z", 24),
|
|
277
|
-
tune: () => material(
|
|
277
|
+
tune: (size = 24) => material(
|
|
278
278
|
"M3 17v2h6v-2H3zM3 5v2h10V5H3zm10 16v-2h8v-2h-8v-2h-2v6h2zM7 9v2H3v2h4v2h2V9H7zm14 4v-2H11v2h10zm-6-4h2V7h4V5h-4V3h-2v6z",
|
|
279
|
-
|
|
279
|
+
size
|
|
280
280
|
),
|
|
281
281
|
help: () => material(
|
|
282
282
|
"M11 18h2v-2h-2v2zm1-16a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm0 18a8 8 0 1 1 0-16 8 8 0 0 1 0 16zm0-14a4 4 0 0 0-4 4h2a2 2 0 1 1 4 0c0 2-3 1.75-3 5h2c0-2.25 3-2.5 3-5a4 4 0 0 0-4-4z",
|
|
@@ -522,6 +522,8 @@ var TAB_LABELS = {
|
|
|
522
522
|
var MIN_SCALE = 0.5;
|
|
523
523
|
var deviceScale = (value) => typeof value === "number" && Number.isFinite(value) ? Math.max(MIN_SCALE, Math.min(1, value)) : 1;
|
|
524
524
|
var isCompact = (layout, width, scale = 1) => layout === "tabs" || layout === "auto" && width > 0 && width / scale < TABS_BELOW_WIDTH;
|
|
525
|
+
var PHONE_BELOW_WIDTH = 640;
|
|
526
|
+
var isPhoneWidth = (width) => width > 0 && width < PHONE_BELOW_WIDTH;
|
|
525
527
|
var phoneFit = (width, scale = 1) => Math.max(0.5, Math.min(1, (width / scale - 16) / 362));
|
|
526
528
|
var tabsFor = (enabled, compact) => enabled.length < 2 ? [] : compact ? [...enabled] : ["all", ...enabled];
|
|
527
529
|
var activeTab = (enabled, compact, only, fallback) => {
|
|
@@ -583,6 +585,8 @@ function createApp(root, options = {}) {
|
|
|
583
585
|
view: initialView === "timeline" ? "timeline" : "devices",
|
|
584
586
|
only: CHANNELS.includes(initialView ?? "") ? initialView : null,
|
|
585
587
|
search: "",
|
|
588
|
+
/** Narrow screens: whether the rest of the top bar is open. */
|
|
589
|
+
menu: false,
|
|
586
590
|
follow: params.get("follow") !== "0",
|
|
587
591
|
connected: false,
|
|
588
592
|
sms: {
|
|
@@ -644,12 +648,15 @@ function createApp(root, options = {}) {
|
|
|
644
648
|
const width = root.clientWidth;
|
|
645
649
|
root.style.setProperty("--mbn-scale", String(scale));
|
|
646
650
|
if (width > 0) root.style.setProperty("--mbn-fit", String(phoneFit(width, scale)));
|
|
651
|
+
const size = width > 0 ? isPhoneWidth(width) ? "phone" : "wide" : root.dataset.size;
|
|
652
|
+
const resized = size !== root.dataset.size;
|
|
653
|
+
if (size) root.dataset.size = size;
|
|
647
654
|
const next = isCompact(
|
|
648
655
|
options.tabs === false && layout === "auto" ? "grid" : layout,
|
|
649
656
|
width,
|
|
650
657
|
scale
|
|
651
658
|
);
|
|
652
|
-
if (next === compact) return
|
|
659
|
+
if (next === compact) return resized;
|
|
653
660
|
compact = next;
|
|
654
661
|
return true;
|
|
655
662
|
};
|
|
@@ -1036,21 +1043,24 @@ function createApp(root, options = {}) {
|
|
|
1036
1043
|
const namespaces = [.../* @__PURE__ */ new Set([...state.namespaces, state.namespace])].sort();
|
|
1037
1044
|
const searchFocused = document.activeElement === byTestId(TEST_IDS.search);
|
|
1038
1045
|
bar.innerHTML = `
|
|
1039
|
-
<div class="brand"><span class="brand-mark">${icons.bell()}</span><span>${esc(title())} <small>Mockingbird</small></span></div>
|
|
1040
|
-
<
|
|
1041
|
-
<
|
|
1046
|
+
<div class="brand"><span class="brand-mark">${icons.bell()}</span><span class="brand-name">${esc(title())} <small>Mockingbird</small></span></div>
|
|
1047
|
+
<div class="field search">${icons.search("#9aa1b1", 14)}<input type="search" data-action="search" ${tid(TEST_IDS.search)} aria-label="Filter notifications" placeholder="${root.dataset.size === "phone" ? "Filter notifications\u2026" : "Filter by recipient, sender, text\u2026"}" value="${esc(state.search)}"></div>
|
|
1048
|
+
<span class="live" ${tid(TEST_IDS.connection)} data-state="${state.connected ? "live" : "reconnecting"}" role="status"><span class="dot ${state.connected ? "ok" : "bad"}"></span><span class="live-label">${state.connected ? "Live" : "Reconnecting"}</span></span>
|
|
1049
|
+
<button class="menu-btn" data-action="menu" ${tid(TEST_IDS.menu)} aria-expanded="${state.menu}" aria-controls="${uid}-more" aria-label="More options">${state.menu ? icons.close(18) : icons.tune(20)}</button>
|
|
1050
|
+
<div class="topbar-more" id="${uid}-more">
|
|
1051
|
+
<label class="field namespace">Namespace <select data-action="namespace" ${tid(TEST_IDS.namespace)} aria-label="Namespace">${namespaces.map((ns) => `<option ${ns === state.namespace ? "selected" : ""}>${esc(ns)}</option>`).join("")}</select></label>
|
|
1042
1052
|
<div class="tabs" role="group" aria-label="View">
|
|
1043
1053
|
<button data-action="view" data-value="devices" ${tid(TEST_IDS.viewDevices)} aria-pressed="${state.view === "devices"}">Devices</button>
|
|
1044
1054
|
<button data-action="view" data-value="timeline" ${tid(TEST_IDS.viewTimeline)} aria-pressed="${state.view === "timeline"}">Timeline <span style="opacity:.6">${state.items.length}</span></button>
|
|
1045
1055
|
</div>
|
|
1046
1056
|
<label class="toggle" title="Jump each device to the newest arrival"><input type="checkbox" data-action="follow" ${tid(TEST_IDS.follow)} ${state.follow ? "checked" : ""}> Follow new</label>
|
|
1047
1057
|
<button class="icon-toggle" data-action="sound" ${tid(TEST_IDS.sound)} aria-pressed="${sound.enabled}" title="Play alert sounds on arrivals">${sound.enabled ? icons.volumeOn() : icons.volumeOff()}<span>Sound</span></button>
|
|
1048
|
-
<span class="live" ${tid(TEST_IDS.connection)} data-state="${state.connected ? "live" : "reconnecting"}" role="status"><span class="dot ${state.connected ? "ok" : "bad"}"></span>${state.connected ? "Live" : "Reconnecting"}</span>
|
|
1049
1058
|
<div class="sources">${state.sources.map(
|
|
1050
1059
|
(s) => `<span class="pill" title="${esc(s.error ?? s.url)}" ${tid(TEST_IDS.source)} data-name="${esc(s.name)}" data-service="${esc(s.service ?? "")}" data-ok="${s.ok}" data-count="${s.count}"><span class="dot ${s.ok ? "ok" : s.error ? "bad" : ""}"></span>${esc(
|
|
1051
1060
|
s.service && s.name !== s.service ? `${s.name} \xB7 ${SERVICE_LABEL[s.service] ?? s.service}` : SERVICE_LABEL[s.name] ?? s.name
|
|
1052
1061
|
)} <b>${s.count}</b></span>`
|
|
1053
|
-
).join("")}</div
|
|
1062
|
+
).join("")}</div>
|
|
1063
|
+
</div>`;
|
|
1054
1064
|
if (searchFocused) {
|
|
1055
1065
|
const input = byTestId(TEST_IDS.search);
|
|
1056
1066
|
input?.focus();
|
|
@@ -1923,6 +1933,7 @@ function createApp(root, options = {}) {
|
|
|
1923
1933
|
switch (action) {
|
|
1924
1934
|
case "view":
|
|
1925
1935
|
state.view = target.dataset.value === "timeline" ? "timeline" : "devices";
|
|
1936
|
+
state.menu = false;
|
|
1926
1937
|
render();
|
|
1927
1938
|
break;
|
|
1928
1939
|
case "tab":
|
|
@@ -1935,6 +1946,10 @@ function createApp(root, options = {}) {
|
|
|
1935
1946
|
case "sound":
|
|
1936
1947
|
handle.setSound(!sound.enabled);
|
|
1937
1948
|
break;
|
|
1949
|
+
case "menu":
|
|
1950
|
+
state.menu = !state.menu;
|
|
1951
|
+
renderTopbar();
|
|
1952
|
+
break;
|
|
1938
1953
|
case "sms-open":
|
|
1939
1954
|
state.sms.thread = from || null;
|
|
1940
1955
|
state.sms.transition = "push";
|