@dimina-kit/devtools 0.4.0-dev.20260716214527 → 0.4.0-dev.20260718085557
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/main/app/app.js +6 -1
- package/dist/main/index.bundle.js +7658 -7306
- package/dist/main/services/cdp-session/index.d.ts +87 -0
- package/dist/main/services/cdp-session/index.js +173 -0
- package/dist/main/services/elements-forward/index.d.ts +132 -15
- package/dist/main/services/elements-forward/index.js +162 -229
- package/dist/main/services/network-forward/body-cache.d.ts +70 -0
- package/dist/main/services/network-forward/body-cache.js +175 -0
- package/dist/main/services/network-forward/frontend-dispatch.d.ts +27 -0
- package/dist/main/services/network-forward/frontend-dispatch.js +42 -0
- package/dist/main/services/network-forward/index.d.ts +80 -9
- package/dist/main/services/network-forward/index.js +419 -149
- package/dist/main/services/render-inspect/index.d.ts +10 -0
- package/dist/main/services/render-inspect/index.js +17 -98
- package/dist/main/services/safe-area/index.d.ts +4 -1
- package/dist/main/services/safe-area/index.js +62 -34
- package/dist/main/services/simulator-appdata/index.d.ts +6 -0
- package/dist/main/services/simulator-appdata/index.js +20 -1
- package/dist/main/services/simulator-storage/index.d.ts +22 -4
- package/dist/main/services/simulator-storage/index.js +51 -64
- package/dist/main/services/views/native-simulator-devtools-host.js +12 -1
- package/dist/main/services/views/native-simulator-view.js +6 -0
- package/dist/main/services/views/view-manager.d.ts +9 -0
- package/dist/main/services/views/view-manager.js +1 -1
- package/dist/main/services/workbench-context.d.ts +9 -0
- package/dist/main/services/workbench-context.js +3 -0
- package/dist/main/utils/ipc-registry.d.ts +2 -1
- package/dist/main/utils/ipc-registry.js +30 -10
- package/dist/preload/windows/host-toolbar-runtime.cjs.map +2 -2
- package/dist/preload/windows/simulator.cjs.map +2 -2
- package/dist/renderer/assets/index-U9F8MrtV.js +49 -0
- package/dist/renderer/assets/{input-7P0WbXyg.js → input-c2OcrrZy.js} +2 -2
- package/dist/renderer/assets/ipc-transport-Blac3sOj.css +1 -0
- package/dist/renderer/assets/{ipc-transport-DTEmLpxx.js → ipc-transport-CuDJ07aE.js} +2 -2
- package/dist/renderer/assets/{popover-DsOcyIS6.js → popover-kv2qspWz.js} +2 -2
- package/dist/renderer/assets/{select-Bzbhbg9Z.js → select-DKqzMtTh.js} +2 -2
- package/dist/renderer/assets/{settings-api-B1wVFAPB.js → settings-api-qpXKDRXt.js} +2 -2
- package/dist/renderer/assets/{settings-CR1TyBWu.js → settings-dJNKTGr8.js} +2 -2
- package/dist/renderer/assets/{workbenchSettings-CFbToT4Q.js → workbenchSettings-DQ_VP5-W.js} +2 -2
- package/dist/renderer/entries/main/index.html +6 -6
- package/dist/renderer/entries/popover/index.html +5 -5
- package/dist/renderer/entries/settings/index.html +5 -5
- package/dist/renderer/entries/workbench-settings/index.html +4 -4
- package/dist/service-host/appdata-set-data.cjs +39 -0
- package/dist/service-host/preload.cjs +21 -0
- package/dist/shared/ipc-channels.d.ts +9 -0
- package/dist/shared/ipc-channels.js +11 -0
- package/package.json +5 -5
- package/dist/renderer/assets/index-CZd3LyY8.js +0 -49
- package/dist/renderer/assets/ipc-transport-BGtDnv6p.css +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{S as e,T as t,w as n,x as r}from"./ipc-transport-
|
|
2
|
-
//# sourceMappingURL=settings-
|
|
1
|
+
import{S as e,T as t,w as n,x as r}from"./ipc-transport-CuDJ07aE.js";import{t as i}from"./input-c2OcrrZy.js";import{l as a,n as o,o as s,t as c}from"./settings-api-qpXKDRXt.js";var l=t(e(),1),u=t(n(),1),d=r(),f=[{id:`local`,label:`本地设置`},{id:`project`,label:`项目配置`}];function p(){let[e,t]=(0,u.useState)(`local`),[n,r]=(0,u.useState)(``),[l,p]=(0,u.useState)({startPage:``,scene:1001,queryParams:[]}),[m,h]=(0,u.useState)({uploadWithSourceMap:!1});(0,u.useEffect)(()=>s(e=>{r(e.projectPath),p(e.config),h({uploadWithSourceMap:!!e.projectSettings?.uploadWithSourceMap})}),[]);function g(e){let t={...l,...e};p(t),o(t)}function _(e){let t={...m,...e};h(t),c(t)}function v(e,t,n){return(0,d.jsxs)(`button`,{type:`button`,onClick:()=>n(!t),className:`w-full flex items-center gap-3 px-3 py-2.5 rounded-md border border-border bg-bg hover:bg-surface-3 transition-colors text-left`,children:[(0,d.jsx)(`span`,{className:`h-4 w-4 rounded-sm border flex items-center justify-center text-[11px] ${t?`bg-accent border-accent text-white`:`border-border bg-surface text-transparent`}`,children:`✓`}),(0,d.jsx)(`span`,{className:`text-[12px] text-text`,children:e})]})}return(0,d.jsx)(`div`,{"data-testid":`settings-backdrop`,className:`fixed inset-0`,onClick:()=>void a(!1),children:(0,d.jsxs)(`div`,{"data-testid":`settings-panel`,className:`fixed top-0 right-0 h-full w-[320px] flex flex-col bg-surface text-text border-l border-border shadow-[0_8px_24px_var(--color-overlay-heavy)]`,onClick:e=>e.stopPropagation(),children:[(0,d.jsx)(`div`,{className:`flex items-center border-b border-border shrink-0`,children:f.map(n=>(0,d.jsx)(`button`,{className:`flex-1 py-2.5 text-[12px] text-center transition-colors ${e===n.id?`text-accent border-b-2 border-accent`:`text-text-secondary hover:text-text`}`,onClick:()=>t(n.id),children:n.label},n.id))}),(0,d.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:[e===`local`&&(0,d.jsxs)(`div`,{className:`space-y-3`,children:[(0,d.jsx)(`div`,{className:`text-[12px] text-text-secondary`,children:`本地设置`}),v(`上传时启用 Sourcemap`,m.uploadWithSourceMap,e=>_({uploadWithSourceMap:e}))]}),e===`project`&&(0,d.jsxs)(`div`,{className:`space-y-4`,children:[(0,d.jsxs)(`div`,{className:`flex items-center justify-between py-2 border-b border-border`,children:[(0,d.jsx)(`span`,{className:`text-[12px] text-text-secondary`,children:`本地目录`}),(0,d.jsx)(`span`,{className:`text-[12px] text-text truncate ml-4 max-w-[180px]`,title:n,children:n})]}),(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`label`,{className:`block text-[12px] text-text-secondary mb-1`,children:`启动页面`}),(0,d.jsx)(i,{value:l.startPage,onChange:e=>g({startPage:e.target.value}),className:`w-full h-8 px-2 text-[12px]`})]}),(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`label`,{className:`block text-[12px] text-text-secondary mb-1`,children:`Scene`}),(0,d.jsx)(i,{type:`number`,value:l.scene,onChange:e=>g({scene:parseInt(e.target.value||`1001`,10)}),className:`w-full h-8 px-2 text-[12px]`})]})]})]})]})})}l.createRoot(document.getElementById(`root`)).render((0,d.jsx)(p,{}));
|
|
2
|
+
//# sourceMappingURL=settings-dJNKTGr8.js.map
|
package/dist/renderer/assets/{workbenchSettings-CFbToT4Q.js → workbenchSettings-DQ_VP5-W.js}
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{S as e,T as t,w as n,x as r}from"./ipc-transport-
|
|
1
|
+
import{S as e,T as t,w as n,x as r}from"./ipc-transport-CuDJ07aE.js";import{t as i}from"./constants-EAMiwL9_.js";import{a,c as o,i as s,r as c,s as l,u}from"./settings-api-qpXKDRXt.js";var d=t(e(),1),f=t(n(),1),p=r(),m=[{id:`general`,label:`通用`},{id:`debug`,label:`调试`},{id:`mcp`,label:`MCP`}],h={system:`跟随系统`,dark:`深色`,light:`浅色`};function g({checked:e,onClick:t}){return(0,p.jsx)(`button`,{type:`button`,onClick:t,className:`relative inline-flex h-5 w-9 shrink-0 rounded-full transition-colors`,style:{background:e?`var(--color-accent)`:`var(--color-surface-3)`},children:(0,p.jsx)(`span`,{className:`inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform`,style:{marginTop:3,transform:e?`translateX(18px)`:`translateX(3px)`}})})}function _({activeTab:e,onSelect:t}){return(0,p.jsx)(`div`,{className:`flex items-center border-b border-border shrink-0`,children:m.map(n=>(0,p.jsx)(`button`,{className:`flex-1 py-2.5 text-[12px] text-center transition-colors ${e===n.id?`text-accent border-b-2 border-accent`:`text-text-secondary hover:text-text`}`,onClick:()=>t(n.id),children:n.label},n.id))})}function v({theme:e,onSelect:t}){return(0,p.jsx)(`div`,{className:`flex rounded overflow-hidden border border-border text-[11px]`,children:[`system`,`dark`,`light`].map((n,r)=>(0,p.jsx)(`button`,{onClick:()=>t(n),className:[`px-3 py-1 transition-colors`,r>0?`border-l border-border`:``,e===n?`bg-accent text-white`:`text-text-secondary hover:text-text hover:bg-surface-3`].join(` `),children:h[n]},n))})}function y({autoBuildEnabled:e,onAutoBuildChange:t,autoReloadEnabled:n,onAutoReloadChange:r,theme:i,onThemeChange:a,saved:o}){return(0,p.jsxs)(`div`,{className:`space-y-4`,children:[(0,p.jsxs)(`section`,{className:`rounded-lg border border-border p-4 space-y-4 bg-bg`,children:[(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`h2`,{className:`text-[13px] font-medium mb-1`,children:`编译与预览`}),(0,p.jsx)(`p`,{className:`text-[11px] leading-relaxed text-text-secondary`,children:`开启「自动编译」后,打开项目时会监听源文件改动并自动重新编译。开启「自动刷新」后,每次编译完成会刷新模拟器(仅改样式时原地热替换,保留当前页面栈与表单状态);关闭它则任何改动都不刷新,仅手动刷新。配置在下次打开项目时生效。`})]}),(0,p.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,p.jsx)(`span`,{className:`text-[12px] text-text-secondary`,children:`监听文件变化自动编译`}),(0,p.jsx)(g,{checked:e,onClick:()=>t(!e)})]}),(0,p.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,p.jsx)(`span`,{className:`text-[12px] text-text-secondary`,children:`编译完成后自动刷新模拟器`}),(0,p.jsx)(g,{checked:n,onClick:()=>r(!n)})]})]}),(0,p.jsxs)(`section`,{className:`rounded-lg border border-border p-4 space-y-3 bg-bg`,children:[(0,p.jsx)(`div`,{children:(0,p.jsx)(`h2`,{className:`text-[13px] font-medium mb-1`,children:`外观`})}),(0,p.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,p.jsx)(`span`,{className:`text-[12px] text-text-secondary`,children:`颜色模式`}),(0,p.jsx)(v,{theme:i,onSelect:a})]})]}),o&&(0,p.jsx)(`div`,{className:`text-[11px] text-status-success`,children:`已保存`})]})}function b({cdpStatus:e}){return(0,p.jsxs)(`div`,{className:`rounded p-3 space-y-2 border border-border bg-surface`,children:[(0,p.jsx)(`div`,{className:`text-[11px] font-medium text-text-secondary`,children:`当前状态`}),(0,p.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,p.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-full`,style:{background:e?.active?`var(--color-status-success)`:`var(--color-text-dim)`}}),(0,p.jsx)(`span`,{className:`text-[12px] text-text-secondary`,children:e?.active?`CDP 已激活 - 端口 ${e.activePort}`:`CDP 未激活`})]}),e?.implicitDevDefault&&(0,p.jsx)(`div`,{className:`text-[11px] text-text-dim`,children:`当前为开发模式默认端口`}),e?.active&&(0,p.jsxs)(`div`,{className:`text-[11px] text-text-dim font-mono`,children:[`调试地址: http://localhost:`,e.activePort]})]})}function x(e,t){return!e||e.implicitDevDefault?!1:t.enabled===e.active?t.enabled&&e.active&&t.port!==e.activePort:!0}function S({cdpEnabled:e,onToggleCdp:t,portInput:n,onPortInputChange:r,cdpStatus:a,needsRestart:o,onSave:s,saved:c}){return(0,p.jsxs)(`section`,{className:`rounded-lg border border-border p-4 space-y-4 bg-bg`,children:[(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`h2`,{className:`text-[13px] font-medium mb-1`,children:`DevTools Protocol`}),(0,p.jsx)(`p`,{className:`text-[11px] leading-relaxed text-text-secondary`,children:`开启后可通过 DevTools Protocol 连接调试模拟器。配置变更需要重启应用后生效。`})]}),(0,p.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,p.jsx)(`span`,{className:`text-[12px] text-text-secondary`,children:`启用 DevTools Protocol`}),(0,p.jsx)(g,{checked:e,onClick:t})]}),(0,p.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,p.jsx)(`label`,{className:`text-[12px] shrink-0 w-16 text-text-secondary`,children:`调试端口`}),(0,p.jsx)(`input`,{type:`number`,min:1024,max:65535,value:n,onChange:e=>r(e.target.value),disabled:!e,className:`w-24 h-7 px-2 rounded text-[12px] outline-none bg-surface border border-border text-text`,style:{opacity:e?1:.4}}),(0,p.jsxs)(`span`,{className:`text-[11px] text-text-dim`,children:[`默认 `,i]})]}),(0,p.jsx)(b,{cdpStatus:a}),o&&(0,p.jsx)(`div`,{className:`rounded px-3 py-2 text-[12px] border bg-warn-bg text-[var(--color-status-warn)]`,children:`配置已变更,需要重启应用后生效`}),(0,p.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,p.jsx)(`button`,{onClick:s,className:`h-7 px-4 rounded text-[13px] font-medium text-white bg-accent hover:bg-accent-hover`,children:`保存`}),c&&(0,p.jsx)(`span`,{className:`text-[11px] text-status-success`,children:`已保存`})]})]})}function C({color:e,children:t}){return(0,p.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,p.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-full`,style:{background:e}}),(0,p.jsx)(`span`,{className:`text-[12px] text-text-secondary`,children:t})]})}function w({mcpEnabled:e,mcpStatus:t}){return(0,p.jsxs)(`div`,{className:`rounded p-3 space-y-2 border border-border bg-surface`,children:[(0,p.jsx)(`div`,{className:`text-[11px] font-medium text-text-secondary`,children:`当前状态`}),e?t?.running?(0,p.jsxs)(C,{color:`var(--color-status-success)`,children:[`MCP 已运行 - 端口 `,t.activePort]}):(0,p.jsxs)(C,{color:`var(--color-status-error, #e54d4d)`,children:[`MCP 未运行`,t?.error===`port-in-use`?`(端口 ${t.configuredPort} 已被占用)`:t?.error?`(${t.error})`:``]}):(0,p.jsx)(C,{color:`var(--color-text-dim)`,children:`MCP 未启用`})]})}function T({mcpEnabled:e,onToggleMcp:t,mcpPortInput:n,onMcpPortInputChange:r,mcpStatus:i,mcpPort:a,onSave:o,saved:s}){return(0,p.jsxs)(`section`,{className:`rounded-lg border border-border p-4 space-y-4 bg-bg`,children:[(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`h2`,{className:`text-[13px] font-medium mb-1`,children:`MCP 配置`}),(0,p.jsx)(`p`,{className:`text-[11px] leading-relaxed text-text-secondary`,children:`AI 助手可以通过 MCP 连接当前开发工具,读取 console、截图、执行 JS、查看 DOM / Storage / 网络请求。启用后开发工具启动时会自动监听 SSE 端点,并自动启用 CDP。`})]}),(0,p.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,p.jsx)(`span`,{className:`text-[12px] text-text-secondary`,children:`启用 MCP 服务`}),(0,p.jsx)(g,{checked:e,onClick:t})]}),(0,p.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,p.jsx)(`label`,{className:`text-[12px] shrink-0 w-16 text-text-secondary`,children:`SSE 端口`}),(0,p.jsx)(`input`,{type:`number`,min:1024,max:65535,value:n,onChange:e=>r(e.target.value),disabled:!e,className:`w-24 h-7 px-2 rounded text-[12px] outline-none bg-surface border border-border text-text`,style:{opacity:e?1:.4}}),(0,p.jsx)(`span`,{className:`text-[11px] text-text-dim`,children:`默认 7789`})]}),(0,p.jsx)(w,{mcpEnabled:e,mcpStatus:i}),(0,p.jsxs)(`div`,{className:`rounded p-3 border border-border bg-surface`,children:[(0,p.jsx)(`div`,{className:`text-[11px] font-medium mb-2 text-text-secondary`,children:"`.mcp.json` 示例(SSE 传输)"}),(0,p.jsx)(`pre`,{className:`text-[11px] whitespace-pre-wrap leading-relaxed text-[var(--color-code-blue)] font-mono`,children:`{
|
|
2
2
|
"mcpServers": {
|
|
3
3
|
"dimina-devtools": {
|
|
4
4
|
"url": "http://127.0.0.1:${a}/sse"
|
|
5
5
|
}
|
|
6
6
|
}
|
|
7
7
|
}`})]}),(0,p.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,p.jsx)(`button`,{onClick:o,className:`h-7 px-4 rounded text-[13px] font-medium text-white bg-accent hover:bg-accent-hover`,children:`保存`}),s&&(0,p.jsx)(`span`,{className:`text-[11px] text-status-success`,children:`已保存`})]})]})}function E(){let[e,t]=(0,f.useState)({cdp:{enabled:!1,port:i},mcp:{enabled:!1,port:7789},compile:{autoBuild:!0},preview:{autoReload:!0},theme:`system`,lastCreateBaseDir:null}),[n,r]=(0,f.useState)(null),[d,m]=(0,f.useState)(null),[h,g]=(0,f.useState)(`general`),[v,b]=(0,f.useState)(!1),[C,w]=(0,f.useState)(String(i)),[E,D]=(0,f.useState)(`7789`);(0,f.useEffect)(()=>{let e=l(e=>{t(e.settings),w(String(e.settings.cdp.port)),D(String(e.settings.mcp.port))});return a().then(e=>{t(e),w(String(e.cdp.port)),D(String(e.mcp.port))}),c().then(r),s().then(m),e},[]);function O(){b(!0),window.setTimeout(()=>b(!1),2e3)}function k(){t(e=>({...e,cdp:{...e.cdp,enabled:!e.cdp.enabled}}))}function A(){t(e=>({...e,mcp:{...e.mcp,enabled:!e.mcp.enabled}}))}function j(n){let r={...e,theme:n};t(r),u(n),o(r)}function M(e){t(e),o(e).then(O)}async function N(){let n=parseInt(C,10);if(Number.isNaN(n)||n<1024||n>65535)return;let i=parseInt(E,10);if(Number.isNaN(i)||i<1024||i>65535)return;let a={...e,cdp:{...e.cdp,port:n},mcp:{...e.mcp,port:i}};t(a),await o(a),r(await c()),m(await s()),O()}let P=x(n,e.cdp);return(0,p.jsxs)(`div`,{className:`flex flex-col h-screen bg-surface text-text`,children:[(0,p.jsx)(_,{activeTab:h,onSelect:g}),(0,p.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:[h===`general`&&(0,p.jsx)(y,{autoBuildEnabled:e.compile.autoBuild,onAutoBuildChange:t=>M({...e,compile:{...e.compile,autoBuild:t}}),autoReloadEnabled:e.preview.autoReload,onAutoReloadChange:t=>M({...e,preview:{...e.preview,autoReload:t}}),theme:e.theme,onThemeChange:j,saved:v}),h===`debug`&&(0,p.jsx)(S,{cdpEnabled:e.cdp.enabled,onToggleCdp:k,portInput:C,onPortInputChange:w,cdpStatus:n,needsRestart:P,onSave:N,saved:v}),h===`mcp`&&(0,p.jsx)(T,{mcpEnabled:e.mcp.enabled,onToggleMcp:A,mcpPortInput:E,onMcpPortInputChange:D,mcpStatus:d,mcpPort:e.mcp.port,onSave:N,saved:v})]})]})}d.createRoot(document.getElementById(`root`)).render((0,p.jsx)(E,{}));
|
|
8
|
-
//# sourceMappingURL=workbenchSettings-
|
|
8
|
+
//# sourceMappingURL=workbenchSettings-DQ_VP5-W.js.map
|
|
@@ -26,13 +26,13 @@
|
|
|
26
26
|
overflow: hidden;
|
|
27
27
|
}
|
|
28
28
|
</style>
|
|
29
|
-
<script type="module" crossorigin src="../../assets/index-
|
|
30
|
-
<link rel="modulepreload" crossorigin href="../../assets/ipc-transport-
|
|
31
|
-
<link rel="modulepreload" crossorigin href="../../assets/input-
|
|
32
|
-
<link rel="modulepreload" crossorigin href="../../assets/select-
|
|
33
|
-
<link rel="modulepreload" crossorigin href="../../assets/settings-api-
|
|
29
|
+
<script type="module" crossorigin src="../../assets/index-U9F8MrtV.js"></script>
|
|
30
|
+
<link rel="modulepreload" crossorigin href="../../assets/ipc-transport-CuDJ07aE.js">
|
|
31
|
+
<link rel="modulepreload" crossorigin href="../../assets/input-c2OcrrZy.js">
|
|
32
|
+
<link rel="modulepreload" crossorigin href="../../assets/select-DKqzMtTh.js">
|
|
33
|
+
<link rel="modulepreload" crossorigin href="../../assets/settings-api-qpXKDRXt.js">
|
|
34
34
|
<link rel="modulepreload" crossorigin href="../../assets/constants-EAMiwL9_.js">
|
|
35
|
-
<link rel="stylesheet" crossorigin href="../../assets/ipc-transport-
|
|
35
|
+
<link rel="stylesheet" crossorigin href="../../assets/ipc-transport-Blac3sOj.css">
|
|
36
36
|
</head>
|
|
37
37
|
<body>
|
|
38
38
|
<div id="root"></div>
|
|
@@ -8,12 +8,12 @@
|
|
|
8
8
|
<style>
|
|
9
9
|
html, body { margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden; background: transparent !important; }
|
|
10
10
|
</style>
|
|
11
|
-
<script type="module" crossorigin src="../../assets/popover-
|
|
12
|
-
<link rel="modulepreload" crossorigin href="../../assets/ipc-transport-
|
|
13
|
-
<link rel="modulepreload" crossorigin href="../../assets/input-
|
|
14
|
-
<link rel="modulepreload" crossorigin href="../../assets/select-
|
|
11
|
+
<script type="module" crossorigin src="../../assets/popover-kv2qspWz.js"></script>
|
|
12
|
+
<link rel="modulepreload" crossorigin href="../../assets/ipc-transport-CuDJ07aE.js">
|
|
13
|
+
<link rel="modulepreload" crossorigin href="../../assets/input-c2OcrrZy.js">
|
|
14
|
+
<link rel="modulepreload" crossorigin href="../../assets/select-DKqzMtTh.js">
|
|
15
15
|
<link rel="modulepreload" crossorigin href="../../assets/constants-EAMiwL9_.js">
|
|
16
|
-
<link rel="stylesheet" crossorigin href="../../assets/ipc-transport-
|
|
16
|
+
<link rel="stylesheet" crossorigin href="../../assets/ipc-transport-Blac3sOj.css">
|
|
17
17
|
</head>
|
|
18
18
|
<body>
|
|
19
19
|
<div id="root"></div>
|
|
@@ -11,11 +11,11 @@
|
|
|
11
11
|
closes the overlay — mirrors the popover entry. */
|
|
12
12
|
html, body { margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden; background: transparent !important; }
|
|
13
13
|
</style>
|
|
14
|
-
<script type="module" crossorigin src="../../assets/settings-
|
|
15
|
-
<link rel="modulepreload" crossorigin href="../../assets/ipc-transport-
|
|
16
|
-
<link rel="modulepreload" crossorigin href="../../assets/input-
|
|
17
|
-
<link rel="modulepreload" crossorigin href="../../assets/settings-api-
|
|
18
|
-
<link rel="stylesheet" crossorigin href="../../assets/ipc-transport-
|
|
14
|
+
<script type="module" crossorigin src="../../assets/settings-dJNKTGr8.js"></script>
|
|
15
|
+
<link rel="modulepreload" crossorigin href="../../assets/ipc-transport-CuDJ07aE.js">
|
|
16
|
+
<link rel="modulepreload" crossorigin href="../../assets/input-c2OcrrZy.js">
|
|
17
|
+
<link rel="modulepreload" crossorigin href="../../assets/settings-api-qpXKDRXt.js">
|
|
18
|
+
<link rel="stylesheet" crossorigin href="../../assets/ipc-transport-Blac3sOj.css">
|
|
19
19
|
</head>
|
|
20
20
|
<body>
|
|
21
21
|
<div id="root"></div>
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
<!-- See entries/main/index.html for CSP rationale. -->
|
|
7
7
|
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob: http: https:; font-src 'self' data:; media-src 'self' blob: http: https:; connect-src 'self' http: https: ws: wss:;" />
|
|
8
8
|
<title>开发工具设置</title>
|
|
9
|
-
<script type="module" crossorigin src="../../assets/workbenchSettings-
|
|
10
|
-
<link rel="modulepreload" crossorigin href="../../assets/ipc-transport-
|
|
11
|
-
<link rel="modulepreload" crossorigin href="../../assets/settings-api-
|
|
9
|
+
<script type="module" crossorigin src="../../assets/workbenchSettings-DQ_VP5-W.js"></script>
|
|
10
|
+
<link rel="modulepreload" crossorigin href="../../assets/ipc-transport-CuDJ07aE.js">
|
|
11
|
+
<link rel="modulepreload" crossorigin href="../../assets/settings-api-qpXKDRXt.js">
|
|
12
12
|
<link rel="modulepreload" crossorigin href="../../assets/constants-EAMiwL9_.js">
|
|
13
|
-
<link rel="stylesheet" crossorigin href="../../assets/ipc-transport-
|
|
13
|
+
<link rel="stylesheet" crossorigin href="../../assets/ipc-transport-Blac3sOj.css">
|
|
14
14
|
</head>
|
|
15
15
|
<body>
|
|
16
16
|
<div id="root"></div>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Pure write-back step of the AppData-panel edit path: resolve the page
|
|
2
|
+
// instance owning `bridgeId` in the CURRENT page stack and hand the patch to
|
|
3
|
+
// its real `setData`, so the update flows through the runtime's own pipeline
|
|
4
|
+
// (observers, child-props sync, `ub` publish) and the panel re-renders from
|
|
5
|
+
// the runtime's state — never an optimistic local echo.
|
|
6
|
+
//
|
|
7
|
+
// `getCurrentPages` is injected (the service runtime installs it on
|
|
8
|
+
// `globalThis` during boot; this module stays testable without that global).
|
|
9
|
+
// Returns whether the patch reached a live page; every failure — no runtime
|
|
10
|
+
// yet, unknown bridge, a throwing setData — degrades to `false` and never
|
|
11
|
+
// throws into the preload's IPC listener.
|
|
12
|
+
'use strict'
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @param {unknown} getCurrentPages
|
|
16
|
+
* @param {string} bridgeId
|
|
17
|
+
* @param {Record<string, unknown>} data
|
|
18
|
+
* @returns {boolean}
|
|
19
|
+
*/
|
|
20
|
+
function applyAppDataSetData(getCurrentPages, bridgeId, data) {
|
|
21
|
+
if (typeof getCurrentPages !== 'function') return false
|
|
22
|
+
let pages
|
|
23
|
+
try {
|
|
24
|
+
pages = getCurrentPages()
|
|
25
|
+
} catch (_) {
|
|
26
|
+
return false
|
|
27
|
+
}
|
|
28
|
+
if (!Array.isArray(pages)) return false
|
|
29
|
+
const page = pages.find((p) => p && p.bridgeId === bridgeId)
|
|
30
|
+
if (!page || typeof page.setData !== 'function') return false
|
|
31
|
+
try {
|
|
32
|
+
page.setData(data)
|
|
33
|
+
} catch (_) {
|
|
34
|
+
return false
|
|
35
|
+
}
|
|
36
|
+
return true
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
module.exports = { applyAppDataSetData }
|
|
@@ -8,6 +8,9 @@ const CHANNELS = {
|
|
|
8
8
|
// wx.getSystemInfoSync() reflects the newly-selected device without a
|
|
9
9
|
// relaunch. Mirrors ServiceHostChannel.HostEnvUpdate in shared/ipc-channels.ts.
|
|
10
10
|
HOST_ENV_UPDATE: 'service-host:host-env:update',
|
|
11
|
+
// main → this window: AppData-panel edit write-back. Mirrors
|
|
12
|
+
// ServiceHostChannel.AppDataSetData in shared/ipc-channels.ts.
|
|
13
|
+
APPDATA_SET_DATA: 'service-host:appdata:set-data',
|
|
11
14
|
}
|
|
12
15
|
|
|
13
16
|
const params = new URLSearchParams(globalThis.location && globalThis.location.search || '')
|
|
@@ -203,6 +206,24 @@ ipcRenderer.on(CHANNELS.TO_SERVICE, (_event, payload) => {
|
|
|
203
206
|
deliver(payload && payload.msg)
|
|
204
207
|
})
|
|
205
208
|
|
|
209
|
+
// AppData-panel edit write-back. The service runtime evaluates in THIS window's
|
|
210
|
+
// global context (contextIsolation: false), so `globalThis.getCurrentPages` is
|
|
211
|
+
// the runtime's real page stack once boot has installed it. The pure resolver
|
|
212
|
+
// lives in a sibling .cjs (unit-tested in appdata-set-data.test.ts), required
|
|
213
|
+
// relative to this preload so it resolves from dist/service-host at runtime.
|
|
214
|
+
const { applyAppDataSetData } = require('./appdata-set-data.cjs')
|
|
215
|
+
|
|
216
|
+
ipcRenderer.on(CHANNELS.APPDATA_SET_DATA, (_event, payload) => {
|
|
217
|
+
if (!payload || typeof payload.bridgeId !== 'string' || !payload.data) return
|
|
218
|
+
const applied = applyAppDataSetData(globalThis.getCurrentPages, payload.bridgeId, payload.data)
|
|
219
|
+
// Narrow race: main resolved a live service window but the page unloaded
|
|
220
|
+
// before this handler ran — the write is dropped here. Surface it in the
|
|
221
|
+
// service console (captured via CDP) so the silent no-op is diagnosable.
|
|
222
|
+
if (!applied) {
|
|
223
|
+
console.warn(`[service-host] appdata set-data dropped: no live page for bridge ${payload.bridgeId}`)
|
|
224
|
+
}
|
|
225
|
+
})
|
|
226
|
+
|
|
206
227
|
// ── Uncaught error capture (native-host) ────────────────────────────────────
|
|
207
228
|
// Placed AFTER the no-bridgeId early-return (pool warming) and AFTER
|
|
208
229
|
// DiminaServiceBridge is defined, so it only runs for a real spawn and can use
|
|
@@ -50,6 +50,14 @@ export declare const ServiceHostChannel: {
|
|
|
50
50
|
* `__diminaSpawnContext.hostEnvSnapshot` in place (see `service-host/preload.cjs`).
|
|
51
51
|
*/
|
|
52
52
|
readonly HostEnvUpdate: "service-host:host-env:update";
|
|
53
|
+
/**
|
|
54
|
+
* NATIVE-HOST ONLY. Deliver an AppData-panel edit (`{bridgeId, data}`) into
|
|
55
|
+
* the service-host window. The preload resolves the page instance via
|
|
56
|
+
* `getCurrentPages()` and calls `page.setData(data)`, so the resulting `ub`
|
|
57
|
+
* publish flows back through the normal service→render tap — the panel
|
|
58
|
+
* refreshes from the runtime's own state, not an optimistic local echo.
|
|
59
|
+
*/
|
|
60
|
+
readonly AppDataSetData: "service-host:appdata:set-data";
|
|
53
61
|
};
|
|
54
62
|
export declare const SimulatorCustomApiChannel: {
|
|
55
63
|
readonly Invoke: "simulator:custom-apis:invoke";
|
|
@@ -101,6 +109,7 @@ export declare const SimulatorWxmlChannel: {
|
|
|
101
109
|
export declare const SimulatorAppDataChannel: {
|
|
102
110
|
readonly GetSnapshot: "simulator:appdata:snapshot";
|
|
103
111
|
readonly Event: "simulator:appdata:event";
|
|
112
|
+
readonly SetData: "simulator:appdata:set-data";
|
|
104
113
|
};
|
|
105
114
|
export type { ElementInspection } from '@dimina-kit/inspect';
|
|
106
115
|
export declare const WorkbenchSettingsChannel: {
|
|
@@ -38,6 +38,14 @@ export const ServiceHostChannel = {
|
|
|
38
38
|
* `__diminaSpawnContext.hostEnvSnapshot` in place (see `service-host/preload.cjs`).
|
|
39
39
|
*/
|
|
40
40
|
HostEnvUpdate: 'service-host:host-env:update',
|
|
41
|
+
/**
|
|
42
|
+
* NATIVE-HOST ONLY. Deliver an AppData-panel edit (`{bridgeId, data}`) into
|
|
43
|
+
* the service-host window. The preload resolves the page instance via
|
|
44
|
+
* `getCurrentPages()` and calls `page.setData(data)`, so the resulting `ub`
|
|
45
|
+
* publish flows back through the normal service→render tap — the panel
|
|
46
|
+
* refreshes from the runtime's own state, not an optimistic local echo.
|
|
47
|
+
*/
|
|
48
|
+
AppDataSetData: 'service-host:appdata:set-data',
|
|
41
49
|
};
|
|
42
50
|
// ── Custom simulator APIs (downstream-registered, main-process handlers) ──
|
|
43
51
|
// invoke: forwards an API call to the registry; result/reject propagates.
|
|
@@ -98,6 +106,9 @@ export const SimulatorWxmlChannel = {
|
|
|
98
106
|
export const SimulatorAppDataChannel = {
|
|
99
107
|
GetSnapshot: 'simulator:appdata:snapshot',
|
|
100
108
|
Event: 'simulator:appdata:event',
|
|
109
|
+
// renderer → main invoke: write an AppData-panel edit back into the running
|
|
110
|
+
// page (forwarded to the service host via ServiceHostChannel.AppDataSetData).
|
|
111
|
+
SetData: 'simulator:appdata:set-data',
|
|
101
112
|
};
|
|
102
113
|
// ── Workbench settings ───────────────────────────────────────────────────
|
|
103
114
|
export const WorkbenchSettingsChannel = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dimina-kit/devtools",
|
|
3
|
-
"version": "0.4.0-dev.
|
|
3
|
+
"version": "0.4.0-dev.20260718085557",
|
|
4
4
|
"description": "Dimina DevTools - modular developer tools for mini app debugging",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dimina",
|
|
@@ -85,10 +85,10 @@
|
|
|
85
85
|
"chrome-remote-interface": "^0.34.0",
|
|
86
86
|
"ws": "^8.20.0",
|
|
87
87
|
"zod": "^4.3.6",
|
|
88
|
-
"@dimina-kit/devkit": "0.1.2-dev.
|
|
89
|
-
"@dimina-kit/
|
|
90
|
-
"@dimina-kit/
|
|
91
|
-
"@dimina-kit/
|
|
88
|
+
"@dimina-kit/devkit": "0.1.2-dev.20260718085557",
|
|
89
|
+
"@dimina-kit/electron-deck": "0.1.0-dev.20260718085557",
|
|
90
|
+
"@dimina-kit/view-anchor": "0.1.0-dev.20260718085557",
|
|
91
|
+
"@dimina-kit/inspect": "0.4.0-dev.20260718085557"
|
|
92
92
|
},
|
|
93
93
|
"devDependencies": {
|
|
94
94
|
"@playwright/test": "^1.59.1",
|