dsh-gufa-code 1.3.3 → 1.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/client.js CHANGED
@@ -21,6 +21,29 @@ G.pendingEntryWorkspace = null
21
21
  G.ctx = null
22
22
  G.h = h
23
23
  G.React = React
24
+ /** 官方同款 portal:把弹窗渲染到 body(与 DSH 自己的设置/会话弹窗同一层级机制),
25
+ * 避免被右侧停靠会话(body 级 fixed z-index 2147483040)盖住。 */
26
+ G.portal = (function createPortalHelper() {
27
+ let ReactDOM = null
28
+ try {
29
+ ReactDOM = require('react-dom')
30
+ } catch {
31
+ ReactDOM = null
32
+ }
33
+ const ensureHost = () => {
34
+ let host = document.getElementById('gufa-portal-root')
35
+ if (host === null) {
36
+ host = document.createElement('div')
37
+ host.id = 'gufa-portal-root'
38
+ document.body.appendChild(host)
39
+ }
40
+ return host
41
+ }
42
+ return function portal(content) {
43
+ if (ReactDOM === null || typeof ReactDOM.createPortal !== 'function' || typeof document === 'undefined') return content
44
+ return ReactDOM.createPortal(content, ensureHost())
45
+ }
46
+ })()
24
47
  G.hooks = { useState, useEffect, useRef, useMemo, useCallback, useLayoutEffect }
25
48
 
26
49
  /* ── 事件总线(零件之间解耦:SSH → 终端 发送命令等) ───────────────────── */
@@ -1124,6 +1147,9 @@ html[data-gufa-ide] [role="dialog"] {
1124
1147
  .gufa-session-group-count{font-size:10.5px;opacity:.6;font-variant-numeric:tabular-nums}
1125
1148
  .gufa-session-group[data-current] .gufa-session-group-head{color:var(--gufa-text)}
1126
1149
  .gufa-session-group .gufa-session-row{margin-left:10px}
1150
+ /* 官方同款 body 级 portal 容器(弹窗渲染到这里,天然在停靠会话之上) */
1151
+ #gufa-portal-root{position:fixed;inset:0;z-index:2147483350;pointer-events:none}
1152
+ #gufa-portal-root>*{pointer-events:auto}
1127
1153
  /* 摸鱼模式:App 窗口选择器 */
1128
1154
  .gufa-float-backdrop{position:fixed;inset:0;z-index:2147483200;display:flex;align-items:center;justify-content:center;
1129
1155
  background:rgba(0,0,0,0.42);padding:24px;box-sizing:border-box}
@@ -11393,7 +11419,7 @@ G.GufaApp = function GufaApp(props) {
11393
11419
  ),
11394
11420
  ),
11395
11421
  typeof G.UsageDock === 'function' ? h(G.UsageDock, { active: true }) : null,
11396
- workspaceDialog === null
11422
+ G.portal(workspaceDialog === null
11397
11423
  ? null
11398
11424
  : h(
11399
11425
  'div',
@@ -11457,7 +11483,8 @@ G.GufaApp = function GufaApp(props) {
11457
11483
  ),
11458
11484
  ),
11459
11485
  ),
11460
- branchMenu === null
11486
+ ),
11487
+ G.portal(branchMenu === null
11461
11488
  ? null
11462
11489
  : h(
11463
11490
  'div',
@@ -11526,9 +11553,10 @@ G.GufaApp = function GufaApp(props) {
11526
11553
  ),
11527
11554
  ),
11528
11555
  ),
11556
+ ),
11529
11557
  /* 弹窗 */
11530
- modal === null ? null : renderModal(),
11531
- floatPicker !== null
11558
+ G.portal(modal === null ? null : renderModal()),
11559
+ G.portal(floatPicker !== null
11532
11560
  ? h(
11533
11561
  'div',
11534
11562
  {
@@ -11602,9 +11630,9 @@ G.GufaApp = function GufaApp(props) {
11602
11630
  ),
11603
11631
  ),
11604
11632
  )
11605
- : null,
11606
- sessionsOpen ? renderSessionsDialog() : null,
11607
- shortcutsOpen ? renderShortcutsDialog() : null,
11633
+ : null),
11634
+ G.portal(sessionsOpen ? renderSessionsDialog() : null),
11635
+ G.portal(shortcutsOpen ? renderShortcutsDialog() : null),
11608
11636
  )
11609
11637
 
11610
11638
  function renderShortcutsDialog() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-gufa-code",
