@fluixi/devtools 0.2.0-alpha.5 → 0.2.0-alpha.7
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.cjs +9 -0
- package/dist/callsite.d.ts.map +1 -1
- package/dist/callsite.js +9 -0
- package/dist/callsite.mjs +9 -0
- package/dist/export.cjs +1 -0
- package/dist/export.mjs +1 -0
- package/dist/graph-view.cjs +12 -3
- package/dist/graph-view.d.ts.map +1 -1
- package/dist/graph-view.js +11 -2
- package/dist/graph-view.mjs +12 -3
- package/dist/hook.cjs +173 -21
- package/dist/hook.mjs +174 -21
- package/dist/index.cjs +199 -29
- package/dist/index.mjs +200 -29
- package/dist/inspector.cjs +6 -2
- package/dist/inspector.js +1 -1
- package/dist/inspector.mjs +6 -2
- package/dist/instrument.cjs +9 -3
- package/dist/instrument.d.ts +16 -1
- package/dist/instrument.d.ts.map +1 -1
- package/dist/instrument.mjs +9 -3
- package/dist/kind-filter.cjs +5 -2
- package/dist/kind-filter.js +3 -3
- package/dist/kind-filter.mjs +5 -2
- package/dist/observe.cjs +172 -21
- package/dist/observe.d.ts.map +1 -1
- package/dist/observe.js +191 -22
- package/dist/observe.mjs +173 -21
- package/dist/palette.cjs +4 -1
- package/dist/palette.d.ts.map +1 -1
- package/dist/palette.js +3 -0
- package/dist/palette.mjs +4 -1
- package/dist/plugins/index.cjs +1 -1
- package/dist/plugins/index.mjs +1 -1
- package/dist/source.cjs +18 -3
- package/dist/source.d.ts +16 -1
- package/dist/source.d.ts.map +1 -1
- package/dist/source.js +25 -3
- package/dist/source.mjs +18 -3
- package/dist/tree.cjs +19 -4
- package/dist/tree.d.ts.map +1 -1
- package/dist/tree.js +21 -2
- package/dist/tree.mjs +19 -4
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/wire.cjs +3 -1
- package/dist/wire.d.ts +2 -0
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +2 -0
- package/dist/wire.mjs +3 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @fluixi/devtools v0.2.0-alpha.
|
|
1
|
+
/*! @fluixi/devtools v0.2.0-alpha.7 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
|
|
2
2
|
|
|
3
3
|
// src/instrument.ts
|
|
4
4
|
import {
|
|
@@ -18,6 +18,7 @@ import { createStore } from "@fluixi/reactive/store";
|
|
|
18
18
|
// src/source.ts
|
|
19
19
|
var MARKER = "__fx_source";
|
|
20
20
|
var COMPONENT_MARKER = "__fx_component";
|
|
21
|
+
var CLASS_MARKER = "__fx_class";
|
|
21
22
|
var HOLE_MARKER = "__fx_hole";
|
|
22
23
|
var PROPS_MARKER = "__fx_props";
|
|
23
24
|
var MARKS = "__FLUIXI_DEVTOOLS_MARKS__";
|
|
@@ -28,12 +29,16 @@ var shared = host[MARKS] ?? {
|
|
|
28
29
|
components: /* @__PURE__ */ new Map()
|
|
29
30
|
};
|
|
30
31
|
host[MARKS] = shared;
|
|
31
|
-
|
|
32
|
+
shared.classes ??= /* @__PURE__ */ new WeakMap();
|
|
33
|
+
function markReactiveSource(file, line, column, name, self) {
|
|
32
34
|
const location2 = locate(file, line, column);
|
|
33
35
|
if (shared.pending && location2.external && !shared.pending.location?.external) return;
|
|
34
|
-
shared.pending = { name, location: location2 };
|
|
36
|
+
shared.pending = self && typeof self === "object" ? { name, location: location2, self } : { name, location: location2 };
|
|
35
37
|
shared.expiring = false;
|
|
36
38
|
}
|
|
39
|
+
function dropReactiveSource() {
|
|
40
|
+
shared.pending = null;
|
|
41
|
+
}
|
|
37
42
|
function locate(file, line, column) {
|
|
38
43
|
const external = !!file && (/^([a-zA-Z]:)?[\\/]/.test(file) || file.includes("node_modules/"));
|
|
39
44
|
return external ? { file, line, column, external } : { file, line, column };
|
|
@@ -47,13 +52,19 @@ function markComponentSource(name, file, line, column) {
|
|
|
47
52
|
}
|
|
48
53
|
if (!seen || seen.file !== file || seen.line !== line) shared.components.set(name, null);
|
|
49
54
|
}
|
|
55
|
+
function markClassSource(constructor, file, line, column) {
|
|
56
|
+
if (typeof constructor === "function") shared.classes.set(constructor, locate(file, line, column));
|
|
57
|
+
}
|
|
58
|
+
function classSource(constructor) {
|
|
59
|
+
return typeof constructor === "function" ? shared.classes.get(constructor) : void 0;
|
|
60
|
+
}
|
|
50
61
|
function componentSource(name) {
|
|
51
62
|
return shared.components.get(name) ?? void 0;
|
|
52
63
|
}
|
|
53
64
|
function takeReactiveSource() {
|
|
54
65
|
const mark = shared.pending;
|
|
55
66
|
if (mark) {
|
|
56
|
-
if (mark.name !== void 0) shared.pending = { location: mark.location };
|
|
67
|
+
if (mark.name !== void 0 || mark.self) shared.pending = { location: mark.location };
|
|
57
68
|
if (!shared.expiring) {
|
|
58
69
|
shared.expiring = true;
|
|
59
70
|
queueMicrotask(() => {
|
|
@@ -93,6 +104,7 @@ function holeLocation(accessor) {
|
|
|
93
104
|
function installSourceMarker() {
|
|
94
105
|
if (typeof host[MARKER] !== "function") host[MARKER] = markReactiveSource;
|
|
95
106
|
if (typeof host[COMPONENT_MARKER] !== "function") host[COMPONENT_MARKER] = markComponentSource;
|
|
107
|
+
if (typeof host[CLASS_MARKER] !== "function") host[CLASS_MARKER] = markClassSource;
|
|
96
108
|
if (typeof host[HOLE_MARKER] !== "function") host[HOLE_MARKER] = markHole;
|
|
97
109
|
if (typeof host[PROPS_MARKER] !== "function") host[PROPS_MARKER] = markProps;
|
|
98
110
|
}
|
|
@@ -530,6 +542,7 @@ function createReactor() {
|
|
|
530
542
|
|
|
531
543
|
// src/observe.ts
|
|
532
544
|
import {
|
|
545
|
+
createRoot as createRoot2,
|
|
533
546
|
observeReactiveNodes,
|
|
534
547
|
untrack as untrack2
|
|
535
548
|
} from "@fluixi/reactive/signal";
|
|
@@ -541,6 +554,15 @@ var INTERNAL = [
|
|
|
541
554
|
"/packages/dom/",
|
|
542
555
|
"/packages/core/",
|
|
543
556
|
"/packages/devtools/",
|
|
557
|
+
"/packages/web-components/",
|
|
558
|
+
"/packages/auth/",
|
|
559
|
+
"/packages/oauth2/",
|
|
560
|
+
"/packages/session/",
|
|
561
|
+
"/packages/router/",
|
|
562
|
+
"/packages/head/",
|
|
563
|
+
"/packages/start/",
|
|
564
|
+
"/packages/server/",
|
|
565
|
+
"/packages/template-runtime/",
|
|
544
566
|
"/@fluixi/",
|
|
545
567
|
"node_modules",
|
|
546
568
|
"fluixi-devtools",
|
|
@@ -1033,7 +1055,10 @@ var KIND_COLOR = {
|
|
|
1033
1055
|
binding: "#5eead4",
|
|
1034
1056
|
setter: "#fb7185",
|
|
1035
1057
|
group: "#8a90a2",
|
|
1036
|
-
element: "#8a90a2"
|
|
1058
|
+
element: "#8a90a2",
|
|
1059
|
+
"custom-element": "#2dd4bf",
|
|
1060
|
+
module: "#facc15",
|
|
1061
|
+
service: "#60a5fa"
|
|
1037
1062
|
};
|
|
1038
1063
|
var kindVar = (kind) => `--fx-kind-${kind}`;
|
|
1039
1064
|
var kindColor = (kind) => `var(${kindVar(kind)}, ${KIND_COLOR[kind]})`;
|
|
@@ -1050,7 +1075,11 @@ var TREE_KINDS = /* @__PURE__ */ new Set([
|
|
|
1050
1075
|
"handler",
|
|
1051
1076
|
// A component a plugin recognised as providing a context. Still a tag the author wrote,
|
|
1052
1077
|
// so leaving it out took it and everything it rendered out of the tree.
|
|
1053
|
-
"provider"
|
|
1078
|
+
"provider",
|
|
1079
|
+
// Scopes the runtime reported: what their signals and memos belong to.
|
|
1080
|
+
"custom-element",
|
|
1081
|
+
"module",
|
|
1082
|
+
"service"
|
|
1054
1083
|
]);
|
|
1055
1084
|
function inPageOrder(nodes) {
|
|
1056
1085
|
const slots = [];
|
|
@@ -1073,7 +1102,8 @@ function badgeOf(node) {
|
|
|
1073
1102
|
return badges.get(node);
|
|
1074
1103
|
}
|
|
1075
1104
|
function componentTree(graph, options = {}) {
|
|
1076
|
-
const
|
|
1105
|
+
const held = (node) => node.scope !== void 0 && (node.kind === "state" || node.kind === "memo" || node.kind === "store");
|
|
1106
|
+
const wanted = (node) => TREE_KINDS.has(node.kind) || options.values === true && (node.authored !== false || held(node));
|
|
1077
1107
|
const tagged = inPageOrder([...graph.values()].filter(wanted).sort((a, b) => a.id - b.id));
|
|
1078
1108
|
const made = /* @__PURE__ */ new Map();
|
|
1079
1109
|
for (const node of tagged) {
|
|
@@ -1269,7 +1299,8 @@ function createComponentTree(host2, options = {}) {
|
|
|
1269
1299
|
const props = listed.length ? [{ key: group, label: "props", kind: node.kind, children: listed, props: true, owner: node.id }] : [];
|
|
1270
1300
|
const row2 = {
|
|
1271
1301
|
key: String(node.id),
|
|
1272
|
-
|
|
1302
|
+
// `<fx-counter>` in the graph, where nothing else draws brackets. Here the row adds them.
|
|
1303
|
+
label: node.kind === "custom-element" ? node.label.replace(/^<(.*)>$/, "$1") : node.label,
|
|
1273
1304
|
kind: node.kind,
|
|
1274
1305
|
id: node.id,
|
|
1275
1306
|
children: [...props, ...node.children.map(build2)],
|
|
@@ -1388,6 +1419,12 @@ function createComponentTree(host2, options = {}) {
|
|
|
1388
1419
|
};
|
|
1389
1420
|
}
|
|
1390
1421
|
const rendered = dom.map((node, i) => walk2(node, `${row2.id}:${i}`)).filter((node) => node !== void 0);
|
|
1422
|
+
const self = rendered[0];
|
|
1423
|
+
if (row2.kind === "custom-element" && rendered.length === 1 && self?.kind === "element") {
|
|
1424
|
+
rendered.splice(0, 1, ...self.children);
|
|
1425
|
+
if (self.element) row2.element = self.element;
|
|
1426
|
+
if (self.at) row2.at = self.at;
|
|
1427
|
+
}
|
|
1391
1428
|
const rest = row2.children.filter((child) => !placed.has(child)).map(expand);
|
|
1392
1429
|
const lifted = [];
|
|
1393
1430
|
const spare = [];
|
|
@@ -1564,9 +1601,14 @@ var PREFIX = {
|
|
|
1564
1601
|
// A plugin's, and it names them itself.
|
|
1565
1602
|
directive: "d",
|
|
1566
1603
|
context: "ctx",
|
|
1567
|
-
provider: "p"
|
|
1604
|
+
provider: "p",
|
|
1605
|
+
// Scopes are always named by what opened them.
|
|
1606
|
+
"custom-element": "el",
|
|
1607
|
+
module: "mod",
|
|
1608
|
+
service: "svc"
|
|
1568
1609
|
};
|
|
1569
1610
|
function readProps(props) {
|
|
1611
|
+
if (readOnce.has(props)) return readOnce.get(props);
|
|
1570
1612
|
const at3 = propsLocations(props);
|
|
1571
1613
|
const out = [];
|
|
1572
1614
|
for (const name of Object.keys(props)) {
|
|
@@ -1577,13 +1619,25 @@ function readProps(props) {
|
|
|
1577
1619
|
...where ? { at: { line: where[0], column: where[1] } } : {}
|
|
1578
1620
|
};
|
|
1579
1621
|
try {
|
|
1580
|
-
report.value = formatValue(
|
|
1622
|
+
report.value = formatValue(
|
|
1623
|
+
createRoot2((dispose) => {
|
|
1624
|
+
try {
|
|
1625
|
+
return untrack2(() => props[name]);
|
|
1626
|
+
} finally {
|
|
1627
|
+
dispose();
|
|
1628
|
+
}
|
|
1629
|
+
}),
|
|
1630
|
+
200
|
|
1631
|
+
);
|
|
1581
1632
|
} catch {
|
|
1582
1633
|
}
|
|
1583
1634
|
out.push(report);
|
|
1584
1635
|
}
|
|
1585
|
-
|
|
1636
|
+
const reports = out.length ? out : void 0;
|
|
1637
|
+
readOnce.set(props, reports);
|
|
1638
|
+
return reports;
|
|
1586
1639
|
}
|
|
1640
|
+
var readOnce = /* @__PURE__ */ new WeakMap();
|
|
1587
1641
|
function observeGraph(options = {}) {
|
|
1588
1642
|
installSourceMarker();
|
|
1589
1643
|
const origin = options.origin ?? (typeof location === "object" ? location.origin : void 0);
|
|
@@ -1604,6 +1658,10 @@ function observeGraph(options = {}) {
|
|
|
1604
1658
|
const boundTo = /* @__PURE__ */ new WeakMap();
|
|
1605
1659
|
const drivenBy = /* @__PURE__ */ new WeakMap();
|
|
1606
1660
|
let reaches2 = /* @__PURE__ */ new Map();
|
|
1661
|
+
const SCOPE_KINDS = /* @__PURE__ */ new Set(["custom-element", "module", "service"]);
|
|
1662
|
+
const scopeIds = /* @__PURE__ */ new WeakMap();
|
|
1663
|
+
const scopeOfTarget = /* @__PURE__ */ new WeakMap();
|
|
1664
|
+
const fieldsOf = /* @__PURE__ */ new WeakMap();
|
|
1607
1665
|
let described = null;
|
|
1608
1666
|
const rendered = /* @__PURE__ */ new Map();
|
|
1609
1667
|
const elementsIn = (value) => {
|
|
@@ -1700,7 +1758,9 @@ function observeGraph(options = {}) {
|
|
|
1700
1758
|
// Mapped, unlike `mark`: these two came off a stack, so they are positions in the
|
|
1701
1759
|
// compiled file until a host translates them.
|
|
1702
1760
|
...site && !site.external ? { usedAt: mapped(site.location) } : {},
|
|
1703
|
-
|
|
1761
|
+
// Not inside a scope: an element's prop is made by the package for the element, and
|
|
1762
|
+
// the package's line says less than the scope it sits in already does.
|
|
1763
|
+
...site && site.external && !mark?.location && !report.scope ? { source: mapped(site.location) } : {}
|
|
1704
1764
|
};
|
|
1705
1765
|
const owner = ancestor(report.parents);
|
|
1706
1766
|
if (owner !== void 0) node.createdIn = owner;
|
|
@@ -1710,6 +1770,28 @@ function observeGraph(options = {}) {
|
|
|
1710
1770
|
node.createdIn = originId;
|
|
1711
1771
|
if (from.source) node.source = from.source;
|
|
1712
1772
|
}
|
|
1773
|
+
const scopeId = report.scope ? scopeIds.get(report.scope) : void 0;
|
|
1774
|
+
if (scopeId !== void 0) {
|
|
1775
|
+
node.scope = scopeId;
|
|
1776
|
+
const creator = node.createdIn !== void 0 ? graph.get(node.createdIn) : void 0;
|
|
1777
|
+
const insideAlready = node.createdIn === scopeId || creator?.scope === scopeId;
|
|
1778
|
+
if (!insideAlready) node.createdIn = scopeId;
|
|
1779
|
+
} else if (node.createdIn !== void 0) {
|
|
1780
|
+
const creator = graph.get(node.createdIn);
|
|
1781
|
+
const inherited = creator && SCOPE_KINDS.has(creator.kind) ? creator.id : creator?.scope;
|
|
1782
|
+
if (inherited !== void 0) node.scope = inherited;
|
|
1783
|
+
}
|
|
1784
|
+
const self = mark?.self;
|
|
1785
|
+
if (self) {
|
|
1786
|
+
const list = fieldsOf.get(self);
|
|
1787
|
+
if (list) list.push(id);
|
|
1788
|
+
else fieldsOf.set(self, [id]);
|
|
1789
|
+
const open = scopeOfTarget.get(self);
|
|
1790
|
+
if (open !== void 0 && graph.has(open)) {
|
|
1791
|
+
node.scope = open;
|
|
1792
|
+
node.createdIn = open;
|
|
1793
|
+
}
|
|
1794
|
+
}
|
|
1713
1795
|
if (kind !== "effect" && typeof handle === "function") {
|
|
1714
1796
|
const read = handle;
|
|
1715
1797
|
node.read = () => untrack2(read);
|
|
@@ -1845,20 +1927,90 @@ function observeGraph(options = {}) {
|
|
|
1845
1927
|
internals.delete(target);
|
|
1846
1928
|
const id = ids.get(target);
|
|
1847
1929
|
if (id === void 0) return;
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1930
|
+
forget(id);
|
|
1931
|
+
},
|
|
1932
|
+
scope(scope, info, parent) {
|
|
1933
|
+
dropReactiveSource();
|
|
1934
|
+
const id = seq++;
|
|
1935
|
+
const kind = info.kind === "element" ? "custom-element" : info.kind;
|
|
1936
|
+
const parentId = parent ? scopeIds.get(parent) : void 0;
|
|
1937
|
+
const found = currentCallSite(origin);
|
|
1938
|
+
const site = found && !/\0|__x00__|^virtual:/.test(found.location.file ?? "") ? found : void 0;
|
|
1939
|
+
const node = {
|
|
1940
|
+
id,
|
|
1941
|
+
label: info.name,
|
|
1942
|
+
kind,
|
|
1943
|
+
// The author named the element, the module and the service; none of them is plumbing.
|
|
1944
|
+
authored: true,
|
|
1945
|
+
deps: /* @__PURE__ */ new Set(),
|
|
1946
|
+
writes: /* @__PURE__ */ new Set(),
|
|
1947
|
+
runs: 0,
|
|
1948
|
+
lastPulse: 0,
|
|
1949
|
+
...info.detail ? { value: info.detail, detail: info.detail } : {},
|
|
1950
|
+
...parentId !== void 0 ? { scope: parentId, createdIn: parentId } : {}
|
|
1951
|
+
};
|
|
1952
|
+
const target = info.target;
|
|
1953
|
+
if (kind === "custom-element") {
|
|
1954
|
+
const defined = target ? classSource(target.constructor) : void 0;
|
|
1955
|
+
if (defined) node.declaredAt = defined;
|
|
1956
|
+
} else if (site && !site.external) {
|
|
1957
|
+
node.usedAt = mapped(site.location);
|
|
1958
|
+
}
|
|
1959
|
+
scopeIds.set(scope, id);
|
|
1960
|
+
if (target && typeof target === "object" && target.nodeType === 1) {
|
|
1961
|
+
rendered.set(id, [new WeakRef(target)]);
|
|
1962
|
+
}
|
|
1963
|
+
graph.set(id, node);
|
|
1964
|
+
history.created(id, node.createdIn, node.label);
|
|
1965
|
+
if (target && typeof target === "object") {
|
|
1966
|
+
scopeOfTarget.set(target, id);
|
|
1967
|
+
for (const field of fieldsOf.get(target) ?? []) {
|
|
1968
|
+
const made = graph.get(field);
|
|
1969
|
+
if (!made) continue;
|
|
1970
|
+
made.scope = id;
|
|
1971
|
+
made.createdIn = id;
|
|
1972
|
+
revs.set(field, ++revision);
|
|
1973
|
+
}
|
|
1974
|
+
}
|
|
1975
|
+
},
|
|
1976
|
+
scopeEnded(scope) {
|
|
1977
|
+
const id = scopeIds.get(scope);
|
|
1978
|
+
if (id === void 0) return;
|
|
1979
|
+
const ended = /* @__PURE__ */ new Set([id]);
|
|
1980
|
+
for (let grew = true; grew; ) {
|
|
1981
|
+
grew = false;
|
|
1982
|
+
for (const [other, node] of graph) {
|
|
1983
|
+
if (!ended.has(other) && node.scope !== void 0 && ended.has(node.scope)) {
|
|
1984
|
+
ended.add(other);
|
|
1985
|
+
grew = true;
|
|
1986
|
+
}
|
|
1987
|
+
}
|
|
1988
|
+
}
|
|
1989
|
+
for (const gone of ended) forget(gone);
|
|
1990
|
+
},
|
|
1991
|
+
scopeAdopted(scope, parent) {
|
|
1992
|
+
const node = graph.get(scopeIds.get(scope) ?? -1);
|
|
1993
|
+
const parentId = scopeIds.get(parent);
|
|
1994
|
+
if (!node || parentId === void 0 || parentId === node.id) return;
|
|
1995
|
+
node.scope = parentId;
|
|
1996
|
+
node.createdIn = parentId;
|
|
1997
|
+
revs.set(node.id, ++revision);
|
|
1860
1998
|
}
|
|
1861
1999
|
});
|
|
2000
|
+
function forget(id) {
|
|
2001
|
+
removed.push({ id, rev: ++revision });
|
|
2002
|
+
revs.delete(id);
|
|
2003
|
+
if (removed.length > REMOVED_LOG) removed.splice(0, removed.length - REMOVED_LOG);
|
|
2004
|
+
history.disposed(id, graph.get(id)?.label);
|
|
2005
|
+
graph.delete(id);
|
|
2006
|
+
handed.delete(id);
|
|
2007
|
+
raws.delete(id);
|
|
2008
|
+
cores.delete(id);
|
|
2009
|
+
rendered.delete(id);
|
|
2010
|
+
setters.delete(id);
|
|
2011
|
+
runsAtLastSample.delete(id);
|
|
2012
|
+
unnamed.delete(id);
|
|
2013
|
+
}
|
|
1862
2014
|
const edges = (id, node) => {
|
|
1863
2015
|
const sources = cores.get(id)?.sources;
|
|
1864
2016
|
node.deps.clear();
|
|
@@ -1878,6 +2030,14 @@ function observeGraph(options = {}) {
|
|
|
1878
2030
|
revs.set(id, ++revision);
|
|
1879
2031
|
};
|
|
1880
2032
|
const now = Date.now();
|
|
2033
|
+
for (const [id, node] of graph) {
|
|
2034
|
+
if (node.kind !== "custom-element" || node.usedAt) continue;
|
|
2035
|
+
const element = rendered.get(id)?.[0]?.deref();
|
|
2036
|
+
const written = element ? element.__fx_loc : void 0;
|
|
2037
|
+
if (!written?.file) continue;
|
|
2038
|
+
node.usedAt = { file: written.file, line: written.line, column: written.column };
|
|
2039
|
+
revs.set(id, ++revision);
|
|
2040
|
+
}
|
|
1881
2041
|
const bindings = /* @__PURE__ */ new Map();
|
|
1882
2042
|
const drives = /* @__PURE__ */ new Map();
|
|
1883
2043
|
const seen = /* @__PURE__ */ new Map();
|
|
@@ -2263,6 +2423,7 @@ function serializeGraph(graph, now = Date.now(), options = {}) {
|
|
|
2263
2423
|
declaredAt: node.declaredAt,
|
|
2264
2424
|
usedAt: node.usedAt,
|
|
2265
2425
|
createdIn: node.createdIn,
|
|
2426
|
+
scope: node.scope,
|
|
2266
2427
|
bindings: node.bindings,
|
|
2267
2428
|
targets: node.targets,
|
|
2268
2429
|
setAt: node.setAt,
|
|
@@ -2300,6 +2461,7 @@ function snapshotToRenderMap(snapshot) {
|
|
|
2300
2461
|
declaredAt: node.declaredAt,
|
|
2301
2462
|
usedAt: node.usedAt,
|
|
2302
2463
|
createdIn: node.createdIn,
|
|
2464
|
+
scope: node.scope,
|
|
2303
2465
|
bindings: node.bindings,
|
|
2304
2466
|
targets: node.targets,
|
|
2305
2467
|
setAt: node.setAt,
|
|
@@ -2452,8 +2614,8 @@ var OVER_NATURAL = 12;
|
|
|
2452
2614
|
var MIN_MAX_ZOOM = 8;
|
|
2453
2615
|
var ABSOLUTE_MAX_ZOOM = 4e3;
|
|
2454
2616
|
var DRAG_SLOP = 4;
|
|
2455
|
-
var KIND_CLASS = { state: "n-state", memo: "n-memo", effect: "n-effect", store: "n-store", resource: "n-resource", component: "n-component", control: "n-control", router: "n-router", handler: "n-handler", group: "n-group", binding: "n-binding", setter: "n-setter", directive: "n-directive", context: "n-context", provider: "n-provider" };
|
|
2456
|
-
var KIND_GLYPH = { state: "◆ state", memo: "ƒ memo", effect: "⚡ effect", store: "▤ store", resource: "⟳ resource", component: "◧ component", control: "⑂ control flow", router: "⤳ router", handler: "⇄ route", group: "▤ framework", binding: "⇥ dom", setter: "✎ sets", directive: "⌘ directive", context: "◈ context", provider: "◈ provider" };
|
|
2617
|
+
var KIND_CLASS = { state: "n-state", memo: "n-memo", effect: "n-effect", store: "n-store", resource: "n-resource", component: "n-component", control: "n-control", router: "n-router", handler: "n-handler", group: "n-group", binding: "n-binding", setter: "n-setter", directive: "n-directive", context: "n-context", provider: "n-provider", "custom-element": "n-custom-element", module: "n-module", service: "n-service" };
|
|
2618
|
+
var KIND_GLYPH = { state: "◆ state", memo: "ƒ memo", effect: "⚡ effect", store: "▤ store", resource: "⟳ resource", component: "◧ component", control: "⑂ control flow", router: "⤳ router", handler: "⇄ route", group: "▤ framework", binding: "⇥ dom", setter: "✎ sets", directive: "⌘ directive", context: "◈ context", provider: "◈ provider", "custom-element": "⬡ custom element", module: "▦ module", service: "⚙ service" };
|
|
2457
2619
|
var GROUP_ID = -1;
|
|
2458
2620
|
var bindingIds = /* @__PURE__ */ new Map();
|
|
2459
2621
|
var bindingId = (place2) => {
|
|
@@ -2714,6 +2876,7 @@ function createGraphView(svg, options = {}) {
|
|
|
2714
2876
|
const inProject = (at3) => !!at3?.file && at3.external !== true;
|
|
2715
2877
|
const machinery = (n) => {
|
|
2716
2878
|
if (n.authored !== false) return false;
|
|
2879
|
+
if (n.scope !== void 0) return false;
|
|
2717
2880
|
if (n.kind === "state" || n.kind === "memo" || n.kind === "effect" || n.kind === "context") {
|
|
2718
2881
|
return true;
|
|
2719
2882
|
}
|
|
@@ -3123,6 +3286,11 @@ ${kindRules((k) => `.fx-node.n-${k}`, "--glow")}
|
|
|
3123
3286
|
.fx-node.n-binding { opacity: .72; }
|
|
3124
3287
|
.fx-node.n-setter { opacity: .72; }
|
|
3125
3288
|
.fx-node.n-binding .fx-box, .fx-node.n-setter .fx-box { stroke-dasharray: 3 3; }
|
|
3289
|
+
/* An element, module or service: a group its signals and memos belong to, so it reads as one. */
|
|
3290
|
+
.fx-node.n-custom-element .fx-box, .fx-node.n-module .fx-box, .fx-node.n-service .fx-box {
|
|
3291
|
+
stroke-width: 2.2;
|
|
3292
|
+
fill: color-mix(in oklab, var(--glow, #5eead4) 14%, var(--fx-node-bg, #131722));
|
|
3293
|
+
}
|
|
3126
3294
|
.fx-node.n-external { opacity: .55; }
|
|
3127
3295
|
.fx-node.n-external .fx-box { stroke-dasharray: 3 2; }
|
|
3128
3296
|
.fx-box { fill: var(--fx-node-bg, #131722); stroke: var(--glow, #5eead4); stroke-width: 1.4; stroke-opacity: calc(.5 + var(--pulse,0) * .5); }
|
|
@@ -3581,7 +3749,7 @@ function createInspector(host2, options = {}) {
|
|
|
3581
3749
|
// no locations at all, and an empty line there reads as missing data.
|
|
3582
3750
|
(node.source ? `<div class="ins-source">${node.source.external ? "📦" : "📍"} ${place(bothAt(node.source, root), node.source, reveals)}</div>` : "") + // A component is created where its tag is written; where it is declared is somewhere
|
|
3583
3751
|
// else, and only worth a line when it is.
|
|
3584
|
-
(node.declaredAt && at(node.declaredAt, root) !== at(node.source, root) ? `<div class="ins-source">◧ declared ${place(at(node.declaredAt, root), node.declaredAt, reveals)}</div>` : "") + // A node a package made on the application's behalf: the package's line is where it
|
|
3752
|
+
(node.declaredAt && at(node.declaredAt, root) !== at(node.source, root) ? `<div class="ins-source">◧ ${node.kind === "custom-element" ? "defined at" : "declared"} ${place(at(node.declaredAt, root), node.declaredAt, reveals)}</div>` : "") + // A node a package made on the application's behalf: the package's line is where it
|
|
3585
3753
|
// was created, and this is the line that asked for it.
|
|
3586
3754
|
(node.usedAt ? `<div class="ins-source">↗ used at ${place(bothAt(node.usedAt, root), node.usedAt, reveals)}</div>` : "") + // Nothing said where it came from at all: the compiler did not mark this project and
|
|
3587
3755
|
// the stack had nothing to offer either. Saying so beats a card that just sits there.
|
|
@@ -3994,9 +4162,12 @@ var FILTERABLE_KINDS = [
|
|
|
3994
4162
|
"router",
|
|
3995
4163
|
"handler",
|
|
3996
4164
|
"context",
|
|
3997
|
-
"directive"
|
|
4165
|
+
"directive",
|
|
4166
|
+
"custom-element",
|
|
4167
|
+
"module",
|
|
4168
|
+
"service"
|
|
3998
4169
|
];
|
|
3999
|
-
var LABEL = { handler: "route" };
|
|
4170
|
+
var LABEL = { handler: "route", "custom-element": "custom element" };
|
|
4000
4171
|
function createKindFilter(host2, options) {
|
|
4001
4172
|
const doc = host2.ownerDocument;
|
|
4002
4173
|
const kinds = options.kinds ?? FILTERABLE_KINDS;
|
package/dist/inspector.cjs
CHANGED
|
@@ -38,6 +38,7 @@ var shared = host[MARKS] ?? {
|
|
|
38
38
|
components: /* @__PURE__ */ new Map()
|
|
39
39
|
};
|
|
40
40
|
host[MARKS] = shared;
|
|
41
|
+
shared.classes ??= /* @__PURE__ */ new WeakMap();
|
|
41
42
|
|
|
42
43
|
// src/format.ts
|
|
43
44
|
var MAX_DEPTH = 3;
|
|
@@ -260,7 +261,10 @@ var KIND_COLOR = {
|
|
|
260
261
|
binding: "#5eead4",
|
|
261
262
|
setter: "#fb7185",
|
|
262
263
|
group: "#8a90a2",
|
|
263
|
-
element: "#8a90a2"
|
|
264
|
+
element: "#8a90a2",
|
|
265
|
+
"custom-element": "#2dd4bf",
|
|
266
|
+
module: "#facc15",
|
|
267
|
+
service: "#60a5fa"
|
|
264
268
|
};
|
|
265
269
|
var kindVar = (kind) => `--fx-kind-${kind}`;
|
|
266
270
|
var kindColor = (kind) => `var(${kindVar(kind)}, ${KIND_COLOR[kind]})`;
|
|
@@ -595,7 +599,7 @@ function createInspector(host2, options = {}) {
|
|
|
595
599
|
// no locations at all, and an empty line there reads as missing data.
|
|
596
600
|
(node.source ? `<div class="ins-source">${node.source.external ? "📦" : "📍"} ${place(bothAt(node.source, root), node.source, reveals)}</div>` : "") + // A component is created where its tag is written; where it is declared is somewhere
|
|
597
601
|
// else, and only worth a line when it is.
|
|
598
|
-
(node.declaredAt && at(node.declaredAt, root) !== at(node.source, root) ? `<div class="ins-source">◧ declared ${place(at(node.declaredAt, root), node.declaredAt, reveals)}</div>` : "") + // A node a package made on the application's behalf: the package's line is where it
|
|
602
|
+
(node.declaredAt && at(node.declaredAt, root) !== at(node.source, root) ? `<div class="ins-source">◧ ${node.kind === "custom-element" ? "defined at" : "declared"} ${place(at(node.declaredAt, root), node.declaredAt, reveals)}</div>` : "") + // A node a package made on the application's behalf: the package's line is where it
|
|
599
603
|
// was created, and this is the line that asked for it.
|
|
600
604
|
(node.usedAt ? `<div class="ins-source">↗ used at ${place(bothAt(node.usedAt, root), node.usedAt, reveals)}</div>` : "") + // Nothing said where it came from at all: the compiler did not mark this project and
|
|
601
605
|
// the stack had nothing to offer either. Saying so beats a card that just sits there.
|
package/dist/inspector.js
CHANGED
|
@@ -285,7 +285,7 @@ export function createInspector(host, options = {}) {
|
|
|
285
285
|
// A component is created where its tag is written; where it is declared is somewhere
|
|
286
286
|
// else, and only worth a line when it is.
|
|
287
287
|
(node.declaredAt && at(node.declaredAt, root) !== at(node.source, root)
|
|
288
|
-
? `<div class="ins-source">◧ declared ${place(at(node.declaredAt, root), node.declaredAt, reveals)}</div>`
|
|
288
|
+
? `<div class="ins-source">◧ ${node.kind === 'custom-element' ? 'defined at' : 'declared'} ${place(at(node.declaredAt, root), node.declaredAt, reveals)}</div>`
|
|
289
289
|
: '') +
|
|
290
290
|
// A node a package made on the application's behalf: the package's line is where it
|
|
291
291
|
// was created, and this is the line that asked for it.
|
package/dist/inspector.mjs
CHANGED
|
@@ -22,6 +22,7 @@ var shared = host[MARKS] ?? {
|
|
|
22
22
|
components: /* @__PURE__ */ new Map()
|
|
23
23
|
};
|
|
24
24
|
host[MARKS] = shared;
|
|
25
|
+
shared.classes ??= /* @__PURE__ */ new WeakMap();
|
|
25
26
|
|
|
26
27
|
// src/format.ts
|
|
27
28
|
var MAX_DEPTH = 3;
|
|
@@ -244,7 +245,10 @@ var KIND_COLOR = {
|
|
|
244
245
|
binding: "#5eead4",
|
|
245
246
|
setter: "#fb7185",
|
|
246
247
|
group: "#8a90a2",
|
|
247
|
-
element: "#8a90a2"
|
|
248
|
+
element: "#8a90a2",
|
|
249
|
+
"custom-element": "#2dd4bf",
|
|
250
|
+
module: "#facc15",
|
|
251
|
+
service: "#60a5fa"
|
|
248
252
|
};
|
|
249
253
|
var kindVar = (kind) => `--fx-kind-${kind}`;
|
|
250
254
|
var kindColor = (kind) => `var(${kindVar(kind)}, ${KIND_COLOR[kind]})`;
|
|
@@ -579,7 +583,7 @@ function createInspector(host2, options = {}) {
|
|
|
579
583
|
// no locations at all, and an empty line there reads as missing data.
|
|
580
584
|
(node.source ? `<div class="ins-source">${node.source.external ? "📦" : "📍"} ${place(bothAt(node.source, root), node.source, reveals)}</div>` : "") + // A component is created where its tag is written; where it is declared is somewhere
|
|
581
585
|
// else, and only worth a line when it is.
|
|
582
|
-
(node.declaredAt && at(node.declaredAt, root) !== at(node.source, root) ? `<div class="ins-source">◧ declared ${place(at(node.declaredAt, root), node.declaredAt, reveals)}</div>` : "") + // A node a package made on the application's behalf: the package's line is where it
|
|
586
|
+
(node.declaredAt && at(node.declaredAt, root) !== at(node.source, root) ? `<div class="ins-source">◧ ${node.kind === "custom-element" ? "defined at" : "declared"} ${place(at(node.declaredAt, root), node.declaredAt, reveals)}</div>` : "") + // A node a package made on the application's behalf: the package's line is where it
|
|
583
587
|
// was created, and this is the line that asked for it.
|
|
584
588
|
(node.usedAt ? `<div class="ins-source">↗ used at ${place(bothAt(node.usedAt, root), node.usedAt, reveals)}</div>` : "") + // Nothing said where it came from at all: the compiler did not mark this project and
|
|
585
589
|
// the stack had nothing to offer either. Saying so beats a card that just sits there.
|
package/dist/instrument.cjs
CHANGED
|
@@ -34,6 +34,7 @@ var import_store = require("@fluixi/reactive/store");
|
|
|
34
34
|
// src/source.ts
|
|
35
35
|
var MARKER = "__fx_source";
|
|
36
36
|
var COMPONENT_MARKER = "__fx_component";
|
|
37
|
+
var CLASS_MARKER = "__fx_class";
|
|
37
38
|
var HOLE_MARKER = "__fx_hole";
|
|
38
39
|
var PROPS_MARKER = "__fx_props";
|
|
39
40
|
var MARKS = "__FLUIXI_DEVTOOLS_MARKS__";
|
|
@@ -44,10 +45,11 @@ var shared = host[MARKS] ?? {
|
|
|
44
45
|
components: /* @__PURE__ */ new Map()
|
|
45
46
|
};
|
|
46
47
|
host[MARKS] = shared;
|
|
47
|
-
|
|
48
|
+
shared.classes ??= /* @__PURE__ */ new WeakMap();
|
|
49
|
+
function markReactiveSource(file, line, column, name, self) {
|
|
48
50
|
const location = locate(file, line, column);
|
|
49
51
|
if (shared.pending && location.external && !shared.pending.location?.external) return;
|
|
50
|
-
shared.pending = { name, location };
|
|
52
|
+
shared.pending = self && typeof self === "object" ? { name, location, self } : { name, location };
|
|
51
53
|
shared.expiring = false;
|
|
52
54
|
}
|
|
53
55
|
function locate(file, line, column) {
|
|
@@ -63,13 +65,16 @@ function markComponentSource(name, file, line, column) {
|
|
|
63
65
|
}
|
|
64
66
|
if (!seen || seen.file !== file || seen.line !== line) shared.components.set(name, null);
|
|
65
67
|
}
|
|
68
|
+
function markClassSource(constructor, file, line, column) {
|
|
69
|
+
if (typeof constructor === "function") shared.classes.set(constructor, locate(file, line, column));
|
|
70
|
+
}
|
|
66
71
|
function componentSource(name) {
|
|
67
72
|
return shared.components.get(name) ?? void 0;
|
|
68
73
|
}
|
|
69
74
|
function takeReactiveSource() {
|
|
70
75
|
const mark = shared.pending;
|
|
71
76
|
if (mark) {
|
|
72
|
-
if (mark.name !== void 0) shared.pending = { location: mark.location };
|
|
77
|
+
if (mark.name !== void 0 || mark.self) shared.pending = { location: mark.location };
|
|
73
78
|
if (!shared.expiring) {
|
|
74
79
|
shared.expiring = true;
|
|
75
80
|
queueMicrotask(() => {
|
|
@@ -102,6 +107,7 @@ function markProps(props, at) {
|
|
|
102
107
|
function installSourceMarker() {
|
|
103
108
|
if (typeof host[MARKER] !== "function") host[MARKER] = markReactiveSource;
|
|
104
109
|
if (typeof host[COMPONENT_MARKER] !== "function") host[COMPONENT_MARKER] = markComponentSource;
|
|
110
|
+
if (typeof host[CLASS_MARKER] !== "function") host[CLASS_MARKER] = markClassSource;
|
|
105
111
|
if (typeof host[HOLE_MARKER] !== "function") host[HOLE_MARKER] = markHole;
|
|
106
112
|
if (typeof host[PROPS_MARKER] !== "function") host[PROPS_MARKER] = markProps;
|
|
107
113
|
}
|
package/dist/instrument.d.ts
CHANGED
|
@@ -19,7 +19,16 @@ export type NodeKind = 'state' | 'memo' | 'effect' | 'store' | 'resource' | 'com
|
|
|
19
19
|
/** A component whose job is providing a context. */
|
|
20
20
|
| 'provider'
|
|
21
21
|
/** Not a node: a place in the code that sets a signal. */
|
|
22
|
-
| 'setter'
|
|
22
|
+
| 'setter'
|
|
23
|
+
/**
|
|
24
|
+
* A custom element instance: its props and everything its render made. Not `element`,
|
|
25
|
+
* which the component tree already uses for the DOM element rows it lists.
|
|
26
|
+
*/
|
|
27
|
+
| 'custom-element'
|
|
28
|
+
/** An app module registered with `defineModule` / `defineApp`. */
|
|
29
|
+
| 'module'
|
|
30
|
+
/** A service a DI provider built, such as the auth service: its own signals and memos. */
|
|
31
|
+
| 'service';
|
|
23
32
|
export type NodeState = 'clean' | 'check' | 'dirty';
|
|
24
33
|
/**
|
|
25
34
|
* The names the compiler supplies without an import, and what each one is. A control-flow
|
|
@@ -70,6 +79,12 @@ export interface RNode {
|
|
|
70
79
|
version?: number;
|
|
71
80
|
state?: number;
|
|
72
81
|
} | null;
|
|
82
|
+
/**
|
|
83
|
+
* The element, module or service this node belongs to: the id of that scope's node. Set
|
|
84
|
+
* for what was created while the scope was open, and for the scope nodes themselves when
|
|
85
|
+
* they sit inside another (a service built by a module).
|
|
86
|
+
*/
|
|
87
|
+
scope?: number;
|
|
73
88
|
/** Where the author created this node, when the compiler said so. Always optional. */
|
|
74
89
|
source?: ReactiveSourceLocation;
|
|
75
90
|
/**
|
package/dist/instrument.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrument.d.ts","sourceRoot":"","sources":["../src/instrument.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAe,SAAS,EAAS,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACpF,OAAO,EAA4D,KAAK,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAEpH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAIxC,MAAM,MAAM,QAAQ,GAChB,OAAO,GACP,MAAM,GACN,QAAQ,GACR,OAAO,GACP,UAAU,GACV,WAAW;AACb,yFAAyF;GACvF,SAAS;AACX,qEAA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@fluixi/reactive/store";
|
|
|
16
16
|
// src/source.ts
|
|
17
17
|
var MARKER = "__fx_source";
|
|
18
18
|
var COMPONENT_MARKER = "__fx_component";
|
|
19
|
+
var CLASS_MARKER = "__fx_class";
|
|
19
20
|
var HOLE_MARKER = "__fx_hole";
|
|
20
21
|
var PROPS_MARKER = "__fx_props";
|
|
21
22
|
var MARKS = "__FLUIXI_DEVTOOLS_MARKS__";
|
|
@@ -26,10 +27,11 @@ var shared = host[MARKS] ?? {
|
|
|
26
27
|
components: /* @__PURE__ */ new Map()
|
|
27
28
|
};
|
|
28
29
|
host[MARKS] = shared;
|
|
29
|
-
|
|
30
|
+
shared.classes ??= /* @__PURE__ */ new WeakMap();
|
|
31
|
+
function markReactiveSource(file, line, column, name, self) {
|
|
30
32
|
const location = locate(file, line, column);
|
|
31
33
|
if (shared.pending && location.external && !shared.pending.location?.external) return;
|
|
32
|
-
shared.pending = { name, location };
|
|
34
|
+
shared.pending = self && typeof self === "object" ? { name, location, self } : { name, location };
|
|
33
35
|
shared.expiring = false;
|
|
34
36
|
}
|
|
35
37
|
function locate(file, line, column) {
|
|
@@ -45,13 +47,16 @@ function markComponentSource(name, file, line, column) {
|
|
|
45
47
|
}
|
|
46
48
|
if (!seen || seen.file !== file || seen.line !== line) shared.components.set(name, null);
|
|
47
49
|
}
|
|
50
|
+
function markClassSource(constructor, file, line, column) {
|
|
51
|
+
if (typeof constructor === "function") shared.classes.set(constructor, locate(file, line, column));
|
|
52
|
+
}
|
|
48
53
|
function componentSource(name) {
|
|
49
54
|
return shared.components.get(name) ?? void 0;
|
|
50
55
|
}
|
|
51
56
|
function takeReactiveSource() {
|
|
52
57
|
const mark = shared.pending;
|
|
53
58
|
if (mark) {
|
|
54
|
-
if (mark.name !== void 0) shared.pending = { location: mark.location };
|
|
59
|
+
if (mark.name !== void 0 || mark.self) shared.pending = { location: mark.location };
|
|
55
60
|
if (!shared.expiring) {
|
|
56
61
|
shared.expiring = true;
|
|
57
62
|
queueMicrotask(() => {
|
|
@@ -84,6 +89,7 @@ function markProps(props, at) {
|
|
|
84
89
|
function installSourceMarker() {
|
|
85
90
|
if (typeof host[MARKER] !== "function") host[MARKER] = markReactiveSource;
|
|
86
91
|
if (typeof host[COMPONENT_MARKER] !== "function") host[COMPONENT_MARKER] = markComponentSource;
|
|
92
|
+
if (typeof host[CLASS_MARKER] !== "function") host[CLASS_MARKER] = markClassSource;
|
|
87
93
|
if (typeof host[HOLE_MARKER] !== "function") host[HOLE_MARKER] = markHole;
|
|
88
94
|
if (typeof host[PROPS_MARKER] !== "function") host[PROPS_MARKER] = markProps;
|
|
89
95
|
}
|