dsh-gufa-code 1.3.49 → 1.3.51
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 +14 -4
- package/client.js +59 -1
- package/desktop/float/GufaFloat.m +12 -0
- package/desktop/float/PLATFORM-PROTOCOL.md +120 -0
- package/desktop/float/bin/README.md +12 -0
- package/desktop/float/bin/gufa-float-macos-arm64 +0 -0
- package/desktop/float/bin/gufa-float-macos-universal +0 -0
- package/desktop/float/bin/gufa-float-macos-x64 +0 -0
- package/desktop/float/bin/linux-x64/gufa-float-linux +0 -0
- package/desktop/float/bin/win-x64/gufa-float-win.exe +0 -0
- package/desktop/float/linux/Makefile +85 -0
- package/desktop/float/linux/README-LINUX.md +219 -0
- package/desktop/float/linux/json.c +498 -0
- package/desktop/float/linux/json.h +56 -0
- package/desktop/float/linux/log.c +48 -0
- package/desktop/float/linux/log.h +19 -0
- package/desktop/float/linux/main.c +1271 -0
- package/desktop/float/linux/x11.c +608 -0
- package/desktop/float/linux/x11.h +118 -0
- package/desktop/float/win/CMakeLists.txt +159 -0
- package/desktop/float/win/README-WIN.md +184 -0
- package/desktop/float/win/json.h +505 -0
- package/desktop/float/win/main.cpp +2246 -0
- package/desktop/float//345/217/244/346/263/225/347/274/226/347/250/213/346/202/254/346/265/256/345/261/202.app/Contents/Info.plist +2 -2
- package/desktop/float//345/217/244/346/263/225/347/274/226/347/250/213/346/202/254/346/265/256/345/261/202.app/Contents/MacOS/gufa-float +0 -0
- package/docs/FLOAT-ACCEPTANCE.md +85 -0
- package/docs/MODES.md +7 -0
- package/host/dev.js +384 -57
- package/package.json +1 -1
- package/scripts/build-float-linux.sh +15 -0
- package/scripts/build-float-macos.sh +1 -0
- package/scripts/build-float-win.ps1 +33 -0
- package/src/client/00-core.js +3 -0
- package/src/client/90-app.js +55 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# 在 Windows 本机构建摸鱼悬浮层 helper(Win32 + WebView2),并放到 host 期望的位置。
|
|
2
|
+
# 依赖:Visual Studio 2022(Desktop development with C++)+ Windows 10/11 SDK。
|
|
3
|
+
# 用法(仓库根目录,PowerShell):
|
|
4
|
+
# pwsh -File scripts/build-float-win.ps1
|
|
5
|
+
# # 或指定已解压的 WebView2 SDK:
|
|
6
|
+
# pwsh -File scripts/build-float-win.ps1 -WebView2SdkDir C:\wv2
|
|
7
|
+
$ErrorActionPreference = 'Stop'
|
|
8
|
+
$Root = Split-Path -Parent $PSScriptRoot
|
|
9
|
+
Set-Location $Root
|
|
10
|
+
|
|
11
|
+
param(
|
|
12
|
+
[string]$WebView2SdkDir = $env:WEBVIEW2_SDK_DIR,
|
|
13
|
+
[string]$WebView2Version = '1.0.2903.40'
|
|
14
|
+
)
|
|
15
|
+
if (-not $WebView2SdkDir) {
|
|
16
|
+
$tmp = Join-Path $env:TEMP 'gufa-webview2'
|
|
17
|
+
$zip = Join-Path $env:TEMP 'gufa-webview2.zip'
|
|
18
|
+
if (-not (Test-Path (Join-Path $tmp 'build/native/include/WebView2.h'))) {
|
|
19
|
+
Write-Host "下载 Microsoft.Web.WebView2 $WebView2Version ..."
|
|
20
|
+
Invoke-WebRequest "https://www.nuget.org/api/v2/package/Microsoft.Web.WebView2/$WebView2Version" -OutFile $zip
|
|
21
|
+
if (Test-Path $tmp) { Remove-Item $tmp -Recurse -Force }
|
|
22
|
+
Expand-Archive $zip -DestinationPath $tmp -Force
|
|
23
|
+
}
|
|
24
|
+
$WebView2SdkDir = $tmp
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
cmake -S desktop/float/win -B build-win -A x64 -DWEBVIEW2_SDK_DIR="$WebView2SdkDir"
|
|
28
|
+
cmake --build build-win --config Release
|
|
29
|
+
New-Item -ItemType Directory -Force desktop/float/bin/win-x64 | Out-Null
|
|
30
|
+
$exe = Get-ChildItem -Path build-win -Recurse -Filter *.exe | Where-Object { $_.Name -notlike 'vc_redist*' } | Select-Object -First 1
|
|
31
|
+
if (-not $exe) { throw '没有找到构建出的 exe' }
|
|
32
|
+
Copy-Item $exe.FullName desktop/float/bin/win-x64/gufa-float-win.exe -Force
|
|
33
|
+
Write-Host "built: desktop/float/bin/win-x64/gufa-float-win.exe"
|
package/src/client/00-core.js
CHANGED
|
@@ -1285,6 +1285,9 @@ html[data-gufa-ide] [role="dialog"] {
|
|
|
1285
1285
|
.gufa-float-owner{font-size:12.5px;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
1286
1286
|
.gufa-float-title{font-size:11px;color:var(--gufa-text-dim);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
1287
1287
|
.gufa-float-size{flex:0 0 auto;font-size:10.5px;color:var(--gufa-text-dim);font-variant-numeric:tabular-nums}
|
|
1288
|
+
.gufa-doctor{width:min(760px,94vw);max-height:min(720px,86vh);display:flex;flex-direction:column}
|
|
1289
|
+
.gufa-doctor-pre{margin:0;padding:12px 14px;font:11.5px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace;
|
|
1290
|
+
white-space:pre-wrap;word-break:break-all;background:transparent;color:var(--gufa-text);overflow:auto;flex:1 1 auto}
|
|
1288
1291
|
.gufa-float-permission{padding:16px}
|
|
1289
1292
|
.gufa-float-permission-title{font-size:13px;font-weight:600;margin-bottom:6px}
|
|
1290
1293
|
.gufa-session-workspace-btn{display:inline-flex;align-items:center;gap:4px;border:1px solid var(--gufa-border);background:var(--gufa-layer2);
|
package/src/client/90-app.js
CHANGED
|
@@ -159,6 +159,8 @@ G.GufaApp = function GufaApp(props) {
|
|
|
159
159
|
const [floatBusy, setFloatBusy] = useState(false)
|
|
160
160
|
/* 摸鱼窗口选择器:null | {status:'loading'|'ready'|'permission'|'error', windows:[], error:''} */
|
|
161
161
|
const [floatPicker, setFloatPicker] = useState(null)
|
|
162
|
+
/* 摸鱼自检:null | {status:'loading'|'ok'|'error', data:null|object, error:''} */
|
|
163
|
+
const [floatDoctor, setFloatDoctor] = useState(null)
|
|
162
164
|
/* 摸鱼模式(悬浮窗实例)与界面透明度 */
|
|
163
165
|
const [moyuMode] = useState(() => G.isFloatMode())
|
|
164
166
|
const [floatAlpha, setFloatAlpha] = useState(() => {
|
|
@@ -961,6 +963,20 @@ G.GufaApp = function GufaApp(props) {
|
|
|
961
963
|
}
|
|
962
964
|
}, [floatBusy])
|
|
963
965
|
|
|
966
|
+
/* 摸鱼自检:平台/helper/WebView2/辅助功能/X11 等现场信息,方便真机反馈 */
|
|
967
|
+
const openFloatDoctor = useCallback(async () => {
|
|
968
|
+
setFloatDoctor({ status: 'loading', data: null, error: '' })
|
|
969
|
+
try {
|
|
970
|
+
const value = await G.api('float.diagnostics')
|
|
971
|
+
setFloatDoctor({ status: 'ok', data: value ?? null, error: '' })
|
|
972
|
+
} catch (error) {
|
|
973
|
+
setFloatDoctor({ status: 'error', data: null, error: G.errorText(error) })
|
|
974
|
+
}
|
|
975
|
+
}, [])
|
|
976
|
+
const floatDoctorText = floatDoctor !== null && floatDoctor.data !== null
|
|
977
|
+
? JSON.stringify(floatDoctor.data, null, 2)
|
|
978
|
+
: (floatDoctor !== null && typeof floatDoctor.error === 'string' ? floatDoctor.error : '')
|
|
979
|
+
|
|
964
980
|
/* 选中某个 App 窗口 → 启动悬浮层并吸附它 */
|
|
965
981
|
/* 当前编辑器状态快照(进出摸鱼都以它为准) */
|
|
966
982
|
const buildFloatSnapshot = useCallback(() => ({
|
|
@@ -2552,6 +2568,7 @@ G.GufaApp = function GufaApp(props) {
|
|
|
2552
2568
|
'div',
|
|
2553
2569
|
{ className: 'gufa-modal-foot' },
|
|
2554
2570
|
h(G.IconButton, { title: '刷新列表', onClick: () => void openFloatPicker() }, h(G.Icon, { name: 'refresh', size: 14 })),
|
|
2571
|
+
h(G.Button, { onClick: () => void openFloatDoctor() }, '自检'),
|
|
2555
2572
|
h('span', { style: { flex: '1 1 auto' } }),
|
|
2556
2573
|
h(G.Button, { onClick: () => void startFloatFree() }, '自由悬浮(不吸附)'),
|
|
2557
2574
|
h(G.Button, { onClick: () => setFloatPicker(null) }, t('common.close')),
|
|
@@ -2559,6 +2576,44 @@ G.GufaApp = function GufaApp(props) {
|
|
|
2559
2576
|
),
|
|
2560
2577
|
)
|
|
2561
2578
|
: null),
|
|
2579
|
+
G.portal(floatDoctor !== null
|
|
2580
|
+
? h(
|
|
2581
|
+
'div',
|
|
2582
|
+
{
|
|
2583
|
+
className: 'gufa-float-backdrop',
|
|
2584
|
+
onMouseDown: (event) => { if (event.target === event.currentTarget) setFloatDoctor(null) },
|
|
2585
|
+
},
|
|
2586
|
+
h(
|
|
2587
|
+
'div',
|
|
2588
|
+
{ className: 'gufa-modal gufa-doctor', role: 'dialog', 'aria-modal': 'true', 'aria-label': '摸鱼自检' },
|
|
2589
|
+
h(
|
|
2590
|
+
'div',
|
|
2591
|
+
{ className: 'gufa-modal-head' },
|
|
2592
|
+
h(G.Icon, { name: 'monitor', size: 15 }),
|
|
2593
|
+
h('span', { style: { flex: '1 1 auto' } }, '摸鱼自检(复制发给开发者排查)'),
|
|
2594
|
+
h(G.IconButton, { title: t('common.close'), onClick: () => setFloatDoctor(null) }, h(G.Icon, { name: 'close', size: 14 })),
|
|
2595
|
+
),
|
|
2596
|
+
h(
|
|
2597
|
+
'div',
|
|
2598
|
+
{ className: 'gufa-modal-body', style: { padding: 0 } },
|
|
2599
|
+
floatDoctor.status === 'loading'
|
|
2600
|
+
? h('div', { className: 'gufa-graph-loading', style: { height: 90 } }, h(G.Spinner), '正在检查平台 / helper / 运行时…')
|
|
2601
|
+
: floatDoctor.status === 'error'
|
|
2602
|
+
? h('div', { className: 'gufa-float-permission' }, h('div', { className: 'gufa-error-banner' }, floatDoctor.error))
|
|
2603
|
+
: h('pre', { className: 'gufa-doctor-pre gufa-scroll' }, floatDoctorText),
|
|
2604
|
+
),
|
|
2605
|
+
h(
|
|
2606
|
+
'div',
|
|
2607
|
+
{ className: 'gufa-modal-foot' },
|
|
2608
|
+
h('span', { style: { flex: '1 1 auto' } }),
|
|
2609
|
+
floatDoctor.status === 'ok'
|
|
2610
|
+
? h(G.Button, { onClick: () => { void navigator.clipboard?.writeText(floatDoctorText) } }, '复制')
|
|
2611
|
+
: null,
|
|
2612
|
+
h(G.Button, { onClick: () => setFloatDoctor(null) }, t('common.close')),
|
|
2613
|
+
),
|
|
2614
|
+
),
|
|
2615
|
+
)
|
|
2616
|
+
: null),
|
|
2562
2617
|
G.portal(sessionsOpen ? renderSessionsDialog() : null),
|
|
2563
2618
|
G.portal(shortcutsOpen ? renderShortcutsDialog() : null),
|
|
2564
2619
|
)
|