3
- "version": "1.3.3",
3
+ "version": "1.3.4",
4
4
  "description": "古法编程 · AI 辅助:一键把 DSH 主面板变成 VS Code 风格 IDE(Monaco 编辑器、文件树、Git、SSH、真实终端 + 右侧官方会话);主张亲手写、每个改动心中有数,AI 是助理、你是第一责任人",
5
5
  "icon": "icon.svg",
6
6
  "keywords": [
@@ -13,6 +13,29 @@ G.pendingEntryWorkspace = null
13
13
  G.ctx = null
14
14
  G.h = h
15
15
  G.React = React
16
+ /** 官方同款 portal:把弹窗渲染到 body(与 DSH 自己的设置/会话弹窗同一层级机制),
17
+ * 避免被右侧停靠会话(body 级 fixed z-index 2147483040)盖住。 */
18
+ G.portal = (function createPortalHelper() {
19
+ let ReactDOM = null
20
+ try {
21
+ ReactDOM = require('react-dom')
22
+ } catch {
23
+ ReactDOM = null
24
+ }
25
+ const ensureHost = () => {
26
+ let host = document.getElementById('gufa-portal-root')
27
+ if (host === null) {
28
+ host = document.createElement('div')
29
+ host.id = 'gufa-portal-root'
30
+ document.body.appendChild(host)
31
+ }
32
+ return host
33
+ }
34
+ return function portal(content) {
35
+ if (ReactDOM === null || typeof ReactDOM.createPortal !== 'function' || typeof document === 'undefined') return content
36
+ return ReactDOM.createPortal(content, ensureHost())
37
+ }
38
+ })()
16
39
  G.hooks = { useState, useEffect, useRef, useMemo, useCallback, useLayoutEffect }
17
40
 
18
41
  /* ── 事件总线(零件之间解耦:SSH → 终端 发送命令等) ───────────────────── */
@@ -1116,6 +1139,9 @@ html[data-gufa-ide] [role="dialog"] {
1116
1139
  .gufa-session-group-count{font-size:10.5px;opacity:.6;font-variant-numeric:tabular-nums}
1117
1140
  .gufa-session-group[data-current] .gufa-session-group-head{color:var(--gufa-text)}
1118
1141
  .gufa-session-group .gufa-session-row{margin-left:10px}
1142
+ /* 官方同款 body 级 portal 容器(弹窗渲染到这里,天然在停靠会话之上) */
1143
+ #gufa-portal-root{position:fixed;inset:0;z-index:2147483350;pointer-events:none}
1144
+ #gufa-portal-root>*{pointer-events:auto}
1119
1145
  /* 摸鱼模式:App 窗口选择器 */
1120
1146
  .gufa-float-backdrop{position:fixed;inset:0;z-index:2147483200;display:flex;align-items:center;justify-content:center;
1121
1147
  background:rgba(0,0,0,0.42);padding:24px;box-sizing:border-box}
@@ -2005,7 +2005,7 @@ G.GufaApp = function GufaApp(props) {
2005
2005
  ),
2006
2006
  ),
2007
2007
  typeof G.UsageDock === 'function' ? h(G.UsageDock, { active: true }) : null,
2008
- workspaceDialog === null
2008
+ G.portal(workspaceDialog === null
2009
2009
  ? null
2010
2010
  : h(
2011
2011
  'div',
@@ -2069,7 +2069,8 @@ G.GufaApp = function GufaApp(props) {
2069
2069
  ),
2070
2070
  ),
2071
2071
  ),
2072
- branchMenu === null
2072
+ ),
2073
+ G.portal(branchMenu === null
2073
2074
  ? null
2074
2075
  : h(
2075
2076
  'div',
@@ -2138,9 +2139,10 @@ G.GufaApp = function GufaApp(props) {
2138
2139
  ),
2139
2140
  ),
2140
2141
  ),
2142
+ ),
2141
2143
  /* 弹窗 */
2142
- modal === null ? null : renderModal(),
2143
- floatPicker !== null
2144
+ G.portal(modal === null ? null : renderModal()),
2145
+ G.portal(floatPicker !== null
2144
2146
  ? h(
2145
2147
  'div',
2146
2148
  {
@@ -2214,9 +2216,9 @@ G.GufaApp = function GufaApp(props) {
2214
2216
  ),
2215
2217
  ),
2216
2218
  )
2217
- : null,
2218
- sessionsOpen ? renderSessionsDialog() : null,
2219
- shortcutsOpen ? renderShortcutsDialog() : null,
2219
+ : null),
2220
+ G.portal(sessionsOpen ? renderSessionsDialog() : null),
2221
+ G.portal(shortcutsOpen ? renderShortcutsDialog() : null),
2220
2222
  )
2221
2223
 
2222
2224
  function renderShortcutsDialog() {