@fluixi/devtools 0.2.0-alpha.2 → 0.2.0-alpha.4
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 +80 -2
- package/dist/callsite.cjs +72 -0
- package/dist/callsite.d.ts +22 -0
- package/dist/callsite.d.ts.map +1 -0
- package/dist/callsite.js +82 -0
- package/dist/callsite.mjs +51 -0
- package/dist/change-view.cjs +134 -0
- package/dist/change-view.d.ts +10 -0
- package/dist/change-view.d.ts.map +1 -0
- package/dist/change-view.js +102 -0
- package/dist/change-view.mjs +111 -0
- package/dist/copy.cjs +63 -0
- package/dist/copy.d.ts +9 -0
- package/dist/copy.d.ts.map +1 -0
- package/dist/copy.js +52 -0
- package/dist/copy.mjs +42 -0
- package/dist/describe.cjs +55 -0
- package/dist/describe.d.ts +3 -0
- package/dist/describe.d.ts.map +1 -0
- package/dist/describe.js +47 -0
- package/dist/describe.mjs +34 -0
- package/dist/detail-panel.cjs +307 -0
- package/dist/detail-panel.d.ts +17 -0
- package/dist/detail-panel.d.ts.map +1 -0
- package/dist/detail-panel.js +217 -0
- package/dist/detail-panel.mjs +284 -0
- package/dist/diff.cjs +225 -0
- package/dist/diff.d.ts +31 -0
- package/dist/diff.d.ts.map +1 -0
- package/dist/diff.js +132 -0
- package/dist/diff.mjs +202 -0
- package/dist/dom.cjs +204 -0
- package/dist/dom.d.ts +81 -0
- package/dist/dom.d.ts.map +1 -0
- package/dist/dom.js +269 -0
- package/dist/dom.mjs +183 -0
- package/dist/export.cjs +221 -0
- package/dist/export.d.ts +55 -0
- package/dist/export.d.ts.map +1 -0
- package/dist/export.js +90 -0
- package/dist/export.mjs +209 -0
- package/dist/float.cjs +232 -0
- package/dist/float.d.ts +54 -0
- package/dist/float.d.ts.map +1 -0
- package/dist/float.js +256 -0
- package/dist/float.mjs +211 -0
- package/dist/format.cjs +175 -0
- package/dist/format.d.ts +16 -0
- package/dist/format.d.ts.map +1 -0
- package/dist/format.js +188 -0
- package/dist/format.mjs +154 -0
- package/dist/graph-view.cjs +893 -0
- package/dist/graph-view.d.ts +79 -2
- package/dist/graph-view.d.ts.map +1 -1
- package/dist/graph-view.js +866 -50
- package/dist/graph-view.mjs +870 -0
- package/dist/highlight.cjs +140 -0
- package/dist/highlight.d.ts +56 -0
- package/dist/highlight.d.ts.map +1 -0
- package/dist/highlight.js +154 -0
- package/dist/highlight.mjs +119 -0
- package/dist/history.cjs +95 -0
- package/dist/history.d.ts +59 -0
- package/dist/history.d.ts.map +1 -0
- package/dist/history.js +85 -0
- package/dist/history.mjs +74 -0
- package/dist/hook.cjs +1562 -0
- package/dist/hook.d.ts +60 -0
- package/dist/hook.d.ts.map +1 -0
- package/dist/hook.js +142 -0
- package/dist/hook.mjs +1553 -0
- package/dist/index.cjs +4552 -0
- package/dist/index.d.ts +44 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +25 -1
- package/dist/index.mjs +4544 -0
- package/dist/inspector.cjs +688 -0
- package/dist/inspector.d.ts +60 -0
- package/dist/inspector.d.ts.map +1 -0
- package/dist/inspector.js +415 -0
- package/dist/inspector.mjs +676 -0
- package/dist/instrument.cjs +497 -0
- package/dist/instrument.d.ts +147 -5
- package/dist/instrument.d.ts.map +1 -1
- package/dist/instrument.js +164 -44
- package/dist/instrument.mjs +487 -0
- package/dist/kind-filter.cjs +172 -0
- package/dist/kind-filter.d.ts +39 -0
- package/dist/kind-filter.d.ts.map +1 -0
- package/dist/kind-filter.js +151 -0
- package/dist/kind-filter.mjs +151 -0
- package/dist/menu.cjs +141 -0
- package/dist/menu.d.ts +37 -0
- package/dist/menu.d.ts.map +1 -0
- package/dist/menu.js +125 -0
- package/dist/menu.mjs +120 -0
- package/dist/observe.cjs +1352 -0
- package/dist/observe.d.ts +80 -0
- package/dist/observe.d.ts.map +1 -0
- package/dist/observe.js +893 -0
- package/dist/observe.mjs +1345 -0
- package/dist/palette.cjs +52 -0
- package/dist/palette.d.ts +11 -0
- package/dist/palette.d.ts.map +1 -0
- package/dist/palette.js +27 -0
- package/dist/palette.mjs +31 -0
- package/dist/path.cjs +45 -0
- package/dist/path.d.ts +19 -0
- package/dist/path.d.ts.map +1 -0
- package/dist/path.js +49 -0
- package/dist/path.mjs +24 -0
- package/dist/plugin.cjs +87 -0
- package/dist/plugin.d.ts +121 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +74 -0
- package/dist/plugin.mjs +66 -0
- package/dist/plugins/context.cjs +98 -0
- package/dist/plugins/context.d.ts +10 -0
- package/dist/plugins/context.d.ts.map +1 -0
- package/dist/plugins/context.js +80 -0
- package/dist/plugins/context.mjs +75 -0
- package/dist/plugins/directives.cjs +98 -0
- package/dist/plugins/directives.d.ts +25 -0
- package/dist/plugins/directives.d.ts.map +1 -0
- package/dist/plugins/directives.js +78 -0
- package/dist/plugins/directives.mjs +75 -0
- package/dist/plugins/index.cjs +162 -0
- package/dist/plugins/index.d.ts +7 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +9 -0
- package/dist/plugins/index.mjs +140 -0
- package/dist/source.cjs +111 -0
- package/dist/source.d.ts +72 -0
- package/dist/source.d.ts.map +1 -0
- package/dist/source.js +153 -0
- package/dist/source.mjs +90 -0
- package/dist/timeline.cjs +350 -0
- package/dist/timeline.d.ts +30 -0
- package/dist/timeline.d.ts.map +1 -0
- package/dist/timeline.js +271 -0
- package/dist/timeline.mjs +327 -0
- package/dist/tree.cjs +574 -0
- package/dist/tree.d.ts +128 -0
- package/dist/tree.d.ts.map +1 -0
- package/dist/tree.js +645 -0
- package/dist/tree.mjs +551 -0
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/value-pane.cjs +223 -0
- package/dist/value-pane.d.ts +10 -0
- package/dist/value-pane.d.ts.map +1 -0
- package/dist/value-pane.js +61 -0
- package/dist/value-pane.mjs +200 -0
- package/dist/wire.cjs +109 -0
- package/dist/wire.d.ts +100 -0
- package/dist/wire.d.ts.map +1 -0
- package/dist/wire.js +93 -0
- package/dist/wire.mjs +89 -0
- package/package.json +17 -5
package/dist/menu.mjs
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
// src/menu.ts
|
|
2
|
+
function createMenu(host, options) {
|
|
3
|
+
const doc = host.ownerDocument;
|
|
4
|
+
const root = doc.createElement("div");
|
|
5
|
+
root.className = "fx-menu";
|
|
6
|
+
const button = doc.createElement("button");
|
|
7
|
+
button.type = "button";
|
|
8
|
+
button.className = "fx-menu-button fx-dropdown-btn";
|
|
9
|
+
button.setAttribute("aria-haspopup", "true");
|
|
10
|
+
button.setAttribute("aria-expanded", "false");
|
|
11
|
+
if (options.hint) button.title = options.hint;
|
|
12
|
+
const caret = doc.createElement("div");
|
|
13
|
+
caret.className = "fx-dropdown-caret";
|
|
14
|
+
const panel = doc.createElement("div");
|
|
15
|
+
panel.className = "fx-menu-panel";
|
|
16
|
+
if (options.menuClass) {
|
|
17
|
+
panel.classList.add(...options.menuClass.split(/\s+/).filter((c) => c));
|
|
18
|
+
}
|
|
19
|
+
panel.hidden = true;
|
|
20
|
+
const boxes = /* @__PURE__ */ new Map();
|
|
21
|
+
for (const item of options.items) {
|
|
22
|
+
if (item.type === "action") {
|
|
23
|
+
const run = doc.createElement("button");
|
|
24
|
+
run.type = "button";
|
|
25
|
+
run.className = "fx-menu-action";
|
|
26
|
+
run.textContent = item.label;
|
|
27
|
+
if (item.hint) run.title = item.hint;
|
|
28
|
+
run.addEventListener("click", () => {
|
|
29
|
+
close();
|
|
30
|
+
item.onRun();
|
|
31
|
+
});
|
|
32
|
+
panel.append(run);
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
const box = doc.createElement("input");
|
|
36
|
+
box.type = "checkbox";
|
|
37
|
+
box.checked = item.on === true;
|
|
38
|
+
const row = doc.createElement("label");
|
|
39
|
+
if (item.hint) row.title = item.hint;
|
|
40
|
+
row.append(box, doc.createTextNode(item.label));
|
|
41
|
+
box.addEventListener("change", () => {
|
|
42
|
+
paint();
|
|
43
|
+
item.onChange(box.checked);
|
|
44
|
+
});
|
|
45
|
+
panel.append(row);
|
|
46
|
+
boxes.set(item.label, box);
|
|
47
|
+
}
|
|
48
|
+
root.append(button, panel);
|
|
49
|
+
host.append(root);
|
|
50
|
+
function paint() {
|
|
51
|
+
let on = 0;
|
|
52
|
+
for (const box of boxes.values()) if (box.checked) on++;
|
|
53
|
+
button.textContent = on ? `${options.label} · ${on}` : options.label;
|
|
54
|
+
button.appendChild(caret);
|
|
55
|
+
button.classList.toggle("on", on > 0);
|
|
56
|
+
}
|
|
57
|
+
function close() {
|
|
58
|
+
panel.hidden = true;
|
|
59
|
+
button.setAttribute("aria-expanded", "false");
|
|
60
|
+
}
|
|
61
|
+
button.addEventListener("click", (event) => {
|
|
62
|
+
event.stopPropagation();
|
|
63
|
+
panel.hidden = !panel.hidden;
|
|
64
|
+
button.setAttribute("aria-expanded", String(!panel.hidden));
|
|
65
|
+
});
|
|
66
|
+
panel.addEventListener("click", (event) => event.stopPropagation());
|
|
67
|
+
const away = () => close();
|
|
68
|
+
const key = (event) => {
|
|
69
|
+
if (event.key === "Escape") close();
|
|
70
|
+
};
|
|
71
|
+
doc.addEventListener("click", away);
|
|
72
|
+
doc.addEventListener("keydown", key);
|
|
73
|
+
paint();
|
|
74
|
+
return {
|
|
75
|
+
set(label, on) {
|
|
76
|
+
const box = boxes.get(label);
|
|
77
|
+
if (!box) return;
|
|
78
|
+
box.checked = on;
|
|
79
|
+
paint();
|
|
80
|
+
},
|
|
81
|
+
destroy() {
|
|
82
|
+
doc.removeEventListener("click", away);
|
|
83
|
+
doc.removeEventListener("keydown", key);
|
|
84
|
+
root.remove();
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
var MENU_CSS = `
|
|
89
|
+
/* The button itself is styled by DROPDOWN_FILTER_CSS, shared with the kind filter. */
|
|
90
|
+
.fx-menu { position: relative; display: inline-flex; }
|
|
91
|
+
.fx-menu-button { white-space: nowrap; position: relative; padding-inline-end: 1.1rem; }
|
|
92
|
+
/* hidden is display:none from the user agent, which a class setting display outranks. */
|
|
93
|
+
.fx-menu-panel[hidden] { display: none; }
|
|
94
|
+
.fx-menu-panel {
|
|
95
|
+
position: absolute; top: calc(100% + 4px); z-index: 40;
|
|
96
|
+
display: grid; gap: 2px; padding: 6px 8px; min-width: 150px;
|
|
97
|
+
background: var(--fx-panel, #14161c);
|
|
98
|
+
border: 1px solid var(--fx-line, #262a35); border-radius: 6px;
|
|
99
|
+
box-shadow: 0 6px 18px rgba(0, 0, 0, .38);
|
|
100
|
+
}
|
|
101
|
+
.fx-menu-panel:not(.fx-panel-left){ right: 0; }
|
|
102
|
+
.fx-menu-panel.fx-panel-left { left: 0; }
|
|
103
|
+
.fx-menu-panel label {
|
|
104
|
+
display: flex; align-items: center; gap: 6px;
|
|
105
|
+
font-size: 11px; color: var(--fx-muted, #8a90a2); cursor: pointer; user-select: none;
|
|
106
|
+
}
|
|
107
|
+
.fx-menu-panel label:hover { color: var(--fx-label, #e7e9ee); }
|
|
108
|
+
.fx-menu-panel input { width: 11px; height: 11px; margin: 0; accent-color: var(--fx-accent, #5eead4); }
|
|
109
|
+
.fx-menu-action {
|
|
110
|
+
text-align: left; padding: 2px 0; border: 0; background: none; cursor: pointer;
|
|
111
|
+
font: inherit; font-size: 11px; color: var(--fx-muted, #8a90a2);
|
|
112
|
+
/* A button does not inherit this, so an action read lowercase beside uppercase toggles. */
|
|
113
|
+
text-transform: inherit; letter-spacing: inherit;
|
|
114
|
+
}
|
|
115
|
+
.fx-menu-action:hover { color: var(--fx-accent, #5eead4); }
|
|
116
|
+
`;
|
|
117
|
+
export {
|
|
118
|
+
MENU_CSS,
|
|
119
|
+
createMenu
|
|
120
|
+
};
|