@fluixi/devtools 1.0.0-alpha.107 → 1.0.0-alpha.109

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.
Files changed (65) hide show
  1. package/dist/callsite.mjs +4 -63
  2. package/dist/change-view.mjs +6 -106
  3. package/dist/chunk-2VDMQ3VF.mjs +520 -0
  4. package/dist/chunk-33U2S43X.mjs +121 -0
  5. package/dist/chunk-4P45Y5EB.mjs +214 -0
  6. package/dist/chunk-B3SAJ7QG.mjs +72 -0
  7. package/dist/chunk-CPZWLBCQ.mjs +35 -0
  8. package/dist/chunk-D25KZZBZ.mjs +212 -0
  9. package/dist/chunk-EBSROPWJ.mjs +314 -0
  10. package/dist/chunk-F664XLZL.mjs +743 -0
  11. package/dist/chunk-FY5K3QVT.mjs +35 -0
  12. package/dist/chunk-G7Z7CVP5.mjs +184 -0
  13. package/dist/chunk-GDQXCOQB.mjs +43 -0
  14. package/dist/chunk-L6XQGNMW.mjs +106 -0
  15. package/dist/chunk-MN6O673L.mjs +90 -0
  16. package/dist/chunk-NDUBBBNL.mjs +70 -0
  17. package/dist/chunk-NT7YMK77.mjs +157 -0
  18. package/dist/chunk-NVULLJDH.mjs +120 -0
  19. package/dist/chunk-NWLSDERQ.mjs +68 -0
  20. package/dist/chunk-OPIGF5XB.mjs +184 -0
  21. package/dist/chunk-P5I7DWFX.mjs +292 -0
  22. package/dist/chunk-PKARAAIS.mjs +75 -0
  23. package/dist/chunk-PSSBFXBD.mjs +155 -0
  24. package/dist/chunk-PTQ5VCYE.mjs +103 -0
  25. package/dist/chunk-PU4MJ5RU.mjs +107 -0
  26. package/dist/chunk-UAEJ3N7F.mjs +76 -0
  27. package/dist/chunk-V6DKWEYD.mjs +67 -0
  28. package/dist/chunk-VO2V7AC5.mjs +80 -0
  29. package/dist/chunk-WGQH7RUW.mjs +25 -0
  30. package/dist/chunk-Y5OQWBAM.mjs +777 -0
  31. package/dist/chunk-Z6KYHEKY.mjs +64 -0
  32. package/dist/copy.mjs +3 -39
  33. package/dist/describe.mjs +3 -31
  34. package/dist/detail-panel.mjs +6 -280
  35. package/dist/diff.mjs +4 -201
  36. package/dist/dom.mjs +7 -176
  37. package/dist/export.mjs +6 -207
  38. package/dist/float.mjs +5 -206
  39. package/dist/format.mjs +5 -151
  40. package/dist/graph-view.mjs +9 -875
  41. package/dist/highlight.mjs +6 -113
  42. package/dist/history.mjs +4 -70
  43. package/dist/hook.mjs +16 -1719
  44. package/dist/index.cjs +1 -1
  45. package/dist/index.mjs +106 -4673
  46. package/dist/inspector.mjs +11 -677
  47. package/dist/instrument.mjs +9 -486
  48. package/dist/kind-filter.mjs +6 -148
  49. package/dist/menu.mjs +4 -116
  50. package/dist/observe.mjs +14 -1510
  51. package/dist/palette.mjs +6 -28
  52. package/dist/path.mjs +3 -21
  53. package/dist/plugin.mjs +9 -57
  54. package/dist/plugins/context.mjs +6 -71
  55. package/dist/plugins/directives.mjs +8 -68
  56. package/dist/plugins/index.cjs +1 -1
  57. package/dist/plugins/index.mjs +13 -136
  58. package/dist/source.mjs +12 -93
  59. package/dist/timeline.mjs +7 -323
  60. package/dist/tree.mjs +11 -558
  61. package/dist/tsconfig.lib.tsbuildinfo +1 -1
  62. package/dist/value-pane.mjs +6 -196
  63. package/dist/wire.cjs +1 -1
  64. package/dist/wire.mjs +6 -86
  65. package/package.json +3 -3
