bnpanel 0.5.6 → 0.5.7
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 +35 -6
- package/package.json +1 -1
package/client.js
CHANGED
|
@@ -127,7 +127,12 @@
|
|
|
127
127
|
.bn-reel video{display:block;width:100%;height:240px;object-fit:contain;background:#111;border-radius:16px;cursor:pointer}
|
|
128
128
|
.bn-reel-meta{display:flex;align-items:center;gap:8px;margin-top:8px}
|
|
129
129
|
.bn-reel-meta strong{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:650}
|
|
130
|
-
|
|
130
|
+
/* 顶层弹层:DSH 窗口按钮在宿主层,插件内部 z-index 盖不住。popover 升到文档顶层后再画全屏。 */
|
|
131
|
+
.bn-player-back{position:fixed;inset:0;z-index:2147483000;background:rgba(10,10,10,.62);display:grid;place-items:center;padding:calc(28px + env(titlebar-area-height, 0px)) 28px 28px;width:auto;height:auto;max-width:none;max-height:none;margin:0;border:0;overflow:visible;color:inherit}
|
|
132
|
+
@supports selector(:popover-open){
|
|
133
|
+
.bn-layer[popover]:not(:popover-open){display:none}
|
|
134
|
+
.bn-player-back[popover]:popover-open{display:grid}
|
|
135
|
+
}
|
|
131
136
|
.bn-player{width:min(92vw,calc((90vh - 64px) * var(--ar,1.777)));max-height:90vh;background:#111;border-radius:16px;overflow:hidden;display:flex;flex-direction:column;box-shadow:var(--bn-shadow-hover)}
|
|
132
137
|
.bn-player video{display:block;width:100%;height:auto;max-height:calc(90vh - 64px);aspect-ratio:var(--ar,1.777);object-fit:contain;background:#000}
|
|
133
138
|
.bn-player-bar{display:flex;align-items:center;gap:10px;padding:10px 14px;color:#f4f1ea;background:#111;flex:none}
|
|
@@ -135,8 +140,11 @@
|
|
|
135
140
|
.bn-player-count{flex:none;color:rgba(244,241,234,.55);font-size:12px;font-variant-numeric:tabular-nums}
|
|
136
141
|
.bn-player-bar .bn-btn{background:#1c1c1c;color:#f4f1ea;border-color:#333}
|
|
137
142
|
.bn-player-bar .bn-btn.ghost{background:transparent;color:#f4f1ea;border-color:transparent}
|
|
138
|
-
.bn-docs-back{position:fixed;inset:0;z-index:
|
|
139
|
-
|
|
143
|
+
.bn-docs-back{position:fixed;inset:0;z-index:2147483000;background:rgba(10,10,10,.28);width:auto;height:auto;max-width:none;max-height:none;margin:0;border:0;padding:0;overflow:visible;color:inherit}
|
|
144
|
+
@supports selector(:popover-open){
|
|
145
|
+
.bn-docs-back[popover]:popover-open{display:block}
|
|
146
|
+
}
|
|
147
|
+
.bn-docs{position:absolute;top:env(titlebar-area-height, 0px);right:0;bottom:0;width:min(560px,100%);background:var(--bn-surface);color:var(--bn-ink);border-left:1px solid var(--bn-line);box-shadow:var(--bn-shadow-hover);display:flex;flex-direction:column}
|
|
140
148
|
.bn-docs-bar{display:flex;align-items:center;gap:8px;padding:12px 14px;border-bottom:1px solid var(--bn-line);flex:none}
|
|
141
149
|
.bn-docs-bar strong{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
142
150
|
.bn-docs-bar a.bn-btn{text-decoration:none}
|
|
@@ -309,7 +317,8 @@
|
|
|
309
317
|
|
|
310
318
|
function createPanel(React, ReactDOM, dshNav) {
|
|
311
319
|
const h = React.createElement;
|
|
312
|
-
const { useState, useEffect, useRef, useCallback } = React;
|
|
320
|
+
const { useState, useEffect, useLayoutEffect, useRef, useCallback } = React;
|
|
321
|
+
const useIsoLayout = useLayoutEffect || useEffect;
|
|
313
322
|
const revealCreationSession = dshNav && typeof dshNav.revealCreationSession === 'function'
|
|
314
323
|
? dshNav.revealCreationSession
|
|
315
324
|
: null;
|
|
@@ -628,6 +637,26 @@
|
|
|
628
637
|
window.addEventListener('keydown', onKey);
|
|
629
638
|
return () => window.removeEventListener('keydown', onKey);
|
|
630
639
|
}, [docsOpen]);
|
|
640
|
+
const caseOpen = !!player;
|
|
641
|
+
useIsoLayout(() => {
|
|
642
|
+
const opened = [];
|
|
643
|
+
document.querySelectorAll('.bn-layer').forEach((node) => {
|
|
644
|
+
if (typeof node.showPopover !== 'function') return;
|
|
645
|
+
try {
|
|
646
|
+
if (!node.matches(':popover-open')) node.showPopover();
|
|
647
|
+
opened.push(node);
|
|
648
|
+
} catch (err) {
|
|
649
|
+
node.removeAttribute('popover');
|
|
650
|
+
}
|
|
651
|
+
});
|
|
652
|
+
return () => {
|
|
653
|
+
opened.forEach((node) => {
|
|
654
|
+
try {
|
|
655
|
+
if (node.isConnected && node.matches(':popover-open')) node.hidePopover();
|
|
656
|
+
} catch (err) { /* 节点已经卸下 */ }
|
|
657
|
+
});
|
|
658
|
+
};
|
|
659
|
+
}, [docsOpen, caseOpen]);
|
|
631
660
|
|
|
632
661
|
const openContact = async () => {
|
|
633
662
|
setContactOpen(true);
|
|
@@ -1310,7 +1339,7 @@
|
|
|
1310
1339
|
),
|
|
1311
1340
|
) : null,
|
|
1312
1341
|
|
|
1313
|
-
docsOpen && doc ? h('div', { className: 'bn-docs-back', onClick: () => setDocsOpen(false) },
|
|
1342
|
+
docsOpen && doc ? h('div', { className: 'bn-docs-back bn-layer', popover: 'manual', onClick: () => setDocsOpen(false) },
|
|
1314
1343
|
h('aside', { className: 'bn-docs', onClick: (event) => event.stopPropagation() },
|
|
1315
1344
|
h('div', { className: 'bn-docs-bar' },
|
|
1316
1345
|
h('strong', null, doc.title),
|
|
@@ -1355,7 +1384,7 @@
|
|
|
1355
1384
|
const rows = playerRows();
|
|
1356
1385
|
const at = Math.max(0, rows.findIndex((row) => row.id === player.id));
|
|
1357
1386
|
const many = rows.length > 1;
|
|
1358
|
-
return h('div', { className: 'bn-player-back', onClick: (event) => { if (event.target === event.currentTarget) closePlayer(); } },
|
|
1387
|
+
return h('div', { className: 'bn-player-back bn-layer', popover: 'manual', onClick: (event) => { if (event.target === event.currentTarget) closePlayer(); } },
|
|
1359
1388
|
h('div', { id: 'bn-player', className: 'bn-player', style: { '--ar': String(playerRatio) }, role: 'dialog' },
|
|
1360
1389
|
h('video', {
|
|
1361
1390
|
key: player.id,
|