@fluixi/devtools 1.0.0-alpha.108 → 1.0.0-alpha.110

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 (83) hide show
  1. package/dist/callsite.mjs +4 -63
  2. package/dist/change-view.mjs +6 -106
  3. package/dist/chunk-235BSS43.mjs +185 -0
  4. package/dist/chunk-2ACSNLS6.mjs +87 -0
  5. package/dist/chunk-2VDMQ3VF.mjs +520 -0
  6. package/dist/chunk-33U2S43X.mjs +121 -0
  7. package/dist/chunk-B3SAJ7QG.mjs +72 -0
  8. package/dist/chunk-BTCWJTXR.mjs +216 -0
  9. package/dist/chunk-CPZWLBCQ.mjs +35 -0
  10. package/dist/chunk-D25KZZBZ.mjs +212 -0
  11. package/dist/chunk-EBSROPWJ.mjs +314 -0
  12. package/dist/chunk-F664XLZL.mjs +743 -0
  13. package/dist/chunk-FY5K3QVT.mjs +35 -0
  14. package/dist/chunk-GDQXCOQB.mjs +43 -0
  15. package/dist/chunk-JLNWT36I.mjs +118 -0
  16. package/dist/chunk-JTHAZJJZ.mjs +780 -0
  17. package/dist/chunk-L6XQGNMW.mjs +106 -0
  18. package/dist/chunk-MN6O673L.mjs +90 -0
  19. package/dist/chunk-NDUBBBNL.mjs +70 -0
  20. package/dist/chunk-NT7YMK77.mjs +157 -0
  21. package/dist/chunk-NVULLJDH.mjs +120 -0
  22. package/dist/chunk-NWLSDERQ.mjs +68 -0
  23. package/dist/chunk-OPIGF5XB.mjs +184 -0
  24. package/dist/chunk-P5I7DWFX.mjs +292 -0
  25. package/dist/chunk-PSSBFXBD.mjs +155 -0
  26. package/dist/chunk-PTQ5VCYE.mjs +103 -0
  27. package/dist/chunk-UAEJ3N7F.mjs +76 -0
  28. package/dist/chunk-V6DKWEYD.mjs +67 -0
  29. package/dist/chunk-VO2V7AC5.mjs +80 -0
  30. package/dist/chunk-WGQH7RUW.mjs +25 -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.cjs +2 -1
  35. package/dist/detail-panel.d.ts.map +1 -1
  36. package/dist/detail-panel.js +1 -0
  37. package/dist/detail-panel.mjs +6 -280
  38. package/dist/diff.mjs +4 -201
  39. package/dist/dom.mjs +7 -176
  40. package/dist/export.mjs +6 -207
  41. package/dist/float.mjs +5 -206
  42. package/dist/format.mjs +5 -151
  43. package/dist/graph-view.mjs +9 -875
  44. package/dist/highlight.mjs +6 -113
  45. package/dist/history.cjs +14 -2
  46. package/dist/history.d.ts +8 -1
  47. package/dist/history.d.ts.map +1 -1
  48. package/dist/history.js +15 -2
  49. package/dist/history.mjs +4 -70
  50. package/dist/hook.cjs +26 -1
  51. package/dist/hook.d.ts +4 -0
  52. package/dist/hook.d.ts.map +1 -1
  53. package/dist/hook.js +13 -0
  54. package/dist/hook.mjs +16 -1719
  55. package/dist/index.cjs +34 -5
  56. package/dist/index.mjs +106 -4673
  57. package/dist/inspector.mjs +11 -677
  58. package/dist/instrument.mjs +9 -486
  59. package/dist/kind-filter.mjs +6 -148
  60. package/dist/menu.mjs +4 -116
  61. package/dist/observe.cjs +15 -1
  62. package/dist/observe.d.ts +2 -0
  63. package/dist/observe.d.ts.map +1 -1
  64. package/dist/observe.js +3 -0
  65. package/dist/observe.mjs +14 -1510
  66. package/dist/palette.mjs +6 -28
  67. package/dist/path.mjs +3 -21
  68. package/dist/plugin.mjs +9 -57
  69. package/dist/plugins/context.mjs +6 -71
  70. package/dist/plugins/directives.mjs +8 -68
  71. package/dist/plugins/index.cjs +1 -1
  72. package/dist/plugins/index.mjs +13 -136
  73. package/dist/source.mjs +12 -93
  74. package/dist/timeline.cjs +5 -2
  75. package/dist/timeline.d.ts.map +1 -1
  76. package/dist/timeline.js +5 -1
  77. package/dist/timeline.mjs +7 -323
  78. package/dist/tree.mjs +11 -558
  79. package/dist/tsconfig.lib.tsbuildinfo +1 -1
  80. package/dist/value-pane.mjs +6 -196
  81. package/dist/wire.cjs +1 -1
  82. package/dist/wire.mjs +6 -86
  83. package/package.json +3 -3
