streetui 2.1.0 → 2.2.0
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 +23 -17
- package/dist/bin.cjs +1 -1
- package/dist/bin.cjs.map +1 -1
- package/dist/bin.js +1 -1
- package/dist/bin.js.map +1 -1
- package/dist/create-bin.cjs +1 -1
- package/dist/create-bin.cjs.map +1 -1
- package/dist/create-bin.js +1 -1
- package/dist/create-bin.js.map +1 -1
- package/dist/{hydration-diagnostics-Jm3qUydo.d.cts → hydration-diagnostics-CEhFie5X.d.cts} +1 -1
- package/dist/{hydration-diagnostics-Jm3qUydo.d.ts → hydration-diagnostics-CEhFie5X.d.ts} +1 -1
- package/dist/index.cjs +349 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +252 -6
- package/dist/index.d.ts +252 -6
- package/dist/index.js +343 -1
- package/dist/index.js.map +1 -1
- package/dist/{renderer-interface-CPrfslvr.d.ts → renderer-interface-CYJIOjj5.d.ts} +1 -1
- package/dist/{renderer-interface-moxwy5PA.d.cts → renderer-interface-DhgAgwa9.d.cts} +1 -1
- package/dist/{server-_kf9p9SV.d.cts → server-Lwm5W3o9.d.cts} +1 -1
- package/dist/{server-DG0tvuRt.d.ts → server-wz5X8SA9.d.ts} +1 -1
- package/dist/server.cjs +1 -1
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +2 -2
- package/dist/server.d.ts +2 -2
- package/dist/server.js +1 -1
- package/dist/server.js.map +1 -1
- package/dist/testing.cjs +1 -1
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.d.cts +3 -3
- package/dist/testing.d.ts +3 -3
- package/dist/testing.js +1 -1
- package/dist/testing.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/version.ts
|
|
2
|
-
var VERSION = "2.
|
|
2
|
+
var VERSION = "2.2.0";
|
|
3
3
|
|
|
4
4
|
// ../state/src/signal.ts
|
|
5
5
|
var _activeConsumer = null;
|
|
@@ -5643,6 +5643,23 @@ function errorMessageOf(error) {
|
|
|
5643
5643
|
if (error instanceof Error) return error.message;
|
|
5644
5644
|
return String(error);
|
|
5645
5645
|
}
|
|
5646
|
+
function inspectMutation(mutation2, options = {}) {
|
|
5647
|
+
const error = mutation2.error.peek();
|
|
5648
|
+
const hasError = error !== void 0 && error !== null;
|
|
5649
|
+
const base = {
|
|
5650
|
+
status: mutation2.status.peek(),
|
|
5651
|
+
pending: mutation2.pending.peek(),
|
|
5652
|
+
hasData: mutation2.data.peek() !== void 0,
|
|
5653
|
+
hasError,
|
|
5654
|
+
errorName: hasError ? errorConstructorName(error) : void 0
|
|
5655
|
+
};
|
|
5656
|
+
if (options.includeData !== true) return base;
|
|
5657
|
+
return {
|
|
5658
|
+
...base,
|
|
5659
|
+
data: mutation2.data.peek(),
|
|
5660
|
+
...hasError ? { errorMessage: errorMessageOf(error) } : {}
|
|
5661
|
+
};
|
|
5662
|
+
}
|
|
5646
5663
|
function inspectRouter(router) {
|
|
5647
5664
|
const match = router.currentRoute.peek();
|
|
5648
5665
|
const query = {};
|
|
@@ -5690,6 +5707,97 @@ function inspectI18n(i18n, options = {}) {
|
|
|
5690
5707
|
return { ...base, missingKeys };
|
|
5691
5708
|
}
|
|
5692
5709
|
|
|
5710
|
+
// ../devtools/src/inspect-detail.ts
|
|
5711
|
+
function inspectEvents(graph) {
|
|
5712
|
+
const nodes = [];
|
|
5713
|
+
const byType = {};
|
|
5714
|
+
let totalHandlers = 0;
|
|
5715
|
+
graph.walk((node, depth) => {
|
|
5716
|
+
if (node.events.length === 0) return;
|
|
5717
|
+
const types = node.events.map((e) => e.type);
|
|
5718
|
+
for (const t of types) {
|
|
5719
|
+
byType[t] = (byType[t] ?? 0) + 1;
|
|
5720
|
+
totalHandlers += 1;
|
|
5721
|
+
}
|
|
5722
|
+
nodes.push({
|
|
5723
|
+
id: node.id,
|
|
5724
|
+
nodeType: node.type,
|
|
5725
|
+
key: node.key,
|
|
5726
|
+
depth,
|
|
5727
|
+
eventTypes: [...types].sort()
|
|
5728
|
+
});
|
|
5729
|
+
});
|
|
5730
|
+
return { nodes, totalHandlers, byType };
|
|
5731
|
+
}
|
|
5732
|
+
function inspectSignalGraph(compiled, options = {}) {
|
|
5733
|
+
const graph = compiled.graph;
|
|
5734
|
+
const edges = [];
|
|
5735
|
+
const byId = /* @__PURE__ */ new Map();
|
|
5736
|
+
graph.walk((node) => {
|
|
5737
|
+
for (const ref of node.stateRefs) {
|
|
5738
|
+
edges.push({
|
|
5739
|
+
signalId: ref.signalId,
|
|
5740
|
+
nodeId: node.id,
|
|
5741
|
+
nodeType: node.type,
|
|
5742
|
+
propKey: ref.propKey
|
|
5743
|
+
});
|
|
5744
|
+
let entry = byId.get(ref.signalId);
|
|
5745
|
+
if (entry === void 0) {
|
|
5746
|
+
entry = { boundNodeIds: /* @__PURE__ */ new Set(), bindingCount: 0 };
|
|
5747
|
+
byId.set(ref.signalId, entry);
|
|
5748
|
+
}
|
|
5749
|
+
entry.boundNodeIds.add(node.id);
|
|
5750
|
+
entry.bindingCount += 1;
|
|
5751
|
+
}
|
|
5752
|
+
});
|
|
5753
|
+
const live = options.signalsById;
|
|
5754
|
+
const signals = [...byId.entries()].sort((a, b) => a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0).map(([signalId, entry]) => {
|
|
5755
|
+
const base = {
|
|
5756
|
+
signalId,
|
|
5757
|
+
boundNodeIds: [...entry.boundNodeIds],
|
|
5758
|
+
bindingCount: entry.bindingCount
|
|
5759
|
+
};
|
|
5760
|
+
const sig = live?.[signalId];
|
|
5761
|
+
if (sig === void 0) return base;
|
|
5762
|
+
const oc = observerCount(sig);
|
|
5763
|
+
return {
|
|
5764
|
+
...base,
|
|
5765
|
+
kind: signalKind(sig),
|
|
5766
|
+
...oc !== void 0 ? { observerCount: oc } : {}
|
|
5767
|
+
};
|
|
5768
|
+
});
|
|
5769
|
+
return { signals, edges };
|
|
5770
|
+
}
|
|
5771
|
+
|
|
5772
|
+
// ../devtools/src/inspect-ssr.ts
|
|
5773
|
+
function countType(graph, type) {
|
|
5774
|
+
let n = 0;
|
|
5775
|
+
graph.walk((node) => {
|
|
5776
|
+
if (node.type === type) n += 1;
|
|
5777
|
+
});
|
|
5778
|
+
return n;
|
|
5779
|
+
}
|
|
5780
|
+
function inspectHydration(compiled) {
|
|
5781
|
+
const graph = compiled.graph;
|
|
5782
|
+
const { summary } = analyzeGraph(graph);
|
|
5783
|
+
const dynamicNodes = summary.totalNodes - summary.staticNodes;
|
|
5784
|
+
const staticRatio = summary.totalNodes === 0 ? 0 : Math.round(summary.staticNodes / summary.totalNodes * 1e4) / 1e4;
|
|
5785
|
+
return {
|
|
5786
|
+
totalNodes: summary.totalNodes,
|
|
5787
|
+
staticNodes: summary.staticNodes,
|
|
5788
|
+
staticSubtrees: summary.staticSubtrees,
|
|
5789
|
+
dynamicNodes,
|
|
5790
|
+
dynamicTextNodes: summary.dynamicTextNodes,
|
|
5791
|
+
dynamicAttrNodes: summary.dynamicAttrNodes,
|
|
5792
|
+
eventNodes: summary.eventNodes,
|
|
5793
|
+
lists: summary.lists,
|
|
5794
|
+
conditionals: summary.conditionals,
|
|
5795
|
+
portals: countType(graph, "portal"),
|
|
5796
|
+
headAnchors: countType(graph, "head"),
|
|
5797
|
+
staticRatio
|
|
5798
|
+
};
|
|
5799
|
+
}
|
|
5800
|
+
|
|
5693
5801
|
// ../devtools/src/panels.ts
|
|
5694
5802
|
function createDevTools(compiled, sources = {}, options = {}) {
|
|
5695
5803
|
let current = capture(compiled, sources, options);
|
|
@@ -5743,6 +5851,12 @@ function capture(compiled, sources, options) {
|
|
|
5743
5851
|
warnings: app.diagnostics.warnings,
|
|
5744
5852
|
messages: app.diagnostics.messages
|
|
5745
5853
|
};
|
|
5854
|
+
const events = inspectEvents(compiled.graph);
|
|
5855
|
+
const signalGraph = inspectSignalGraph(
|
|
5856
|
+
compiled,
|
|
5857
|
+
sources.signalsById !== void 0 ? { signalsById: sources.signalsById } : {}
|
|
5858
|
+
);
|
|
5859
|
+
const hydration = inspectHydration(compiled);
|
|
5746
5860
|
const snapshot = {
|
|
5747
5861
|
application,
|
|
5748
5862
|
graph: app.graph,
|
|
@@ -5752,8 +5866,12 @@ function capture(compiled, sources, options) {
|
|
|
5752
5866
|
overlays: interactions.overlays,
|
|
5753
5867
|
transitions: interactions.transitions,
|
|
5754
5868
|
diagnostics,
|
|
5869
|
+
events,
|
|
5870
|
+
signalGraph,
|
|
5871
|
+
hydration,
|
|
5755
5872
|
...sources.router !== void 0 ? { router: inspectRouter(sources.router) } : {},
|
|
5756
5873
|
...sources.resources !== void 0 ? { resources: mapInspect(sources.resources, (r) => inspectResource(r)) } : {},
|
|
5874
|
+
...sources.mutations !== void 0 ? { mutations: mapInspect(sources.mutations, (m) => inspectMutation(m)) } : {},
|
|
5757
5875
|
...sources.forms !== void 0 ? { forms: mapInspect(sources.forms, (f) => inspectForm(f)) } : {},
|
|
5758
5876
|
...sources.contexts !== void 0 ? { contexts: mapInspect(sources.contexts, (c) => inspectContext(c)) } : {},
|
|
5759
5877
|
...sources.i18n !== void 0 ? {
|
|
@@ -5820,6 +5938,12 @@ function formatSnapshot(s) {
|
|
|
5820
5938
|
lines.push(` ${label}: ${r.status}${r.loading ? " (loading)" : ""}${r.hasError ? ` !${r.errorName}` : ""}`);
|
|
5821
5939
|
}
|
|
5822
5940
|
}
|
|
5941
|
+
if (s.mutations !== void 0) {
|
|
5942
|
+
lines.push("Mutations:");
|
|
5943
|
+
for (const [label, m] of Object.entries(s.mutations)) {
|
|
5944
|
+
lines.push(` ${label}: ${m.status}${m.pending ? " (pending)" : ""}${m.hasError ? ` !${m.errorName}` : ""}`);
|
|
5945
|
+
}
|
|
5946
|
+
}
|
|
5823
5947
|
if (s.forms !== void 0) {
|
|
5824
5948
|
lines.push("Forms:");
|
|
5825
5949
|
for (const [label, f] of Object.entries(s.forms)) {
|
|
@@ -5850,6 +5974,17 @@ function formatSnapshot(s) {
|
|
|
5850
5974
|
for (const m of s.diagnostics.messages) {
|
|
5851
5975
|
lines.push(` ${m}`);
|
|
5852
5976
|
}
|
|
5977
|
+
lines.push(
|
|
5978
|
+
`Events: ${s.events.nodes.length} node(s), ${s.events.totalHandlers} handler(s)` + (Object.keys(s.events.byType).length > 0 ? ` \xB7 ${Object.entries(s.events.byType).map(([t, n]) => `${t}\xD7${n}`).join(", ")}` : "")
|
|
5979
|
+
);
|
|
5980
|
+
lines.push(
|
|
5981
|
+
`Signal graph: ${s.signalGraph.signals.length} signal(s), ${s.signalGraph.edges.length} binding edge(s)`
|
|
5982
|
+
);
|
|
5983
|
+
const h = s.hydration;
|
|
5984
|
+
lines.push(
|
|
5985
|
+
`SSR/Hydration: ${h.staticNodes}/${h.totalNodes} static (${(h.staticRatio * 100).toFixed(1)}%), ${h.dynamicNodes} dynamic \xB7 ${h.staticSubtrees} static subtree(s) \xB7 ${h.portals} portal(s), ${h.headAnchors} head anchor(s)`
|
|
5986
|
+
);
|
|
5987
|
+
lines.push(" (structural counts only \u2014 not wall-clock timings; browser gate BLOCKED)");
|
|
5853
5988
|
return lines.join("\n");
|
|
5854
5989
|
}
|
|
5855
5990
|
function format(value) {
|
|
@@ -6035,6 +6170,207 @@ var DEVTOOLS_CSS = [
|
|
|
6035
6170
|
"code{color:#d7d7e0}"
|
|
6036
6171
|
].join("");
|
|
6037
6172
|
|
|
6173
|
+
// ../devtools/src/interactive.ts
|
|
6174
|
+
var DEVTOOLS_TABS = [
|
|
6175
|
+
{ id: "components", label: "Component Tree" },
|
|
6176
|
+
{ id: "inspector", label: "Component Inspector" },
|
|
6177
|
+
{ id: "state", label: "Reactive State" },
|
|
6178
|
+
{ id: "signalGraph", label: "Signal Graph" },
|
|
6179
|
+
{ id: "router", label: "Router" },
|
|
6180
|
+
{ id: "resources", label: "Resource / Async" },
|
|
6181
|
+
{ id: "mutations", label: "Mutations" },
|
|
6182
|
+
{ id: "events", label: "Events" },
|
|
6183
|
+
{ id: "overlays", label: "Overlays" },
|
|
6184
|
+
{ id: "performance", label: "Performance" },
|
|
6185
|
+
{ id: "diagnostics", label: "Error Diagnostics" },
|
|
6186
|
+
{ id: "hydration", label: "SSR / Hydration" }
|
|
6187
|
+
];
|
|
6188
|
+
var EMBED_ESCAPE = new RegExp("[<\\u2028\\u2029]", "g");
|
|
6189
|
+
function embedJson(snapshot) {
|
|
6190
|
+
return JSON.stringify(snapshot).replace(EMBED_ESCAPE, (ch) => {
|
|
6191
|
+
const code = ch.charCodeAt(0).toString(16).padStart(4, "0");
|
|
6192
|
+
return `\\u${code}`;
|
|
6193
|
+
});
|
|
6194
|
+
}
|
|
6195
|
+
function renderInteractiveDevTools(snapshot, options = {}) {
|
|
6196
|
+
const app = snapshot.application;
|
|
6197
|
+
const title = options.title ?? `StreetUI DevTools \u2014 ${app.identity.name}`;
|
|
6198
|
+
const initialTab = options.initialTab ?? DEVTOOLS_TABS[0].id;
|
|
6199
|
+
const tabButtons = DEVTOOLS_TABS.map(
|
|
6200
|
+
(t) => `<button type="button" role="tab" class="st-tab" data-tab="${escapeHtml(t.id)}"${t.id === initialTab ? ' aria-selected="true"' : ' aria-selected="false"'}>${escapeHtml(t.label)}</button>`
|
|
6201
|
+
).join("");
|
|
6202
|
+
return `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>${escapeHtml(title)}</title><style>${INTERACTIVE_CSS}</style></head><body class="st-dt"><header class="st-top"><h1>${escapeHtml(title)} <span class="st-dim">v${escapeHtml(app.identity.version)}</span></h1><button type="button" id="st-refresh" class="st-refresh">↻ Refresh</button></header><nav class="st-tabs" role="tablist" aria-label="DevTools panels">${tabButtons}</nav><main id="st-panel" class="st-body" role="tabpanel" aria-live="polite"></main><footer class="st-foot"><span class="st-dim">Structural inspection over one compiled graph. Not a production profiler; browser/AT conformance not claimed (gates BLOCKED).</span></footer><script type="application/json" id="st-data">${embedJson(snapshot)}</script><script>${CONTROLLER_JS.replace("__INITIAL_TAB__", JSON.stringify(initialTab))}</script></body></html>`;
|
|
6203
|
+
}
|
|
6204
|
+
var CONTROLLER_JS = [
|
|
6205
|
+
"(function(){",
|
|
6206
|
+
'"use strict";',
|
|
6207
|
+
"var INITIAL_TAB=__INITIAL_TAB__;",
|
|
6208
|
+
"function esc(v){",
|
|
6209
|
+
" if(v===null||v===undefined)return String(v);",
|
|
6210
|
+
" var s=typeof v==='string'?v:(typeof v==='object'?sj(v):String(v));",
|
|
6211
|
+
` return s.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>').replace(/"/g,'"').replace(/'/g,''');`,
|
|
6212
|
+
"}",
|
|
6213
|
+
'function sj(v){try{return JSON.stringify(v);}catch(e){return "[object]";}}',
|
|
6214
|
+
'function read(){var el=document.getElementById("st-data");if(!el)return {};try{return JSON.parse(el.textContent||"{}");}catch(e){return {};}}',
|
|
6215
|
+
"var state={data:read(),tab:INITIAL_TAB,selected:null};",
|
|
6216
|
+
"function findNode(n,id){if(!n)return null;if(n.id===id)return n;var c=n.children||[];for(var i=0;i<c.length;i++){var f=findNode(c[i],id);if(f)return f;}return null;}",
|
|
6217
|
+
'function empty(m){return "<p class=\\"st-empty\\">"+esc(m||"(none)")+"</p>";}',
|
|
6218
|
+
'function kv(k,v){return "<div class=\\"st-kv\\"><span class=\\"st-k\\">"+esc(k)+"</span><span class=\\"st-v\\">"+esc(v)+"</span></div>";}',
|
|
6219
|
+
"function rComponents(){",
|
|
6220
|
+
" var cs=state.data.components||[];",
|
|
6221
|
+
' if(!cs.length)return empty("No component() instances");',
|
|
6222
|
+
' var h="<ul class=\\"st-list\\">";',
|
|
6223
|
+
" for(var i=0;i<cs.length;i++){var c=cs[i];",
|
|
6224
|
+
' h+="<li class=\\"st-row st-click\\" data-node=\\""+esc(c.id||"")+"\\">"',
|
|
6225
|
+
' +"<span class=\\"st-ind\\" style=\\"--d:"+(c.depth||0)+"\\"></span>"',
|
|
6226
|
+
' +"<code>"+esc(c.name)+"</code>"',
|
|
6227
|
+
' +(c.key!=null?" <span class=\\"st-key\\">#"+esc(c.key)+"</span>":"")',
|
|
6228
|
+
' +" <span class=\\"st-dim\\">"+(c.childCount||0)+" child</span></li>";}',
|
|
6229
|
+
' return h+"</ul><p class=\\"st-dim\\">Click a component to inspect it.</p>";',
|
|
6230
|
+
"}",
|
|
6231
|
+
"function rInspector(){",
|
|
6232
|
+
' if(!state.selected)return empty("Select a node in Component Tree, Events or Overlays");',
|
|
6233
|
+
" var n=findNode(state.data.graph,state.selected);",
|
|
6234
|
+
' if(!n)return empty("Node "+state.selected+" not found in current snapshot");',
|
|
6235
|
+
' var h="<h3><code><"+esc(n.type)+"></code>"+(n.key!=null?" <span class=\\"st-key\\">#"+esc(n.key)+"</span>":"")+"</h3>";',
|
|
6236
|
+
' h+=kv("id",n.id)+kv("depth",n.depth)+kv("children",(n.children||[]).length);',
|
|
6237
|
+
" var pk=Object.keys(n.props||{});",
|
|
6238
|
+
' h+="<h4>Props</h4>"+(pk.length?pk.map(function(k){return kv(k,n.props[k]);}).join(""):empty("none"));',
|
|
6239
|
+
' h+="<h4>Event types</h4>"+((n.eventTypes||[]).length?"<code>"+esc((n.eventTypes||[]).join(", "))+"</code>":empty("none"));',
|
|
6240
|
+
' h+="<h4>State bindings</h4>"+((n.stateBindings||[]).length?"<ul class=\\"st-list\\">"+n.stateBindings.map(function(b){return "<li><code>"+esc(b)+"</code></li>";}).join("")+"</ul>":empty("none"));',
|
|
6241
|
+
" return h;",
|
|
6242
|
+
"}",
|
|
6243
|
+
"function rState(){",
|
|
6244
|
+
" var s=state.data.signals||{};var live=s.live||{};var ids=s.boundSignalIds||[];",
|
|
6245
|
+
' var h="<p class=\\"st-dim\\">"+ids.length+" signal id(s) bound in graph. Effects are shown as observer counts (no global effect registry).</p>";',
|
|
6246
|
+
" var labels=Object.keys(live);",
|
|
6247
|
+
' if(!labels.length)return h+empty("No live signals registered with DevTools");',
|
|
6248
|
+
' h+="<ul class=\\"st-list\\">";',
|
|
6249
|
+
" for(var i=0;i<labels.length;i++){var l=labels[i];var sg=live[l];",
|
|
6250
|
+
' h+="<li><code>"+esc(l)+"</code> <span class=\\"st-key\\">["+esc(sg.kind)+"]</span> = <code>"+esc(sg.value)+"</code> <span class=\\"st-dim\\">observers "+esc(sg.observerCount==null?"?":sg.observerCount)+"</span></li>";}',
|
|
6251
|
+
' return h+"</ul>";',
|
|
6252
|
+
"}",
|
|
6253
|
+
"function rSignalGraph(){",
|
|
6254
|
+
" var g=state.data.signalGraph||{signals:[],edges:[]};",
|
|
6255
|
+
' if(!(g.signals||[]).length)return empty("No signal bindings in graph");',
|
|
6256
|
+
' var h="<p class=\\"st-dim\\">"+g.signals.length+" signal(s), "+(g.edges||[]).length+" binding edge(s)</p><ul class=\\"st-list\\">";',
|
|
6257
|
+
" for(var i=0;i<g.signals.length;i++){var sn=g.signals[i];",
|
|
6258
|
+
' h+="<li><code>"+esc(sn.signalId)+"</code> <span class=\\"st-dim\\">→ "+(sn.boundNodeIds||[]).length+" node(s), "+sn.bindingCount+" edge(s)</span>"',
|
|
6259
|
+
' +(sn.kind?" <span class=\\"st-key\\">["+esc(sn.kind)+"]</span>":"")',
|
|
6260
|
+
' +(sn.observerCount!=null?" <span class=\\"st-dim\\">obs "+esc(sn.observerCount)+"</span>":"")+"</li>";}',
|
|
6261
|
+
' return h+"</ul>";',
|
|
6262
|
+
"}",
|
|
6263
|
+
"function rRouter(){",
|
|
6264
|
+
' var r=state.data.router;if(!r)return empty("No router registered");',
|
|
6265
|
+
' return kv("path",r.path)+kv("pattern",r.pattern)+kv("fallback",r.isFallback?"yes":"no")',
|
|
6266
|
+
' +"<h4>Params</h4>"+(Object.keys(r.params||{}).length?Object.keys(r.params).map(function(k){return kv(k,r.params[k]);}).join(""):empty("none"))',
|
|
6267
|
+
' +"<h4>Query</h4>"+(Object.keys(r.query||{}).length?Object.keys(r.query).map(function(k){return kv(k,r.query[k]);}).join(""):empty("none"));',
|
|
6268
|
+
"}",
|
|
6269
|
+
"function rResources(){",
|
|
6270
|
+
' var rs=state.data.resources;if(!rs||!Object.keys(rs).length)return empty("No resources registered");',
|
|
6271
|
+
' var ks=Object.keys(rs);var h="<ul class=\\"st-list\\">";',
|
|
6272
|
+
" for(var i=0;i<ks.length;i++){var r=rs[ks[i]];",
|
|
6273
|
+
' h+="<li><code>"+esc(ks[i])+"</code>: <span class=\\"st-key\\">"+esc(r.status)+"</span>"',
|
|
6274
|
+
' +(r.loading?" <span class=\\"st-dim\\">(loading)</span>":"")',
|
|
6275
|
+
' +(r.isRefetching?" <span class=\\"st-dim\\">(refetching)</span>":"")',
|
|
6276
|
+
' +(r.hasError?" <span class=\\"st-err\\">!"+esc(r.errorName)+"</span>":"")+"</li>";}',
|
|
6277
|
+
' return h+"</ul>";',
|
|
6278
|
+
"}",
|
|
6279
|
+
"function rMutations(){",
|
|
6280
|
+
' var ms=state.data.mutations;if(!ms||!Object.keys(ms).length)return empty("No mutations registered");',
|
|
6281
|
+
' var ks=Object.keys(ms);var h="<ul class=\\"st-list\\">";',
|
|
6282
|
+
" for(var i=0;i<ks.length;i++){var m=ms[ks[i]];",
|
|
6283
|
+
' h+="<li><code>"+esc(ks[i])+"</code>: <span class=\\"st-key\\">"+esc(m.status)+"</span>"',
|
|
6284
|
+
' +(m.pending?" <span class=\\"st-dim\\">(pending)</span>":"")',
|
|
6285
|
+
' +(m.hasError?" <span class=\\"st-err\\">!"+esc(m.errorName)+"</span>":"")+"</li>";}',
|
|
6286
|
+
' return h+"</ul>";',
|
|
6287
|
+
"}",
|
|
6288
|
+
"function rEvents(){",
|
|
6289
|
+
" var e=state.data.events||{nodes:[],totalHandlers:0,byType:{}};",
|
|
6290
|
+
" var bt=e.byType||{};var bk=Object.keys(bt);",
|
|
6291
|
+
' var h="<p class=\\"st-dim\\">"+(e.nodes||[]).length+" node(s), "+e.totalHandlers+" handler(s)</p>";',
|
|
6292
|
+
' h+=bk.length?"<p>"+bk.map(function(t){return "<span class=\\"st-badge\\">"+esc(t)+" ×"+bt[t]+"</span>";}).join(" ")+"</p>":"";',
|
|
6293
|
+
' if(!(e.nodes||[]).length)return h+empty("No event handlers wired");',
|
|
6294
|
+
' h+="<ul class=\\"st-list\\">";',
|
|
6295
|
+
" for(var i=0;i<e.nodes.length;i++){var n=e.nodes[i];",
|
|
6296
|
+
' h+="<li class=\\"st-row st-click\\" data-node=\\""+esc(n.id)+"\\"><code><"+esc(n.nodeType)+"></code>"',
|
|
6297
|
+
' +(n.key!=null?" <span class=\\"st-key\\">#"+esc(n.key)+"</span>":"")',
|
|
6298
|
+
' +" <span class=\\"st-dim\\">"+esc((n.eventTypes||[]).join(", "))+"</span></li>";}',
|
|
6299
|
+
' return h+"</ul>";',
|
|
6300
|
+
"}",
|
|
6301
|
+
"function rOverlays(){",
|
|
6302
|
+
' var os=state.data.overlays||[];if(!os.length)return empty("No overlays wired");',
|
|
6303
|
+
' var h="<ul class=\\"st-list\\">";',
|
|
6304
|
+
" for(var i=0;i<os.length;i++){var o=os[i];",
|
|
6305
|
+
' var kind=o.modal?"modal":(o.menu?"menu":(o.takesFocus?"focusable":"non-modal"));',
|
|
6306
|
+
' h+="<li class=\\"st-row st-click\\" data-node=\\""+esc(o.id)+"\\"><code>"+esc(o.key||o.id)+"</code> <span class=\\"st-key\\">["+kind+"]</span> <span class=\\"st-dim\\">"+(o.open?"open":"closed")+(o.closeOnEscape?" \\u00b7 esc":"")+(o.restoreFocus?" \\u00b7 restore":"")+"</span></li>";}',
|
|
6307
|
+
' return h+"</ul>";',
|
|
6308
|
+
"}",
|
|
6309
|
+
"function rPerformance(){",
|
|
6310
|
+
" var p=state.data.performance||{snapshot:{},diagnostics:[]};var snap=p.snapshot||{};",
|
|
6311
|
+
' var h="<p class=\\"st-warn\\">Structural counts, not wall-clock timings. A real render/interaction timeline needs a browser (gate BLOCKED); no timings are fabricated here.</p>";',
|
|
6312
|
+
" var sk=Object.keys(snap);",
|
|
6313
|
+
' h+="<h4>Graph metrics</h4>"+(sk.length?sk.map(function(k){return kv(k,snap[k]);}).join(""):empty("none"));',
|
|
6314
|
+
" var d=p.diagnostics||[];",
|
|
6315
|
+
' h+="<h4>Diagnostics ("+d.length+")</h4>"+(d.length?"<ul class=\\"st-list\\">"+d.map(function(x){return "<li><code>"+esc(x.code)+"</code>: "+esc(x.message)+"</li>";}).join("")+"</ul>":empty("none"));',
|
|
6316
|
+
" return h;",
|
|
6317
|
+
"}",
|
|
6318
|
+
"function rDiagnostics(){",
|
|
6319
|
+
" var d=state.data.diagnostics||{errors:0,warnings:0,messages:[]};",
|
|
6320
|
+
' var h="<p class=\\"st-dim\\">"+d.errors+" error(s) \\u00b7 "+d.warnings+" warning(s) (compiler findings)</p>";',
|
|
6321
|
+
" var m=d.messages||[];",
|
|
6322
|
+
' return h+(m.length?"<ul class=\\"st-list\\">"+m.map(function(x){return "<li>"+esc(x)+"</li>";}).join("")+"</ul>":empty("No diagnostics"));',
|
|
6323
|
+
"}",
|
|
6324
|
+
"function rHydration(){",
|
|
6325
|
+
' var h2=state.data.hydration;if(!h2)return empty("No hydration inspection");',
|
|
6326
|
+
" var pct=(h2.staticRatio*100).toFixed(1);",
|
|
6327
|
+
' var h="<p class=\\"st-warn\\">Structural static-vs-dynamic split only \\u2014 NOT wall-clock SSR/hydration timing (browser gate BLOCKED).</p>";',
|
|
6328
|
+
' h+=kv("total nodes",h2.totalNodes)+kv("static nodes",h2.staticNodes+" ("+pct+"%)")+kv("dynamic nodes",h2.dynamicNodes)',
|
|
6329
|
+
' +kv("static subtrees",h2.staticSubtrees)+kv("dynamic text",h2.dynamicTextNodes)+kv("dynamic attrs",h2.dynamicAttrNodes)',
|
|
6330
|
+
' +kv("event nodes",h2.eventNodes)+kv("lists",h2.lists)+kv("conditionals",h2.conditionals)+kv("portals",h2.portals)+kv("head anchors",h2.headAnchors);',
|
|
6331
|
+
" return h;",
|
|
6332
|
+
"}",
|
|
6333
|
+
"var RENDERERS={components:rComponents,inspector:rInspector,state:rState,signalGraph:rSignalGraph,router:rRouter,resources:rResources,mutations:rMutations,events:rEvents,overlays:rOverlays,performance:rPerformance,diagnostics:rDiagnostics,hydration:rHydration};",
|
|
6334
|
+
'function renderTab(){var el=document.getElementById("st-panel");if(!el)return;var fn=RENDERERS[state.tab]||function(){return empty("Unknown panel");};',
|
|
6335
|
+
" el.innerHTML=fn();",
|
|
6336
|
+
' var rows=el.querySelectorAll(".st-click");',
|
|
6337
|
+
' for(var i=0;i<rows.length;i++){(function(row){row.addEventListener("click",function(){var id=row.getAttribute("data-node");if(id){state.selected=id;selectTab("inspector");}});})(rows[i]);}',
|
|
6338
|
+
"}",
|
|
6339
|
+
'function selectTab(id){state.tab=id;var tabs=document.querySelectorAll(".st-tab");for(var i=0;i<tabs.length;i++){var t=tabs[i];t.setAttribute("aria-selected",t.getAttribute("data-tab")===id?"true":"false");}renderTab();}',
|
|
6340
|
+
'function selectComponent(id){state.selected=id;selectTab("inspector");}',
|
|
6341
|
+
'function refresh(){var hook=window.__STREETUI_DEVTOOLS_REFRESH__;if(typeof hook!=="function")return false;var next=hook();if(next&&typeof next==="object"){state.data=next;renderTab();return true;}return false;}',
|
|
6342
|
+
"function bind(){",
|
|
6343
|
+
' var tabs=document.querySelectorAll(".st-tab");',
|
|
6344
|
+
' for(var i=0;i<tabs.length;i++){(function(t){t.addEventListener("click",function(){selectTab(t.getAttribute("data-tab"));});})(tabs[i]);}',
|
|
6345
|
+
' var rb=document.getElementById("st-refresh");if(rb)rb.addEventListener("click",refresh);',
|
|
6346
|
+
"}",
|
|
6347
|
+
"window.__StreetUIDevTools={get data(){return state.data;},get tab(){return state.tab;},get selected(){return state.selected;},selectTab:selectTab,selectComponent:selectComponent,refresh:refresh,render:renderTab};",
|
|
6348
|
+
"bind();renderTab();",
|
|
6349
|
+
"})();"
|
|
6350
|
+
].join("\n");
|
|
6351
|
+
var INTERACTIVE_CSS = [
|
|
6352
|
+
"*{box-sizing:border-box}",
|
|
6353
|
+
".st-dt{font:13px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace;margin:0;color:#e6e6e6;background:#1e1e28;display:flex;flex-direction:column;min-height:100vh}",
|
|
6354
|
+
".st-top{display:flex;align-items:center;justify-content:space-between;padding:10px 16px;border-bottom:1px solid #333;background:#15151c}",
|
|
6355
|
+
".st-top h1{font-size:14px;margin:0}",
|
|
6356
|
+
".st-refresh{font:inherit;color:#e6e6e6;background:#2c2c3a;border:1px solid #3a3a4a;border-radius:5px;padding:4px 10px;cursor:pointer}",
|
|
6357
|
+
".st-refresh:hover{background:#37374a}",
|
|
6358
|
+
".st-tabs{display:flex;flex-wrap:wrap;gap:2px;padding:6px 10px;border-bottom:1px solid #2c2c38;background:#191922}",
|
|
6359
|
+
".st-tab{font:inherit;color:#b8b8c8;background:transparent;border:0;border-radius:5px;padding:5px 10px;cursor:pointer}",
|
|
6360
|
+
".st-tab:hover{background:#26263200}",
|
|
6361
|
+
'.st-tab[aria-selected="true"]{background:#2f2f40;color:#fff}',
|
|
6362
|
+
".st-body{flex:1;padding:12px 16px;overflow:auto}",
|
|
6363
|
+
".st-body h3{font-size:13px;margin:2px 0 8px}.st-body h4{font-size:11px;text-transform:uppercase;letter-spacing:.05em;color:#9a9aae;margin:14px 0 4px}",
|
|
6364
|
+
".st-list{list-style:none;margin:0;padding:0}.st-list li{padding:2px 0}",
|
|
6365
|
+
".st-row{display:flex;align-items:center;gap:6px}.st-click{cursor:pointer;border-radius:4px;padding:2px 4px}.st-click:hover{background:#26263a}",
|
|
6366
|
+
".st-ind{display:inline-block;width:calc(var(--d,0)*12px)}",
|
|
6367
|
+
".st-kv{display:flex;gap:10px;padding:1px 0}.st-k{color:#9a9aae;min-width:120px}.st-v{color:#d7d7e0;word-break:break-all}",
|
|
6368
|
+
".st-badge{display:inline-block;background:#2c2c3a;border-radius:10px;padding:1px 8px;font-size:11px}",
|
|
6369
|
+
".st-foot{padding:6px 16px;border-top:1px solid #2c2c38;background:#15151c}",
|
|
6370
|
+
".st-dim{color:#8a8a9a}.st-key{color:#7db4ff}.st-err{color:#ff8a8a}.st-empty{color:#6a6a7a}.st-warn{color:#ffce8a;margin:0 0 10px}",
|
|
6371
|
+
"code{color:#d7d7e0}"
|
|
6372
|
+
].join("");
|
|
6373
|
+
|
|
6038
6374
|
// ../devtools/src/devtools-report.ts
|
|
6039
6375
|
function renderDevToolsReport(compiled, sources = {}, options = {}) {
|
|
6040
6376
|
const session = createDevTools(compiled, sources, options);
|
|
@@ -6054,6 +6390,7 @@ export {
|
|
|
6054
6390
|
CleanupRegistry,
|
|
6055
6391
|
ContainerBuilderImpl,
|
|
6056
6392
|
DEFAULT_PERF_THRESHOLDS,
|
|
6393
|
+
DEVTOOLS_TABS,
|
|
6057
6394
|
DerivedSignal,
|
|
6058
6395
|
DiagnosticCollector,
|
|
6059
6396
|
DiagnosticError,
|
|
@@ -6150,13 +6487,17 @@ export {
|
|
|
6150
6487
|
inspectApplication,
|
|
6151
6488
|
inspectComponents,
|
|
6152
6489
|
inspectContext,
|
|
6490
|
+
inspectEvents,
|
|
6153
6491
|
inspectForm,
|
|
6154
6492
|
inspectGraph,
|
|
6493
|
+
inspectHydration,
|
|
6155
6494
|
inspectI18n,
|
|
6156
6495
|
inspectInteractions,
|
|
6496
|
+
inspectMutation,
|
|
6157
6497
|
inspectResource,
|
|
6158
6498
|
inspectRouter,
|
|
6159
6499
|
inspectSignal,
|
|
6500
|
+
inspectSignalGraph,
|
|
6160
6501
|
interpolate,
|
|
6161
6502
|
isBatching,
|
|
6162
6503
|
isComponentDefinition,
|
|
@@ -6190,6 +6531,7 @@ export {
|
|
|
6190
6531
|
renderDevToolsHTML,
|
|
6191
6532
|
renderDevToolsReport,
|
|
6192
6533
|
renderHead,
|
|
6534
|
+
renderInteractiveDevTools,
|
|
6193
6535
|
renderToString,
|
|
6194
6536
|
reportDiagnostic,
|
|
6195
6537
|
reportError,
|