@fluixi/devtools 0.2.0-alpha.2 → 0.2.0-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. package/README.md +80 -2
  2. package/dist/callsite.cjs +72 -0
  3. package/dist/callsite.d.ts +22 -0
  4. package/dist/callsite.d.ts.map +1 -0
  5. package/dist/callsite.js +82 -0
  6. package/dist/callsite.mjs +51 -0
  7. package/dist/change-view.cjs +134 -0
  8. package/dist/change-view.d.ts +10 -0
  9. package/dist/change-view.d.ts.map +1 -0
  10. package/dist/change-view.js +102 -0
  11. package/dist/change-view.mjs +111 -0
  12. package/dist/copy.cjs +63 -0
  13. package/dist/copy.d.ts +9 -0
  14. package/dist/copy.d.ts.map +1 -0
  15. package/dist/copy.js +52 -0
  16. package/dist/copy.mjs +42 -0
  17. package/dist/describe.cjs +55 -0
  18. package/dist/describe.d.ts +3 -0
  19. package/dist/describe.d.ts.map +1 -0
  20. package/dist/describe.js +47 -0
  21. package/dist/describe.mjs +34 -0
  22. package/dist/detail-panel.cjs +307 -0
  23. package/dist/detail-panel.d.ts +17 -0
  24. package/dist/detail-panel.d.ts.map +1 -0
  25. package/dist/detail-panel.js +217 -0
  26. package/dist/detail-panel.mjs +284 -0
  27. package/dist/diff.cjs +225 -0
  28. package/dist/diff.d.ts +31 -0
  29. package/dist/diff.d.ts.map +1 -0
  30. package/dist/diff.js +132 -0
  31. package/dist/diff.mjs +202 -0
  32. package/dist/dom.cjs +204 -0
  33. package/dist/dom.d.ts +81 -0
  34. package/dist/dom.d.ts.map +1 -0
  35. package/dist/dom.js +269 -0
  36. package/dist/dom.mjs +183 -0
  37. package/dist/export.cjs +221 -0
  38. package/dist/export.d.ts +55 -0
  39. package/dist/export.d.ts.map +1 -0
  40. package/dist/export.js +90 -0
  41. package/dist/export.mjs +209 -0
  42. package/dist/float.cjs +232 -0
  43. package/dist/float.d.ts +54 -0
  44. package/dist/float.d.ts.map +1 -0
  45. package/dist/float.js +256 -0
  46. package/dist/float.mjs +211 -0
  47. package/dist/format.cjs +175 -0
  48. package/dist/format.d.ts +16 -0
  49. package/dist/format.d.ts.map +1 -0
  50. package/dist/format.js +188 -0
  51. package/dist/format.mjs +154 -0
  52. package/dist/graph-view.cjs +893 -0
  53. package/dist/graph-view.d.ts +79 -2
  54. package/dist/graph-view.d.ts.map +1 -1
  55. package/dist/graph-view.js +866 -50
  56. package/dist/graph-view.mjs +870 -0
  57. package/dist/highlight.cjs +140 -0
  58. package/dist/highlight.d.ts +56 -0
  59. package/dist/highlight.d.ts.map +1 -0
  60. package/dist/highlight.js +154 -0
  61. package/dist/highlight.mjs +119 -0
  62. package/dist/history.cjs +95 -0
  63. package/dist/history.d.ts +59 -0
  64. package/dist/history.d.ts.map +1 -0
  65. package/dist/history.js +85 -0
  66. package/dist/history.mjs +74 -0
  67. package/dist/hook.cjs +1562 -0
  68. package/dist/hook.d.ts +60 -0
  69. package/dist/hook.d.ts.map +1 -0
  70. package/dist/hook.js +142 -0
  71. package/dist/hook.mjs +1553 -0
  72. package/dist/index.cjs +4552 -0
  73. package/dist/index.d.ts +44 -1
  74. package/dist/index.d.ts.map +1 -1
  75. package/dist/index.js +25 -1
  76. package/dist/index.mjs +4544 -0
  77. package/dist/inspector.cjs +688 -0
  78. package/dist/inspector.d.ts +60 -0
  79. package/dist/inspector.d.ts.map +1 -0
  80. package/dist/inspector.js +415 -0
  81. package/dist/inspector.mjs +676 -0
  82. package/dist/instrument.cjs +497 -0
  83. package/dist/instrument.d.ts +147 -5
  84. package/dist/instrument.d.ts.map +1 -1
  85. package/dist/instrument.js +164 -44
  86. package/dist/instrument.mjs +487 -0
  87. package/dist/kind-filter.cjs +172 -0
  88. package/dist/kind-filter.d.ts +39 -0
  89. package/dist/kind-filter.d.ts.map +1 -0
  90. package/dist/kind-filter.js +151 -0
  91. package/dist/kind-filter.mjs +151 -0
  92. package/dist/menu.cjs +141 -0
  93. package/dist/menu.d.ts +37 -0
  94. package/dist/menu.d.ts.map +1 -0
  95. package/dist/menu.js +125 -0
  96. package/dist/menu.mjs +120 -0
  97. package/dist/observe.cjs +1352 -0
  98. package/dist/observe.d.ts +80 -0
  99. package/dist/observe.d.ts.map +1 -0
  100. package/dist/observe.js +893 -0
  101. package/dist/observe.mjs +1345 -0
  102. package/dist/palette.cjs +52 -0
  103. package/dist/palette.d.ts +11 -0
  104. package/dist/palette.d.ts.map +1 -0
  105. package/dist/palette.js +27 -0
  106. package/dist/palette.mjs +31 -0
  107. package/dist/path.cjs +45 -0
  108. package/dist/path.d.ts +19 -0
  109. package/dist/path.d.ts.map +1 -0
  110. package/dist/path.js +49 -0
  111. package/dist/path.mjs +24 -0
  112. package/dist/plugin.cjs +87 -0
  113. package/dist/plugin.d.ts +121 -0
  114. package/dist/plugin.d.ts.map +1 -0
  115. package/dist/plugin.js +74 -0
  116. package/dist/plugin.mjs +66 -0
  117. package/dist/plugins/context.cjs +98 -0
  118. package/dist/plugins/context.d.ts +10 -0
  119. package/dist/plugins/context.d.ts.map +1 -0
  120. package/dist/plugins/context.js +80 -0
  121. package/dist/plugins/context.mjs +75 -0
  122. package/dist/plugins/directives.cjs +98 -0
  123. package/dist/plugins/directives.d.ts +25 -0
  124. package/dist/plugins/directives.d.ts.map +1 -0
  125. package/dist/plugins/directives.js +78 -0
  126. package/dist/plugins/directives.mjs +75 -0
  127. package/dist/plugins/index.cjs +162 -0
  128. package/dist/plugins/index.d.ts +7 -0
  129. package/dist/plugins/index.d.ts.map +1 -0
  130. package/dist/plugins/index.js +9 -0
  131. package/dist/plugins/index.mjs +140 -0
  132. package/dist/source.cjs +111 -0
  133. package/dist/source.d.ts +72 -0
  134. package/dist/source.d.ts.map +1 -0
  135. package/dist/source.js +153 -0
  136. package/dist/source.mjs +90 -0
  137. package/dist/timeline.cjs +350 -0
  138. package/dist/timeline.d.ts +30 -0
  139. package/dist/timeline.d.ts.map +1 -0
  140. package/dist/timeline.js +271 -0
  141. package/dist/timeline.mjs +327 -0
  142. package/dist/tree.cjs +574 -0
  143. package/dist/tree.d.ts +128 -0
  144. package/dist/tree.d.ts.map +1 -0
  145. package/dist/tree.js +645 -0
  146. package/dist/tree.mjs +551 -0
  147. package/dist/tsconfig.lib.tsbuildinfo +1 -1
  148. package/dist/value-pane.cjs +223 -0
  149. package/dist/value-pane.d.ts +10 -0
  150. package/dist/value-pane.d.ts.map +1 -0
  151. package/dist/value-pane.js +61 -0
  152. package/dist/value-pane.mjs +200 -0
  153. package/dist/wire.cjs +109 -0
  154. package/dist/wire.d.ts +100 -0
  155. package/dist/wire.d.ts.map +1 -0
  156. package/dist/wire.js +93 -0
  157. package/dist/wire.mjs +89 -0
  158. package/package.json +17 -5
