dsh-plugin-inspiration-workbench 0.1.1 → 0.3.0
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 +17 -1
- package/lib/client.js +590 -58
- package/lib/client.js.map +3 -3
- package/package.json +10 -6
- package/scripts/build-client.mjs +1 -1
- package/src/client/board.js +491 -55
- package/src/client/icons.js +5 -0
- package/src/client/index.jsx +56 -0
- package/src/client/persistence.js +27 -0
- package/src/client/popovers.js +2 -0
- package/src/client/styles.css +67 -5
- package/src/host/index.js +61 -1
package/src/client/board.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* can never re-create the composer or the textarea a user is typing into.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { fetchRemoteLayout, pushRemoteLayout, subscribeRemoteLayout } from './persistence';
|
|
9
|
+
import { fetchRemoteLayout, pushRemoteLayout, subscribeRemoteLayout, fetchCanvases, pushCanvases } from './persistence';
|
|
10
10
|
|
|
11
11
|
import { clamp, el } from './dom';
|
|
12
12
|
import { icon } from './icons';
|
|
@@ -17,6 +17,7 @@ import { createCardTools } from './card-tools';
|
|
|
17
17
|
import { createModelMenu, createArrangeMenu, createSettingsMenu, createWorkspaceMenu } from './popovers';
|
|
18
18
|
|
|
19
19
|
const STORAGE_KEY = 'dsh.inspiration-workbench.v1';
|
|
20
|
+
const CANVAS_KEY = 'dsh.inspiration-workbench.canvases.v1';
|
|
20
21
|
const DEFAULT_W = 380;
|
|
21
22
|
const DEFAULT_H = 500;
|
|
22
23
|
const GAP = 20;
|
|
@@ -43,6 +44,8 @@ export function createBoard({ host, adapter, approvals, t, onOpenSession }) {
|
|
|
43
44
|
focusedId: null,
|
|
44
45
|
savedView: false,
|
|
45
46
|
board: { active: false, key: 'status', saved: new Map() },
|
|
47
|
+
canvases: [],
|
|
48
|
+
activeCanvas: null,
|
|
46
49
|
};
|
|
47
50
|
|
|
48
51
|
// Turn expansion survives a remote layout apply (which rebuilds card DOM):
|
|
@@ -116,6 +119,8 @@ export function createBoard({ host, adapter, approvals, t, onOpenSession }) {
|
|
|
116
119
|
|
|
117
120
|
const btnNew = el('button', 'iwb-btn primary', icon('plus', 13) + '<span>' + t('new') + '</span>');
|
|
118
121
|
btnNew.type = 'button';
|
|
122
|
+
const btnCanvas = el('button', 'iwb-btn', icon('canvas', 13) + '<span>' + t('canvas') + '</span>');
|
|
123
|
+
btnCanvas.type = 'button';
|
|
119
124
|
const btnArrange = el('button', 'iwb-btn', icon('arrange', 13) + '<span>' + t('arrange') + '</span>');
|
|
120
125
|
btnArrange.type = 'button';
|
|
121
126
|
const btnBoard = el('button', 'iwb-btn', icon('board', 13) + '<span>' + t('boardMode') + '</span>');
|
|
@@ -132,7 +137,7 @@ export function createBoard({ host, adapter, approvals, t, onOpenSession }) {
|
|
|
132
137
|
const btnSettings = el('button', 'iwb-btn', icon('sliders', 13) + '<span>' + t('settings') + '</span>');
|
|
133
138
|
btnSettings.type = 'button';
|
|
134
139
|
const actions = el('div', 'iwb-toolbar-actions');
|
|
135
|
-
actions.append(todoBar, btnNew, btnNote, btnArrange, btnBoard, btnFit, btnCollapse, btnSettings);
|
|
140
|
+
actions.append(todoBar, btnNew, btnNote, btnCanvas, btnArrange, btnBoard, btnFit, btnCollapse, btnSettings);
|
|
136
141
|
toolbar.append(titles, hint, actions);
|
|
137
142
|
|
|
138
143
|
const canvas = el('div', 'iwb-canvas');
|
|
@@ -141,6 +146,11 @@ export function createBoard({ host, adapter, approvals, t, onOpenSession }) {
|
|
|
141
146
|
canvas.setAttribute('aria-label', t('a11y.canvas'));
|
|
142
147
|
const world = el('div', 'iwb-world');
|
|
143
148
|
canvas.appendChild(world);
|
|
149
|
+
const SVG_NS = 'http://www.w3.org/2000/svg';
|
|
150
|
+
const linkLayer = document.createElementNS(SVG_NS, 'svg');
|
|
151
|
+
linkLayer.setAttribute('class', 'iwb-links');
|
|
152
|
+
linkLayer.setAttribute('aria-hidden', 'true');
|
|
153
|
+
world.appendChild(linkLayer);
|
|
144
154
|
|
|
145
155
|
const emptyState = el(
|
|
146
156
|
'div',
|
|
@@ -180,7 +190,7 @@ export function createBoard({ host, adapter, approvals, t, onOpenSession }) {
|
|
|
180
190
|
tools.closeRefPicker();
|
|
181
191
|
},
|
|
182
192
|
});
|
|
183
|
-
const arrangeMenu = createArrangeMenu({ t, state, canvas, fitView, saveSoon, toast, defaultSize: { w: DEFAULT_W, h: DEFAULT_H }, gap: GAP, anchor: btnArrange });
|
|
193
|
+
const arrangeMenu = createArrangeMenu({ t, state, canvas, fitView, saveSoon, toast, defaultSize: { w: DEFAULT_W, h: DEFAULT_H }, gap: GAP, anchor: btnArrange, afterArrange: () => schedulePipelines() });
|
|
184
194
|
const workspaceMenu = createWorkspaceMenu({
|
|
185
195
|
t,
|
|
186
196
|
adapter,
|
|
@@ -341,6 +351,7 @@ export function createBoard({ host, adapter, approvals, t, onOpenSession }) {
|
|
|
341
351
|
function layoutStack(stack) {
|
|
342
352
|
const cards = stackCards(stack);
|
|
343
353
|
if (!cards.length) return;
|
|
354
|
+
schedulePipelines();
|
|
344
355
|
state.zTop += cards.length + 1;
|
|
345
356
|
const base = state.zTop;
|
|
346
357
|
const inStack = cards.length > 1;
|
|
@@ -493,14 +504,16 @@ export function createBoard({ host, adapter, approvals, t, onOpenSession }) {
|
|
|
493
504
|
'<span class="iwb-stack-badge" hidden></span>' +
|
|
494
505
|
'<span class="iwb-pipe-badge" hidden></span>' +
|
|
495
506
|
'<span class="iwb-actions">' +
|
|
496
|
-
'<button type="button" data-act="pipe" title="' + t('pipe.title') + '" aria-label="' + t('pipe.title') + '">' + icon('flow') + '</button>' +
|
|
497
507
|
'<button type="button" data-act="outline" title="' + t('card.outline') + '" aria-label="' + t('card.outline') + '">' + icon('list') + '</button>' +
|
|
498
508
|
'<button type="button" data-act="search" title="' + t('card.search') + '" aria-label="' + t('card.search') + '">' + icon('search') + '</button>' +
|
|
509
|
+
'<button type="button" data-act="more" class="iwb-act-more" title="' + t('card.more') + '" aria-label="' + t('card.more') + '">' + icon('more') + '</button>' +
|
|
510
|
+
'<button type="button" data-act="close" title="' + t('remove') + '" aria-label="' + t('remove') + '">' + icon('close') + '</button>' +
|
|
511
|
+
'<span class="iwb-acts-more" hidden>' +
|
|
499
512
|
'<button type="button" data-act="pin" title="' + t('card.pin') + '" aria-label="' + t('card.pin') + '">' + icon('pin') + '</button>' +
|
|
500
513
|
'<button type="button" data-act="copy" title="' + t('card.copy') + '" aria-label="' + t('card.copy') + '">' + icon('copy') + '</button>' +
|
|
501
514
|
'<button type="button" data-act="detach" title="' + t('detach') + '" aria-label="' + t('detach') + '" style="display:none">' + icon('layers') + '</button>' +
|
|
502
515
|
'<button type="button" data-act="open" title="' + t('openNative') + '" aria-label="' + t('openNative') + '">' + icon('open') + '</button>' +
|
|
503
|
-
'
|
|
516
|
+
'</span>' +
|
|
504
517
|
'</span>' +
|
|
505
518
|
'</header>' +
|
|
506
519
|
'<div class="iwb-search" hidden><input class="iwb-search-input" type="text" /><span class="iwb-search-count"></span></div>' +
|
|
@@ -559,6 +572,7 @@ export function createBoard({ host, adapter, approvals, t, onOpenSession }) {
|
|
|
559
572
|
node.querySelector('[data-act="outline"]')?.remove();
|
|
560
573
|
node.querySelector('[data-act="pipe"]')?.remove();
|
|
561
574
|
node.querySelector('.iwb-pipe-badge')?.remove();
|
|
575
|
+
|
|
562
576
|
node.querySelector('.iwb-search')?.remove();
|
|
563
577
|
noteBody(card);
|
|
564
578
|
bindCard(card);
|
|
@@ -610,6 +624,7 @@ export function createBoard({ host, adapter, approvals, t, onOpenSession }) {
|
|
|
610
624
|
node.dataset.sessionId = sessionId;
|
|
611
625
|
card.el = node;
|
|
612
626
|
world.appendChild(node);
|
|
627
|
+
node.appendChild(el('span', 'iwb-port'));
|
|
613
628
|
node.querySelector('.iwb-card-title').textContent = card.title;
|
|
614
629
|
const bodyRegion = node.querySelector('.iwb-body');
|
|
615
630
|
bodyRegion.tabIndex = 0;
|
|
@@ -617,12 +632,14 @@ export function createBoard({ host, adapter, approvals, t, onOpenSession }) {
|
|
|
617
632
|
bodyRegion.setAttribute('aria-label', t('a11y.body'));
|
|
618
633
|
|
|
619
634
|
bindCard(card);
|
|
635
|
+
bindPort(card);
|
|
620
636
|
for (const [boardKey, value] of expandedTurns) {
|
|
621
637
|
if (!boardKey.startsWith(sessionId + ':')) continue;
|
|
622
638
|
card.toolOpen.set('turn:' + boardKey.slice(sessionId.length + 1), value);
|
|
623
639
|
}
|
|
624
640
|
renderFoot(card);
|
|
625
641
|
renderPipeBadge(card);
|
|
642
|
+
schedulePipelines();
|
|
626
643
|
state.cards.push(card);
|
|
627
644
|
updateCounts();
|
|
628
645
|
updateEmptyState();
|
|
@@ -944,6 +961,253 @@ export function createBoard({ host, adapter, approvals, t, onOpenSession }) {
|
|
|
944
961
|
toast(t('batch.closed').replace('{n}', String(picked.length)));
|
|
945
962
|
}
|
|
946
963
|
|
|
964
|
+
// ── named canvases ───────────────────────────────────────────────────
|
|
965
|
+
let canvasPop = null;
|
|
966
|
+
|
|
967
|
+
function closeCanvasMenu() {
|
|
968
|
+
canvasPop?.remove();
|
|
969
|
+
canvasPop = null;
|
|
970
|
+
}
|
|
971
|
+
|
|
972
|
+
function loadLocalCanvases() {
|
|
973
|
+
try {
|
|
974
|
+
const raw = window.localStorage.getItem(CANVAS_KEY);
|
|
975
|
+
if (!raw) return null;
|
|
976
|
+
const parsed = JSON.parse(raw);
|
|
977
|
+
if (!parsed || !Array.isArray(parsed.canvases)) return null;
|
|
978
|
+
return parsed;
|
|
979
|
+
} catch {
|
|
980
|
+
return null;
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
|
|
984
|
+
function syncCanvases() {
|
|
985
|
+
state.canvases = Array.isArray(state.canvases) ? state.canvases : [];
|
|
986
|
+
return state.canvases;
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
function storeCanvases() {
|
|
990
|
+
const payload = { canvases: state.canvases, activeCanvas: state.activeCanvas };
|
|
991
|
+
try {
|
|
992
|
+
window.localStorage.setItem(CANVAS_KEY, JSON.stringify(payload));
|
|
993
|
+
} catch {
|
|
994
|
+
/* private mode: the Host copy still holds it */
|
|
995
|
+
}
|
|
996
|
+
void pushCanvases(payload.canvases, payload.activeCanvas);
|
|
997
|
+
renderCanvasButton();
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
function renderCanvasButton() {
|
|
1001
|
+
const active = syncCanvases().find((canvas) => canvas.id === state.activeCanvas);
|
|
1002
|
+
// Keep the verb ("画布") first so the affordance never disappears, and append
|
|
1003
|
+
// the active canvas name for orientation.
|
|
1004
|
+
btnCanvas.querySelector('span').textContent = active ? t('canvas') + ' · ' + active.name : t('canvas');
|
|
1005
|
+
btnCanvas.title = active ? t('canvas.active').replace('{name}', active.name) : t('canvas.title');
|
|
1006
|
+
btnCanvas.classList.toggle('iwb-btn-active', Boolean(active));
|
|
1007
|
+
}
|
|
1008
|
+
|
|
1009
|
+
/** Only canvases that actually carry a board are switchable. */
|
|
1010
|
+
function usableCanvases(list) {
|
|
1011
|
+
return (Array.isArray(list) ? list : []).filter(
|
|
1012
|
+
(canvas) => canvas && typeof canvas.id === 'string' && canvas.layout && Array.isArray(canvas.layout.cards)
|
|
1013
|
+
);
|
|
1014
|
+
}
|
|
1015
|
+
|
|
1016
|
+
/** Merge Host and localStorage copies, preferring whichever knows the layout. */
|
|
1017
|
+
function mergeCanvases(remoteList, localList) {
|
|
1018
|
+
const byId = new Map();
|
|
1019
|
+
for (const canvas of usableCanvases(localList)) byId.set(canvas.id, canvas);
|
|
1020
|
+
for (const canvas of usableCanvases(remoteList)) {
|
|
1021
|
+
const existing = byId.get(canvas.id);
|
|
1022
|
+
if (!existing || (canvas.savedAt || 0) >= (existing.savedAt || 0)) byId.set(canvas.id, canvas);
|
|
1023
|
+
}
|
|
1024
|
+
return [...byId.values()].sort((left, right) => (left.savedAt || 0) - (right.savedAt || 0));
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
async function loadCanvases() {
|
|
1028
|
+
const remote = await fetchCanvases();
|
|
1029
|
+
const local = loadLocalCanvases();
|
|
1030
|
+
const remoteCanvases = remote?.canvases || [];
|
|
1031
|
+
const localCanvases = local?.canvases || [];
|
|
1032
|
+
const merged = mergeCanvases(remoteCanvases, localCanvases);
|
|
1033
|
+
state.canvases = merged;
|
|
1034
|
+
state.activeCanvas = remote?.activeCanvas || local?.activeCanvas || null;
|
|
1035
|
+
if (!merged.some((canvas) => canvas.id === state.activeCanvas)) state.activeCanvas = null;
|
|
1036
|
+
renderCanvasButton();
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1039
|
+
function canvasStamp() {
|
|
1040
|
+
return new Date().toLocaleString(undefined, { month: 'numeric', day: 'numeric', hour: '2-digit', minute: '2-digit' });
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
/** Save the current board as a brand new named canvas. */
|
|
1044
|
+
function saveCanvasAs(name) {
|
|
1045
|
+
const trimmed = String(name || '').trim();
|
|
1046
|
+
if (!trimmed) {
|
|
1047
|
+
toast(t('canvas.nameRequired'));
|
|
1048
|
+
return false;
|
|
1049
|
+
}
|
|
1050
|
+
state.canvases = syncCanvases().filter((canvas) => canvas.name !== trimmed);
|
|
1051
|
+
const canvas = {
|
|
1052
|
+
id: 'cv' + Date.now().toString(36),
|
|
1053
|
+
name: trimmed,
|
|
1054
|
+
savedAt: Date.now(),
|
|
1055
|
+
layout: layoutPayload(),
|
|
1056
|
+
};
|
|
1057
|
+
state.canvases = [...state.canvases, canvas];
|
|
1058
|
+
state.activeCanvas = canvas.id;
|
|
1059
|
+
storeCanvases();
|
|
1060
|
+
toast(t('canvas.saved').replace('{name}', trimmed));
|
|
1061
|
+
return true;
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
/** Overwrite the canvas the board is currently bound to. */
|
|
1065
|
+
function updateActiveCanvas() {
|
|
1066
|
+
const active = syncCanvases().find((canvas) => canvas.id === state.activeCanvas);
|
|
1067
|
+
if (!active) return false;
|
|
1068
|
+
active.layout = layoutPayload();
|
|
1069
|
+
active.savedAt = Date.now();
|
|
1070
|
+
storeCanvases();
|
|
1071
|
+
toast(t('canvas.updated').replace('{name}', active.name));
|
|
1072
|
+
return true;
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1075
|
+
function switchCanvas(id) {
|
|
1076
|
+
const target = syncCanvases().find((canvas) => canvas.id === id);
|
|
1077
|
+
if (!target) return;
|
|
1078
|
+
// Keep unsaved work: fold the current board back into its canvas first.
|
|
1079
|
+
if (state.activeCanvas && state.activeCanvas !== id) {
|
|
1080
|
+
const current = syncCanvases().find((canvas) => canvas.id === state.activeCanvas);
|
|
1081
|
+
if (current) {
|
|
1082
|
+
current.layout = layoutPayload();
|
|
1083
|
+
current.savedAt = Date.now();
|
|
1084
|
+
}
|
|
1085
|
+
}
|
|
1086
|
+
state.activeCanvas = id;
|
|
1087
|
+
storeCanvases();
|
|
1088
|
+
closeCanvasMenu();
|
|
1089
|
+
try {
|
|
1090
|
+
applyLayout(target.layout, { toast: t('canvas.switched').replace('{name}', target.name) });
|
|
1091
|
+
save();
|
|
1092
|
+
void fitView();
|
|
1093
|
+
} catch {
|
|
1094
|
+
toast(t('canvas.broken'));
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
function deleteCanvas(id) {
|
|
1099
|
+
const target = syncCanvases().find((canvas) => canvas.id === id);
|
|
1100
|
+
state.canvases = syncCanvases().filter((canvas) => canvas.id !== id);
|
|
1101
|
+
if (state.activeCanvas === id) state.activeCanvas = null;
|
|
1102
|
+
storeCanvases();
|
|
1103
|
+
if (target) toast(t('canvas.deleted').replace('{name}', target.name));
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1106
|
+
function openCanvasMenu() {
|
|
1107
|
+
if (canvasPop) {
|
|
1108
|
+
closeCanvasMenu();
|
|
1109
|
+
return;
|
|
1110
|
+
}
|
|
1111
|
+
const pop = el('div', 'iwb-popover iwb-canvas-menu');
|
|
1112
|
+
pop.setAttribute('role', 'dialog');
|
|
1113
|
+
pop.setAttribute('aria-label', t('canvas.title'));
|
|
1114
|
+
const head = el('div', 'iwb-popover-head');
|
|
1115
|
+
head.textContent = t('canvas.title');
|
|
1116
|
+
pop.appendChild(head);
|
|
1117
|
+
|
|
1118
|
+
const active = syncCanvases().find((canvas) => canvas.id === state.activeCanvas);
|
|
1119
|
+
const status = el('div', 'iwb-popover-note');
|
|
1120
|
+
status.textContent = active ? t('canvas.current').replace('{name}', active.name) : t('canvas.unsaved');
|
|
1121
|
+
pop.appendChild(status);
|
|
1122
|
+
|
|
1123
|
+
const form = el('div', 'iwb-canvas-form');
|
|
1124
|
+
const input = document.createElement('input');
|
|
1125
|
+
input.type = 'text';
|
|
1126
|
+
input.className = 'iwb-canvas-input';
|
|
1127
|
+
input.placeholder = t('canvas.placeholder');
|
|
1128
|
+
input.value = active ? active.name : '';
|
|
1129
|
+
const saveBtn = el('button', 'iwb-btn primary');
|
|
1130
|
+
saveBtn.type = 'button';
|
|
1131
|
+
saveBtn.textContent = t('canvas.save');
|
|
1132
|
+
saveBtn.addEventListener('click', (event) => {
|
|
1133
|
+
event.stopPropagation();
|
|
1134
|
+
if (saveCanvasAs(input.value)) {
|
|
1135
|
+
closeCanvasMenu();
|
|
1136
|
+
}
|
|
1137
|
+
});
|
|
1138
|
+
input.addEventListener('keydown', (event) => {
|
|
1139
|
+
event.stopPropagation();
|
|
1140
|
+
if (event.key === 'Enter') {
|
|
1141
|
+
event.preventDefault();
|
|
1142
|
+
if (saveCanvasAs(input.value)) closeCanvasMenu();
|
|
1143
|
+
}
|
|
1144
|
+
});
|
|
1145
|
+
form.append(input, saveBtn);
|
|
1146
|
+
pop.appendChild(form);
|
|
1147
|
+
|
|
1148
|
+
if (active) {
|
|
1149
|
+
const overwrite = el('button', 'iwb-btn');
|
|
1150
|
+
overwrite.type = 'button';
|
|
1151
|
+
overwrite.textContent = t('canvas.overwrite').replace('{name}', active.name);
|
|
1152
|
+
overwrite.addEventListener('click', (event) => {
|
|
1153
|
+
event.stopPropagation();
|
|
1154
|
+
updateActiveCanvas();
|
|
1155
|
+
closeCanvasMenu();
|
|
1156
|
+
});
|
|
1157
|
+
pop.appendChild(overwrite);
|
|
1158
|
+
}
|
|
1159
|
+
|
|
1160
|
+
const list = el('div', 'iwb-canvas-list');
|
|
1161
|
+
const canvases = syncCanvases();
|
|
1162
|
+
if (!canvases.length) {
|
|
1163
|
+
const empty = el('div', 'iwb-popover-note');
|
|
1164
|
+
empty.textContent = t('canvas.none');
|
|
1165
|
+
list.appendChild(empty);
|
|
1166
|
+
}
|
|
1167
|
+
for (const canvas of canvases) {
|
|
1168
|
+
const row = el('div', 'iwb-canvas-row' + (canvas.id === state.activeCanvas ? ' current' : ''));
|
|
1169
|
+
const pick = el('button', 'iwb-canvas-pick');
|
|
1170
|
+
pick.type = 'button';
|
|
1171
|
+
pick.innerHTML = '<span class="iwb-model-name"></span><span class="iwb-model-desc"></span>';
|
|
1172
|
+
pick.querySelector('.iwb-model-name').textContent = canvas.name;
|
|
1173
|
+
const cards = Array.isArray(canvas.layout?.cards)
|
|
1174
|
+
? canvas.layout.cards.length
|
|
1175
|
+
: Number(canvas.layout?.cards) || 0;
|
|
1176
|
+
pick.querySelector('.iwb-model-desc').textContent = t('canvas.meta')
|
|
1177
|
+
.replace('{n}', String(cards))
|
|
1178
|
+
.replace('{time}', canvas.savedAt ? canvasStamp(canvas.savedAt) : '');
|
|
1179
|
+
pick.addEventListener('click', (event) => {
|
|
1180
|
+
event.stopPropagation();
|
|
1181
|
+
switchCanvas(canvas.id);
|
|
1182
|
+
});
|
|
1183
|
+
const remove = el('button', 'iwb-canvas-remove');
|
|
1184
|
+
remove.type = 'button';
|
|
1185
|
+
remove.title = t('canvas.delete');
|
|
1186
|
+
remove.setAttribute('aria-label', t('canvas.delete'));
|
|
1187
|
+
remove.textContent = '×';
|
|
1188
|
+
remove.addEventListener('click', (event) => {
|
|
1189
|
+
event.stopPropagation();
|
|
1190
|
+
deleteCanvas(canvas.id);
|
|
1191
|
+
closeCanvasMenu();
|
|
1192
|
+
});
|
|
1193
|
+
row.append(pick, remove);
|
|
1194
|
+
list.appendChild(row);
|
|
1195
|
+
}
|
|
1196
|
+
pop.appendChild(list);
|
|
1197
|
+
|
|
1198
|
+
const rect = btnCanvas.getBoundingClientRect();
|
|
1199
|
+
pop.style.left = Math.round(Math.max(8, Math.min(rect.left - 80, window.innerWidth - 300))) + 'px';
|
|
1200
|
+
pop.style.top = Math.round(rect.bottom + 6) + 'px';
|
|
1201
|
+
document.body.appendChild(pop);
|
|
1202
|
+
canvasPop = pop;
|
|
1203
|
+
const measured = pop.getBoundingClientRect();
|
|
1204
|
+
if (measured.bottom > window.innerHeight - 8) {
|
|
1205
|
+
pop.style.top = Math.max(8, Math.round(rect.top - measured.height - 6)) + 'px';
|
|
1206
|
+
}
|
|
1207
|
+
input.focus();
|
|
1208
|
+
input.select();
|
|
1209
|
+
}
|
|
1210
|
+
|
|
947
1211
|
// ── kanban grouping (C4) ─────────────────────────────────────────────
|
|
948
1212
|
let kanbanPop = null;
|
|
949
1213
|
let kanbanTimer = 0;
|
|
@@ -1052,6 +1316,7 @@ export function createBoard({ host, adapter, approvals, t, onOpenSession }) {
|
|
|
1052
1316
|
});
|
|
1053
1317
|
saveSoon();
|
|
1054
1318
|
void fitView();
|
|
1319
|
+
schedulePipelines();
|
|
1055
1320
|
}
|
|
1056
1321
|
|
|
1057
1322
|
function exitKanban() {
|
|
@@ -1068,6 +1333,7 @@ export function createBoard({ host, adapter, approvals, t, onOpenSession }) {
|
|
|
1068
1333
|
state.board.saved.clear();
|
|
1069
1334
|
saveSoon();
|
|
1070
1335
|
void fitView();
|
|
1336
|
+
schedulePipelines();
|
|
1071
1337
|
btnBoard.classList.remove('iwb-btn-active');
|
|
1072
1338
|
}
|
|
1073
1339
|
|
|
@@ -1142,6 +1408,108 @@ export function createBoard({ host, adapter, approvals, t, onOpenSession }) {
|
|
|
1142
1408
|
return state.cards.find((card) => card.sessionId === sessionId) || null;
|
|
1143
1409
|
}
|
|
1144
1410
|
|
|
1411
|
+
function portAnchor(card) {
|
|
1412
|
+
return { x: card.x + card.w, y: card.y + 30 };
|
|
1413
|
+
}
|
|
1414
|
+
|
|
1415
|
+
function targetAnchor(card) {
|
|
1416
|
+
return { x: card.x, y: card.y + 30 };
|
|
1417
|
+
}
|
|
1418
|
+
|
|
1419
|
+
function linkPath(from, to) {
|
|
1420
|
+
const dx = Math.max(40, Math.abs(to.x - from.x) * 0.45);
|
|
1421
|
+
return 'M ' + from.x + ' ' + from.y + ' C ' + (from.x + dx) + ' ' + from.y + ', ' + (to.x - dx) + ' ' + to.y + ', ' + to.x + ' ' + to.y;
|
|
1422
|
+
}
|
|
1423
|
+
|
|
1424
|
+
/** Draw one curve per configured pipeline, plus a fat invisible hit area. */
|
|
1425
|
+
function renderPipelines() {
|
|
1426
|
+
while (linkLayer.firstChild) linkLayer.removeChild(linkLayer.firstChild);
|
|
1427
|
+
for (const card of state.cards) {
|
|
1428
|
+
const target = card.pipeline?.targetSessionId ? sessionCardOf(card.pipeline.targetSessionId) : null;
|
|
1429
|
+
if (!target || target === card) continue;
|
|
1430
|
+
const d = linkPath(portAnchor(card), targetAnchor(target));
|
|
1431
|
+
const hit = document.createElementNS(SVG_NS, 'path');
|
|
1432
|
+
hit.setAttribute('d', d);
|
|
1433
|
+
hit.setAttribute('class', 'iwb-link-hit');
|
|
1434
|
+
hit.addEventListener('pointerdown', (event) => {
|
|
1435
|
+
event.stopPropagation();
|
|
1436
|
+
openPipeMenu(card, event.currentTarget);
|
|
1437
|
+
});
|
|
1438
|
+
const path = document.createElementNS(SVG_NS, 'path');
|
|
1439
|
+
path.setAttribute('d', d);
|
|
1440
|
+
path.setAttribute('class', 'iwb-link');
|
|
1441
|
+
if (card.pipeline.mode === 'draft') path.setAttribute('stroke-dasharray', '4 4');
|
|
1442
|
+
linkLayer.append(hit, path);
|
|
1443
|
+
}
|
|
1444
|
+
}
|
|
1445
|
+
|
|
1446
|
+
let pipelineFrame = 0;
|
|
1447
|
+
function schedulePipelines() {
|
|
1448
|
+
if (pipelineFrame) return;
|
|
1449
|
+
pipelineFrame = requestAnimationFrame(() => {
|
|
1450
|
+
pipelineFrame = 0;
|
|
1451
|
+
renderPipelines();
|
|
1452
|
+
});
|
|
1453
|
+
}
|
|
1454
|
+
|
|
1455
|
+
/** Drag from a card's port to another card to wire a pipeline. */
|
|
1456
|
+
function bindPort(card) {
|
|
1457
|
+
const port = card.el.querySelector('.iwb-port');
|
|
1458
|
+
if (!port) return;
|
|
1459
|
+
port.setAttribute('title', t('pipe.port'));
|
|
1460
|
+
port.setAttribute('aria-label', t('pipe.port'));
|
|
1461
|
+
port.addEventListener('pointerdown', (event) => {
|
|
1462
|
+
event.preventDefault();
|
|
1463
|
+
event.stopPropagation();
|
|
1464
|
+
const canvasRect = canvas.getBoundingClientRect();
|
|
1465
|
+
const point = (clientX, clientY) => ({
|
|
1466
|
+
x: (clientX - canvasRect.left - state.pan.x) / state.zoom,
|
|
1467
|
+
y: (clientY - canvasRect.top - state.pan.y) / state.zoom,
|
|
1468
|
+
});
|
|
1469
|
+
const temp = document.createElementNS(SVG_NS, 'path');
|
|
1470
|
+
temp.setAttribute('class', 'iwb-link-temp');
|
|
1471
|
+
linkLayer.appendChild(temp);
|
|
1472
|
+
let hovered = null;
|
|
1473
|
+
const draw = (clientX, clientY) => {
|
|
1474
|
+
temp.setAttribute('d', linkPath(portAnchor(card), point(clientX, clientY)));
|
|
1475
|
+
};
|
|
1476
|
+
draw(event.clientX, event.clientY);
|
|
1477
|
+
port.setPointerCapture?.(event.pointerId);
|
|
1478
|
+
|
|
1479
|
+
const onMove = (moveEvent) => {
|
|
1480
|
+
draw(moveEvent.clientX, moveEvent.clientY);
|
|
1481
|
+
const under = document.elementFromPoint(moveEvent.clientX, moveEvent.clientY);
|
|
1482
|
+
const candidate = under?.closest?.('.iwb-card');
|
|
1483
|
+
const targetCard = candidate ? state.cards.find((entry) => entry.el === candidate) : null;
|
|
1484
|
+
if (hovered && hovered !== targetCard) hovered.el.classList.remove('iwb-link-target');
|
|
1485
|
+
hovered = targetCard && targetCard !== card && targetCard.sessionId ? targetCard : null;
|
|
1486
|
+
if (hovered) hovered.el.classList.add('iwb-link-target');
|
|
1487
|
+
};
|
|
1488
|
+
const finish = (upEvent) => {
|
|
1489
|
+
port.releasePointerCapture?.(event.pointerId);
|
|
1490
|
+
port.removeEventListener('pointermove', onMove);
|
|
1491
|
+
port.removeEventListener('pointerup', finish);
|
|
1492
|
+
port.removeEventListener('pointercancel', cancel);
|
|
1493
|
+
temp.remove();
|
|
1494
|
+
if (hovered) {
|
|
1495
|
+
hovered.el.classList.remove('iwb-link-target');
|
|
1496
|
+
card.pipeline = { targetSessionId: hovered.sessionId, mode: card.pipeline?.mode || 'send' };
|
|
1497
|
+
renderPipeBadge(card);
|
|
1498
|
+
schedulePipelines();
|
|
1499
|
+
saveSoon();
|
|
1500
|
+
toast(t('pipe.created').replace('{name}', hovered.title || t('untitled')));
|
|
1501
|
+
} else if (upEvent) {
|
|
1502
|
+
toast(t('pipe.needTarget'));
|
|
1503
|
+
}
|
|
1504
|
+
hovered = null;
|
|
1505
|
+
};
|
|
1506
|
+
const cancel = () => finish(null);
|
|
1507
|
+
port.addEventListener('pointermove', onMove);
|
|
1508
|
+
port.addEventListener('pointerup', finish);
|
|
1509
|
+
port.addEventListener('pointercancel', cancel);
|
|
1510
|
+
});
|
|
1511
|
+
}
|
|
1512
|
+
|
|
1145
1513
|
function renderPipeBadge(card) {
|
|
1146
1514
|
const badge = card.el?.querySelector('.iwb-pipe-badge');
|
|
1147
1515
|
if (!badge) return;
|
|
@@ -1163,6 +1531,51 @@ export function createBoard({ host, adapter, approvals, t, onOpenSession }) {
|
|
|
1163
1531
|
return '';
|
|
1164
1532
|
}
|
|
1165
1533
|
|
|
1534
|
+
let morePop = null;
|
|
1535
|
+
|
|
1536
|
+
function closeMoreMenu() {
|
|
1537
|
+
morePop?.remove();
|
|
1538
|
+
morePop = null;
|
|
1539
|
+
}
|
|
1540
|
+
|
|
1541
|
+
/** Secondary header actions live in a ⋯ menu so the row never overflows. */
|
|
1542
|
+
function openMoreMenu(card, anchor) {
|
|
1543
|
+
if (morePop) {
|
|
1544
|
+
closeMoreMenu();
|
|
1545
|
+
return;
|
|
1546
|
+
}
|
|
1547
|
+
const pop = el('div', 'iwb-popover iwb-more');
|
|
1548
|
+
pop.setAttribute('role', 'dialog');
|
|
1549
|
+
pop.setAttribute('aria-label', t('card.more'));
|
|
1550
|
+
const rows = [
|
|
1551
|
+
{ act: 'pin', label: card.pinned ? t('card.unpin') : t('card.pin'), icon: 'pin' },
|
|
1552
|
+
{ act: 'copy', label: t('card.copy'), icon: 'copy' },
|
|
1553
|
+
{ act: 'open', label: t('openNative'), icon: 'open' },
|
|
1554
|
+
];
|
|
1555
|
+
if (card.stackId) rows.push({ act: 'detach', label: t('detach'), icon: 'layers' });
|
|
1556
|
+
for (const row of rows) {
|
|
1557
|
+
const button = el('button', 'iwb-model-row');
|
|
1558
|
+
button.type = 'button';
|
|
1559
|
+
button.innerHTML = '<span class="iwb-more-ico">' + icon(row.icon, 13) + '</span><span class="iwb-model-main"><span class="iwb-model-name"></span></span>';
|
|
1560
|
+
button.querySelector('.iwb-model-name').textContent = row.label;
|
|
1561
|
+
button.addEventListener('click', (event) => {
|
|
1562
|
+
event.stopPropagation();
|
|
1563
|
+
closeMoreMenu();
|
|
1564
|
+
card.el.querySelector('.iwb-acts-more [data-act="' + row.act + '"]')?.click();
|
|
1565
|
+
});
|
|
1566
|
+
pop.appendChild(button);
|
|
1567
|
+
}
|
|
1568
|
+
const rect = anchor.getBoundingClientRect();
|
|
1569
|
+
pop.style.left = Math.round(Math.max(8, Math.min(rect.left - 120, window.innerWidth - 200))) + 'px';
|
|
1570
|
+
pop.style.top = Math.round(rect.bottom + 6) + 'px';
|
|
1571
|
+
document.body.appendChild(pop);
|
|
1572
|
+
morePop = pop;
|
|
1573
|
+
const measured = pop.getBoundingClientRect();
|
|
1574
|
+
if (measured.bottom > window.innerHeight - 8) {
|
|
1575
|
+
pop.style.top = Math.max(8, Math.round(rect.top - measured.height - 6)) + 'px';
|
|
1576
|
+
}
|
|
1577
|
+
}
|
|
1578
|
+
|
|
1166
1579
|
async function deliverPipeline(card) {
|
|
1167
1580
|
const pipeline = card.pipeline;
|
|
1168
1581
|
if (!pipeline?.targetSessionId) return;
|
|
@@ -1198,78 +1611,69 @@ export function createBoard({ host, adapter, approvals, t, onOpenSession }) {
|
|
|
1198
1611
|
target.pipeDepth = depth;
|
|
1199
1612
|
}
|
|
1200
1613
|
|
|
1614
|
+
/** Click a pipeline curve: switch its delivery mode or remove it. */
|
|
1201
1615
|
function openPipeMenu(card, anchor) {
|
|
1202
1616
|
if (pipePop) {
|
|
1203
1617
|
closePipeMenu();
|
|
1204
1618
|
return;
|
|
1205
1619
|
}
|
|
1206
|
-
const
|
|
1207
|
-
|
|
1620
|
+
const target = sessionCardOf(card.pipeline?.targetSessionId);
|
|
1621
|
+
if (!target) return;
|
|
1622
|
+
const pop = el('div', 'iwb-popover iwb-link-menu');
|
|
1208
1623
|
pop.setAttribute('role', 'dialog');
|
|
1209
1624
|
pop.setAttribute('aria-label', t('pipe.title'));
|
|
1210
1625
|
const head = el('div', 'iwb-popover-head');
|
|
1211
1626
|
head.textContent = t('pipe.title');
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1627
|
+
const status = el('div', 'iwb-popover-note');
|
|
1628
|
+
status.textContent = t('pipe.linked').replace('{name}', target.title || t('untitled'));
|
|
1629
|
+
pop.append(head, status);
|
|
1630
|
+
|
|
1631
|
+
const mode = card.pipeline.mode === 'draft' ? 'draft' : 'send';
|
|
1632
|
+
const modes = [
|
|
1633
|
+
{ id: 'send', label: t('pipe.send'), hint: t('pipe.sendHint') },
|
|
1634
|
+
{ id: 'draft', label: t('pipe.draft'), hint: t('pipe.draftHint') },
|
|
1635
|
+
];
|
|
1636
|
+
for (const option of modes) {
|
|
1637
|
+
const row = el('button', 'iwb-model-row' + (mode === option.id ? ' current' : ''));
|
|
1222
1638
|
row.type = 'button';
|
|
1223
|
-
row.innerHTML = '<span class="iwb-model-main"><span class="iwb-model-name"></span><span class="iwb-model-desc"></span></span>' + (
|
|
1224
|
-
row.querySelector('.iwb-model-name').textContent = label;
|
|
1225
|
-
row.querySelector('.iwb-model-desc').textContent =
|
|
1639
|
+
row.innerHTML = '<span class="iwb-model-main"><span class="iwb-model-name"></span><span class="iwb-model-desc"></span></span>' + (mode === option.id ? '<span class="iwb-check">✓</span>' : '');
|
|
1640
|
+
row.querySelector('.iwb-model-name').textContent = option.label;
|
|
1641
|
+
row.querySelector('.iwb-model-desc').textContent = option.hint;
|
|
1226
1642
|
row.addEventListener('click', (event) => {
|
|
1227
1643
|
event.stopPropagation();
|
|
1644
|
+
card.pipeline = { ...card.pipeline, mode: option.id };
|
|
1645
|
+
renderPipeBadge(card);
|
|
1646
|
+
schedulePipelines();
|
|
1647
|
+
saveSoon();
|
|
1228
1648
|
closePipeMenu();
|
|
1229
|
-
|
|
1649
|
+
toast(option.id === 'draft' ? t('pipe.modeDraft') : t('pipe.modeSend'));
|
|
1230
1650
|
});
|
|
1231
1651
|
pop.appendChild(row);
|
|
1232
|
-
};
|
|
1233
|
-
|
|
1234
|
-
for (const target of targets) {
|
|
1235
|
-
addRow(
|
|
1236
|
-
target.title || t('untitled'),
|
|
1237
|
-
target.workspace || t('workspace.none'),
|
|
1238
|
-
() => {
|
|
1239
|
-
card.pipeline = { targetSessionId: target.sessionId, mode: card.pipeline?.mode || 'send' };
|
|
1240
|
-
renderPipeBadge(card);
|
|
1241
|
-
saveSoon();
|
|
1242
|
-
toast(t('pipe.linked').replace('{name}', target.title || t('untitled')));
|
|
1243
|
-
},
|
|
1244
|
-
current === target.sessionId
|
|
1245
|
-
);
|
|
1246
|
-
}
|
|
1247
|
-
if (card.pipeline?.targetSessionId) {
|
|
1248
|
-
addRow(
|
|
1249
|
-
card.pipeline.mode === 'draft' ? t('pipe.send') : t('pipe.draft'),
|
|
1250
|
-
card.pipeline.mode === 'draft' ? t('pipe.modeDraftHint') : t('pipe.modeSendHint'),
|
|
1251
|
-
() => {
|
|
1252
|
-
card.pipeline = { ...card.pipeline, mode: card.pipeline.mode === 'draft' ? 'send' : 'draft' };
|
|
1253
|
-
saveSoon();
|
|
1254
|
-
toast(card.pipeline.mode === 'draft' ? t('pipe.draft') : t('pipe.send'));
|
|
1255
|
-
},
|
|
1256
|
-
false
|
|
1257
|
-
);
|
|
1258
|
-
addRow(t('pipe.off'), '', () => {
|
|
1259
|
-
card.pipeline = null;
|
|
1260
|
-
renderPipeBadge(card);
|
|
1261
|
-
saveSoon();
|
|
1262
|
-
}, false);
|
|
1263
1652
|
}
|
|
1264
1653
|
|
|
1654
|
+
const remove = el('button', 'iwb-model-row iwb-link-remove');
|
|
1655
|
+
remove.type = 'button';
|
|
1656
|
+
remove.innerHTML = '<span class="iwb-model-main"><span class="iwb-model-name"></span></span>';
|
|
1657
|
+
remove.querySelector('.iwb-model-name').textContent = t('pipe.remove');
|
|
1658
|
+
remove.addEventListener('click', (event) => {
|
|
1659
|
+
event.stopPropagation();
|
|
1660
|
+
card.pipeline = null;
|
|
1661
|
+
renderPipeBadge(card);
|
|
1662
|
+
schedulePipelines();
|
|
1663
|
+
saveSoon();
|
|
1664
|
+
closePipeMenu();
|
|
1665
|
+
toast(t('pipe.removed'));
|
|
1666
|
+
});
|
|
1667
|
+
pop.appendChild(remove);
|
|
1668
|
+
|
|
1265
1669
|
const rect = anchor.getBoundingClientRect();
|
|
1266
|
-
pop.style.left = Math.round(Math.max(8, Math.min(rect.left -
|
|
1267
|
-
pop.style.top = Math.round(rect.
|
|
1670
|
+
pop.style.left = Math.round(Math.max(8, Math.min(rect.left + rect.width / 2 - 110, window.innerWidth - 240))) + 'px';
|
|
1671
|
+
pop.style.top = Math.round(rect.top + rect.height + 8) + 'px';
|
|
1268
1672
|
document.body.appendChild(pop);
|
|
1269
1673
|
pipePop = pop;
|
|
1270
1674
|
const measured = pop.getBoundingClientRect();
|
|
1271
1675
|
if (measured.bottom > window.innerHeight - 8) {
|
|
1272
|
-
pop.style.top = Math.max(8, Math.round(rect.top - measured.height -
|
|
1676
|
+
pop.style.top = Math.max(8, Math.round(rect.top - measured.height - 8)) + 'px';
|
|
1273
1677
|
}
|
|
1274
1678
|
}
|
|
1275
1679
|
|
|
@@ -1294,6 +1698,7 @@ export function createBoard({ host, adapter, approvals, t, onOpenSession }) {
|
|
|
1294
1698
|
/* the session scope may already be gone */
|
|
1295
1699
|
}
|
|
1296
1700
|
state.cards = state.cards.filter((c) => c !== card);
|
|
1701
|
+
schedulePipelines();
|
|
1297
1702
|
if (state.selected.delete(card.id)) renderBatchBar();
|
|
1298
1703
|
if (state.focusedId === card.id) {
|
|
1299
1704
|
state.focusedId = null;
|
|
@@ -1868,6 +2273,10 @@ export function createBoard({ host, adapter, approvals, t, onOpenSession }) {
|
|
|
1868
2273
|
card.hovered = false;
|
|
1869
2274
|
});
|
|
1870
2275
|
|
|
2276
|
+
node.querySelector('[data-act="more"]')?.addEventListener('click', (event) => {
|
|
2277
|
+
event.stopPropagation();
|
|
2278
|
+
openMoreMenu(card, event.currentTarget);
|
|
2279
|
+
});
|
|
1871
2280
|
node.querySelector('[data-act="pipe"]')?.addEventListener('click', (event) => {
|
|
1872
2281
|
event.stopPropagation();
|
|
1873
2282
|
openPipeMenu(card, event.currentTarget);
|
|
@@ -1994,6 +2403,7 @@ export function createBoard({ host, adapter, approvals, t, onOpenSession }) {
|
|
|
1994
2403
|
node.style.left = nx + 'px';
|
|
1995
2404
|
node.style.top = ny + 'px';
|
|
1996
2405
|
}
|
|
2406
|
+
schedulePipelines();
|
|
1997
2407
|
};
|
|
1998
2408
|
const up = () => {
|
|
1999
2409
|
interactionActive = false;
|
|
@@ -2102,6 +2512,7 @@ export function createBoard({ host, adapter, approvals, t, onOpenSession }) {
|
|
|
2102
2512
|
if (!saved || !Array.isArray(saved.cards)) {
|
|
2103
2513
|
syncApprovalSessions();
|
|
2104
2514
|
void syncFromRemote().then(() => startRemoteSync());
|
|
2515
|
+
void loadCanvases();
|
|
2105
2516
|
return false;
|
|
2106
2517
|
}
|
|
2107
2518
|
localUpdatedAt = Number(saved.updatedAt) || 0;
|
|
@@ -2151,12 +2562,14 @@ export function createBoard({ host, adapter, approvals, t, onOpenSession }) {
|
|
|
2151
2562
|
updateEmptyState();
|
|
2152
2563
|
syncApprovalSessions();
|
|
2153
2564
|
updateTodoBar();
|
|
2565
|
+
schedulePipelines();
|
|
2154
2566
|
// The Host copy wins when it is newer (other window, other device, or a
|
|
2155
2567
|
// previous browser session whose site data was cleared). Drop the restore's
|
|
2156
2568
|
// pending write first: it must not fence off the initial remote read.
|
|
2157
2569
|
clearTimeout(saveTimer);
|
|
2158
2570
|
saveTimer = 0;
|
|
2159
2571
|
void syncFromRemote().then(() => startRemoteSync());
|
|
2572
|
+
void loadCanvases();
|
|
2160
2573
|
return true;
|
|
2161
2574
|
}
|
|
2162
2575
|
|
|
@@ -2429,6 +2842,18 @@ export function createBoard({ host, adapter, approvals, t, onOpenSession }) {
|
|
|
2429
2842
|
});
|
|
2430
2843
|
|
|
2431
2844
|
|
|
2845
|
+
btnCanvas.addEventListener('click', (event) => {
|
|
2846
|
+
event.stopPropagation();
|
|
2847
|
+
openCanvasMenu();
|
|
2848
|
+
});
|
|
2849
|
+
|
|
2850
|
+
const onCanvasPointerDown = (event) => {
|
|
2851
|
+
if (!canvasPop) return;
|
|
2852
|
+
if (event.target?.closest?.('.iwb-canvas-menu') || event.target?.closest?.('.iwb-toolbar')) return;
|
|
2853
|
+
closeCanvasMenu();
|
|
2854
|
+
};
|
|
2855
|
+
document.addEventListener('pointerdown', onCanvasPointerDown, true);
|
|
2856
|
+
|
|
2432
2857
|
btnBoard.addEventListener('click', (event) => {
|
|
2433
2858
|
event.stopPropagation();
|
|
2434
2859
|
openKanbanMenu();
|
|
@@ -2441,6 +2866,13 @@ export function createBoard({ host, adapter, approvals, t, onOpenSession }) {
|
|
|
2441
2866
|
};
|
|
2442
2867
|
document.addEventListener('pointerdown', onKanbanPointerDown, true);
|
|
2443
2868
|
|
|
2869
|
+
const onMorePointerDown = (event) => {
|
|
2870
|
+
if (!morePop) return;
|
|
2871
|
+
if (event.target?.closest?.('.iwb-more') || event.target?.closest?.('[data-act="more"]')) return;
|
|
2872
|
+
closeMoreMenu();
|
|
2873
|
+
};
|
|
2874
|
+
document.addEventListener('pointerdown', onMorePointerDown, true);
|
|
2875
|
+
|
|
2444
2876
|
const onPipePointerDown = (event) => {
|
|
2445
2877
|
if (!pipePop) return;
|
|
2446
2878
|
if (event.target?.closest?.('.iwb-pipe') || event.target?.closest?.('[data-act="pipe"]')) return;
|
|
@@ -2459,6 +2891,10 @@ export function createBoard({ host, adapter, approvals, t, onOpenSession }) {
|
|
|
2459
2891
|
if (event.key === 'Escape') {
|
|
2460
2892
|
clearSelection();
|
|
2461
2893
|
closePipeMenu();
|
|
2894
|
+
closeMoreMenu();
|
|
2895
|
+
closeCanvasMenu();
|
|
2896
|
+
document.removeEventListener('pointerdown', onMorePointerDown, true);
|
|
2897
|
+
document.removeEventListener('pointerdown', onCanvasPointerDown, true);
|
|
2462
2898
|
closeKanbanMenu();
|
|
2463
2899
|
}
|
|
2464
2900
|
if (event.key === '0') fitView();
|