@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
@@ -1,116 +1,9 @@
1
- // src/highlight.ts
2
- var LAYER = "fx-highlight-layer";
3
- var overlay = null;
4
- function build(doc) {
5
- const layer = doc.createElement("div");
6
- layer.id = LAYER;
7
- layer.style.cssText = "position:fixed;inset:0;z-index:2147483646;pointer-events:none;contain:strict;";
8
- const label = doc.createElement("div");
9
- label.style.cssText = "position:absolute;padding:1px 5px;border-radius:3px;background:#5eead4;color:#07131a;font:11px/1.5 ui-monospace,monospace;white-space:nowrap;";
10
- layer.append(label);
11
- doc.body.appendChild(layer);
12
- return { layer, boxes: [], label };
13
- }
14
- function boxIn(overlay2, index) {
15
- const held = overlay2.boxes[index];
16
- if (held) return held;
17
- const box = overlay2.layer.ownerDocument.createElement("div");
18
- box.style.cssText = "position:absolute;border:1px solid #5eead4;background:rgba(94,234,212,.16);border-radius:2px;transition:none;";
19
- overlay2.layer.append(box);
20
- overlay2.boxes.push(box);
21
- return box;
22
- }
23
- function showHighlight(target, text) {
24
- const elements = (Array.isArray(target) ? target : [target]).filter(
25
- (el) => el?.isConnected
26
- );
27
- const first = elements[0];
28
- const doc = first?.ownerDocument;
29
- if (!doc?.body) {
30
- hideHighlight();
31
- return;
32
- }
33
- if (!overlay || overlay.layer.ownerDocument !== doc || !overlay.layer.isConnected) {
34
- overlay = build(doc);
35
- }
36
- const { label, layer } = overlay;
37
- layer.style.display = "";
38
- let top = Infinity;
39
- let left = Infinity;
40
- let bottom = 0;
41
- elements.forEach((element, index) => {
42
- const rect = element.getBoundingClientRect();
43
- const box = boxIn(overlay, index);
44
- box.style.display = "";
45
- box.style.left = `${rect.left}px`;
46
- box.style.top = `${rect.top}px`;
47
- box.style.width = `${rect.width}px`;
48
- box.style.height = `${rect.height}px`;
49
- top = Math.min(top, rect.top);
50
- left = Math.min(left, rect.left);
51
- bottom = Math.max(bottom, rect.bottom);
52
- });
53
- for (let i = elements.length; i < overlay.boxes.length; i++) {
54
- overlay.boxes[i].style.display = "none";
55
- }
56
- if (!text) {
57
- label.style.display = "none";
58
- return;
59
- }
60
- label.style.display = "";
61
- label.textContent = text;
62
- label.style.left = `${Math.max(2, left)}px`;
63
- label.style.top = top >= 20 ? `${top - 18}px` : `${bottom + 4}px`;
64
- }
65
- function hideHighlight() {
66
- if (overlay) overlay.layer.style.display = "none";
67
- }
68
- function removeHighlight() {
69
- overlay?.layer.remove();
70
- overlay = null;
71
- }
72
- function startPicking(options) {
73
- const doc = options.document ?? globalThis.document;
74
- if (!doc?.body) return () => {
75
- };
76
- const was = doc.body.style.cursor;
77
- doc.body.style.cursor = "crosshair";
78
- const under = (event) => {
79
- const target = event.target;
80
- return target?.closest?.(`#${LAYER}`) ? null : target;
81
- };
82
- const move = (event) => {
83
- const element = under(event);
84
- const id = options.nodeAt(element);
85
- if (element && id !== void 0) showHighlight(element, options.describe?.(id, element));
86
- else hideHighlight();
87
- };
88
- const click = (event) => {
89
- event.preventDefault();
90
- event.stopPropagation();
91
- const target = under(event);
92
- const id = options.nodeAt(target);
93
- if (!options.sticky) stop();
94
- if (id !== void 0) options.onPick(id, target);
95
- else if (!options.sticky) options.onCancel?.();
96
- };
97
- const key = (event) => {
98
- if (event.key !== "Escape") return;
99
- stop();
100
- options.onCancel?.();
101
- };
102
- const stop = () => {
103
- doc.body.style.cursor = was;
104
- doc.removeEventListener("pointermove", move, true);
105
- doc.removeEventListener("click", click, true);
106
- doc.removeEventListener("keydown", key, true);
107
- hideHighlight();
108
- };
109
- doc.addEventListener("pointermove", move, true);
110
- doc.addEventListener("click", click, true);
111
- doc.addEventListener("keydown", key, true);
112
- return stop;
113
- }
1
+ import {
2
+ hideHighlight,
3
+ removeHighlight,
4
+ showHighlight,
5
+ startPicking
6
+ } from "./chunk-NVULLJDH.mjs";
114
7
  export {
115
8
  hideHighlight,
116
9
  removeHighlight,
package/dist/history.cjs CHANGED
@@ -33,6 +33,8 @@ var OFF = {
33
33
  },
34
34
  disposed() {
35
35
  },
36
+ marked() {
37
+ },
36
38
  take: () => [],
37
39
  dropped: 0,
38
40
  clear() {
@@ -44,6 +46,7 @@ function createHistory(limit) {
44
46
  let seq = 0;
45
47
  let commit = 0;
46
48
  let dropped = 0;
49
+ let held = false;
47
50
  const push = (event) => {
48
51
  events.push({ ...event, seq: seq++, t: Date.now(), commit });
49
52
  if (events.length > limit) {
@@ -53,7 +56,10 @@ function createHistory(limit) {
53
56
  };
54
57
  return {
55
58
  wrote(id, by, detail) {
56
- if (by === void 0) commit++;
59
+ if (by === void 0) {
60
+ if (held) held = false;
61
+ else commit++;
62
+ }
57
63
  push({ kind: "write", id, by, ...detail });
58
64
  },
59
65
  ran(id, by) {
@@ -65,6 +71,11 @@ function createHistory(limit) {
65
71
  disposed(id, label) {
66
72
  push({ kind: "disposed", id, label });
67
73
  },
74
+ marked(label) {
75
+ commit++;
76
+ held = true;
77
+ push({ kind: "mark", id: -1, label });
78
+ },
68
79
  take() {
69
80
  const taken = events;
70
81
  events = [];
@@ -90,6 +101,7 @@ function toCommits(events) {
90
101
  commit,
91
102
  t: group[0].t,
92
103
  events: group,
93
- cause: group.find((e) => e.kind === "write" && e.by === void 0)
104
+ cause: group.find((e) => e.kind === "write" && e.by === void 0),
105
+ mark: group.find((e) => e.kind === "mark")
94
106
  }));
95
107
  }
package/dist/history.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { ValueChange } from './diff.js';
2
- export type GraphEventKind = 'write' | 'ran' | 'created' | 'disposed';
2
+ export type GraphEventKind = 'write' | 'ran' | 'created' | 'disposed' | 'mark';
3
3
  export interface GraphEvent {
4
4
  /** Monotonic across the session, so a consumer folding deltas never reorders them. */
5
5
  readonly seq: number;
@@ -35,6 +35,11 @@ export interface History {
35
35
  ran(id: number, by?: number): void;
36
36
  created(id: number, by?: number, label?: string): void;
37
37
  disposed(id: number, label?: string): void;
38
+ /**
39
+ * Open a commit named by the tool, such as a hot update: the write that follows joins it
40
+ * instead of opening its own.
41
+ */
42
+ marked(label: string): void;
38
43
  /** Everything since the last call. Draining is what keeps a producer nobody polls bounded. */
39
44
  take(): GraphEvent[];
40
45
  /** How many events were dropped for being older than the limit. */
@@ -50,6 +55,8 @@ export interface Commit {
50
55
  readonly events: GraphEvent[];
51
56
  /** The write that opened it, if the buffer still holds it. */
52
57
  readonly cause?: GraphEvent;
58
+ /** What a tool named it, such as a hot update. */
59
+ readonly mark?: GraphEvent;
53
60
  }
54
61
  /**
55
62
  * Oldest first. A commit whose opening write has aged out still groups, its events carry the
@@ -1 +1 @@
1
- {"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../src/history.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAE7C,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,KAAK,GAAG,SAAS,GAAG,UAAU,CAAC;AAEtE,MAAM,WAAW,UAAU;IACzB,sFAAsF;IACtF,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,+CAA+C;IAC/C,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAC9B,+BAA+B;IAC/B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,4FAA4F;IAC5F,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IACrB,qFAAqF;IACrF,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,4EAA4E;IAC5E,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IACrB,yFAAyF;IACzF,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;IAC9B;;;OAGG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,gEAAgE;AAChE,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,EAAE,MAAM,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AAC;IACvD,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3C;;;OAGG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,8FAA8F;IAC9F,IAAI,IAAI,UAAU,EAAE,CAAC;IACrB,mEAAmE;IACnE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,KAAK,IAAI,IAAI,CAAC;CACf;AAcD,0EAA0E;AAC1E,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAsDpD;AAED,uDAAuD;AACvD,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,MAAM,EAAE,UAAU,EAAE,CAAC;IAC9B,8DAA8D;IAC9D,QAAQ,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC;IAC5B,kDAAkD;IAClD,QAAQ,CAAC,IAAI,CAAC,EAAE,UAAU,CAAC;CAC5B;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,SAAS,UAAU,EAAE,GAAG,MAAM,EAAE,CAgBjE"}
package/dist/history.js CHANGED
@@ -12,6 +12,7 @@ const OFF = {
12
12
  ran() { },
13
13
  created() { },
14
14
  disposed() { },
15
+ marked() { },
15
16
  take: () => [],
16
17
  dropped: 0,
17
18
  clear() { },
@@ -24,6 +25,8 @@ export function createHistory(limit) {
24
25
  let seq = 0;
25
26
  let commit = 0;
26
27
  let dropped = 0;
28
+ /** A mark just opened the commit; the next outside write belongs to it. */
29
+ let held = false;
27
30
  const push = (event) => {
28
31
  events.push({ ...event, seq: seq++, t: Date.now(), commit });
29
32
  if (events.length > limit) {
@@ -34,8 +37,12 @@ export function createHistory(limit) {
34
37
  return {
35
38
  wrote(id, by, detail) {
36
39
  // Nothing running: it came from outside, which is where a reader wants the cut.
37
- if (by === undefined)
38
- commit++;
40
+ if (by === undefined) {
41
+ if (held)
42
+ held = false;
43
+ else
44
+ commit++;
45
+ }
39
46
  push({ kind: 'write', id, by, ...detail });
40
47
  },
41
48
  ran(id, by) {
@@ -47,6 +54,11 @@ export function createHistory(limit) {
47
54
  disposed(id, label) {
48
55
  push({ kind: 'disposed', id, label });
49
56
  },
57
+ marked(label) {
58
+ commit++;
59
+ held = true;
60
+ push({ kind: 'mark', id: -1, label });
61
+ },
50
62
  take() {
51
63
  const taken = events;
52
64
  events = [];
@@ -81,5 +93,6 @@ export function toCommits(events) {
81
93
  t: group[0].t,
82
94
  events: group,
83
95
  cause: group.find((e) => e.kind === 'write' && e.by === undefined),
96
+ mark: group.find((e) => e.kind === 'mark'),
84
97
  }));
85
98
  }
package/dist/history.mjs CHANGED
@@ -1,73 +1,7 @@
1
- // src/history.ts
2
- var OFF = {
3
- wrote() {
4
- },
5
- ran() {
6
- },
7
- created() {
8
- },
9
- disposed() {
10
- },
11
- take: () => [],
12
- dropped: 0,
13
- clear() {
14
- }
15
- };
16
- function createHistory(limit) {
17
- if (limit <= 0) return OFF;
18
- let events = [];
19
- let seq = 0;
20
- let commit = 0;
21
- let dropped = 0;
22
- const push = (event) => {
23
- events.push({ ...event, seq: seq++, t: Date.now(), commit });
24
- if (events.length > limit) {
25
- dropped += events.length - limit;
26
- events = events.slice(-limit);
27
- }
28
- };
29
- return {
30
- wrote(id, by, detail) {
31
- if (by === void 0) commit++;
32
- push({ kind: "write", id, by, ...detail });
33
- },
34
- ran(id, by) {
35
- push({ kind: "ran", id, by });
36
- },
37
- created(id, by, label) {
38
- push({ kind: "created", id, by, label });
39
- },
40
- disposed(id, label) {
41
- push({ kind: "disposed", id, label });
42
- },
43
- take() {
44
- const taken = events;
45
- events = [];
46
- return taken;
47
- },
48
- get dropped() {
49
- return dropped;
50
- },
51
- clear() {
52
- events = [];
53
- dropped = 0;
54
- }
55
- };
56
- }
57
- function toCommits(events) {
58
- const byNumber = /* @__PURE__ */ new Map();
59
- for (const event of events) {
60
- const bucket = byNumber.get(event.commit);
61
- if (bucket) bucket.push(event);
62
- else byNumber.set(event.commit, [event]);
63
- }
64
- return [...byNumber.entries()].sort((a, b) => a[0] - b[0]).map(([commit, group]) => ({
65
- commit,
66
- t: group[0].t,
67
- events: group,
68
- cause: group.find((e) => e.kind === "write" && e.by === void 0)
69
- }));
70
- }
1
+ import {
2
+ createHistory,
3
+ toCommits
4
+ } from "./chunk-2ACSNLS6.mjs";
71
5
  export {
72
6
  createHistory,
73
7
  toCommits
package/dist/hook.cjs CHANGED
@@ -504,6 +504,8 @@ var OFF = {
504
504
  },
505
505
  disposed() {
506
506
  },
507
+ marked() {
508
+ },
507
509
  take: () => [],
508
510
  dropped: 0,
509
511
  clear() {
@@ -515,6 +517,7 @@ function createHistory(limit) {
515
517
  let seq = 0;
516
518
  let commit = 0;
517
519
  let dropped = 0;
520
+ let held = false;
518
521
  const push = (event) => {
519
522
  events.push({ ...event, seq: seq++, t: Date.now(), commit });
520
523
  if (events.length > limit) {
@@ -524,7 +527,10 @@ function createHistory(limit) {
524
527
  };
525
528
  return {
526
529
  wrote(id, by, detail) {
527
- if (by === void 0) commit++;
530
+ if (by === void 0) {
531
+ if (held) held = false;
532
+ else commit++;
533
+ }
528
534
  push({ kind: "write", id, by, ...detail });
529
535
  },
530
536
  ran(id, by) {
@@ -536,6 +542,11 @@ function createHistory(limit) {
536
542
  disposed(id, label) {
537
543
  push({ kind: "disposed", id, label });
538
544
  },
545
+ marked(label) {
546
+ commit++;
547
+ held = true;
548
+ push({ kind: "mark", id: -1, label });
549
+ },
539
550
  take() {
540
551
  const taken = events;
541
552
  events = [];
@@ -1452,6 +1463,9 @@ function observeGraph(options = {}) {
1452
1463
  takeEvents() {
1453
1464
  return history.take();
1454
1465
  },
1466
+ mark(label) {
1467
+ history.marked(label);
1468
+ },
1455
1469
  detach() {
1456
1470
  stop();
1457
1471
  internals.clear();
@@ -1643,6 +1657,7 @@ function serializeGraph(graph, now = Date.now(), options = {}) {
1643
1657
  // src/hook.ts
1644
1658
  var HISTORY = 500;
1645
1659
  var HOOK = "__FLUIXI_DEVTOOLS_HOOK__";
1660
+ var FLASH_MS = 1200;
1646
1661
  function installDevtoolsHook() {
1647
1662
  const host2 = globalThis;
1648
1663
  const existing = host2[HOOK];
@@ -1653,6 +1668,7 @@ function installDevtoolsHook() {
1653
1668
  let observed = null;
1654
1669
  let owned = false;
1655
1670
  let version = null;
1671
+ let flashTimer;
1656
1672
  const history = [];
1657
1673
  const hook = {
1658
1674
  copies: 1,
@@ -1674,6 +1690,15 @@ function installDevtoolsHook() {
1674
1690
  get version() {
1675
1691
  return version;
1676
1692
  },
1693
+ mark(label) {
1694
+ observed?.mark(label);
1695
+ },
1696
+ flash(elements, label) {
1697
+ if (!elements.length) return;
1698
+ showHighlight([...elements], label);
1699
+ clearTimeout(flashTimer);
1700
+ flashTimer = setTimeout(hideHighlight, FLASH_MS);
1701
+ },
1677
1702
  highlight(target) {
1678
1703
  if (!observed || target === null) {
1679
1704
  hideHighlight();
package/dist/hook.d.ts CHANGED
@@ -51,6 +51,10 @@ export interface DevtoolsHook {
51
51
  * index per step: `12:0/1/2`. Null clears it.
52
52
  */
53
53
  highlight(target: number | string | null): void;
54
+ /** Called by the runtime before a hot update: the update's writes are one commit named `label`. */
55
+ mark(label: string): void;
56
+ /** Outline what a hot update rebuilt, for a moment. */
57
+ flash(elements: readonly Element[], label: string): void;
54
58
  }
55
59
  /**
56
60
  * Install the hook. Returns the existing one if something got there first, so two agents on
@@ -1 +1 @@
1
- {"version":3,"file":"hook.d.ts","sourceRoot":"","sources":["../src/hook.ts"],"names":[],"mappings":"AAYA,OAAO,EAAgB,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAEhE,OAAO,EAAmC,KAAK,aAAa,EAAE,MAAM,WAAW,CAAC;AAQhF,MAAM,WAAW,YAAY;IAC3B;;;;;;;;OAQG;IACH,MAAM,CAAC,OAAO,E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MAAM,IAAI,CAAA;SAAE,KAAK,aAAa,CAAC;KAC3E,GAAG,IAAI,CAAC;IACT,+CAA+C;IAC/C,QAAQ,CAAC,QAAQ,EAAE,aAAa,GAAG,IAAI,CAAC;IACxC,8FAA8F;IAC9F,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,aAAa,GAAG,IAAI,CAAC;IAChF;;;;;;OAMG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,IAAI,CAAC;IAChD,mGAAmG;IACnG,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,uDAAuD;IACvD,KAAK,CAAC,QAAQ,EAAE,SAAS,OAAO,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1D;AAKD;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,YAAY,CA2HlD"}
package/dist/hook.js CHANGED
@@ -17,6 +17,8 @@ import { serializeGraph } from './wire.js';
17
17
  const HISTORY = 500;
18
18
  /** Kept in step with the name in @fluixi/reactive's observe.ts. */
19
19
  const HOOK = '__FLUIXI_DEVTOOLS_HOOK__';
20
+ /** How long a hot update's outline stays. */
21
+ const FLASH_MS = 1200;
20
22
  /**
21
23
  * Install the hook. Returns the existing one if something got there first, so two agents on
22
24
  * one page share a graph rather than each seeing half of it.
@@ -35,6 +37,7 @@ export function installDevtoolsHook() {
35
37
  /** Whether whoever is watching brought its own devtools, rather than being given this one. */
36
38
  let owned = false;
37
39
  let version = null;
40
+ let flashTimer;
38
41
  /** What has happened, for whoever asks. Bounded: nothing here is ever consumed. */
39
42
  const history = [];
40
43
  const hook = {
@@ -62,6 +65,16 @@ export function installDevtoolsHook() {
62
65
  get version() {
63
66
  return version;
64
67
  },
68
+ mark(label) {
69
+ observed?.mark(label);
70
+ },
71
+ flash(elements, label) {
72
+ if (!elements.length)
73
+ return;
74
+ showHighlight([...elements], label);
75
+ clearTimeout(flashTimer);
76
+ flashTimer = setTimeout(hideHighlight, FLASH_MS);
77
+ },
65
78
  highlight(target) {
66
79
  if (!observed || target === null) {
67
80
  hideHighlight();