dsh-agent-team-presets 0.1.8 → 0.2.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 +87 -34
- package/README.zh.md +87 -34
- package/lib/client.js +529 -173
- package/lib/index.js +672 -253
- package/lib/types/application.d.ts +90 -17
- package/lib/types/application.js +105 -56
- package/lib/types/builtin-skill.d.ts +32 -0
- package/lib/types/builtin-skill.js +247 -0
- package/lib/types/client/ComposerTeamSelect.d.ts +5 -3
- package/lib/types/client/ComposerTeamSelect.js +173 -15
- package/lib/types/client/locales.d.ts +1 -1
- package/lib/types/client/locales.js +18 -0
- package/lib/types/client/team-presets-controller.d.ts +42 -0
- package/lib/types/client/team-presets-controller.js +50 -5
- package/lib/types/config.d.ts +4 -0
- package/lib/types/config.js +3 -0
- package/lib/types/execution.d.ts +5 -0
- package/lib/types/execution.js +14 -3
- package/lib/types/index.js +184 -74
- package/lib/types/member-runtime.js +16 -22
- package/lib/types/presentation.d.ts +23 -105
- package/lib/types/presentation.js +37 -85
- package/lib/types/preset-tools.js +2 -2
- package/lib/types/presets.d.ts +70 -1
- package/lib/types/presets.js +95 -2
- package/lib/types/tool-policy.d.ts +4 -12
- package/lib/types/tool-policy.js +13 -15
- package/lib/types/types.d.ts +11 -0
- package/package.json +54 -49
package/lib/client.js
CHANGED
|
@@ -16172,17 +16172,57 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16172
16172
|
return findTeam(teams, selections.find((record) => record.sessionId === sessionId)?.teamId);
|
|
16173
16173
|
}
|
|
16174
16174
|
/**
|
|
16175
|
+
* Read the member role one Session selection names.
|
|
16176
|
+
*
|
|
16177
|
+
* An empty stored value is the captain-led meaning, exactly like an absent one:
|
|
16178
|
+
* the settings schema can project an empty string for a record written before a
|
|
16179
|
+
* role existed, and that must never be treated as a member identity.
|
|
16180
|
+
* @param selection - the Session's stored selection, when it has one.
|
|
16181
|
+
* @returns the member role identity, or undefined for a captain-led selection.
|
|
16182
|
+
*/
|
|
16183
|
+
function selectedRoleId(selection) {
|
|
16184
|
+
const roleId = selection?.roleId;
|
|
16185
|
+
return roleId === void 0 || roleId.trim() === "" ? void 0 : roleId;
|
|
16186
|
+
}
|
|
16187
|
+
/**
|
|
16188
|
+
* Locate one member slot by its stable identity.
|
|
16189
|
+
* @param team - the Team preset to search.
|
|
16190
|
+
* @param roleId - the member's stable identity.
|
|
16191
|
+
* @returns the matching member, or undefined when the slot no longer exists.
|
|
16192
|
+
*/
|
|
16193
|
+
function findMemberById(team, roleId) {
|
|
16194
|
+
if (team === void 0 || roleId === void 0) return void 0;
|
|
16195
|
+
return team.members.find((member) => member.id === roleId);
|
|
16196
|
+
}
|
|
16197
|
+
/**
|
|
16198
|
+
* Resolve the member a Session talks to individually.
|
|
16199
|
+
* @param teams - every configured Team preset.
|
|
16200
|
+
* @param selections - every Session selection record.
|
|
16201
|
+
* @param sessionId - the Session identity to resolve.
|
|
16202
|
+
* @returns the selected member, or undefined when the selection is captain-led
|
|
16203
|
+
* or the member no longer exists.
|
|
16204
|
+
*/
|
|
16205
|
+
function selectedMember(teams, selections, sessionId) {
|
|
16206
|
+
const selection = selections.find((record) => record.sessionId === sessionId);
|
|
16207
|
+
return findMemberById(findTeam(teams, selection?.teamId), selectedRoleId(selection));
|
|
16208
|
+
}
|
|
16209
|
+
/**
|
|
16175
16210
|
* Replace the current Team selection of one Session.
|
|
16176
16211
|
* @param selections - the current selection records.
|
|
16177
16212
|
* @param sessionId - the Session whose selection changes.
|
|
16178
16213
|
* @param teamId - the selected Team identity; undefined clears the selection.
|
|
16214
|
+
* @param roleId - the member to talk to individually; undefined keeps the
|
|
16215
|
+
* captain leading the Session.
|
|
16179
16216
|
* @returns a new selection list, with the Session's record updated or removed.
|
|
16180
16217
|
*/
|
|
16181
|
-
function withSelection(selections, sessionId, teamId) {
|
|
16218
|
+
function withSelection(selections, sessionId, teamId, roleId) {
|
|
16182
16219
|
const rest = selections.filter((record) => record.sessionId !== sessionId);
|
|
16183
|
-
|
|
16220
|
+
if (teamId === void 0) return rest;
|
|
16221
|
+
const role = roleId === void 0 || roleId.trim() === "" ? void 0 : roleId;
|
|
16222
|
+
return [...rest, {
|
|
16184
16223
|
sessionId,
|
|
16185
|
-
teamId
|
|
16224
|
+
teamId,
|
|
16225
|
+
...role === void 0 ? {} : { roleId: role }
|
|
16186
16226
|
}];
|
|
16187
16227
|
}
|
|
16188
16228
|
|
|
@@ -17275,6 +17315,15 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17275
17315
|
composeSeriesDev: "Built-in · development",
|
|
17276
17316
|
composeSeriesModes: "Built-in · work modes",
|
|
17277
17317
|
composeEmpty: "No team matches",
|
|
17318
|
+
composePanelTitle: "Team members",
|
|
17319
|
+
composePanelCaptain: "Captain",
|
|
17320
|
+
composePanelMembers: "Members",
|
|
17321
|
+
composePanelSessionModel: "Session model",
|
|
17322
|
+
composePanelCaptainHint: "The captain takes over this session: its system prompt becomes the session prompt, its tool policy scopes the session tools, and it follows the model you already selected — the team never changes your model.",
|
|
17323
|
+
composePanelSoloHint: "Select a member to talk to it alone: its role card, tool policy, Team Skills, and model route are injected into this session.",
|
|
17324
|
+
composePanelEmptyMembers: "This team has no members yet.",
|
|
17325
|
+
composePanelNoId: "This member has no stable id, so it cannot be selected on its own.",
|
|
17326
|
+
composerMissingMember: "Missing member: {member} (team {team})",
|
|
17278
17327
|
skillsAssignHint: "Checked skills belong to this member only. They are discovered through this Agent scope, never globally.",
|
|
17279
17328
|
skillsAssignEmpty: "No team skill is installed yet. Add one on the Team skills page.",
|
|
17280
17329
|
skillsOverrideOn: "a local override is active"
|
|
@@ -17552,6 +17601,15 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17552
17601
|
composeSeriesDev: "插件内置 · 研发规模",
|
|
17553
17602
|
composeSeriesModes: "插件内置 · 工作模式",
|
|
17554
17603
|
composeEmpty: "没有匹配的团队",
|
|
17604
|
+
composePanelTitle: "团队成员",
|
|
17605
|
+
composePanelCaptain: "队长",
|
|
17606
|
+
composePanelMembers: "队员",
|
|
17607
|
+
composePanelSessionModel: "会话模型",
|
|
17608
|
+
composePanelCaptainHint: "队长会接管本会话:队长的系统提示词成为会话提示词,工具权限作用于会话工具;队长跟随会话已选模型,不会改动你的模型。",
|
|
17609
|
+
composePanelSoloHint: "选择队员即可只与该成员单独对话:其角色卡、工具权限、Team Skill 与模型路由会注入本会话。",
|
|
17610
|
+
composePanelEmptyMembers: "该团队还没有队员。",
|
|
17611
|
+
composePanelNoId: "该成员缺少稳定 ID,无法单独选择。",
|
|
17612
|
+
composerMissingMember: "成员已失效:{member}(团队 {team})",
|
|
17555
17613
|
skillsAssignHint: "勾选的技能只属于这名成员,通过该 Agent 的作用域发现,不会全局注册。",
|
|
17556
17614
|
skillsAssignEmpty: "还没有安装任何团队技能,请先到「团队技能」页添加。",
|
|
17557
17615
|
skillsOverrideOn: "已启用本地覆盖"
|
|
@@ -17633,12 +17691,30 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17633
17691
|
if (typeof document !== "undefined" && !document.querySelector("style[data-team-presets-style=\"dsh-agent-team-presets:client/ComposerTeamSelect.module.css\"]")) {
|
|
17634
17692
|
const style = document.createElement("style");
|
|
17635
17693
|
style.dataset.teamPresetsStyle = key$2;
|
|
17636
|
-
style.textContent = ".Q4LFCW_popover,.Q4LFCW_popover *,.Q4LFCW_popover :before,.Q4LFCW_popover :after{box-sizing:border-box}.Q4LFCW_wrap{display:inline-flex;position:relative}.Q4LFCW_trigger{border-radius:var(--dsw-radius-sm);min-width:0;max-width:160px;height:28px;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;outline:none;align-items:center;gap:4px;padding:0 4px 0 8px;font-size:13px;font-weight:500;line-height:20px;display:inline-flex}.Q4LFCW_trigger:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}.Q4LFCW_trigger:focus-visible{box-shadow:0 0 0 2px var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary))}.Q4LFCW_trigger:disabled{color:var(--dsw-alias-label-dimmed);cursor:default}.Q4LFCW_triggerIcon{flex:none;display:inline-flex}.Q4LFCW_triggerIcon svg{width:14px;height:14px}.Q4LFCW_triggerLabel{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}.Q4LFCW_accentDot{border-radius:50%;flex:none;width:8px;height:8px}.Q4LFCW_failure{text-overflow:ellipsis;white-space:nowrap;max-width:220px;color:var(--dsw-alias-state-warn-label);font-size:11px;line-height:17px;overflow:hidden}.Q4LFCW_popover{box-sizing:border-box;background:var(--dsw-alias-bg-layer-3);background:rgb(from var(--dsw-specific-menu,var(--dsw-alias-bg-layer-3)) r g b / 1);border:1px solid var(--dsw-alias-border-l3);width:
|
|
17694
|
+
style.textContent = ".Q4LFCW_popover,.Q4LFCW_popover *,.Q4LFCW_popover :before,.Q4LFCW_popover :after,.Q4LFCW_dock,.Q4LFCW_dock *,.Q4LFCW_dock :before,.Q4LFCW_dock :after{box-sizing:border-box}.Q4LFCW_wrap{display:inline-flex;position:relative}.Q4LFCW_trigger{border-radius:var(--dsw-radius-sm);min-width:0;max-width:160px;height:28px;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;outline:none;align-items:center;gap:4px;padding:0 4px 0 8px;font-size:13px;font-weight:500;line-height:20px;display:inline-flex}.Q4LFCW_triggerMember{max-width:240px}.Q4LFCW_trigger:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}.Q4LFCW_trigger:focus-visible{box-shadow:0 0 0 2px var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary))}.Q4LFCW_trigger:disabled{color:var(--dsw-alias-label-dimmed);cursor:default}.Q4LFCW_triggerIcon{flex:none;display:inline-flex}.Q4LFCW_triggerIcon svg{width:14px;height:14px}.Q4LFCW_triggerLabel{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}.Q4LFCW_accentDot{border-radius:50%;flex:none;width:8px;height:8px}.Q4LFCW_failure{text-overflow:ellipsis;white-space:nowrap;max-width:220px;color:var(--dsw-alias-state-warn-label);font-size:11px;line-height:17px;overflow:hidden}.Q4LFCW_dock{z-index:40;align-items:flex-end;width:min(360px,100vw - 76px);display:flex;position:absolute;bottom:40px;left:0}.Q4LFCW_popover{box-sizing:border-box;background:var(--dsw-alias-bg-layer-3);background:rgb(from var(--dsw-specific-menu,var(--dsw-alias-bg-layer-3)) r g b / 1);border:1px solid var(--dsw-alias-border-l3);width:100%;box-shadow:var(--dsw-elevation-prominent);border-radius:13px;flex-direction:column;gap:8px;padding:12px;display:flex;position:relative}.Q4LFCW_memberPanel{background:var(--dsw-alias-bg-layer-3);border:1px solid var(--dsw-alias-border-l3);width:320px;max-height:360px;box-shadow:var(--dsw-elevation-prominent);border-radius:13px;flex-direction:column;gap:2px;padding:10px;display:flex;position:absolute;bottom:0;left:calc(100% + 8px);overflow:auto}.Q4LFCW_memberPanelLeft{left:auto;right:calc(100% + 8px)}.Q4LFCW_memberPanelOverlay{width:auto;max-height:46vh;bottom:calc(100% + 8px);left:0;right:0}@media (width<=720px){.Q4LFCW_memberPanel,.Q4LFCW_memberPanelLeft,.Q4LFCW_memberPanelOverlay{width:auto;max-height:46vh;bottom:calc(100% + 8px);left:0;right:0}}.Q4LFCW_panelHead{justify-content:space-between;align-items:baseline;gap:8px;padding:0 4px 4px;display:flex}.Q4LFCW_panelTitle{color:var(--dsw-alias-label-primary);font-size:12px;font-weight:550}.Q4LFCW_panelTeam{text-overflow:ellipsis;white-space:nowrap;min-width:0;color:var(--dsw-alias-label-secondary);font-size:11px;overflow:hidden}.Q4LFCW_panelSection{color:var(--dsw-alias-label-tertiary);padding:6px 4px 2px;font-size:11px}.Q4LFCW_panelRow{text-align:left;width:100%;color:inherit;cursor:pointer;background:0 0;border:0;border-radius:8px;flex-direction:column;gap:2px;padding:7px 8px;display:flex}.Q4LFCW_panelRow:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}.Q4LFCW_panelRow:focus-visible{box-shadow:0 0 0 2px var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline:none}.Q4LFCW_panelRow:disabled{color:var(--dsw-alias-label-dimmed);cursor:default}.Q4LFCW_panelRowActive{background:var(--dsw-alias-interactive-bg-active)}.Q4LFCW_panelRowHead{align-items:center;gap:6px;min-width:0;display:flex}.Q4LFCW_panelDot{background:var(--dsw-alias-label-dimmed);border-radius:50%;flex:none;width:7px;height:7px}.Q4LFCW_panelName{text-overflow:ellipsis;white-space:nowrap;min-width:0;font-size:12.5px;font-weight:500;overflow:hidden}.Q4LFCW_panelBadge{background:var(--dsw-alias-interactive-bg-active);color:var(--dsw-alias-label-secondary);border-radius:6px;flex:none;margin-left:auto;padding:1px 6px;font-size:10px;line-height:15px}.Q4LFCW_panelRoute{color:var(--dsw-alias-label-secondary);text-overflow:ellipsis;white-space:nowrap;font-size:11px;overflow:hidden}.Q4LFCW_panelDesc{-webkit-line-clamp:2;color:var(--dsw-alias-label-tertiary);-webkit-box-orient:vertical;font-size:11px;line-height:16px;display:-webkit-box;overflow:hidden}.Q4LFCW_panelEmpty{color:var(--dsw-alias-label-secondary);padding:6px 8px;font-size:11.5px}.Q4LFCW_panelHint{border-top:1px solid var(--dsw-alias-border-l3);color:var(--dsw-alias-label-tertiary);margin-top:4px;padding:6px 4px 2px;font-size:10.5px;line-height:15px}.Q4LFCW_popHead{justify-content:space-between;align-items:center;font-size:13px;font-weight:550;display:flex}.Q4LFCW_popClose{color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:0;padding:2px 4px;font-size:12px}.Q4LFCW_popSearch{box-sizing:border-box;border:1px solid var(--dsw-alias-border-l3);background:var(--dsw-specific-input-major);width:100%;max-width:100%;color:var(--dsw-alias-label-primary);border-radius:9px;outline:none;padding:7px 10px;font-size:13px}.Q4LFCW_popChips{box-sizing:border-box;flex-wrap:wrap;gap:4px;display:flex}.Q4LFCW_popChip{border:1px solid var(--dsw-alias-border-l3);color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border-radius:7px;padding:6px 10px;font-size:12px}.Q4LFCW_popChipActive{background:var(--dsw-alias-interactive-bg-active);color:var(--dsw-alias-label-primary)}.Q4LFCW_popList{box-sizing:border-box;flex-direction:column;max-height:268px;display:flex;overflow:auto}.Q4LFCW_popGroup{color:var(--dsw-alias-label-secondary);padding:6px 8px 2px;font-size:11px}.Q4LFCW_popOption{text-align:left;width:100%;color:inherit;cursor:pointer;background:0 0;border:0;border-radius:8px;padding:8px 9px;display:block}.Q4LFCW_popOption:hover{background:var(--dsw-alias-interactive-bg-hover)}.Q4LFCW_popOptionActive{background:var(--dsw-alias-interactive-bg-active);font-weight:550}.Q4LFCW_popOptionName{font-size:13px;display:block}.Q4LFCW_popOptionSub{color:var(--dsw-alias-label-secondary);text-overflow:ellipsis;white-space:nowrap;margin-top:2px;font-size:11px;display:block;overflow:hidden}.Q4LFCW_popEmpty{color:var(--dsw-alias-label-secondary);text-align:center;padding:14px 8px;font-size:12.5px}.Q4LFCW_popFilterLabel{color:var(--dsw-alias-label-secondary);align-self:center;margin-right:2px;font-size:12px}";
|
|
17637
17695
|
document.head.appendChild(style);
|
|
17638
17696
|
}
|
|
17639
17697
|
var ComposerTeamSelect_module_css_default = {
|
|
17640
17698
|
"accentDot": "Q4LFCW_accentDot",
|
|
17699
|
+
"dock": "Q4LFCW_dock",
|
|
17641
17700
|
"failure": "Q4LFCW_failure",
|
|
17701
|
+
"memberPanel": "Q4LFCW_memberPanel",
|
|
17702
|
+
"memberPanelLeft": "Q4LFCW_memberPanelLeft",
|
|
17703
|
+
"memberPanelOverlay": "Q4LFCW_memberPanelOverlay",
|
|
17704
|
+
"panelBadge": "Q4LFCW_panelBadge",
|
|
17705
|
+
"panelDesc": "Q4LFCW_panelDesc",
|
|
17706
|
+
"panelDot": "Q4LFCW_panelDot",
|
|
17707
|
+
"panelEmpty": "Q4LFCW_panelEmpty",
|
|
17708
|
+
"panelHead": "Q4LFCW_panelHead",
|
|
17709
|
+
"panelHint": "Q4LFCW_panelHint",
|
|
17710
|
+
"panelName": "Q4LFCW_panelName",
|
|
17711
|
+
"panelRoute": "Q4LFCW_panelRoute",
|
|
17712
|
+
"panelRow": "Q4LFCW_panelRow",
|
|
17713
|
+
"panelRowActive": "Q4LFCW_panelRowActive",
|
|
17714
|
+
"panelRowHead": "Q4LFCW_panelRowHead",
|
|
17715
|
+
"panelSection": "Q4LFCW_panelSection",
|
|
17716
|
+
"panelTeam": "Q4LFCW_panelTeam",
|
|
17717
|
+
"panelTitle": "Q4LFCW_panelTitle",
|
|
17642
17718
|
"popChip": "Q4LFCW_popChip",
|
|
17643
17719
|
"popChipActive": "Q4LFCW_popChipActive",
|
|
17644
17720
|
"popChips": "Q4LFCW_popChips",
|
|
@@ -17657,27 +17733,65 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17657
17733
|
"trigger": "Q4LFCW_trigger",
|
|
17658
17734
|
"triggerIcon": "Q4LFCW_triggerIcon",
|
|
17659
17735
|
"triggerLabel": "Q4LFCW_triggerLabel",
|
|
17736
|
+
"triggerMember": "Q4LFCW_triggerMember",
|
|
17660
17737
|
"wrap": "Q4LFCW_wrap"
|
|
17661
17738
|
};
|
|
17662
17739
|
|
|
17663
17740
|
|
|
17664
17741
|
/**
|
|
17665
|
-
* The composer's Team control: pick the Team preset that leads this Session
|
|
17742
|
+
* The composer's Team control: pick the Team preset that leads this Session, or
|
|
17743
|
+
* hover a Team to talk to one of its members on its own.
|
|
17744
|
+
*
|
|
17666
17745
|
* It sits in the composer tool row after the permission control.
|
|
17667
17746
|
*/
|
|
17747
|
+
/** How long the member panel survives while the pointer crosses the gap to it. */
|
|
17748
|
+
const PANEL_GRACE_MS = 140;
|
|
17749
|
+
/** Gap between the picker and the panel, matching the dock's CSS gap. */
|
|
17750
|
+
const PANEL_GAP_PX = 8;
|
|
17751
|
+
/** Space kept between the panel and the viewport edge before it flips sides. */
|
|
17752
|
+
const PANEL_VIEWPORT_MARGIN_PX = 8;
|
|
17753
|
+
/**
|
|
17754
|
+
* Render one member's configured route as `provider · model`.
|
|
17755
|
+
*
|
|
17756
|
+
* An empty provider and model is the Session route, which the caller renders
|
|
17757
|
+
* with its own locale key. A provider or model the catalogue no longer lists
|
|
17758
|
+
* still shows its stored identity, so a row never claims a route it cannot name.
|
|
17759
|
+
* @param providers - provider choices the catalogue currently offers.
|
|
17760
|
+
* @param member - the member whose route to render.
|
|
17761
|
+
* @returns the route label, or undefined when the member follows the Session.
|
|
17762
|
+
*/
|
|
17763
|
+
function memberRouteLabel(providers, member) {
|
|
17764
|
+
if (member.provider.trim() === "" || member.model.trim() === "") return void 0;
|
|
17765
|
+
const provider = providers.find((entry) => entry.id === member.provider);
|
|
17766
|
+
const model = provider?.models.find((entry) => entry.id === member.model);
|
|
17767
|
+
const parts = [provider?.name ?? member.provider, model?.name ?? member.model].filter((part) => part.trim() !== "");
|
|
17768
|
+
return parts.length === 0 ? void 0 : parts.join(" · ");
|
|
17769
|
+
}
|
|
17668
17770
|
/**
|
|
17669
17771
|
* Render the composer's Team picker.
|
|
17670
|
-
* @param props - the Session identity, the page's locale reader, and the selection
|
|
17671
|
-
* @returns the Team trigger,
|
|
17772
|
+
* @param props - the Session identity, the page's locale reader, and the selection writers.
|
|
17773
|
+
* @returns the Team trigger, the picker with its member panel, and a notice when the last selection write failed.
|
|
17672
17774
|
*/
|
|
17673
17775
|
function ComposerTeamSelect(props) {
|
|
17674
17776
|
const { t, sessionId } = props;
|
|
17675
17777
|
const state = props.useTeamPresets((snapshot) => snapshot);
|
|
17676
17778
|
const [open, setOpen] = (0, react.useState)(false);
|
|
17779
|
+
const [hoverTeamId, setHoverTeamId] = (0, react.useState)(void 0);
|
|
17780
|
+
const [panelPlacement, setPanelPlacement] = (0, react.useState)("right");
|
|
17781
|
+
const popover = (0, react.useRef)(null);
|
|
17782
|
+
const dock = (0, react.useRef)(null);
|
|
17783
|
+
const panel = (0, react.useRef)(null);
|
|
17784
|
+
const hoverTimer = (0, react.useRef)(void 0);
|
|
17677
17785
|
const selection = state.selections.find((row) => row.sessionId === String(sessionId));
|
|
17678
17786
|
const active = selectedTeam(state.teams, state.selections, String(sessionId));
|
|
17679
|
-
const
|
|
17680
|
-
const
|
|
17787
|
+
const roleId = selectedRoleId(selection);
|
|
17788
|
+
const activeMember = selectedMember(state.teams, state.selections, String(sessionId));
|
|
17789
|
+
const missingTeam = selection !== void 0 && active === void 0;
|
|
17790
|
+
const missingMember = active !== void 0 && roleId !== void 0 && activeMember === void 0;
|
|
17791
|
+
const missing = missingTeam || missingMember;
|
|
17792
|
+
const missingLabel = missingTeam ? t("composerMissing").replace("{team}", selection?.teamId ?? "") : missingMember ? t("composerMissingMember").replace("{team}", active.name.trim() === "" ? active.id : active.name).replace("{member}", roleId ?? "") : "";
|
|
17793
|
+
const accent = active === void 0 ? "" : activeMember === void 0 ? active.captain.color : activeMember.color;
|
|
17794
|
+
const triggerLabel = missing ? missingLabel : active === void 0 ? t("composerNone") : activeMember === void 0 ? active.name === "" ? active.id : active.name : `${active.name === "" ? active.id : active.name} · ${activeMember.name.trim() === "" ? activeMember.id ?? "" : activeMember.name}`;
|
|
17681
17795
|
const failure = state.selectionFailure === void 0 ? void 0 : selectionFailureText(state.selectionFailure, t);
|
|
17682
17796
|
const issue = state.formIssue === void 0 ? void 0 : t(FORM_ISSUE_KEYS[state.formIssue]);
|
|
17683
17797
|
const writable = state.status === "ready" && state.writable;
|
|
@@ -17685,15 +17799,46 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17685
17799
|
const [source, setSource] = (0, react.useState)("all");
|
|
17686
17800
|
const [series, setSeries] = (0, react.useState)("all");
|
|
17687
17801
|
const [categoryId, setCategoryId] = (0, react.useState)("");
|
|
17688
|
-
|
|
17802
|
+
/** Cancel a pending panel close, so a hover that continues keeps the panel up. */
|
|
17803
|
+
const cancelHoverClose = () => {
|
|
17804
|
+
if (hoverTimer.current === void 0) return;
|
|
17805
|
+
clearTimeout(hoverTimer.current);
|
|
17806
|
+
hoverTimer.current = void 0;
|
|
17807
|
+
};
|
|
17808
|
+
/** Show the panel of one Team and cancel any close the previous row scheduled. */
|
|
17809
|
+
const showPanel = (teamId) => {
|
|
17810
|
+
cancelHoverClose();
|
|
17811
|
+
setHoverTeamId(teamId);
|
|
17812
|
+
};
|
|
17813
|
+
/** Schedule the panel close that a pointer or focus leaving a row starts. */
|
|
17814
|
+
const schedulePanelClose = () => {
|
|
17815
|
+
cancelHoverClose();
|
|
17816
|
+
hoverTimer.current = setTimeout(() => {
|
|
17817
|
+
hoverTimer.current = void 0;
|
|
17818
|
+
setHoverTeamId(void 0);
|
|
17819
|
+
}, PANEL_GRACE_MS);
|
|
17820
|
+
};
|
|
17821
|
+
/** Close the picker and forget the panel it was showing. */
|
|
17822
|
+
const closePicker = () => {
|
|
17823
|
+
cancelHoverClose();
|
|
17824
|
+
setHoverTeamId(void 0);
|
|
17825
|
+
setPanelPlacement("right");
|
|
17826
|
+
setOpen(false);
|
|
17827
|
+
};
|
|
17828
|
+
(0, react.useEffect)(() => {
|
|
17829
|
+
if (open) return;
|
|
17830
|
+
cancelHoverClose();
|
|
17831
|
+
setHoverTeamId(void 0);
|
|
17832
|
+
setPanelPlacement("right");
|
|
17833
|
+
}, [open]);
|
|
17689
17834
|
(0, react.useEffect)(() => {
|
|
17690
17835
|
if (!open) return;
|
|
17691
17836
|
const onKey = (event) => {
|
|
17692
|
-
if (event.key === "Escape")
|
|
17837
|
+
if (event.key === "Escape") closePicker();
|
|
17693
17838
|
};
|
|
17694
17839
|
const onDown = (event) => {
|
|
17695
17840
|
const node = popover.current;
|
|
17696
|
-
if (node !== null && event.target instanceof Node && !node.contains(event.target))
|
|
17841
|
+
if (node !== null && event.target instanceof Node && !node.contains(event.target)) closePicker();
|
|
17697
17842
|
};
|
|
17698
17843
|
document.addEventListener("keydown", onKey);
|
|
17699
17844
|
document.addEventListener("mousedown", onDown);
|
|
@@ -17702,6 +17847,33 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17702
17847
|
document.removeEventListener("mousedown", onDown);
|
|
17703
17848
|
};
|
|
17704
17849
|
}, [open]);
|
|
17850
|
+
(0, react.useEffect)(() => () => {
|
|
17851
|
+
cancelHoverClose();
|
|
17852
|
+
}, []);
|
|
17853
|
+
const hoverTeam = hoverTeamId === void 0 ? void 0 : state.teams.find((team) => team.id === hoverTeamId);
|
|
17854
|
+
(0, react.useLayoutEffect)(() => {
|
|
17855
|
+
if (!open || hoverTeam === void 0) {
|
|
17856
|
+
setPanelPlacement("right");
|
|
17857
|
+
return;
|
|
17858
|
+
}
|
|
17859
|
+
const measure = () => {
|
|
17860
|
+
const dockNode = dock.current;
|
|
17861
|
+
const panelNode = panel.current;
|
|
17862
|
+
if (dockNode === null || panelNode === null) return;
|
|
17863
|
+
const dockRect = dockNode.getBoundingClientRect();
|
|
17864
|
+
const width = panelNode.getBoundingClientRect().width;
|
|
17865
|
+
if (!(dockRect.right + PANEL_GAP_PX + width > window.innerWidth - PANEL_VIEWPORT_MARGIN_PX)) {
|
|
17866
|
+
setPanelPlacement("right");
|
|
17867
|
+
return;
|
|
17868
|
+
}
|
|
17869
|
+
setPanelPlacement(dockRect.left - PANEL_GAP_PX - width >= PANEL_VIEWPORT_MARGIN_PX ? "left" : "overlay");
|
|
17870
|
+
};
|
|
17871
|
+
measure();
|
|
17872
|
+
window.addEventListener("resize", measure);
|
|
17873
|
+
return () => {
|
|
17874
|
+
window.removeEventListener("resize", measure);
|
|
17875
|
+
};
|
|
17876
|
+
}, [open, hoverTeam]);
|
|
17705
17877
|
const tokens = queryTokens(query);
|
|
17706
17878
|
const categories = (0, react.useMemo)(() => orderedCategories(state.categories), [state.categories]);
|
|
17707
17879
|
const groups = (0, react.useMemo)(() => groupTeams(state.teams.filter((team) => {
|
|
@@ -17724,15 +17896,31 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17724
17896
|
return t("composeUncategorized");
|
|
17725
17897
|
};
|
|
17726
17898
|
const choose = (teamId) => {
|
|
17727
|
-
|
|
17899
|
+
closePicker();
|
|
17728
17900
|
props.selectTeam(String(sessionId), teamId);
|
|
17729
17901
|
};
|
|
17902
|
+
const chooseMember = (teamId, memberId) => {
|
|
17903
|
+
closePicker();
|
|
17904
|
+
props.selectMember(String(sessionId), teamId, memberId);
|
|
17905
|
+
};
|
|
17906
|
+
/** Whether the panel row is the selection this Session currently talks to. */
|
|
17907
|
+
const isActiveCaptain = (team) => selection?.teamId === team.id && roleId === void 0;
|
|
17908
|
+
const isActiveMember = (team, member) => selection?.teamId === team.id && roleId !== void 0 && member.id === roleId;
|
|
17909
|
+
/** Keep the panel up while focus moves between the picker and the panel. */
|
|
17910
|
+
const onDockBlur = (event) => {
|
|
17911
|
+
const next = event.relatedTarget;
|
|
17912
|
+
if (next instanceof Node && event.currentTarget.contains(next)) {
|
|
17913
|
+
cancelHoverClose();
|
|
17914
|
+
return;
|
|
17915
|
+
}
|
|
17916
|
+
schedulePanelClose();
|
|
17917
|
+
};
|
|
17730
17918
|
return (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [(0, react_jsx_runtime.jsxs)("span", {
|
|
17731
17919
|
className: ComposerTeamSelect_module_css_default.wrap,
|
|
17732
17920
|
ref: popover,
|
|
17733
17921
|
children: [(0, react_jsx_runtime.jsxs)("button", {
|
|
17734
17922
|
type: "button",
|
|
17735
|
-
className: ComposerTeamSelect_module_css_default.trigger
|
|
17923
|
+
className: activeMember === void 0 ? ComposerTeamSelect_module_css_default.trigger : `${ComposerTeamSelect_module_css_default.trigger} ${ComposerTeamSelect_module_css_default.triggerMember}`,
|
|
17736
17924
|
disabled: !writable,
|
|
17737
17925
|
"aria-haspopup": "listbox",
|
|
17738
17926
|
"aria-expanded": open,
|
|
@@ -17741,15 +17929,15 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17741
17929
|
setOpen((value) => !value);
|
|
17742
17930
|
},
|
|
17743
17931
|
children: [
|
|
17744
|
-
|
|
17932
|
+
accent === "" ? null : (0, react_jsx_runtime.jsx)("span", {
|
|
17745
17933
|
className: ComposerTeamSelect_module_css_default.accentDot,
|
|
17746
|
-
style: { background:
|
|
17934
|
+
style: { background: accent },
|
|
17747
17935
|
"aria-hidden": true
|
|
17748
17936
|
}),
|
|
17749
17937
|
(0, react_jsx_runtime.jsx)("span", {
|
|
17750
17938
|
className: ComposerTeamSelect_module_css_default.triggerLabel,
|
|
17751
17939
|
"aria-label": t("composerTitle"),
|
|
17752
|
-
children:
|
|
17940
|
+
children: triggerLabel
|
|
17753
17941
|
}),
|
|
17754
17942
|
(0, react_jsx_runtime.jsx)("span", {
|
|
17755
17943
|
className: ComposerTeamSelect_module_css_default.triggerIcon,
|
|
@@ -17757,161 +17945,285 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17757
17945
|
})
|
|
17758
17946
|
]
|
|
17759
17947
|
}), open ? (0, react_jsx_runtime.jsxs)("div", {
|
|
17760
|
-
className: ComposerTeamSelect_module_css_default.
|
|
17761
|
-
|
|
17762
|
-
|
|
17763
|
-
children: [
|
|
17764
|
-
|
|
17765
|
-
|
|
17766
|
-
|
|
17767
|
-
|
|
17768
|
-
|
|
17769
|
-
|
|
17770
|
-
|
|
17771
|
-
},
|
|
17772
|
-
children: t("composeClose")
|
|
17773
|
-
})]
|
|
17774
|
-
}),
|
|
17775
|
-
(0, react_jsx_runtime.jsx)("input", {
|
|
17776
|
-
className: ComposerTeamSelect_module_css_default.popSearch,
|
|
17777
|
-
autoFocus: true,
|
|
17778
|
-
value: query,
|
|
17779
|
-
placeholder: t("composeSearch"),
|
|
17780
|
-
onChange: (event) => {
|
|
17781
|
-
setQuery(event.target.value);
|
|
17782
|
-
}
|
|
17783
|
-
}),
|
|
17784
|
-
(0, react_jsx_runtime.jsxs)("div", {
|
|
17785
|
-
className: ComposerTeamSelect_module_css_default.popChips,
|
|
17786
|
-
children: [
|
|
17787
|
-
(0, react_jsx_runtime.jsx)("span", {
|
|
17788
|
-
className: ComposerTeamSelect_module_css_default.popFilterLabel,
|
|
17789
|
-
children: t("filterSource")
|
|
17790
|
-
}),
|
|
17791
|
-
(0, react_jsx_runtime.jsx)("button", {
|
|
17792
|
-
type: "button",
|
|
17793
|
-
className: `${ComposerTeamSelect_module_css_default.popChip} ${source === "all" ? ComposerTeamSelect_module_css_default.popChipActive : ""}`,
|
|
17794
|
-
onClick: () => {
|
|
17795
|
-
setSource("all");
|
|
17796
|
-
},
|
|
17797
|
-
children: t("listAll")
|
|
17798
|
-
}),
|
|
17799
|
-
(0, react_jsx_runtime.jsx)("button", {
|
|
17800
|
-
type: "button",
|
|
17801
|
-
className: `${ComposerTeamSelect_module_css_default.popChip} ${source === "builtin" ? ComposerTeamSelect_module_css_default.popChipActive : ""}`,
|
|
17802
|
-
onClick: () => {
|
|
17803
|
-
setSource("builtin");
|
|
17804
|
-
setCategoryId("");
|
|
17805
|
-
},
|
|
17806
|
-
children: t("listBuiltin")
|
|
17807
|
-
}),
|
|
17808
|
-
(0, react_jsx_runtime.jsx)("button", {
|
|
17809
|
-
type: "button",
|
|
17810
|
-
className: `${ComposerTeamSelect_module_css_default.popChip} ${source === "custom" ? ComposerTeamSelect_module_css_default.popChipActive : ""}`,
|
|
17811
|
-
onClick: () => {
|
|
17812
|
-
setSource("custom");
|
|
17813
|
-
setSeries("all");
|
|
17814
|
-
},
|
|
17815
|
-
children: t("listCustom")
|
|
17816
|
-
})
|
|
17817
|
-
]
|
|
17818
|
-
}),
|
|
17819
|
-
(0, react_jsx_runtime.jsxs)("div", {
|
|
17820
|
-
className: ComposerTeamSelect_module_css_default.popChips,
|
|
17821
|
-
children: [
|
|
17822
|
-
(0, react_jsx_runtime.jsx)("span", {
|
|
17823
|
-
className: ComposerTeamSelect_module_css_default.popFilterLabel,
|
|
17824
|
-
children: t("filterCategory")
|
|
17825
|
-
}),
|
|
17826
|
-
(0, react_jsx_runtime.jsx)("button", {
|
|
17827
|
-
type: "button",
|
|
17828
|
-
className: `${ComposerTeamSelect_module_css_default.popChip} ${series === "all" && categoryId === "" ? ComposerTeamSelect_module_css_default.popChipActive : ""}`,
|
|
17829
|
-
onClick: () => {
|
|
17830
|
-
setSeries("all");
|
|
17831
|
-
setCategoryId("");
|
|
17832
|
-
},
|
|
17833
|
-
children: t("listAll")
|
|
17834
|
-
}),
|
|
17835
|
-
source !== "custom" ? TEAM_SERIES.map((entry) => (0, react_jsx_runtime.jsx)("button", {
|
|
17836
|
-
type: "button",
|
|
17837
|
-
className: `${ComposerTeamSelect_module_css_default.popChip} ${series === entry.id ? ComposerTeamSelect_module_css_default.popChipActive : ""}`,
|
|
17838
|
-
onClick: () => {
|
|
17839
|
-
setSeries(series === entry.id ? "all" : entry.id);
|
|
17840
|
-
setCategoryId("");
|
|
17841
|
-
},
|
|
17842
|
-
children: entry.id === "classic-development" ? t("seriesDevelopment") : t("seriesWorkModes")
|
|
17843
|
-
}, entry.id)) : null,
|
|
17844
|
-
source !== "builtin" ? categories.map((entry) => (0, react_jsx_runtime.jsx)("button", {
|
|
17845
|
-
type: "button",
|
|
17846
|
-
className: `${ComposerTeamSelect_module_css_default.popChip} ${categoryId === entry.id ? ComposerTeamSelect_module_css_default.popChipActive : ""}`,
|
|
17847
|
-
onClick: () => {
|
|
17848
|
-
setCategoryId(categoryId === entry.id ? "" : entry.id);
|
|
17849
|
-
setSeries("all");
|
|
17850
|
-
},
|
|
17851
|
-
children: entry.name
|
|
17852
|
-
}, entry.id)) : null,
|
|
17853
|
-
source === "custom" && categories.length === 0 ? (0, react_jsx_runtime.jsx)("span", {
|
|
17854
|
-
className: ComposerTeamSelect_module_css_default.popFilterLabel,
|
|
17855
|
-
children: t("filterNoCategory")
|
|
17856
|
-
}) : null
|
|
17857
|
-
]
|
|
17858
|
-
}),
|
|
17859
|
-
(0, react_jsx_runtime.jsxs)("div", {
|
|
17860
|
-
className: ComposerTeamSelect_module_css_default.popList,
|
|
17861
|
-
children: [
|
|
17862
|
-
(0, react_jsx_runtime.jsxs)("button", {
|
|
17948
|
+
className: ComposerTeamSelect_module_css_default.dock,
|
|
17949
|
+
ref: dock,
|
|
17950
|
+
onBlur: onDockBlur,
|
|
17951
|
+
children: [(0, react_jsx_runtime.jsxs)("div", {
|
|
17952
|
+
className: ComposerTeamSelect_module_css_default.popover,
|
|
17953
|
+
role: "listbox",
|
|
17954
|
+
"aria-label": t("composeTitle"),
|
|
17955
|
+
children: [
|
|
17956
|
+
(0, react_jsx_runtime.jsxs)("div", {
|
|
17957
|
+
className: ComposerTeamSelect_module_css_default.popHead,
|
|
17958
|
+
children: [(0, react_jsx_runtime.jsx)("span", { children: t("composeTitle") }), (0, react_jsx_runtime.jsx)("button", {
|
|
17863
17959
|
type: "button",
|
|
17864
|
-
className:
|
|
17960
|
+
className: ComposerTeamSelect_module_css_default.popClose,
|
|
17865
17961
|
onClick: () => {
|
|
17866
|
-
|
|
17962
|
+
closePicker();
|
|
17867
17963
|
},
|
|
17868
|
-
children:
|
|
17869
|
-
|
|
17870
|
-
|
|
17871
|
-
|
|
17872
|
-
|
|
17873
|
-
|
|
17874
|
-
|
|
17875
|
-
|
|
17876
|
-
|
|
17877
|
-
|
|
17878
|
-
|
|
17879
|
-
|
|
17880
|
-
|
|
17881
|
-
|
|
17882
|
-
|
|
17883
|
-
|
|
17884
|
-
className: ComposerTeamSelect_module_css_default.
|
|
17885
|
-
children: t("
|
|
17886
|
-
})
|
|
17887
|
-
|
|
17888
|
-
|
|
17889
|
-
|
|
17890
|
-
|
|
17891
|
-
|
|
17964
|
+
children: t("composeClose")
|
|
17965
|
+
})]
|
|
17966
|
+
}),
|
|
17967
|
+
(0, react_jsx_runtime.jsx)("input", {
|
|
17968
|
+
className: ComposerTeamSelect_module_css_default.popSearch,
|
|
17969
|
+
autoFocus: true,
|
|
17970
|
+
value: query,
|
|
17971
|
+
placeholder: t("composeSearch"),
|
|
17972
|
+
onChange: (event) => {
|
|
17973
|
+
setQuery(event.target.value);
|
|
17974
|
+
}
|
|
17975
|
+
}),
|
|
17976
|
+
(0, react_jsx_runtime.jsxs)("div", {
|
|
17977
|
+
className: ComposerTeamSelect_module_css_default.popChips,
|
|
17978
|
+
children: [
|
|
17979
|
+
(0, react_jsx_runtime.jsx)("span", {
|
|
17980
|
+
className: ComposerTeamSelect_module_css_default.popFilterLabel,
|
|
17981
|
+
children: t("filterSource")
|
|
17982
|
+
}),
|
|
17983
|
+
(0, react_jsx_runtime.jsx)("button", {
|
|
17984
|
+
type: "button",
|
|
17985
|
+
className: `${ComposerTeamSelect_module_css_default.popChip} ${source === "all" ? ComposerTeamSelect_module_css_default.popChipActive : ""}`,
|
|
17986
|
+
onClick: () => {
|
|
17987
|
+
setSource("all");
|
|
17988
|
+
},
|
|
17989
|
+
children: t("listAll")
|
|
17990
|
+
}),
|
|
17991
|
+
(0, react_jsx_runtime.jsx)("button", {
|
|
17992
|
+
type: "button",
|
|
17993
|
+
className: `${ComposerTeamSelect_module_css_default.popChip} ${source === "builtin" ? ComposerTeamSelect_module_css_default.popChipActive : ""}`,
|
|
17994
|
+
onClick: () => {
|
|
17995
|
+
setSource("builtin");
|
|
17996
|
+
setCategoryId("");
|
|
17997
|
+
},
|
|
17998
|
+
children: t("listBuiltin")
|
|
17999
|
+
}),
|
|
18000
|
+
(0, react_jsx_runtime.jsx)("button", {
|
|
18001
|
+
type: "button",
|
|
18002
|
+
className: `${ComposerTeamSelect_module_css_default.popChip} ${source === "custom" ? ComposerTeamSelect_module_css_default.popChipActive : ""}`,
|
|
18003
|
+
onClick: () => {
|
|
18004
|
+
setSource("custom");
|
|
18005
|
+
setSeries("all");
|
|
18006
|
+
},
|
|
18007
|
+
children: t("listCustom")
|
|
18008
|
+
})
|
|
18009
|
+
]
|
|
18010
|
+
}),
|
|
18011
|
+
(0, react_jsx_runtime.jsxs)("div", {
|
|
18012
|
+
className: ComposerTeamSelect_module_css_default.popChips,
|
|
18013
|
+
children: [
|
|
18014
|
+
(0, react_jsx_runtime.jsx)("span", {
|
|
18015
|
+
className: ComposerTeamSelect_module_css_default.popFilterLabel,
|
|
18016
|
+
children: t("filterCategory")
|
|
18017
|
+
}),
|
|
18018
|
+
(0, react_jsx_runtime.jsx)("button", {
|
|
18019
|
+
type: "button",
|
|
18020
|
+
className: `${ComposerTeamSelect_module_css_default.popChip} ${series === "all" && categoryId === "" ? ComposerTeamSelect_module_css_default.popChipActive : ""}`,
|
|
18021
|
+
onClick: () => {
|
|
18022
|
+
setSeries("all");
|
|
18023
|
+
setCategoryId("");
|
|
18024
|
+
},
|
|
18025
|
+
children: t("listAll")
|
|
18026
|
+
}),
|
|
18027
|
+
source !== "custom" ? TEAM_SERIES.map((entry) => (0, react_jsx_runtime.jsx)("button", {
|
|
18028
|
+
type: "button",
|
|
18029
|
+
className: `${ComposerTeamSelect_module_css_default.popChip} ${series === entry.id ? ComposerTeamSelect_module_css_default.popChipActive : ""}`,
|
|
18030
|
+
onClick: () => {
|
|
18031
|
+
setSeries(series === entry.id ? "all" : entry.id);
|
|
18032
|
+
setCategoryId("");
|
|
18033
|
+
},
|
|
18034
|
+
children: entry.id === "classic-development" ? t("seriesDevelopment") : t("seriesWorkModes")
|
|
18035
|
+
}, entry.id)) : null,
|
|
18036
|
+
source !== "builtin" ? categories.map((entry) => (0, react_jsx_runtime.jsx)("button", {
|
|
18037
|
+
type: "button",
|
|
18038
|
+
className: `${ComposerTeamSelect_module_css_default.popChip} ${categoryId === entry.id ? ComposerTeamSelect_module_css_default.popChipActive : ""}`,
|
|
18039
|
+
onClick: () => {
|
|
18040
|
+
setCategoryId(categoryId === entry.id ? "" : entry.id);
|
|
18041
|
+
setSeries("all");
|
|
18042
|
+
},
|
|
18043
|
+
children: entry.name
|
|
18044
|
+
}, entry.id)) : null,
|
|
18045
|
+
source === "custom" && categories.length === 0 ? (0, react_jsx_runtime.jsx)("span", {
|
|
18046
|
+
className: ComposerTeamSelect_module_css_default.popFilterLabel,
|
|
18047
|
+
children: t("filterNoCategory")
|
|
18048
|
+
}) : null
|
|
18049
|
+
]
|
|
18050
|
+
}),
|
|
18051
|
+
(0, react_jsx_runtime.jsxs)("div", {
|
|
18052
|
+
className: ComposerTeamSelect_module_css_default.popList,
|
|
18053
|
+
children: [
|
|
18054
|
+
(0, react_jsx_runtime.jsxs)("button", {
|
|
18055
|
+
type: "button",
|
|
18056
|
+
className: `${ComposerTeamSelect_module_css_default.popOption} ${selection === void 0 ? ComposerTeamSelect_module_css_default.popOptionActive : ""}`,
|
|
18057
|
+
onClick: () => {
|
|
18058
|
+
choose(void 0);
|
|
18059
|
+
},
|
|
18060
|
+
children: [(0, react_jsx_runtime.jsx)("span", {
|
|
18061
|
+
className: ComposerTeamSelect_module_css_default.popOptionName,
|
|
18062
|
+
children: t("composerNone")
|
|
18063
|
+
}), (0, react_jsx_runtime.jsx)("span", {
|
|
18064
|
+
className: ComposerTeamSelect_module_css_default.popOptionSub,
|
|
18065
|
+
children: t("composeNoneSub")
|
|
18066
|
+
})]
|
|
18067
|
+
}),
|
|
18068
|
+
missing ? (0, react_jsx_runtime.jsxs)("button", {
|
|
18069
|
+
type: "button",
|
|
18070
|
+
className: ComposerTeamSelect_module_css_default.popOption,
|
|
18071
|
+
disabled: true,
|
|
18072
|
+
children: [(0, react_jsx_runtime.jsx)("span", {
|
|
18073
|
+
className: ComposerTeamSelect_module_css_default.popOptionName,
|
|
18074
|
+
children: missingLabel
|
|
18075
|
+
}), (0, react_jsx_runtime.jsx)("span", {
|
|
18076
|
+
className: ComposerTeamSelect_module_css_default.popOptionSub,
|
|
18077
|
+
children: t("composerMissingHint")
|
|
18078
|
+
})]
|
|
18079
|
+
}) : null,
|
|
18080
|
+
groups.map((group) => group.teams.length === 0 ? null : (0, react_jsx_runtime.jsxs)("div", { children: [(0, react_jsx_runtime.jsx)("div", {
|
|
18081
|
+
className: ComposerTeamSelect_module_css_default.popGroup,
|
|
18082
|
+
children: groupLabel(group)
|
|
18083
|
+
}), group.teams.map((team) => (0, react_jsx_runtime.jsxs)("button", {
|
|
18084
|
+
type: "button",
|
|
18085
|
+
role: "option",
|
|
18086
|
+
"aria-selected": selection?.teamId === team.id,
|
|
18087
|
+
className: `${ComposerTeamSelect_module_css_default.popOption} ${selection?.teamId === team.id ? ComposerTeamSelect_module_css_default.popOptionActive : ""}`,
|
|
18088
|
+
onClick: () => {
|
|
18089
|
+
choose(team.id);
|
|
18090
|
+
},
|
|
18091
|
+
onMouseEnter: () => {
|
|
18092
|
+
showPanel(team.id);
|
|
18093
|
+
},
|
|
18094
|
+
onMouseLeave: schedulePanelClose,
|
|
18095
|
+
onFocus: () => {
|
|
18096
|
+
showPanel(team.id);
|
|
18097
|
+
},
|
|
18098
|
+
onBlur: schedulePanelClose,
|
|
18099
|
+
children: [(0, react_jsx_runtime.jsx)("span", {
|
|
18100
|
+
className: ComposerTeamSelect_module_css_default.popOptionName,
|
|
18101
|
+
children: team.name === "" ? team.id : team.name
|
|
18102
|
+
}), (0, react_jsx_runtime.jsx)("span", {
|
|
18103
|
+
className: ComposerTeamSelect_module_css_default.popOptionSub,
|
|
18104
|
+
title: team.description,
|
|
18105
|
+
children: team.description || team.metadata?.summary || ""
|
|
18106
|
+
})]
|
|
18107
|
+
}, team.id))] }, group.id)),
|
|
18108
|
+
groups.every((group) => group.teams.length === 0) ? (0, react_jsx_runtime.jsx)("div", {
|
|
18109
|
+
className: ComposerTeamSelect_module_css_default.popEmpty,
|
|
18110
|
+
children: t("composeEmpty")
|
|
18111
|
+
}) : null
|
|
18112
|
+
]
|
|
18113
|
+
})
|
|
18114
|
+
]
|
|
18115
|
+
}), hoverTeam === void 0 ? null : (0, react_jsx_runtime.jsxs)("div", {
|
|
18116
|
+
ref: panel,
|
|
18117
|
+
className: `${ComposerTeamSelect_module_css_default.memberPanel} ${panelPlacement === "left" ? ComposerTeamSelect_module_css_default.memberPanelLeft : panelPlacement === "overlay" ? ComposerTeamSelect_module_css_default.memberPanelOverlay : ""}`,
|
|
18118
|
+
role: "group",
|
|
18119
|
+
"aria-label": t("composePanelTitle"),
|
|
18120
|
+
onMouseEnter: cancelHoverClose,
|
|
18121
|
+
onMouseLeave: schedulePanelClose,
|
|
18122
|
+
children: [
|
|
18123
|
+
(0, react_jsx_runtime.jsxs)("div", {
|
|
18124
|
+
className: ComposerTeamSelect_module_css_default.panelHead,
|
|
18125
|
+
children: [(0, react_jsx_runtime.jsx)("span", {
|
|
18126
|
+
className: ComposerTeamSelect_module_css_default.panelTitle,
|
|
18127
|
+
children: t("composePanelTitle")
|
|
18128
|
+
}), (0, react_jsx_runtime.jsx)("span", {
|
|
18129
|
+
className: ComposerTeamSelect_module_css_default.panelTeam,
|
|
18130
|
+
children: hoverTeam.name === "" ? hoverTeam.id : hoverTeam.name
|
|
18131
|
+
})]
|
|
18132
|
+
}),
|
|
18133
|
+
(0, react_jsx_runtime.jsx)("div", {
|
|
18134
|
+
className: ComposerTeamSelect_module_css_default.panelSection,
|
|
18135
|
+
children: t("composePanelCaptain")
|
|
18136
|
+
}),
|
|
18137
|
+
(0, react_jsx_runtime.jsxs)("button", {
|
|
18138
|
+
type: "button",
|
|
18139
|
+
className: `${ComposerTeamSelect_module_css_default.panelRow} ${isActiveCaptain(hoverTeam) ? ComposerTeamSelect_module_css_default.panelRowActive : ""}`,
|
|
18140
|
+
"aria-pressed": isActiveCaptain(hoverTeam),
|
|
18141
|
+
title: t("composePanelCaptainHint"),
|
|
18142
|
+
onClick: () => {
|
|
18143
|
+
choose(hoverTeam.id);
|
|
18144
|
+
},
|
|
18145
|
+
children: [
|
|
18146
|
+
(0, react_jsx_runtime.jsxs)("span", {
|
|
18147
|
+
className: ComposerTeamSelect_module_css_default.panelRowHead,
|
|
18148
|
+
children: [
|
|
18149
|
+
(0, react_jsx_runtime.jsx)("span", {
|
|
18150
|
+
className: ComposerTeamSelect_module_css_default.panelDot,
|
|
18151
|
+
style: hoverTeam.captain.color === "" ? void 0 : { background: hoverTeam.captain.color },
|
|
18152
|
+
"aria-hidden": true
|
|
18153
|
+
}),
|
|
18154
|
+
(0, react_jsx_runtime.jsx)("span", {
|
|
18155
|
+
className: ComposerTeamSelect_module_css_default.panelName,
|
|
18156
|
+
children: hoverTeam.captain.name.trim() === "" ? t("composePanelCaptain") : hoverTeam.captain.name
|
|
18157
|
+
}),
|
|
18158
|
+
(0, react_jsx_runtime.jsx)("span", {
|
|
18159
|
+
className: ComposerTeamSelect_module_css_default.panelBadge,
|
|
18160
|
+
children: t("composePanelCaptain")
|
|
18161
|
+
})
|
|
18162
|
+
]
|
|
18163
|
+
}),
|
|
18164
|
+
(0, react_jsx_runtime.jsx)("span", {
|
|
18165
|
+
className: ComposerTeamSelect_module_css_default.panelRoute,
|
|
18166
|
+
children: t("composePanelSessionModel")
|
|
18167
|
+
}),
|
|
18168
|
+
hoverTeam.captain.description.trim() === "" ? null : (0, react_jsx_runtime.jsx)("span", {
|
|
18169
|
+
className: ComposerTeamSelect_module_css_default.panelDesc,
|
|
18170
|
+
children: hoverTeam.captain.description
|
|
18171
|
+
})
|
|
18172
|
+
]
|
|
18173
|
+
}),
|
|
18174
|
+
(0, react_jsx_runtime.jsx)("div", {
|
|
18175
|
+
className: ComposerTeamSelect_module_css_default.panelSection,
|
|
18176
|
+
children: t("composePanelMembers")
|
|
18177
|
+
}),
|
|
18178
|
+
hoverTeam.members.length === 0 ? (0, react_jsx_runtime.jsx)("div", {
|
|
18179
|
+
className: ComposerTeamSelect_module_css_default.panelEmpty,
|
|
18180
|
+
children: t("composePanelEmptyMembers")
|
|
18181
|
+
}) : hoverTeam.members.map((member, index) => {
|
|
18182
|
+
const selectable = member.id !== void 0 && member.id.trim() !== "";
|
|
18183
|
+
const route = memberRouteLabel(state.providers, member) ?? t("composePanelSessionModel");
|
|
18184
|
+
return (0, react_jsx_runtime.jsxs)("button", {
|
|
17892
18185
|
type: "button",
|
|
17893
|
-
|
|
17894
|
-
"aria-
|
|
17895
|
-
|
|
18186
|
+
className: `${ComposerTeamSelect_module_css_default.panelRow} ${isActiveMember(hoverTeam, member) ? ComposerTeamSelect_module_css_default.panelRowActive : ""}`,
|
|
18187
|
+
"aria-pressed": isActiveMember(hoverTeam, member),
|
|
18188
|
+
disabled: !selectable,
|
|
18189
|
+
title: selectable ? t("composePanelSoloHint") : t("composePanelNoId"),
|
|
17896
18190
|
onClick: () => {
|
|
17897
|
-
|
|
18191
|
+
if (member.id === void 0 || member.id.trim() === "") return;
|
|
18192
|
+
chooseMember(hoverTeam.id, member.id);
|
|
17898
18193
|
},
|
|
17899
|
-
children: [
|
|
17900
|
-
|
|
17901
|
-
|
|
17902
|
-
|
|
17903
|
-
|
|
17904
|
-
|
|
17905
|
-
|
|
17906
|
-
|
|
17907
|
-
|
|
17908
|
-
|
|
17909
|
-
|
|
17910
|
-
|
|
17911
|
-
|
|
17912
|
-
|
|
17913
|
-
|
|
17914
|
-
|
|
18194
|
+
children: [
|
|
18195
|
+
(0, react_jsx_runtime.jsxs)("span", {
|
|
18196
|
+
className: ComposerTeamSelect_module_css_default.panelRowHead,
|
|
18197
|
+
children: [(0, react_jsx_runtime.jsx)("span", {
|
|
18198
|
+
className: ComposerTeamSelect_module_css_default.panelDot,
|
|
18199
|
+
style: member.color === "" ? void 0 : { background: member.color },
|
|
18200
|
+
"aria-hidden": true
|
|
18201
|
+
}), (0, react_jsx_runtime.jsx)("span", {
|
|
18202
|
+
className: ComposerTeamSelect_module_css_default.panelName,
|
|
18203
|
+
children: member.name.trim() === "" ? member.id ?? t("composePanelMembers") : member.name
|
|
18204
|
+
})]
|
|
18205
|
+
}),
|
|
18206
|
+
(0, react_jsx_runtime.jsx)("span", {
|
|
18207
|
+
className: ComposerTeamSelect_module_css_default.panelRoute,
|
|
18208
|
+
children: route
|
|
18209
|
+
}),
|
|
18210
|
+
member.description.trim() === "" ? null : (0, react_jsx_runtime.jsx)("span", {
|
|
18211
|
+
className: ComposerTeamSelect_module_css_default.panelDesc,
|
|
18212
|
+
children: member.description
|
|
18213
|
+
}),
|
|
18214
|
+
selectable ? null : (0, react_jsx_runtime.jsx)("span", {
|
|
18215
|
+
className: ComposerTeamSelect_module_css_default.panelDesc,
|
|
18216
|
+
children: t("composePanelNoId")
|
|
18217
|
+
})
|
|
18218
|
+
]
|
|
18219
|
+
}, member.id ?? `${hoverTeam.id}:${index}`);
|
|
18220
|
+
}),
|
|
18221
|
+
(0, react_jsx_runtime.jsx)("div", {
|
|
18222
|
+
className: ComposerTeamSelect_module_css_default.panelHint,
|
|
18223
|
+
children: hoverTeam.members.length === 0 ? t("composePanelCaptainHint") : t("composePanelSoloHint")
|
|
18224
|
+
})
|
|
18225
|
+
]
|
|
18226
|
+
})]
|
|
17915
18227
|
}) : null]
|
|
17916
18228
|
}), failure === void 0 ? null : (0, react_jsx_runtime.jsx)("span", {
|
|
17917
18229
|
className: ComposerTeamSelect_module_css_default.failure,
|
|
@@ -19349,6 +19661,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
19349
19661
|
this.discard();
|
|
19350
19662
|
},
|
|
19351
19663
|
selectTeam: (sessionId, teamId) => this.selectTeam(sessionId, teamId),
|
|
19664
|
+
selectMember: (sessionId, teamId, roleId) => this.selectMember(sessionId, teamId, roleId),
|
|
19352
19665
|
loadCatalogue: () => {
|
|
19353
19666
|
this.loadCatalogue();
|
|
19354
19667
|
},
|
|
@@ -19917,6 +20230,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
19917
20230
|
/**
|
|
19918
20231
|
* Apply one Team to a Session, or clear its Team.
|
|
19919
20232
|
*
|
|
20233
|
+
* A captain-led selection: any member the Session was talking to is cleared
|
|
20234
|
+
* with the record, because the captain always leads and never inherits a
|
|
20235
|
+
* member's route.
|
|
20236
|
+
*
|
|
19920
20237
|
* The write goes through the Host's own `settings.mutate` with the revision
|
|
19921
20238
|
* the describe mirror holds, which is what makes a refusal reportable: the
|
|
19922
20239
|
* shared form's `mutate` answers only a boolean, so a refused selection used
|
|
@@ -19934,6 +20251,37 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
19934
20251
|
* @returns once the write settled; the outcome is published on {@link store}.
|
|
19935
20252
|
*/
|
|
19936
20253
|
async selectTeam(sessionId, teamId) {
|
|
20254
|
+
return this.applySelection(sessionId, teamId, void 0);
|
|
20255
|
+
}
|
|
20256
|
+
/**
|
|
20257
|
+
* Point one Session at a single member of a Team.
|
|
20258
|
+
*
|
|
20259
|
+
* The same fence, retry, and failure path as {@link selectTeam}, with the
|
|
20260
|
+
* member's stable role identity carried in the stored record: the Host then
|
|
20261
|
+
* injects that member's own configuration and model route, and this Session
|
|
20262
|
+
* talks to the member instead of being led by the captain. Nothing is
|
|
20263
|
+
* validated here — the composer only offers identities the stored Team still
|
|
20264
|
+
* holds, and a role that disappears later is exactly the stale-selection case
|
|
20265
|
+
* the missing notice already reports.
|
|
20266
|
+
* @param sessionId - the Session whose selection changes.
|
|
20267
|
+
* @param teamId - the Team the member belongs to.
|
|
20268
|
+
* @param roleId - the member's stable role identity.
|
|
20269
|
+
* @returns once the write settled; the outcome is published on {@link store}.
|
|
20270
|
+
*/
|
|
20271
|
+
async selectMember(sessionId, teamId, roleId) {
|
|
20272
|
+
return this.applySelection(sessionId, teamId, roleId);
|
|
20273
|
+
}
|
|
20274
|
+
/**
|
|
20275
|
+
* Write one Session selection, captain-led or member-scoped.
|
|
20276
|
+
*
|
|
20277
|
+
* The fence, the single retry, and the failure report are identical for both
|
|
20278
|
+
* forms; only the record the write carries differs.
|
|
20279
|
+
* @param sessionId - the Session whose selection changes.
|
|
20280
|
+
* @param teamId - the selected Team identity; undefined clears the selection.
|
|
20281
|
+
* @param roleId - the member to talk to individually; undefined keeps the captain leading.
|
|
20282
|
+
* @returns once the write settled; the outcome is published on {@link store}.
|
|
20283
|
+
*/
|
|
20284
|
+
async applySelection(sessionId, teamId, roleId) {
|
|
19937
20285
|
this.selectionFailure = void 0;
|
|
19938
20286
|
this.publish();
|
|
19939
20287
|
const view = this.namespaceView();
|
|
@@ -19946,10 +20294,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
19946
20294
|
});
|
|
19947
20295
|
return;
|
|
19948
20296
|
}
|
|
19949
|
-
const attempt = await this.writeSelection(sessionId, teamId, view.revision);
|
|
20297
|
+
const attempt = await this.writeSelection(sessionId, teamId, roleId, view.revision);
|
|
19950
20298
|
if (attempt.kind === "landed") return;
|
|
19951
20299
|
const recovered = this.namespaceView();
|
|
19952
|
-
const retried = recovered === void 0 ? attempt : await this.writeSelection(sessionId, teamId, recovered.revision);
|
|
20300
|
+
const retried = recovered === void 0 ? attempt : await this.writeSelection(sessionId, teamId, roleId, recovered.revision);
|
|
19953
20301
|
if (retried.kind === "landed") return;
|
|
19954
20302
|
this.failSelection({
|
|
19955
20303
|
kind: retried.kind,
|
|
@@ -19962,10 +20310,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
19962
20310
|
* Write one selection under one revision fence.
|
|
19963
20311
|
* @param sessionId - the Session whose Team changes.
|
|
19964
20312
|
* @param teamId - the selected Team identity; undefined clears the selection.
|
|
20313
|
+
* @param roleId - the member to talk to individually; undefined keeps the captain leading.
|
|
19965
20314
|
* @param revision - the revision the write is fenced on.
|
|
19966
20315
|
* @returns the outcome, with the Host's own refusal text when it refused.
|
|
19967
20316
|
*/
|
|
19968
|
-
async writeSelection(sessionId, teamId, revision) {
|
|
20317
|
+
async writeSelection(sessionId, teamId, roleId, revision) {
|
|
19969
20318
|
const stored = this.storedSection();
|
|
19970
20319
|
/* v8 ignore next -- every caller resolves the section before it writes. */
|
|
19971
20320
|
if (stored === void 0) return {
|
|
@@ -19975,10 +20324,17 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
19975
20324
|
const ops = [{
|
|
19976
20325
|
op: "set",
|
|
19977
20326
|
path: ["selections"],
|
|
19978
|
-
value: withSelection(stored.selections, sessionId, teamId).map((record) =>
|
|
19979
|
-
|
|
19980
|
-
|
|
19981
|
-
|
|
20327
|
+
value: withSelection(stored.selections, sessionId, teamId, roleId).map((record) => {
|
|
20328
|
+
const role = record.roleId;
|
|
20329
|
+
return role === void 0 || role.trim() === "" ? {
|
|
20330
|
+
sessionId: record.sessionId,
|
|
20331
|
+
teamId: record.teamId
|
|
20332
|
+
} : {
|
|
20333
|
+
sessionId: record.sessionId,
|
|
20334
|
+
teamId: record.teamId,
|
|
20335
|
+
roleId: role
|
|
20336
|
+
};
|
|
20337
|
+
})
|
|
19982
20338
|
}];
|
|
19983
20339
|
let response;
|
|
19984
20340
|
try {
|