@@ -0,0 +1,214 @@
1
+ import {
2
+ toCommits
3
+ } from "./chunk-PKARAAIS.mjs";
4
+ import {
5
+ CHANGE_CSS,
6
+ changeRows,
7
+ handleCopyClick
8
+ } from "./chunk-UAEJ3N7F.mjs";
9
+
10
+ // src/timeline.ts
11
+ var escape = (text) => text.replace(/[&<>"]/g, (c) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;" })[c]);
12
+ var clock = (t) => {
13
+ const d = new Date(t);
14
+ const pad = (n, width = 2) => String(n).padStart(width, "0");
15
+ return `${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}.${pad(d.getMilliseconds(), 3)}`;
16
+ };
17
+ function subject(commit, nameOf) {
18
+ if (!commit.cause) return commit.commit === 0 ? "first render" : "continued";
19
+ return nameOf(commit.cause);
20
+ }
21
+ function change(commit) {
22
+ const cause = commit.cause;
23
+ if (!cause || cause.from === void 0 || cause.to === void 0) return "";
24
+ return `${cause.from} → ${cause.to}`;
25
+ }
26
+ function detail(commit, nameOf) {
27
+ const lines = [`${subject(commit, nameOf)} ${change(commit)}`.trim()];
28
+ const named = (kind, verb) => {
29
+ const ids = commit.events.filter((e) => e.kind === kind && e !== commit.cause).map(nameOf);
30
+ if (ids.length) lines.push(`${verb}: ${[...new Set(ids)].join(", ")}`);
31
+ };
32
+ named("ran", "ran");
33
+ named("write", "written");
34
+ named("created", "made");
35
+ named("disposed", "gone");
36
+ return lines.join("\n");
37
+ }
38
+ function summary(commit) {
39
+ const counts = { ran: 0, created: 0, disposed: 0, write: 0 };
40
+ for (const event of commit.events) counts[event.kind]++;
41
+ const writes = counts.write - (commit.cause ? 1 : 0);
42
+ return [
43
+ counts.ran && `${counts.ran} ran`,
44
+ writes > 0 && `${writes} written`,
45
+ counts.created && `${counts.created} made`,
46
+ counts.disposed && `${counts.disposed} gone`
47
+ ].filter(Boolean).join(" · ");
48
+ }
49
+ function createTimeline(host, options = {}) {
50
+ const empty = options.empty ?? "nothing has happened yet";
51
+ const limit = options.limit ?? 100;
52
+ let events = [];
53
+ let seen = -1;
54
+ let selected = null;
55
+ let filter = "";
56
+ let signature = "";
57
+ let paused = false;
58
+ host.innerHTML = '<div class="tl-head"><input class="tl-filter" type="search" placeholder="filter by name or value" aria-label="Filter the timeline" /><button type="button" class="tl-pause" title="Stop taking new updates, so the list holds still while you read it">❚❚</button></div><div class="tl-list"></div>';
59
+ const input = host.querySelector(".tl-filter");
60
+ const list = host.querySelector(".tl-list");
61
+ const pause = host.querySelector(".tl-pause");
62
+ const all = () => toCommits(events).slice(-limit).reverse();
63
+ const idsOf = (commit) => {
64
+ const ids = /* @__PURE__ */ new Set();
65
+ for (const event of commit.events) {
66
+ ids.add(event.id);
67
+ if (event.by !== void 0) ids.add(event.by);
68
+ }
69
+ return [...ids];
70
+ };
71
+ const haystack = (commit, nameOf) => `${detail(commit, nameOf)} ${summary(commit)}`.toLowerCase();
72
+ const shown = (nameOf) => filter ? all().filter((c) => haystack(c, nameOf).includes(filter)) : all();
73
+ input.addEventListener("input", () => {
74
+ filter = input.value.trim().toLowerCase();
75
+ signature = "";
76
+ });
77
+ const showPaused = () => {
78
+ pause.textContent = paused ? "▶" : "❚❚";
79
+ pause.classList.toggle("on", paused);
80
+ pause.title = paused ? "Taking updates again" : "Stop taking new updates, so the list holds still while you read it";
81
+ };
82
+ pause.addEventListener("click", () => {
83
+ paused = !paused;
84
+ showPaused();
85
+ signature = "";
86
+ });
87
+ list.addEventListener("click", (e) => {
88
+ if (handleCopyClick(e)) return;
89
+ const row = e.target?.closest?.(".tl-commit");
90
+ if (!row) return;
91
+ const number = Number(row.dataset.commit);
92
+ if (e.target.classList.contains("tl-more")) {
93
+ const full = all().find((c) => c.commit === number);
94
+ if (full) options.onExpand?.(full);
95
+ return;
96
+ }
97
+ selected = selected === number ? null : number;
98
+ const commit = all().find((c) => c.commit === selected) ?? null;
99
+ options.onSelect?.(commit ? idsOf(commit) : [], commit);
100
+ signature = "";
101
+ });
102
+ return {
103
+ setPaused(next) {
104
+ paused = next;
105
+ showPaused();
106
+ signature = "";
107
+ },
108
+ get paused() {
109
+ return paused;
110
+ },
111
+ push(incoming) {
112
+ if (paused) return;
113
+ let added = false;
114
+ for (const event of incoming) {
115
+ if (event.seq <= seen) continue;
116
+ events.push(event);
117
+ seen = event.seq;
118
+ added = true;
119
+ }
120
+ if (!added) return;
121
+ if (events.length > limit * 40) events = events.slice(-limit * 40);
122
+ },
123
+ render(graph) {
124
+ const nameOf = (e) => graph.get(e.id)?.label ?? e.label ?? `#${e.id}`;
125
+ const rows = shown(nameOf);
126
+ const next = `${seen}|${selected ?? ""}|${filter}|${rows.length}|${graph.size}`;
127
+ if (next === signature) return;
128
+ signature = next;
129
+ if (!rows.length) {
130
+ list.innerHTML = `<span class="tl-empty">${escape(filter ? "nothing matches" : empty)}</span>`;
131
+ return;
132
+ }
133
+ list.innerHTML = rows.map((commit) => {
134
+ const open = commit.commit === selected;
135
+ const did = summary(commit);
136
+ const moved = change(commit);
137
+ const parts = [
138
+ ["ran", "ran"],
139
+ ["write", "written"],
140
+ ["created", "made"],
141
+ ["disposed", "gone"]
142
+ ];
143
+ const body = parts.map(([kind, verb]) => {
144
+ const names = [
145
+ ...new Set(
146
+ commit.events.filter((e) => e.kind === kind && e !== commit.cause).map(nameOf)
147
+ )
148
+ ];
149
+ return names.length ? `<div class="tl-part"><span class="tl-verb">${verb}</span> ${escape(names.join(", "))}</div>` : "";
150
+ }).join("");
151
+ return `<div class="tl-commit${open ? " selected" : ""}" data-commit="${commit.commit}" title="${escape(detail(commit, nameOf))}"><div class="tl-line"><span class="tl-caret">${open ? "▾" : "▸"}</span><span class="tl-time">${clock(commit.t)}</span><span class="tl-name">${escape(subject(commit, nameOf))}</span>` + (did ? `<span class="tl-did">${escape(did)}</span>` : "") + "</div>" + // Open, the value gets the width and wraps.
152
+ (open ? `<div class="tl-body">${moved ? `<div class="tl-change">${escape(moved)}</div>` : ""}${changeRows(commit.cause?.change, 6)}${body}${// Only worth offering when there is more than the row can hold.
153
+ options.onExpand && (commit.cause?.change || commit.events.length > 6) ? '<button type="button" class="tl-more">open in full</button>' : ""}</div>` : "") + "</div>";
154
+ }).join("");
155
+ },
156
+ selected() {
157
+ const commit = all().find((c) => c.commit === selected);
158
+ return commit ? idsOf(commit) : [];
159
+ },
160
+ clear() {
161
+ events = [];
162
+ seen = -1;
163
+ selected = null;
164
+ signature = "";
165
+ list.innerHTML = `<span class="tl-empty">${escape(empty)}</span>`;
166
+ }
167
+ };
168
+ }
169
+ var TIMELINE_CSS = `
170
+ .tl-head { position: relative; display: flex; gap: 4px; padding: 0 .25rem; }
171
+ .tl-pause {
172
+ position: absolute; right: .4rem; top: 40%; transform: translateY(-50%);
173
+ flex: none; width: 26px; cursor: pointer; font: inherit; font-size: 10px;
174
+ border: 1px solid var(--fx-line, #ffffff1f); border-radius: 4px;
175
+ background: transparent; color: var(--fx-muted, #8a90a2);
176
+ }
177
+ .tl-pause:hover { color: var(--fx-label, #e7e9ee); }
178
+ .tl-pause.on { color: var(--fx-accent, #5eead4); border-color: var(--fx-accent, #5eead4); }
179
+ .tl-filter {
180
+ flex: 1; min-width: 0; box-sizing: border-box; padding: 3px 6px;
181
+ font: inherit; font-size: 11.5px; border-radius: 4px;
182
+ border: 1px solid var(--fx-line, #ffffff1f);
183
+ background: var(--fx-input, transparent); color: var(--fx-label, #e7e9ee);
184
+ padding-inline-end: 2rem;
185
+ }
186
+ .tl-empty { color: var(--fx-muted, #8a90a2); font-size: 12px; }
187
+ .tl-commit { padding: 4px 6px; border-radius: 4px; cursor: pointer; font-size: 11.5px; }
188
+ .tl-commit:hover { background: var(--fx-hover, #ffffff10); }
189
+ .tl-commit.selected { background: var(--fx-selected, #ffffff1a); }
190
+ .tl-line { display: flex; align-items: baseline; gap: 6px; }
191
+ .tl-caret { color: var(--fx-muted, #8a90a2); font-size: 9px; flex: none; }
192
+ .tl-time { font-family: ui-monospace, monospace; font-size: 10px; color: var(--fx-muted, #8a90a2); flex: none; }
193
+ .tl-name { color: var(--fx-label, #e7e9ee); font-family: ui-monospace, monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
194
+ .tl-did { margin-left: auto; color: var(--fx-muted, #8a90a2); flex: none; }
195
+ .tl-body { margin: 3px 0 2px 15px; }
196
+ /* Wraps: an open entry exists to show the whole value. */
197
+ .tl-change {
198
+ font-family: ui-monospace, monospace; font-size: 11px;
199
+ color: var(--fx-accent, #5eead4); overflow-wrap: anywhere; white-space: pre-wrap;
200
+ }
201
+ .tl-part { margin-top: 2px; color: var(--fx-label, #e7e9ee); font-size: 11px; overflow-wrap: anywhere; }
202
+ .tl-verb { color: var(--fx-muted, #8a90a2); }
203
+ .tl-more {
204
+ margin-top: 5px; padding: 2px 8px; font: inherit; font-size: 10.5px; cursor: pointer;
205
+ border: 1px solid var(--fx-line, #ffffff1f); border-radius: 4px;
206
+ background: transparent; color: var(--fx-muted, #8a90a2);
207
+ }
208
+ .tl-more:hover { color: var(--fx-label, #e7e9ee); }
209
+ ${CHANGE_CSS}`;
210
+
211
+ export {
212
+ createTimeline,
213
+ TIMELINE_CSS
214
+ };
@@ -0,0 +1,72 @@
1
+ import {
2
+ registerDevtoolsPlugin
3
+ } from "./chunk-V6DKWEYD.mjs";
4
+
5
+ // src/plugins/directives.ts
6
+ var NAME = "directives";
7
+ function directivesOn(extra) {
8
+ return extra?.[NAME] ?? [];
9
+ }
10
+ function directiveBadge(notes) {
11
+ if (!notes.length) return void 0;
12
+ const first = notes[0];
13
+ const short = first.kind === "ref" ? "ref" : label(first);
14
+ return notes.length > 1 ? `${short} +${notes.length - 1}` : short;
15
+ }
16
+ function directiveRows(notes) {
17
+ return notes.map((note) => ({
18
+ label: label(note),
19
+ value: note.element,
20
+ ...note.at ? { at: note.at } : {}
21
+ }));
22
+ }
23
+ var label = (note) => note.kind === "ref" ? `ref ${note.name}` : `${note.kind}:${note.name}`;
24
+ var directivesPlugin = {
25
+ name: NAME,
26
+ collect(ctx) {
27
+ ctx.onDirective((report) => {
28
+ if (!report.target) return;
29
+ const held = ctx.elementAnnotation(report.target) ?? [];
30
+ const already = held.some((n) => n.kind === report.kind && n.name === report.name);
31
+ if (already) return;
32
+ held.push({
33
+ kind: report.kind,
34
+ name: report.name,
35
+ element: report.element,
36
+ ...report.at ? { at: report.at } : {}
37
+ });
38
+ ctx.annotateElement(report.target, held);
39
+ });
40
+ },
41
+ rows(node) {
42
+ const notes = node.extra?.[NAME];
43
+ if (!notes?.length) return [];
44
+ return notes.map((note) => ({
45
+ label: label(note),
46
+ value: note.element,
47
+ ...note.at ? { at: note.at } : {}
48
+ }));
49
+ },
50
+ elementRows(extra) {
51
+ return directiveRows(directivesOn(extra));
52
+ },
53
+ elementBadge(extra) {
54
+ return directiveBadge(directivesOn(extra));
55
+ },
56
+ badge(node) {
57
+ const notes = node.extra?.[NAME];
58
+ if (!notes?.length) return void 0;
59
+ const first = notes[0];
60
+ const short = first.kind === "ref" ? "ref" : label(first);
61
+ return notes.length > 1 ? `${short} +${notes.length - 1}` : short;
62
+ }
63
+ };
64
+ registerDevtoolsPlugin(directivesPlugin);
65
+
66
+ export {
67
+ NAME,
68
+ directivesOn,
69
+ directiveBadge,
70
+ directiveRows,
71
+ directivesPlugin
72
+ };
@@ -0,0 +1,35 @@
1
+ // src/describe.ts
2
+ var MAX_CLASSES = 2;
3
+ function textOwner(node) {
4
+ const parent = node.parentElement;
5
+ return parent ? `text in ${describeElement(parent)}` : "text";
6
+ }
7
+ function describeElement(el) {
8
+ const tag = el.tagName.toLowerCase();
9
+ const id = el.id ? `#${el.id}` : "";
10
+ const raw = typeof el.className === "string" ? el.className : el.getAttribute("class") ?? "";
11
+ const classes = raw.split(/\s+/).filter(Boolean).slice(0, MAX_CLASSES).map((c) => `.${c}`).join("");
12
+ return `${tag}${id}${classes}`;
13
+ }
14
+ function describeNode(target) {
15
+ const node = target;
16
+ if (!node || typeof node.nodeType !== "number") return "detached";
17
+ switch (node.nodeType) {
18
+ case 1:
19
+ return describeElement(node);
20
+ case 3:
21
+ return textOwner(node);
22
+ case 8: {
23
+ const parent = node.parentElement;
24
+ return parent ? `slot in ${describeElement(parent)}` : "slot";
25
+ }
26
+ case 11:
27
+ return "fragment";
28
+ default:
29
+ return node.nodeName?.toLowerCase() ?? "node";
30
+ }
31
+ }
32
+
33
+ export {
34
+ describeNode
35
+ };
@@ -0,0 +1,212 @@
1
+ // src/float.ts
2
+ var MIN_W = 240;
3
+ var MIN_H = 160;
4
+ function draggable(handle, onMove, onStart) {
5
+ handle.addEventListener("pointerdown", (event) => {
6
+ if (event.button !== 0) return;
7
+ if (event.target.closest("button")) return;
8
+ event.preventDefault();
9
+ handle.setPointerCapture(event.pointerId);
10
+ const fromX = event.clientX;
11
+ const fromY = event.clientY;
12
+ onStart?.();
13
+ const move = (e) => onMove(e.clientX - fromX, e.clientY - fromY);
14
+ const stop = () => {
15
+ handle.removeEventListener("pointermove", move);
16
+ handle.removeEventListener("pointerup", stop);
17
+ handle.removeEventListener("pointercancel", stop);
18
+ handle.removeEventListener("lostpointercapture", stop);
19
+ if (handle.hasPointerCapture(event.pointerId)) handle.releasePointerCapture(event.pointerId);
20
+ };
21
+ handle.addEventListener("pointermove", move);
22
+ handle.addEventListener("pointerup", stop);
23
+ handle.addEventListener("pointercancel", stop);
24
+ handle.addEventListener("lostpointercapture", stop);
25
+ });
26
+ }
27
+ var opened = 0;
28
+ function floatCard(doc, title, at) {
29
+ const card = doc.createElement("div");
30
+ card.className = "fx-float";
31
+ const spot = at ?? {
32
+ x: 60 + opened % 4 * 28,
33
+ y: 60 + opened % 4 * 28,
34
+ width: 360,
35
+ height: 280
36
+ };
37
+ opened += 1;
38
+ const bar = doc.createElement("div");
39
+ bar.className = "fx-float-bar";
40
+ const name = doc.createElement("span");
41
+ name.textContent = title;
42
+ bar.append(name);
43
+ card.append(bar);
44
+ let x = spot.x;
45
+ let y = spot.y;
46
+ let w = spot.width;
47
+ let h = spot.height;
48
+ const apply = () => {
49
+ const view = doc.defaultView;
50
+ const vw = view?.innerWidth ?? w;
51
+ const vh = view?.innerHeight ?? h;
52
+ w = Math.min(Math.max(MIN_W, w), vw);
53
+ h = Math.min(Math.max(MIN_H, h), vh);
54
+ x = Math.min(Math.max(0, x), Math.max(0, vw - w));
55
+ y = Math.min(Math.max(0, y), Math.max(0, vh - h));
56
+ card.style.left = `${x}px`;
57
+ card.style.top = `${y}px`;
58
+ card.style.width = `${w}px`;
59
+ card.style.height = `${h}px`;
60
+ };
61
+ let from = { x, y, w, h };
62
+ const remember = () => {
63
+ from = { x, y, w, h };
64
+ };
65
+ for (const edge of ["n", "s", "e", "w", "ne", "nw", "se", "sw"]) {
66
+ const handle = doc.createElement("div");
67
+ handle.className = `fx-float-h fx-float-${edge}`;
68
+ card.append(handle);
69
+ draggable(
70
+ handle,
71
+ (dx, dy) => {
72
+ if (edge.includes("e")) w = from.w + dx;
73
+ if (edge.includes("s")) h = from.h + dy;
74
+ if (edge.includes("w")) {
75
+ w = Math.max(MIN_W, from.w - dx);
76
+ x = from.x + from.w - w;
77
+ }
78
+ if (edge.includes("n")) {
79
+ h = Math.max(MIN_H, from.h - dy);
80
+ y = from.y + from.h - h;
81
+ }
82
+ apply();
83
+ },
84
+ remember
85
+ );
86
+ }
87
+ draggable(
88
+ bar,
89
+ (dx, dy) => {
90
+ x = from.x + dx;
91
+ y = from.y + dy;
92
+ apply();
93
+ },
94
+ remember
95
+ );
96
+ apply();
97
+ return { card, bar, remove: () => card.remove() };
98
+ }
99
+ function makeFloatable(pane, options) {
100
+ const doc = pane.ownerDocument;
101
+ let card = null;
102
+ let home = null;
103
+ const button = doc.createElement("button");
104
+ button.type = "button";
105
+ button.className = "fx-float-btn";
106
+ button.textContent = "⇱";
107
+ button.title = `Float ${options.title}`;
108
+ pane.classList.add("fx-floatable");
109
+ pane.append(button);
110
+ const keep = new MutationObserver(() => {
111
+ if (button.parentNode !== pane) pane.append(button);
112
+ });
113
+ keep.observe(pane, { childList: true });
114
+ function dock() {
115
+ if (!card || !home) return;
116
+ home.parent.insertBefore(pane, home.before);
117
+ card.remove();
118
+ card = null;
119
+ home = null;
120
+ pane.classList.remove("fx-floated");
121
+ button.textContent = "⇱";
122
+ button.title = `Float ${options.title}`;
123
+ options.onChange?.(false);
124
+ }
125
+ function float() {
126
+ if (card || !pane.parentNode) return;
127
+ home = { parent: pane.parentNode, before: pane.nextSibling };
128
+ const built = floatCard(doc, options.title, options.at);
129
+ card = built.card;
130
+ card.append(pane);
131
+ doc.body.appendChild(card);
132
+ pane.classList.add("fx-floated");
133
+ button.textContent = "⇲";
134
+ button.title = `Put ${options.title} back`;
135
+ options.onChange?.(true);
136
+ }
137
+ button.addEventListener("click", (event) => {
138
+ event.stopPropagation();
139
+ if (card) dock();
140
+ else float();
141
+ });
142
+ return {
143
+ get floating() {
144
+ return card !== null;
145
+ },
146
+ toggle() {
147
+ if (card) dock();
148
+ else float();
149
+ return card !== null;
150
+ },
151
+ dock,
152
+ destroy() {
153
+ keep.disconnect();
154
+ dock();
155
+ button.remove();
156
+ pane.classList.remove("fx-floatable");
157
+ }
158
+ };
159
+ }
160
+ var FLOAT_CSS = `
161
+ .fx-floatable { position: relative; }
162
+ .fx-float-btn {
163
+ position: absolute; top: 2px; right: 2px; z-index: 5;
164
+ width: 18px; height: 18px; padding: 0; line-height: 1;
165
+ font-size: 11px; color: var(--fx-muted, #8a90a2);
166
+ background: var(--fx-panel, #14161c);
167
+ border: 1px solid var(--fx-line, #262a35); border-radius: 4px;
168
+ cursor: pointer; opacity: 0; transition: opacity .12s;
169
+ }
170
+ .fx-floatable:hover .fx-float-btn, .fx-float-btn:focus-visible { opacity: 1; }
171
+ .fx-float-btn:hover { color: var(--fx-accent, #5eead4); border-color: var(--fx-accent, #5eead4); }
172
+
173
+ .fx-float {
174
+ position: fixed; z-index: 60; display: flex; flex-direction: column;
175
+ background: var(--fx-panel, #14161c);
176
+ border: 1px solid var(--fx-line, #262a35); border-radius: 8px;
177
+ box-shadow: 0 12px 34px rgba(0, 0, 0, .5); overflow: hidden;
178
+ }
179
+ .fx-float-bar {
180
+ display: flex; align-items: center; padding: 4px 8px; cursor: move;
181
+ font-size: 11px; color: var(--fx-muted, #8a90a2);
182
+ background: var(--fx-bg, #0f1115); border-bottom: 1px solid var(--fx-line, #262a35);
183
+ user-select: none;
184
+ }
185
+ /* The pane fills the card, whatever it was sized to in the layout it came from. */
186
+ .fx-float > .fx-floated {
187
+ flex: 1; min-height: 0; width: auto; height: auto; overflow: auto;
188
+ }
189
+ /* Edges and corners. Thin, and over everything, so a card can be resized from whichever
190
+ side is reachable. */
191
+ .fx-float-h { position: absolute; z-index: 1; }
192
+ .fx-float-n, .fx-float-s { left: 8px; right: 8px; height: 6px; cursor: ns-resize; }
193
+ .fx-float-e, .fx-float-w { top: 8px; bottom: 8px; width: 6px; cursor: ew-resize; }
194
+ .fx-float-n { top: -3px; }
195
+ .fx-float-s { bottom: -3px; }
196
+ .fx-float-e { right: -3px; }
197
+ .fx-float-w { left: -3px; }
198
+ .fx-float-ne, .fx-float-nw, .fx-float-se, .fx-float-sw { width: 14px; height: 14px; }
199
+ .fx-float-nw { top: -3px; left: -3px; cursor: nwse-resize; }
200
+ .fx-float-ne { top: -3px; right: -3px; cursor: nesw-resize; }
201
+ .fx-float-sw { bottom: -3px; left: -3px; cursor: nesw-resize; }
202
+ .fx-float-se {
203
+ bottom: 0; right: 0; cursor: nwse-resize;
204
+ background: linear-gradient(135deg, transparent 50%, var(--fx-line, #262a35) 50%);
205
+ }
206
+ `;
207
+
208
+ export {
209
+ floatCard,
210
+ makeFloatable,
211
+ FLOAT_CSS
212
+ };