@uzuhq/code-cli 0.4.0 → 0.4.1
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/harness/dev-button.js +7 -1
- package/dist/harness/mount.js +12 -0
- package/package.json +1 -1
|
@@ -17,7 +17,7 @@ function isInspectorOpen() {
|
|
|
17
17
|
* UZU ボタン (button 要素) にタップメニューを配線する。 メニューはボタン直下に出る。
|
|
18
18
|
*/
|
|
19
19
|
export function attachUzuMenu(button, opts = {}) {
|
|
20
|
-
const { stateGetter, playerCount, adminEnabled, resetGame, onOpenMobile } = opts;
|
|
20
|
+
const { stateGetter, playerCount, adminEnabled, resetGame, onOpenMobile, onOpenSingleView } = opts;
|
|
21
21
|
let popup = null;
|
|
22
22
|
const closePopup = () => {
|
|
23
23
|
popup?.remove();
|
|
@@ -81,6 +81,12 @@ export function attachUzuMenu(button, opts = {}) {
|
|
|
81
81
|
el.appendChild(b);
|
|
82
82
|
return b;
|
|
83
83
|
};
|
|
84
|
+
if (onOpenSingleView) {
|
|
85
|
+
addAction('🖥 この画面だけ開く', '#0984e3', '#74b9ff', () => {
|
|
86
|
+
onOpenSingleView();
|
|
87
|
+
closePopup();
|
|
88
|
+
});
|
|
89
|
+
}
|
|
84
90
|
if (onOpenMobile) {
|
|
85
91
|
addAction('📱 スマホで開く', '#0984e3', '#74b9ff', () => {
|
|
86
92
|
onOpenMobile();
|
package/dist/harness/mount.js
CHANGED
|
@@ -320,6 +320,15 @@ function resolveMobileUrl(opts, playerIndex) {
|
|
|
320
320
|
const port = location.port ? `:${location.port}` : '';
|
|
321
321
|
return `http://${host}${port}/?player=${playerIndex}`;
|
|
322
322
|
}
|
|
323
|
+
/**
|
|
324
|
+
* その player の単体表示 (`?player=N`) URL。 実機リンクと違い LAN host には
|
|
325
|
+
* 読み替えず、 いま harness を見ている origin をそのまま使う。
|
|
326
|
+
*/
|
|
327
|
+
function singleViewUrl(playerIndex) {
|
|
328
|
+
const url = new URL(location.href);
|
|
329
|
+
url.searchParams.set('player', String(playerIndex));
|
|
330
|
+
return url.toString();
|
|
331
|
+
}
|
|
323
332
|
/** 携帯リンクの QR ポップアップ (カメラで読めばそのキャラの画面がスマホで開く)。 */
|
|
324
333
|
function openMobileQrPopup(url, label) {
|
|
325
334
|
const backdrop = document.createElement('div');
|
|
@@ -467,6 +476,9 @@ onUzuClick) {
|
|
|
467
476
|
resetGame: opts.resetGame,
|
|
468
477
|
playerCount: opts.playerCount,
|
|
469
478
|
adminEnabled: opts.seats.some((s) => s.kind === 'admin'),
|
|
479
|
+
onOpenSingleView: () => {
|
|
480
|
+
window.open(singleViewUrl(playerIndex), '_blank', 'noopener');
|
|
481
|
+
},
|
|
470
482
|
});
|
|
471
483
|
}
|
|
472
484
|
wrap.appendChild(uzu);
|