@unson/brainbase-mcp 0.47.3 → 0.47.4
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/package.json +2 -2
- package/ui/brainbase-tokens.css +20 -0
- package/ui/meeting-minutes.css +18 -3
- package/ui/meeting-minutes.js +65 -20
- package/ui/workspace-kit.css +60 -2
- package/ui/workspace-kit.js +102 -17
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unson/brainbase-mcp",
|
|
3
|
-
"version": "0.47.
|
|
3
|
+
"version": "0.47.4",
|
|
4
4
|
"description": "Local-first Brainbase judgment OS that lets supported AI agents reuse a user's approved goals, priorities, decisions, and judgment criteria.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -624,5 +624,5 @@
|
|
|
624
624
|
"url": "https://github.com/Unson-LLC/brainbase/issues"
|
|
625
625
|
},
|
|
626
626
|
"homepage": "https://github.com/Unson-LLC/brainbase#readme",
|
|
627
|
-
"gitHead": "
|
|
627
|
+
"gitHead": "6a7f9223419008f3fa0cc57b19cadf2ca0a9ae52"
|
|
628
628
|
}
|
package/ui/brainbase-tokens.css
CHANGED
|
@@ -105,4 +105,24 @@
|
|
|
105
105
|
--bb-tab-indicator-size: 2px;
|
|
106
106
|
--bb-tab-count-size: 20px;
|
|
107
107
|
--bb-tab-count-font-size: 12px;
|
|
108
|
+
/* Opt-in search band: dimensions and interaction surfaces. */
|
|
109
|
+
--bb-search-band-query-width: 180px;
|
|
110
|
+
--bb-search-band-placeholder: #9b9ba3;
|
|
111
|
+
--bb-search-band-selected: var(--bb-color-interaction-hover, #e5f8e1);
|
|
112
|
+
--bb-search-band-icon-width: 24px;
|
|
113
|
+
--bb-search-band-icon-stroke: 1.5;
|
|
114
|
+
--bb-search-band-icon-selected-stroke: 2;
|
|
115
|
+
--bb-search-band-chevron-width: 10px;
|
|
116
|
+
--bb-search-band-chevron-height: 6px;
|
|
117
|
+
--bb-search-band-chevron-stroke: 1.2;
|
|
118
|
+
--bb-search-band-header-height: 44px;
|
|
119
|
+
--bb-search-band-scope-padding: 13px;
|
|
120
|
+
--bb-search-band-scope-viewport-reserve: 192px;
|
|
121
|
+
--bb-search-band-scope-popup-width: 260px;
|
|
122
|
+
--bb-search-band-project-icon-size: 18px;
|
|
123
|
+
--bb-control-small-height: 28px;
|
|
124
|
+
--bb-create-background: #24324b;
|
|
125
|
+
--bb-create-hover: #1b263a;
|
|
126
|
+
--bb-radius-pill: 999px;
|
|
127
|
+
|
|
108
128
|
}
|
package/ui/meeting-minutes.css
CHANGED
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
color: var(--bb-color-danger);
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
.bb-minutes-toolbar {
|
|
111
|
+
.bb-minutes-toolbar:not(.bb-ws-search-band) {
|
|
112
112
|
display: flex;
|
|
113
113
|
flex-wrap: wrap;
|
|
114
114
|
gap: 8px 12px;
|
|
@@ -828,7 +828,7 @@
|
|
|
828
828
|
/* Explicit compact mode keeps other hosts' expanded presentation compatible. */
|
|
829
829
|
.bb-minutes-screen.bb-minutes-compact { display: flex; flex-direction: column; gap: var(--bb-space-1); overflow: visible; }
|
|
830
830
|
.bb-minutes-compact > .bb-minutes-heading, .bb-minutes-compact > .bb-minutes-status[hidden] { display: none; }
|
|
831
|
-
.bb-minutes-compact > .bb-minutes-toolbar { flex: none; align-items: center; }
|
|
831
|
+
.bb-minutes-compact > .bb-minutes-toolbar:not(.bb-ws-search-band) { flex: none; align-items: center; }
|
|
832
832
|
.bb-minutes-compact > .bb-minutes-columns { flex: 1; min-height: 0; }
|
|
833
833
|
.bb-minutes-compact .bb-minutes-list-pane { display: block; }
|
|
834
834
|
.bb-minutes-compact .bb-ws-toolbar-primary > .bb-minutes-pane-head { flex-wrap: nowrap; padding: 0; gap: var(--bb-space-2); }
|
|
@@ -843,4 +843,19 @@
|
|
|
843
843
|
|
|
844
844
|
.bb-minutes-compact .bb-ws-toolbar-primary > .bb-minutes-pane-head { position: relative; }
|
|
845
845
|
.bb-minutes-compact .bb-ws-toolbar-primary > .bb-minutes-pane-head:is(:hover, :focus) .bb-minutes-create-reason { position: absolute; z-index: 48; left: 0; top: calc(100% + var(--bb-space-2)); width: max-content; max-width: var(--bb-toolbar-popover-width); height: auto; overflow: visible; clip-path: none; padding: var(--bb-space-2) var(--bb-space-3); background: var(--bb-color-panel); border: 1px solid var(--bb-color-border); border-radius: var(--bb-radius-sm); }
|
|
846
|
-
.bb-minutes-compact > .bb-minutes-toolbar { display: flex; flex-wrap: nowrap; justify-content: space-between; gap: var(--bb-space-3); min-height: var(--bb-toolbar-height); padding: 0; margin: 0 0 var(--bb-space-2); border: 0; border-radius: 0; background: transparent; overflow: visible; }
|
|
846
|
+
.bb-minutes-compact > .bb-minutes-toolbar:not(.bb-ws-search-band) { display: flex; flex-wrap: nowrap; justify-content: space-between; gap: var(--bb-space-3); min-height: var(--bb-toolbar-height); padding: 0; margin: 0 0 var(--bb-space-2); border: 0; border-radius: 0; background: transparent; overflow: visible; }
|
|
847
|
+
|
|
848
|
+
/* Explicit search-band composition. Legacy expanded/compact presentation stays intact. */
|
|
849
|
+
.bb-minutes-search-band { gap: 0; overflow: visible; }
|
|
850
|
+
.bb-minutes-search-band .bb-ws-toolbar-primary > .bb-minutes-pane-head { flex-wrap: nowrap; padding: 0; gap: var(--bb-space-2); }
|
|
851
|
+
.bb-minutes-search-band .bb-ws-toolbar-primary .bb-minutes-button { display: inline-flex; align-items: center; gap: var(--bb-space-1); white-space: nowrap; min-height: var(--bb-control-compact-height); height: var(--bb-control-compact-height); padding: var(--bb-space-1) var(--bb-space-2); box-sizing: border-box; font-size: var(--bb-toolbar-font-size); }
|
|
852
|
+
.bb-minutes-search-band .bb-ws-toolbar-primary .bb-ws-action-icon { order: -1; }
|
|
853
|
+
.bb-minutes-search-band .bb-minutes-button.is-primary { background: var(--bb-create-background); border-color: var(--bb-create-background); color: var(--bb-color-paper); }
|
|
854
|
+
.bb-minutes-search-band .bb-minutes-button.is-primary:hover { background: var(--bb-create-hover); border-color: var(--bb-create-hover); }
|
|
855
|
+
.bb-minutes-search-band .bb-minutes-filter-reset { width: auto; min-width: 0; height: var(--bb-control-small-height); padding: var(--bb-space-1) var(--bb-space-2); border: 0; background: transparent; color: var(--bb-color-brand-indigo); }
|
|
856
|
+
@media (max-width: 760px) {
|
|
857
|
+
.bb-minutes-search-band .bb-ws-toolbar-primary .bb-minutes-button.is-primary { width: var(--bb-control-compact-height); min-width: var(--bb-control-compact-height); padding: var(--bb-space-2); font-size: 0; gap: 0; }
|
|
858
|
+
.bb-minutes-search-band .bb-ws-toolbar-primary .bb-minutes-sort-note { display: none; }
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
.bb-ws-search-band .bb-minutes-filter-reset[hidden] { display: none; }
|
package/ui/meeting-minutes.js
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* changes what it asks the server for (story-meeting-minutes-list-filters-v1).
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
import { workspaceActionIcon, workspaceCompactToolbar, workspaceCombobox, workspaceDetailDrawer } from './workspace-kit.js';
|
|
14
|
+
import { workspaceActionIcon, workspaceSearchBand, workspaceCompactToolbar, workspaceCombobox, workspaceDetailDrawer } from './workspace-kit.js';
|
|
15
15
|
|
|
16
16
|
export const MEETING_MINUTES_UI_CONTRACT_VERSION = 'brainbase.meeting-minutes-ui.v1';
|
|
17
17
|
|
|
@@ -686,6 +686,10 @@ export function createMeetingMinutesUI({
|
|
|
686
686
|
meetingConnections,
|
|
687
687
|
meetingParticipants,
|
|
688
688
|
canCreateMeeting,
|
|
689
|
+
createProjectOptions,
|
|
690
|
+
createProjectValue,
|
|
691
|
+
createMeeting,
|
|
692
|
+
shouldOpenCreatedMeeting,
|
|
689
693
|
createUnavailableReason,
|
|
690
694
|
canEditMinutes,
|
|
691
695
|
hostFilters = [],
|
|
@@ -727,8 +731,10 @@ export function createMeetingMinutesUI({
|
|
|
727
731
|
let railProjectSlot = null;
|
|
728
732
|
let railProjectMeeting = null;
|
|
729
733
|
|
|
730
|
-
const
|
|
734
|
+
const searchBand = toolbarPresentation === 'search-band';
|
|
735
|
+
const compact = searchBand || toolbarPresentation === 'compact';
|
|
731
736
|
const screen = makeElement(doc, 'div', { className: `bb-minutes-screen${compact ? ' bb-minutes-compact bb-ws-neutral-controls' : ''}`, attrs: { 'data-contract-version': MEETING_MINUTES_UI_CONTRACT_VERSION } });
|
|
737
|
+
if (searchBand) screen.classList.add('bb-minutes-search-band');
|
|
732
738
|
const heading = makeElement(doc, 'header', { className: 'bb-minutes-heading' });
|
|
733
739
|
heading.append(
|
|
734
740
|
makeElement(doc, 'div', { className: 'bb-minutes-eyebrow', textContent: page?.source ?? '正本の議事録' }),
|
|
@@ -746,10 +752,13 @@ export function createMeetingMinutesUI({
|
|
|
746
752
|
attrs: { 'aria-label': '議事録', tabindex: '-1' },
|
|
747
753
|
});
|
|
748
754
|
const detailPane = makeElement(doc, 'section', { className: 'bb-minutes-detail-pane', attrs: { 'aria-label': '議事録詳細' } });
|
|
755
|
+
let createProjectBox = null;
|
|
756
|
+
const cleanupCreateProject = () => { createProjectBox?.destroy(); createProjectBox = null; };
|
|
749
757
|
const detailDrawer = detailPresentation === 'drawer' ? workspaceDetailDrawer(doc, {
|
|
750
|
-
title: '議事録の詳細', opener: () => listPane.querySelector('.bb-minutes-meeting-item.is-selected') ?? listPane,
|
|
758
|
+
title: '議事録の詳細', onClose: cleanupCreateProject, opener: () => detailPane.querySelector('.bb-minutes-create-form') ? toolbar.querySelector('.bb-minutes-button.is-primary') : listPane.querySelector('.bb-minutes-meeting-item.is-selected') ?? listPane,
|
|
751
759
|
}) : null;
|
|
752
760
|
if (detailDrawer) {
|
|
761
|
+
if (searchBand) detailDrawer.dialog.classList.add('bb-ws-search-band-drawer');
|
|
753
762
|
columns.classList.add('bb-minutes-details-in-drawer');
|
|
754
763
|
columns.append(listPane);
|
|
755
764
|
const scope = makeElement(doc, 'div', { className: 'bb-minutes-screen bb-minutes-drawer-content' });
|
|
@@ -767,7 +776,7 @@ export function createMeetingMinutesUI({
|
|
|
767
776
|
}
|
|
768
777
|
|
|
769
778
|
function filterCombobox(label, options, value, onChange) {
|
|
770
|
-
return workspaceCombobox(doc, { label, options, value, className: 'bb-minutes-filter-combobox', onChange });
|
|
779
|
+
return workspaceCombobox(doc, { label, options, value, showCount: !searchBand, className: 'bb-minutes-filter-combobox', onChange });
|
|
771
780
|
}
|
|
772
781
|
|
|
773
782
|
const keyword = makeElement(doc, 'input', {
|
|
@@ -795,7 +804,7 @@ export function createMeetingMinutesUI({
|
|
|
795
804
|
if (compact) {
|
|
796
805
|
const filters = makeElement(doc, 'div', { className: 'bb-minutes-compact-filters' });
|
|
797
806
|
filters.append(hostSlot, filterField('期間', period, 'is-period'), participantField, statusField);
|
|
798
|
-
compactToolbar = workspaceCompactToolbar(doc, { root: toolbar, query: keyword, filters, sort: sortBox, reset });
|
|
807
|
+
compactToolbar = searchBand ? workspaceSearchBand(doc, { root: toolbar, query: keyword, filters, sort: sortBox, reset, onResetSort: () => { state.sort = SORTS[0].value; renderList(); } }) : workspaceCompactToolbar(doc, { root: toolbar, query: keyword, filters, sort: sortBox, reset });
|
|
799
808
|
} else toolbar.append(keywordField, hostSlot, filterField('期間', period, 'is-period'), participantField, statusField, sortField, reset);
|
|
800
809
|
const hostBoxes = new Map();
|
|
801
810
|
|
|
@@ -812,16 +821,18 @@ export function createMeetingMinutesUI({
|
|
|
812
821
|
}
|
|
813
822
|
|
|
814
823
|
function filtersActive() {
|
|
815
|
-
|
|
824
|
+
const local = searchBand ? Object.keys(EMPTY_FILTERS).some(key => key !== 'query' && Boolean(state.filters[key])) : clientFiltersActive();
|
|
825
|
+
return local || currentHostFilters().some(filter => filter.placement !== 'scope' && (filter.multiple ? filter.values?.length : text(filter.value)));
|
|
816
826
|
}
|
|
817
827
|
|
|
818
828
|
function clearFilters() {
|
|
819
|
-
state.filters = { ...EMPTY_FILTERS };
|
|
820
|
-
keyword.value =
|
|
829
|
+
state.filters = { ...EMPTY_FILTERS, ...(searchBand ? { query: state.filters.query } : {}) };
|
|
830
|
+
keyword.value = state.filters.query;
|
|
821
831
|
fromInput.value = '';
|
|
822
832
|
toInput.value = '';
|
|
823
833
|
for (const filter of currentHostFilters()) {
|
|
824
|
-
if (
|
|
834
|
+
if (searchBand && filter.placement === 'scope') continue;
|
|
835
|
+
if (typeof filter.onChange === 'function' && (filter.multiple ? filter.values?.length : text(filter.value))) filter.onChange(filter.multiple ? [] : '');
|
|
825
836
|
}
|
|
826
837
|
renderList();
|
|
827
838
|
}
|
|
@@ -839,7 +850,11 @@ export function createMeetingMinutesUI({
|
|
|
839
850
|
const box = workspaceCombobox(doc, {
|
|
840
851
|
label: text(filter.label, id),
|
|
841
852
|
options,
|
|
842
|
-
value,
|
|
853
|
+
value, multiple: filter.multiple === true, values: filter.values,
|
|
854
|
+
renderIcon: filter.renderIcon, showHints: filter.showHints !== false,
|
|
855
|
+
showCount: searchBand ? false : filter.showCount !== false,
|
|
856
|
+
align: filter.placement === 'scope' ? 'end' : 'start',
|
|
857
|
+
searchable: filter.placement === 'scope' ? false : 'auto',
|
|
843
858
|
placeholder: text(filter.placeholder, '選択してください'),
|
|
844
859
|
className: 'bb-minutes-filter-combobox',
|
|
845
860
|
onChange: (next) => {
|
|
@@ -850,15 +865,22 @@ export function createMeetingMinutesUI({
|
|
|
850
865
|
entry = { box, field: filterField(text(filter.label, id), box.root) };
|
|
851
866
|
hostBoxes.set(id, entry);
|
|
852
867
|
}
|
|
853
|
-
entry.box.update({ options, value, disabled: filter.disabled === true });
|
|
868
|
+
entry.box.update({ options, value, values: filter.values, disabled: filter.disabled === true });
|
|
854
869
|
}
|
|
855
870
|
for (const [id, entry] of hostBoxes) {
|
|
856
871
|
if (seen.has(id)) continue;
|
|
857
872
|
entry.box.destroy();
|
|
858
873
|
hostBoxes.delete(id);
|
|
859
874
|
}
|
|
860
|
-
|
|
861
|
-
|
|
875
|
+
const inlineHosts = hosts.filter(filter => !searchBand || filter.placement !== 'scope');
|
|
876
|
+
const scopeHosts = searchBand ? hosts.filter(filter => filter.placement === 'scope') : [];
|
|
877
|
+
const reconcile = (parent, children) => {
|
|
878
|
+
if (!parent) return;
|
|
879
|
+
if (children.length !== parent.children.length || children.some((child, index) => parent.children[index] !== child)) parent.replaceChildren(...children);
|
|
880
|
+
};
|
|
881
|
+
reconcile(hostSlot, inlineHosts.map(filter => hostBoxes.get(text(filter.id)).field));
|
|
882
|
+
reconcile(compactToolbar?.scopeSlot, scopeHosts.map(filter => hostBoxes.get(text(filter.id)).box.root));
|
|
883
|
+
hostSlot.hidden = inlineHosts.length === 0;
|
|
862
884
|
|
|
863
885
|
// Offer only the conditions the loaded records can answer (P9).
|
|
864
886
|
const participants = [...new Set(meetings.flatMap(participantsOf))]
|
|
@@ -876,6 +898,7 @@ export function createMeetingMinutesUI({
|
|
|
876
898
|
sortBox.update({ value: state.sort });
|
|
877
899
|
reset.hidden = !filtersActive();
|
|
878
900
|
compactToolbar?.setFiltered(filtersActive());
|
|
901
|
+
compactToolbar?.setSorted?.(state.sort !== SORTS[0].value);
|
|
879
902
|
}
|
|
880
903
|
|
|
881
904
|
function clock() {
|
|
@@ -919,7 +942,7 @@ export function createMeetingMinutesUI({
|
|
|
919
942
|
});
|
|
920
943
|
}
|
|
921
944
|
|
|
922
|
-
function clear(node) { node.replaceChildren(); return node; }
|
|
945
|
+
function clear(node) { if (node === detailPane) cleanupCreateProject(); node.replaceChildren(); return node; }
|
|
923
946
|
|
|
924
947
|
function canCreate() {
|
|
925
948
|
if (typeof canCreateMeeting === 'function') {
|
|
@@ -1426,7 +1449,7 @@ export function createMeetingMinutesUI({
|
|
|
1426
1449
|
const head = makeElement(doc, 'div', { className: 'bb-minutes-pane-head' });
|
|
1427
1450
|
const meetings = state.meetings.filter((entry) => isRecord(entry?.meeting) && typeof entry.meeting.meeting_id === 'string');
|
|
1428
1451
|
renderToolbar(meetings);
|
|
1429
|
-
const visible = sortMeetings(meetings.filter(
|
|
1452
|
+
const visible = sortMeetings(meetings.filter(entry => matchesFilters(entry, state.filters) && currentHostFilters().every(filter => typeof filter.matches !== 'function' || filter.matches(entry, filter.multiple ? filter.values ?? [] : filter.value))), state.sort);
|
|
1430
1453
|
if (canCreate()) {
|
|
1431
1454
|
head.append(button(doc, '会議を作成', () => renderCreateForm(), { className: 'bb-minutes-button is-primary' }));
|
|
1432
1455
|
} else {
|
|
@@ -1777,6 +1800,7 @@ export function createMeetingMinutesUI({
|
|
|
1777
1800
|
}
|
|
1778
1801
|
|
|
1779
1802
|
function renderDetail(detail, documentRecord = null, selectedVersion = null) {
|
|
1803
|
+
detailDrawer?.setTitle('議事録の詳細');
|
|
1780
1804
|
clear(detailPane);
|
|
1781
1805
|
connectionsSlot = null;
|
|
1782
1806
|
participantsSlot = null;
|
|
@@ -1854,6 +1878,8 @@ export function createMeetingMinutesUI({
|
|
|
1854
1878
|
}
|
|
1855
1879
|
|
|
1856
1880
|
function renderCreateForm() {
|
|
1881
|
+
detailDrawer?.setTitle('会議を作成');
|
|
1882
|
+
detailRequestGeneration += 1;
|
|
1857
1883
|
detailDrawer?.open();
|
|
1858
1884
|
clear(detailPane);
|
|
1859
1885
|
if (!canCreate()) {
|
|
@@ -1861,7 +1887,16 @@ export function createMeetingMinutesUI({
|
|
|
1861
1887
|
return;
|
|
1862
1888
|
}
|
|
1863
1889
|
const form = makeElement(doc, 'form', { className: 'bb-minutes-create-form' });
|
|
1864
|
-
form.append(makeElement(doc, 'h2', { textContent: '会議を作成' })
|
|
1890
|
+
form.append(makeElement(doc, 'h2', { textContent: '会議を作成' }));
|
|
1891
|
+
const projectOptions = typeof createProjectOptions === 'function' ? createProjectOptions() : null;
|
|
1892
|
+
const initialProject = typeof createProjectValue === 'function' ? createProjectValue() : '';
|
|
1893
|
+
let projectCode = Array.isArray(projectOptions) && projectOptions.some(option => option.value === initialProject) ? initialProject : '';
|
|
1894
|
+
const projectError = makeElement(doc, 'p', { className: 'bb-minutes-warning', attrs: { role: 'alert' } }); projectError.hidden = true;
|
|
1895
|
+
if (Array.isArray(projectOptions)) {
|
|
1896
|
+
createProjectBox = workspaceCombobox(doc, { label: 'プロジェクト', options: [{ value: '', label: 'プロジェクトを選択' }, ...projectOptions], value: projectCode,
|
|
1897
|
+
showCount: false, searchable: true, onChange: value => { projectCode = value; projectError.hidden = true; } });
|
|
1898
|
+
form.append(filterField('プロジェクト', createProjectBox.root), projectError);
|
|
1899
|
+
}
|
|
1865
1900
|
const title = labelInput(doc, '会議名', { name: 'title', placeholder: '例: 週次定例' });
|
|
1866
1901
|
const date = labelInput(doc, '日時(任意)', { type: 'datetime-local', name: 'scheduled_at' });
|
|
1867
1902
|
const participants = labelInput(doc, '参加者(任意・カンマ区切り)', { name: 'participant_ids' });
|
|
@@ -1869,6 +1904,7 @@ export function createMeetingMinutesUI({
|
|
|
1869
1904
|
const body = labelInput(doc, '本文(任意)', { type: 'textarea', name: 'initial_body', placeholder: '会議の本文を入力' });
|
|
1870
1905
|
body.input.rows = 8;
|
|
1871
1906
|
const save = makeElement(doc, 'button', { className: 'bb-minutes-button is-primary', textContent: '会議を保存', type: 'submit' });
|
|
1907
|
+
title.input.required = true;
|
|
1872
1908
|
form.append(title.wrapper, date.wrapper, participants.wrapper, minutesTitle.wrapper, body.wrapper, save);
|
|
1873
1909
|
form.addEventListener('submit', async (event) => {
|
|
1874
1910
|
event.preventDefault();
|
|
@@ -1878,6 +1914,10 @@ export function createMeetingMinutesUI({
|
|
|
1878
1914
|
renderCreateUnavailable();
|
|
1879
1915
|
return;
|
|
1880
1916
|
}
|
|
1917
|
+
if (Array.isArray(projectOptions) && !projectOptions.some(option => option.value === projectCode)) {
|
|
1918
|
+
projectError.textContent = 'プロジェクトを選択してください。'; projectError.hidden = false;
|
|
1919
|
+
createProjectBox?.trigger.focus({ preventScroll: true }); return;
|
|
1920
|
+
}
|
|
1881
1921
|
save.disabled = true;
|
|
1882
1922
|
try {
|
|
1883
1923
|
const scheduledAt = date.input.value ? new Date(date.input.value).toISOString() : undefined;
|
|
@@ -1888,11 +1928,14 @@ export function createMeetingMinutesUI({
|
|
|
1888
1928
|
minutes_title: minutesTitle.input.value,
|
|
1889
1929
|
initial_body: body.input.value,
|
|
1890
1930
|
};
|
|
1891
|
-
const created = await mutate('', payload);
|
|
1931
|
+
const created = typeof createMeeting === 'function' && Array.isArray(projectOptions) ? await createMeeting(payload, projectCode) : await mutate('', payload);
|
|
1892
1932
|
const id = created?.meeting?.meeting_id;
|
|
1893
1933
|
setStatus('会議を保存しました。', 'success');
|
|
1894
1934
|
await loadMeetings();
|
|
1895
|
-
if (typeof id === 'string')
|
|
1935
|
+
if (typeof id === 'string') {
|
|
1936
|
+
if (typeof shouldOpenCreatedMeeting !== 'function' || shouldOpenCreatedMeeting(created, projectCode) !== false) await loadDetail(id);
|
|
1937
|
+
else { detailDrawer?.close(); renderDetail(null); if (!state.listError) setStatus('会議を保存しました。', 'success'); }
|
|
1938
|
+
}
|
|
1896
1939
|
} catch (error) {
|
|
1897
1940
|
save.disabled = false;
|
|
1898
1941
|
setStatus(error instanceof Error ? error.message : '会議を保存できませんでした。', 'error');
|
|
@@ -1901,11 +1944,11 @@ export function createMeetingMinutesUI({
|
|
|
1901
1944
|
detailPane.append(form);
|
|
1902
1945
|
}
|
|
1903
1946
|
|
|
1904
|
-
async function loadMeetings({ restoreFocus = false } = {}) {
|
|
1947
|
+
async function loadMeetings({ restoreFocus = false, quiet = false } = {}) {
|
|
1905
1948
|
const requestGeneration = ++listRequestGeneration;
|
|
1906
1949
|
const isCurrentRequest = () => !disposed && requestGeneration === listRequestGeneration;
|
|
1907
1950
|
state.loading = true;
|
|
1908
|
-
setStatus('会議一覧を読み込んでいます。');
|
|
1951
|
+
if (!quiet) setStatus('会議一覧を読み込んでいます。');
|
|
1909
1952
|
try {
|
|
1910
1953
|
const payload = await call('');
|
|
1911
1954
|
if (!isCurrentRequest()) return state.meetings;
|
|
@@ -1957,6 +2000,7 @@ export function createMeetingMinutesUI({
|
|
|
1957
2000
|
|
|
1958
2001
|
async function loadDetail(meetingId) {
|
|
1959
2002
|
if (disposed) return null;
|
|
2003
|
+
cleanupCreateProject();
|
|
1960
2004
|
detailDrawer?.open();
|
|
1961
2005
|
const requestGeneration = ++detailRequestGeneration;
|
|
1962
2006
|
const isCurrentRequest = () => !disposed && requestGeneration === detailRequestGeneration
|
|
@@ -2003,6 +2047,7 @@ export function createMeetingMinutesUI({
|
|
|
2003
2047
|
openMeeting: loadDetail,
|
|
2004
2048
|
destroy() {
|
|
2005
2049
|
disposed = true; listRequestGeneration += 1; detailRequestGeneration += 1;
|
|
2050
|
+
cleanupCreateProject();
|
|
2006
2051
|
detailDrawer?.dispose();
|
|
2007
2052
|
compactToolbar?.destroy();
|
|
2008
2053
|
participantBox.destroy(); statusBox.destroy(); sortBox.destroy();
|
package/ui/workspace-kit.css
CHANGED
|
@@ -544,7 +544,7 @@
|
|
|
544
544
|
}
|
|
545
545
|
.bb-ws-notification-symbol {
|
|
546
546
|
display: grid; place-items: center; flex: none;
|
|
547
|
-
width:
|
|
547
|
+
width: var(--bb-search-band-project-icon-size); height: var(--bb-search-band-project-icon-size); border-radius: 3px;
|
|
548
548
|
border: 1px solid var(--bb-notification-symbol-border);
|
|
549
549
|
color: var(--bb-notification-symbol-text);
|
|
550
550
|
font-size: 11px; font-weight: 700;
|
|
@@ -623,7 +623,7 @@
|
|
|
623
623
|
.bb-ws-combobox-chevron::after { content: '⌄'; color: var(--bb-color-muted); }
|
|
624
624
|
.bb-ws-combobox-popup {
|
|
625
625
|
position: absolute; z-index: 45; top: calc(100% + 6px); left: 0; display: grid; gap: var(--bb-space-2);
|
|
626
|
-
box-sizing: border-box; width: max(100%,
|
|
626
|
+
box-sizing: border-box; width: max(100%, var(--bb-search-band-scope-popup-width)); max-width: calc(100vw - 32px); padding: 8px;
|
|
627
627
|
border: 1px solid var(--bb-color-border); border-radius: var(--bb-radius-md); background: var(--bb-color-panel); color: var(--bb-color-ink);
|
|
628
628
|
box-shadow: var(--bb-shadow-popover); animation: bb-ws-filter-enter 140ms ease-out; transform-origin: top left;
|
|
629
629
|
}
|
|
@@ -818,3 +818,61 @@
|
|
|
818
818
|
.bb-ws-tabs--summary > [role="tab"] { flex-direction: column; align-items: flex-start; gap: 0; }
|
|
819
819
|
.bb-ws-tabs--summary > [role="tab"] strong { font: inherit; }
|
|
820
820
|
.bb-ws-tabs--summary > [role="tab"] small { margin: 0; }
|
|
821
|
+
|
|
822
|
+
/* Shared dropdown symbol; pointer/keyboard behavior remains on its trigger. */
|
|
823
|
+
.bb-ws-combobox-chevron { display: inline-flex; align-items: center; justify-content: center; flex: none; line-height: 0; }
|
|
824
|
+
.bb-ws-combobox-chevron::after { content: none; }
|
|
825
|
+
.bb-ws-dropdown-chevron { display: block; width: var(--bb-search-band-chevron-width); height: var(--bb-search-band-chevron-height); fill: none; stroke: currentColor; stroke-width: var(--bb-search-band-chevron-stroke); stroke-linecap: round; stroke-linejoin: round; }
|
|
826
|
+
.bb-ws-combobox-align-end .bb-ws-combobox-popup { left: auto; right: 0; transform-origin: top right; }
|
|
827
|
+
.bb-ws-combobox-multiple .bb-ws-combobox-list { scrollbar-gutter: stable both-edges; }
|
|
828
|
+
.bb-ws-combobox-multiple .bb-ws-combobox-value,
|
|
829
|
+
.bb-ws-combobox-multiple .bb-ws-combobox-option-label { display: flex; align-items: center; gap: var(--bb-space-1); }
|
|
830
|
+
.bb-ws-combobox-multiple .bb-project-icon { flex: none; width: var(--bb-search-band-project-icon-size); height: var(--bb-search-band-project-icon-size); }
|
|
831
|
+
.bb-ws-combobox-multiple .bb-ws-combobox-option,
|
|
832
|
+
.bb-ws-combobox-multiple .bb-ws-combobox-option.is-active,
|
|
833
|
+
.bb-ws-combobox-multiple .bb-ws-combobox-option[aria-selected='true'] { background: transparent; box-shadow: none; }
|
|
834
|
+
.bb-ws-combobox-multiple .bb-ws-combobox-option:hover { background: var(--bb-color-surface); }
|
|
835
|
+
.bb-ws-combobox-multiple .bb-ws-combobox-list:focus-visible .bb-ws-combobox-option.is-active { outline: 1px solid var(--bb-color-muted); outline-offset: -1px; }
|
|
836
|
+
.bb-ws-combobox-status[hidden] { display: none; }
|
|
837
|
+
|
|
838
|
+
/* Opt-in shared one-row search band. No host-specific selectors or DOM observers. */
|
|
839
|
+
.bb-ws-search-band { flex-wrap: nowrap; border: 0; border-radius: 0; position: sticky; top: var(--bb-search-band-header-height); z-index: 17; display: flex; align-items: center; gap: var(--bb-space-2); box-sizing: border-box; min-height: calc(var(--bb-control-compact-height) + var(--bb-space-3) * 2); margin-bottom: var(--bb-space-3); padding-block: var(--bb-space-3); background: var(--bb-color-panel); box-shadow: inset 0 -1px var(--bb-color-border); overflow: visible; }
|
|
840
|
+
.bb-ws-search-band .bb-ws-toolbar-controls { margin-left: auto; gap: var(--bb-space-2); }
|
|
841
|
+
.bb-ws-search-band .bb-ws-toolbar-query { width: var(--bb-search-band-query-width); max-width: var(--bb-search-band-query-width); }
|
|
842
|
+
.bb-ws-search-band .bb-ws-toolbar-query input { width: 100%; min-width: 0; height: var(--bb-control-compact-height); min-height: var(--bb-control-compact-height); box-sizing: border-box; padding: var(--bb-space-1) var(--bb-space-2) var(--bb-space-1) calc(var(--bb-space-2) * 2 + var(--bb-toolbar-icon-size)); font-size: var(--bb-toolbar-font-size); border: 0; border-radius: var(--bb-radius-pill); background: var(--bb-color-canvas); box-shadow: none; }
|
|
843
|
+
.bb-ws-search-band .bb-ws-toolbar-query input::placeholder { color: var(--bb-search-band-placeholder); opacity: 1; }
|
|
844
|
+
.bb-ws-search-band .bb-ws-toolbar-query input:not(:placeholder-shown) { background: var(--bb-search-band-selected); }
|
|
845
|
+
.bb-ws-search-band .bb-ws-toolbar-scope { display: inline-flex; flex: none; min-width: 0; max-width: min(var(--bb-toolbar-popover-width), calc(100vw - var(--bb-search-band-scope-viewport-reserve))); }
|
|
846
|
+
.bb-ws-search-band .bb-ws-toolbar-scope > .bb-ws-combobox { width: max-content; min-width: 0; max-width: 100%; }
|
|
847
|
+
.bb-ws-search-band .bb-ws-toolbar-scope .bb-ws-combobox-trigger { width: auto; max-width: 100%; min-height: var(--bb-control-compact-height); height: var(--bb-control-compact-height); padding-inline: var(--bb-search-band-scope-padding); border: 0; border-radius: var(--bb-radius-pill); background: var(--bb-color-canvas); }
|
|
848
|
+
.bb-ws-search-band .bb-ws-toolbar-scope .is-multi-selected .bb-ws-combobox-trigger { background: var(--bb-search-band-selected); color: var(--bb-color-brand-indigo); }
|
|
849
|
+
.bb-ws-search-band .bb-ws-toolbar-scope .bb-ws-combobox-popup { width: max(100%, var(--bb-search-band-scope-popup-width)); }
|
|
850
|
+
.bb-ws-search-band .bb-ws-toolbar-filter-group,
|
|
851
|
+
.bb-ws-search-band .bb-ws-toolbar-sort { display: inline-flex; flex: none; border-radius: var(--bb-radius-sm); }
|
|
852
|
+
.bb-ws-search-band .bb-ws-toolbar-sort { margin-left: calc(var(--bb-space-1) * -1); }
|
|
853
|
+
.bb-ws-search-band .bb-ws-toolbar-filter,
|
|
854
|
+
.bb-ws-search-band .bb-ws-toolbar-sort-trigger { display: inline-flex; align-items: center; justify-content: center; width: var(--bb-search-band-icon-width); min-width: var(--bb-search-band-icon-width); height: var(--bb-control-compact-height); min-height: var(--bb-control-compact-height); box-sizing: border-box; padding: var(--bb-space-1); border: 0; border-radius: var(--bb-radius-sm); background: transparent; color: var(--bb-color-muted); box-shadow: none; }
|
|
855
|
+
.bb-ws-search-band .bb-ws-toolbar-filter:hover,
|
|
856
|
+
.bb-ws-search-band .bb-ws-toolbar-sort-trigger:hover { background: transparent; color: var(--bb-color-brand-indigo); }
|
|
857
|
+
.bb-ws-search-band .is-filtered .bb-ws-toolbar-filter,
|
|
858
|
+
.bb-ws-search-band .is-sorted .bb-ws-toolbar-sort-trigger { background: var(--bb-search-band-selected); color: var(--bb-color-brand-indigo); }
|
|
859
|
+
.bb-ws-search-band .bb-ws-action-icon { stroke-width: var(--bb-search-band-icon-stroke); }
|
|
860
|
+
.bb-ws-search-band :is(.is-filtered, .is-sorted) .bb-ws-action-icon { stroke-width: var(--bb-search-band-icon-selected-stroke); }
|
|
861
|
+
.bb-ws-search-band .bb-ws-toolbar-filter-panel { width: var(--bb-toolbar-popover-width); }
|
|
862
|
+
.bb-ws-search-band .bb-ws-menu-reset { display: flex; justify-content: center; }
|
|
863
|
+
.bb-ws-search-band .bb-ws-toolbar-sort .bb-ws-button { margin-inline: auto; border: 0; background: transparent; }
|
|
864
|
+
.bb-ws-search-band :is(.bb-ws-toolbar-filter, .bb-ws-toolbar-sort-trigger, .bb-ws-toolbar-scope .bb-ws-combobox-trigger):focus-visible { outline: 2px solid var(--bb-control-edge, var(--bb-color-muted)); outline-offset: 2px; }
|
|
865
|
+
@media (max-width: 760px) {
|
|
866
|
+
.bb-ws-search-band .bb-ws-toolbar-controls { flex: 1; min-width: 0; gap: var(--bb-space-1); }
|
|
867
|
+
.bb-ws-search-band .bb-ws-toolbar-query { flex: 1; width: auto; min-width: var(--bb-toolbar-height); }
|
|
868
|
+
.bb-ws-search-band .bb-ws-toolbar-sort { margin-left: 0; }
|
|
869
|
+
.bb-ws-search-band .bb-ws-toolbar-filter-panel { position: fixed; top: calc(var(--bb-search-band-header-height) + var(--bb-control-compact-height) + var(--bb-space-3) * 2); right: var(--bb-space-4); width: calc(100vw - var(--bb-space-6)); max-height: calc(100dvh - 140px); overflow-y: auto; }
|
|
870
|
+
.bb-ws-search-band .bb-ws-toolbar-sort .bb-ws-combobox-popup { left: auto; right: 0; width: min(var(--bb-search-band-scope-popup-width), calc(100vw - var(--bb-space-6))); }
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
/* Opaque entry prevents fixed chrome rules from shining through an inspector. */
|
|
874
|
+
@keyframes bb-ws-drawer-opaque-in { from { transform: translateX(24px); } to { transform: none; } }
|
|
875
|
+
.bb-ws-search-band-drawer[open]:not(.is-closing) { animation-name: bb-ws-drawer-opaque-in; }
|
|
876
|
+
.bb-ws-search-band-drawer .bb-ws-detail-closebar { border-bottom: 0; box-shadow: none; }
|
|
877
|
+
|
|
878
|
+
.bb-ws-search-band .bb-ws-toolbar-filter::after { content: none; margin: 0; }
|
package/ui/workspace-kit.js
CHANGED
|
@@ -25,6 +25,13 @@ export function makeWorkspaceElement(doc, tag, { className, text, attrs = {} } =
|
|
|
25
25
|
|
|
26
26
|
const el = makeWorkspaceElement;
|
|
27
27
|
|
|
28
|
+
function toggleWorkspaceClass(node, name, active) {
|
|
29
|
+
if (!node) return;
|
|
30
|
+
const names = new Set(String(node.className || '').split(/\s+/u).filter(Boolean));
|
|
31
|
+
if (active) names.add(name); else names.delete(name);
|
|
32
|
+
node.className = [...names].join(' ');
|
|
33
|
+
}
|
|
34
|
+
|
|
28
35
|
function appendContent(parent, doc, content) {
|
|
29
36
|
if (content === undefined || content === null || content === false) return;
|
|
30
37
|
if (Array.isArray(content)) {
|
|
@@ -109,6 +116,7 @@ export function workspaceDetailDrawer(doc, { title = '詳細', opener, onClose }
|
|
|
109
116
|
return {
|
|
110
117
|
dialog,
|
|
111
118
|
setContent(...content) { if (!disposed) body.replaceChildren(...content); },
|
|
119
|
+
setTitle(title) { if (!disposed) label.textContent = String(title); },
|
|
112
120
|
open(target) {
|
|
113
121
|
if (disposed) return;
|
|
114
122
|
cancelClosing?.(); cancelClosing = null;
|
|
@@ -505,13 +513,16 @@ function comboboxText(value) {
|
|
|
505
513
|
export function workspaceCombobox(doc, {
|
|
506
514
|
label, options = [], value = '', placeholder = '選択してください', searchLabel, searchPlaceholder = '絞り込む',
|
|
507
515
|
emptyText = '一致する候補はありません', limit = 100, searchable = 'auto', className, onChange,
|
|
516
|
+
multiple = false, values = [], renderIcon, showCount = true, showHints = true, align = 'start',
|
|
508
517
|
} = {}) {
|
|
509
518
|
const sequence = ++workspaceSequence;
|
|
510
519
|
const listId = `bb-ws-combobox-${sequence}-list`;
|
|
511
520
|
const root = el(doc, 'span', { className: ['bb-ws-combobox', className].filter(Boolean).join(' ') });
|
|
521
|
+
if (multiple) root.classList?.add('bb-ws-combobox-multiple');
|
|
522
|
+
if (align === 'end') root.classList?.add('bb-ws-combobox-align-end');
|
|
512
523
|
const trigger = el(doc, 'button', { className: 'bb-ws-combobox-trigger', attrs: { type: 'button', 'aria-haspopup': 'listbox', 'aria-expanded': 'false', 'aria-controls': listId } });
|
|
513
524
|
const triggerText = el(doc, 'span', { className: 'bb-ws-combobox-value' });
|
|
514
|
-
trigger.append(triggerText,
|
|
525
|
+
trigger.append(triggerText, workspaceDropdownChevron(doc));
|
|
515
526
|
const popup = el(doc, 'div', { className: 'bb-ws-combobox-popup' });
|
|
516
527
|
popup.hidden = true;
|
|
517
528
|
const search = el(doc, 'input', { className: 'bb-ws-combobox-search', attrs: {
|
|
@@ -519,29 +530,35 @@ export function workspaceCombobox(doc, {
|
|
|
519
530
|
'aria-label': searchLabel || `${label || '候補'}を絞り込む`, placeholder: searchPlaceholder, autocomplete: 'off', spellcheck: 'false',
|
|
520
531
|
} });
|
|
521
532
|
const list = el(doc, 'ul', { className: 'bb-ws-combobox-list', attrs: { id: listId, role: 'listbox', 'aria-label': label || '候補', tabindex: '-1' } });
|
|
533
|
+
if (multiple) list.setAttribute('aria-multiselectable', 'true');
|
|
522
534
|
const status = el(doc, 'p', { className: 'bb-ws-combobox-status', attrs: { role: 'status', 'aria-live': 'polite' } });
|
|
523
535
|
popup.append(search, list, status);
|
|
524
536
|
root.append(trigger, popup);
|
|
525
537
|
|
|
526
|
-
const state = { options: [], value: String(value ?? ''), query: '', active: -1, shown: [], open: false, disabled: false };
|
|
538
|
+
const state = { options: [], values: [...new Set((Array.isArray(values) ? values : []).map(String))].filter(Boolean), value: String(value ?? ''), query: '', active: -1, shown: [], open: false, disabled: false };
|
|
527
539
|
const usesSearch = () => searchable === true || (searchable === 'auto' && state.options.length > 8);
|
|
528
540
|
const focusTarget = () => (usesSearch() ? search : list);
|
|
529
541
|
const chosen = () => state.options.find(option => option.value === state.value);
|
|
530
542
|
|
|
531
543
|
function setOptions(next) {
|
|
532
544
|
state.options = (Array.isArray(next) ? next : []).map(option => ({
|
|
533
|
-
value: String(option?.value ?? ''), label: String(option?.label ?? option?.value ?? ''),
|
|
545
|
+
...option, value: String(option?.value ?? ''), label: String(option?.label ?? option?.value ?? ''),
|
|
534
546
|
hint: option?.hint ? String(option.hint) : '', keywords: option?.keywords ? String(option.keywords) : '',
|
|
535
547
|
}));
|
|
536
548
|
}
|
|
537
549
|
|
|
538
550
|
function renderTrigger() {
|
|
539
|
-
const option = chosen();
|
|
540
|
-
|
|
541
|
-
const text = option ? option.label : state.value || placeholder;
|
|
551
|
+
const option = multiple ? (state.values.length === 1 ? state.options.find(option => option.value === state.values[0]) : state.options.find(option => !option.value)) : chosen();
|
|
552
|
+
const summary = multiple && state.values.length > 1 ? `${state.values.length}件選択中` : null;
|
|
553
|
+
const text = summary || (option ? option.label : multiple ? state.values.join('、') || placeholder : state.value || placeholder);
|
|
542
554
|
triggerText.textContent = text;
|
|
555
|
+
if (!summary && option && typeof renderIcon === 'function') {
|
|
556
|
+
const icon = renderIcon(option);
|
|
557
|
+
if (icon) { triggerText.textContent = ''; triggerText.append(icon, el(doc, 'span', { className: 'bb-ws-combobox-text', text })); }
|
|
558
|
+
}
|
|
559
|
+
toggleWorkspaceClass(root, 'is-multi-selected', Boolean(summary));
|
|
543
560
|
trigger.setAttribute('aria-label', `${label ? `${label}: ` : ''}${text}`);
|
|
544
|
-
trigger.setAttribute('data-empty', String(!option && !state.value));
|
|
561
|
+
trigger.setAttribute('data-empty', String(multiple ? !state.values.length : !option && !state.value));
|
|
545
562
|
if (state.disabled) trigger.setAttribute('disabled', ''); else trigger.removeAttribute('disabled');
|
|
546
563
|
}
|
|
547
564
|
|
|
@@ -552,7 +569,8 @@ export function workspaceCombobox(doc, {
|
|
|
552
569
|
}
|
|
553
570
|
}
|
|
554
571
|
|
|
555
|
-
function renderList() {
|
|
572
|
+
function renderList({ reveal = false } = {}) {
|
|
573
|
+
const scrollTop = list.scrollTop;
|
|
556
574
|
const terms = comboboxText(state.query).split(/\s+/u).filter(Boolean);
|
|
557
575
|
const matches = terms.length
|
|
558
576
|
? state.options.filter(option => { const text = comboboxText(`${option.label}\n${option.hint}\n${option.keywords}`); return terms.every(term => text.includes(term)); })
|
|
@@ -562,25 +580,37 @@ export function workspaceCombobox(doc, {
|
|
|
562
580
|
if (state.active >= state.shown.length) state.active = state.shown.length - 1;
|
|
563
581
|
list.replaceChildren();
|
|
564
582
|
state.shown.forEach((option, index) => {
|
|
565
|
-
const selected = option.value === state.value;
|
|
583
|
+
const selected = multiple ? option.value ? state.values.includes(option.value) : state.values.length === 0 : option.value === state.value;
|
|
566
584
|
const item = el(doc, 'li', { className: `bb-ws-combobox-option${index === state.active ? ' is-active' : ''}`, attrs: { id: `bb-ws-combobox-${sequence}-option-${index}`, role: 'option', 'aria-selected': String(selected), 'data-value': option.value } });
|
|
567
|
-
|
|
568
|
-
if (option
|
|
585
|
+
const optionLabel = el(doc, 'span', { className: 'bb-ws-combobox-option-label', text: option.label });
|
|
586
|
+
if (typeof renderIcon === 'function') { const icon = renderIcon(option); if (icon) { optionLabel.textContent = ''; optionLabel.append(icon, el(doc, 'span', { className: 'bb-ws-combobox-text', text: option.label })); } }
|
|
587
|
+
item.append(optionLabel);
|
|
588
|
+
if (showHints && option.hint) item.append(el(doc, 'span', { className: 'bb-ws-combobox-option-hint', text: option.hint }));
|
|
569
589
|
item.addEventListener('pointerdown', event => event.preventDefault?.());
|
|
570
590
|
item.addEventListener('click', () => choose(option));
|
|
571
591
|
list.append(item);
|
|
572
592
|
});
|
|
573
593
|
const active = list.children?.[state.active];
|
|
574
594
|
activeDescendant(active);
|
|
575
|
-
|
|
595
|
+
if (scrollTop !== undefined) list.scrollTop = scrollTop;
|
|
596
|
+
if (reveal) {
|
|
597
|
+
const activeRect = active?.getBoundingClientRect?.(), listRect = list.getBoundingClientRect?.();
|
|
598
|
+
const top = activeRect && listRect ? activeRect.top - listRect.top + list.scrollTop : active?.offsetTop;
|
|
599
|
+
const height = activeRect?.height ?? active?.offsetHeight;
|
|
600
|
+
if (Number.isFinite(top) && Number.isFinite(height)) {
|
|
601
|
+
if (top < list.scrollTop) list.scrollTop = top;
|
|
602
|
+
else if (top + height > list.scrollTop + list.clientHeight) list.scrollTop = top + height - list.clientHeight;
|
|
603
|
+
}
|
|
604
|
+
}
|
|
576
605
|
const rest = matches.length - state.shown.length;
|
|
606
|
+
status.hidden = !showCount && matches.length > 0 && rest === 0;
|
|
577
607
|
status.textContent = !matches.length ? emptyText : rest > 0 ? `${matches.length}件中${state.shown.length}件を表示。ほか${rest}件は絞り込むと出ます` : `${matches.length}件`;
|
|
578
608
|
}
|
|
579
609
|
|
|
580
610
|
function move(index) {
|
|
581
611
|
if (!state.shown.length) return;
|
|
582
612
|
state.active = Math.min(state.shown.length - 1, Math.max(0, index));
|
|
583
|
-
renderList();
|
|
613
|
+
renderList({ reveal: true });
|
|
584
614
|
}
|
|
585
615
|
|
|
586
616
|
function removeListeners() { doc.removeEventListener?.('pointerdown', outside); }
|
|
@@ -590,11 +620,11 @@ export function workspaceCombobox(doc, {
|
|
|
590
620
|
if (state.disabled) return;
|
|
591
621
|
if (!state.open) { state.open = true; doc.addEventListener?.('pointerdown', outside); }
|
|
592
622
|
state.query = query; search.value = query; search.hidden = !usesSearch();
|
|
593
|
-
const selectedIndex = state.options.findIndex(option => option.value === state.value);
|
|
623
|
+
const selectedIndex = state.options.findIndex(option => multiple ? state.values.includes(option.value) : option.value === state.value);
|
|
594
624
|
state.active = query ? 0 : Math.max(0, selectedIndex);
|
|
595
625
|
popup.hidden = false; trigger.setAttribute('aria-expanded', 'true');
|
|
596
|
-
renderList();
|
|
597
|
-
focusTarget().focus?.();
|
|
626
|
+
renderList({ reveal: true });
|
|
627
|
+
focusTarget().focus?.({ preventScroll: true });
|
|
598
628
|
}
|
|
599
629
|
|
|
600
630
|
function close(returnFocus = true) {
|
|
@@ -605,6 +635,11 @@ export function workspaceCombobox(doc, {
|
|
|
605
635
|
}
|
|
606
636
|
|
|
607
637
|
function choose(option) {
|
|
638
|
+
if (multiple) {
|
|
639
|
+
state.active = state.shown.findIndex(candidate => candidate.value === option.value);
|
|
640
|
+
state.values = !option.value ? [] : state.values.includes(option.value) ? state.values.filter(value => value !== option.value) : [...state.values, option.value];
|
|
641
|
+
renderTrigger(); renderList(); onChange?.([...state.values], option); return;
|
|
642
|
+
}
|
|
608
643
|
const changed = option.value !== state.value;
|
|
609
644
|
state.value = option.value; renderTrigger(); close(true);
|
|
610
645
|
if (changed) onChange?.(option.value, option);
|
|
@@ -621,6 +656,7 @@ export function workspaceCombobox(doc, {
|
|
|
621
656
|
// Home and End move the caret while a search box is shown.
|
|
622
657
|
if (!usesSearch()) Object.assign(keys, { Home: () => move(0), End: () => move(state.shown.length - 1) });
|
|
623
658
|
if (event.key === 'Tab') { close(false); return; }
|
|
659
|
+
if (multiple && event.key === ' ' && !usesSearch()) keys[' '] = keys.Enter;
|
|
624
660
|
const action = keys[event.key];
|
|
625
661
|
if (!action) return;
|
|
626
662
|
event.preventDefault?.(); event.stopPropagation?.();
|
|
@@ -641,12 +677,16 @@ export function workspaceCombobox(doc, {
|
|
|
641
677
|
return {
|
|
642
678
|
root, trigger, popup, search, list,
|
|
643
679
|
get value() { return state.value; },
|
|
680
|
+
get values() { return [...state.values]; },
|
|
644
681
|
get isOpen() { return state.open; },
|
|
645
682
|
open, close,
|
|
646
|
-
update({ options: nextOptions, value: nextValue, disabled } = {}) {
|
|
683
|
+
update({ options: nextOptions, value: nextValue, values: nextValues, disabled } = {}) {
|
|
684
|
+
const previous = JSON.stringify([state.options, state.value, state.values, state.disabled]);
|
|
647
685
|
if (nextOptions !== undefined) setOptions(nextOptions);
|
|
648
686
|
if (nextValue !== undefined) state.value = String(nextValue ?? '');
|
|
687
|
+
if (nextValues !== undefined) state.values = [...new Set((Array.isArray(nextValues) ? nextValues : []).map(String))].filter(Boolean);
|
|
649
688
|
if (disabled !== undefined) { state.disabled = Boolean(disabled); if (state.disabled) close(false); }
|
|
689
|
+
if (previous === JSON.stringify([state.options, state.value, state.values, state.disabled])) return;
|
|
650
690
|
renderTrigger();
|
|
651
691
|
if (state.open) { search.hidden = !usesSearch(); renderList(); }
|
|
652
692
|
},
|
|
@@ -718,3 +758,48 @@ export function workspaceTabList(root) {
|
|
|
718
758
|
root.className = classes.join(' ');
|
|
719
759
|
return root;
|
|
720
760
|
}
|
|
761
|
+
|
|
762
|
+
/** The shared shallow dropdown chevron, sized and colored through shared CSS. */
|
|
763
|
+
export function workspaceDropdownChevron(doc) {
|
|
764
|
+
const wrap = el(doc, 'span', { className: 'bb-ws-combobox-chevron', attrs: { 'aria-hidden': 'true' } });
|
|
765
|
+
const create = tag => typeof doc.createElementNS === 'function' ? doc.createElementNS('http://www.w3.org/2000/svg', tag) : doc.createElement(tag);
|
|
766
|
+
const svg = create('svg'); svg.setAttribute('viewBox', '0 0 12 8'); svg.setAttribute('class', 'bb-ws-dropdown-chevron');
|
|
767
|
+
const path = create('path'); path.setAttribute('d', 'M1 2.5l5 3 5-3'); svg.append(path); wrap.append(svg); return wrap;
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
/** Opt-in shared search band. The host retains scope options and query handlers. */
|
|
771
|
+
export function workspaceSearchBand(doc, { root, query, filters, sort, reset, onResetSort } = {}) {
|
|
772
|
+
root ||= el(doc, 'div'); root.classList.add('bb-ws-search-band');
|
|
773
|
+
const primary = el(doc, 'div', { className: 'bb-ws-toolbar-primary' });
|
|
774
|
+
const controls = el(doc, 'div', { className: 'bb-ws-toolbar-controls' });
|
|
775
|
+
const search = el(doc, 'span', { className: 'bb-ws-toolbar-query' }); search.append(workspaceActionIcon(doc, 'search'), query);
|
|
776
|
+
const scopeSlot = el(doc, 'span', { className: 'bb-ws-toolbar-scope' });
|
|
777
|
+
const trigger = workspaceButton(doc, { variant: 'quiet', attrs: { 'aria-label': 'フィルター', title: 'フィルター' } });
|
|
778
|
+
trigger.classList.add('bb-ws-toolbar-filter'); trigger.append(workspaceActionIcon(doc, 'filter'));
|
|
779
|
+
const filter = workspaceFilterPopover(doc, { content: filters, trigger,
|
|
780
|
+
onToggle: open => { if (open) sort?.close(false); },
|
|
781
|
+
});
|
|
782
|
+
filter.root.classList.add('bb-ws-toolbar-filter-group'); filter.panel.classList.add('bb-ws-toolbar-filter-panel');
|
|
783
|
+
if (reset) {
|
|
784
|
+
reset.textContent = 'フィルターを解除'; reset.setAttribute('aria-label', 'フィルターを解除');
|
|
785
|
+
const footer = el(doc, 'div', { className: 'bb-ws-menu-reset' }); footer.append(reset); filters.append(footer);
|
|
786
|
+
}
|
|
787
|
+
const closeFilter = () => { if (!filter.panel.hidden) trigger.click(); };
|
|
788
|
+
const clear = () => { closeFilter(); trigger.focus({ preventScroll: true }); };
|
|
789
|
+
const sortClick = () => closeFilter();
|
|
790
|
+
const sortReset = workspaceButton(doc, { text: '初期順に戻す', attrs: { 'aria-label': '並べ替えを初期順に戻す' } });
|
|
791
|
+
const resetSort = () => { sort?.close(false); onResetSort?.(); sort?.trigger.focus({ preventScroll: true }); };
|
|
792
|
+
if (sort) {
|
|
793
|
+
sort.root.classList.add('bb-ws-toolbar-sort'); sort.trigger.classList.add('bb-ws-toolbar-sort-trigger');
|
|
794
|
+
sort.trigger.replaceChildren(workspaceActionIcon(doc, 'sort')); sort.trigger.setAttribute('title', '並べ替え');
|
|
795
|
+
sort.popup.append(sortReset); sortReset.addEventListener('click', resetSort);
|
|
796
|
+
sort.trigger.addEventListener('click', sortClick); sort.trigger.addEventListener('keydown', sortClick);
|
|
797
|
+
}
|
|
798
|
+
controls.append(search, scopeSlot, filter.root); if (sort) controls.append(sort.root); root.replaceChildren(primary, controls);
|
|
799
|
+
reset?.addEventListener('click', clear);
|
|
800
|
+
return { root, primary, scopeSlot, filter,
|
|
801
|
+
setFiltered(active) { toggleWorkspaceClass(filter.root, 'is-filtered', Boolean(active)); trigger.setAttribute('aria-label', active ? 'フィルター(適用中)' : 'フィルター'); },
|
|
802
|
+
setSorted(active) { toggleWorkspaceClass(sort?.root, 'is-sorted', Boolean(active)); sortReset.hidden = !active; },
|
|
803
|
+
destroy() { filter.destroy(); reset?.removeEventListener('click', clear); sortReset.removeEventListener('click', resetSort); sort?.trigger.removeEventListener('click', sortClick); sort?.trigger.removeEventListener('keydown', sortClick); },
|
|
804
|
+
};
|
|
805
|
+
}
|