@@ -0,0 +1,85 @@
1
+ // What happened, in order.
2
+ //
3
+ // A snapshot says what the graph is; by the time a panel polls, the propagation is over and
4
+ // everything reads as settled. So the observer's callbacks are recorded as they arrive — the
5
+ // runtime calls them from inside the write, so the order is real rather than reconstructed.
6
+ //
7
+ // Events group into commits: a write with nothing running came from a handler and opens one.
8
+ // Deferred effects land in the commit that scheduled them.
9
+ /** Records nothing and costs nothing, for `history: 0`. */
10
+ const OFF = {
11
+ wrote() { },
12
+ ran() { },
13
+ created() { },
14
+ disposed() { },
15
+ take: () => [],
16
+ dropped: 0,
17
+ clear() { },
18
+ };
19
+ /** Keep the last `limit`. An app nobody is polling still runs effects. */
20
+ export function createHistory(limit) {
21
+ if (limit <= 0)
22
+ return OFF;
23
+ let events = [];
24
+ let seq = 0;
25
+ let commit = 0;
26
+ let dropped = 0;
27
+ const push = (event) => {
28
+ events.push({ ...event, seq: seq++, t: Date.now(), commit });
29
+ if (events.length > limit) {
30
+ dropped += events.length - limit;
31
+ events = events.slice(-limit);
32
+ }
33
+ };
34
+ return {
35
+ wrote(id, by, detail) {
36
+ // Nothing running: it came from outside, which is where a reader wants the cut.
37
+ if (by === undefined)
38
+ commit++;
39
+ push({ kind: 'write', id, by, ...detail });
40
+ },
41
+ ran(id, by) {
42
+ push({ kind: 'ran', id, by });
43
+ },
44
+ created(id, by, label) {
45
+ push({ kind: 'created', id, by, label });
46
+ },
47
+ disposed(id, label) {
48
+ push({ kind: 'disposed', id, label });
49
+ },
50
+ take() {
51
+ const taken = events;
52
+ events = [];
53
+ return taken;
54
+ },
55
+ get dropped() {
56
+ return dropped;
57
+ },
58
+ clear() {
59
+ events = [];
60
+ dropped = 0;
61
+ },
62
+ };
63
+ }
64
+ /**
65
+ * Oldest first. A commit whose opening write has aged out still groups — its events carry the
66
+ * number, and a partial commit beats dropping the runs after it.
67
+ */
68
+ export function toCommits(events) {
69
+ const byNumber = new Map();
70
+ for (const event of events) {
71
+ const bucket = byNumber.get(event.commit);
72
+ if (bucket)
73
+ bucket.push(event);
74
+ else
75
+ byNumber.set(event.commit, [event]);
76
+ }
77
+ return [...byNumber.entries()]
78
+ .sort((a, b) => a[0] - b[0])
79
+ .map(([commit, group]) => ({
80
+ commit,
81
+ t: group[0].t,
82
+ events: group,
83
+ cause: group.find((e) => e.kind === 'write' && e.by === undefined),
84
+ }));
85
+ }
@@ -0,0 +1,74 @@
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
+ }
71
+ export {
72
+ createHistory,
73
+ toCommits
74
+ };