@songsid/agend 2.4.0-beta.20 → 2.4.0-beta.21
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/agent-cli-instructions.md +1 -1
- package/dist/backend/claude-carry.d.ts +11 -0
- package/dist/backend/claude-carry.js +88 -6
- package/dist/backend/claude-carry.js.map +1 -1
- package/dist/build-provenance.json +1 -1
- package/dist/channel/mcp-tools.js +6 -4
- package/dist/channel/mcp-tools.js.map +1 -1
- package/dist/contact-change-proposals.d.ts +47 -0
- package/dist/contact-change-proposals.js +131 -0
- package/dist/contact-change-proposals.js.map +1 -0
- package/dist/fleet-manager.d.ts +25 -1
- package/dist/fleet-manager.js +166 -3
- package/dist/fleet-manager.js.map +1 -1
- package/dist/general-knowledge/skills/concepts/SKILL.md +2 -1
- package/dist/general-knowledge/skills/hub/SKILL.md +39 -2
- package/dist/general-knowledge/skills/task-board/SKILL.md +4 -0
- package/dist/general-knowledge/skills/web-appearance/SKILL.md +1 -1
- package/dist/general-knowledge/skills/web-dashboard/SKILL.md +16 -6
- package/dist/hub/agent-pictures-model.d.ts +147 -0
- package/dist/hub/agent-pictures-model.js +64 -0
- package/dist/hub/agent-pictures-model.js.map +1 -0
- package/dist/hub/agent-pictures.d.ts +52 -0
- package/dist/hub/agent-pictures.js +202 -0
- package/dist/hub/agent-pictures.js.map +1 -0
- package/dist/hub/client.d.ts +2 -0
- package/dist/hub/client.js +16 -2
- package/dist/hub/client.js.map +1 -1
- package/dist/hub/compose/member.d.ts +10 -2
- package/dist/hub/compose/member.js +32 -8
- package/dist/hub/compose/member.js.map +1 -1
- package/dist/hub/compose/server.d.ts +1 -0
- package/dist/hub/compose/server.js +4 -2
- package/dist/hub/compose/server.js.map +1 -1
- package/dist/hub/direct-posts-model.d.ts +1 -0
- package/dist/hub/direct-posts-model.js +2 -0
- package/dist/hub/direct-posts-model.js.map +1 -0
- package/dist/hub/direct-posts.d.ts +36 -0
- package/dist/hub/direct-posts.js +145 -0
- package/dist/hub/direct-posts.js.map +1 -0
- package/dist/hub/http/compose.d.ts +2 -0
- package/dist/hub/http/compose.js +155 -19
- package/dist/hub/http/compose.js.map +1 -1
- package/dist/hub/http/core.d.ts +9 -1
- package/dist/hub/http/core.js +21 -1
- package/dist/hub/http/core.js.map +1 -1
- package/dist/hub/http/schema.js +6 -0
- package/dist/hub/http/schema.js.map +1 -1
- package/dist/hub/join/service.d.ts +2 -0
- package/dist/hub/join/service.js +7 -3
- package/dist/hub/join/service.js.map +1 -1
- package/dist/hub/mcp/policy.d.ts +1 -1
- package/dist/hub/member/agent-pictures.d.ts +43 -0
- package/dist/hub/member/agent-pictures.js +125 -0
- package/dist/hub/member/agent-pictures.js.map +1 -0
- package/dist/hub/member/direct-rooms.d.ts +9 -0
- package/dist/hub/member/direct-rooms.js +14 -0
- package/dist/hub/member/direct-rooms.js.map +1 -0
- package/dist/hub/member/room-post.d.ts +11 -10
- package/dist/hub/member/room-post.js +51 -7
- package/dist/hub/member/room-post.js.map +1 -1
- package/dist/hub/policy.d.ts +11 -2
- package/dist/hub/policy.js +60 -7
- package/dist/hub/policy.js.map +1 -1
- package/dist/hub/protocol.d.ts +123 -1
- package/dist/hub/protocol.js +17 -7
- package/dist/hub/protocol.js.map +1 -1
- package/dist/hub/representative.d.ts +28 -0
- package/dist/hub/representative.js +127 -12
- package/dist/hub/representative.js.map +1 -1
- package/dist/hub/rooms/agents.d.ts +2 -0
- package/dist/hub/rooms/agents.js +14 -3
- package/dist/hub/rooms/agents.js.map +1 -1
- package/dist/hub/rooms/direct-view.d.ts +3 -2
- package/dist/hub/rooms/direct-view.js +23 -8
- package/dist/hub/rooms/direct-view.js.map +1 -1
- package/dist/hub/rooms/office.d.ts +9 -0
- package/dist/hub/rooms/office.js +10 -2
- package/dist/hub/rooms/office.js.map +1 -1
- package/dist/hub/rooms/service.d.ts +32 -1
- package/dist/hub/rooms/service.js +37 -3
- package/dist/hub/rooms/service.js.map +1 -1
- package/dist/hub/rooms/types.d.ts +5 -2
- package/dist/hub/rooms.d.ts +9 -0
- package/dist/hub/rooms.js +97 -26
- package/dist/hub/rooms.js.map +1 -1
- package/dist/hub/runtime.d.ts +1 -1
- package/dist/hub/server.js +19 -2
- package/dist/hub/server.js.map +1 -1
- package/dist/hub/session-directory-transition.d.ts +1 -0
- package/dist/hub/session-directory-transition.js +15 -9
- package/dist/hub/session-directory-transition.js.map +1 -1
- package/dist/hub/session-limits.d.ts +58 -0
- package/dist/hub/session-limits.js +121 -0
- package/dist/hub/session-limits.js.map +1 -0
- package/dist/hub/sessions.d.ts +1 -1
- package/dist/hub/sessions.js +13 -7
- package/dist/hub/sessions.js.map +1 -1
- package/dist/hub/settings-directory-decision.js +1 -1
- package/dist/hub/settings-directory-decision.js.map +1 -1
- package/dist/hub/types.d.ts +8 -2
- package/dist/hub-picture-reduce.d.ts +14 -0
- package/dist/hub-picture-reduce.js +49 -0
- package/dist/hub-picture-reduce.js.map +1 -0
- package/dist/hub-picture-worker.d.ts +1 -0
- package/dist/hub-picture-worker.js +11 -0
- package/dist/hub-picture-worker.js.map +1 -0
- package/dist/hub-report-target.d.ts +6 -0
- package/dist/hub-report-target.js +6 -0
- package/dist/hub-report-target.js.map +1 -1
- package/dist/locale.js +90 -2
- package/dist/locale.js.map +1 -1
- package/dist/needs-you.d.ts +4 -0
- package/dist/needs-you.js +2 -0
- package/dist/needs-you.js.map +1 -1
- package/dist/outbound-handlers.d.ts +4 -0
- package/dist/outbound-handlers.js +37 -4
- package/dist/outbound-handlers.js.map +1 -1
- package/dist/outbound-schemas.d.ts +2 -0
- package/dist/outbound-schemas.js +6 -4
- package/dist/outbound-schemas.js.map +1 -1
- package/dist/task-board-tool.d.ts +17 -0
- package/dist/task-board-tool.js +58 -6
- package/dist/task-board-tool.js.map +1 -1
- package/dist/tool-permissions.js +2 -2
- package/dist/tool-permissions.js.map +1 -1
- package/dist/ui/contact-tool-groups.js +1 -1
- package/dist/ui/fleet-canvas.js +2 -1
- package/dist/ui/fleet-office-card.js +20 -5
- package/dist/ui/fleet-office-dialogue.d.ts +6 -3
- package/dist/ui/fleet-office-dialogue.js +13 -3
- package/dist/ui/fleet-office-layout.js +13 -13
- package/dist/ui/fleet-office-model.js +3 -2
- package/dist/ui/fleet-office-overview.js +1 -1
- package/dist/ui/fleet-office-pack.d.ts +17 -7
- package/dist/ui/fleet-office-pack.js +106 -38
- package/dist/ui/fleet-office-play.js +11 -4
- package/dist/ui/fleet-office-skin.js +25 -11
- package/dist/ui/fleet-office-store.js +10 -1
- package/dist/ui/fleet-office-talk.js +423 -0
- package/dist/ui/fleet-office-view.js +26 -17
- package/dist/ui/fleet-office-zones.js +20 -12
- package/dist/ui/fleet-office.js +173 -44
- package/dist/ui/fleet-task-common.js +1 -1
- package/dist/ui/fleet-task-sort.js +88 -0
- package/dist/ui/fleet-task-view.js +38 -9
- package/dist/ui/fleet-tasks.js +47 -15
- package/dist/ui/hub-chat-store.js +4 -3
- package/dist/ui/hub-chat-strings.js +2 -0
- package/dist/ui/hub-client.js +3 -0
- package/dist/ui/hub-my-agents-strings.js +2 -2
- package/dist/ui/hub-my-agents.js +3 -0
- package/dist/ui/hub-room-composer.js +24 -4
- package/dist/ui/hub-room-members.js +7 -3
- package/dist/ui/hub-room-office.js +2 -1
- package/dist/ui/hub-room-presence.js +9 -0
- package/dist/ui/hub-room-strings.js +18 -2
- package/dist/ui/hub-room-thread.js +82 -13
- package/dist/ui/hub-room-working.js +37 -0
- package/dist/ui/hub-session-limits.js +79 -0
- package/dist/ui/panel-hub.js +41 -6
- package/dist/ui/panel-needs.js +28 -2
- package/dist/ui/shared/app.css +84 -3
- package/dist/ui/shared/chat-strings.js +1 -1
- package/dist/ui/shared/hub-owner.css +5 -0
- package/dist/ui/shared/hub-rooms-u2.css +3 -0
- package/dist/ui/shared/office-dialogue.css +110 -0
- package/dist/ui/shared/task-board.css +103 -7
- package/dist/web-api.d.ts +5 -0
- package/dist/web-api.js +29 -0
- package/dist/web-api.js.map +1 -1
- package/dist/web-office-skins.d.ts +8 -2
- package/dist/web-office-skins.js +33 -14
- package/dist/web-office-skins.js.map +1 -1
- package/dist/web-office-store.js +5 -3
- package/dist/web-office-store.js.map +1 -1
- package/package.json +1 -1
package/dist/ui/fleet-office.js
CHANGED
|
@@ -76,18 +76,18 @@ import { CALLING, activeFurniture, bubbleAt, hiddenBy, bubbleRank, NIGHT, WANDER
|
|
|
76
76
|
import { actsOk, createOfficeStore } from "./fleet-office-store.js";
|
|
77
77
|
import { badgeOf, fixedOf, mergeLevels } from "./fleet-office-levels.js";
|
|
78
78
|
import { OfficeCard, cardModel } from "./fleet-office-card.js";
|
|
79
|
-
import { PLAY, applySeatDrop, clampDropForArea, createHold, createSnackDrag, createSnacks, findSeatDropTarget, playAllowed, playOffForMotion, pruneReactions, reactionAt, scatterWords, seatDropTargets } from "./fleet-office-play.js";
|
|
79
|
+
import { PLAY, applySeatDrop, patLook, clampDropForArea, createHold, createSnackDrag, createSnacks, findSeatDropTarget, playAllowed, playOffForMotion, pruneReactions, reactionAt, scatterWords, seatDropTargets } from "./fleet-office-play.js";
|
|
80
80
|
import { POLL_MS } from "./fleet-traffic.js";
|
|
81
81
|
import { OfficeEditor, officeForSave } from "./fleet-office-editor.js";
|
|
82
82
|
import { LayoutEditor, handlesOf } from "./fleet-office-layout.js";
|
|
83
83
|
import { ShareButton } from "./office-share-dialog.js";
|
|
84
84
|
import { Dialog } from "/assets/ui-dialog.js";
|
|
85
85
|
import { DLG, boxColours, boxLayout, createDialogue, createFaces, drawBox, fitBox, messageOf, onBox, pickFront, portraitSrc, stageOf, talkOf, wrap } from "./fleet-office-dialogue.js";
|
|
86
|
-
import { applyOverrides, createClipClocks, fitNight, fitSeatFor, packMaxFps, snackLabel, stripBox } from "./fleet-office-pack.js";
|
|
86
|
+
import { applyOverrides, createClipClocks, fitNight, fitSeatFor, packMaxFps, snackLabel, stripBox, stripDurationMs } from "./fleet-office-pack.js";
|
|
87
87
|
import { ALL_ID, LOBBY_TILE, OV, createCrossFlights, cropToRooms, fromTile, inTile, labelAt, lobbyNodes, overviewOk, tileAt, tileBox, tileLayout, visibleTiles } from "./fleet-office-overview.js";
|
|
88
88
|
import { CAROUSEL_ID, INTERVALS, carouselHeld, carouselIdsOk, carouselKey, carouselOk, intervalOk, nextIndex, prevIndex } from "./fleet-office-carousel.js";
|
|
89
89
|
import { centreOn, gestureState, gestures, miniPoint, toScreen, toWorld, wheelFactor, zoomKey, zoomTo } from "./fleet-canvas-view.js";
|
|
90
|
-
import { OK_MAX,
|
|
90
|
+
import { OK_MAX, clampPan, desksK, minK, edgeMatte, edgeStrips, fitScene, layerScale, miniBox, miniFrame, openingView, pinchOffice, savedOf, stepK, viewFromSaved,
|
|
91
91
|
wholeInView, zoomLabel, zoomOffice } from "./fleet-office-view.js";
|
|
92
92
|
|
|
93
93
|
register("orgo", {
|
|
@@ -107,7 +107,8 @@ register("orgo", {
|
|
|
107
107
|
styleFailed: "The style was not saved for everyone ({0}).", styleBusy: "Too many changes. Try again in a minute.",
|
|
108
108
|
fit: "Fit the office", overview: "Overview: click to move there", fullscreen: "Fullscreen", exitFullscreen: "Exit fullscreen",
|
|
109
109
|
fill: "Fill", fillTitle: "Fill the panel (the scene's overflow is cropped; drag to see it)", zoomLevel: "Zoom {0}",
|
|
110
|
-
allOffices: "All offices", labelAll: "All offices: each office is a tile, drawn in its own style. Drag to pan; the wheel, a pinch, + and − zoom, 0 fits, F is fullscreen.
|
|
110
|
+
allOffices: "All offices", labelAll: "All offices: each office is a tile, drawn in its own style. Drag to pan; the wheel, a pinch, + and − zoom, 0 fits, F is fullscreen. Click a tile to open that office.",
|
|
111
|
+
backAll: "← All offices",
|
|
111
112
|
key: "Key", keyTitle: "What the items carried between desks are", keyLabel: "Carried between desks",
|
|
112
113
|
keyTask: "Folder: a task", keySend: "Envelope: a message", keyReport: "Paper: a report", keyBroadcast: "Horn: a broadcast",
|
|
113
114
|
tileLabel: "{0} ({1})", openOffice: "Open the office {0}", lobbyTile: "Lobby tile (in no office)", lobbyEveryone: "Everyone is in an office", overviewNoEdit: "Pick one office to edit offices or a layout",
|
|
@@ -139,7 +140,8 @@ register("orgo", {
|
|
|
139
140
|
styleFailed: "風格沒有替所有人儲存({0})。", styleBusy: "變更太頻繁,請一分鐘後再試。",
|
|
140
141
|
fit: "顯示整個辦公室", overview: "總覽:點一下移到那裡", fullscreen: "全螢幕", exitFullscreen: "結束全螢幕",
|
|
141
142
|
fill: "填滿", fillTitle: "填滿整個面板(超出的部分會被裁切,拖曳即可看到)", zoomLevel: "縮放 {0}",
|
|
142
|
-
allOffices: "所有辦公室", labelAll: "所有辦公室:每間辦公室是一格,以它自己的風格顯示。拖曳平移;滾輪、雙指、+ 和 − 縮放,0 顯示全部,F
|
|
143
|
+
allOffices: "所有辦公室", labelAll: "所有辦公室:每間辦公室是一格,以它自己的風格顯示。拖曳平移;滾輪、雙指、+ 和 − 縮放,0 顯示全部,F 切換全螢幕。點一格即可開啟那間辦公室。",
|
|
144
|
+
backAll: "← 返回全域",
|
|
143
145
|
key: "圖例", keyTitle: "桌子之間傳遞的物品代表什麼", keyLabel: "桌子之間傳遞的物品",
|
|
144
146
|
keyTask: "資料夾:任務", keySend: "信封:訊息", keyReport: "紙張:回報", keyBroadcast: "喇叭:廣播",
|
|
145
147
|
tileLabel: "{0}({1})", openOffice: "開啟辦公室「{0}」", lobbyTile: "大廳格(不在任何辦公室)", lobbyEveryone: "每個成員都已在某間辦公室", overviewNoEdit: "請先選一間辦公室,再編輯辦公室或配置",
|
|
@@ -616,8 +618,12 @@ export function drawPart(ctx, p, a, ox, oy, ms, still, hot, env, tagsOff = false
|
|
|
616
618
|
const posed = actPosed(p, q.look);
|
|
617
619
|
const eating = !q.at.walking && p.snacks && ms > 0 ? p.snacks.eatingOf(q.look.name, t) : null;
|
|
618
620
|
const canEat = !!eating && !CALLING.has(q.look.state) && !ASLEEP.has(q.look.state) && !q.look.night;
|
|
621
|
+
// A pat shows the set's `pat` strip for one full pass of it (pat.until), each pat from frame 0; a set without one keeps its pose.
|
|
622
|
+
const canPat = !q.at.walking && !canEat && ms > 0 && !!p.reacts && !CALLING.has(q.look.state) && !ASLEEP.has(q.look.state) && !q.look.night;
|
|
623
|
+
const patted = canPat ? patLook(posed, p.reacts.get(q.look.name), t) : null;
|
|
619
624
|
const look = q.at.walking ? { ...q.look, pose: "walk", heading: q.at.heading }
|
|
620
|
-
: canEat ? { ...posed, pose: "eat", basePose: posed.pose }
|
|
625
|
+
: canEat ? { ...posed, pose: "eat", basePose: posed.pose }
|
|
626
|
+
: patted || posed;
|
|
621
627
|
sk.drawCharacter(ctx, box, look, ms, env);
|
|
622
628
|
if (canEat && eating.snackId && p.snacksById && sk.drawSnack) {
|
|
623
629
|
const sdef = p.snacksById.get(eating.snackId);
|
|
@@ -763,9 +769,12 @@ export function drawPart(ctx, p, a, ox, oy, ms, still, hot, env, tagsOff = false
|
|
|
763
769
|
}
|
|
764
770
|
// Speech bubbles: a short line for the state, now and then (typed out; whole at once when still), placed so no two
|
|
765
771
|
// overlap (placeBubbles; #2431).
|
|
766
|
-
const bubbles = [];
|
|
772
|
+
const bubbles = [], rp = p.reply, tSaid = Date.now(), replies = [];
|
|
767
773
|
for (const sp of speakers) {
|
|
768
774
|
if (sp.look.dim || sp.look.pose === "away") continue;
|
|
775
|
+
// Talk "Over their head": a live reply, in full (wrapped), in place of the state's line.
|
|
776
|
+
const said = rp ? rp.chat.recent(sp.look.name, tSaid) : null;
|
|
777
|
+
if (said) { replies.push({ sp, said }); continue; }
|
|
769
778
|
const says = sp.look.night ? "paused" : sp.look.state; // asleep at night: its "Zzz…" lines
|
|
770
779
|
// What an agent says itself (office_set, #2578): whole, kept over the area's thinning like a call.
|
|
771
780
|
const act = p.acts && p.acts.get(sp.look.name), ra = reacting && reacting.has(sp.look.name) ? reactionAt(reacting.get(sp.look.name), t0, p.lang) : null;
|
|
@@ -784,7 +793,8 @@ export function drawPart(ctx, p, a, ox, oy, ms, still, hot, env, tagsOff = false
|
|
|
784
793
|
}
|
|
785
794
|
// A crowded area speaks less (thinBubbles: calls, then work, a few at most); no bubble covers a name tag. `defer`
|
|
786
795
|
// (All offices): drawn after every tile, unclipped, so a bubble at a tile's edge is whole.
|
|
787
|
-
|
|
796
|
+
// M-3648: an area's name blocks chatter; a call may cover it (placeBubbles' `soft`): a name never keeps a call out.
|
|
797
|
+
const placed = placeBubbles(thinBubbles(bubbles, p.zones ? p.L.over : null), 22, tags, titleBoxes);
|
|
788
798
|
const say = () => { T(); for (const { sp, b, dy } of placed) {
|
|
789
799
|
const text = [...b.text].slice(0, b.shown).join("");
|
|
790
800
|
sk.drawBubble(ctx, sp.x, sp.y, text, env, -dy);
|
|
@@ -792,9 +802,32 @@ export function drawPart(ctx, p, a, ox, oy, ms, still, hot, env, tagsOff = false
|
|
|
792
802
|
const box = bubbleBox(ctx, sp.x, sp.y, text, -dy);
|
|
793
803
|
bubbleHits.push({ name: sp.look.name, box: { x: ox + box.x * a, y: oy + box.y * a, w: box.w * a, h: box.h * a } });
|
|
794
804
|
}
|
|
805
|
+
}
|
|
806
|
+
const bl = sk.pack && sk.pack.dialogBox ? sk.pack.dialogBox.bubble : null;
|
|
807
|
+
const im = bl && bl.frame && typeof sk.picture === "function" ? sk.picture(bl.frame, () => {}) : null;
|
|
808
|
+
for (const { sp, said } of replies) {
|
|
809
|
+
// Typed out from its page's start, at the reading mode's pace; ▼ once whole; Auto / Fast: it goes on by itself.
|
|
810
|
+
const cps = rp.pace(rp.read).cps, n = ms > 0 ? Math.floor(((tSaid - (said.pageAt ?? said.at)) * cps) / 1000) : Infinity;
|
|
811
|
+
// #4406: never smaller than its own size on the page — zoomed out (a phone's whole office at 30 %), it is drawn at
|
|
812
|
+
// 1 CSS px a unit about its tail, so the words stay readable; zoomed in, as the map.
|
|
813
|
+
const u = Math.max(1, (rp.ratio || 1) / a);
|
|
814
|
+
// And kept on screen: the canvas's visible width in this part's units, into the bubble's own (scaled about its tail).
|
|
815
|
+
const vl = -ox / a, vr = ((ctx.canvas && ctx.canvas.width) || Infinity) / a - ox / a, m = 6 / u;
|
|
816
|
+
const vt = -oy / a, vb = ((ctx.canvas && ctx.canvas.height) || Infinity) / a - oy / a;
|
|
817
|
+
const fit = Number.isFinite(vr) ? { l: sp.x + (vl - sp.x) / u + m, r: sp.x + (vr - sp.x) / u - m,
|
|
818
|
+
...(Number.isFinite(vb) ? { t: sp.y + (vt - sp.y) / u + m, b: sp.y + (vb - sp.y) / u - m } : {}) } : null;
|
|
819
|
+
ctx.save(); ctx.translate(sp.x, sp.y); ctx.scale(u, u); ctx.translate(-sp.x, -sp.y);
|
|
820
|
+
const b0 = rp.draw(ctx, sp.x, sp.y, sp.look.label || sp.look.name, said.text, ms > 0 ? tSaid - said.at : 0, rp.style(bl, env), im ? { im, slice: bl.slice || 6, k: sk.pack.scale || 2 } : null,
|
|
821
|
+
{ page: said.page, n }, fit);
|
|
822
|
+
ctx.restore();
|
|
823
|
+
const box = { ...b0, x: sp.x + (b0.x - sp.x) * u, y: sp.y + (b0.y - sp.y) * u, w: b0.w * u, h: b0.h * u };
|
|
824
|
+
said.pages = box.pages;
|
|
825
|
+
if (n >= box.len && !said.whole) { said.whole = true; said.wholeAt = tSaid; }
|
|
826
|
+
if (said.whole && tSaid - said.wholeAt >= rp.pace(rp.read, box.len).wait) rp.chat.advance(sp.look.name);
|
|
827
|
+
if (bubbleHits) bubbleHits.push({ name: sp.look.name, reply: true, box: { x: ox + box.x * a, y: oy + box.y * a, w: box.w * a, h: box.h * a } });
|
|
795
828
|
} };
|
|
796
829
|
if (defer) defer.push(say); else say();
|
|
797
|
-
return walking || up.length > 0 || p.flights.size() > 0 || post.some((it) => it.t > 0) || rising.length > 0 || !!reacting || (!!p.snacks && p.snacks.active(t0)) || !!(p.snackDrop && p.snackDrop.current) || !!(p.hold && p.hold.held());
|
|
830
|
+
return replies.length > 0 || walking || up.length > 0 || p.flights.size() > 0 || post.some((it) => it.t > 0) || rising.length > 0 || !!reacting || (!!p.snacks && p.snacks.active(t0)) || !!(p.snackDrop && p.snackDrop.current) || !!(p.hold && p.hold.held());
|
|
798
831
|
}
|
|
799
832
|
/**
|
|
800
833
|
* #2661: an NPC's name tag (a furniture item's label) — with the title a pack pins on it (`levels.fixed` by its id),
|
|
@@ -900,7 +933,8 @@ export function OfficeKey({ pal }) {
|
|
|
900
933
|
* in the zoom stack (a Hub room's office: the scene right under the room's header, M-3533 #4370);
|
|
901
934
|
* `cardAction(name)` a card's main action ({ label, title, run }: the room's "@ it"), or null; `cardName(name)` a card's
|
|
902
935
|
* title instead of the person's name (the room's: the agent's own, without the owner its scene label carries); `officesKey` read the offices
|
|
903
|
-
* again when it changes (a page with no stream: the room's office when an agent joins, leaves or is renamed)
|
|
936
|
+
* again when it changes (a page with no stream: the room's office when an agent joins, leaves or is renamed); M-3533 R2b:
|
|
937
|
+
* `cardPhoto(name)` the src of a card's identity-card picture (the room's), or null: the figure.
|
|
904
938
|
*/
|
|
905
939
|
function ensureDialogueStyle() {
|
|
906
940
|
const doc = globalThis.document;
|
|
@@ -909,8 +943,8 @@ function ensureDialogueStyle() {
|
|
|
909
943
|
link.href = assetUrl("/assets/office-dialogue.css");
|
|
910
944
|
link.setAttribute("data-office-dialogue-css", "1"); doc.head.appendChild(link);
|
|
911
945
|
}
|
|
912
|
-
export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetImage, opening, talk, more = false, onMore = null, live = null, onLive = null,
|
|
913
|
-
oneOffice = false, readOnly = false, stream = true, storage = undefined, cardRows = null, words = null, cardAction = null, cardName = null, officesKey = undefined, foldBar = false }) {
|
|
946
|
+
export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetImage, opening, talk, chatUi = null, more = false, onMore = null, live = null, onLive = null,
|
|
947
|
+
oneOffice = false, readOnly = false, stream = true, storage = undefined, cardRows = null, words = null, cardAction = null, cardName = null, officesKey = undefined, foldBar = false, cardPhoto = null }) {
|
|
914
948
|
// M-3253: on a phone the page above (fleet-canvas.js) puts a ⋯ in its bar: `more` is that sheet open, `onMore(open)`;
|
|
915
949
|
// `live` / `onLive` its Live toggle, which moves into the sheet. Without one (a share link's page) the bar stays.
|
|
916
950
|
useLayoutEffect(ensureDialogueStyle, []);
|
|
@@ -924,7 +958,9 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
|
|
|
924
958
|
const [canEdit, setCanEdit] = useState(false); // an admin session (never a guest or the public link)
|
|
925
959
|
const [canShare, setCanShare] = useState(false); // #2636: an admin session, here or over the public link
|
|
926
960
|
const [editing, setEditing] = useState(false);
|
|
927
|
-
|
|
961
|
+
// Never picked here: All offices, the map of every office (one click enters one, unremembered; Back returns) — the
|
|
962
|
+
// whole fleet while fewer than two are stored. A pick from the switcher is kept per device, as before.
|
|
963
|
+
const [choice, setChoice] = useState(() => opening ?? store.choice(ALL_ID));
|
|
928
964
|
const [filter, setFilter] = useState(() => store.filter());
|
|
929
965
|
// #4010: the carousel's offices and interval (per browser); the slide index and playing are this visit only.
|
|
930
966
|
const [carSaved, setCarSaved] = useState(() => store.carousel());
|
|
@@ -956,6 +992,17 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
|
|
|
956
992
|
// conversations; the avatars read for it; what it last said for a screen reader. `dlgRef`: what draw() reads (it runs
|
|
957
993
|
// from the loop, outside a render); `dlgShown`: the box as last drawn (its clicks).
|
|
958
994
|
const [dialogueOn, setDialogueOn] = useState(() => store.dialogueOn());
|
|
995
|
+
// Talking from here (fleet-office-talk.js, `chatUi`: the dashboard's only, never a share link): how (per browser) and
|
|
996
|
+
// to whom; `chat` the conversations every way shows.
|
|
997
|
+
const [talkMode, setTalkMode] = useState(() => store.talkMode());
|
|
998
|
+
const [talkTo, setTalkTo] = useState(null);
|
|
999
|
+
const [readMode, setReadMode] = useState(() => (chatUi ? chatUi.readModeOf(store.talkRead()) : "click"));
|
|
1000
|
+
const chat = useMemo(() => (chatUi ? chatUi.createTalk() : null), [chatUi]);
|
|
1001
|
+
// #4406: the Dialogue-box talk shows the dialogue's conversations, so they run while it is picked — without ticking
|
|
1002
|
+
// Dialogue for the person (their own choice, kept as they left it when they pick another way to talk).
|
|
1003
|
+
const boxTalk = !!chat && talk === undefined && typeof onOpen === "function" && chatUi.talkModeOf(talkMode) === "box";
|
|
1004
|
+
const dlgOn = dialogueOn || boxTalk;
|
|
1005
|
+
const replyRef = useRef(null);
|
|
959
1006
|
const dlg = useMemo(createDialogue, []);
|
|
960
1007
|
const faces = useMemo(() => createFaces(), []);
|
|
961
1008
|
const [dlgSay, setDlgSay] = useState("");
|
|
@@ -1115,7 +1162,7 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
|
|
|
1115
1162
|
if (who) setDlgSay(to("dlgSays", ...words(who)));
|
|
1116
1163
|
};
|
|
1117
1164
|
useEffect(() => {
|
|
1118
|
-
if (!
|
|
1165
|
+
if (!dlgOn || talk !== undefined) return undefined;
|
|
1119
1166
|
const sub = streamOn();
|
|
1120
1167
|
if (!sub) return undefined;
|
|
1121
1168
|
let skew = 0;
|
|
@@ -1135,9 +1182,9 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
|
|
|
1135
1182
|
const hold = (off) => (lease ? lease.hold(off) : off);
|
|
1136
1183
|
const offs = [hold(sub("clock", (d) => { if (d && typeof d.now === "number") skew = d.now - Date.now(); })), hold(sub("message", take))];
|
|
1137
1184
|
return () => { for (const off of offs) if (typeof off === "function") off(); };
|
|
1138
|
-
}, [
|
|
1185
|
+
}, [dlgOn, lease, talk === undefined]);
|
|
1139
1186
|
useEffect(() => {
|
|
1140
|
-
if (!
|
|
1187
|
+
if (!dlgOn || !talk) return;
|
|
1141
1188
|
let changed = false;
|
|
1142
1189
|
for (const x of talkOf(talk)) {
|
|
1143
1190
|
const k = `${x.instance}|${x.kind}|${x.at}`;
|
|
@@ -1150,13 +1197,13 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
|
|
|
1150
1197
|
sayFor(x.instance, (who) => (x.kind === "heard" ? [to("dlgSomeone"), to("dlgHeardShare", nodeText(who.node).primary)] : [nodeText(who.node).primary, to("dlgAnsweredShare")]));
|
|
1151
1198
|
}
|
|
1152
1199
|
if (changed) dlgWake();
|
|
1153
|
-
}, [
|
|
1200
|
+
}, [dlgOn, talk]);
|
|
1154
1201
|
// What is over goes (an answer after its fade, a conversation never answered); the box is drawn again meanwhile.
|
|
1155
1202
|
useEffect(() => {
|
|
1156
|
-
if (!
|
|
1157
|
-
const h = setInterval(() => { if (dlg.sweep(now(), still) || dlg.size()) dlgWake(); }, 1000);
|
|
1203
|
+
if (!dlgOn) return undefined;
|
|
1204
|
+
const h = setInterval(() => { if (dlg.sweep(now(), still, !!(dlgRef.current && dlgRef.current.vn)) || dlg.size()) dlgWake(); }, 1000);
|
|
1158
1205
|
return () => clearInterval(h);
|
|
1159
|
-
}, [
|
|
1206
|
+
}, [dlgOn]);
|
|
1160
1207
|
const toggleDialogue = () => {
|
|
1161
1208
|
const v = !dialogueOn;
|
|
1162
1209
|
store.saveDialogueOn(v); setDialogueOn(v);
|
|
@@ -1281,6 +1328,18 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
|
|
|
1281
1328
|
// what will stand, sit or lie there, not by a dot.
|
|
1282
1329
|
const ghosts = zones && !!layout && !layoutStale;
|
|
1283
1330
|
const shared = talk !== undefined || typeof onOpen !== "function";
|
|
1331
|
+
const tmode = chat && !shared ? chatUi.talkModeOf(talkMode) : "window";
|
|
1332
|
+
useEffect(() => {
|
|
1333
|
+
if (!chat || tmode === "window") return undefined;
|
|
1334
|
+
const sub = appStore.get().streamOn, hold = (off) => (lease ? lease.hold(off) : off);
|
|
1335
|
+
const off = sub ? hold(sub("message", chat.take)) : null;
|
|
1336
|
+
const quiet = chat.subscribe(() => { if (still && scene.current) draw(0); else loop.current?.wake(); });
|
|
1337
|
+
return () => { if (typeof off === "function") off(); quiet(); };
|
|
1338
|
+
}, [chat, tmode, lease]);
|
|
1339
|
+
const pickTalkMode = (v) => {
|
|
1340
|
+
store.saveTalkMode(v); setTalkMode(v);
|
|
1341
|
+
if (v === "window") setTalkTo(null);
|
|
1342
|
+
};
|
|
1284
1343
|
// What a view and per-device seat choices are kept for: the office and its style (All offices: its own key).
|
|
1285
1344
|
const officeKey = overview ? `${ALL_ID}@tiles` : `${custom ? custom.id : AUTO_ID}@${baseSkin.id}`;
|
|
1286
1345
|
const keep = (n) => !(hideAsleep && ASLEEP.has(n.state));
|
|
@@ -1458,7 +1517,7 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
|
|
|
1458
1517
|
const v = view0(), sz = sizeRef.current;
|
|
1459
1518
|
const w = c.walks ? walkers.at(c.name, now()) : null;
|
|
1460
1519
|
const pt = w ? { x: w.x, y: w.y - 52, r: 16 } : { x: c.box.x + c.box.w / 2, y: c.box.y, r: (c.box.w / 2) * v.k };
|
|
1461
|
-
const p = toScreen(v, pt.x, pt.y), cw = el.offsetWidth || 320, ch = el.offsetHeight || 260, gap =
|
|
1520
|
+
const p = toScreen(v, pt.x, pt.y), cw = el.offsetWidth || 320, ch = el.offsetHeight || 260, gap = (c.skin?.pack?.card?.layout?.gap ?? 12) + pt.r;
|
|
1462
1521
|
let x = p.x + gap;
|
|
1463
1522
|
if (x + cw > sz.w - 8) x = p.x - gap - cw;
|
|
1464
1523
|
x = Math.max(8, Math.min(x, sz.w - cw - 8));
|
|
@@ -1526,11 +1585,13 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
|
|
|
1526
1585
|
* under the zoom controls at the side.
|
|
1527
1586
|
*/
|
|
1528
1587
|
const fitL = (mode) => fitScene(L.width, L.height, size, mode, overview && mode !== "cover" ? FIT_PAD : 0);
|
|
1588
|
+
/** #4405: this scene's zoom floor — lower than OK_MIN for a pack's big canvas (or All offices), so − reaches its Fit. */
|
|
1589
|
+
const kLo = minK(L.width, L.height);
|
|
1529
1590
|
/** The view an office opens on: its kept one (a kept fit: fitted to this size), else its opening; and whether a fit. */
|
|
1530
1591
|
const openView = () => {
|
|
1531
1592
|
const kept = store.view(officeKey);
|
|
1532
1593
|
if (kept && kept.fit) return { v: fitL(fitMode), fit: true };
|
|
1533
|
-
if (kept) return { v: viewFromSaved(kept, size), fit: false };
|
|
1594
|
+
if (kept) return { v: viewFromSaved(kept, size, kLo), fit: false };
|
|
1534
1595
|
const fitted0 = zones || overview; // All offices opens whole, as a zones scene
|
|
1535
1596
|
return { v: overview ? fitL(fitMode) : openingView(L.width, L.height, size, ratio, fitted0, fitMode), fit: fitted0 };
|
|
1536
1597
|
};
|
|
@@ -1564,7 +1625,7 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
|
|
|
1564
1625
|
fit(next);
|
|
1565
1626
|
};
|
|
1566
1627
|
/** + / −: the next pixel level about the stage's middle. */
|
|
1567
|
-
const zoomStep = (dir) => { const v = view0(), k = stepK(v.k, dir, ratio); raw.current = k; setView(zoomTo(v, k, size.w / 2, size.h / 2)); };
|
|
1628
|
+
const zoomStep = (dir) => { const v = view0(), k = stepK(v.k, dir, ratio, kLo); raw.current = k; setView(zoomTo(v, k, size.w / 2, size.h / 2)); };
|
|
1568
1629
|
/** Bring a box (logical units) into view, unchanged when it already is. */
|
|
1569
1630
|
const show = (b) => {
|
|
1570
1631
|
const v = view0(), p = toScreen(v, b.x, b.y);
|
|
@@ -1647,7 +1708,14 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
|
|
|
1647
1708
|
return () => root.classList.remove("oo-immersive");
|
|
1648
1709
|
}, [fs]);
|
|
1649
1710
|
/** A desk opens its chat: out of fullscreen first (the chat is beside the view, or instead of it). */
|
|
1650
|
-
const open = (name) => {
|
|
1711
|
+
const open = (name) => {
|
|
1712
|
+
if (!onOpen) return;
|
|
1713
|
+
if (tmode !== "window") { setTalkTo(name); return; }
|
|
1714
|
+
if (fsRef.current) exitFs();
|
|
1715
|
+
onOpen(name);
|
|
1716
|
+
};
|
|
1717
|
+
/** The whole chat (the pop-up), from a talk in the Office. */
|
|
1718
|
+
const openFull = () => { if (!onOpen || !talkTo) return; if (fsRef.current) exitFs(); onOpen(talkTo); };
|
|
1651
1719
|
|
|
1652
1720
|
// ── Drawing: the back and front layers are pictures of the scene at the view's resolution (remade when the office
|
|
1653
1721
|
// or the zoom changes, never on a pan); each frame draws the matte, the layers, the people and the items in the air ──
|
|
@@ -1704,6 +1772,7 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
|
|
|
1704
1772
|
ctx.clearRect(0, 0, BW, BH);
|
|
1705
1773
|
ctx.fillStyle = s.matte; ctx.fillRect(0, 0, BW, BH);
|
|
1706
1774
|
ctx.imageSmoothingEnabled = false;
|
|
1775
|
+
for (const p of s.overview ? s.parts : [s.part]) p.reply = replyRef.current ? { ...replyRef.current, ratio: s.ratio } : null;
|
|
1707
1776
|
if (!s.overview) {
|
|
1708
1777
|
// #4379 review: an open card (beside its person, or a bottom sheet) covers part of the scene: a name tag under it is
|
|
1709
1778
|
// left out whole, never a fragment showing past its edge. Its box in bitmap px, as the canvas lies on the page.
|
|
@@ -1760,7 +1829,8 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
|
|
|
1760
1829
|
if (!front) { dlgShown.current = null; showDialogueDock(false); return false; }
|
|
1761
1830
|
const who = d.who.get(front.instance), node = who.node;
|
|
1762
1831
|
const stage = stageOf(front, t, node.state === "working", still);
|
|
1763
|
-
|
|
1832
|
+
// Talk "Dialogue box" (d.vn) keeps an answer until it is clicked away in its own box (TalkStage); the dock is not drawn then.
|
|
1833
|
+
if (stage.done && !d.vn) { dlgShown.current = null; showDialogueDock(false); return false; }
|
|
1764
1834
|
showDialogueDock(true);
|
|
1765
1835
|
const cv = dialogueCanvasRef.current;
|
|
1766
1836
|
if (!cv) return false; // layout commit mounts the dock, then its effect paints even with reduced motion
|
|
@@ -1817,10 +1887,10 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
|
|
|
1817
1887
|
}
|
|
1818
1888
|
// A newly mounted dock must paint even when reduced motion leaves the map loop asleep.
|
|
1819
1889
|
useLayoutEffect(() => {
|
|
1820
|
-
if (!
|
|
1890
|
+
if (!dlgOn || !dlgVisible) return;
|
|
1821
1891
|
if (scene.current) drawDialogue(scene.current.ctx, scene.current, still ? 0 : now());
|
|
1822
1892
|
if (!still) loop.current?.wake();
|
|
1823
|
-
}, [
|
|
1893
|
+
}, [dlgOn, dlgVisible, dlgSay, width, phone, ratio]);
|
|
1824
1894
|
|
|
1825
1895
|
// The loop: drawing only when the frame (FPS) changed or something is in the air; stopped while the tab is hidden,
|
|
1826
1896
|
// gone with the view. Office review: while something walks or flies, one requestAnimationFrame per display frame (the
|
|
@@ -1879,7 +1949,35 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
|
|
|
1879
1949
|
area: zones ? areaName(d.area) : roomOf(L, d), skin, look: looks.get(d.key) }));
|
|
1880
1950
|
// #2861: who the dialogue box may speak for — everyone drawn here (All offices: the first tile they are in), with what
|
|
1881
1951
|
// draws them; null while it is off (draw() then draws nothing of it).
|
|
1882
|
-
|
|
1952
|
+
replyRef.current = tmode === "bubble" ? { chat, draw: chatUi.drawReply, style: chatUi.replyStyle, pace: chatUi.readPace, read: readMode } : null;
|
|
1953
|
+
const talkWho = talkTo ? people.find((d) => d.node && d.node.name === talkTo) || null : null;
|
|
1954
|
+
const talkLabel = talkWho ? nodeText(talkWho.node).primary : talkTo;
|
|
1955
|
+
const sidePanel = tmode === "panel" && !!talkTo;
|
|
1956
|
+
/** Talk "Dialogue box": what the box on the scene shows now (fleet-office-talk.js TalkStage), or null. */
|
|
1957
|
+
const stagePeek = () => {
|
|
1958
|
+
const d = dlgRef.current;
|
|
1959
|
+
const pf = d ? pickFront(dlg.list(), (n) => d.who.has(n), (n) => d.who.get(n).look?.pose === "paused") : { front: null, more: 0 };
|
|
1960
|
+
const conv = pf.front, name = conv ? conv.instance : talkTo;
|
|
1961
|
+
if (!name) return null;
|
|
1962
|
+
const who = d ? d.who.get(name) : null, node = who ? who.node : (people.find((x) => x.node && x.node.name === name) || {}).node;
|
|
1963
|
+
if (!node) return null;
|
|
1964
|
+
const sk = (who && who.skin) || skin, pack = sk && sk.pack, act = actsHere && actsHere.get(name);
|
|
1965
|
+
const pic = (src) => { const im = src && sk && typeof sk.picture === "function" ? sk.picture(src, () => {}) : null; return im && im.src ? im.src : null; };
|
|
1966
|
+
return {
|
|
1967
|
+
name, label: nodeText(node).primary, conv, more: pf.more,
|
|
1968
|
+
status: node.state === "working" ? (actLive(act, node.state, Date.now(), null) && act.say ? act.say : to("dlgWorking")) : null,
|
|
1969
|
+
portrait: pack ? pic(portraitSrc(pack, { agent: name, state: node.state })) : null,
|
|
1970
|
+
colours: (pack && pack.dialogBox) || null,
|
|
1971
|
+
};
|
|
1972
|
+
};
|
|
1973
|
+
const stageOps = {
|
|
1974
|
+
now, skip: () => skipTalk(), target: (n) => { if (talkTo !== n) setTalkTo(n); },
|
|
1975
|
+
drop: (instance) => { dlg.drop(instance); dlgWake(); },
|
|
1976
|
+
};
|
|
1977
|
+
// The dialogue box is the talk only as itself (or beside the pop-up): never under the side panel or the head bubble.
|
|
1978
|
+
const dockShown = dlgOn && dlgVisible && tmode === "window";
|
|
1979
|
+
dlgRef.current = dlgOn ? {
|
|
1980
|
+
vn: tmode === "box", read: readMode,
|
|
1883
1981
|
who: new Map(people.filter((d) => d.node && d.node.name).reverse().map((d) => [d.node.name, { key: d.key, node: d.node, look: d.look, skin: d.skin || skin }])),
|
|
1884
1982
|
acts: actsHere, share: talk !== undefined,
|
|
1885
1983
|
} : null;
|
|
@@ -1909,7 +2007,7 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
|
|
|
1909
2007
|
return d ? { key: p.prefix + d.key, node: d.node } : null;
|
|
1910
2008
|
};
|
|
1911
2009
|
const g = gestures(drag.current, { el: () => stageRef.current, pan: (dx, dy) => { const v = view0(); setView({ ...v, x: v.x + dx, y: v.y + dy }); },
|
|
1912
|
-
pinch: (from, to) => { raw.current = Math.min(OK_MAX, Math.max(
|
|
2010
|
+
pinch: (from, to) => { raw.current = Math.min(OK_MAX, Math.max(kLo, raw.current * (to.dist / from.dist))); setView(pinchOffice(view0(), from, to, raw.current, kLo)); } });
|
|
1913
2011
|
/** Where a drag pans: the canvas, and Edit layout's overlay off its handles (the controls, the bar and the list: never). */
|
|
1914
2012
|
const onScene = (el) => !!el && (el === canvasRef.current || (typeof el.closest === "function" && !!el.closest(".ol-svg") && !el.closest(".ol-handle")));
|
|
1915
2013
|
/** M-3293 / M-3445: update the floor-level seat drop targets while carrying `h` ({ name, at }). */
|
|
@@ -2005,8 +2103,8 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
|
|
|
2005
2103
|
if (!onScene(e.target) && !(typeof e.target?.closest === "function" && e.target.closest(".ol-handle, .oo-tile-label"))) return;
|
|
2006
2104
|
e.preventDefault();
|
|
2007
2105
|
const r = stageRef.current.getBoundingClientRect(), v = view0();
|
|
2008
|
-
raw.current = Math.min(OK_MAX, Math.max(
|
|
2009
|
-
if (raw.current !== v.k) setView(zoomOffice(v, raw.current, e.clientX - r.left, e.clientY - r.top));
|
|
2106
|
+
raw.current = Math.min(OK_MAX, Math.max(kLo, raw.current * wheelFactor(e)));
|
|
2107
|
+
if (raw.current !== v.k) setView(zoomOffice(v, raw.current, e.clientX - r.left, e.clientY - r.top, kLo));
|
|
2010
2108
|
};
|
|
2011
2109
|
const onKeyDown = (e) => {
|
|
2012
2110
|
if (e.defaultPrevented) return; // Edit layout's handles move with the arrows
|
|
@@ -2057,6 +2155,9 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
|
|
|
2057
2155
|
}
|
|
2058
2156
|
setCard(null); open(dlgShown.current.name);
|
|
2059
2157
|
};
|
|
2158
|
+
/** Skip (the reading controls): every reply in the box, or over the heads, goes now. */
|
|
2159
|
+
const skipTalk = () => { if (tmode === "box") dlg.skip(); else if (chat) chat.skipAll(); dlgWake(); };
|
|
2160
|
+
const pickRead = (v) => { store.saveTalkRead(v); setReadMode(v); dlgWake(); };
|
|
2060
2161
|
const onMove = (e) => {
|
|
2061
2162
|
if (e.pointerType === "touch" || g.busy() || snackDrag || snackDropRef.current) return;
|
|
2062
2163
|
const onDlg = !!dlgAt(e) || !!bubbleAtEvent(e);
|
|
@@ -2082,7 +2183,7 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
|
|
|
2082
2183
|
const wk = zones ? walkers.at(d.node.name, at) : null;
|
|
2083
2184
|
return { key: d.key, node: d.node, x: wk ? wk.x : d.box.x + d.box.w / 2, y: wk ? wk.y - 32 : d.box.y + d.box.h / 2 };
|
|
2084
2185
|
});
|
|
2085
|
-
return nearestPerson(list, w.x, w.y, TAP_R / Math.max(
|
|
2186
|
+
return nearestPerson(list, w.x, w.y, TAP_R / Math.max(kLo, view0().k));
|
|
2086
2187
|
};
|
|
2087
2188
|
/** M-3432 (#4255): feed an awake person a snack (plays eat animation + hearts + feed bubble + optional Tell). */
|
|
2088
2189
|
const feedPerson = (name, snack, at) => {
|
|
@@ -2198,6 +2299,7 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
|
|
|
2198
2299
|
const onClick = (e) => {
|
|
2199
2300
|
const box = dlgAt(e);
|
|
2200
2301
|
const bubble = bubbleAtEvent(e);
|
|
2302
|
+
if (bubble && bubble.reply && chat) { if (talkTo !== bubble.name) setTalkTo(bubble.name); chat.advance(bubble.name); return; }
|
|
2201
2303
|
if ((box || bubble) && !shared && onOpen) {
|
|
2202
2304
|
if (!(e.detail > 1)) { setCard(null); open((box || bubble).name); }
|
|
2203
2305
|
return;
|
|
@@ -2224,12 +2326,21 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
|
|
|
2224
2326
|
}
|
|
2225
2327
|
}
|
|
2226
2328
|
const d = deskOf(e) || (lastType.current === "touch" ? nearOf(e) : null);
|
|
2227
|
-
if (!d || !d.node.i) { setTip(null); setCard(null); return; }
|
|
2329
|
+
if (!d || !d.node.i) { if (enterTile(e)) return; setTip(null); setCard(null); return; }
|
|
2228
2330
|
if (lastType.current === "touch") setTip(null);
|
|
2229
2331
|
cardFrom.current = null;
|
|
2230
2332
|
setCard((cur) => (cur === d.key ? null : d.key));
|
|
2231
2333
|
};
|
|
2232
|
-
|
|
2334
|
+
/** All offices: a click on a tile (off its people) enters that office for this visit; the lobby is no office. */
|
|
2335
|
+
const enterTile = (e) => {
|
|
2336
|
+
const s = scene.current, w = pointOf(e);
|
|
2337
|
+
if (!overview || !s || !s.overview || !w || deskOf(e)) return false;
|
|
2338
|
+
const tt = tileAt(s.lay, w.x, w.y) || labelAt(s.lay, w.x, w.y), tl = tt ? tiles.find((x) => x.key === tt.key) : null;
|
|
2339
|
+
if (!tl || tl.lobby) return false;
|
|
2340
|
+
setCard(null); pick(tl.key, false);
|
|
2341
|
+
return true;
|
|
2342
|
+
};
|
|
2343
|
+
// All offices: a double-click on a tile (off its people) opens that office, as one click does.
|
|
2233
2344
|
const onDblClick = (e) => {
|
|
2234
2345
|
const box = dlgAt(e);
|
|
2235
2346
|
if (box || bubbleAtEvent(e)) return; // the first click already opened it
|
|
@@ -2281,7 +2392,8 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
|
|
|
2281
2392
|
const teamValue = (opts.find((o) => o.team === f.team) || opts[0]).value;
|
|
2282
2393
|
const setF = (next) => { const v = filterOk(next); store.saveFilter(v); setFilter(v); };
|
|
2283
2394
|
// While Edit layout is open the office stays (its picker is disabled; this is the guard behind it).
|
|
2284
|
-
|
|
2395
|
+
/** The switcher's pick (kept per device); `keep` false: a tile entered from All offices, for this visit only. */
|
|
2396
|
+
const pick = (id, keep = true) => {
|
|
2285
2397
|
if (layoutRef.current) return;
|
|
2286
2398
|
if (id === CAROUSEL_ID) {
|
|
2287
2399
|
const cur = store.carousel();
|
|
@@ -2289,7 +2401,8 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
|
|
|
2289
2401
|
const next = { ids: ids.length ? ids : stored.map((o) => o.id), interval: intervalOk(cur && cur.interval) };
|
|
2290
2402
|
store.saveCarousel(next); setCarSaved(next); setCarIndex(0); setCarPlaying(true);
|
|
2291
2403
|
}
|
|
2292
|
-
store.saveChoice(id);
|
|
2404
|
+
if (keep) store.saveChoice(id);
|
|
2405
|
+
setChoice(id); setTip(null);
|
|
2293
2406
|
};
|
|
2294
2407
|
const setCarIds = (ids) => {
|
|
2295
2408
|
const next = { ids, interval: intervalOk(carSaved && carSaved.interval) };
|
|
@@ -2308,7 +2421,7 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
|
|
|
2308
2421
|
const tipText = tipDesk ? nodeText(tipDesk.node) : null;
|
|
2309
2422
|
// #2661: the card's person (gone from the office, filtered out or the office changed: it closes).
|
|
2310
2423
|
const cardOf = card ? people.find((d) => d.key === card && d.node.i) || null : null;
|
|
2311
|
-
cardDesk.current = cardOf ? { name: cardOf.node.name, box: cardOf.box, walks: zones && !overview } : null;
|
|
2424
|
+
cardDesk.current = cardOf ? { name: cardOf.node.name, box: cardOf.box, walks: zones && !overview, skin: cardOf.skin } : null;
|
|
2312
2425
|
useEffect(() => { if (card && !cardOf) setCard(null); }, [card, !!cardOf]);
|
|
2313
2426
|
const closeCard = () => {
|
|
2314
2427
|
setCard(null);
|
|
@@ -2348,7 +2461,8 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
|
|
|
2348
2461
|
const r = deviceRatio(), W = Number(sizePx) || 56;
|
|
2349
2462
|
if (cv.width !== Math.round(W * r) || cv.height !== Math.round(W * r)) { cv.width = Math.round(W * r); cv.height = Math.round(W * r); }
|
|
2350
2463
|
g.setTransform(1, 0, 0, 1, 0, 0); g.clearRect(0, 0, cv.width, cv.height); g.imageSmoothingEnabled = false;
|
|
2351
|
-
|
|
2464
|
+
// The card's avatar: the set's still `stand` when it has one (poseStrip falls back to idle).
|
|
2465
|
+
const look = { ...c.look, pose: "stand", dim: false, match: false, badge: null, notag: true, free: true, work: 0, sign: null };
|
|
2352
2466
|
const at = { x: 0, y: 0 }, b = c.skin.charBox ? c.skin.charBox(look, at) : null, box = b || { x: -16, y: -48, w: 32, h: 48 };
|
|
2353
2467
|
const k = Math.min((W - 8) / box.w, (W - 8) / box.h) * r;
|
|
2354
2468
|
g.setTransform(k, 0, 0, k, (W * r) / 2 - (box.x + box.w / 2) * k, (W * r) / 2 - (box.y + box.h / 2) * k);
|
|
@@ -2417,6 +2531,7 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
|
|
|
2417
2531
|
// M-3556: the bar in three groups — scope (which office, whom: left of the desk's one row), the display options (behind
|
|
2418
2532
|
// ⚙) and the actions (right). A phone's ⋯ sheet lists all three in that order.
|
|
2419
2533
|
const scopeItems = html`
|
|
2534
|
+
${custom && !carouselPick && opening == null && !layout && overviewOk(stored) ? html`<button type="button" class="btn btn-sm oo-back-all" onClick=${() => pick(ALL_ID)}>${to("backAll")}</button>` : null}
|
|
2420
2535
|
${oneOffice ? null : html`<label class="oo-pick"><span class="oo-pick-label">${to("office")}</span>${officeSelect("oo-office")}</label>`}
|
|
2421
2536
|
${auto ? html`<label class="oo-pick"><span class="oo-pick-label">${to("show")}</span>
|
|
2422
2537
|
<select class="tb-select oo-team" value=${teamValue} onChange=${(e) => { const o = opts.find((x) => x.value === e.target.value); setF({ ...f, team: o ? o.team : "" }); }}>
|
|
@@ -2447,6 +2562,10 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
|
|
|
2447
2562
|
onChange=${() => { const v = !playOn; store.savePlayOn(v); setPlayOn(v); }} /><span>${to("playOn")}</span>${playStillOff ? html`<span class="muted oo-note oo-play-still">${to("playMotionOff")}</span>` : null}</label>` : null}
|
|
2448
2563
|
${zones || overview ? html`<label class="check oo-night"><input type="checkbox" checked=${nightOn} onChange=${() => { const v = !nightOn; store.saveNightOn(v); setNightOn(v); }} /><span>${to("nightOn")}</span></label>` : null}
|
|
2449
2564
|
<label class="check oo-dialogue" title=${to("dialogueTitle")}><input type="checkbox" checked=${dialogueOn} onChange=${toggleDialogue} /><span>${to("dialogue")}</span></label>
|
|
2565
|
+
${chat && !shared ? html`<label class="oo-pick oo-talk-pick" title=${chatUi.talkWord("modeTitle")}><span class="oo-pick-label">${chatUi.talkWord("mode")}</span>
|
|
2566
|
+
<select class="tb-select oo-talk-mode" value=${tmode} onChange=${(e) => pickTalkMode(e.target.value)}>
|
|
2567
|
+
${chatUi.TALK_MODES.map((m) => html`<option key=${m} value=${m}>${chatUi.talkWord(m)}</option>`)}
|
|
2568
|
+
</select></label>` : null}
|
|
2450
2569
|
${overview ? html`<label class="check oo-lobby-tile" title=${lobbyAll.length ? undefined : to("lobbyEveryone")}><input type="checkbox" checked=${lobbyOn && lobbyAll.length > 0}
|
|
2451
2570
|
disabled=${!lobbyAll.length} onChange=${() => { const v = !lobbyOn; store.saveLobbyTile(v); setLobbyOn(v); setTip(null); }} /><span>${to("lobbyTile")}</span></label>
|
|
2452
2571
|
${lobbyAll.length ? null : html`<span class="muted oo-note oo-lobby-none">${to("lobbyEveryone")}</span>`}` : null}
|
|
@@ -2475,7 +2594,7 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
|
|
|
2475
2594
|
const displayMenu = (opener) => html`<div class=${`oo-display${roomGear ? " oo-display-zoom" : ""}`} ref=${displayRef}>${opener}
|
|
2476
2595
|
${dispOpen ? html`<div class="oo-display-pop" role="group" aria-label=${to("display")} ref=${fitPop}><h3 class="oo-display-h">${to("display")}</h3>
|
|
2477
2596
|
<div class="oo-bar oo-display-list">${optionItems}</div></div>` : null}</div>`;
|
|
2478
|
-
return html`<div class=${`oo${fs ? ` fs ${fs}` : ""}${compact ? " phone" : ""}${
|
|
2597
|
+
return html`<div class=${`oo${fs ? ` fs ${fs}` : ""}${compact ? " phone" : ""}${dockShown ? " has-dialogue" : ""}${sidePanel && !phone ? " ot-side" : ""}`} ref=${ooRef}>
|
|
2479
2598
|
${folded ? null : html`<div class="oo-bar oo-bar-row">
|
|
2480
2599
|
<div class="oo-bar-scope">${scopeItems}</div>
|
|
2481
2600
|
<div class="oo-bar-actions">${actionItems}
|
|
@@ -2498,14 +2617,16 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
|
|
|
2498
2617
|
${overview || people.length || L.rooms.length ? null : html`<p class="note oo-empty">${to("nobody")} ${auto && (f.team || f.pinned.length) ? html`<button type="button" class="btn btn-sm" onClick=${() => setF({ team: "", pinned: [] })}>${to("everyone")}</button>` : null}</p>`}
|
|
2499
2618
|
<div class=${`oo-stage${layout ? " editing" : ""}`} ref=${stageRef} onPointerDown=${onDown} onPointerMove=${onStageMove} onPointerUp=${onStageUp} onPointerCancel=${onStageCancel}
|
|
2500
2619
|
onWheel=${onWheel} onKeyDown=${onKeyDown} onFocusIn=${onFocusIn} onClickCapture=${g.clickCapture}>
|
|
2501
|
-
${
|
|
2620
|
+
${dlgOn ? html`<div class="sr-only oo-dialogue-live" aria-live="polite">${dlgSay}</div>` : null}
|
|
2502
2621
|
<canvas ref=${canvasRef} class=${`oo-canvas${(tipDesk && tipDesk.node.i) || dlgHot ? " hot" : ""}`} role="application" tabindex="0" aria-label=${to(carouselPick ? "labelCarousel" : overview ? "labelAll" : "label")}
|
|
2503
2622
|
onPointerMove=${onMove} onPointerLeave=${() => setTip(null)} onClick=${onClick} ondblclick=${onDblClick}></canvas>
|
|
2623
|
+
${tmode === "box" ? html`<${chatUi.TalkStage} peek=${stagePeek} ops=${stageOps} talk=${chat} read=${readMode} onRead=${pickRead} phone=${phone} still=${still}
|
|
2624
|
+
onFull=${openFull} onClose=${() => { dlg.skip(); setTalkTo(null); dlgWake(); }} />` : null}
|
|
2504
2625
|
${overview ? tiles.map((tl) => {
|
|
2505
2626
|
const text = to("tileLabel", tl.name, tl.count), at = (el) => { if (el) labelEls.current.set(tl.key, el); else labelEls.current.delete(tl.key); };
|
|
2506
2627
|
return tl.lobby ? html`<span key=${tl.key} ref=${at} class="oo-tile-label lobby">${text}</span>`
|
|
2507
2628
|
: html`<button key=${tl.key} ref=${at} type="button" class="oo-tile-label" data-office=${tl.key} title=${to("openOffice", tl.name)} aria-label=${to("openOffice", tl.name)}
|
|
2508
|
-
onClick=${() => pick(tl.key)}>${text}</button>`;
|
|
2629
|
+
onClick=${() => pick(tl.key, false)}>${text}</button>`;
|
|
2509
2630
|
}) : null}
|
|
2510
2631
|
${layout ? html`<${LayoutEditor} key=${layout.id} base=${layout.base} start=${layout.start} place=${placeOverlay} dock=${!fs} members=${layoutMembers}
|
|
2511
2632
|
stale=${layoutStale ? t("orgl.stale") : ""} onChange=${onDraft} onSave=${saveLayout} onClose=${closeLayout} />` : null}
|
|
@@ -2532,13 +2653,17 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
|
|
|
2532
2653
|
walkNow.current?.();
|
|
2533
2654
|
}
|
|
2534
2655
|
}
|
|
2535
|
-
|
|
2656
|
+
// A pat with the set's `pat` strip lasts one full pass of it (never shorter than the hearts).
|
|
2657
|
+
const t0 = now(), patSt = kind === "pat" && skin.patStrip ? skin.patStrip(n) : null;
|
|
2658
|
+
reacts.current.set(n, { kind, t0, ...(patSt ? { until: t0 + Math.max(PLAY.REACT_MS, stripDurationMs(patSt)) } : {}) });
|
|
2659
|
+
loop.current?.wake(); if (store.tellOn(n)) void store.tell(n, kind);
|
|
2536
2660
|
} : null}
|
|
2537
2661
|
tell=${play ? { on: store.tellOn(cardOf.node.name), set: (v) => { store.saveTell(cardOf.node.name, v); setTellRev((x) => x + 1); } } : null}
|
|
2538
2662
|
packCard=${cardOf.skin?.pack?.card || null}
|
|
2539
2663
|
picture=${typeof cardOf.skin?.picture === "function" ? cardOf.skin.picture : null}
|
|
2540
2664
|
portrait=${cardOf.skin?.pack ? portraitSrc(cardOf.skin.pack, { agent: cardOf.node.name, state: cardOf.node.state }) : null}
|
|
2541
|
-
packScale=${cardOf.skin?.pack?.scale || 2} action=${cardAction ? cardAction(cardOf.node.name) : null}
|
|
2665
|
+
packScale=${cardOf.skin?.pack?.scale || 2} action=${cardAction ? cardAction(cardOf.node.name) : null}
|
|
2666
|
+
photo=${cardPhoto ? cardPhoto(cardOf.node.name) : null} />` : null}
|
|
2542
2667
|
<ul class="oo-desks" aria-label=${to("desks")}>${people.map((d) => {
|
|
2543
2668
|
const nt = nodeText(d.node), cap = nowOf(d.node), where = d.office ? ` · ${d.office}` : "";
|
|
2544
2669
|
const full = words ? `${nt.primary} — ${stateOf(d.node)}` : nt.full;
|
|
@@ -2590,9 +2715,13 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
|
|
|
2590
2715
|
<button type="button" class="btn btn-sm oo-zone-all" onClick=${() => fit()}>${to("zoneAll")}</button>
|
|
2591
2716
|
${zoneList.map((z) => html`<button key=${z.key} type="button" class="btn btn-sm oo-zone" data-area=${z.key} onClick=${() => toZone(z)}>${to("zoneN", areaName(z.key), z.n)}</button>`)}
|
|
2592
2717
|
</div>` : null}
|
|
2593
|
-
${
|
|
2718
|
+
${dockShown ? html`<canvas class="oo-dialogue-canvas" ref=${dialogueCanvasRef}
|
|
2594
2719
|
role=${onOpen && !shared ? "button" : "img"} tabindex=${onOpen && !shared ? "0" : null}
|
|
2595
2720
|
aria-label=${onOpen && !shared ? to("dlgOpenChat") : dlgSay} title=${onOpen && !shared ? to("dlgOpenChat") : null}
|
|
2596
2721
|
onClick=${openDialogue} onKeyDown=${openDialogue}></canvas>` : null}
|
|
2722
|
+
${tmode === "bubble" ? html`<${chatUi.TalkBar} talk=${chat} name=${talkTo} label=${talkLabel} onFull=${openFull}
|
|
2723
|
+
read=${readMode} onRead=${pickRead} onSkip=${skipTalk} />` : null}
|
|
2724
|
+
${sidePanel ? html`<${chatUi.TalkPanel} talk=${chat} name=${talkTo} label=${talkLabel} state=${talkWho ? talkWho.node.state : null} stateLabel=${talkWho ? stateOf(talkWho.node) : null} sheet=${phone}
|
|
2725
|
+
onClose=${() => setTalkTo(null)} onFull=${openFull} top=${stageRef.current ? stageRef.current.offsetTop : null} />` : null}
|
|
2597
2726
|
</div>`;
|
|
2598
2727
|
}
|
|
@@ -100,7 +100,7 @@ register("tasks", {
|
|
|
100
100
|
reviewYou: "等你確認", reviewBy: "等 {0} 確認", reviewByTip: "由 {0} 確認,不是你",
|
|
101
101
|
main: "主任務", sub: "子任務", urgent: "緊急", high: "高", normal: "一般", low: "低",
|
|
102
102
|
sizeS: "小", sizeM: "中", sizeL: "大", sizeNone: "未定",
|
|
103
|
-
projects: "專案", noProject: "未分類", noProjectDesc: "
|
|
103
|
+
projects: "專案", noProject: "未分類", noProjectDesc: "Fleet 在專案以外開的任務",
|
|
104
104
|
newProject: "新增專案", newMain: "主任務", archived: "已封存", archive: "封存", restore: "恢復",
|
|
105
105
|
rename: "編輯專案", projectName: "名稱", projectDesc: "說明",
|
|
106
106
|
projectLead: "負責的 Agent", projectLeadNone: "無(General)", projectLeadHint: "這個專案裡等你處理的卡片(待確認或卡住)會在負責 Agent 的頻道顯示按鈕;若卡片是某個 Agent 派出的,則顯示在派出者的頻道。", projectLeadGone: "{0}(已不在 fleet 中)", projectLeadChip: "負責:{0}", create: "建立", save: "儲存", cancel: "取消",
|