@@ -0,0 +1,35 @@
1
+ // src/palette.ts
2
+ var KIND_COLOR = {
3
+ state: "#34d399",
4
+ memo: "#a78bfa",
5
+ effect: "#fbbf24",
6
+ store: "#38bdf8",
7
+ resource: "#fb7185",
8
+ component: "#f0abfc",
9
+ provider: "#fb923c",
10
+ control: "#22d3ee",
11
+ router: "#818cf8",
12
+ handler: "#f472b6",
13
+ context: "#a3e635",
14
+ directive: "#5eead4",
15
+ binding: "#5eead4",
16
+ setter: "#fb7185",
17
+ group: "#8a90a2",
18
+ element: "#8a90a2",
19
+ "custom-element": "#2dd4bf",
20
+ module: "#facc15",
21
+ service: "#60a5fa"
22
+ };
23
+ var kindVar = (kind) => `--fx-kind-${kind}`;
24
+ var kindColor = (kind) => `var(${kindVar(kind)}, ${KIND_COLOR[kind]})`;
25
+ var KINDS = Object.keys(KIND_COLOR);
26
+ function kindRules(selector, property) {
27
+ return KINDS.map((kind) => `${selector(kind)} { ${property}: ${kindColor(kind)}; }`).join("\n");
28
+ }
29
+
30
+ export {
31
+ KIND_COLOR,
32
+ kindVar,
33
+ kindColor,
34
+ kindRules
35
+ };
@@ -0,0 +1,43 @@
1
+ // src/copy.ts
2
+ function confirmOn(button, said = "copied") {
3
+ if (!button) return;
4
+ const was = button.textContent;
5
+ button.textContent = said;
6
+ setTimeout(() => {
7
+ button.textContent = was;
8
+ }, 1200);
9
+ }
10
+ function fallback(text, button) {
11
+ try {
12
+ const doc = button?.ownerDocument ?? document;
13
+ const area = doc.createElement("textarea");
14
+ area.value = text;
15
+ area.setAttribute("readonly", "");
16
+ area.style.position = "fixed";
17
+ area.style.opacity = "0";
18
+ doc.body.appendChild(area);
19
+ area.select();
20
+ doc.execCommand("copy");
21
+ area.remove();
22
+ confirmOn(button);
23
+ return true;
24
+ } catch {
25
+ return false;
26
+ }
27
+ }
28
+ async function copyText(text, button) {
29
+ const clipboard = globalThis.navigator?.clipboard;
30
+ if (clipboard?.writeText) {
31
+ try {
32
+ await clipboard.writeText(text);
33
+ confirmOn(button);
34
+ return true;
35
+ } catch {
36
+ }
37
+ }
38
+ return fallback(text, button);
39
+ }
40
+
41
+ export {
42
+ copyText
43
+ };
@@ -0,0 +1,118 @@
1
+ import {
2
+ serializeGraph
3
+ } from "./chunk-MN6O673L.mjs";
4
+ import {
5
+ observeGraph
6
+ } from "./chunk-JTHAZJJZ.mjs";
7
+ import {
8
+ hideHighlight,
9
+ showHighlight
10
+ } from "./chunk-NVULLJDH.mjs";
11
+ import {
12
+ withoutElements
13
+ } from "./chunk-OPIGF5XB.mjs";
14
+
15
+ // src/hook.ts
16
+ var HISTORY = 500;
17
+ var HOOK = "__FLUIXI_DEVTOOLS_HOOK__";
18
+ var FLASH_MS = 1200;
19
+ function installDevtoolsHook() {
20
+ const host = globalThis;
21
+ const existing = host[HOOK];
22
+ if (existing) {
23
+ existing.copies = (existing.copies ?? 1) + 1;
24
+ return existing;
25
+ }
26
+ let observed = null;
27
+ let owned = false;
28
+ let version = null;
29
+ let flashTimer;
30
+ const history = [];
31
+ const hook = {
32
+ copies: 1,
33
+ inject(runtime) {
34
+ version = runtime.version;
35
+ if (!observed) {
36
+ observed = (runtime.watch ?? observeGraph)({ observe: runtime.observeReactiveNodes });
37
+ owned = runtime.watch !== void 0;
38
+ return;
39
+ }
40
+ if (owned || !runtime.watch) return;
41
+ observed.detach();
42
+ observed = runtime.watch({ observe: runtime.observeReactiveNodes });
43
+ owned = true;
44
+ },
45
+ get observed() {
46
+ return observed;
47
+ },
48
+ get version() {
49
+ return version;
50
+ },
51
+ mark(label) {
52
+ observed?.mark(label);
53
+ },
54
+ flash(elements, label) {
55
+ if (!elements.length) return;
56
+ showHighlight([...elements], label);
57
+ clearTimeout(flashTimer);
58
+ flashTimer = setTimeout(hideHighlight, FLASH_MS);
59
+ },
60
+ highlight(target) {
61
+ if (!observed || target === null) {
62
+ hideHighlight();
63
+ return;
64
+ }
65
+ if (typeof target === "number") {
66
+ const found = observed.elementsFor(target);
67
+ if (found.length) showHighlight(found, observed.graph.get(target)?.label);
68
+ else hideHighlight();
69
+ return;
70
+ }
71
+ const [head, ...steps] = target.split("/");
72
+ const [tag, root] = (head ?? "").split(":");
73
+ let node = observed.domFor(Number(tag))[Number(root)];
74
+ for (const step of steps) node = node?.children[Number(step)];
75
+ const element = node?.element;
76
+ if (element) showHighlight(element, element.tagName.toLowerCase());
77
+ else hideHighlight();
78
+ },
79
+ snapshot({ partial = false, since } = {}) {
80
+ if (!observed) return null;
81
+ const changed = observed.sample();
82
+ const cursor = observed.revision;
83
+ history.push(...observed.takeEvents());
84
+ if (history.length > HISTORY) history.splice(0, history.length - HISTORY);
85
+ const events = history.slice();
86
+ const dom = (id) => {
87
+ const described = observed.domFor(id);
88
+ return described.length ? withoutElements(described) : void 0;
89
+ };
90
+ const cursors = typeof observed.changedSince === "function";
91
+ const whole = partial === false || since === void 0 || !cursors || observed.outrun(since);
92
+ if (whole) {
93
+ if (partial && !cursors) {
94
+ return serializeGraph(observed.graph, Date.now(), {
95
+ ids: changed,
96
+ removed: observed.takeRemoved(),
97
+ events,
98
+ dom
99
+ });
100
+ }
101
+ return serializeGraph(observed.graph, Date.now(), { events, dom, cursor });
102
+ }
103
+ return serializeGraph(observed.graph, Date.now(), {
104
+ ids: observed.changedSince(since),
105
+ removed: observed.removedSince(since),
106
+ events,
107
+ dom,
108
+ cursor
109
+ });
110
+ }
111
+ };
112
+ host[HOOK] = hook;
113
+ return hook;
114
+ }
115
+
116
+ export {
117
+ installDevtoolsHook
118
+ };