@fluixi/devtools 1.0.0-alpha.108 → 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.
- package/dist/callsite.mjs +4 -63
- package/dist/change-view.mjs +6 -106
- package/dist/chunk-2VDMQ3VF.mjs +520 -0
- package/dist/chunk-33U2S43X.mjs +121 -0
- package/dist/chunk-4P45Y5EB.mjs +214 -0
- package/dist/chunk-B3SAJ7QG.mjs +72 -0
- package/dist/chunk-CPZWLBCQ.mjs +35 -0
- package/dist/chunk-D25KZZBZ.mjs +212 -0
- package/dist/chunk-EBSROPWJ.mjs +314 -0
- package/dist/chunk-F664XLZL.mjs +743 -0
- package/dist/chunk-FY5K3QVT.mjs +35 -0
- package/dist/chunk-G7Z7CVP5.mjs +184 -0
- package/dist/chunk-GDQXCOQB.mjs +43 -0
- package/dist/chunk-L6XQGNMW.mjs +106 -0
- package/dist/chunk-MN6O673L.mjs +90 -0
- package/dist/chunk-NDUBBBNL.mjs +70 -0
- package/dist/chunk-NT7YMK77.mjs +157 -0
- package/dist/chunk-NVULLJDH.mjs +120 -0
- package/dist/chunk-NWLSDERQ.mjs +68 -0
- package/dist/chunk-OPIGF5XB.mjs +184 -0
- package/dist/chunk-P5I7DWFX.mjs +292 -0
- package/dist/chunk-PKARAAIS.mjs +75 -0
- package/dist/chunk-PSSBFXBD.mjs +155 -0
- package/dist/chunk-PTQ5VCYE.mjs +103 -0
- package/dist/chunk-PU4MJ5RU.mjs +107 -0
- package/dist/chunk-UAEJ3N7F.mjs +76 -0
- package/dist/chunk-V6DKWEYD.mjs +67 -0
- package/dist/chunk-VO2V7AC5.mjs +80 -0
- package/dist/chunk-WGQH7RUW.mjs +25 -0
- package/dist/chunk-Y5OQWBAM.mjs +777 -0
- package/dist/chunk-Z6KYHEKY.mjs +64 -0
- package/dist/copy.mjs +3 -39
- package/dist/describe.mjs +3 -31
- package/dist/detail-panel.mjs +6 -280
- package/dist/diff.mjs +4 -201
- package/dist/dom.mjs +7 -176
- package/dist/export.mjs +6 -207
- package/dist/float.mjs +5 -206
- package/dist/format.mjs +5 -151
- package/dist/graph-view.mjs +9 -875
- package/dist/highlight.mjs +6 -113
- package/dist/history.mjs +4 -70
- package/dist/hook.mjs +16 -1719
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +106 -4673
- package/dist/inspector.mjs +11 -677
- package/dist/instrument.mjs +9 -486
- package/dist/kind-filter.mjs +6 -148
- package/dist/menu.mjs +4 -116
- package/dist/observe.mjs +14 -1510
- package/dist/palette.mjs +6 -28
- package/dist/path.mjs +3 -21
- package/dist/plugin.mjs +9 -57
- package/dist/plugins/context.mjs +6 -71
- package/dist/plugins/directives.mjs +8 -68
- package/dist/plugins/index.cjs +1 -1
- package/dist/plugins/index.mjs +13 -136
- package/dist/source.mjs +12 -93
- package/dist/timeline.mjs +7 -323
- package/dist/tree.mjs +11 -558
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/value-pane.mjs +6 -196
- package/dist/wire.cjs +1 -1
- package/dist/wire.mjs +6 -86
- package/package.json +3 -3
package/dist/dom.mjs
CHANGED
|
@@ -1,179 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
let out = element.tagName.toLowerCase();
|
|
9
|
-
if (element.id) out += `#${element.id}`;
|
|
10
|
-
const classes = element.classList;
|
|
11
|
-
if (classes.length > 0) {
|
|
12
|
-
out += `.${classes[0]}`;
|
|
13
|
-
if (classes.length > 1) out += `.${classes[1]}`;
|
|
14
|
-
}
|
|
15
|
-
return out;
|
|
16
|
-
}
|
|
17
|
-
function describeAll(graph, roots, writtenBy, kinds, extraFor) {
|
|
18
|
-
const owners = /* @__PURE__ */ new Map();
|
|
19
|
-
const writers = /* @__PURE__ */ new Map();
|
|
20
|
-
const rendered = /* @__PURE__ */ new Map();
|
|
21
|
-
for (const node of graph.values()) {
|
|
22
|
-
if (kinds.has(node.kind)) {
|
|
23
|
-
const found = roots(node.id);
|
|
24
|
-
rendered.set(node.id, found);
|
|
25
|
-
for (const element of found) if (!owners.has(element)) owners.set(element, node.id);
|
|
26
|
-
continue;
|
|
27
|
-
}
|
|
28
|
-
for (const element of writtenBy(node.id)) {
|
|
29
|
-
const held = writers.get(element);
|
|
30
|
-
if (held) held.push(node.id);
|
|
31
|
-
else writers.set(element, [node.id]);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
const { claimed, containers } = claimOrphans(graph, rendered, writtenBy, kinds, owners);
|
|
35
|
-
const claims = /* @__PURE__ */ new Map();
|
|
36
|
-
for (const [element, id] of claimed) {
|
|
37
|
-
const held = claims.get(id);
|
|
38
|
-
if (held) held.push(element);
|
|
39
|
-
else claims.set(id, [element]);
|
|
40
|
-
}
|
|
41
|
-
const landing = landings(graph, rendered, writtenBy, kinds, claimed, containers);
|
|
42
|
-
const out = /* @__PURE__ */ new Map();
|
|
43
|
-
for (const node of graph.values()) {
|
|
44
|
-
if (!kinds.has(node.kind)) continue;
|
|
45
|
-
const budget = { left: DOM_BUDGET };
|
|
46
|
-
const walk = (element) => {
|
|
47
|
-
const owner = owners.get(element) ?? claimed.get(element);
|
|
48
|
-
const where = locationOf(element);
|
|
49
|
-
if (owner !== void 0 && owner !== node.id) {
|
|
50
|
-
return { label: describeElement(element), children: [], owner, element, ...where ? { at: where } : {} };
|
|
51
|
-
}
|
|
52
|
-
if (containers.has(element)) {
|
|
53
|
-
return { label: describeElement(element), children: [], container: true, element, ...where ? { at: where } : {} };
|
|
54
|
-
}
|
|
55
|
-
const children = [];
|
|
56
|
-
const kids = element.children;
|
|
57
|
-
for (let i = 0, n = kids.length; i < n && budget.left > 0; i++) {
|
|
58
|
-
budget.left -= 1;
|
|
59
|
-
children.push(walk(kids[i]));
|
|
60
|
-
}
|
|
61
|
-
const writes = writers.get(element);
|
|
62
|
-
const extra = extraFor?.(element);
|
|
63
|
-
const inside = landing.get(element)?.filter((id) => within(graph, id, node.id));
|
|
64
|
-
return {
|
|
65
|
-
label: describeElement(element),
|
|
66
|
-
children,
|
|
67
|
-
element,
|
|
68
|
-
...where ? { at: where } : {},
|
|
69
|
-
...writes?.length ? { writes } : {},
|
|
70
|
-
...inside?.length ? { inside } : {},
|
|
71
|
-
...extra ? { extra } : {}
|
|
72
|
-
};
|
|
73
|
-
};
|
|
74
|
-
out.set(node.id, [...rendered.get(node.id) ?? [], ...claims.get(node.id) ?? []].map(walk));
|
|
75
|
-
}
|
|
76
|
-
return out;
|
|
77
|
-
}
|
|
78
|
-
function within(graph, id, ancestor) {
|
|
79
|
-
const seen = /* @__PURE__ */ new Set();
|
|
80
|
-
for (let at = graph.get(id)?.createdIn; at !== void 0 && !seen.has(at); at = graph.get(at)?.createdIn) {
|
|
81
|
-
if (at === ancestor) return true;
|
|
82
|
-
seen.add(at);
|
|
83
|
-
}
|
|
84
|
-
return false;
|
|
85
|
-
}
|
|
86
|
-
function landings(graph, rendered, writtenBy, kinds, claimed, containers) {
|
|
87
|
-
const claimers = new Set(claimed.values());
|
|
88
|
-
const landing = /* @__PURE__ */ new Map();
|
|
89
|
-
for (const node of graph.values()) {
|
|
90
|
-
if (!kinds.has(node.kind) || (rendered.get(node.id) ?? []).length) continue;
|
|
91
|
-
if (claimers.has(node.id)) continue;
|
|
92
|
-
let shallowest;
|
|
93
|
-
let best = Infinity;
|
|
94
|
-
for (const element of writtenBy(node.id)) {
|
|
95
|
-
if (containers.has(element)) continue;
|
|
96
|
-
const depth = depthInDocument(element);
|
|
97
|
-
if (depth < best) {
|
|
98
|
-
best = depth;
|
|
99
|
-
shallowest = element;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
if (!shallowest) continue;
|
|
103
|
-
const held = landing.get(shallowest);
|
|
104
|
-
if (held) held.push(node.id);
|
|
105
|
-
else landing.set(shallowest, [node.id]);
|
|
106
|
-
}
|
|
107
|
-
for (const [element, ids] of landing) {
|
|
108
|
-
landing.set(element, ids.filter((id) => !ids.some((other) => other !== id && within(graph, id, other))));
|
|
109
|
-
}
|
|
110
|
-
return landing;
|
|
111
|
-
}
|
|
112
|
-
function tagDepths(graph, kinds) {
|
|
113
|
-
const depth = /* @__PURE__ */ new Map();
|
|
114
|
-
const of = (id, seen) => {
|
|
115
|
-
const held = depth.get(id);
|
|
116
|
-
if (held !== void 0) return held;
|
|
117
|
-
if (seen.has(id)) return 0;
|
|
118
|
-
seen.add(id);
|
|
119
|
-
const parent = graph.get(id)?.createdIn;
|
|
120
|
-
const value = parent === void 0 ? 0 : of(parent, seen) + 1;
|
|
121
|
-
depth.set(id, value);
|
|
122
|
-
return value;
|
|
123
|
-
};
|
|
124
|
-
for (const node of graph.values()) if (kinds.has(node.kind)) of(node.id, /* @__PURE__ */ new Set());
|
|
125
|
-
return depth;
|
|
126
|
-
}
|
|
127
|
-
function depthInDocument(element) {
|
|
128
|
-
let steps = 0;
|
|
129
|
-
for (let at = element.parentElement; at; at = at.parentElement) steps++;
|
|
130
|
-
return steps;
|
|
131
|
-
}
|
|
132
|
-
function claimOrphans(graph, rendered, writtenBy, kinds, owners) {
|
|
133
|
-
const depth = tagDepths(graph, kinds);
|
|
134
|
-
const wraps = (element) => {
|
|
135
|
-
for (const owned of owners.keys()) if (element !== owned && element.contains(owned)) return true;
|
|
136
|
-
return false;
|
|
137
|
-
};
|
|
138
|
-
const writing = /* @__PURE__ */ new Map();
|
|
139
|
-
for (const node of graph.values()) {
|
|
140
|
-
if (!kinds.has(node.kind) || (rendered.get(node.id) ?? []).length) continue;
|
|
141
|
-
for (const element of writtenBy(node.id)) {
|
|
142
|
-
if (owners.has(element)) continue;
|
|
143
|
-
const held = writing.get(element);
|
|
144
|
-
if (held) held.push(node.id);
|
|
145
|
-
else writing.set(element, [node.id]);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
const claimed = /* @__PURE__ */ new Map();
|
|
149
|
-
const containers = /* @__PURE__ */ new Set();
|
|
150
|
-
const covered = (element) => {
|
|
151
|
-
for (let at = element.parentElement; at; at = at.parentElement) {
|
|
152
|
-
if (owners.has(at) || claimed.has(at)) return true;
|
|
153
|
-
}
|
|
154
|
-
return false;
|
|
155
|
-
};
|
|
156
|
-
const order = [...writing.keys()].sort((a, b) => depthInDocument(a) - depthInDocument(b));
|
|
157
|
-
for (const element of order) {
|
|
158
|
-
if (covered(element)) continue;
|
|
159
|
-
const ids = writing.get(element);
|
|
160
|
-
const container = wraps(element);
|
|
161
|
-
const pick = ids.reduce((best, id) => {
|
|
162
|
-
const a = depth.get(id) ?? 0;
|
|
163
|
-
const b = depth.get(best) ?? 0;
|
|
164
|
-
return container ? a < b ? id : best : a > b ? id : best;
|
|
165
|
-
});
|
|
166
|
-
claimed.set(element, pick);
|
|
167
|
-
if (container) containers.add(element);
|
|
168
|
-
}
|
|
169
|
-
return { claimed, containers };
|
|
170
|
-
}
|
|
171
|
-
function withoutElements(nodes) {
|
|
172
|
-
return nodes.map(({ element, children, ...rest }) => ({
|
|
173
|
-
...rest,
|
|
174
|
-
children: withoutElements(children)
|
|
175
|
-
}));
|
|
176
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
DOM_BUDGET,
|
|
3
|
+
describeAll,
|
|
4
|
+
describeElement,
|
|
5
|
+
tagDepths,
|
|
6
|
+
withoutElements
|
|
7
|
+
} from "./chunk-OPIGF5XB.mjs";
|
|
177
8
|
export {
|
|
178
9
|
DOM_BUDGET,
|
|
179
10
|
describeAll,
|
package/dist/export.mjs
CHANGED
|
@@ -1,211 +1,10 @@
|
|
|
1
|
-
// src/instrument.ts
|
|
2
1
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
onCleanup,
|
|
10
|
-
getOwner,
|
|
11
|
-
runWithOwner,
|
|
12
|
-
Signal
|
|
13
|
-
} from "@fluixi/reactive/signal";
|
|
14
|
-
import { createStore } from "@fluixi/reactive/store";
|
|
15
|
-
|
|
16
|
-
// src/source.ts
|
|
17
|
-
var MARKS = "__FLUIXI_DEVTOOLS_MARKS__";
|
|
18
|
-
var host = globalThis;
|
|
19
|
-
var shared = host[MARKS] ?? {
|
|
20
|
-
pending: null,
|
|
21
|
-
expiring: false,
|
|
22
|
-
components: /* @__PURE__ */ new Map()
|
|
23
|
-
};
|
|
24
|
-
host[MARKS] = shared;
|
|
25
|
-
shared.classes ??= /* @__PURE__ */ new WeakMap();
|
|
26
|
-
|
|
27
|
-
// src/format.ts
|
|
28
|
-
var MAX_DEPTH = 3;
|
|
29
|
-
var MAX_ENTRIES = 8;
|
|
30
|
-
function domName(v) {
|
|
31
|
-
if (typeof v?.nodeType !== "number" || typeof v.nodeName !== "string") return null;
|
|
32
|
-
return v.tagName ? `<${v.tagName.toLowerCase()}>` : `#${v.nodeName.toLowerCase()}`;
|
|
33
|
-
}
|
|
34
|
-
function fnName(v) {
|
|
35
|
-
return v.name ? `ƒ ${v.name}()` : "ƒ";
|
|
36
|
-
}
|
|
37
|
-
function className(v) {
|
|
38
|
-
const name = v.constructor?.name;
|
|
39
|
-
return name && name !== "Object" ? `${name} ` : "";
|
|
40
|
-
}
|
|
41
|
-
function primitive(v) {
|
|
42
|
-
if (v === null) return "null";
|
|
43
|
-
switch (typeof v) {
|
|
44
|
-
case "undefined":
|
|
45
|
-
return "undefined";
|
|
46
|
-
case "string":
|
|
47
|
-
return JSON.stringify(v);
|
|
48
|
-
case "number":
|
|
49
|
-
case "boolean":
|
|
50
|
-
return String(v);
|
|
51
|
-
case "bigint":
|
|
52
|
-
return `${v}n`;
|
|
53
|
-
case "symbol":
|
|
54
|
-
return v.toString();
|
|
55
|
-
case "function":
|
|
56
|
-
return fnName(v);
|
|
57
|
-
default:
|
|
58
|
-
return null;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
function walk(value, depth, seen) {
|
|
62
|
-
const simple = primitive(value);
|
|
63
|
-
if (simple !== null) return simple;
|
|
64
|
-
const object = value;
|
|
65
|
-
if (seen.has(object)) return "[circular]";
|
|
66
|
-
const dom = domName(object);
|
|
67
|
-
if (dom) return dom;
|
|
68
|
-
if (object instanceof Date) return Number.isNaN(object.getTime()) ? "Invalid Date" : object.toISOString();
|
|
69
|
-
if (object instanceof RegExp) return String(object);
|
|
70
|
-
if (object instanceof Error) return `${object.name}: ${object.message}`;
|
|
71
|
-
if (object instanceof Promise) return "Promise";
|
|
72
|
-
if (ArrayBuffer.isView(object)) {
|
|
73
|
-
return `${className(object).trim()}(${object.length ?? ""})`;
|
|
74
|
-
}
|
|
75
|
-
if (depth >= MAX_DEPTH) return Array.isArray(object) ? "[…]" : "{…}";
|
|
76
|
-
seen.add(object);
|
|
77
|
-
try {
|
|
78
|
-
if (Array.isArray(object)) {
|
|
79
|
-
const shown2 = object.slice(0, MAX_ENTRIES).map((item) => walk(item, depth + 1, seen));
|
|
80
|
-
if (object.length > MAX_ENTRIES) shown2.push("…");
|
|
81
|
-
return `[${shown2.join(", ")}]`;
|
|
82
|
-
}
|
|
83
|
-
if (object instanceof Map) {
|
|
84
|
-
const shown2 = [];
|
|
85
|
-
for (const [k, v] of object) {
|
|
86
|
-
if (shown2.length === MAX_ENTRIES) {
|
|
87
|
-
shown2.push("…");
|
|
88
|
-
break;
|
|
89
|
-
}
|
|
90
|
-
shown2.push(`${walk(k, depth + 1, seen)} => ${walk(v, depth + 1, seen)}`);
|
|
91
|
-
}
|
|
92
|
-
return `Map(${object.size}) {${shown2.join(", ")}}`;
|
|
93
|
-
}
|
|
94
|
-
if (object instanceof Set) {
|
|
95
|
-
const shown2 = [];
|
|
96
|
-
for (const item of object) {
|
|
97
|
-
if (shown2.length === MAX_ENTRIES) {
|
|
98
|
-
shown2.push("…");
|
|
99
|
-
break;
|
|
100
|
-
}
|
|
101
|
-
shown2.push(walk(item, depth + 1, seen));
|
|
102
|
-
}
|
|
103
|
-
return `Set(${object.size}) {${shown2.join(", ")}}`;
|
|
104
|
-
}
|
|
105
|
-
const keys = Object.keys(object);
|
|
106
|
-
const shown = keys.slice(0, MAX_ENTRIES).map((key) => {
|
|
107
|
-
let read;
|
|
108
|
-
try {
|
|
109
|
-
const descriptor = Object.getOwnPropertyDescriptor(object, key);
|
|
110
|
-
if (descriptor?.get) return `${key}: [getter]`;
|
|
111
|
-
read = walk(object[key], depth + 1, seen);
|
|
112
|
-
} catch {
|
|
113
|
-
read = "[unreadable]";
|
|
114
|
-
}
|
|
115
|
-
return `${key}: ${read}`;
|
|
116
|
-
});
|
|
117
|
-
if (keys.length > MAX_ENTRIES) shown.push("…");
|
|
118
|
-
return `${className(object)}{${shown.join(", ")}}`;
|
|
119
|
-
} finally {
|
|
120
|
-
seen.delete(object);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
function formatValue(value, limit = 240) {
|
|
124
|
-
let text;
|
|
125
|
-
try {
|
|
126
|
-
text = walk(value, 0, /* @__PURE__ */ new Set());
|
|
127
|
-
} catch {
|
|
128
|
-
text = "[unreadable]";
|
|
129
|
-
}
|
|
130
|
-
return text.length > limit ? `${text.slice(0, limit - 1)}…` : text;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
// src/instrument.ts
|
|
134
|
-
var CORE_STATE = { 0: "clean", 1: "check", 2: "dirty" };
|
|
135
|
-
function nodeVersion(n) {
|
|
136
|
-
return n.core && typeof n.core.version === "number" ? n.core.version : n.runs;
|
|
137
|
-
}
|
|
138
|
-
function nodeState(n) {
|
|
139
|
-
return n.core && typeof n.core.state === "number" ? CORE_STATE[n.core.state] : void 0;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
// src/export.ts
|
|
143
|
-
var at = (source) => {
|
|
144
|
-
if (!source) return void 0;
|
|
145
|
-
const where = `${source.file ?? ""}:${source.line ?? ""}:${source.column ?? ""}`;
|
|
146
|
-
const out = source.compiled;
|
|
147
|
-
const same = out?.line === source.line && out?.column === source.column;
|
|
148
|
-
return out && !same ? `${where} (out ${out.line ?? ""}:${out.column ?? ""})` : where;
|
|
149
|
-
};
|
|
150
|
-
function naming(graph) {
|
|
151
|
-
const seen = /* @__PURE__ */ new Map();
|
|
152
|
-
for (const node of graph.values()) seen.set(node.label, (seen.get(node.label) ?? 0) + 1);
|
|
153
|
-
return (id) => {
|
|
154
|
-
const node = graph.get(id);
|
|
155
|
-
if (!node) return `#${id}`;
|
|
156
|
-
return (seen.get(node.label) ?? 0) > 1 ? `${node.label}#${node.id}` : node.label;
|
|
157
|
-
};
|
|
158
|
-
}
|
|
159
|
-
function exportGraph(graph, options = {}) {
|
|
160
|
-
const limit = options.limit ?? 400;
|
|
161
|
-
const name = naming(graph);
|
|
162
|
-
const nodes = [...graph.values()].map((node) => {
|
|
163
|
-
let value = node.detail ?? node.value;
|
|
164
|
-
if (node.read) {
|
|
165
|
-
try {
|
|
166
|
-
value = formatValue(node.read(), limit);
|
|
167
|
-
} catch {
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
const feeds = [...node.deps].map(name);
|
|
171
|
-
const wrote = [...node.writes].map(name);
|
|
172
|
-
const state = nodeState(node);
|
|
173
|
-
return {
|
|
174
|
-
id: node.id,
|
|
175
|
-
label: node.label,
|
|
176
|
-
kind: node.kind,
|
|
177
|
-
...node.authored === false ? { authored: false } : {},
|
|
178
|
-
...value ? { value } : {},
|
|
179
|
-
...node.runs ? { runs: node.runs } : {},
|
|
180
|
-
// Only a node with a core has one; a static node would report a version of 0.
|
|
181
|
-
...node.core?.version !== void 0 ? { version: nodeVersion(node) } : {},
|
|
182
|
-
...state ? { state } : {},
|
|
183
|
-
...feeds.length ? { reads: feeds } : {},
|
|
184
|
-
...wrote.length ? { writes: wrote } : {},
|
|
185
|
-
...node.createdIn !== void 0 ? { madeIn: name(node.createdIn) } : {},
|
|
186
|
-
...at(node.source) ? { source: at(node.source) } : {},
|
|
187
|
-
...at(node.declaredAt) ? { declaredAt: at(node.declaredAt) } : {},
|
|
188
|
-
...at(node.usedAt) ? { usedAt: at(node.usedAt) } : {},
|
|
189
|
-
...node.targets?.length ? {
|
|
190
|
-
updates: node.targets.map((target) => {
|
|
191
|
-
const what = target.name ? `${target.name} of ${target.element}` : target.element;
|
|
192
|
-
const where = at(target.source);
|
|
193
|
-
return where ? `${what} — ${where}` : what;
|
|
194
|
-
})
|
|
195
|
-
} : {},
|
|
196
|
-
...node.setAt?.length ? { setAt: node.setAt.map((s) => at(s)).filter(Boolean) } : {}
|
|
197
|
-
};
|
|
198
|
-
});
|
|
199
|
-
return {
|
|
200
|
-
t: Date.now(),
|
|
201
|
-
from: options.fromSource ? "source" : "running application",
|
|
202
|
-
nodes,
|
|
203
|
-
...options.events?.length ? { events: [...options.events] } : {}
|
|
204
|
-
};
|
|
205
|
-
}
|
|
206
|
-
function graphToJson(graph, options = {}) {
|
|
207
|
-
return JSON.stringify(exportGraph(graph, options), null, 2);
|
|
208
|
-
}
|
|
2
|
+
exportGraph,
|
|
3
|
+
graphToJson
|
|
4
|
+
} from "./chunk-VO2V7AC5.mjs";
|
|
5
|
+
import "./chunk-EBSROPWJ.mjs";
|
|
6
|
+
import "./chunk-L6XQGNMW.mjs";
|
|
7
|
+
import "./chunk-NT7YMK77.mjs";
|
|
209
8
|
export {
|
|
210
9
|
exportGraph,
|
|
211
10
|
graphToJson
|
package/dist/float.mjs
CHANGED
|
@@ -1,209 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
`;
|
|
1
|
+
import {
|
|
2
|
+
FLOAT_CSS,
|
|
3
|
+
floatCard,
|
|
4
|
+
makeFloatable
|
|
5
|
+
} from "./chunk-D25KZZBZ.mjs";
|
|
207
6
|
export {
|
|
208
7
|
FLOAT_CSS,
|
|
209
8
|
floatCard,
|