@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.
- package/README.md +80 -2
- package/dist/callsite.cjs +72 -0
- package/dist/callsite.d.ts +22 -0
- package/dist/callsite.d.ts.map +1 -0
- package/dist/callsite.js +82 -0
- package/dist/callsite.mjs +51 -0
- package/dist/change-view.cjs +134 -0
- package/dist/change-view.d.ts +10 -0
- package/dist/change-view.d.ts.map +1 -0
- package/dist/change-view.js +102 -0
- package/dist/change-view.mjs +111 -0
- package/dist/copy.cjs +63 -0
- package/dist/copy.d.ts +9 -0
- package/dist/copy.d.ts.map +1 -0
- package/dist/copy.js +52 -0
- package/dist/copy.mjs +42 -0
- package/dist/describe.cjs +55 -0
- package/dist/describe.d.ts +3 -0
- package/dist/describe.d.ts.map +1 -0
- package/dist/describe.js +47 -0
- package/dist/describe.mjs +34 -0
- package/dist/detail-panel.cjs +307 -0
- package/dist/detail-panel.d.ts +17 -0
- package/dist/detail-panel.d.ts.map +1 -0
- package/dist/detail-panel.js +217 -0
- package/dist/detail-panel.mjs +284 -0
- package/dist/diff.cjs +225 -0
- package/dist/diff.d.ts +31 -0
- package/dist/diff.d.ts.map +1 -0
- package/dist/diff.js +132 -0
- package/dist/diff.mjs +202 -0
- package/dist/dom.cjs +204 -0
- package/dist/dom.d.ts +81 -0
- package/dist/dom.d.ts.map +1 -0
- package/dist/dom.js +269 -0
- package/dist/dom.mjs +183 -0
- package/dist/export.cjs +221 -0
- package/dist/export.d.ts +55 -0
- package/dist/export.d.ts.map +1 -0
- package/dist/export.js +90 -0
- package/dist/export.mjs +209 -0
- package/dist/float.cjs +232 -0
- package/dist/float.d.ts +54 -0
- package/dist/float.d.ts.map +1 -0
- package/dist/float.js +256 -0
- package/dist/float.mjs +211 -0
- package/dist/format.cjs +175 -0
- package/dist/format.d.ts +16 -0
- package/dist/format.d.ts.map +1 -0
- package/dist/format.js +188 -0
- package/dist/format.mjs +154 -0
- package/dist/graph-view.cjs +893 -0
- package/dist/graph-view.d.ts +79 -2
- package/dist/graph-view.d.ts.map +1 -1
- package/dist/graph-view.js +866 -50
- package/dist/graph-view.mjs +870 -0
- package/dist/highlight.cjs +140 -0
- package/dist/highlight.d.ts +56 -0
- package/dist/highlight.d.ts.map +1 -0
- package/dist/highlight.js +154 -0
- package/dist/highlight.mjs +119 -0
- package/dist/history.cjs +95 -0
- package/dist/history.d.ts +59 -0
- package/dist/history.d.ts.map +1 -0
- package/dist/history.js +85 -0
- package/dist/history.mjs +74 -0
- package/dist/hook.cjs +1562 -0
- package/dist/hook.d.ts +60 -0
- package/dist/hook.d.ts.map +1 -0
- package/dist/hook.js +142 -0
- package/dist/hook.mjs +1553 -0
- package/dist/index.cjs +4552 -0
- package/dist/index.d.ts +44 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +25 -1
- package/dist/index.mjs +4544 -0
- package/dist/inspector.cjs +688 -0
- package/dist/inspector.d.ts +60 -0
- package/dist/inspector.d.ts.map +1 -0
- package/dist/inspector.js +415 -0
- package/dist/inspector.mjs +676 -0
- package/dist/instrument.cjs +497 -0
- package/dist/instrument.d.ts +147 -5
- package/dist/instrument.d.ts.map +1 -1
- package/dist/instrument.js +164 -44
- package/dist/instrument.mjs +487 -0
- package/dist/kind-filter.cjs +172 -0
- package/dist/kind-filter.d.ts +39 -0
- package/dist/kind-filter.d.ts.map +1 -0
- package/dist/kind-filter.js +151 -0
- package/dist/kind-filter.mjs +151 -0
- package/dist/menu.cjs +141 -0
- package/dist/menu.d.ts +37 -0
- package/dist/menu.d.ts.map +1 -0
- package/dist/menu.js +125 -0
- package/dist/menu.mjs +120 -0
- package/dist/observe.cjs +1352 -0
- package/dist/observe.d.ts +80 -0
- package/dist/observe.d.ts.map +1 -0
- package/dist/observe.js +893 -0
- package/dist/observe.mjs +1345 -0
- package/dist/palette.cjs +52 -0
- package/dist/palette.d.ts +11 -0
- package/dist/palette.d.ts.map +1 -0
- package/dist/palette.js +27 -0
- package/dist/palette.mjs +31 -0
- package/dist/path.cjs +45 -0
- package/dist/path.d.ts +19 -0
- package/dist/path.d.ts.map +1 -0
- package/dist/path.js +49 -0
- package/dist/path.mjs +24 -0
- package/dist/plugin.cjs +87 -0
- package/dist/plugin.d.ts +121 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +74 -0
- package/dist/plugin.mjs +66 -0
- package/dist/plugins/context.cjs +98 -0
- package/dist/plugins/context.d.ts +10 -0
- package/dist/plugins/context.d.ts.map +1 -0
- package/dist/plugins/context.js +80 -0
- package/dist/plugins/context.mjs +75 -0
- package/dist/plugins/directives.cjs +98 -0
- package/dist/plugins/directives.d.ts +25 -0
- package/dist/plugins/directives.d.ts.map +1 -0
- package/dist/plugins/directives.js +78 -0
- package/dist/plugins/directives.mjs +75 -0
- package/dist/plugins/index.cjs +162 -0
- package/dist/plugins/index.d.ts +7 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +9 -0
- package/dist/plugins/index.mjs +140 -0
- package/dist/source.cjs +111 -0
- package/dist/source.d.ts +72 -0
- package/dist/source.d.ts.map +1 -0
- package/dist/source.js +153 -0
- package/dist/source.mjs +90 -0
- package/dist/timeline.cjs +350 -0
- package/dist/timeline.d.ts +30 -0
- package/dist/timeline.d.ts.map +1 -0
- package/dist/timeline.js +271 -0
- package/dist/timeline.mjs +327 -0
- package/dist/tree.cjs +574 -0
- package/dist/tree.d.ts +128 -0
- package/dist/tree.d.ts.map +1 -0
- package/dist/tree.js +645 -0
- package/dist/tree.mjs +551 -0
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/value-pane.cjs +223 -0
- package/dist/value-pane.d.ts +10 -0
- package/dist/value-pane.d.ts.map +1 -0
- package/dist/value-pane.js +61 -0
- package/dist/value-pane.mjs +200 -0
- package/dist/wire.cjs +109 -0
- package/dist/wire.d.ts +100 -0
- package/dist/wire.d.ts.map +1 -0
- package/dist/wire.js +93 -0
- package/dist/wire.mjs +89 -0
- package/package.json +17 -5
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/plugins/context.ts
|
|
21
|
+
var context_exports = {};
|
|
22
|
+
__export(context_exports, {
|
|
23
|
+
NAME: () => NAME,
|
|
24
|
+
contextPlugin: () => contextPlugin
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(context_exports);
|
|
27
|
+
|
|
28
|
+
// src/plugin.ts
|
|
29
|
+
var plugins = [];
|
|
30
|
+
function registerDevtoolsPlugin(plugin) {
|
|
31
|
+
const at = plugins.findIndex((p) => p.name === plugin.name);
|
|
32
|
+
if (at === -1) plugins.push(plugin);
|
|
33
|
+
else plugins[at] = plugin;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// src/format.ts
|
|
37
|
+
function shorten(text, limit = 18) {
|
|
38
|
+
return text.length > limit ? `${text.slice(0, limit - 1)}…` : text;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// src/plugins/context.ts
|
|
42
|
+
var NAME = "context";
|
|
43
|
+
var contextPlugin = {
|
|
44
|
+
name: NAME,
|
|
45
|
+
collect(ctx) {
|
|
46
|
+
const nodes = /* @__PURE__ */ new Map();
|
|
47
|
+
ctx.onContext((report) => {
|
|
48
|
+
if (report.owner === void 0) return;
|
|
49
|
+
let node = nodes.get(report.id);
|
|
50
|
+
if (node === void 0) {
|
|
51
|
+
const label = report.name === "context" && report.ownerLabel ? `${report.ownerLabel} context` : report.name;
|
|
52
|
+
node = ctx.add({
|
|
53
|
+
label,
|
|
54
|
+
kind: "context",
|
|
55
|
+
// A context is created at module scope with nothing running, so the only line it
|
|
56
|
+
// can carry is the one that provided or read it.
|
|
57
|
+
...report.at ? { source: report.at } : {},
|
|
58
|
+
// The router's own contexts are the framework's, and belong in its card rather
|
|
59
|
+
// than beside the ones the application wrote.
|
|
60
|
+
authored: report.at?.external !== true,
|
|
61
|
+
// Under whoever provided it. A context read with no provider above it belongs to
|
|
62
|
+
// the reader, which is the honest place for a default value.
|
|
63
|
+
createdIn: report.owner,
|
|
64
|
+
// Short on the card, whole in the inspector, the way every other node works.
|
|
65
|
+
...report.value !== void 0 ? { value: shorten(report.value), detail: report.value } : {}
|
|
66
|
+
});
|
|
67
|
+
nodes.set(report.id, node);
|
|
68
|
+
}
|
|
69
|
+
if (report.kind === "provide") ctx.retype(report.owner, "provider");
|
|
70
|
+
const held = ctx.annotation(report.owner) ?? [];
|
|
71
|
+
const already = held.some((n) => n.name === report.name && n.kind === report.kind);
|
|
72
|
+
if (already) return;
|
|
73
|
+
held.push({
|
|
74
|
+
name: report.name,
|
|
75
|
+
kind: report.kind,
|
|
76
|
+
...report.value !== void 0 ? { value: report.value } : {}
|
|
77
|
+
});
|
|
78
|
+
ctx.annotate(report.owner, held);
|
|
79
|
+
});
|
|
80
|
+
},
|
|
81
|
+
rows(node) {
|
|
82
|
+
const notes = node.extra?.[NAME];
|
|
83
|
+
if (!notes?.length) return [];
|
|
84
|
+
return notes.map((note) => ({
|
|
85
|
+
label: note.kind === "provide" ? `provides ${note.name}` : `reads ${note.name}`,
|
|
86
|
+
...note.value !== void 0 ? { value: note.value } : {}
|
|
87
|
+
}));
|
|
88
|
+
},
|
|
89
|
+
badge(node) {
|
|
90
|
+
const notes = node.extra?.[NAME];
|
|
91
|
+
if (!notes?.length) return void 0;
|
|
92
|
+
const given = notes.filter((n) => n.kind === "provide");
|
|
93
|
+
if (given.length === 1) return `provides ${given[0].name}`;
|
|
94
|
+
if (given.length > 1) return `provides ${given.length}`;
|
|
95
|
+
return notes.length === 1 ? `reads ${notes[0].name}` : `reads ${notes.length}`;
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
registerDevtoolsPlugin(contextPlugin);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type DevtoolsPlugin } from '../plugin.js';
|
|
2
|
+
export declare const NAME = "context";
|
|
3
|
+
/** What lands on a component under this plugin's name. */
|
|
4
|
+
export interface ContextNote {
|
|
5
|
+
name: string;
|
|
6
|
+
kind: 'provide' | 'read';
|
|
7
|
+
value?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const contextPlugin: DevtoolsPlugin;
|
|
10
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/plugins/context.ts"],"names":[],"mappings":"AAKA,OAAO,EAA0B,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAI3E,eAAO,MAAM,IAAI,YAAY,CAAC;AAE9B,0DAA0D;AAC1D,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,SAAS,GAAG,MAAM,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,aAAa,EAAE,cAuE3B,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// Which components provide a context, and which read it.
|
|
2
|
+
//
|
|
3
|
+
// The graph cannot show this on its own. A provider stamps a value on the owner chain and a
|
|
4
|
+
// reader walks up looking for it, so neither is a dependency and no edge is ever made. The
|
|
5
|
+
// two components end up as unrelated cards even though one feeds the other.
|
|
6
|
+
import { registerDevtoolsPlugin } from '../plugin.js';
|
|
7
|
+
import { shorten } from '../format.js';
|
|
8
|
+
export const NAME = 'context';
|
|
9
|
+
export const contextPlugin = {
|
|
10
|
+
name: NAME,
|
|
11
|
+
collect(ctx) {
|
|
12
|
+
/** One node per context, however many components touch it. */
|
|
13
|
+
const nodes = new Map();
|
|
14
|
+
ctx.onContext((report) => {
|
|
15
|
+
if (report.owner === undefined)
|
|
16
|
+
return;
|
|
17
|
+
let node = nodes.get(report.id);
|
|
18
|
+
if (node === undefined) {
|
|
19
|
+
// `createContext` names its symbol `context` unless told otherwise, so an unnamed
|
|
20
|
+
// one is said by where it came from rather than drawn seven times identically.
|
|
21
|
+
const label = report.name === 'context' && report.ownerLabel
|
|
22
|
+
? `${report.ownerLabel} context`
|
|
23
|
+
: report.name;
|
|
24
|
+
node = ctx.add({
|
|
25
|
+
label,
|
|
26
|
+
kind: 'context',
|
|
27
|
+
// A context is created at module scope with nothing running, so the only line it
|
|
28
|
+
// can carry is the one that provided or read it.
|
|
29
|
+
...(report.at ? { source: report.at } : {}),
|
|
30
|
+
// The router's own contexts are the framework's, and belong in its card rather
|
|
31
|
+
// than beside the ones the application wrote.
|
|
32
|
+
authored: report.at?.external !== true,
|
|
33
|
+
// Under whoever provided it. A context read with no provider above it belongs to
|
|
34
|
+
// the reader, which is the honest place for a default value.
|
|
35
|
+
createdIn: report.owner,
|
|
36
|
+
// Short on the card, whole in the inspector, the way every other node works.
|
|
37
|
+
...(report.value !== undefined
|
|
38
|
+
? { value: shorten(report.value), detail: report.value }
|
|
39
|
+
: {}),
|
|
40
|
+
});
|
|
41
|
+
nodes.set(report.id, node);
|
|
42
|
+
}
|
|
43
|
+
// A component that provides is a provider. Only this plugin can tell, and a card
|
|
44
|
+
// reading `component` says nothing about why it is there.
|
|
45
|
+
if (report.kind === 'provide')
|
|
46
|
+
ctx.retype(report.owner, 'provider');
|
|
47
|
+
const held = ctx.annotation(report.owner) ?? [];
|
|
48
|
+
const already = held.some((n) => n.name === report.name && n.kind === report.kind);
|
|
49
|
+
if (already)
|
|
50
|
+
return;
|
|
51
|
+
held.push({
|
|
52
|
+
name: report.name,
|
|
53
|
+
kind: report.kind,
|
|
54
|
+
...(report.value !== undefined ? { value: report.value } : {}),
|
|
55
|
+
});
|
|
56
|
+
ctx.annotate(report.owner, held);
|
|
57
|
+
});
|
|
58
|
+
},
|
|
59
|
+
rows(node) {
|
|
60
|
+
const notes = node.extra?.[NAME];
|
|
61
|
+
if (!notes?.length)
|
|
62
|
+
return [];
|
|
63
|
+
return notes.map((note) => ({
|
|
64
|
+
label: note.kind === 'provide' ? `provides ${note.name}` : `reads ${note.name}`,
|
|
65
|
+
...(note.value !== undefined ? { value: note.value } : {}),
|
|
66
|
+
}));
|
|
67
|
+
},
|
|
68
|
+
badge(node) {
|
|
69
|
+
const notes = node.extra?.[NAME];
|
|
70
|
+
if (!notes?.length)
|
|
71
|
+
return undefined;
|
|
72
|
+
const given = notes.filter((n) => n.kind === 'provide');
|
|
73
|
+
if (given.length === 1)
|
|
74
|
+
return `provides ${given[0].name}`;
|
|
75
|
+
if (given.length > 1)
|
|
76
|
+
return `provides ${given.length}`;
|
|
77
|
+
return notes.length === 1 ? `reads ${notes[0].name}` : `reads ${notes.length}`;
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
registerDevtoolsPlugin(contextPlugin);
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// src/plugin.ts
|
|
2
|
+
var plugins = [];
|
|
3
|
+
function registerDevtoolsPlugin(plugin) {
|
|
4
|
+
const at = plugins.findIndex((p) => p.name === plugin.name);
|
|
5
|
+
if (at === -1) plugins.push(plugin);
|
|
6
|
+
else plugins[at] = plugin;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
// src/format.ts
|
|
10
|
+
function shorten(text, limit = 18) {
|
|
11
|
+
return text.length > limit ? `${text.slice(0, limit - 1)}…` : text;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// src/plugins/context.ts
|
|
15
|
+
var NAME = "context";
|
|
16
|
+
var contextPlugin = {
|
|
17
|
+
name: NAME,
|
|
18
|
+
collect(ctx) {
|
|
19
|
+
const nodes = /* @__PURE__ */ new Map();
|
|
20
|
+
ctx.onContext((report) => {
|
|
21
|
+
if (report.owner === void 0) return;
|
|
22
|
+
let node = nodes.get(report.id);
|
|
23
|
+
if (node === void 0) {
|
|
24
|
+
const label = report.name === "context" && report.ownerLabel ? `${report.ownerLabel} context` : report.name;
|
|
25
|
+
node = ctx.add({
|
|
26
|
+
label,
|
|
27
|
+
kind: "context",
|
|
28
|
+
// A context is created at module scope with nothing running, so the only line it
|
|
29
|
+
// can carry is the one that provided or read it.
|
|
30
|
+
...report.at ? { source: report.at } : {},
|
|
31
|
+
// The router's own contexts are the framework's, and belong in its card rather
|
|
32
|
+
// than beside the ones the application wrote.
|
|
33
|
+
authored: report.at?.external !== true,
|
|
34
|
+
// Under whoever provided it. A context read with no provider above it belongs to
|
|
35
|
+
// the reader, which is the honest place for a default value.
|
|
36
|
+
createdIn: report.owner,
|
|
37
|
+
// Short on the card, whole in the inspector, the way every other node works.
|
|
38
|
+
...report.value !== void 0 ? { value: shorten(report.value), detail: report.value } : {}
|
|
39
|
+
});
|
|
40
|
+
nodes.set(report.id, node);
|
|
41
|
+
}
|
|
42
|
+
if (report.kind === "provide") ctx.retype(report.owner, "provider");
|
|
43
|
+
const held = ctx.annotation(report.owner) ?? [];
|
|
44
|
+
const already = held.some((n) => n.name === report.name && n.kind === report.kind);
|
|
45
|
+
if (already) return;
|
|
46
|
+
held.push({
|
|
47
|
+
name: report.name,
|
|
48
|
+
kind: report.kind,
|
|
49
|
+
...report.value !== void 0 ? { value: report.value } : {}
|
|
50
|
+
});
|
|
51
|
+
ctx.annotate(report.owner, held);
|
|
52
|
+
});
|
|
53
|
+
},
|
|
54
|
+
rows(node) {
|
|
55
|
+
const notes = node.extra?.[NAME];
|
|
56
|
+
if (!notes?.length) return [];
|
|
57
|
+
return notes.map((note) => ({
|
|
58
|
+
label: note.kind === "provide" ? `provides ${note.name}` : `reads ${note.name}`,
|
|
59
|
+
...note.value !== void 0 ? { value: note.value } : {}
|
|
60
|
+
}));
|
|
61
|
+
},
|
|
62
|
+
badge(node) {
|
|
63
|
+
const notes = node.extra?.[NAME];
|
|
64
|
+
if (!notes?.length) return void 0;
|
|
65
|
+
const given = notes.filter((n) => n.kind === "provide");
|
|
66
|
+
if (given.length === 1) return `provides ${given[0].name}`;
|
|
67
|
+
if (given.length > 1) return `provides ${given.length}`;
|
|
68
|
+
return notes.length === 1 ? `reads ${notes[0].name}` : `reads ${notes.length}`;
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
registerDevtoolsPlugin(contextPlugin);
|
|
72
|
+
export {
|
|
73
|
+
NAME,
|
|
74
|
+
contextPlugin
|
|
75
|
+
};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/plugins/directives.ts
|
|
21
|
+
var directives_exports = {};
|
|
22
|
+
__export(directives_exports, {
|
|
23
|
+
NAME: () => NAME,
|
|
24
|
+
directiveBadge: () => directiveBadge,
|
|
25
|
+
directiveRows: () => directiveRows,
|
|
26
|
+
directivesOn: () => directivesOn,
|
|
27
|
+
directivesPlugin: () => directivesPlugin
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(directives_exports);
|
|
30
|
+
|
|
31
|
+
// src/plugin.ts
|
|
32
|
+
var plugins = [];
|
|
33
|
+
function registerDevtoolsPlugin(plugin) {
|
|
34
|
+
const at = plugins.findIndex((p) => p.name === plugin.name);
|
|
35
|
+
if (at === -1) plugins.push(plugin);
|
|
36
|
+
else plugins[at] = plugin;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// src/plugins/directives.ts
|
|
40
|
+
var NAME = "directives";
|
|
41
|
+
function directivesOn(extra) {
|
|
42
|
+
return extra?.[NAME] ?? [];
|
|
43
|
+
}
|
|
44
|
+
function directiveBadge(notes) {
|
|
45
|
+
if (!notes.length) return void 0;
|
|
46
|
+
const first = notes[0];
|
|
47
|
+
const short = first.kind === "ref" ? "ref" : label(first);
|
|
48
|
+
return notes.length > 1 ? `${short} +${notes.length - 1}` : short;
|
|
49
|
+
}
|
|
50
|
+
function directiveRows(notes) {
|
|
51
|
+
return notes.map((note) => ({
|
|
52
|
+
label: label(note),
|
|
53
|
+
value: note.element,
|
|
54
|
+
...note.at ? { at: note.at } : {}
|
|
55
|
+
}));
|
|
56
|
+
}
|
|
57
|
+
var label = (note) => note.kind === "ref" ? `ref ${note.name}` : `${note.kind}:${note.name}`;
|
|
58
|
+
var directivesPlugin = {
|
|
59
|
+
name: NAME,
|
|
60
|
+
collect(ctx) {
|
|
61
|
+
ctx.onDirective((report) => {
|
|
62
|
+
if (!report.target) return;
|
|
63
|
+
const held = ctx.elementAnnotation(report.target) ?? [];
|
|
64
|
+
const already = held.some((n) => n.kind === report.kind && n.name === report.name);
|
|
65
|
+
if (already) return;
|
|
66
|
+
held.push({
|
|
67
|
+
kind: report.kind,
|
|
68
|
+
name: report.name,
|
|
69
|
+
element: report.element,
|
|
70
|
+
...report.at ? { at: report.at } : {}
|
|
71
|
+
});
|
|
72
|
+
ctx.annotateElement(report.target, held);
|
|
73
|
+
});
|
|
74
|
+
},
|
|
75
|
+
rows(node) {
|
|
76
|
+
const notes = node.extra?.[NAME];
|
|
77
|
+
if (!notes?.length) return [];
|
|
78
|
+
return notes.map((note) => ({
|
|
79
|
+
label: label(note),
|
|
80
|
+
value: note.element,
|
|
81
|
+
...note.at ? { at: note.at } : {}
|
|
82
|
+
}));
|
|
83
|
+
},
|
|
84
|
+
elementRows(extra) {
|
|
85
|
+
return directiveRows(directivesOn(extra));
|
|
86
|
+
},
|
|
87
|
+
elementBadge(extra) {
|
|
88
|
+
return directiveBadge(directivesOn(extra));
|
|
89
|
+
},
|
|
90
|
+
badge(node) {
|
|
91
|
+
const notes = node.extra?.[NAME];
|
|
92
|
+
if (!notes?.length) return void 0;
|
|
93
|
+
const first = notes[0];
|
|
94
|
+
const short = first.kind === "ref" ? "ref" : label(first);
|
|
95
|
+
return notes.length > 1 ? `${short} +${notes.length - 1}` : short;
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
registerDevtoolsPlugin(directivesPlugin);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type DevtoolsPlugin } from '../plugin.js';
|
|
2
|
+
export declare const NAME = "directives";
|
|
3
|
+
/** The notes on an element of a description, for a panel drawing element rows. */
|
|
4
|
+
export declare function directivesOn(extra?: Record<string, unknown>): DirectiveNote[];
|
|
5
|
+
/** A short word for a badge. The whole expression an inline ref was written as is not one. */
|
|
6
|
+
export declare function directiveBadge(notes: DirectiveNote[]): string | undefined;
|
|
7
|
+
/** A row per directive, for the inspector. */
|
|
8
|
+
export declare function directiveRows(notes: DirectiveNote[]): {
|
|
9
|
+
label: string;
|
|
10
|
+
value?: string;
|
|
11
|
+
at?: DirectiveNote['at'];
|
|
12
|
+
}[];
|
|
13
|
+
/** What lands on a node under this plugin's name. */
|
|
14
|
+
export interface DirectiveNote {
|
|
15
|
+
kind: string;
|
|
16
|
+
name: string;
|
|
17
|
+
element: string;
|
|
18
|
+
at?: {
|
|
19
|
+
file?: string;
|
|
20
|
+
line?: number;
|
|
21
|
+
column?: number;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export declare const directivesPlugin: DevtoolsPlugin;
|
|
25
|
+
//# sourceMappingURL=directives.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"directives.d.ts","sourceRoot":"","sources":["../../src/plugins/directives.ts"],"names":[],"mappings":"AAKA,OAAO,EAA0B,KAAK,cAAc,EAAwB,MAAM,cAAc,CAAC;AAGjG,eAAO,MAAM,IAAI,eAAe,CAAC;AAEjC,kFAAkF;AAClF,wBAAgB,YAAY,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,aAAa,EAAE,CAE7E;AAED,8FAA8F;AAC9F,wBAAgB,cAAc,CAAC,KAAK,EAAE,aAAa,EAAE,GAAG,MAAM,GAAG,SAAS,CAKzE;AAED,8CAA8C;AAC9C,wBAAgB,aAAa,CAAC,KAAK,EAAE,aAAa,EAAE,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,EAAE,CAAC,EAAE,aAAa,CAAC,IAAI,CAAC,CAAA;CAAE,EAAE,CAMnH;AAED,qDAAqD;AACrD,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,EAAE,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACxD;AAKD,eAAO,MAAM,gBAAgB,EAAE,cAiD9B,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// What directives an element was given.
|
|
2
|
+
//
|
|
3
|
+
// The graph already shows that something writes a class or a style, because the dom reports
|
|
4
|
+
// the binding. It does not show which directive asked for it, and `use:` is invisible
|
|
5
|
+
// entirely since a custom directive is a function call with no reactive node behind it.
|
|
6
|
+
import { registerDevtoolsPlugin } from '../plugin.js';
|
|
7
|
+
export const NAME = 'directives';
|
|
8
|
+
/** The notes on an element of a description, for a panel drawing element rows. */
|
|
9
|
+
export function directivesOn(extra) {
|
|
10
|
+
return extra?.[NAME] ?? [];
|
|
11
|
+
}
|
|
12
|
+
/** A short word for a badge. The whole expression an inline ref was written as is not one. */
|
|
13
|
+
export function directiveBadge(notes) {
|
|
14
|
+
if (!notes.length)
|
|
15
|
+
return undefined;
|
|
16
|
+
const first = notes[0];
|
|
17
|
+
const short = first.kind === 'ref' ? 'ref' : label(first);
|
|
18
|
+
return notes.length > 1 ? `${short} +${notes.length - 1}` : short;
|
|
19
|
+
}
|
|
20
|
+
/** A row per directive, for the inspector. */
|
|
21
|
+
export function directiveRows(notes) {
|
|
22
|
+
return notes.map((note) => ({
|
|
23
|
+
label: label(note),
|
|
24
|
+
value: note.element,
|
|
25
|
+
...(note.at ? { at: note.at } : {}),
|
|
26
|
+
}));
|
|
27
|
+
}
|
|
28
|
+
const label = (note) => note.kind === 'ref' ? `ref ${note.name}` : `${note.kind}:${note.name}`;
|
|
29
|
+
export const directivesPlugin = {
|
|
30
|
+
name: NAME,
|
|
31
|
+
collect(ctx) {
|
|
32
|
+
ctx.onDirective((report) => {
|
|
33
|
+
// On the element, which is what the directive was applied to. The component that ran
|
|
34
|
+
// is only where the call happened.
|
|
35
|
+
if (!report.target)
|
|
36
|
+
return;
|
|
37
|
+
const held = ctx.elementAnnotation(report.target) ?? [];
|
|
38
|
+
// A render effect re-runs, so the same directive arrives more than once.
|
|
39
|
+
const already = held.some((n) => n.kind === report.kind && n.name === report.name);
|
|
40
|
+
if (already)
|
|
41
|
+
return;
|
|
42
|
+
held.push({
|
|
43
|
+
kind: report.kind,
|
|
44
|
+
name: report.name,
|
|
45
|
+
element: report.element,
|
|
46
|
+
...(report.at ? { at: report.at } : {}),
|
|
47
|
+
});
|
|
48
|
+
ctx.annotateElement(report.target, held);
|
|
49
|
+
});
|
|
50
|
+
},
|
|
51
|
+
rows(node) {
|
|
52
|
+
const notes = node.extra?.[NAME];
|
|
53
|
+
if (!notes?.length)
|
|
54
|
+
return [];
|
|
55
|
+
return notes.map((note) => ({
|
|
56
|
+
label: label(note),
|
|
57
|
+
value: note.element,
|
|
58
|
+
...(note.at ? { at: note.at } : {}),
|
|
59
|
+
}));
|
|
60
|
+
},
|
|
61
|
+
elementRows(extra) {
|
|
62
|
+
return directiveRows(directivesOn(extra));
|
|
63
|
+
},
|
|
64
|
+
elementBadge(extra) {
|
|
65
|
+
return directiveBadge(directivesOn(extra));
|
|
66
|
+
},
|
|
67
|
+
badge(node) {
|
|
68
|
+
const notes = node.extra?.[NAME];
|
|
69
|
+
if (!notes?.length)
|
|
70
|
+
return undefined;
|
|
71
|
+
// A badge sits beside a label, so it says which directive and not the whole expression
|
|
72
|
+
// an inline ref was written as.
|
|
73
|
+
const first = notes[0];
|
|
74
|
+
const short = first.kind === 'ref' ? 'ref' : label(first);
|
|
75
|
+
return notes.length > 1 ? `${short} +${notes.length - 1}` : short;
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
registerDevtoolsPlugin(directivesPlugin);
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// src/plugin.ts
|
|
2
|
+
var plugins = [];
|
|
3
|
+
function registerDevtoolsPlugin(plugin) {
|
|
4
|
+
const at = plugins.findIndex((p) => p.name === plugin.name);
|
|
5
|
+
if (at === -1) plugins.push(plugin);
|
|
6
|
+
else plugins[at] = plugin;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
// src/plugins/directives.ts
|
|
10
|
+
var NAME = "directives";
|
|
11
|
+
function directivesOn(extra) {
|
|
12
|
+
return extra?.[NAME] ?? [];
|
|
13
|
+
}
|
|
14
|
+
function directiveBadge(notes) {
|
|
15
|
+
if (!notes.length) return void 0;
|
|
16
|
+
const first = notes[0];
|
|
17
|
+
const short = first.kind === "ref" ? "ref" : label(first);
|
|
18
|
+
return notes.length > 1 ? `${short} +${notes.length - 1}` : short;
|
|
19
|
+
}
|
|
20
|
+
function directiveRows(notes) {
|
|
21
|
+
return notes.map((note) => ({
|
|
22
|
+
label: label(note),
|
|
23
|
+
value: note.element,
|
|
24
|
+
...note.at ? { at: note.at } : {}
|
|
25
|
+
}));
|
|
26
|
+
}
|
|
27
|
+
var label = (note) => note.kind === "ref" ? `ref ${note.name}` : `${note.kind}:${note.name}`;
|
|
28
|
+
var directivesPlugin = {
|
|
29
|
+
name: NAME,
|
|
30
|
+
collect(ctx) {
|
|
31
|
+
ctx.onDirective((report) => {
|
|
32
|
+
if (!report.target) return;
|
|
33
|
+
const held = ctx.elementAnnotation(report.target) ?? [];
|
|
34
|
+
const already = held.some((n) => n.kind === report.kind && n.name === report.name);
|
|
35
|
+
if (already) return;
|
|
36
|
+
held.push({
|
|
37
|
+
kind: report.kind,
|
|
38
|
+
name: report.name,
|
|
39
|
+
element: report.element,
|
|
40
|
+
...report.at ? { at: report.at } : {}
|
|
41
|
+
});
|
|
42
|
+
ctx.annotateElement(report.target, held);
|
|
43
|
+
});
|
|
44
|
+
},
|
|
45
|
+
rows(node) {
|
|
46
|
+
const notes = node.extra?.[NAME];
|
|
47
|
+
if (!notes?.length) return [];
|
|
48
|
+
return notes.map((note) => ({
|
|
49
|
+
label: label(note),
|
|
50
|
+
value: note.element,
|
|
51
|
+
...note.at ? { at: note.at } : {}
|
|
52
|
+
}));
|
|
53
|
+
},
|
|
54
|
+
elementRows(extra) {
|
|
55
|
+
return directiveRows(directivesOn(extra));
|
|
56
|
+
},
|
|
57
|
+
elementBadge(extra) {
|
|
58
|
+
return directiveBadge(directivesOn(extra));
|
|
59
|
+
},
|
|
60
|
+
badge(node) {
|
|
61
|
+
const notes = node.extra?.[NAME];
|
|
62
|
+
if (!notes?.length) return void 0;
|
|
63
|
+
const first = notes[0];
|
|
64
|
+
const short = first.kind === "ref" ? "ref" : label(first);
|
|
65
|
+
return notes.length > 1 ? `${short} +${notes.length - 1}` : short;
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
registerDevtoolsPlugin(directivesPlugin);
|
|
69
|
+
export {
|
|
70
|
+
NAME,
|
|
71
|
+
directiveBadge,
|
|
72
|
+
directiveRows,
|
|
73
|
+
directivesOn,
|
|
74
|
+
directivesPlugin
|
|
75
|
+
};
|