@isoloop/devtools 0.1.0-next.6 → 0.1.0-next.8
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 +6 -4
- package/dist/index.d.ts +11 -0
- package/dist/index.js +19 -1
- package/dist/panel.js +1652 -197
- package/package.json +5 -5
package/dist/panel.js
CHANGED
|
@@ -64,7 +64,7 @@ function majorMinor(version) {
|
|
|
64
64
|
}
|
|
65
65
|
// ../runtime/dist/index.js
|
|
66
66
|
/** This build's stamp: `major.minor` of the package version, inlined when tsdown bundles it. */
|
|
67
|
-
const REQUIRES = majorMinor("0.1.0-next.
|
|
67
|
+
const REQUIRES = majorMinor("0.1.0-next.8") ?? "0.0";
|
|
68
68
|
// ../../node_modules/.pnpm/preact@11.1.1/node_modules/preact/dist/preact.mjs
|
|
69
69
|
var n;
|
|
70
70
|
var t$1;
|
|
@@ -693,8 +693,12 @@ function healthOf(snap) {
|
|
|
693
693
|
return snap.isolates.some((i) => UNWELL.has(i.state)) ? "unwell" : "ok";
|
|
694
694
|
}
|
|
695
695
|
// src/persist.ts
|
|
696
|
+
const isMode = (v) => v === "normal" || v === "wide" || v === "max";
|
|
696
697
|
const DB = "isoloop-devtools";
|
|
697
698
|
const STORE = "settings";
|
|
699
|
+
/** The kernel events of each page session, and the sessions themselves (`event-store.ts`). */
|
|
700
|
+
const EVENTS_STORE = "events";
|
|
701
|
+
const SESSIONS_STORE = "sessions";
|
|
698
702
|
const KEY = "panel";
|
|
699
703
|
const POSITIONS$1 = /* @__PURE__ */ new Set([
|
|
700
704
|
"bottom-right",
|
|
@@ -715,6 +719,8 @@ function parseUi(v) {
|
|
|
715
719
|
if (typeof width === "number" && Number.isFinite(width)) out.width = width;
|
|
716
720
|
if (typeof height === "number" && Number.isFinite(height)) out.height = height;
|
|
717
721
|
if (isPosition(position)) out.position = position;
|
|
722
|
+
const mode = Reflect.get(v, "mode");
|
|
723
|
+
if (isMode(mode)) out.mode = mode;
|
|
718
724
|
return out;
|
|
719
725
|
}
|
|
720
726
|
/** Settles with a request's result; rejects on its error. */
|
|
@@ -727,16 +733,30 @@ const settle = (req) => new Promise((resolve, reject) => {
|
|
|
727
733
|
});
|
|
728
734
|
});
|
|
729
735
|
function openDb() {
|
|
730
|
-
const req = indexedDB.open(DB,
|
|
736
|
+
const req = indexedDB.open(DB, 2);
|
|
731
737
|
req.addEventListener("upgradeneeded", () => {
|
|
732
|
-
req.result
|
|
738
|
+
const d = req.result;
|
|
739
|
+
if (!d.objectStoreNames.contains(STORE)) d.createObjectStore(STORE);
|
|
740
|
+
if (!d.objectStoreNames.contains("events")) d.createObjectStore(EVENTS_STORE, {
|
|
741
|
+
keyPath: "id",
|
|
742
|
+
autoIncrement: true
|
|
743
|
+
}).createIndex("session", "session");
|
|
744
|
+
if (!d.objectStoreNames.contains("sessions")) d.createObjectStore(SESSIONS_STORE, { keyPath: "id" });
|
|
733
745
|
});
|
|
734
|
-
|
|
746
|
+
const opened = settle(req).then((d) => {
|
|
747
|
+
d.addEventListener("versionchange", () => {
|
|
748
|
+
d.close();
|
|
749
|
+
db = void 0;
|
|
750
|
+
});
|
|
751
|
+
return d;
|
|
752
|
+
});
|
|
753
|
+
return Promise.race([opened, new Promise((_resolve, reject) => {
|
|
735
754
|
req.addEventListener("blocked", () => {
|
|
736
755
|
reject(/* @__PURE__ */ new Error("indexedDB.open blocked"));
|
|
737
756
|
});
|
|
738
757
|
})]);
|
|
739
758
|
}
|
|
759
|
+
/** The open connection, shared; reset when the database is closed from under it. */
|
|
740
760
|
let db;
|
|
741
761
|
const database = () => {
|
|
742
762
|
db ??= openDb();
|
|
@@ -767,6 +787,402 @@ async function saveUi(s) {
|
|
|
767
787
|
});
|
|
768
788
|
} catch {}
|
|
769
789
|
}
|
|
790
|
+
const UNWELL_STATES = /* @__PURE__ */ new Set([
|
|
791
|
+
"restarting",
|
|
792
|
+
"crashed",
|
|
793
|
+
"blocked"
|
|
794
|
+
]);
|
|
795
|
+
/** `ok` below `warn`, `unwell` below `bad`, `failed` from `bad` up. */
|
|
796
|
+
const by = (value, warn, bad) => value < warn ? "ok" : value < bad ? "unwell" : "failed";
|
|
797
|
+
const max = (xs) => xs.reduce((a, b) => Math.max(a, b), 0);
|
|
798
|
+
const unknown = (id, label) => ({
|
|
799
|
+
id,
|
|
800
|
+
label,
|
|
801
|
+
level: "unknown"
|
|
802
|
+
});
|
|
803
|
+
/** The ring's checks, always `RING_SLOTS` of them: grey ones while there's no data. */
|
|
804
|
+
function checksOf(snap) {
|
|
805
|
+
if (!snap) return Array.from({ length: 12 }, (_, i) => unknown(`c${i}`, "No data yet"));
|
|
806
|
+
const { isolates, pools, bus } = snap;
|
|
807
|
+
const m = bus.metrics;
|
|
808
|
+
const surfaces = isolates.flatMap((i) => i.surface ? [i.surface] : []);
|
|
809
|
+
const memory = isolates.flatMap((i) => i.memory ? [i.memory.bytes] : []);
|
|
810
|
+
const rejected = m ? Object.values(m.rejected).reduce((n, v) => n + (v ?? 0), 0) : 0;
|
|
811
|
+
const storage = m?.storage;
|
|
812
|
+
return [
|
|
813
|
+
{
|
|
814
|
+
id: "isolates",
|
|
815
|
+
label: "Isolates",
|
|
816
|
+
level: isolates.some((i) => i.state === "failed") ? "failed" : isolates.some((i) => UNWELL_STATES.has(i.state)) ? "unwell" : "ok"
|
|
817
|
+
},
|
|
818
|
+
{
|
|
819
|
+
id: "restarts",
|
|
820
|
+
label: "Restarts",
|
|
821
|
+
level: by(max(isolates.map((i) => i.restarts)), 1, 3)
|
|
822
|
+
},
|
|
823
|
+
{
|
|
824
|
+
id: "lag",
|
|
825
|
+
label: "Heartbeat lag",
|
|
826
|
+
level: by(max(isolates.map((i) => i.lagMs)), 100, 500)
|
|
827
|
+
},
|
|
828
|
+
{
|
|
829
|
+
id: "holds",
|
|
830
|
+
label: "Held isolates",
|
|
831
|
+
level: by(max(isolates.flatMap((i) => (i.holds ?? []).map((h) => h.ageMs))), 1, 1e3)
|
|
832
|
+
},
|
|
833
|
+
{
|
|
834
|
+
id: "errors",
|
|
835
|
+
label: "Isolate errors",
|
|
836
|
+
level: isolates.some((i) => i.error !== void 0) ? "unwell" : "ok"
|
|
837
|
+
},
|
|
838
|
+
{
|
|
839
|
+
id: "frames",
|
|
840
|
+
label: "Dropped or rejected updates",
|
|
841
|
+
level: surfaces.some((s) => s.dropped + s.rejected > 0) ? "unwell" : "ok"
|
|
842
|
+
},
|
|
843
|
+
{
|
|
844
|
+
id: "bus",
|
|
845
|
+
label: "Bus",
|
|
846
|
+
level: bus.state === "running" ? "ok" : bus.state === "failed" ? "failed" : bus.state === "starting" || bus.state === "loading" ? "unknown" : "unwell"
|
|
847
|
+
},
|
|
848
|
+
m ? {
|
|
849
|
+
id: "rejected",
|
|
850
|
+
label: "Rejected publishes",
|
|
851
|
+
level: by(rejected, 1, 100)
|
|
852
|
+
} : unknown("rejected", "Rejected publishes"),
|
|
853
|
+
m ? {
|
|
854
|
+
id: "consumers",
|
|
855
|
+
label: "Consumer lag",
|
|
856
|
+
level: by(max(m.subscriptions.map((s) => s.lag)), 100, 1e3)
|
|
857
|
+
} : unknown("consumers", "Consumer lag"),
|
|
858
|
+
storage ? {
|
|
859
|
+
id: "storage",
|
|
860
|
+
label: "Storage",
|
|
861
|
+
level: by(storage.usage / Math.max(1, storage.quota), .7, .9)
|
|
862
|
+
} : unknown("storage", "Storage"),
|
|
863
|
+
{
|
|
864
|
+
id: "pools",
|
|
865
|
+
label: "Pools",
|
|
866
|
+
level: pools.some((p) => !p.running) ? "unwell" : "ok"
|
|
867
|
+
},
|
|
868
|
+
memory.length > 0 ? {
|
|
869
|
+
id: "memory",
|
|
870
|
+
label: "Memory",
|
|
871
|
+
level: "ok"
|
|
872
|
+
} : unknown("memory", "Memory")
|
|
873
|
+
];
|
|
874
|
+
}
|
|
875
|
+
const levelOf = (state) => state === "failed" ? "failed" : UNWELL_STATES.has(state) ? "unwell" : state === "loading" || state === "starting" ? "unknown" : "ok";
|
|
876
|
+
const RANK = {
|
|
877
|
+
failed: 3,
|
|
878
|
+
unwell: 2,
|
|
879
|
+
ok: 1,
|
|
880
|
+
unknown: 0
|
|
881
|
+
};
|
|
882
|
+
/**
|
|
883
|
+
* The ring: the isolates in the order they were spawned, shared out over
|
|
884
|
+
* `RING_SLOTS` arcs (a few to an arc when there are many, one isolate over
|
|
885
|
+
* several arcs when there are few), each arc the worst state among its own.
|
|
886
|
+
* A crash lights the arc its isolate is in, so where on the ring tells you
|
|
887
|
+
* roughly which one.
|
|
888
|
+
*/
|
|
889
|
+
function arcsOf(snap) {
|
|
890
|
+
const list = snap?.isolates ?? [];
|
|
891
|
+
const n = list.length;
|
|
892
|
+
return Array.from({ length: 12 }, (_, i) => {
|
|
893
|
+
if (n === 0) return {
|
|
894
|
+
id: `a${i}`,
|
|
895
|
+
label: "No isolates yet",
|
|
896
|
+
level: "unknown"
|
|
897
|
+
};
|
|
898
|
+
const from = Math.floor(i * n / 12);
|
|
899
|
+
const to = Math.max(from + 1, Math.floor((i + 1) * n / 12));
|
|
900
|
+
const members = list.slice(from, to);
|
|
901
|
+
let level = "unknown";
|
|
902
|
+
const bad = [];
|
|
903
|
+
for (const m of members) {
|
|
904
|
+
const l = levelOf(m.state);
|
|
905
|
+
if (RANK[l] > RANK[level]) level = l;
|
|
906
|
+
if (l === "failed" || l === "unwell") bad.push(`${m.id} ${m.state}`);
|
|
907
|
+
}
|
|
908
|
+
const first = members[0]?.id ?? "";
|
|
909
|
+
const last = members.at(-1)?.id ?? "";
|
|
910
|
+
const range = first === last ? first : `${first} … ${last}`;
|
|
911
|
+
return {
|
|
912
|
+
id: `a${i}`,
|
|
913
|
+
label: bad.length > 0 ? `${range}: ${bad.join(", ")}` : range,
|
|
914
|
+
level
|
|
915
|
+
};
|
|
916
|
+
});
|
|
917
|
+
}
|
|
918
|
+
/** A line for the button's label: how many isolates need attention, and which other checks do. */
|
|
919
|
+
function summaryOf(arcs, checks) {
|
|
920
|
+
const bad = arcs.filter((a) => a.level === "failed").length;
|
|
921
|
+
const warn = arcs.filter((a) => a.level === "unwell").length;
|
|
922
|
+
const other = checks.filter((c) => c.id !== "isolates" && (c.level === "failed" || c.level === "unwell"));
|
|
923
|
+
const parts = [
|
|
924
|
+
bad > 0 ? `${bad} of 12 ring sections failed` : "",
|
|
925
|
+
warn > 0 ? `${warn} of 12 ring sections need attention` : "",
|
|
926
|
+
other.length > 0 ? `Also: ${other.map((c) => c.label).join(", ")}` : ""
|
|
927
|
+
].filter(Boolean);
|
|
928
|
+
return parts.length > 0 ? parts.join(". ") : "All checks pass";
|
|
929
|
+
}
|
|
930
|
+
/** The SVG path of arc `i` of `RING_SLOTS` on a circle. Neighbours overlap a hair so no seam shows. */
|
|
931
|
+
function arcPath(i, cx, cy, r) {
|
|
932
|
+
const step = 30;
|
|
933
|
+
const gap = -.8;
|
|
934
|
+
const a0 = (-90 + i * step + gap / 2) * Math.PI / 180;
|
|
935
|
+
const a1 = (-90 + (i + 1) * step - gap / 2) * Math.PI / 180;
|
|
936
|
+
const p = (a) => `${(cx + r * Math.cos(a)).toFixed(2)} ${(cy + r * Math.sin(a)).toFixed(2)}`;
|
|
937
|
+
return `M${p(a0)}A${r} ${r} 0 0 1 ${p(a1)}`;
|
|
938
|
+
}
|
|
939
|
+
/**
|
|
940
|
+
* The pie slice of arc `i` on a circle of radius `r` about (`cx`, `cy`), at the
|
|
941
|
+
* same angles as `arcPath`: the logo filled with these puts each colour on the
|
|
942
|
+
* same side of the button as its arc in the ring.
|
|
943
|
+
*/
|
|
944
|
+
function wedgePath(i, cx, cy, r) {
|
|
945
|
+
const step = 30;
|
|
946
|
+
const over = .8;
|
|
947
|
+
const a0 = (-90 + i * step - over / 2) * Math.PI / 180;
|
|
948
|
+
const a1 = (-90 + (i + 1) * step + over / 2) * Math.PI / 180;
|
|
949
|
+
const p = (a) => `${(cx + r * Math.cos(a)).toFixed(2)} ${(cy + r * Math.sin(a)).toFixed(2)}`;
|
|
950
|
+
return `M${cx} ${cy}L${p(a0)}A${r} ${r} 0 0 1 ${p(a1)}Z`;
|
|
951
|
+
}
|
|
952
|
+
// src/event-level.ts
|
|
953
|
+
const str = (v) => typeof v === "string" ? v : "";
|
|
954
|
+
/** How serious an event is, in the ring's terms: failed is red, a crash or a stall amber. */
|
|
955
|
+
function levelOfEvent(e) {
|
|
956
|
+
switch (e.event) {
|
|
957
|
+
case "isolate:failed":
|
|
958
|
+
case "bus:failed": return "bad";
|
|
959
|
+
case "isolate:crash":
|
|
960
|
+
case "isolate:error":
|
|
961
|
+
case "bus:crash":
|
|
962
|
+
case "bus:recovered":
|
|
963
|
+
case "bus:quota":
|
|
964
|
+
case "bus:durability-degraded":
|
|
965
|
+
case "workers:budget":
|
|
966
|
+
case "agents:unmatched": return "warn";
|
|
967
|
+
case "isolate:ready":
|
|
968
|
+
case "bus:ready": return "good";
|
|
969
|
+
case "isolate:state": {
|
|
970
|
+
const state = str(e.data["state"]);
|
|
971
|
+
if (state === "failed") return "bad";
|
|
972
|
+
if (state === "running") return "good";
|
|
973
|
+
return [
|
|
974
|
+
"blocked",
|
|
975
|
+
"restarting",
|
|
976
|
+
"crashed"
|
|
977
|
+
].includes(state) ? "warn" : "info";
|
|
978
|
+
}
|
|
979
|
+
default: return "info";
|
|
980
|
+
}
|
|
981
|
+
}
|
|
982
|
+
/** What the event is about: its isolate, or the bus. */
|
|
983
|
+
const subjectOf = (e) => {
|
|
984
|
+
const id = str(e.data["id"]);
|
|
985
|
+
if (id) return id;
|
|
986
|
+
return e.event.startsWith("bus:") ? "bus" : "";
|
|
987
|
+
};
|
|
988
|
+
const show = (v) => typeof v === "string" || typeof v === "number" || typeof v === "boolean" ? String(v) : JSON.stringify(v);
|
|
989
|
+
/** One line of what happened. */
|
|
990
|
+
function detailOf(e) {
|
|
991
|
+
const d = e.data;
|
|
992
|
+
if (e.event === "isolate:state") return `${str(d["prev"])} → ${str(d["state"])}`;
|
|
993
|
+
if (e.event === "isolate:crash" || e.event === "isolate:failed" || e.event === "bus:crash") return [str(d["reason"]), str(d["message"])].filter(Boolean).join(": ");
|
|
994
|
+
if (e.event === "isolate:error") return str(d["message"]);
|
|
995
|
+
return Object.entries(d).filter(([k]) => k !== "id").map(([k, v]) => `${k}=${show(v)}`).join(" ");
|
|
996
|
+
}
|
|
997
|
+
// src/event-store.ts
|
|
998
|
+
const PER_SESSION = 6e3;
|
|
999
|
+
/** How long events wait to be written together. Problems are written at once. */
|
|
1000
|
+
const FLUSH_MS = 250;
|
|
1001
|
+
const isSession = (v) => typeof v === "object" && v !== null && typeof Reflect.get(v, "id") === "string" && typeof Reflect.get(v, "started") === "number";
|
|
1002
|
+
const isRow = (v) => typeof v === "object" && v !== null && typeof Reflect.get(v, "at") === "number" && typeof Reflect.get(v, "event") === "string" && typeof Reflect.get(v, "wall") === "number" && ["number", "undefined"].includes(typeof Reflect.get(v, "n")) && typeof Reflect.get(v, "data") === "object";
|
|
1003
|
+
const keyOf = (e) => `${e.at} ${e.event} ${JSON.stringify(e.data)}`;
|
|
1004
|
+
const done = (tx) => new Promise((resolve) => {
|
|
1005
|
+
for (const type of [
|
|
1006
|
+
"complete",
|
|
1007
|
+
"error",
|
|
1008
|
+
"abort"
|
|
1009
|
+
]) tx.addEventListener(type, () => {
|
|
1010
|
+
resolve();
|
|
1011
|
+
});
|
|
1012
|
+
});
|
|
1013
|
+
function createRecorder() {
|
|
1014
|
+
const session = `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
1015
|
+
const started = Date.now();
|
|
1016
|
+
/** This session's events, oldest first. */
|
|
1017
|
+
let mem = [];
|
|
1018
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1019
|
+
let pending = [];
|
|
1020
|
+
let timer;
|
|
1021
|
+
let written = 0;
|
|
1022
|
+
let seq = 0;
|
|
1023
|
+
let acked = 0;
|
|
1024
|
+
let ready;
|
|
1025
|
+
/** Opens storage, notes this session and drops the sessions beyond the last few before it. */
|
|
1026
|
+
const open = () => {
|
|
1027
|
+
ready ??= (async () => {
|
|
1028
|
+
try {
|
|
1029
|
+
const tx = (await database()).transaction([SESSIONS_STORE, EVENTS_STORE], "readwrite");
|
|
1030
|
+
const sessions = tx.objectStore(SESSIONS_STORE);
|
|
1031
|
+
sessions.put({
|
|
1032
|
+
id: session,
|
|
1033
|
+
started
|
|
1034
|
+
});
|
|
1035
|
+
const old = (await settle(sessions.getAll())).filter(isSession).toSorted((a, b) => b.started - a.started).slice(4);
|
|
1036
|
+
const events = tx.objectStore(EVENTS_STORE).index("session");
|
|
1037
|
+
for (const s of old) {
|
|
1038
|
+
sessions.delete(s.id);
|
|
1039
|
+
const cursor = events.openKeyCursor(IDBKeyRange.only(s.id));
|
|
1040
|
+
cursor.addEventListener("success", () => {
|
|
1041
|
+
const c = cursor.result;
|
|
1042
|
+
if (!c) return;
|
|
1043
|
+
tx.objectStore(EVENTS_STORE).delete(c.primaryKey);
|
|
1044
|
+
c.continue();
|
|
1045
|
+
});
|
|
1046
|
+
}
|
|
1047
|
+
await done(tx);
|
|
1048
|
+
return true;
|
|
1049
|
+
} catch {
|
|
1050
|
+
return false;
|
|
1051
|
+
}
|
|
1052
|
+
})();
|
|
1053
|
+
return ready;
|
|
1054
|
+
};
|
|
1055
|
+
const flush = async () => {
|
|
1056
|
+
timer = void 0;
|
|
1057
|
+
const batch = pending;
|
|
1058
|
+
pending = [];
|
|
1059
|
+
if (batch.length === 0 || !await open()) return;
|
|
1060
|
+
try {
|
|
1061
|
+
const tx = (await database()).transaction(EVENTS_STORE, "readwrite");
|
|
1062
|
+
const store = tx.objectStore(EVENTS_STORE);
|
|
1063
|
+
for (const e of batch) store.add({
|
|
1064
|
+
...e,
|
|
1065
|
+
session
|
|
1066
|
+
});
|
|
1067
|
+
written += batch.length;
|
|
1068
|
+
if (written > 6e3) {
|
|
1069
|
+
let drop = written - PER_SESSION;
|
|
1070
|
+
written = PER_SESSION;
|
|
1071
|
+
const cursor = store.index("session").openKeyCursor(IDBKeyRange.only(session));
|
|
1072
|
+
cursor.addEventListener("success", () => {
|
|
1073
|
+
const c = cursor.result;
|
|
1074
|
+
if (!c || drop <= 0) return;
|
|
1075
|
+
drop -= 1;
|
|
1076
|
+
store.delete(c.primaryKey);
|
|
1077
|
+
c.continue();
|
|
1078
|
+
});
|
|
1079
|
+
}
|
|
1080
|
+
await done(tx);
|
|
1081
|
+
} catch {}
|
|
1082
|
+
};
|
|
1083
|
+
const schedule = (urgent) => {
|
|
1084
|
+
if (urgent) {
|
|
1085
|
+
if (timer !== void 0) clearTimeout(timer);
|
|
1086
|
+
flush();
|
|
1087
|
+
} else timer ??= setTimeout(() => void flush(), FLUSH_MS);
|
|
1088
|
+
};
|
|
1089
|
+
/** Records events not seen yet; the same event arriving twice (live and in a snapshot) counts once. */
|
|
1090
|
+
const add = (events, wall = Date.now()) => {
|
|
1091
|
+
let urgent = false;
|
|
1092
|
+
let changed = false;
|
|
1093
|
+
for (const e of events) {
|
|
1094
|
+
const k = keyOf(e);
|
|
1095
|
+
if (seen.has(k)) continue;
|
|
1096
|
+
seen.add(k);
|
|
1097
|
+
const stored = {
|
|
1098
|
+
...e,
|
|
1099
|
+
wall,
|
|
1100
|
+
n: ++seq
|
|
1101
|
+
};
|
|
1102
|
+
mem.push(stored);
|
|
1103
|
+
pending.push(stored);
|
|
1104
|
+
changed = true;
|
|
1105
|
+
const l = levelOfEvent(e);
|
|
1106
|
+
if (l === "bad" || l === "warn") urgent = true;
|
|
1107
|
+
}
|
|
1108
|
+
if (!changed) return;
|
|
1109
|
+
mem = mem.toSorted((a, b) => a.at - b.at);
|
|
1110
|
+
if (mem.length > 6e3) mem = mem.slice(mem.length - PER_SESSION);
|
|
1111
|
+
schedule(urgent);
|
|
1112
|
+
};
|
|
1113
|
+
return {
|
|
1114
|
+
session,
|
|
1115
|
+
started,
|
|
1116
|
+
add,
|
|
1117
|
+
/** This session's events, oldest first. */
|
|
1118
|
+
events: () => mem,
|
|
1119
|
+
isNew: (e) => (e.n ?? 0) > acked,
|
|
1120
|
+
unacknowledged: () => mem.filter((e) => {
|
|
1121
|
+
const l = levelOfEvent(e);
|
|
1122
|
+
return (l === "bad" || l === "warn") && (e.n ?? 0) > acked;
|
|
1123
|
+
}).length,
|
|
1124
|
+
acknowledge() {
|
|
1125
|
+
acked = seq;
|
|
1126
|
+
},
|
|
1127
|
+
/**
|
|
1128
|
+
* Starts recording from `inspector`: every event as it comes, and the ring
|
|
1129
|
+
* it already holds (what happened before the panel connected).
|
|
1130
|
+
*/
|
|
1131
|
+
start(inspector) {
|
|
1132
|
+
const off = inspector.on((m) => {
|
|
1133
|
+
if (m.t === "event") add([m.p]);
|
|
1134
|
+
});
|
|
1135
|
+
inspector.snapshot().then((s) => {
|
|
1136
|
+
const now = Date.now();
|
|
1137
|
+
for (const e of s.events) add([e], now - Math.max(0, s.at - e.at));
|
|
1138
|
+
}, () => void 0);
|
|
1139
|
+
return off;
|
|
1140
|
+
},
|
|
1141
|
+
/** This and the earlier sessions kept in storage, newest first. */
|
|
1142
|
+
async sessions() {
|
|
1143
|
+
if (!await open()) return [];
|
|
1144
|
+
try {
|
|
1145
|
+
const tx = (await database()).transaction([SESSIONS_STORE, EVENTS_STORE], "readonly");
|
|
1146
|
+
const all = (await settle(tx.objectStore(SESSIONS_STORE).getAll())).filter(isSession);
|
|
1147
|
+
const index = tx.objectStore(EVENTS_STORE).index("session");
|
|
1148
|
+
return await Promise.all(all.toSorted((a, b) => b.started - a.started).map(async (s) => ({
|
|
1149
|
+
id: s.id,
|
|
1150
|
+
started: s.started,
|
|
1151
|
+
count: await settle(index.count(IDBKeyRange.only(s.id)))
|
|
1152
|
+
})));
|
|
1153
|
+
} catch {
|
|
1154
|
+
return [];
|
|
1155
|
+
}
|
|
1156
|
+
},
|
|
1157
|
+
/** One stored session's events, oldest first. */
|
|
1158
|
+
async load(id) {
|
|
1159
|
+
try {
|
|
1160
|
+
const d = await database();
|
|
1161
|
+
return (await settle(d.transaction(EVENTS_STORE, "readonly").objectStore(EVENTS_STORE).index("session").getAll(IDBKeyRange.only(id)))).filter(isRow).map(({ session: _s, id: _i, ...e }) => e);
|
|
1162
|
+
} catch {
|
|
1163
|
+
return [];
|
|
1164
|
+
}
|
|
1165
|
+
},
|
|
1166
|
+
/** Forgets everything stored, this session's and the earlier ones. */
|
|
1167
|
+
async clear() {
|
|
1168
|
+
mem = [];
|
|
1169
|
+
pending = [];
|
|
1170
|
+
seen.clear();
|
|
1171
|
+
written = 0;
|
|
1172
|
+
acked = seq;
|
|
1173
|
+
try {
|
|
1174
|
+
const tx = (await database()).transaction([SESSIONS_STORE, EVENTS_STORE], "readwrite");
|
|
1175
|
+
tx.objectStore(EVENTS_STORE).clear();
|
|
1176
|
+
tx.objectStore(SESSIONS_STORE).clear();
|
|
1177
|
+
tx.objectStore(SESSIONS_STORE).put({
|
|
1178
|
+
id: session,
|
|
1179
|
+
started
|
|
1180
|
+
});
|
|
1181
|
+
await done(tx);
|
|
1182
|
+
} catch {}
|
|
1183
|
+
}
|
|
1184
|
+
};
|
|
1185
|
+
}
|
|
770
1186
|
// ../../node_modules/.pnpm/preact@11.1.1/node_modules/preact/jsx-runtime/dist/jsxRuntime.mjs
|
|
771
1187
|
var f = Symbol.for("pv");
|
|
772
1188
|
var o = 0;
|
|
@@ -912,7 +1328,7 @@ function Rejected(props) {
|
|
|
912
1328
|
});
|
|
913
1329
|
}
|
|
914
1330
|
function BusView(props) {
|
|
915
|
-
const { bus } = props;
|
|
1331
|
+
const { bus, sub } = props;
|
|
916
1332
|
const m = bus.metrics;
|
|
917
1333
|
return /* @__PURE__ */ a("div", {
|
|
918
1334
|
class: "dt-view",
|
|
@@ -933,27 +1349,505 @@ function BusView(props) {
|
|
|
933
1349
|
m?.storage ? ` · storage ${bytes(m.storage.usage)} of ${bytes(m.storage.quota)}` : ""
|
|
934
1350
|
]
|
|
935
1351
|
}), m ? /* @__PURE__ */ a(M, { children: [
|
|
936
|
-
/* @__PURE__ */ a(
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
children: "Subscriptions"
|
|
944
|
-
}),
|
|
945
|
-
/* @__PURE__ */ a(Subscriptions, { metrics: m }),
|
|
946
|
-
/* @__PURE__ */ a("h3", {
|
|
947
|
-
class: "dt-h",
|
|
948
|
-
children: "Rejected publishes, since the bus worker started"
|
|
949
|
-
}),
|
|
950
|
-
/* @__PURE__ */ a(Rejected, { metrics: m })
|
|
1352
|
+
sub === "topics" ? /* @__PURE__ */ a(Topics, { metrics: m }) : null,
|
|
1353
|
+
sub === "subscriptions" ? /* @__PURE__ */ a(Subscriptions, { metrics: m }) : null,
|
|
1354
|
+
sub === "rejected" ? /* @__PURE__ */ a(M, { children: [/* @__PURE__ */ a("p", {
|
|
1355
|
+
class: "dt-muted",
|
|
1356
|
+
style: "margin:0 0 4px;",
|
|
1357
|
+
children: "Publishes rejected since the bus worker started."
|
|
1358
|
+
}), /* @__PURE__ */ a(Rejected, { metrics: m })] }) : null
|
|
951
1359
|
] }) : /* @__PURE__ */ a("p", {
|
|
952
1360
|
class: "dt-muted",
|
|
953
1361
|
children: bus.state === "none" ? "No bus: the kernel has no contracts." : "Waiting for bus metrics…"
|
|
954
1362
|
})]
|
|
955
1363
|
});
|
|
956
1364
|
}
|
|
1365
|
+
// src/format.ts
|
|
1366
|
+
const pad$2 = (n) => " ".repeat(n);
|
|
1367
|
+
/**
|
|
1368
|
+
* The text indented like JSON, one member or element to a line. The values are
|
|
1369
|
+
* JSON-like, not always JSON (`Float32Array(50)`, or a preview cut short), so
|
|
1370
|
+
* this walks the text instead of parsing it: strings and anything in
|
|
1371
|
+
* parentheses stay whole, and a cut-off ending is left as it is.
|
|
1372
|
+
*/
|
|
1373
|
+
function pretty(text) {
|
|
1374
|
+
let out = "";
|
|
1375
|
+
let depth = 0;
|
|
1376
|
+
let parens = 0;
|
|
1377
|
+
let fresh = false;
|
|
1378
|
+
for (let i = 0; i < text.length; i++) {
|
|
1379
|
+
const c = text.charAt(i);
|
|
1380
|
+
const wasFresh = fresh;
|
|
1381
|
+
fresh = false;
|
|
1382
|
+
if (c === "\"") {
|
|
1383
|
+
let j = i + 1;
|
|
1384
|
+
while (j < text.length && text.charAt(j) !== "\"") j += text.charAt(j) === "\\" ? 2 : 1;
|
|
1385
|
+
out += text.slice(i, j + 1);
|
|
1386
|
+
i = j;
|
|
1387
|
+
} else if (parens > 0 || c === "(") {
|
|
1388
|
+
if (c === "(") parens++;
|
|
1389
|
+
else if (c === ")") parens--;
|
|
1390
|
+
out += c;
|
|
1391
|
+
} else if (c === "{" || c === "[") {
|
|
1392
|
+
const close = c === "{" ? "}" : "]";
|
|
1393
|
+
if (text.charAt(i + 1) === close) {
|
|
1394
|
+
out += c + close;
|
|
1395
|
+
i++;
|
|
1396
|
+
} else {
|
|
1397
|
+
depth++;
|
|
1398
|
+
out += `${c}\n${pad$2(depth)}`;
|
|
1399
|
+
fresh = true;
|
|
1400
|
+
}
|
|
1401
|
+
} else if (c === "}" || c === "]") {
|
|
1402
|
+
depth = Math.max(0, depth - 1);
|
|
1403
|
+
out += `\n${pad$2(depth)}${c}`;
|
|
1404
|
+
} else if (c === ",") {
|
|
1405
|
+
out += `,\n${pad$2(depth)}`;
|
|
1406
|
+
fresh = true;
|
|
1407
|
+
} else if (c === ":") {
|
|
1408
|
+
out += ": ";
|
|
1409
|
+
fresh = true;
|
|
1410
|
+
} else if (!(wasFresh && /\s/.test(c))) out += c;
|
|
1411
|
+
}
|
|
1412
|
+
return out;
|
|
1413
|
+
}
|
|
1414
|
+
const TOKEN = /("(?:\\.|[^"\\])*")(\s*:)?|\b(?:true|false|null)\b|(?<![\w$.])-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?(?![\w$])/g;
|
|
1415
|
+
/** Splits JSON-like text into parts to colour: keys, strings, numbers, true/false/null. */
|
|
1416
|
+
function highlight(text) {
|
|
1417
|
+
const parts = [];
|
|
1418
|
+
let last = 0;
|
|
1419
|
+
for (const m of text.matchAll(TOKEN)) {
|
|
1420
|
+
const at = m.index;
|
|
1421
|
+
if (at > last) parts.push({ text: text.slice(last, at) });
|
|
1422
|
+
if (m[1] !== void 0) {
|
|
1423
|
+
if (m[2] === void 0) parts.push({
|
|
1424
|
+
text: m[1],
|
|
1425
|
+
kind: "string"
|
|
1426
|
+
});
|
|
1427
|
+
else {
|
|
1428
|
+
parts.push({
|
|
1429
|
+
text: m[1],
|
|
1430
|
+
kind: "key"
|
|
1431
|
+
});
|
|
1432
|
+
parts.push({ text: m[2] });
|
|
1433
|
+
}
|
|
1434
|
+
} else parts.push({
|
|
1435
|
+
text: m[0],
|
|
1436
|
+
kind: /^[-\d]/.test(m[0]) ? "number" : "literal"
|
|
1437
|
+
});
|
|
1438
|
+
last = at + m[0].length;
|
|
1439
|
+
}
|
|
1440
|
+
if (last < text.length) parts.push({ text: text.slice(last) });
|
|
1441
|
+
return parts;
|
|
1442
|
+
}
|
|
1443
|
+
/** What a record is besides its value, as indented JSON (for the Record panel's Copy). */
|
|
1444
|
+
function recordJson(r) {
|
|
1445
|
+
return JSON.stringify({
|
|
1446
|
+
topic: r.topic,
|
|
1447
|
+
offset: r.offset,
|
|
1448
|
+
...r.key === void 0 ? {} : { key: r.key },
|
|
1449
|
+
time: new Date(r.ts).toISOString(),
|
|
1450
|
+
ts: r.ts,
|
|
1451
|
+
producer: r.producer,
|
|
1452
|
+
bytes: r.bytes,
|
|
1453
|
+
truncated: r.truncated,
|
|
1454
|
+
...r.req === void 0 ? {} : { req: r.req }
|
|
1455
|
+
}, null, 2);
|
|
1456
|
+
}
|
|
1457
|
+
// src/events-view.tsx
|
|
1458
|
+
const pad$1 = (n, w = 2) => String(n).padStart(w, "0");
|
|
1459
|
+
/** Time since the page started, as the host's clock has it: m:ss.mmm. */
|
|
1460
|
+
const since = (at) => {
|
|
1461
|
+
const total = Math.max(0, Math.round(at));
|
|
1462
|
+
return `${Math.floor(total / 6e4)}:${pad$1(Math.floor(total / 1e3) % 60)}.${pad$1(total % 1e3, 3)}`;
|
|
1463
|
+
};
|
|
1464
|
+
/** Newest first, each with a key that stays the same while newer events arrive. */
|
|
1465
|
+
function rowsOf(events) {
|
|
1466
|
+
const seen = /* @__PURE__ */ new Map();
|
|
1467
|
+
const oldestFirst = events.map((e) => {
|
|
1468
|
+
const subject = subjectOf(e);
|
|
1469
|
+
const base = `${e.at} ${e.event} ${subject}`;
|
|
1470
|
+
const n = (seen.get(base) ?? 0) + 1;
|
|
1471
|
+
seen.set(base, n);
|
|
1472
|
+
return {
|
|
1473
|
+
key: `${base} ${n}`,
|
|
1474
|
+
e,
|
|
1475
|
+
level: levelOfEvent(e),
|
|
1476
|
+
subject,
|
|
1477
|
+
detail: detailOf(e)
|
|
1478
|
+
};
|
|
1479
|
+
});
|
|
1480
|
+
const rows = [];
|
|
1481
|
+
for (let i = oldestFirst.length - 1; i >= 0; i--) {
|
|
1482
|
+
const r = oldestFirst[i];
|
|
1483
|
+
if (r) rows.push(r);
|
|
1484
|
+
}
|
|
1485
|
+
return rows;
|
|
1486
|
+
}
|
|
1487
|
+
const isProblem = (l) => l === "bad" || l === "warn";
|
|
1488
|
+
const MARK$1 = {
|
|
1489
|
+
bad: "●",
|
|
1490
|
+
warn: "●",
|
|
1491
|
+
good: "●",
|
|
1492
|
+
info: "○"
|
|
1493
|
+
};
|
|
1494
|
+
const PAGE = 500;
|
|
1495
|
+
const when = (ms) => new Date(ms).toLocaleString(void 0, {
|
|
1496
|
+
dateStyle: "short",
|
|
1497
|
+
timeStyle: "medium"
|
|
1498
|
+
});
|
|
1499
|
+
function EventsView(props) {
|
|
1500
|
+
const { recorder } = props;
|
|
1501
|
+
const [filter, setFilter] = d("");
|
|
1502
|
+
const [problems, setProblems] = d(false);
|
|
1503
|
+
const [open, setOpen] = d(/* @__PURE__ */ new Set());
|
|
1504
|
+
const [copied, setCopied] = d(void 0);
|
|
1505
|
+
const [limit, setLimit] = d(PAGE);
|
|
1506
|
+
const [sessions, setSessions] = d([]);
|
|
1507
|
+
const [session, setSession] = d(recorder.session);
|
|
1508
|
+
const [earlier, setEarlier] = d(void 0);
|
|
1509
|
+
const current = session === recorder.session;
|
|
1510
|
+
const refreshSessions = () => {
|
|
1511
|
+
recorder.sessions().then(setSessions);
|
|
1512
|
+
};
|
|
1513
|
+
A(refreshSessions, []);
|
|
1514
|
+
A(() => {
|
|
1515
|
+
let alive = true;
|
|
1516
|
+
setEarlier(void 0);
|
|
1517
|
+
if (!current) recorder.load(session).then((rows) => {
|
|
1518
|
+
if (alive) setEarlier(rows);
|
|
1519
|
+
});
|
|
1520
|
+
return () => {
|
|
1521
|
+
alive = false;
|
|
1522
|
+
};
|
|
1523
|
+
}, [session]);
|
|
1524
|
+
const events = current ? recorder.events() : earlier ?? [];
|
|
1525
|
+
const q = filter.trim().toLowerCase();
|
|
1526
|
+
const all = rowsOf(events);
|
|
1527
|
+
const matching = all.filter((r) => (!problems || r.level === "bad" || r.level === "warn") && (q === "" || `${r.e.event} ${r.subject} ${r.detail}`.toLowerCase().includes(q)));
|
|
1528
|
+
const rows = matching.slice(0, limit);
|
|
1529
|
+
const others = sessions.filter((s) => s.id !== recorder.session);
|
|
1530
|
+
const unseen = recorder.unacknowledged();
|
|
1531
|
+
return /* @__PURE__ */ a("div", {
|
|
1532
|
+
class: "dt-view dt-log",
|
|
1533
|
+
"data-view": "events",
|
|
1534
|
+
children: [
|
|
1535
|
+
/* @__PURE__ */ a("form", {
|
|
1536
|
+
class: "dt-log-bar",
|
|
1537
|
+
onSubmit: (e) => {
|
|
1538
|
+
e.preventDefault();
|
|
1539
|
+
},
|
|
1540
|
+
children: [
|
|
1541
|
+
/* @__PURE__ */ a("input", {
|
|
1542
|
+
type: "text",
|
|
1543
|
+
"aria-label": "Filter the events",
|
|
1544
|
+
placeholder: "Filter, e.g. feed-T1 or crash",
|
|
1545
|
+
value: filter,
|
|
1546
|
+
"data-events-filter": "",
|
|
1547
|
+
onInput: (e) => {
|
|
1548
|
+
setFilter(e.currentTarget.value);
|
|
1549
|
+
setLimit(PAGE);
|
|
1550
|
+
}
|
|
1551
|
+
}),
|
|
1552
|
+
/* @__PURE__ */ a("button", {
|
|
1553
|
+
type: "button",
|
|
1554
|
+
"data-events-problems": "",
|
|
1555
|
+
"aria-pressed": problems ? "true" : "false",
|
|
1556
|
+
onClick: () => {
|
|
1557
|
+
setProblems(!problems);
|
|
1558
|
+
setLimit(PAGE);
|
|
1559
|
+
},
|
|
1560
|
+
children: "Problems only"
|
|
1561
|
+
}),
|
|
1562
|
+
others.length > 0 ? /* @__PURE__ */ a("select", {
|
|
1563
|
+
"aria-label": "Session",
|
|
1564
|
+
"data-events-session": "",
|
|
1565
|
+
value: session,
|
|
1566
|
+
onChange: (e) => {
|
|
1567
|
+
setSession(e.currentTarget.value);
|
|
1568
|
+
setLimit(PAGE);
|
|
1569
|
+
setOpen(/* @__PURE__ */ new Set());
|
|
1570
|
+
},
|
|
1571
|
+
children: [/* @__PURE__ */ a("option", {
|
|
1572
|
+
value: recorder.session,
|
|
1573
|
+
children: "This session"
|
|
1574
|
+
}), others.map((s) => /* @__PURE__ */ a("option", {
|
|
1575
|
+
value: s.id,
|
|
1576
|
+
children: [
|
|
1577
|
+
when(s.started),
|
|
1578
|
+
" · ",
|
|
1579
|
+
s.count,
|
|
1580
|
+
" events"
|
|
1581
|
+
]
|
|
1582
|
+
}, s.id))]
|
|
1583
|
+
}) : null,
|
|
1584
|
+
/* @__PURE__ */ a("button", {
|
|
1585
|
+
type: "button",
|
|
1586
|
+
"data-events-ack": "",
|
|
1587
|
+
disabled: unseen === 0,
|
|
1588
|
+
title: "Mark the problems listed as seen, which clears the count on the tab",
|
|
1589
|
+
onClick: () => {
|
|
1590
|
+
recorder.acknowledge();
|
|
1591
|
+
props.onAck();
|
|
1592
|
+
},
|
|
1593
|
+
children: ["Acknowledge", unseen > 0 ? ` (${unseen})` : ""]
|
|
1594
|
+
}),
|
|
1595
|
+
/* @__PURE__ */ a("button", {
|
|
1596
|
+
type: "button",
|
|
1597
|
+
"data-events-clear": "",
|
|
1598
|
+
title: `Forget the stored events of every session. Kept in this browser (IndexedDB): this session and the last 3 before it, up to ${PER_SESSION} events each.`,
|
|
1599
|
+
onClick: () => {
|
|
1600
|
+
recorder.clear().then(() => {
|
|
1601
|
+
setSession(recorder.session);
|
|
1602
|
+
setOpen(/* @__PURE__ */ new Set());
|
|
1603
|
+
refreshSessions();
|
|
1604
|
+
props.onAck();
|
|
1605
|
+
});
|
|
1606
|
+
},
|
|
1607
|
+
children: "Clear"
|
|
1608
|
+
})
|
|
1609
|
+
]
|
|
1610
|
+
}),
|
|
1611
|
+
/* @__PURE__ */ a("p", {
|
|
1612
|
+
class: "dt-muted",
|
|
1613
|
+
style: "margin:4px 0;",
|
|
1614
|
+
children: [
|
|
1615
|
+
matching.length === all.length ? `${all.length} events` : `${matching.length} of ${all.length} events`,
|
|
1616
|
+
" · newest first · ",
|
|
1617
|
+
current ? "this page session" : `session from ${when(sessions.find((s) => s.id === session)?.started ?? 0)}`,
|
|
1618
|
+
current && all.length >= 6e3 ? ` · the oldest are dropped past ${PER_SESSION}` : ""
|
|
1619
|
+
]
|
|
1620
|
+
}),
|
|
1621
|
+
/* @__PURE__ */ a("div", {
|
|
1622
|
+
class: "dt-log-rows",
|
|
1623
|
+
children: rows.length === 0 ? /* @__PURE__ */ a("p", {
|
|
1624
|
+
class: "dt-muted",
|
|
1625
|
+
children: !current && earlier === void 0 ? "Loading…" : all.length === 0 ? "No events yet." : "No events match."
|
|
1626
|
+
}) : /* @__PURE__ */ a(M, { children: [/* @__PURE__ */ a("table", {
|
|
1627
|
+
class: "dt-table",
|
|
1628
|
+
"data-events-table": "",
|
|
1629
|
+
children: [/* @__PURE__ */ a("thead", { children: /* @__PURE__ */ a("tr", { children: [
|
|
1630
|
+
/* @__PURE__ */ a("th", {
|
|
1631
|
+
class: "dt-c-chev",
|
|
1632
|
+
children: /* @__PURE__ */ a("span", {
|
|
1633
|
+
class: "dt-sr",
|
|
1634
|
+
children: "Details"
|
|
1635
|
+
})
|
|
1636
|
+
}),
|
|
1637
|
+
/* @__PURE__ */ a("th", {
|
|
1638
|
+
class: "dt-c-time",
|
|
1639
|
+
children: "Since start"
|
|
1640
|
+
}),
|
|
1641
|
+
/* @__PURE__ */ a("th", { children: "Event" }),
|
|
1642
|
+
/* @__PURE__ */ a("th", { children: "Isolate" }),
|
|
1643
|
+
/* @__PURE__ */ a("th", { children: "What happened" })
|
|
1644
|
+
] }) }), /* @__PURE__ */ a("tbody", { children: rows.map((r) => {
|
|
1645
|
+
const isOpen = open.has(r.key);
|
|
1646
|
+
const text = JSON.stringify(r.e.data, null, 2);
|
|
1647
|
+
return /* @__PURE__ */ a(M, { children: [/* @__PURE__ */ a("tr", {
|
|
1648
|
+
class: `dt-log-row dt-ev-${r.level}${current && isProblem(r.level) && recorder.isNew(r.e) ? " dt-ev-new" : ""}`,
|
|
1649
|
+
"data-event": r.e.event,
|
|
1650
|
+
"data-level": r.level,
|
|
1651
|
+
"aria-expanded": isOpen ? "true" : "false",
|
|
1652
|
+
onClick: () => {
|
|
1653
|
+
const next = new Set(open);
|
|
1654
|
+
if (isOpen) next.delete(r.key);
|
|
1655
|
+
else next.add(r.key);
|
|
1656
|
+
setOpen(next);
|
|
1657
|
+
},
|
|
1658
|
+
children: [
|
|
1659
|
+
/* @__PURE__ */ a("td", {
|
|
1660
|
+
class: "dt-c-chev",
|
|
1661
|
+
children: /* @__PURE__ */ a("button", {
|
|
1662
|
+
type: "button",
|
|
1663
|
+
class: "dt-chev",
|
|
1664
|
+
"aria-expanded": isOpen ? "true" : "false",
|
|
1665
|
+
"aria-label": isOpen ? "Hide the event" : "Show the event",
|
|
1666
|
+
children: isOpen ? "▾" : "▸"
|
|
1667
|
+
})
|
|
1668
|
+
}),
|
|
1669
|
+
/* @__PURE__ */ a("td", {
|
|
1670
|
+
class: "dt-c-time",
|
|
1671
|
+
title: when(r.e.wall),
|
|
1672
|
+
children: since(r.e.at)
|
|
1673
|
+
}),
|
|
1674
|
+
/* @__PURE__ */ a("td", { children: [
|
|
1675
|
+
/* @__PURE__ */ a("span", {
|
|
1676
|
+
class: "dt-ev-dot",
|
|
1677
|
+
"aria-hidden": "true",
|
|
1678
|
+
children: MARK$1[r.level]
|
|
1679
|
+
}),
|
|
1680
|
+
" ",
|
|
1681
|
+
/* @__PURE__ */ a("code", { children: r.e.event })
|
|
1682
|
+
] }),
|
|
1683
|
+
/* @__PURE__ */ a("td", { children: r.subject }),
|
|
1684
|
+
/* @__PURE__ */ a("td", {
|
|
1685
|
+
class: "dt-vclip",
|
|
1686
|
+
children: r.detail
|
|
1687
|
+
})
|
|
1688
|
+
]
|
|
1689
|
+
}), isOpen ? /* @__PURE__ */ a("tr", {
|
|
1690
|
+
class: "dt-log-detail",
|
|
1691
|
+
"data-event-detail": "",
|
|
1692
|
+
children: /* @__PURE__ */ a("td", {
|
|
1693
|
+
colSpan: 5,
|
|
1694
|
+
children: /* @__PURE__ */ a("div", {
|
|
1695
|
+
class: "dt-detail",
|
|
1696
|
+
children: /* @__PURE__ */ a("div", {
|
|
1697
|
+
class: "dt-detail-part dt-detail-value",
|
|
1698
|
+
children: [/* @__PURE__ */ a("div", {
|
|
1699
|
+
class: "dt-detail-bar",
|
|
1700
|
+
children: [/* @__PURE__ */ a("strong", {
|
|
1701
|
+
class: "dt-detail-h",
|
|
1702
|
+
children: "Data"
|
|
1703
|
+
}), /* @__PURE__ */ a("button", {
|
|
1704
|
+
type: "button",
|
|
1705
|
+
"data-isoloop-copy": text,
|
|
1706
|
+
"data-log-copy": "event",
|
|
1707
|
+
onClick: () => {
|
|
1708
|
+
setCopied(r.key);
|
|
1709
|
+
setTimeout(() => {
|
|
1710
|
+
setCopied((c) => c === r.key ? void 0 : c);
|
|
1711
|
+
}, 1500);
|
|
1712
|
+
},
|
|
1713
|
+
children: copied === r.key ? "Copied" : "Copy"
|
|
1714
|
+
})]
|
|
1715
|
+
}), /* @__PURE__ */ a("pre", {
|
|
1716
|
+
class: "dt-json",
|
|
1717
|
+
children: highlight(text).map((part, i) => /* @__PURE__ */ a("span", {
|
|
1718
|
+
class: part.kind ? `dt-j-${part.kind}` : void 0,
|
|
1719
|
+
children: part.text
|
|
1720
|
+
}, i))
|
|
1721
|
+
})]
|
|
1722
|
+
})
|
|
1723
|
+
})
|
|
1724
|
+
})
|
|
1725
|
+
}) : null] }, r.key);
|
|
1726
|
+
}) })]
|
|
1727
|
+
}), matching.length > rows.length ? /* @__PURE__ */ a("p", {
|
|
1728
|
+
style: "margin:6px 0;",
|
|
1729
|
+
children: /* @__PURE__ */ a("button", {
|
|
1730
|
+
type: "button",
|
|
1731
|
+
class: "dt-more",
|
|
1732
|
+
"data-events-older": "",
|
|
1733
|
+
onClick: () => {
|
|
1734
|
+
setLimit(limit + PAGE);
|
|
1735
|
+
},
|
|
1736
|
+
children: [
|
|
1737
|
+
"Load older (",
|
|
1738
|
+
matching.length - rows.length,
|
|
1739
|
+
" more)"
|
|
1740
|
+
]
|
|
1741
|
+
})
|
|
1742
|
+
}) : null] })
|
|
1743
|
+
})
|
|
1744
|
+
]
|
|
1745
|
+
});
|
|
1746
|
+
}
|
|
1747
|
+
// src/record-detail.tsx
|
|
1748
|
+
const ITEMS = [{
|
|
1749
|
+
id: "value",
|
|
1750
|
+
label: "Value"
|
|
1751
|
+
}, {
|
|
1752
|
+
id: "record",
|
|
1753
|
+
label: "Record"
|
|
1754
|
+
}];
|
|
1755
|
+
function Value(props) {
|
|
1756
|
+
return /* @__PURE__ */ a("pre", {
|
|
1757
|
+
class: "dt-json",
|
|
1758
|
+
children: highlight(props.text).map((part, i) => /* @__PURE__ */ a("span", {
|
|
1759
|
+
class: part.kind ? `dt-j-${part.kind}` : void 0,
|
|
1760
|
+
children: part.text
|
|
1761
|
+
}, i))
|
|
1762
|
+
});
|
|
1763
|
+
}
|
|
1764
|
+
const dim = (v) => /* @__PURE__ */ a("span", {
|
|
1765
|
+
class: "dt-dim",
|
|
1766
|
+
children: v
|
|
1767
|
+
});
|
|
1768
|
+
function Fields(props) {
|
|
1769
|
+
const { r } = props;
|
|
1770
|
+
return /* @__PURE__ */ a(M, { children: [/* @__PURE__ */ a("dl", {
|
|
1771
|
+
class: "dt-rec",
|
|
1772
|
+
children: [
|
|
1773
|
+
[
|
|
1774
|
+
"Time",
|
|
1775
|
+
"mono",
|
|
1776
|
+
new Date(r.ts).toISOString()
|
|
1777
|
+
],
|
|
1778
|
+
[
|
|
1779
|
+
"Topic",
|
|
1780
|
+
"topic",
|
|
1781
|
+
r.topic
|
|
1782
|
+
],
|
|
1783
|
+
[
|
|
1784
|
+
"Offset",
|
|
1785
|
+
"num",
|
|
1786
|
+
String(r.offset)
|
|
1787
|
+
],
|
|
1788
|
+
[
|
|
1789
|
+
"Key",
|
|
1790
|
+
r.key === void 0 ? "" : "str",
|
|
1791
|
+
r.key ?? dim("–")
|
|
1792
|
+
],
|
|
1793
|
+
[
|
|
1794
|
+
"Producer",
|
|
1795
|
+
"",
|
|
1796
|
+
r.producer
|
|
1797
|
+
],
|
|
1798
|
+
[
|
|
1799
|
+
"Size",
|
|
1800
|
+
"num",
|
|
1801
|
+
`${r.bytes} B`
|
|
1802
|
+
],
|
|
1803
|
+
[
|
|
1804
|
+
"Request",
|
|
1805
|
+
"",
|
|
1806
|
+
r.req ? `${r.req.from} · ${r.req.id}${r.req.via ? ` · via ${r.req.via}` : ""}` : dim("–")
|
|
1807
|
+
]
|
|
1808
|
+
].map(([k, kind, v]) => /* @__PURE__ */ a("div", {
|
|
1809
|
+
class: "dt-rec-row",
|
|
1810
|
+
children: [/* @__PURE__ */ a("dt", { children: k }), /* @__PURE__ */ a("dd", {
|
|
1811
|
+
class: kind ? `dt-rec-${kind}` : void 0,
|
|
1812
|
+
children: v
|
|
1813
|
+
})]
|
|
1814
|
+
}, k))
|
|
1815
|
+
}), r.truncated ? /* @__PURE__ */ a("p", {
|
|
1816
|
+
class: "dt-rec-note",
|
|
1817
|
+
children: "The value is cut to a 2 KB preview."
|
|
1818
|
+
}) : null] });
|
|
1819
|
+
}
|
|
1820
|
+
function RecordDetail(props) {
|
|
1821
|
+
const { r } = props;
|
|
1822
|
+
const [copied, setCopied] = d(void 0);
|
|
1823
|
+
const value = pretty(r.preview);
|
|
1824
|
+
const record = recordJson(r);
|
|
1825
|
+
const copy = (p) => /* @__PURE__ */ a("button", {
|
|
1826
|
+
type: "button",
|
|
1827
|
+
"data-isoloop-copy": p === "value" ? value : record,
|
|
1828
|
+
"data-log-copy": p,
|
|
1829
|
+
onClick: () => {
|
|
1830
|
+
setCopied(p);
|
|
1831
|
+
setTimeout(() => {
|
|
1832
|
+
setCopied((c) => c === p ? void 0 : c);
|
|
1833
|
+
}, 1500);
|
|
1834
|
+
},
|
|
1835
|
+
children: copied === p ? "Copied" : "Copy"
|
|
1836
|
+
});
|
|
1837
|
+
return /* @__PURE__ */ a("div", {
|
|
1838
|
+
class: "dt-detail dt-detail-cols",
|
|
1839
|
+
children: ITEMS.map((it) => /* @__PURE__ */ a("section", {
|
|
1840
|
+
class: `dt-detail-part dt-detail-${it.id}`,
|
|
1841
|
+
children: [/* @__PURE__ */ a("div", {
|
|
1842
|
+
class: "dt-detail-bar",
|
|
1843
|
+
children: [/* @__PURE__ */ a("strong", {
|
|
1844
|
+
class: "dt-detail-h",
|
|
1845
|
+
children: it.label
|
|
1846
|
+
}), copy(it.id)]
|
|
1847
|
+
}), it.id === "value" ? /* @__PURE__ */ a(Value, { text: value }) : /* @__PURE__ */ a(Fields, { r })]
|
|
1848
|
+
}, it.id))
|
|
1849
|
+
});
|
|
1850
|
+
}
|
|
957
1851
|
/** Splits the filter into tap patterns: `*` (every topic) when empty. */
|
|
958
1852
|
const patternsOf = (filter) => {
|
|
959
1853
|
const p = filter.split(/[\s,]+/).map((s) => s.trim()).filter((s) => s.length > 0);
|
|
@@ -964,13 +1858,16 @@ const time = (ts) => {
|
|
|
964
1858
|
const d = new Date(ts);
|
|
965
1859
|
return `${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}.${pad(d.getMilliseconds(), 3)}`;
|
|
966
1860
|
};
|
|
967
|
-
|
|
1861
|
+
/** The row's one-line value is coloured once, from its first characters (the cell clips the rest). */
|
|
1862
|
+
const GLANCE = 240;
|
|
1863
|
+
function MessagesView() {
|
|
968
1864
|
const inspector = useIsolate().inspector;
|
|
969
1865
|
const [filter, setFilter] = d("");
|
|
970
1866
|
const [applied, setApplied] = d(["*"]);
|
|
971
1867
|
const [paused, setPaused] = d(false);
|
|
972
1868
|
const [entries, setEntries] = d([]);
|
|
973
1869
|
const [skipped, setSkipped] = d(0);
|
|
1870
|
+
const [open, setOpen] = d(/* @__PURE__ */ new Set());
|
|
974
1871
|
A(() => {
|
|
975
1872
|
if (!inspector || paused) return void 0;
|
|
976
1873
|
let n = 0;
|
|
@@ -985,7 +1882,8 @@ function LogView() {
|
|
|
985
1882
|
n += 1;
|
|
986
1883
|
const entry = {
|
|
987
1884
|
...r,
|
|
988
|
-
n
|
|
1885
|
+
n,
|
|
1886
|
+
glance: highlight(r.preview.slice(0, GLANCE))
|
|
989
1887
|
};
|
|
990
1888
|
setEntries((prev) => [entry, ...prev].slice(0, 200));
|
|
991
1889
|
});
|
|
@@ -995,8 +1893,8 @@ function LogView() {
|
|
|
995
1893
|
paused
|
|
996
1894
|
]);
|
|
997
1895
|
return /* @__PURE__ */ a("div", {
|
|
998
|
-
class: "dt-view",
|
|
999
|
-
"data-view": "
|
|
1896
|
+
class: "dt-view dt-log",
|
|
1897
|
+
"data-view": "messages",
|
|
1000
1898
|
children: [
|
|
1001
1899
|
/* @__PURE__ */ a("form", {
|
|
1002
1900
|
class: "dt-log-bar",
|
|
@@ -1057,76 +1955,202 @@ function LogView() {
|
|
|
1057
1955
|
})
|
|
1058
1956
|
]
|
|
1059
1957
|
}),
|
|
1060
|
-
|
|
1061
|
-
class: "dt-
|
|
1062
|
-
children:
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
/* @__PURE__ */ a("
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
/* @__PURE__ */ a("td", { children: time(r.ts) }),
|
|
1085
|
-
/* @__PURE__ */ a("td", { children: /* @__PURE__ */ a("code", { children: r.topic }) }),
|
|
1086
|
-
/* @__PURE__ */ a("td", {
|
|
1087
|
-
class: "dt-num",
|
|
1088
|
-
children: r.offset
|
|
1958
|
+
/* @__PURE__ */ a("div", {
|
|
1959
|
+
class: "dt-log-rows",
|
|
1960
|
+
children: entries.length === 0 ? /* @__PURE__ */ a("p", {
|
|
1961
|
+
class: "dt-muted",
|
|
1962
|
+
children: "No records yet."
|
|
1963
|
+
}) : /* @__PURE__ */ a("table", {
|
|
1964
|
+
class: "dt-table",
|
|
1965
|
+
"data-log-table": "",
|
|
1966
|
+
children: [/* @__PURE__ */ a("thead", { children: /* @__PURE__ */ a("tr", { children: [
|
|
1967
|
+
/* @__PURE__ */ a("th", {
|
|
1968
|
+
class: "dt-c-chev",
|
|
1969
|
+
children: /* @__PURE__ */ a("span", {
|
|
1970
|
+
class: "dt-sr",
|
|
1971
|
+
children: "Details"
|
|
1972
|
+
})
|
|
1973
|
+
}),
|
|
1974
|
+
/* @__PURE__ */ a("th", {
|
|
1975
|
+
class: "dt-c-time",
|
|
1976
|
+
children: "Time"
|
|
1977
|
+
}),
|
|
1978
|
+
/* @__PURE__ */ a("th", { children: "Topic" }),
|
|
1979
|
+
/* @__PURE__ */ a("th", {
|
|
1980
|
+
class: "dt-num dt-c-offset",
|
|
1981
|
+
children: "Offset"
|
|
1089
1982
|
}),
|
|
1090
|
-
/* @__PURE__ */ a("
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
class: "dt-num",
|
|
1094
|
-
children: [r.bytes, " B"]
|
|
1983
|
+
/* @__PURE__ */ a("th", {
|
|
1984
|
+
class: "dt-c-key",
|
|
1985
|
+
children: "Key"
|
|
1095
1986
|
}),
|
|
1096
|
-
/* @__PURE__ */ a("
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
children:
|
|
1100
|
-
})
|
|
1101
|
-
|
|
1102
|
-
|
|
1987
|
+
/* @__PURE__ */ a("th", { children: "Producer" }),
|
|
1988
|
+
/* @__PURE__ */ a("th", {
|
|
1989
|
+
class: "dt-num dt-c-size",
|
|
1990
|
+
children: "Size"
|
|
1991
|
+
}),
|
|
1992
|
+
/* @__PURE__ */ a("th", { children: "Value" })
|
|
1993
|
+
] }) }), /* @__PURE__ */ a("tbody", { children: entries.map((r) => {
|
|
1994
|
+
const id = `${r.topic} ${r.offset} ${r.n}`;
|
|
1995
|
+
const isOpen = open.has(id);
|
|
1996
|
+
return /* @__PURE__ */ a(M, { children: [/* @__PURE__ */ a("tr", {
|
|
1997
|
+
class: "dt-log-row",
|
|
1998
|
+
"data-log-topic": r.topic,
|
|
1999
|
+
"data-offset": r.offset,
|
|
2000
|
+
"aria-expanded": isOpen ? "true" : "false",
|
|
2001
|
+
onClick: () => {
|
|
2002
|
+
const next = new Set(open);
|
|
2003
|
+
if (isOpen) next.delete(id);
|
|
2004
|
+
else next.add(id);
|
|
2005
|
+
setOpen(next);
|
|
2006
|
+
},
|
|
2007
|
+
children: [
|
|
2008
|
+
/* @__PURE__ */ a("td", {
|
|
2009
|
+
class: "dt-c-chev",
|
|
2010
|
+
children: /* @__PURE__ */ a("button", {
|
|
2011
|
+
type: "button",
|
|
2012
|
+
class: "dt-chev",
|
|
2013
|
+
"aria-expanded": isOpen ? "true" : "false",
|
|
2014
|
+
"aria-label": isOpen ? "Hide the record" : "Show the record",
|
|
2015
|
+
children: isOpen ? "▾" : "▸"
|
|
2016
|
+
})
|
|
2017
|
+
}),
|
|
2018
|
+
/* @__PURE__ */ a("td", {
|
|
2019
|
+
class: "dt-c-time",
|
|
2020
|
+
children: time(r.ts)
|
|
2021
|
+
}),
|
|
2022
|
+
/* @__PURE__ */ a("td", {
|
|
2023
|
+
class: "dt-col-topic",
|
|
2024
|
+
children: /* @__PURE__ */ a("code", { children: r.topic })
|
|
2025
|
+
}),
|
|
2026
|
+
/* @__PURE__ */ a("td", {
|
|
2027
|
+
class: "dt-num dt-c-offset dt-col-num",
|
|
2028
|
+
children: r.offset
|
|
2029
|
+
}),
|
|
2030
|
+
/* @__PURE__ */ a("td", {
|
|
2031
|
+
class: "dt-c-key dt-col-str",
|
|
2032
|
+
title: r.key ?? "",
|
|
2033
|
+
children: r.key ?? ""
|
|
2034
|
+
}),
|
|
2035
|
+
/* @__PURE__ */ a("td", { children: r.producer }),
|
|
2036
|
+
/* @__PURE__ */ a("td", {
|
|
2037
|
+
class: "dt-num dt-c-size",
|
|
2038
|
+
children: [r.bytes, " B"]
|
|
2039
|
+
}),
|
|
2040
|
+
/* @__PURE__ */ a("td", {
|
|
2041
|
+
class: "dt-vclip",
|
|
2042
|
+
children: /* @__PURE__ */ a("code", { children: r.glance.map((part, i) => /* @__PURE__ */ a("span", {
|
|
2043
|
+
class: part.kind ? `dt-j-${part.kind}` : void 0,
|
|
2044
|
+
children: part.text
|
|
2045
|
+
}, i)) })
|
|
2046
|
+
})
|
|
2047
|
+
]
|
|
2048
|
+
}), isOpen ? /* @__PURE__ */ a("tr", {
|
|
2049
|
+
class: "dt-log-detail",
|
|
2050
|
+
"data-log-detail": "",
|
|
2051
|
+
children: /* @__PURE__ */ a("td", {
|
|
2052
|
+
colSpan: 8,
|
|
2053
|
+
children: /* @__PURE__ */ a(RecordDetail, { r })
|
|
2054
|
+
})
|
|
2055
|
+
}) : null] }, id);
|
|
2056
|
+
}) })]
|
|
2057
|
+
})
|
|
1103
2058
|
})
|
|
1104
2059
|
]
|
|
1105
2060
|
});
|
|
1106
2061
|
}
|
|
2062
|
+
// src/subtabs.tsx
|
|
2063
|
+
const subId = (group, id) => `dt-sub-${group}-${id}`;
|
|
2064
|
+
const subPanelId = (group) => `dt-subpanel-${group}`;
|
|
2065
|
+
function SubTabs(props) {
|
|
2066
|
+
const ctx = useIsolate();
|
|
2067
|
+
const buttons = T({});
|
|
2068
|
+
const { items, value } = props;
|
|
2069
|
+
const onKey = (e) => {
|
|
2070
|
+
const step = e.key === "ArrowRight" ? 1 : e.key === "ArrowLeft" ? -1 : 0;
|
|
2071
|
+
if (step === 0) return;
|
|
2072
|
+
const i = items.findIndex((t) => t.id === value);
|
|
2073
|
+
const next = items[(i + step + items.length) % items.length];
|
|
2074
|
+
if (!next) return;
|
|
2075
|
+
props.onChange(next.id);
|
|
2076
|
+
const el = buttons.current[next.id];
|
|
2077
|
+
if (el !== void 0) ctx.host.focus(el).catch(() => void 0);
|
|
2078
|
+
};
|
|
2079
|
+
return /* @__PURE__ */ a("div", {
|
|
2080
|
+
class: "dt-subtabs",
|
|
2081
|
+
role: "tablist",
|
|
2082
|
+
"aria-label": props.label,
|
|
2083
|
+
onKeyDown: onKey,
|
|
2084
|
+
children: items.map((t) => /* @__PURE__ */ a("button", {
|
|
2085
|
+
ref: (el) => {
|
|
2086
|
+
buttons.current[t.id] = el ?? void 0;
|
|
2087
|
+
},
|
|
2088
|
+
id: subId(props.group, t.id),
|
|
2089
|
+
type: "button",
|
|
2090
|
+
role: "tab",
|
|
2091
|
+
"data-subtab": t.id,
|
|
2092
|
+
"aria-selected": value === t.id ? "true" : "false",
|
|
2093
|
+
"aria-controls": subPanelId(props.group),
|
|
2094
|
+
tabindex: value === t.id ? 0 : -1,
|
|
2095
|
+
class: "dt-subtab",
|
|
2096
|
+
onClick: () => {
|
|
2097
|
+
props.onChange(t.id);
|
|
2098
|
+
},
|
|
2099
|
+
children: [t.label, t.count === void 0 ? null : /* @__PURE__ */ a("span", {
|
|
2100
|
+
class: "dt-subcount",
|
|
2101
|
+
children: t.count
|
|
2102
|
+
})]
|
|
2103
|
+
}, t.id))
|
|
2104
|
+
});
|
|
2105
|
+
}
|
|
1107
2106
|
// src/views.tsx
|
|
1108
2107
|
/** How long the block control busy-loops an isolate's worker. */
|
|
1109
2108
|
const BLOCK_MS = 2e3;
|
|
1110
2109
|
const CSS = `
|
|
1111
|
-
.dt-
|
|
2110
|
+
.dt-root { display: flex; flex-direction: column; flex: 1; min-height: 0; }
|
|
2111
|
+
.dt-nav { background: #0b1220; }
|
|
2112
|
+
.dt-scroll { flex: 1; min-height: 0; overflow: auto; }
|
|
2113
|
+
/* The log keeps its toolbar in place and scrolls only its rows. */
|
|
2114
|
+
.dt-scroll-fill { display: flex; flex-direction: column; overflow: hidden; }
|
|
2115
|
+
.dt-tabs { display: flex; gap: 2px; padding: 4px 12px 0; border-bottom: 1px solid #374151; }
|
|
2116
|
+
.dt-subtabs { display: flex; gap: 4px; padding: 4px 12px; background: #0f1a2e;
|
|
2117
|
+
border-bottom: 1px solid #1f2937; }
|
|
2118
|
+
.dt-subtab { background: none; border: 1px solid transparent; border-radius: 999px; color: #8b95a7;
|
|
2119
|
+
font: inherit; font-size: 11px; padding: 1px 9px; cursor: pointer; }
|
|
2120
|
+
.dt-subtab:hover { color: #e5e7eb; }
|
|
2121
|
+
.dt-subtab[aria-selected="true"] { background: #1e293b; border-color: #334155; color: #e5e7eb; }
|
|
2122
|
+
.dt-subtab:focus-visible { outline: 2px solid #60a5fa; outline-offset: 1px; }
|
|
2123
|
+
.dt-subcount { margin-left: 5px; color: #64748b; font-variant-numeric: tabular-nums; }
|
|
2124
|
+
.dt-subtab[aria-selected="true"] .dt-subcount { color: #93c5fd; }
|
|
1112
2125
|
.dt-tab { background: none; border: 0; border-bottom: 2px solid transparent; color: #9ca3af;
|
|
1113
2126
|
font: inherit; padding: 4px 8px; cursor: pointer; }
|
|
1114
2127
|
.dt-tab[aria-selected="true"] { color: #e5e7eb; border-bottom-color: #60a5fa; }
|
|
1115
|
-
.dt-view { padding: 6px
|
|
2128
|
+
.dt-view { padding: 6px 12px; }
|
|
1116
2129
|
.dt-muted { color: #9ca3af; }
|
|
1117
2130
|
.dt-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
|
|
1118
|
-
.dt-table th { text-align: left; font-weight: 600; color: #9ca3af; padding: 2px
|
|
2131
|
+
.dt-table th { text-align: left; font-weight: 600; color: #9ca3af; padding: 2px 12px 4px 0;
|
|
1119
2132
|
white-space: nowrap; }
|
|
1120
|
-
.dt-table td { padding: 3px
|
|
2133
|
+
.dt-table td { padding: 3px 12px 3px 0; border-top: 1px solid #1f2937; vertical-align: top;
|
|
1121
2134
|
white-space: nowrap; }
|
|
2135
|
+
.dt-table th { position: sticky; top: 0; z-index: 1; background: #111827; box-shadow: 0 1px 0 #374151; }
|
|
1122
2136
|
.dt-table td.dt-num, .dt-table th.dt-num { text-align: right; }
|
|
2137
|
+
.dt-chips { display: flex; flex-wrap: wrap; gap: 3px; }
|
|
2138
|
+
.dt-chip { background: #1f2937; border: 1px solid #374151; border-radius: 4px; padding: 0 5px;
|
|
2139
|
+
font-size: 11px; color: #d1d5db; }
|
|
2140
|
+
.dt-more { background: none; border: 1px dashed #4b5563; border-radius: 4px; color: #93c5fd;
|
|
2141
|
+
font: inherit; font-size: 11px; padding: 0 5px; cursor: pointer; }
|
|
2142
|
+
.dt-more:focus-visible { outline: 2px solid #60a5fa; outline-offset: 1px; }
|
|
2143
|
+
.dt-pool-note { margin-top: 3px; font-size: 11px; }
|
|
1123
2144
|
.dt-badge { display: inline-block; margin-left: 4px; padding: 0 4px; border-radius: 3px;
|
|
1124
2145
|
background: #1e3a8a; color: #bfdbfe; font-size: 10px; }
|
|
2146
|
+
/* The Events tab's count of problems: amber, like the ring's arcs. */
|
|
2147
|
+
.dt-badge-warn { background: #f59e0b; color: #111827; font-weight: 600; }
|
|
1125
2148
|
.dt-pool { display: block; color: #9ca3af; font-size: 11px; }
|
|
1126
2149
|
.dt-state-running { color: #86efac; }
|
|
1127
2150
|
.dt-state-blocked, .dt-state-crashed, .dt-state-restarting { color: #fcd34d; }
|
|
1128
2151
|
.dt-state-failed { color: #fca5a5; }
|
|
1129
|
-
.dt-actions { display: flex; gap: 4px; }
|
|
2152
|
+
.dt-actions { display: flex; justify-content: center; gap: 4px; }
|
|
2153
|
+
.dt-table th.dt-center { text-align: center; }
|
|
1130
2154
|
.dt-actions button { background: #1f2937; color: #e5e7eb; border: 1px solid #374151;
|
|
1131
2155
|
border-radius: 4px; font: inherit; font-size: 11px; padding: 1px 6px; cursor: pointer; }
|
|
1132
2156
|
.dt-actions button:focus-visible, .dt-tab:focus-visible { outline: 2px solid #60a5fa;
|
|
@@ -1135,14 +2159,80 @@ const CSS = `
|
|
|
1135
2159
|
.dt-h { margin: 10px 0 4px; font-size: 12px; color: #9ca3af; }
|
|
1136
2160
|
.dt-warning { color: #fcd34d; }
|
|
1137
2161
|
.dt-state-none { color: #9ca3af; }
|
|
1138
|
-
.dt-log
|
|
1139
|
-
.dt-log-
|
|
2162
|
+
.dt-log { display: flex; flex-direction: column; flex: 1; min-height: 0; }
|
|
2163
|
+
.dt-log-rows { flex: 1; min-height: 0; overflow: auto; container-type: inline-size; }
|
|
2164
|
+
/* The detail keeps the width you can see, so a wide table doesn't push its panels out of view. */
|
|
2165
|
+
.dt-detail { position: sticky; left: 0; width: calc(100cqw - 16px); box-sizing: border-box; }
|
|
2166
|
+
.dt-log-bar { display: flex; flex-wrap: wrap; align-items: stretch; gap: 4px; }
|
|
2167
|
+
.dt-log-bar input { flex: 1 1 9em; min-width: 9em; box-sizing: border-box; background: #0b1220; color: #e5e7eb;
|
|
1140
2168
|
border: 1px solid #374151; border-radius: 4px; font: inherit; padding: 2px 6px; }
|
|
1141
|
-
.dt-log-bar button { background: #1f2937; color: #e5e7eb; border: 1px solid #374151;
|
|
2169
|
+
.dt-log-bar button { white-space: nowrap; box-sizing: border-box; background: #1f2937; color: #e5e7eb; border: 1px solid #374151;
|
|
1142
2170
|
border-radius: 4px; font: inherit; font-size: 11px; padding: 1px 8px; cursor: pointer; }
|
|
1143
|
-
.dt-log-bar
|
|
2171
|
+
.dt-log-bar select { box-sizing: border-box; background: #1f2937; color: #e5e7eb; border: 1px solid #374151;
|
|
2172
|
+
border-radius: 4px; font: inherit; font-size: 11px; padding: 1px 4px; max-width: 14em; }
|
|
2173
|
+
.dt-log-bar input:focus-visible, .dt-log-bar select:focus-visible, .dt-log-bar button:focus-visible { outline: 2px solid #60a5fa;
|
|
1144
2174
|
outline-offset: 1px; }
|
|
1145
2175
|
.dt-table td.dt-value { white-space: normal; word-break: break-all; max-width: 40ch; }
|
|
2176
|
+
/* The log's columns with a known width keep it; the value takes the rest, on one line. */
|
|
2177
|
+
.dt-table .dt-c-time { width: 12ch; min-width: 12ch; }
|
|
2178
|
+
.dt-table .dt-c-offset { width: 7ch; min-width: 7ch; }
|
|
2179
|
+
.dt-table .dt-c-size { width: 9ch; min-width: 9ch; }
|
|
2180
|
+
.dt-table .dt-c-key { width: 12ch; min-width: 12ch; max-width: 12ch; overflow: hidden;
|
|
2181
|
+
text-overflow: ellipsis; }
|
|
2182
|
+
.dt-table td.dt-vclip { width: 100%; max-width: 0; overflow: hidden; text-overflow: ellipsis; }
|
|
2183
|
+
.dt-table .dt-c-chev { width: 18px; min-width: 18px; padding-right: 0; }
|
|
2184
|
+
.dt-chev { background: none; border: 0; color: #6b7280; font: inherit; font-size: 11px;
|
|
2185
|
+
padding: 0; width: 16px; cursor: pointer; }
|
|
2186
|
+
.dt-log-row:hover .dt-chev, .dt-log-row[aria-expanded="true"] .dt-chev { color: #e5e7eb; }
|
|
2187
|
+
.dt-chev:focus-visible { outline: 2px solid #60a5fa; outline-offset: 1px; }
|
|
2188
|
+
.dt-sr { position: absolute; width: 1px; height: 1px; overflow: hidden;
|
|
2189
|
+
clip: rect(0 0 0 0); white-space: nowrap; }
|
|
2190
|
+
.dt-log-row { cursor: pointer; }
|
|
2191
|
+
.dt-ev-new td:first-child { box-shadow: inset 3px 0 0 #f59e0b; }
|
|
2192
|
+
.dt-log-bar button:disabled { opacity: 0.45; cursor: default; }
|
|
2193
|
+
.dt-ev-bad .dt-ev-dot { color: #ef4444; }
|
|
2194
|
+
.dt-ev-warn .dt-ev-dot { color: #f59e0b; }
|
|
2195
|
+
.dt-ev-good .dt-ev-dot { color: #22c55e; }
|
|
2196
|
+
.dt-ev-info .dt-ev-dot { color: #64748b; }
|
|
2197
|
+
.dt-ev-bad td.dt-vclip { color: #fca5a5; }
|
|
2198
|
+
.dt-ev-warn td.dt-vclip { color: #fcd34d; }
|
|
2199
|
+
.dt-log-row:hover { background: #172033; }
|
|
2200
|
+
.dt-log-row[aria-expanded="true"] { background: #172033; }
|
|
2201
|
+
.dt-table tr.dt-log-detail td { white-space: normal; background: #0b1220; padding: 6px 8px; }
|
|
2202
|
+
.dt-detail-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
|
|
2203
|
+
.dt-detail-bar .dt-subtabs { background: none; border: 0; padding: 0; }
|
|
2204
|
+
.dt-detail-bar button[data-log-copy] { background: #1f2937; color: #e5e7eb; border: 1px solid #374151;
|
|
2205
|
+
border-radius: 4px; font: inherit; font-size: 11px; padding: 1px 8px; cursor: pointer; }
|
|
2206
|
+
.dt-detail-bar button[data-log-copy]:focus-visible { outline: 2px solid #60a5fa; outline-offset: 1px; }
|
|
2207
|
+
.dt-detail-h { color: #9ca3af; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
|
|
2208
|
+
.dt-detail-cols { display: flex; flex-wrap: wrap; align-items: stretch; gap: 8px; }
|
|
2209
|
+
.dt-detail-part { box-sizing: border-box; min-width: 0; background: #0f1a2e; border: 1px solid #1f2937;
|
|
2210
|
+
border-left-width: 3px; border-radius: 6px; padding: 6px 10px 8px; }
|
|
2211
|
+
.dt-detail-value { flex: 1 1 260px; border-left-color: #4ade80; }
|
|
2212
|
+
/* The record is as wide as its content, up to 30% of what you can see. */
|
|
2213
|
+
.dt-detail-record { flex: 0 1 auto; width: max-content; max-width: 30%; min-width: 200px;
|
|
2214
|
+
border-left-color: #60a5fa; }
|
|
2215
|
+
.dt-rec { margin: 0; }
|
|
2216
|
+
.dt-rec-row { display: grid; grid-template-columns: 4.5em 1fr; gap: 0 12px; padding: 3px 0;
|
|
2217
|
+
border-top: 1px solid #1c2a40; }
|
|
2218
|
+
.dt-rec-row:first-child { border-top: 0; }
|
|
2219
|
+
.dt-rec dt { color: #8b95a7; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
|
|
2220
|
+
padding-top: 1px; }
|
|
2221
|
+
.dt-rec dd { margin: 0; color: #e5e7eb; word-break: break-word; }
|
|
2222
|
+
.dt-rec-mono, .dt-rec-topic, .dt-rec-num, .dt-rec-str { font: 11px/1.5 ui-monospace, SFMono-Regular,
|
|
2223
|
+
Menlo, monospace; }
|
|
2224
|
+
.dt-rec-topic, .dt-col-topic { color: #93c5fd; }
|
|
2225
|
+
.dt-rec-num, .dt-col-num { color: #fcd34d; }
|
|
2226
|
+
.dt-rec-str, .dt-col-str { color: #86efac; }
|
|
2227
|
+
.dt-dim { color: #64748b; }
|
|
2228
|
+
.dt-rec-note { margin: 4px 0 0; color: #9ca3af; font-size: 11px; }
|
|
2229
|
+
.dt-json { margin: 0; max-height: 240px; overflow: auto; white-space: pre-wrap;
|
|
2230
|
+
word-break: break-word; font: 11px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
2231
|
+
color: #d1d5db; }
|
|
2232
|
+
.dt-j-key { color: #93c5fd; }
|
|
2233
|
+
.dt-j-string { color: #86efac; }
|
|
2234
|
+
.dt-j-number { color: #fcd34d; }
|
|
2235
|
+
.dt-j-literal { color: #c4b5fd; }
|
|
1146
2236
|
`;
|
|
1147
2237
|
const ms = (n) => n === void 0 ? "–" : `${Math.round(n)} ms`;
|
|
1148
2238
|
const mb = (bytes) => `${(bytes / 1048576).toFixed(1)} MB`;
|
|
@@ -1272,10 +2362,74 @@ function IsolateRow(props) {
|
|
|
1272
2362
|
]
|
|
1273
2363
|
});
|
|
1274
2364
|
}
|
|
2365
|
+
/** How many members a pool row lists before "+N more". */
|
|
2366
|
+
const POOL_PREVIEW = 8;
|
|
2367
|
+
function PoolRow(props) {
|
|
2368
|
+
const { pool: p } = props;
|
|
2369
|
+
const [all, setAll] = d(false);
|
|
2370
|
+
const shown = all ? p.members : p.members.slice(0, POOL_PREVIEW);
|
|
2371
|
+
const rest = p.members.length - shown.length;
|
|
2372
|
+
return /* @__PURE__ */ a("tr", {
|
|
2373
|
+
"data-pool": p.name,
|
|
2374
|
+
children: [
|
|
2375
|
+
/* @__PURE__ */ a("td", { children: /* @__PURE__ */ a("code", { children: p.name }) }),
|
|
2376
|
+
/* @__PURE__ */ a("td", {
|
|
2377
|
+
class: p.running ? "dt-state-running" : "dt-state-failed",
|
|
2378
|
+
children: p.running ? "running" : "stopped"
|
|
2379
|
+
}),
|
|
2380
|
+
/* @__PURE__ */ a("td", {
|
|
2381
|
+
class: "dt-num",
|
|
2382
|
+
children: p.members.length
|
|
2383
|
+
}),
|
|
2384
|
+
/* @__PURE__ */ a("td", {
|
|
2385
|
+
style: "white-space:normal;",
|
|
2386
|
+
children: [/* @__PURE__ */ a("div", {
|
|
2387
|
+
class: "dt-chips",
|
|
2388
|
+
children: [shown.map((m) => /* @__PURE__ */ a("span", {
|
|
2389
|
+
class: "dt-chip",
|
|
2390
|
+
children: m
|
|
2391
|
+
}, m)), p.members.length > POOL_PREVIEW ? /* @__PURE__ */ a("button", {
|
|
2392
|
+
type: "button",
|
|
2393
|
+
class: "dt-more",
|
|
2394
|
+
"data-pool-more": p.name,
|
|
2395
|
+
"aria-expanded": all ? "true" : "false",
|
|
2396
|
+
onClick: () => {
|
|
2397
|
+
setAll(!all);
|
|
2398
|
+
},
|
|
2399
|
+
children: all ? "Show fewer" : `+${rest} more`
|
|
2400
|
+
}) : null]
|
|
2401
|
+
}), p.warning === void 0 ? null : /* @__PURE__ */ a("div", {
|
|
2402
|
+
class: "dt-pool-note dt-warning",
|
|
2403
|
+
children: ["⚠ ", p.warning]
|
|
2404
|
+
})]
|
|
2405
|
+
})
|
|
2406
|
+
]
|
|
2407
|
+
});
|
|
2408
|
+
}
|
|
2409
|
+
function PoolsTable(props) {
|
|
2410
|
+
return /* @__PURE__ */ a("table", {
|
|
2411
|
+
class: "dt-table",
|
|
2412
|
+
"data-view": "pools",
|
|
2413
|
+
children: [/* @__PURE__ */ a("thead", { children: /* @__PURE__ */ a("tr", { children: [
|
|
2414
|
+
/* @__PURE__ */ a("th", { children: "Pool" }),
|
|
2415
|
+
/* @__PURE__ */ a("th", { children: "Worker" }),
|
|
2416
|
+
/* @__PURE__ */ a("th", {
|
|
2417
|
+
class: "dt-num",
|
|
2418
|
+
children: "Isolates"
|
|
2419
|
+
}),
|
|
2420
|
+
/* @__PURE__ */ a("th", { children: "Members" })
|
|
2421
|
+
] }) }), /* @__PURE__ */ a("tbody", { children: props.snap.pools.map((p) => /* @__PURE__ */ a(PoolRow, { pool: p }, p.name)) })]
|
|
2422
|
+
});
|
|
2423
|
+
}
|
|
1275
2424
|
function IsolatesView(props) {
|
|
1276
2425
|
const ctx = useIsolate();
|
|
1277
2426
|
const [error, setError] = d(void 0);
|
|
1278
|
-
const { snap } = props;
|
|
2427
|
+
const { snap, sub } = props;
|
|
2428
|
+
if (sub === "pools") return /* @__PURE__ */ a("div", {
|
|
2429
|
+
class: "dt-view",
|
|
2430
|
+
"data-view": "isolates",
|
|
2431
|
+
children: /* @__PURE__ */ a(PoolsTable, { snap })
|
|
2432
|
+
});
|
|
1279
2433
|
return /* @__PURE__ */ a("div", {
|
|
1280
2434
|
class: "dt-view",
|
|
1281
2435
|
"data-view": "isolates",
|
|
@@ -1315,7 +2469,10 @@ function IsolatesView(props) {
|
|
|
1315
2469
|
class: "dt-num",
|
|
1316
2470
|
children: "Queue"
|
|
1317
2471
|
}),
|
|
1318
|
-
/* @__PURE__ */ a("th", {
|
|
2472
|
+
/* @__PURE__ */ a("th", {
|
|
2473
|
+
class: "dt-center",
|
|
2474
|
+
children: "Actions"
|
|
2475
|
+
})
|
|
1319
2476
|
] }) }), /* @__PURE__ */ a("tbody", { children: snap.isolates.map((i) => /* @__PURE__ */ a(IsolateRow, {
|
|
1320
2477
|
isolate: i,
|
|
1321
2478
|
self: i.id === ctx.id,
|
|
@@ -1329,32 +2486,7 @@ function IsolatesView(props) {
|
|
|
1329
2486
|
role: "status",
|
|
1330
2487
|
"data-isoloop-devtools-status": "",
|
|
1331
2488
|
children: error
|
|
1332
|
-
})
|
|
1333
|
-
snap.pools.length === 0 ? null : /* @__PURE__ */ a(M, { children: [/* @__PURE__ */ a("h3", {
|
|
1334
|
-
class: "dt-h",
|
|
1335
|
-
children: "Pools"
|
|
1336
|
-
}), /* @__PURE__ */ a("table", {
|
|
1337
|
-
class: "dt-table",
|
|
1338
|
-
"data-view": "pools",
|
|
1339
|
-
children: [/* @__PURE__ */ a("thead", { children: /* @__PURE__ */ a("tr", { children: [
|
|
1340
|
-
/* @__PURE__ */ a("th", { children: "Pool" }),
|
|
1341
|
-
/* @__PURE__ */ a("th", { children: "Members" }),
|
|
1342
|
-
/* @__PURE__ */ a("th", { children: "Worker" })
|
|
1343
|
-
] }) }), /* @__PURE__ */ a("tbody", { children: snap.pools.map((p) => /* @__PURE__ */ a("tr", {
|
|
1344
|
-
"data-pool": p.name,
|
|
1345
|
-
children: [
|
|
1346
|
-
/* @__PURE__ */ a("td", { children: /* @__PURE__ */ a("code", { children: p.name }) }),
|
|
1347
|
-
/* @__PURE__ */ a("td", {
|
|
1348
|
-
style: "white-space:normal;",
|
|
1349
|
-
children: [p.members.join(", "), p.warning === void 0 ? null : /* @__PURE__ */ a("span", {
|
|
1350
|
-
class: "dt-pool dt-warning",
|
|
1351
|
-
children: p.warning
|
|
1352
|
-
})]
|
|
1353
|
-
}),
|
|
1354
|
-
/* @__PURE__ */ a("td", { children: p.running ? "running" : "stopped" })
|
|
1355
|
-
]
|
|
1356
|
-
}, p.name)) })]
|
|
1357
|
-
})] })
|
|
2489
|
+
})
|
|
1358
2490
|
]
|
|
1359
2491
|
});
|
|
1360
2492
|
}
|
|
@@ -1368,8 +2500,12 @@ const TABS = [
|
|
|
1368
2500
|
label: "Bus"
|
|
1369
2501
|
},
|
|
1370
2502
|
{
|
|
1371
|
-
id: "
|
|
1372
|
-
label: "
|
|
2503
|
+
id: "events",
|
|
2504
|
+
label: "Events"
|
|
2505
|
+
},
|
|
2506
|
+
{
|
|
2507
|
+
id: "messages",
|
|
2508
|
+
label: "Messages"
|
|
1373
2509
|
}
|
|
1374
2510
|
];
|
|
1375
2511
|
const tabId = (t) => `dt-tab-${t}`;
|
|
@@ -1377,10 +2513,14 @@ const panelId = (t) => `dt-panel-${t}`;
|
|
|
1377
2513
|
function Body(props) {
|
|
1378
2514
|
const ctx = useIsolate();
|
|
1379
2515
|
const [tab, setTab] = d("isolates");
|
|
2516
|
+
const [isoSub, setIsoSub] = d("isolates");
|
|
2517
|
+
const [busSub, setBusSub] = d("topics");
|
|
1380
2518
|
A(() => {
|
|
1381
2519
|
ctx.styles(CSS);
|
|
1382
2520
|
}, []);
|
|
1383
2521
|
const { snap } = props;
|
|
2522
|
+
const [, setAcks] = d(0);
|
|
2523
|
+
const eventProblems = props.recorder.unacknowledged();
|
|
1384
2524
|
const buttons = T({});
|
|
1385
2525
|
const onKey = (e) => {
|
|
1386
2526
|
const step = e.key === "ArrowRight" ? 1 : e.key === "ArrowLeft" ? -1 : 0;
|
|
@@ -1393,41 +2533,117 @@ function Body(props) {
|
|
|
1393
2533
|
if (el !== void 0) ctx.host.focus(el).catch(() => void 0);
|
|
1394
2534
|
};
|
|
1395
2535
|
let view;
|
|
2536
|
+
let subBar = null;
|
|
2537
|
+
let subGroup = "";
|
|
2538
|
+
let subValue = "";
|
|
1396
2539
|
if (!snap) view = /* @__PURE__ */ a("p", {
|
|
1397
2540
|
class: "dt-view dt-muted",
|
|
1398
2541
|
children: "Waiting for the inspection feed…"
|
|
1399
2542
|
});
|
|
1400
|
-
else if (tab === "bus")
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
onKeyDown: onKey,
|
|
1408
|
-
children: TABS.map((t) => /* @__PURE__ */ a("button", {
|
|
1409
|
-
ref: (el) => {
|
|
1410
|
-
buttons.current[t.id] = el ?? void 0;
|
|
2543
|
+
else if (tab === "bus") {
|
|
2544
|
+
const m = snap.bus.metrics;
|
|
2545
|
+
const items = m ? [
|
|
2546
|
+
{
|
|
2547
|
+
id: "topics",
|
|
2548
|
+
label: "Topics",
|
|
2549
|
+
count: m.topics.length
|
|
1411
2550
|
},
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
"aria-selected": tab === t.id ? "true" : "false",
|
|
1417
|
-
"aria-controls": panelId(t.id),
|
|
1418
|
-
tabindex: tab === t.id ? 0 : -1,
|
|
1419
|
-
class: "dt-tab",
|
|
1420
|
-
onClick: () => {
|
|
1421
|
-
setTab(t.id);
|
|
2551
|
+
{
|
|
2552
|
+
id: "subscriptions",
|
|
2553
|
+
label: "Subscriptions",
|
|
2554
|
+
count: m.subscriptions.length
|
|
1422
2555
|
},
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
2556
|
+
{
|
|
2557
|
+
id: "rejected",
|
|
2558
|
+
label: "Rejected",
|
|
2559
|
+
count: Object.values(m.rejected).reduce((n, v) => n + (typeof v === "number" ? v : 0), 0)
|
|
2560
|
+
}
|
|
2561
|
+
] : [];
|
|
2562
|
+
subGroup = "bus";
|
|
2563
|
+
subValue = busSub;
|
|
2564
|
+
if (items.length > 0) subBar = /* @__PURE__ */ a(SubTabs, {
|
|
2565
|
+
group: "bus",
|
|
2566
|
+
label: "Bus views",
|
|
2567
|
+
items,
|
|
2568
|
+
value: busSub,
|
|
2569
|
+
onChange: setBusSub
|
|
2570
|
+
});
|
|
2571
|
+
view = /* @__PURE__ */ a(BusView, {
|
|
2572
|
+
bus: snap.bus,
|
|
2573
|
+
sub: busSub
|
|
2574
|
+
});
|
|
2575
|
+
} else if (tab === "events") view = /* @__PURE__ */ a(EventsView, {
|
|
2576
|
+
recorder: props.recorder,
|
|
2577
|
+
onAck: () => {
|
|
2578
|
+
setAcks((n) => n + 1);
|
|
2579
|
+
}
|
|
2580
|
+
});
|
|
2581
|
+
else if (tab === "messages") view = /* @__PURE__ */ a(MessagesView, {});
|
|
2582
|
+
else {
|
|
2583
|
+
const hasPools = snap.pools.length > 0;
|
|
2584
|
+
const sub = hasPools ? isoSub : "isolates";
|
|
2585
|
+
const items = [{
|
|
2586
|
+
id: "isolates",
|
|
2587
|
+
label: "Isolates",
|
|
2588
|
+
count: snap.isolates.length
|
|
2589
|
+
}, ...hasPools ? [{
|
|
2590
|
+
id: "pools",
|
|
2591
|
+
label: "Pools",
|
|
2592
|
+
count: snap.pools.length
|
|
2593
|
+
}] : []];
|
|
2594
|
+
subGroup = "isolates";
|
|
2595
|
+
subValue = sub;
|
|
2596
|
+
if (hasPools) subBar = /* @__PURE__ */ a(SubTabs, {
|
|
2597
|
+
group: "isolates",
|
|
2598
|
+
label: "Isolates views",
|
|
2599
|
+
items,
|
|
2600
|
+
value: sub,
|
|
2601
|
+
onChange: setIsoSub
|
|
2602
|
+
});
|
|
2603
|
+
view = /* @__PURE__ */ a(IsolatesView, {
|
|
2604
|
+
snap,
|
|
2605
|
+
sub
|
|
2606
|
+
});
|
|
2607
|
+
}
|
|
2608
|
+
return /* @__PURE__ */ a("div", {
|
|
2609
|
+
class: "dt-root",
|
|
2610
|
+
children: [/* @__PURE__ */ a("div", {
|
|
2611
|
+
class: "dt-nav",
|
|
2612
|
+
children: [/* @__PURE__ */ a("div", {
|
|
2613
|
+
class: "dt-tabs",
|
|
2614
|
+
role: "tablist",
|
|
2615
|
+
"aria-label": "Devtools views",
|
|
2616
|
+
onKeyDown: onKey,
|
|
2617
|
+
children: TABS.map((t) => /* @__PURE__ */ a("button", {
|
|
2618
|
+
ref: (el) => {
|
|
2619
|
+
buttons.current[t.id] = el ?? void 0;
|
|
2620
|
+
},
|
|
2621
|
+
id: tabId(t.id),
|
|
2622
|
+
type: "button",
|
|
2623
|
+
role: "tab",
|
|
2624
|
+
"data-tab": t.id,
|
|
2625
|
+
"aria-selected": tab === t.id ? "true" : "false",
|
|
2626
|
+
"aria-controls": panelId(t.id),
|
|
2627
|
+
tabindex: tab === t.id ? 0 : -1,
|
|
2628
|
+
class: "dt-tab",
|
|
2629
|
+
onClick: () => {
|
|
2630
|
+
setTab(t.id);
|
|
2631
|
+
},
|
|
2632
|
+
children: [t.label, t.id === "events" && eventProblems > 0 ? /* @__PURE__ */ a("span", {
|
|
2633
|
+
class: "dt-badge dt-badge-warn",
|
|
2634
|
+
title: "Problem events you haven't acknowledged",
|
|
2635
|
+
children: eventProblems > 99 ? "99+" : eventProblems
|
|
2636
|
+
}) : null]
|
|
2637
|
+
}, t.id))
|
|
2638
|
+
}), subBar]
|
|
2639
|
+
}), /* @__PURE__ */ a("div", {
|
|
2640
|
+
class: tab === "messages" || tab === "events" ? "dt-scroll dt-scroll-fill" : "dt-scroll",
|
|
2641
|
+
role: "tabpanel",
|
|
2642
|
+
id: subBar ? subPanelId(subGroup) : panelId(tab),
|
|
2643
|
+
"aria-labelledby": subBar ? subId(subGroup, subValue) : tabId(tab),
|
|
2644
|
+
children: view
|
|
2645
|
+
})]
|
|
2646
|
+
});
|
|
1431
2647
|
}
|
|
1432
2648
|
// src/panel.tsx
|
|
1433
2649
|
const POSITIONS = [
|
|
@@ -1439,7 +2655,15 @@ const POSITIONS = [
|
|
|
1439
2655
|
const MIN_WIDTH = 280;
|
|
1440
2656
|
const MIN_HEIGHT = 160;
|
|
1441
2657
|
const GAP = 12;
|
|
2658
|
+
/** The open panel docks flush to the viewport edges, so it can be dragged to the very edge. */
|
|
2659
|
+
const DOCK_GAP = 0;
|
|
2660
|
+
/** Isoloop one-colour mark (logo exploration 6-cube v108), traced to a path. */
|
|
2661
|
+
const MARK = "M33.9 79.4L31.7 79.4L28.4 79.2L26.3 78.8L23.5 78.1L19.9 76.6L17.1 75.0L15.2 73.7L12.5 71.4L10.6 69.3L9.1 67.3L7.7 65.0L6.6 62.1L5.9 59.7L5.4 56.7L5.2 53.3L0.1 53.2L5.4 43.7L6.0 40.3L6.9 36.7L7.9 33.8L9.2 30.7L11.1 27.0L13.9 22.9L15.5 20.8L17.6 18.4L19.9 16.2L24.2 12.7L26.7 11.0L30.5 8.9L33.9 7.4L38.6 5.7L42.9 4.8L47.5 4.3L51.6 4.2L55.2 4.5L59.2 5.2L63.8 6.5L67.3 7.9L71.6 10.1L75.4 12.5L77.7 14.3L80.1 16.5L83.3 19.8L84.9 21.8L87.1 25.0L89.7 29.6L90.9 32.3L92.3 36.0L93.1 38.8L93.8 42.0L94.3 45.9L99.7 46.1L94.4 55.9L93.2 60.7L91.6 65.4L91.6 65.5L91.1 64.8L80.0 46.2L86.0 46.1L85.9 43.7L85.5 41.3L84.8 38.3L84.2 36.4L83.4 34.2L82.0 31.0L80.2 27.8L79.0 26.1L77.7 24.4L75.7 22.1L72.1 18.8L68.7 16.3L66.4 15.0L64.2 13.9L59.9 12.3L56.3 11.5L53.7 11.1L51.6 10.9L48.7 10.9L46.3 11.0L41.5 11.9L37.6 13.1L33.7 14.7L30.7 16.3L26.5 19.4L23.9 21.7L20.8 25.1L18.3 28.5L16.5 31.8L15.5 34.2L14.4 37.6L13.8 40.1L13.5 43.5L13.7 44.0L19.3 53.1L19.2 53.2L13.5 53.3L13.1 53.4L13.3 55.3L14.1 58.4L15.3 61.4L16.6 63.6L18.4 65.9L21.0 68.3L23.7 70.0L25.9 71.0L27.2 71.4L30.2 71.9L32.1 72.1L34.7 71.9L36.7 71.7L38.9 71.1L41.0 70.5L42.6 69.8L44.5 68.7L46.1 67.6L46.9 66.9L48.5 65.0L49.4 63.2L50.0 61.4L50.2 59.5L50.3 51.2L77.6 35.1L77.7 36.5L77.8 65.2L77.7 65.4L72.0 68.8L71.4 69.1L71.3 69.0L71.1 65.9L70.4 62.0L70.3 47.3L70.1 47.2L57.1 54.8L57.0 62.0L56.9 63.3L56.5 65.2L55.7 67.4L54.6 69.5L53.1 71.4L51.8 72.6L49.8 74.2L47.6 75.6L45.7 76.6L43.0 77.7L38.4 78.9ZM32.8 39.5L30.1 38.1L23.1 33.9L24.4 33.1L49.9 18.0L69.9 29.5L69.1 30.0L62.6 33.8L50.1 26.5L42.6 30.6L38.9 33.0L37.5 34.1L35.2 36.3ZM30.2 60.9L30.0 60.9L30.0 51.5L30.2 49.0L30.6 46.7L31.1 45.0L31.8 43.2L32.9 41.0L35.1 37.9L36.9 35.9L38.5 34.5L42.3 31.9L49.5 27.8L49.7 30.0L49.7 35.2L49.6 41.0L44.9 38.4L43.4 39.6L41.6 41.4L39.8 43.7L38.6 45.9L37.8 48.4L37.5 50.7L37.5 52.6L41.1 54.7L41.2 54.9ZM50.6 40.8L50.6 27.9L61.5 34.4L60.5 35.0ZM49.7 50.4L40.3 45.0L40.5 44.4L41.8 42.7L43.7 40.6L44.9 39.6L45.0 39.5L45.8 39.9L49.9 42.3L70.9 30.1L77.5 33.9ZM33.6 71.1L31.4 71.1L22.3 65.5L22.4 34.7L32.2 40.3L31.0 42.7L30.2 44.8L29.5 47.4L29.2 48.9L29.0 51.4L29.1 61.8L39.0 67.7L41.4 69.2L40.1 69.8L37.4 70.6L35.1 71.0ZM42.9 68.5L42.6 68.6L42.5 68.2L42.6 54.6L38.4 52.0L38.6 49.0L39.0 47.6L39.7 45.8L49.3 51.4L49.3 59.7L49.0 61.4L48.6 62.7L47.7 64.6L46.8 65.6L45.2 67.2ZM69.4 61.3L58.5 55.0L69.3 48.7L69.4 48.8L69.4 48.9L69.5 58.3L69.5 61.2ZM41.6 68.0L41.4 68.0L40.4 67.4L30.9 61.9L30.8 61.7L41.6 55.8ZM56.1 69.2L55.9 69.3L55.8 69.2L56.7 67.6L57.3 65.8L57.9 63.2L58.0 60.9L58.0 56.0L58.1 55.9L58.6 56.2L68.6 62.0L68.6 62.1ZM52.8 95.6L46.0 95.6L43.1 95.3L39.3 94.7L35.8 93.7L33.2 92.7L31.2 91.8L27.6 89.9L24.4 87.7L22.2 86.0L19.3 83.3L17.5 81.4L15.6 79.1L13.5 76.1L11.3 72.6L10.2 70.5L10.3 70.5L12.2 72.4L14.3 74.1L18.5 77.0L22.6 78.7L25.0 79.4L28.2 80.0L31.8 82.6L35.8 84.6L38.6 85.7L42.4 86.6L46.4 87.0L49.3 86.9L51.8 86.4L53.9 85.5L55.9 84.2L58.2 82.0L59.4 80.3L60.3 78.7L61.5 75.3L61.9 72.9L62.0 71.4L61.9 69.0L61.6 67.3L69.5 62.7L69.8 64.0L70.3 67.6L70.4 70.4L70.2 73.0L69.8 75.6L69.3 77.6L68.4 80.1L67.2 82.2L64.8 85.6L62.7 87.7L60.4 89.6L58.1 91.1L56.3 92.1L53.2 93.4L49.7 94.5L50.3 94.5L51.7 94.4L54.4 93.7L57.7 92.3L60.3 90.9L62.9 88.9L64.5 87.4L66.2 85.5L67.8 83.2L68.8 81.4L72.0 78.9L75.4 75.7L78.1 72.4L81.1 68.0L83.6 63.1L84.7 60.3L85.6 57.5L91.1 66.7L89.0 71.1L87.1 74.2L84.5 77.9L82.4 80.5L78.8 84.2L75.5 86.9L72.0 89.3L69.1 91.0L64.8 92.9L60.7 94.2L56.2 95.2ZM50.6 81.7L50.6 74.8L52.9 72.9L54.7 71.0L60.7 67.7L61.0 69.5L61.1 71.6L60.9 73.9L60.5 75.4ZM49.7 82.3L49.4 82.3L45.6 80.1L43.2 78.6L46.9 77.0L49.7 75.5Z";
|
|
1442
2662
|
const font = "font:12px/1.4 ui-sans-serif,system-ui,sans-serif;";
|
|
2663
|
+
const configStatus = (config) => {
|
|
2664
|
+
const v = typeof config === "object" && config !== null ? Reflect.get(config, "healthStatus") : void 0;
|
|
2665
|
+
return v === "radar" || v === "off" ? v : "ring";
|
|
2666
|
+
};
|
|
1443
2667
|
const configPosition = (config) => {
|
|
1444
2668
|
const p = typeof config === "object" && config !== null ? Reflect.get(config, "position") : void 0;
|
|
1445
2669
|
return POSITIONS.find((x) => x === p) ?? "bottom-right";
|
|
@@ -1448,59 +2672,248 @@ const configPosition = (config) => {
|
|
|
1448
2672
|
* CSS placing a box in `position`'s corner of the viewport. Fixed, not
|
|
1449
2673
|
* absolute: the compositor's own element in the surface has no height.
|
|
1450
2674
|
*/
|
|
1451
|
-
const corner = (position) => {
|
|
2675
|
+
const corner = (position, gap = GAP) => {
|
|
1452
2676
|
const [v, h] = position.split("-");
|
|
1453
|
-
return `position:fixed;${v}:${
|
|
2677
|
+
return `position:fixed;${v}:${gap}px;${h}:${gap}px;`;
|
|
1454
2678
|
};
|
|
1455
|
-
|
|
1456
|
-
|
|
2679
|
+
/**
|
|
2680
|
+
* The panel's size. Stretched or maximized, it is pinned to both edges instead
|
|
2681
|
+
* of given the viewport's width: `100vw` counts the page's scrollbar, so the
|
|
2682
|
+
* panel would run a few pixels past the window.
|
|
2683
|
+
*/
|
|
2684
|
+
const OPPOSITE = {
|
|
2685
|
+
left: "right",
|
|
2686
|
+
right: "left",
|
|
2687
|
+
top: "bottom",
|
|
2688
|
+
bottom: "top"
|
|
2689
|
+
};
|
|
2690
|
+
const fill = (ui) => {
|
|
2691
|
+
const [v, h] = ui.position.split("-");
|
|
2692
|
+
return `${ui.mode !== "normal" ? `${OPPOSITE[h ?? ""] ?? "left"}:0;` : ""}${ui.mode === "max" ? `${OPPOSITE[v ?? ""] ?? "top"}:0;` : ""}${ui.mode === "normal" ? `width:${ui.width}px;` : "width:auto;"}${ui.mode === "max" ? "height:auto;" : `height:${ui.height}px;`}max-width:100%;max-height:100%;`;
|
|
2693
|
+
};
|
|
2694
|
+
/** The closed button: a round tile of 70px, the mark inside at 58px. */
|
|
2695
|
+
const FAB_SIZE = 70;
|
|
2696
|
+
const FAB_MARK = 46;
|
|
2697
|
+
/** The ring's thickness: it sits on the button's outer edge, with nothing outside it. */
|
|
2698
|
+
const RING_WIDTH = 4;
|
|
2699
|
+
/** Seconds for the wave to go once around the ring. */
|
|
2700
|
+
const RING_PERIOD = 2.4;
|
|
2701
|
+
/**
|
|
2702
|
+
* The wave: every arc brightens and dims on the same clock, each a step behind
|
|
2703
|
+
* the last (the delays are set per arc), so brightness runs round the ring. The
|
|
2704
|
+
* colour is animated, not the opacity, so where two arcs overlap by a hair no
|
|
2705
|
+
* seam shows. A failing arc pulses faster; a grey one sits still. Reduced
|
|
2706
|
+
* motion: no motion.
|
|
2707
|
+
*/
|
|
2708
|
+
const RING_CSS = `
|
|
2709
|
+
@keyframes dt-flow-ok { 0%, 100% { stroke: #15803d; } 50% { stroke: #22c55e; } }
|
|
2710
|
+
@keyframes dt-flow-unwell { 0%, 100% { stroke: #a16207; } 50% { stroke: #f59e0b; } }
|
|
2711
|
+
@keyframes dt-alarm { 0%, 100% { stroke: #ef4444; } 50% { stroke: #7f1d1d; } }
|
|
2712
|
+
@keyframes dt-fill-ok { 0%, 100% { fill: #15803d; } 50% { fill: #4ade80; } }
|
|
2713
|
+
@keyframes dt-fill-unwell { 0%, 100% { fill: #a16207; } 50% { fill: #fbbf24; } }
|
|
2714
|
+
@keyframes dt-fill-alarm { 0%, 100% { fill: #ef4444; } 50% { fill: #7f1d1d; } }
|
|
2715
|
+
.dt-ring path[data-level="ok"] { animation: dt-flow-ok ${RING_PERIOD}s ease-in-out infinite; }
|
|
2716
|
+
.dt-ring path[data-level="unwell"] { animation: dt-flow-unwell ${RING_PERIOD}s ease-in-out infinite; }
|
|
2717
|
+
.dt-ring path[data-level="failed"] { animation: dt-alarm 0.9s ease-in-out infinite; }
|
|
2718
|
+
.dt-mark path[data-level="ok"] { animation: dt-fill-ok ${RING_PERIOD}s ease-in-out infinite; }
|
|
2719
|
+
.dt-mark path[data-level="unwell"] { animation: dt-fill-unwell ${RING_PERIOD}s ease-in-out infinite; }
|
|
2720
|
+
.dt-mark path[data-level="failed"] { animation: dt-fill-alarm 0.9s ease-in-out infinite; }
|
|
2721
|
+
@media (prefers-reduced-motion: reduce) {
|
|
2722
|
+
.dt-ring path, .dt-mark path { animation: none; }
|
|
2723
|
+
}
|
|
2724
|
+
`;
|
|
2725
|
+
const LEVEL_COLOR = {
|
|
2726
|
+
ok: "#22c55e",
|
|
1457
2727
|
unwell: "#f59e0b",
|
|
1458
|
-
failed: "#
|
|
2728
|
+
failed: "#ef4444",
|
|
2729
|
+
unknown: "#334155"
|
|
1459
2730
|
};
|
|
2731
|
+
const STEP = {
|
|
2732
|
+
"bottom-left": {
|
|
2733
|
+
horizontal: "bottom-right",
|
|
2734
|
+
vertical: "top-left"
|
|
2735
|
+
},
|
|
2736
|
+
"bottom-right": {
|
|
2737
|
+
horizontal: "bottom-left",
|
|
2738
|
+
vertical: "top-right"
|
|
2739
|
+
},
|
|
2740
|
+
"top-left": {
|
|
2741
|
+
horizontal: "top-right",
|
|
2742
|
+
vertical: "bottom-left"
|
|
2743
|
+
},
|
|
2744
|
+
"top-right": {
|
|
2745
|
+
horizontal: "top-left",
|
|
2746
|
+
vertical: "bottom-right"
|
|
2747
|
+
}
|
|
2748
|
+
};
|
|
2749
|
+
/** The corner one step across (`horizontal`) or up or down (`vertical`) from `position`. */
|
|
2750
|
+
const stepPosition = (position, axis) => STEP[position][axis];
|
|
2751
|
+
const ARROW = 24;
|
|
2752
|
+
const ARROW_GAP = 4;
|
|
2753
|
+
/** Chevron paths on the 14 px icon grid. */
|
|
2754
|
+
const CHEVRON = {
|
|
2755
|
+
left: "M8.5 3 4.5 7l4 4",
|
|
2756
|
+
right: "M5.5 3l4 4-4 4",
|
|
2757
|
+
up: "M3 8.5l4-4 4 4",
|
|
2758
|
+
down: "M3 5.5l4 4 4-4"
|
|
2759
|
+
};
|
|
2760
|
+
const arrowStyle = `position:absolute;width:${ARROW}px;height:${ARROW}px;padding:0;border-radius:${ARROW / 2}px;display:flex;align-items:center;justify-content:center;border:1px solid #374151;background:#111827;color:#e5e7eb;cursor:pointer;box-shadow:0 2px 6px rgb(0 0 0 / 0.5);`;
|
|
1460
2761
|
function Fab(props) {
|
|
1461
|
-
const
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
2762
|
+
const [hover, setHover] = d(false);
|
|
2763
|
+
const [v, h] = props.position.split("-");
|
|
2764
|
+
const toH = stepPosition(props.position, "horizontal");
|
|
2765
|
+
const toV = stepPosition(props.position, "vertical");
|
|
2766
|
+
const chevH = h === "left" ? CHEVRON.right : CHEVRON.left;
|
|
2767
|
+
const chevV = v === "top" ? CHEVRON.down : CHEVRON.up;
|
|
2768
|
+
const mid = 23;
|
|
2769
|
+
const offH = h === "left" ? 74 : -28;
|
|
2770
|
+
const offV = v === "top" ? 74 : -28;
|
|
2771
|
+
const bridgeH = h === "left" ? FAB_SIZE : -4;
|
|
2772
|
+
const bridgeV = v === "top" ? FAB_SIZE : -4;
|
|
2773
|
+
return /* @__PURE__ */ a(M, { children: [hover ? /* @__PURE__ */ a("div", {
|
|
2774
|
+
"data-isoloop-devtools-fab-away": "",
|
|
2775
|
+
onPointerMove: () => {
|
|
2776
|
+
setHover(false);
|
|
2777
|
+
},
|
|
2778
|
+
onPointerDown: () => {
|
|
2779
|
+
setHover(false);
|
|
2780
|
+
},
|
|
2781
|
+
style: "position:fixed;inset:0;pointer-events:auto;z-index:0;"
|
|
2782
|
+
}) : null, /* @__PURE__ */ a("div", {
|
|
2783
|
+
"data-isoloop-devtools-fab": "",
|
|
2784
|
+
onPointerMove: () => {
|
|
2785
|
+
if (!hover) setHover(true);
|
|
2786
|
+
},
|
|
2787
|
+
style: `${corner(props.position)}pointer-events:auto;z-index:1;width:${FAB_SIZE}px;height:${FAB_SIZE}px;`,
|
|
2788
|
+
children: [/* @__PURE__ */ a("button", {
|
|
2789
|
+
type: "button",
|
|
2790
|
+
"data-isoloop-devtools-toggle": "",
|
|
2791
|
+
"data-health": props.health,
|
|
2792
|
+
"aria-label": `Open Isoloop devtools (Alt+Shift+D)${props.summary ? `. ${props.summary}` : ""}`,
|
|
2793
|
+
title: `Isoloop devtools (Alt+Shift+D)${props.summary ? `\n${props.summary}` : ""}`,
|
|
2794
|
+
onClick: props.onOpen,
|
|
2795
|
+
style: `position:absolute;inset:0;display:flex;align-items:center;justify-content:center;border-radius:${FAB_SIZE / 2}px;border:0;background:#111827;box-shadow:0 0 0 3px rgb(0 0 0 / 0.35),0 4px 14px rgb(0 0 0 / 0.7);color:#e5e7eb;cursor:pointer;padding:0;overflow:hidden;${font}`,
|
|
2796
|
+
children: [/* @__PURE__ */ a("svg", {
|
|
2797
|
+
class: "dt-ring",
|
|
2798
|
+
width: FAB_SIZE,
|
|
2799
|
+
height: FAB_SIZE,
|
|
2800
|
+
viewBox: `0 0 ${FAB_SIZE} ${FAB_SIZE}`,
|
|
2801
|
+
"aria-hidden": "true",
|
|
2802
|
+
style: "position:absolute;inset:0;",
|
|
2803
|
+
children: props.status === "off" ? /* @__PURE__ */ a("circle", {
|
|
2804
|
+
cx: FAB_SIZE / 2,
|
|
2805
|
+
cy: FAB_SIZE / 2,
|
|
2806
|
+
r: FAB_SIZE / 2 - RING_WIDTH / 2,
|
|
2807
|
+
fill: "none",
|
|
2808
|
+
stroke: "#f8fafc",
|
|
2809
|
+
"stroke-width": RING_WIDTH
|
|
2810
|
+
}) : props.arcs.map((c, i) => /* @__PURE__ */ a("path", {
|
|
2811
|
+
"data-level": c.level,
|
|
2812
|
+
d: arcPath(i, FAB_SIZE / 2, FAB_SIZE / 2, FAB_SIZE / 2 - RING_WIDTH / 2),
|
|
2813
|
+
stroke: LEVEL_COLOR[c.level],
|
|
2814
|
+
"stroke-width": RING_WIDTH,
|
|
2815
|
+
"stroke-linecap": "butt",
|
|
2816
|
+
fill: "none",
|
|
2817
|
+
style: `animation-delay:-${(i / 12 * RING_PERIOD).toFixed(2)}s;`,
|
|
2818
|
+
children: /* @__PURE__ */ a("title", { children: c.label })
|
|
2819
|
+
}, c.id))
|
|
2820
|
+
}), props.status === "radar" ? /* @__PURE__ */ a("svg", {
|
|
2821
|
+
class: "dt-mark",
|
|
2822
|
+
width: FAB_MARK,
|
|
2823
|
+
height: FAB_MARK,
|
|
2824
|
+
viewBox: "0 0 100 100",
|
|
2825
|
+
"aria-hidden": "true",
|
|
2826
|
+
children: [/* @__PURE__ */ a("defs", { children: /* @__PURE__ */ a("clipPath", {
|
|
2827
|
+
id: "dt-mark-clip",
|
|
2828
|
+
children: /* @__PURE__ */ a("path", {
|
|
2829
|
+
d: MARK,
|
|
2830
|
+
"clip-rule": "evenodd"
|
|
2831
|
+
})
|
|
2832
|
+
}) }), /* @__PURE__ */ a("g", {
|
|
2833
|
+
"clip-path": "url(#dt-mark-clip)",
|
|
2834
|
+
children: props.arcs.map((c, i) => /* @__PURE__ */ a("path", {
|
|
2835
|
+
"data-level": c.level,
|
|
2836
|
+
d: wedgePath(i, 50, 50, 75),
|
|
2837
|
+
fill: LEVEL_COLOR[c.level],
|
|
2838
|
+
style: `animation-delay:-${(i / 12 * RING_PERIOD).toFixed(2)}s;`
|
|
2839
|
+
}, c.id))
|
|
2840
|
+
})]
|
|
2841
|
+
}) : /* @__PURE__ */ a("svg", {
|
|
2842
|
+
width: FAB_MARK,
|
|
2843
|
+
height: FAB_MARK,
|
|
2844
|
+
viewBox: "0 0 100 100",
|
|
2845
|
+
"aria-hidden": "true",
|
|
2846
|
+
children: /* @__PURE__ */ a("path", {
|
|
2847
|
+
d: MARK,
|
|
2848
|
+
fill: "#fff",
|
|
2849
|
+
"fill-rule": "evenodd"
|
|
2850
|
+
})
|
|
1487
2851
|
})]
|
|
1488
|
-
}),
|
|
1489
|
-
"
|
|
1490
|
-
style: `position:absolute;top
|
|
1491
|
-
|
|
1492
|
-
|
|
2852
|
+
}), hover ? /* @__PURE__ */ a(M, { children: [
|
|
2853
|
+
/* @__PURE__ */ a("span", { style: `position:absolute;left:${bridgeH}px;top:${mid}px;width:${ARROW_GAP}px;height:${ARROW}px;` }),
|
|
2854
|
+
/* @__PURE__ */ a("span", { style: `position:absolute;top:${bridgeV}px;left:${mid}px;width:${ARROW}px;height:${ARROW_GAP}px;` }),
|
|
2855
|
+
/* @__PURE__ */ a("button", {
|
|
2856
|
+
type: "button",
|
|
2857
|
+
"data-isoloop-devtools-move": "horizontal",
|
|
2858
|
+
"aria-label": `Move the button ${h === "left" ? "right" : "left"}`,
|
|
2859
|
+
title: `Move ${h === "left" ? "right" : "left"}`,
|
|
2860
|
+
onClick: () => {
|
|
2861
|
+
props.onMove(toH);
|
|
2862
|
+
},
|
|
2863
|
+
style: `${arrowStyle}top:${mid}px;left:${offH}px;`,
|
|
2864
|
+
children: /* @__PURE__ */ a(Icon, { d: chevH })
|
|
2865
|
+
}),
|
|
2866
|
+
/* @__PURE__ */ a("button", {
|
|
2867
|
+
type: "button",
|
|
2868
|
+
"data-isoloop-devtools-move": "vertical",
|
|
2869
|
+
"aria-label": `Move the button ${v === "top" ? "down" : "up"}`,
|
|
2870
|
+
title: `Move ${v === "top" ? "down" : "up"}`,
|
|
2871
|
+
onClick: () => {
|
|
2872
|
+
props.onMove(toV);
|
|
2873
|
+
},
|
|
2874
|
+
style: `${arrowStyle}top:${offV}px;left:${mid}px;`,
|
|
2875
|
+
children: /* @__PURE__ */ a(Icon, { d: chevV })
|
|
2876
|
+
})
|
|
2877
|
+
] }) : null]
|
|
2878
|
+
})] });
|
|
1493
2879
|
}
|
|
2880
|
+
/** A toolbar button: the same 26 px square, its icon centered. */
|
|
2881
|
+
const tool = (active) => `display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;box-sizing:border-box;background:${active ? "#374151" : "none"};border:0;border-radius:4px;color:inherit;cursor:pointer;padding:0;`;
|
|
2882
|
+
const Icon = (props) => /* @__PURE__ */ a("svg", {
|
|
2883
|
+
width: "14",
|
|
2884
|
+
height: "14",
|
|
2885
|
+
viewBox: "0 0 14 14",
|
|
2886
|
+
"aria-hidden": "true",
|
|
2887
|
+
style: "display:block;",
|
|
2888
|
+
children: /* @__PURE__ */ a("path", {
|
|
2889
|
+
d: props.d,
|
|
2890
|
+
fill: "none",
|
|
2891
|
+
stroke: "currentColor",
|
|
2892
|
+
"stroke-width": "1.5",
|
|
2893
|
+
"stroke-linecap": "round",
|
|
2894
|
+
"stroke-linejoin": "round"
|
|
2895
|
+
})
|
|
2896
|
+
});
|
|
1494
2897
|
function Dock(props) {
|
|
1495
2898
|
const { ui } = props;
|
|
1496
2899
|
const [v, h] = ui.position.split("-");
|
|
1497
2900
|
const [drag, setDrag] = d(void 0);
|
|
1498
2901
|
const sx = h === "right" ? 1 : -1;
|
|
1499
2902
|
const sy = v === "bottom" ? 1 : -1;
|
|
1500
|
-
const sizeAt = (d, x, y) => [Math.max(280, Math.round(d.width + (d.x - x) * sx)), Math.max(160, Math.round(d.height + (d.y - y) * sy))];
|
|
2903
|
+
const sizeAt = (d, x, y) => [d.axis === "y" ? d.width : Math.max(280, Math.round(d.width + (d.x - x) * sx)), d.axis === "x" ? d.height : Math.max(160, Math.round(d.height + (d.y - y) * sy))];
|
|
1501
2904
|
const handleV = v === "bottom" ? "top" : "bottom";
|
|
1502
2905
|
const handleH = h === "right" ? "left" : "right";
|
|
1503
|
-
const
|
|
2906
|
+
const cornerCursor = sx === sy ? "nwse-resize" : "nesw-resize";
|
|
2907
|
+
const cursor = drag?.axis === "x" ? "ew-resize" : drag?.axis === "y" ? "ns-resize" : cornerCursor;
|
|
2908
|
+
const start = (axis, e) => {
|
|
2909
|
+
setDrag({
|
|
2910
|
+
x: e.clientX,
|
|
2911
|
+
y: e.clientY,
|
|
2912
|
+
width: ui.width,
|
|
2913
|
+
height: ui.height,
|
|
2914
|
+
axis
|
|
2915
|
+
});
|
|
2916
|
+
};
|
|
1504
2917
|
return /* @__PURE__ */ a("div", {
|
|
1505
2918
|
"data-isoloop-devtools-panel": "",
|
|
1506
2919
|
role: "dialog",
|
|
@@ -1508,10 +2921,10 @@ function Dock(props) {
|
|
|
1508
2921
|
onKeyDown: (e) => {
|
|
1509
2922
|
if (e.key === "Escape") props.onClose();
|
|
1510
2923
|
},
|
|
1511
|
-
style: `${corner(ui.position)}pointer-events:auto;box-sizing:border-box;
|
|
2924
|
+
style: `${corner(ui.position, DOCK_GAP)}${fill(ui)}pointer-events:auto;box-sizing:border-box;display:flex;flex-direction:column;border:1px solid #374151;border-radius:8px;background:#111827;color:#e5e7eb;box-shadow:0 4px 16px rgb(0 0 0 / 0.35);overflow:hidden;${font}`,
|
|
1512
2925
|
children: [
|
|
1513
2926
|
/* @__PURE__ */ a("div", {
|
|
1514
|
-
style: "display:flex;align-items:center;gap:
|
|
2927
|
+
style: "display:flex;align-items:center;gap:4px;padding:6px 12px;border-bottom:1px solid #374151;",
|
|
1515
2928
|
children: [
|
|
1516
2929
|
/* @__PURE__ */ a("strong", {
|
|
1517
2930
|
style: "flex:1;",
|
|
@@ -1519,12 +2932,27 @@ function Dock(props) {
|
|
|
1519
2932
|
}),
|
|
1520
2933
|
/* @__PURE__ */ a("button", {
|
|
1521
2934
|
type: "button",
|
|
1522
|
-
"data-isoloop-devtools-
|
|
1523
|
-
"aria-label": "
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
2935
|
+
"data-isoloop-devtools-stretch": "",
|
|
2936
|
+
"aria-label": "Stretch across the window's width",
|
|
2937
|
+
"aria-pressed": ui.mode === "wide",
|
|
2938
|
+
title: ui.mode === "wide" ? "Restore width" : "Stretch across the width",
|
|
2939
|
+
onClick: () => {
|
|
2940
|
+
props.onMode(ui.mode === "wide" ? "normal" : "wide");
|
|
2941
|
+
},
|
|
2942
|
+
style: tool(ui.mode === "wide"),
|
|
2943
|
+
children: /* @__PURE__ */ a(Icon, { d: "M1.5 7h11M4 4.5 1.5 7 4 9.5M10 4.5 12.5 7 10 9.5" })
|
|
2944
|
+
}),
|
|
2945
|
+
/* @__PURE__ */ a("button", {
|
|
2946
|
+
type: "button",
|
|
2947
|
+
"data-isoloop-devtools-maximize": "",
|
|
2948
|
+
"aria-label": "Fill the window",
|
|
2949
|
+
"aria-pressed": ui.mode === "max",
|
|
2950
|
+
title: ui.mode === "max" ? "Restore size" : "Fill the window",
|
|
2951
|
+
onClick: () => {
|
|
2952
|
+
props.onMode(ui.mode === "max" ? "normal" : "max");
|
|
2953
|
+
},
|
|
2954
|
+
style: tool(ui.mode === "max"),
|
|
2955
|
+
children: /* @__PURE__ */ a(Icon, { d: "M2.5 2.5h9v9h-9z" })
|
|
1528
2956
|
}),
|
|
1529
2957
|
/* @__PURE__ */ a("button", {
|
|
1530
2958
|
type: "button",
|
|
@@ -1532,28 +2960,41 @@ function Dock(props) {
|
|
|
1532
2960
|
"aria-label": "Close Isoloop devtools (Alt+Shift+D)",
|
|
1533
2961
|
title: "Close (Alt+Shift+D)",
|
|
1534
2962
|
onClick: props.onClose,
|
|
1535
|
-
style:
|
|
1536
|
-
children: "
|
|
2963
|
+
style: tool(false),
|
|
2964
|
+
children: /* @__PURE__ */ a(Icon, { d: "M3 3l8 8M11 3l-8 8" })
|
|
1537
2965
|
})
|
|
1538
2966
|
]
|
|
1539
2967
|
}),
|
|
1540
2968
|
/* @__PURE__ */ a("div", {
|
|
1541
|
-
style: "flex:1;
|
|
1542
|
-
children: /* @__PURE__ */ a(Body, {
|
|
2969
|
+
style: "flex:1;min-height:0;display:flex;flex-direction:column;",
|
|
2970
|
+
children: /* @__PURE__ */ a(Body, {
|
|
2971
|
+
snap: props.snap,
|
|
2972
|
+
recorder: props.recorder
|
|
2973
|
+
})
|
|
1543
2974
|
}),
|
|
1544
|
-
/* @__PURE__ */ a("div", {
|
|
1545
|
-
"data-isoloop-devtools-resize": "",
|
|
2975
|
+
ui.mode === "max" ? null : /* @__PURE__ */ a("div", {
|
|
2976
|
+
"data-isoloop-devtools-resize-y": "",
|
|
1546
2977
|
"aria-hidden": "true",
|
|
1547
2978
|
onPointerDown: (e) => {
|
|
1548
|
-
|
|
1549
|
-
x: e.clientX,
|
|
1550
|
-
y: e.clientY,
|
|
1551
|
-
width: ui.width,
|
|
1552
|
-
height: ui.height
|
|
1553
|
-
});
|
|
2979
|
+
start("y", e);
|
|
1554
2980
|
},
|
|
1555
|
-
style: `position:absolute;${handleV}:0
|
|
2981
|
+
style: `position:absolute;${handleV}:0;left:0;right:0;height:5px;cursor:ns-resize;`
|
|
1556
2982
|
}),
|
|
2983
|
+
ui.mode === "normal" ? /* @__PURE__ */ a(M, { children: [/* @__PURE__ */ a("div", {
|
|
2984
|
+
"data-isoloop-devtools-resize-x": "",
|
|
2985
|
+
"aria-hidden": "true",
|
|
2986
|
+
onPointerDown: (e) => {
|
|
2987
|
+
start("x", e);
|
|
2988
|
+
},
|
|
2989
|
+
style: `position:absolute;${handleH}:0;top:0;bottom:0;width:5px;cursor:ew-resize;`
|
|
2990
|
+
}), /* @__PURE__ */ a("div", {
|
|
2991
|
+
"data-isoloop-devtools-resize": "",
|
|
2992
|
+
"aria-hidden": "true",
|
|
2993
|
+
onPointerDown: (e) => {
|
|
2994
|
+
start("both", e);
|
|
2995
|
+
},
|
|
2996
|
+
style: `position:absolute;${handleV}:0;${handleH}:0;width:14px;height:14px;cursor:${cornerCursor};`
|
|
2997
|
+
})] }) : null,
|
|
1557
2998
|
drag ? /* @__PURE__ */ a("div", {
|
|
1558
2999
|
"data-isoloop-devtools-drag": "",
|
|
1559
3000
|
onPointerMove: (e) => {
|
|
@@ -1571,7 +3012,14 @@ function Dock(props) {
|
|
|
1571
3012
|
});
|
|
1572
3013
|
}
|
|
1573
3014
|
function Panel({ config }) {
|
|
1574
|
-
const
|
|
3015
|
+
const ctx = useIsolate();
|
|
3016
|
+
const status = configStatus(config);
|
|
3017
|
+
A(() => {
|
|
3018
|
+
ctx.styles(RING_CSS);
|
|
3019
|
+
}, []);
|
|
3020
|
+
const snap = useFeed(ctx.inspector);
|
|
3021
|
+
const [recorder] = d(createRecorder);
|
|
3022
|
+
A(() => ctx.inspector ? recorder.start(ctx.inspector) : void 0, [ctx.inspector]);
|
|
1575
3023
|
const [ui, setUi] = d(void 0);
|
|
1576
3024
|
const latest = T(void 0);
|
|
1577
3025
|
latest.current = ui;
|
|
@@ -1584,6 +3032,7 @@ function Panel({ config }) {
|
|
|
1584
3032
|
width: 420,
|
|
1585
3033
|
height: 320,
|
|
1586
3034
|
position: configPosition(config),
|
|
3035
|
+
mode: "normal",
|
|
1587
3036
|
...stored
|
|
1588
3037
|
});
|
|
1589
3038
|
});
|
|
@@ -1604,19 +3053,25 @@ function Panel({ config }) {
|
|
|
1604
3053
|
if (!ui.open) return /* @__PURE__ */ a(Fab, {
|
|
1605
3054
|
position: ui.position,
|
|
1606
3055
|
health: healthOf(snap),
|
|
3056
|
+
arcs: status === "off" ? [] : arcsOf(snap),
|
|
3057
|
+
summary: status === "off" ? "" : summaryOf(arcsOf(snap), checksOf(snap)),
|
|
3058
|
+
status,
|
|
1607
3059
|
onOpen: () => {
|
|
1608
3060
|
update({ open: true });
|
|
3061
|
+
},
|
|
3062
|
+
onMove: (position) => {
|
|
3063
|
+
update({ position });
|
|
1609
3064
|
}
|
|
1610
3065
|
});
|
|
1611
3066
|
return /* @__PURE__ */ a(Dock, {
|
|
1612
3067
|
ui,
|
|
1613
3068
|
snap,
|
|
3069
|
+
recorder,
|
|
1614
3070
|
onClose: () => {
|
|
1615
3071
|
update({ open: false });
|
|
1616
3072
|
},
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
update({ position: POSITIONS[(i + 1) % POSITIONS.length] ?? "bottom-right" });
|
|
3073
|
+
onMode: (mode) => {
|
|
3074
|
+
update({ mode });
|
|
1620
3075
|
},
|
|
1621
3076
|
onResize: (width, height, done) => {
|
|
1622
3077
|
update({
|
|
@@ -1627,4 +3082,4 @@ function Panel({ config }) {
|
|
|
1627
3082
|
});
|
|
1628
3083
|
}
|
|
1629
3084
|
const panel = defineIsolate(Panel);
|
|
1630
|
-
export { MIN_HEIGHT, MIN_WIDTH, panel as default };
|
|
3085
|
+
export { MIN_HEIGHT, MIN_WIDTH, panel as default, stepPosition };
|