@fluixi/devtools 0.2.0-alpha.3 → 0.2.0-alpha.5
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 +72 -0
- package/dist/callsite.d.ts +1 -1
- package/dist/callsite.js +1 -1
- package/dist/callsite.mjs +51 -0
- package/dist/change-view.cjs +134 -0
- package/dist/change-view.js +2 -2
- package/dist/change-view.mjs +111 -0
- package/dist/copy.cjs +63 -0
- package/dist/copy.mjs +42 -0
- package/dist/describe.cjs +55 -0
- package/dist/describe.js +2 -2
- package/dist/describe.mjs +34 -0
- package/dist/detail-panel.cjs +307 -0
- package/dist/detail-panel.d.ts +1 -1
- package/dist/detail-panel.d.ts.map +1 -1
- package/dist/detail-panel.js +1 -1
- package/dist/detail-panel.mjs +284 -0
- package/dist/diff.cjs +225 -0
- package/dist/diff.js +1 -1
- package/dist/diff.mjs +202 -0
- package/dist/dom.cjs +204 -0
- package/dist/dom.mjs +183 -0
- package/dist/export.cjs +221 -0
- package/dist/export.d.ts +2 -2
- package/dist/export.d.ts.map +1 -1
- package/dist/export.js +1 -1
- package/dist/export.mjs +209 -0
- package/dist/float.cjs +232 -0
- package/dist/float.d.ts +1 -1
- package/dist/float.js +3 -3
- package/dist/float.mjs +211 -0
- package/dist/format.cjs +175 -0
- package/dist/format.js +3 -3
- package/dist/format.mjs +154 -0
- package/dist/graph-view.cjs +893 -0
- package/dist/graph-view.mjs +870 -0
- package/dist/highlight.cjs +140 -0
- package/dist/highlight.mjs +119 -0
- package/dist/history.cjs +95 -0
- package/dist/history.d.ts +2 -2
- package/dist/history.js +2 -2
- package/dist/history.mjs +74 -0
- package/dist/hook.cjs +1562 -0
- package/dist/hook.d.ts +3 -3
- package/dist/hook.js +6 -6
- package/dist/hook.mjs +1553 -0
- package/dist/index.cjs +4552 -0
- package/dist/index.mjs +4544 -0
- package/dist/inspector.cjs +688 -0
- package/dist/inspector.d.ts +2 -2
- package/dist/inspector.js +7 -7
- package/dist/inspector.mjs +676 -0
- package/dist/instrument.cjs +497 -0
- package/dist/instrument.mjs +487 -0
- package/dist/kind-filter.cjs +172 -0
- package/dist/kind-filter.d.ts +2 -2
- package/dist/kind-filter.js +1 -1
- package/dist/kind-filter.mjs +151 -0
- package/dist/menu.cjs +141 -0
- package/dist/menu.mjs +120 -0
- package/dist/observe.cjs +1352 -0
- package/dist/observe.mjs +1345 -0
- package/dist/palette.cjs +52 -0
- package/dist/palette.mjs +31 -0
- package/dist/path.cjs +45 -0
- package/dist/path.d.ts +2 -2
- package/dist/path.js +2 -2
- package/dist/path.mjs +24 -0
- package/dist/plugin.cjs +87 -0
- package/dist/plugin.mjs +66 -0
- package/dist/plugins/context.cjs +98 -0
- package/dist/plugins/context.mjs +75 -0
- package/dist/plugins/directives.cjs +98 -0
- package/dist/plugins/directives.mjs +75 -0
- package/dist/plugins/index.cjs +162 -0
- package/dist/plugins/index.mjs +140 -0
- package/dist/source.cjs +111 -0
- package/dist/source.d.ts +2 -2
- package/dist/source.js +4 -4
- package/dist/source.mjs +90 -0
- package/dist/timeline.cjs +350 -0
- package/dist/timeline.js +3 -3
- package/dist/timeline.mjs +327 -0
- package/dist/tree.cjs +574 -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.mjs +200 -0
- package/dist/wire.cjs +109 -0
- package/dist/wire.mjs +89 -0
- package/package.json +19 -6
package/dist/palette.cjs
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
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/palette.ts
|
|
21
|
+
var palette_exports = {};
|
|
22
|
+
__export(palette_exports, {
|
|
23
|
+
KIND_COLOR: () => KIND_COLOR,
|
|
24
|
+
kindColor: () => kindColor,
|
|
25
|
+
kindRules: () => kindRules,
|
|
26
|
+
kindVar: () => kindVar
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(palette_exports);
|
|
29
|
+
var KIND_COLOR = {
|
|
30
|
+
state: "#34d399",
|
|
31
|
+
memo: "#a78bfa",
|
|
32
|
+
effect: "#fbbf24",
|
|
33
|
+
store: "#38bdf8",
|
|
34
|
+
resource: "#fb7185",
|
|
35
|
+
component: "#f0abfc",
|
|
36
|
+
provider: "#fb923c",
|
|
37
|
+
control: "#22d3ee",
|
|
38
|
+
router: "#818cf8",
|
|
39
|
+
handler: "#f472b6",
|
|
40
|
+
context: "#a3e635",
|
|
41
|
+
directive: "#5eead4",
|
|
42
|
+
binding: "#5eead4",
|
|
43
|
+
setter: "#fb7185",
|
|
44
|
+
group: "#8a90a2",
|
|
45
|
+
element: "#8a90a2"
|
|
46
|
+
};
|
|
47
|
+
var kindVar = (kind) => `--fx-kind-${kind}`;
|
|
48
|
+
var kindColor = (kind) => `var(${kindVar(kind)}, ${KIND_COLOR[kind]})`;
|
|
49
|
+
var KINDS = Object.keys(KIND_COLOR);
|
|
50
|
+
function kindRules(selector, property) {
|
|
51
|
+
return KINDS.map((kind) => `${selector(kind)} { ${property}: ${kindColor(kind)}; }`).join("\n");
|
|
52
|
+
}
|
package/dist/palette.mjs
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
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
|
+
};
|
|
20
|
+
var kindVar = (kind) => `--fx-kind-${kind}`;
|
|
21
|
+
var kindColor = (kind) => `var(${kindVar(kind)}, ${KIND_COLOR[kind]})`;
|
|
22
|
+
var KINDS = Object.keys(KIND_COLOR);
|
|
23
|
+
function kindRules(selector, property) {
|
|
24
|
+
return KINDS.map((kind) => `${selector(kind)} { ${property}: ${kindColor(kind)}; }`).join("\n");
|
|
25
|
+
}
|
|
26
|
+
export {
|
|
27
|
+
KIND_COLOR,
|
|
28
|
+
kindColor,
|
|
29
|
+
kindRules,
|
|
30
|
+
kindVar
|
|
31
|
+
};
|
package/dist/path.cjs
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
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/path.ts
|
|
21
|
+
var path_exports = {};
|
|
22
|
+
__export(path_exports, {
|
|
23
|
+
shortenPath: () => shortenPath
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(path_exports);
|
|
26
|
+
var normalize = (file) => file.replace(/\\/g, "/");
|
|
27
|
+
var ROOTED = /^\/|^(Users|home|var|opt|private|tmp|mnt|srv)\//;
|
|
28
|
+
var WORKSPACE_DIRS = /* @__PURE__ */ new Set(["packages", "apps", "libs", "examples"]);
|
|
29
|
+
function shortenPath(file, root) {
|
|
30
|
+
const path = normalize(file);
|
|
31
|
+
if (root) {
|
|
32
|
+
const base = normalize(root).replace(/\/+$/, "");
|
|
33
|
+
if (base && path.startsWith(`${base}/`)) return path.slice(base.length + 1);
|
|
34
|
+
if (base.startsWith("/") && path.startsWith(`${base.slice(1)}/`)) return path.slice(base.length);
|
|
35
|
+
}
|
|
36
|
+
const installed = path.lastIndexOf("node_modules/");
|
|
37
|
+
if (installed >= 0) return path.slice(installed + "node_modules/".length);
|
|
38
|
+
if (ROOTED.test(path)) {
|
|
39
|
+
const segments = path.split("/");
|
|
40
|
+
for (let i = segments.length - 2; i > 0; i--) {
|
|
41
|
+
if (WORKSPACE_DIRS.has(segments[i])) return segments.slice(i).join("/");
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return path;
|
|
45
|
+
}
|
package/dist/path.d.ts
CHANGED
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
* ran it: `/Users/someone/work/app/packages/dom/src/lib/dom/runtime.ts`. All of it before
|
|
6
6
|
* the package name says nothing about the project, and it is most of the line.
|
|
7
7
|
*
|
|
8
|
-
* The full path is kept for opening the file
|
|
8
|
+
* The full path is kept for opening the file: only what is displayed is shortened.
|
|
9
9
|
*/
|
|
10
10
|
/**
|
|
11
11
|
* The part of `file` worth showing.
|
|
12
12
|
*
|
|
13
13
|
* Tried in order: below the project root when the host knows it, then the package a
|
|
14
14
|
* node_modules path names, then the workspace package a monorepo path names. A path that
|
|
15
|
-
* matches none of those is left as it is
|
|
15
|
+
* matches none of those is left as it is: guessing at a shorter form would hide which file
|
|
16
16
|
* it is, and the point of the line is to say that.
|
|
17
17
|
*/
|
|
18
18
|
export declare function shortenPath(file: string, root?: string): string;
|
package/dist/path.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* ran it: `/Users/someone/work/app/packages/dom/src/lib/dom/runtime.ts`. All of it before
|
|
6
6
|
* the package name says nothing about the project, and it is most of the line.
|
|
7
7
|
*
|
|
8
|
-
* The full path is kept for opening the file
|
|
8
|
+
* The full path is kept for opening the file: only what is displayed is shortened.
|
|
9
9
|
*/
|
|
10
10
|
/** Windows separators, and the leading slash an origin-stripped path can lose. */
|
|
11
11
|
const normalize = (file) => file.replace(/\\/g, '/');
|
|
@@ -18,7 +18,7 @@ const WORKSPACE_DIRS = new Set(['packages', 'apps', 'libs', 'examples']);
|
|
|
18
18
|
*
|
|
19
19
|
* Tried in order: below the project root when the host knows it, then the package a
|
|
20
20
|
* node_modules path names, then the workspace package a monorepo path names. A path that
|
|
21
|
-
* matches none of those is left as it is
|
|
21
|
+
* matches none of those is left as it is: guessing at a shorter form would hide which file
|
|
22
22
|
* it is, and the point of the line is to say that.
|
|
23
23
|
*/
|
|
24
24
|
export function shortenPath(file, root) {
|
package/dist/path.mjs
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// src/path.ts
|
|
2
|
+
var normalize = (file) => file.replace(/\\/g, "/");
|
|
3
|
+
var ROOTED = /^\/|^(Users|home|var|opt|private|tmp|mnt|srv)\//;
|
|
4
|
+
var WORKSPACE_DIRS = /* @__PURE__ */ new Set(["packages", "apps", "libs", "examples"]);
|
|
5
|
+
function shortenPath(file, root) {
|
|
6
|
+
const path = normalize(file);
|
|
7
|
+
if (root) {
|
|
8
|
+
const base = normalize(root).replace(/\/+$/, "");
|
|
9
|
+
if (base && path.startsWith(`${base}/`)) return path.slice(base.length + 1);
|
|
10
|
+
if (base.startsWith("/") && path.startsWith(`${base.slice(1)}/`)) return path.slice(base.length);
|
|
11
|
+
}
|
|
12
|
+
const installed = path.lastIndexOf("node_modules/");
|
|
13
|
+
if (installed >= 0) return path.slice(installed + "node_modules/".length);
|
|
14
|
+
if (ROOTED.test(path)) {
|
|
15
|
+
const segments = path.split("/");
|
|
16
|
+
for (let i = segments.length - 2; i > 0; i--) {
|
|
17
|
+
if (WORKSPACE_DIRS.has(segments[i])) return segments.slice(i).join("/");
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return path;
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
shortenPath
|
|
24
|
+
};
|
package/dist/plugin.cjs
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
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/plugin.ts
|
|
21
|
+
var plugin_exports = {};
|
|
22
|
+
__export(plugin_exports, {
|
|
23
|
+
annotationOf: () => annotationOf,
|
|
24
|
+
devtoolsPlugins: () => devtoolsPlugins,
|
|
25
|
+
pluginBadge: () => pluginBadge,
|
|
26
|
+
pluginElementBadge: () => pluginElementBadge,
|
|
27
|
+
pluginElementRows: () => pluginElementRows,
|
|
28
|
+
pluginRows: () => pluginRows,
|
|
29
|
+
registerDevtoolsPlugin: () => registerDevtoolsPlugin
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(plugin_exports);
|
|
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
|
+
function devtoolsPlugins() {
|
|
39
|
+
return plugins;
|
|
40
|
+
}
|
|
41
|
+
function annotationOf(node, name) {
|
|
42
|
+
return node.extra?.[name];
|
|
43
|
+
}
|
|
44
|
+
function pluginRows(node, graph) {
|
|
45
|
+
const out = [];
|
|
46
|
+
for (const plugin of plugins) {
|
|
47
|
+
if (!plugin.rows) continue;
|
|
48
|
+
try {
|
|
49
|
+
out.push(...plugin.rows(node, graph));
|
|
50
|
+
} catch {
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return out;
|
|
54
|
+
}
|
|
55
|
+
function pluginElementRows(extra) {
|
|
56
|
+
if (!extra) return [];
|
|
57
|
+
const out = [];
|
|
58
|
+
for (const plugin of plugins) {
|
|
59
|
+
if (!plugin.elementRows) continue;
|
|
60
|
+
try {
|
|
61
|
+
out.push(...plugin.elementRows(extra));
|
|
62
|
+
} catch {
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return out;
|
|
66
|
+
}
|
|
67
|
+
function pluginElementBadge(extra) {
|
|
68
|
+
if (!extra) return void 0;
|
|
69
|
+
for (const plugin of plugins) {
|
|
70
|
+
try {
|
|
71
|
+
const badge = plugin.elementBadge?.(extra);
|
|
72
|
+
if (badge) return badge;
|
|
73
|
+
} catch {
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return void 0;
|
|
77
|
+
}
|
|
78
|
+
function pluginBadge(node) {
|
|
79
|
+
for (const plugin of plugins) {
|
|
80
|
+
try {
|
|
81
|
+
const badge = plugin.badge?.(node);
|
|
82
|
+
if (badge) return badge;
|
|
83
|
+
} catch {
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return void 0;
|
|
87
|
+
}
|
package/dist/plugin.mjs
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
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
|
+
function devtoolsPlugins() {
|
|
9
|
+
return plugins;
|
|
10
|
+
}
|
|
11
|
+
function annotationOf(node, name) {
|
|
12
|
+
return node.extra?.[name];
|
|
13
|
+
}
|
|
14
|
+
function pluginRows(node, graph) {
|
|
15
|
+
const out = [];
|
|
16
|
+
for (const plugin of plugins) {
|
|
17
|
+
if (!plugin.rows) continue;
|
|
18
|
+
try {
|
|
19
|
+
out.push(...plugin.rows(node, graph));
|
|
20
|
+
} catch {
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return out;
|
|
24
|
+
}
|
|
25
|
+
function pluginElementRows(extra) {
|
|
26
|
+
if (!extra) return [];
|
|
27
|
+
const out = [];
|
|
28
|
+
for (const plugin of plugins) {
|
|
29
|
+
if (!plugin.elementRows) continue;
|
|
30
|
+
try {
|
|
31
|
+
out.push(...plugin.elementRows(extra));
|
|
32
|
+
} catch {
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return out;
|
|
36
|
+
}
|
|
37
|
+
function pluginElementBadge(extra) {
|
|
38
|
+
if (!extra) return void 0;
|
|
39
|
+
for (const plugin of plugins) {
|
|
40
|
+
try {
|
|
41
|
+
const badge = plugin.elementBadge?.(extra);
|
|
42
|
+
if (badge) return badge;
|
|
43
|
+
} catch {
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return void 0;
|
|
47
|
+
}
|
|
48
|
+
function pluginBadge(node) {
|
|
49
|
+
for (const plugin of plugins) {
|
|
50
|
+
try {
|
|
51
|
+
const badge = plugin.badge?.(node);
|
|
52
|
+
if (badge) return badge;
|
|
53
|
+
} catch {
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return void 0;
|
|
57
|
+
}
|
|
58
|
+
export {
|
|
59
|
+
annotationOf,
|
|
60
|
+
devtoolsPlugins,
|
|
61
|
+
pluginBadge,
|
|
62
|
+
pluginElementBadge,
|
|
63
|
+
pluginElementRows,
|
|
64
|
+
pluginRows,
|
|
65
|
+
registerDevtoolsPlugin
|
|
66
|
+
};
|
|
@@ -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,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,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
|
+
};
|