@unson/brainbase-mcp 0.47.3 → 0.47.5
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 +71 -20
- package/ui/workspace-kit.css +60 -2
- package/ui/workspace-kit.js +114 -23
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unson/brainbase-mcp",
|
|
3
|
-
"version": "0.47.
|
|
3
|
+
"version": "0.47.5",
|
|
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": "58653c598fd801e609c9e9627fbfaf8715081ad5"
|
|
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,10 @@
|
|
|
11
11
|
* changes what it asks the server for (story-meeting-minutes-list-filters-v1).
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
// A new lazy screen must not reuse the pre-search-band kit cached by an open tab.
|
|
15
|
+
// The capability query gives this compatible kit its own browser module identity.
|
|
16
|
+
import * as workspaceKit from './workspace-kit.js?capability=search-band-v1';
|
|
17
|
+
const { workspaceActionIcon, workspaceSearchBand, workspaceCompactToolbar, workspaceCombobox, workspaceDetailDrawer } = workspaceKit;
|
|
15
18
|
|
|
16
19
|
export const MEETING_MINUTES_UI_CONTRACT_VERSION = 'brainbase.meeting-minutes-ui.v1';
|
|
17
20
|
|
|
@@ -686,6 +689,10 @@ export function createMeetingMinutesUI({
|
|
|
686
689
|
meetingConnections,
|
|
687
690
|
meetingParticipants,
|
|
688
691
|
canCreateMeeting,
|
|
692
|
+
createProjectOptions,
|
|
693
|
+
createProjectValue,
|
|
694
|
+
createMeeting,
|
|
695
|
+
shouldOpenCreatedMeeting,
|
|
689
696
|
createUnavailableReason,
|
|
690
697
|
canEditMinutes,
|
|
691
698
|
hostFilters = [],
|
|
@@ -727,8 +734,13 @@ export function createMeetingMinutesUI({
|
|
|
727
734
|
let railProjectSlot = null;
|
|
728
735
|
let railProjectMeeting = null;
|
|
729
736
|
|
|
730
|
-
const
|
|
737
|
+
const searchBand = toolbarPresentation === 'search-band';
|
|
738
|
+
if (searchBand && typeof workspaceSearchBand !== 'function') {
|
|
739
|
+
throw new Error('検索帯の共通部品を読み込めませんでした。ページを再読み込みしてください。');
|
|
740
|
+
}
|
|
741
|
+
const compact = searchBand || toolbarPresentation === 'compact';
|
|
731
742
|
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 } });
|
|
743
|
+
if (searchBand) screen.classList.add('bb-minutes-search-band');
|
|
732
744
|
const heading = makeElement(doc, 'header', { className: 'bb-minutes-heading' });
|
|
733
745
|
heading.append(
|
|
734
746
|
makeElement(doc, 'div', { className: 'bb-minutes-eyebrow', textContent: page?.source ?? '正本の議事録' }),
|
|
@@ -746,10 +758,13 @@ export function createMeetingMinutesUI({
|
|
|
746
758
|
attrs: { 'aria-label': '議事録', tabindex: '-1' },
|
|
747
759
|
});
|
|
748
760
|
const detailPane = makeElement(doc, 'section', { className: 'bb-minutes-detail-pane', attrs: { 'aria-label': '議事録詳細' } });
|
|
761
|
+
let createProjectBox = null;
|
|
762
|
+
const cleanupCreateProject = () => { createProjectBox?.destroy(); createProjectBox = null; };
|
|
749
763
|
const detailDrawer = detailPresentation === 'drawer' ? workspaceDetailDrawer(doc, {
|
|
750
|
-
title: '議事録の詳細', opener: () => listPane.querySelector('.bb-minutes-meeting-item.is-selected') ?? listPane,
|
|
764
|
+
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
765
|
}) : null;
|
|
752
766
|
if (detailDrawer) {
|
|
767
|
+
if (searchBand) detailDrawer.dialog.classList.add('bb-ws-search-band-drawer');
|
|
753
768
|
columns.classList.add('bb-minutes-details-in-drawer');
|
|
754
769
|
columns.append(listPane);
|
|
755
770
|
const scope = makeElement(doc, 'div', { className: 'bb-minutes-screen bb-minutes-drawer-content' });
|
|
@@ -767,7 +782,7 @@ export function createMeetingMinutesUI({
|
|
|
767
782
|
}
|
|
768
783
|
|
|
769
784
|
function filterCombobox(label, options, value, onChange) {
|
|
770
|
-
return workspaceCombobox(doc, { label, options, value, className: 'bb-minutes-filter-combobox', onChange });
|
|
785
|
+
return workspaceCombobox(doc, { label, options, value, showCount: !searchBand, className: 'bb-minutes-filter-combobox', onChange });
|
|
771
786
|
}
|
|
772
787
|
|
|
773
788
|
const keyword = makeElement(doc, 'input', {
|
|
@@ -795,7 +810,7 @@ export function createMeetingMinutesUI({
|
|
|
795
810
|
if (compact) {
|
|
796
811
|
const filters = makeElement(doc, 'div', { className: 'bb-minutes-compact-filters' });
|
|
797
812
|
filters.append(hostSlot, filterField('期間', period, 'is-period'), participantField, statusField);
|
|
798
|
-
compactToolbar = workspaceCompactToolbar(doc, { root: toolbar, query: keyword, filters, sort: sortBox, reset });
|
|
813
|
+
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
814
|
} else toolbar.append(keywordField, hostSlot, filterField('期間', period, 'is-period'), participantField, statusField, sortField, reset);
|
|
800
815
|
const hostBoxes = new Map();
|
|
801
816
|
|
|
@@ -812,16 +827,18 @@ export function createMeetingMinutesUI({
|
|
|
812
827
|
}
|
|
813
828
|
|
|
814
829
|
function filtersActive() {
|
|
815
|
-
|
|
830
|
+
const local = searchBand ? Object.keys(EMPTY_FILTERS).some(key => key !== 'query' && Boolean(state.filters[key])) : clientFiltersActive();
|
|
831
|
+
return local || currentHostFilters().some(filter => filter.placement !== 'scope' && (filter.multiple ? filter.values?.length : text(filter.value)));
|
|
816
832
|
}
|
|
817
833
|
|
|
818
834
|
function clearFilters() {
|
|
819
|
-
state.filters = { ...EMPTY_FILTERS };
|
|
820
|
-
keyword.value =
|
|
835
|
+
state.filters = { ...EMPTY_FILTERS, ...(searchBand ? { query: state.filters.query } : {}) };
|
|
836
|
+
keyword.value = state.filters.query;
|
|
821
837
|
fromInput.value = '';
|
|
822
838
|
toInput.value = '';
|
|
823
839
|
for (const filter of currentHostFilters()) {
|
|
824
|
-
if (
|
|
840
|
+
if (searchBand && filter.placement === 'scope') continue;
|
|
841
|
+
if (typeof filter.onChange === 'function' && (filter.multiple ? filter.values?.length : text(filter.value))) filter.onChange(filter.multiple ? [] : '');
|
|
825
842
|
}
|
|
826
843
|
renderList();
|
|
827
844
|
}
|
|
@@ -839,7 +856,11 @@ export function createMeetingMinutesUI({
|
|
|
839
856
|
const box = workspaceCombobox(doc, {
|
|
840
857
|
label: text(filter.label, id),
|
|
841
858
|
options,
|
|
842
|
-
value,
|
|
859
|
+
value, multiple: filter.multiple === true, values: filter.values,
|
|
860
|
+
renderIcon: filter.renderIcon, showHints: filter.showHints !== false,
|
|
861
|
+
showCount: searchBand ? false : filter.showCount !== false,
|
|
862
|
+
align: filter.placement === 'scope' ? 'end' : 'start',
|
|
863
|
+
searchable: filter.placement === 'scope' ? false : 'auto',
|
|
843
864
|
placeholder: text(filter.placeholder, '選択してください'),
|
|
844
865
|
className: 'bb-minutes-filter-combobox',
|
|
845
866
|
onChange: (next) => {
|
|
@@ -850,15 +871,22 @@ export function createMeetingMinutesUI({
|
|
|
850
871
|
entry = { box, field: filterField(text(filter.label, id), box.root) };
|
|
851
872
|
hostBoxes.set(id, entry);
|
|
852
873
|
}
|
|
853
|
-
entry.box.update({ options, value, disabled: filter.disabled === true });
|
|
874
|
+
entry.box.update({ options, value, values: filter.values, disabled: filter.disabled === true });
|
|
854
875
|
}
|
|
855
876
|
for (const [id, entry] of hostBoxes) {
|
|
856
877
|
if (seen.has(id)) continue;
|
|
857
878
|
entry.box.destroy();
|
|
858
879
|
hostBoxes.delete(id);
|
|
859
880
|
}
|
|
860
|
-
|
|
861
|
-
|
|
881
|
+
const inlineHosts = hosts.filter(filter => !searchBand || filter.placement !== 'scope');
|
|
882
|
+
const scopeHosts = searchBand ? hosts.filter(filter => filter.placement === 'scope') : [];
|
|
883
|
+
const reconcile = (parent, children) => {
|
|
884
|
+
if (!parent) return;
|
|
885
|
+
if (children.length !== parent.children.length || children.some((child, index) => parent.children[index] !== child)) parent.replaceChildren(...children);
|
|
886
|
+
};
|
|
887
|
+
reconcile(hostSlot, inlineHosts.map(filter => hostBoxes.get(text(filter.id)).field));
|
|
888
|
+
reconcile(compactToolbar?.scopeSlot, scopeHosts.map(filter => hostBoxes.get(text(filter.id)).box.root));
|
|
889
|
+
hostSlot.hidden = inlineHosts.length === 0;
|
|
862
890
|
|
|
863
891
|
// Offer only the conditions the loaded records can answer (P9).
|
|
864
892
|
const participants = [...new Set(meetings.flatMap(participantsOf))]
|
|
@@ -876,6 +904,7 @@ export function createMeetingMinutesUI({
|
|
|
876
904
|
sortBox.update({ value: state.sort });
|
|
877
905
|
reset.hidden = !filtersActive();
|
|
878
906
|
compactToolbar?.setFiltered(filtersActive());
|
|
907
|
+
compactToolbar?.setSorted?.(state.sort !== SORTS[0].value);
|
|
879
908
|
}
|
|
880
909
|
|
|
881
910
|
function clock() {
|
|
@@ -919,7 +948,7 @@ export function createMeetingMinutesUI({
|
|
|
919
948
|
});
|
|
920
949
|
}
|
|
921
950
|
|
|
922
|
-
function clear(node) { node.replaceChildren(); return node; }
|
|
951
|
+
function clear(node) { if (node === detailPane) cleanupCreateProject(); node.replaceChildren(); return node; }
|
|
923
952
|
|
|
924
953
|
function canCreate() {
|
|
925
954
|
if (typeof canCreateMeeting === 'function') {
|
|
@@ -1426,7 +1455,7 @@ export function createMeetingMinutesUI({
|
|
|
1426
1455
|
const head = makeElement(doc, 'div', { className: 'bb-minutes-pane-head' });
|
|
1427
1456
|
const meetings = state.meetings.filter((entry) => isRecord(entry?.meeting) && typeof entry.meeting.meeting_id === 'string');
|
|
1428
1457
|
renderToolbar(meetings);
|
|
1429
|
-
const visible = sortMeetings(meetings.filter(
|
|
1458
|
+
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
1459
|
if (canCreate()) {
|
|
1431
1460
|
head.append(button(doc, '会議を作成', () => renderCreateForm(), { className: 'bb-minutes-button is-primary' }));
|
|
1432
1461
|
} else {
|
|
@@ -1777,6 +1806,7 @@ export function createMeetingMinutesUI({
|
|
|
1777
1806
|
}
|
|
1778
1807
|
|
|
1779
1808
|
function renderDetail(detail, documentRecord = null, selectedVersion = null) {
|
|
1809
|
+
detailDrawer?.setTitle?.('議事録の詳細');
|
|
1780
1810
|
clear(detailPane);
|
|
1781
1811
|
connectionsSlot = null;
|
|
1782
1812
|
participantsSlot = null;
|
|
@@ -1854,6 +1884,8 @@ export function createMeetingMinutesUI({
|
|
|
1854
1884
|
}
|
|
1855
1885
|
|
|
1856
1886
|
function renderCreateForm() {
|
|
1887
|
+
detailDrawer?.setTitle?.('会議を作成');
|
|
1888
|
+
detailRequestGeneration += 1;
|
|
1857
1889
|
detailDrawer?.open();
|
|
1858
1890
|
clear(detailPane);
|
|
1859
1891
|
if (!canCreate()) {
|
|
@@ -1861,7 +1893,16 @@ export function createMeetingMinutesUI({
|
|
|
1861
1893
|
return;
|
|
1862
1894
|
}
|
|
1863
1895
|
const form = makeElement(doc, 'form', { className: 'bb-minutes-create-form' });
|
|
1864
|
-
form.append(makeElement(doc, 'h2', { textContent: '会議を作成' })
|
|
1896
|
+
form.append(makeElement(doc, 'h2', { textContent: '会議を作成' }));
|
|
1897
|
+
const projectOptions = typeof createProjectOptions === 'function' ? createProjectOptions() : null;
|
|
1898
|
+
const initialProject = typeof createProjectValue === 'function' ? createProjectValue() : '';
|
|
1899
|
+
let projectCode = Array.isArray(projectOptions) && projectOptions.some(option => option.value === initialProject) ? initialProject : '';
|
|
1900
|
+
const projectError = makeElement(doc, 'p', { className: 'bb-minutes-warning', attrs: { role: 'alert' } }); projectError.hidden = true;
|
|
1901
|
+
if (Array.isArray(projectOptions)) {
|
|
1902
|
+
createProjectBox = workspaceCombobox(doc, { label: 'プロジェクト', options: [{ value: '', label: 'プロジェクトを選択' }, ...projectOptions], value: projectCode,
|
|
1903
|
+
showCount: false, searchable: true, onChange: value => { projectCode = value; projectError.hidden = true; } });
|
|
1904
|
+
form.append(filterField('プロジェクト', createProjectBox.root), projectError);
|
|
1905
|
+
}
|
|
1865
1906
|
const title = labelInput(doc, '会議名', { name: 'title', placeholder: '例: 週次定例' });
|
|
1866
1907
|
const date = labelInput(doc, '日時(任意)', { type: 'datetime-local', name: 'scheduled_at' });
|
|
1867
1908
|
const participants = labelInput(doc, '参加者(任意・カンマ区切り)', { name: 'participant_ids' });
|
|
@@ -1869,6 +1910,7 @@ export function createMeetingMinutesUI({
|
|
|
1869
1910
|
const body = labelInput(doc, '本文(任意)', { type: 'textarea', name: 'initial_body', placeholder: '会議の本文を入力' });
|
|
1870
1911
|
body.input.rows = 8;
|
|
1871
1912
|
const save = makeElement(doc, 'button', { className: 'bb-minutes-button is-primary', textContent: '会議を保存', type: 'submit' });
|
|
1913
|
+
title.input.required = true;
|
|
1872
1914
|
form.append(title.wrapper, date.wrapper, participants.wrapper, minutesTitle.wrapper, body.wrapper, save);
|
|
1873
1915
|
form.addEventListener('submit', async (event) => {
|
|
1874
1916
|
event.preventDefault();
|
|
@@ -1878,6 +1920,10 @@ export function createMeetingMinutesUI({
|
|
|
1878
1920
|
renderCreateUnavailable();
|
|
1879
1921
|
return;
|
|
1880
1922
|
}
|
|
1923
|
+
if (Array.isArray(projectOptions) && !projectOptions.some(option => option.value === projectCode)) {
|
|
1924
|
+
projectError.textContent = 'プロジェクトを選択してください。'; projectError.hidden = false;
|
|
1925
|
+
createProjectBox?.trigger.focus({ preventScroll: true }); return;
|
|
1926
|
+
}
|
|
1881
1927
|
save.disabled = true;
|
|
1882
1928
|
try {
|
|
1883
1929
|
const scheduledAt = date.input.value ? new Date(date.input.value).toISOString() : undefined;
|
|
@@ -1888,11 +1934,14 @@ export function createMeetingMinutesUI({
|
|
|
1888
1934
|
minutes_title: minutesTitle.input.value,
|
|
1889
1935
|
initial_body: body.input.value,
|
|
1890
1936
|
};
|
|
1891
|
-
const created = await mutate('', payload);
|
|
1937
|
+
const created = typeof createMeeting === 'function' && Array.isArray(projectOptions) ? await createMeeting(payload, projectCode) : await mutate('', payload);
|
|
1892
1938
|
const id = created?.meeting?.meeting_id;
|
|
1893
1939
|
setStatus('会議を保存しました。', 'success');
|
|
1894
1940
|
await loadMeetings();
|
|
1895
|
-
if (typeof id === 'string')
|
|
1941
|
+
if (typeof id === 'string') {
|
|
1942
|
+
if (typeof shouldOpenCreatedMeeting !== 'function' || shouldOpenCreatedMeeting(created, projectCode) !== false) await loadDetail(id);
|
|
1943
|
+
else { detailDrawer?.close(); renderDetail(null); if (!state.listError) setStatus('会議を保存しました。', 'success'); }
|
|
1944
|
+
}
|
|
1896
1945
|
} catch (error) {
|
|
1897
1946
|
save.disabled = false;
|
|
1898
1947
|
setStatus(error instanceof Error ? error.message : '会議を保存できませんでした。', 'error');
|
|
@@ -1901,11 +1950,11 @@ export function createMeetingMinutesUI({
|
|
|
1901
1950
|
detailPane.append(form);
|
|
1902
1951
|
}
|
|
1903
1952
|
|
|
1904
|
-
async function loadMeetings({ restoreFocus = false } = {}) {
|
|
1953
|
+
async function loadMeetings({ restoreFocus = false, quiet = false } = {}) {
|
|
1905
1954
|
const requestGeneration = ++listRequestGeneration;
|
|
1906
1955
|
const isCurrentRequest = () => !disposed && requestGeneration === listRequestGeneration;
|
|
1907
1956
|
state.loading = true;
|
|
1908
|
-
setStatus('会議一覧を読み込んでいます。');
|
|
1957
|
+
if (!quiet) setStatus('会議一覧を読み込んでいます。');
|
|
1909
1958
|
try {
|
|
1910
1959
|
const payload = await call('');
|
|
1911
1960
|
if (!isCurrentRequest()) return state.meetings;
|
|
@@ -1957,6 +2006,7 @@ export function createMeetingMinutesUI({
|
|
|
1957
2006
|
|
|
1958
2007
|
async function loadDetail(meetingId) {
|
|
1959
2008
|
if (disposed) return null;
|
|
2009
|
+
cleanupCreateProject();
|
|
1960
2010
|
detailDrawer?.open();
|
|
1961
2011
|
const requestGeneration = ++detailRequestGeneration;
|
|
1962
2012
|
const isCurrentRequest = () => !disposed && requestGeneration === detailRequestGeneration
|
|
@@ -2003,6 +2053,7 @@ export function createMeetingMinutesUI({
|
|
|
2003
2053
|
openMeeting: loadDetail,
|
|
2004
2054
|
destroy() {
|
|
2005
2055
|
disposed = true; listRequestGeneration += 1; detailRequestGeneration += 1;
|
|
2056
|
+
cleanupCreateProject();
|
|
2006
2057
|
detailDrawer?.dispose();
|
|
2007
2058
|
compactToolbar?.destroy();
|
|
2008
2059
|
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:has(.bb-ws-dropdown-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)) {
|
|
@@ -76,7 +83,7 @@ export function workspaceTopbar(doc, { title = '' } = {}) {
|
|
|
76
83
|
/** A reusable right inspector whose content can refresh without replacing the modal. */
|
|
77
84
|
export function workspaceDetailDrawer(doc, { title = '詳細', opener, onClose } = {}) {
|
|
78
85
|
const dialog = workspaceApplyDrawer(el(doc, 'dialog', { className: 'bb-ws-dialog bb-ws-detail-drawer' }));
|
|
79
|
-
const titleId = `bb-ws-inspector-${
|
|
86
|
+
const titleId = `bb-ws-inspector-${nextWorkspaceSequence()}`;
|
|
80
87
|
dialog.setAttribute('aria-labelledby', titleId);
|
|
81
88
|
const head = el(doc, 'header', { className: 'bb-ws-detail-closebar' });
|
|
82
89
|
const label = el(doc, 'h2', { className: 'bb-ws-visually-hidden', text: title, attrs: { id: titleId } });
|
|
@@ -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;
|
|
@@ -288,12 +296,18 @@ export function workspaceSectionTitle(doc, { title, lead } = {}) {
|
|
|
288
296
|
|
|
289
297
|
|
|
290
298
|
let workspaceSequence = 0;
|
|
299
|
+
// Capability-isolated modules coexist with an older kit in the same document.
|
|
300
|
+
const workspaceIdScope = new URL(import.meta.url).searchParams.get('capability') ?? '';
|
|
301
|
+
function nextWorkspaceSequence() {
|
|
302
|
+
const next = ++workspaceSequence;
|
|
303
|
+
return workspaceIdScope ? `${encodeURIComponent(workspaceIdScope)}-${next}` : next;
|
|
304
|
+
}
|
|
291
305
|
/** Shared explanatory help: hover/focus above the control, click for touch. */
|
|
292
306
|
export function workspaceHelp(doc, { text, label } = {}) {
|
|
293
307
|
const wrap = el(doc, 'span', { className: 'bb-ws-help' });
|
|
294
308
|
const control = workspaceButton(doc, { text: 'i', attrs: { 'aria-label': `${label}の説明`, 'aria-expanded': 'false' } });
|
|
295
309
|
control.className = 'bb-ws-help-button';
|
|
296
|
-
const bubble = el(doc, 'span', { className: 'bb-ws-help-bubble', text, attrs: { id: `bb-ws-help-${
|
|
310
|
+
const bubble = el(doc, 'span', { className: 'bb-ws-help-bubble', text, attrs: { id: `bb-ws-help-${nextWorkspaceSequence()}`, role: 'tooltip' } });
|
|
297
311
|
control.setAttribute('aria-describedby', bubble.id || bubble.getAttribute?.('id') || bubble.attributes?.id);
|
|
298
312
|
control.addEventListener('click', event => {
|
|
299
313
|
event.stopPropagation(); event.preventDefault();
|
|
@@ -352,7 +366,7 @@ export function workspaceCloseDrawer(dialog, finish) {
|
|
|
352
366
|
export function workspaceDialog(doc, { title, content, opener, presentation = 'center', onClose } = {}) {
|
|
353
367
|
const dialog = el(doc, 'dialog', { className: 'bb-ws-dialog' });
|
|
354
368
|
if (presentation === 'drawer') workspaceApplyDrawer(dialog);
|
|
355
|
-
const headingId = `bb-ws-dialog-${
|
|
369
|
+
const headingId = `bb-ws-dialog-${nextWorkspaceSequence()}`;
|
|
356
370
|
dialog.setAttribute('aria-labelledby', headingId);
|
|
357
371
|
const head = el(doc, 'header', { className: 'bb-ws-dialog-head' });
|
|
358
372
|
const nativeClose = dialog.close.bind(dialog);
|
|
@@ -396,8 +410,8 @@ export function workspaceDialog(doc, { title, content, opener, presentation = 'c
|
|
|
396
410
|
/** Anchored advanced search. Hosts destroy it before replacing its controls. */
|
|
397
411
|
export function workspaceFilterPopover(doc, { content, open = false, onToggle, trigger, panel: suppliedPanel, initialFocus } = {}) {
|
|
398
412
|
const root = el(doc, 'span', { className: 'bb-ws-filter-anchor' });
|
|
399
|
-
const panel = suppliedPanel || el(doc, 'div', { className: 'bb-ws-filter-popover', attrs: { id: `bb-ws-filter-${
|
|
400
|
-
if (!panel.id && !panel.getAttribute?.('id')) panel.setAttribute('id', `bb-ws-filter-${
|
|
413
|
+
const panel = suppliedPanel || el(doc, 'div', { className: 'bb-ws-filter-popover', attrs: { id: `bb-ws-filter-${nextWorkspaceSequence()}`, role: 'region', 'aria-label': '詳細検索' } });
|
|
414
|
+
if (!panel.id && !panel.getAttribute?.('id')) panel.setAttribute('id', `bb-ws-filter-${nextWorkspaceSequence()}`);
|
|
401
415
|
panel.classList?.add('bb-ws-filter-popover');
|
|
402
416
|
const control = trigger || workspaceButton(doc, { text: '詳細検索', variant: 'quiet' });
|
|
403
417
|
control.setAttribute('aria-controls', panel.id || panel.getAttribute?.('id') || panel.attributes?.id);
|
|
@@ -505,13 +519,16 @@ function comboboxText(value) {
|
|
|
505
519
|
export function workspaceCombobox(doc, {
|
|
506
520
|
label, options = [], value = '', placeholder = '選択してください', searchLabel, searchPlaceholder = '絞り込む',
|
|
507
521
|
emptyText = '一致する候補はありません', limit = 100, searchable = 'auto', className, onChange,
|
|
522
|
+
multiple = false, values = [], renderIcon, showCount = true, showHints = true, align = 'start',
|
|
508
523
|
} = {}) {
|
|
509
|
-
const sequence =
|
|
524
|
+
const sequence = nextWorkspaceSequence();
|
|
510
525
|
const listId = `bb-ws-combobox-${sequence}-list`;
|
|
511
526
|
const root = el(doc, 'span', { className: ['bb-ws-combobox', className].filter(Boolean).join(' ') });
|
|
527
|
+
if (multiple) root.classList?.add('bb-ws-combobox-multiple');
|
|
528
|
+
if (align === 'end') root.classList?.add('bb-ws-combobox-align-end');
|
|
512
529
|
const trigger = el(doc, 'button', { className: 'bb-ws-combobox-trigger', attrs: { type: 'button', 'aria-haspopup': 'listbox', 'aria-expanded': 'false', 'aria-controls': listId } });
|
|
513
530
|
const triggerText = el(doc, 'span', { className: 'bb-ws-combobox-value' });
|
|
514
|
-
trigger.append(triggerText,
|
|
531
|
+
trigger.append(triggerText, workspaceDropdownChevron(doc));
|
|
515
532
|
const popup = el(doc, 'div', { className: 'bb-ws-combobox-popup' });
|
|
516
533
|
popup.hidden = true;
|
|
517
534
|
const search = el(doc, 'input', { className: 'bb-ws-combobox-search', attrs: {
|
|
@@ -519,29 +536,35 @@ export function workspaceCombobox(doc, {
|
|
|
519
536
|
'aria-label': searchLabel || `${label || '候補'}を絞り込む`, placeholder: searchPlaceholder, autocomplete: 'off', spellcheck: 'false',
|
|
520
537
|
} });
|
|
521
538
|
const list = el(doc, 'ul', { className: 'bb-ws-combobox-list', attrs: { id: listId, role: 'listbox', 'aria-label': label || '候補', tabindex: '-1' } });
|
|
539
|
+
if (multiple) list.setAttribute('aria-multiselectable', 'true');
|
|
522
540
|
const status = el(doc, 'p', { className: 'bb-ws-combobox-status', attrs: { role: 'status', 'aria-live': 'polite' } });
|
|
523
541
|
popup.append(search, list, status);
|
|
524
542
|
root.append(trigger, popup);
|
|
525
543
|
|
|
526
|
-
const state = { options: [], value: String(value ?? ''), query: '', active: -1, shown: [], open: false, disabled: false };
|
|
544
|
+
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
545
|
const usesSearch = () => searchable === true || (searchable === 'auto' && state.options.length > 8);
|
|
528
546
|
const focusTarget = () => (usesSearch() ? search : list);
|
|
529
547
|
const chosen = () => state.options.find(option => option.value === state.value);
|
|
530
548
|
|
|
531
549
|
function setOptions(next) {
|
|
532
550
|
state.options = (Array.isArray(next) ? next : []).map(option => ({
|
|
533
|
-
value: String(option?.value ?? ''), label: String(option?.label ?? option?.value ?? ''),
|
|
551
|
+
...option, value: String(option?.value ?? ''), label: String(option?.label ?? option?.value ?? ''),
|
|
534
552
|
hint: option?.hint ? String(option.hint) : '', keywords: option?.keywords ? String(option.keywords) : '',
|
|
535
553
|
}));
|
|
536
554
|
}
|
|
537
555
|
|
|
538
556
|
function renderTrigger() {
|
|
539
|
-
const option = chosen();
|
|
540
|
-
|
|
541
|
-
const text = option ? option.label : state.value || placeholder;
|
|
557
|
+
const option = multiple ? (state.values.length === 1 ? state.options.find(option => option.value === state.values[0]) : state.options.find(option => !option.value)) : chosen();
|
|
558
|
+
const summary = multiple && state.values.length > 1 ? `${state.values.length}件選択中` : null;
|
|
559
|
+
const text = summary || (option ? option.label : multiple ? state.values.join('、') || placeholder : state.value || placeholder);
|
|
542
560
|
triggerText.textContent = text;
|
|
561
|
+
if (!summary && option && typeof renderIcon === 'function') {
|
|
562
|
+
const icon = renderIcon(option);
|
|
563
|
+
if (icon) { triggerText.textContent = ''; triggerText.append(icon, el(doc, 'span', { className: 'bb-ws-combobox-text', text })); }
|
|
564
|
+
}
|
|
565
|
+
toggleWorkspaceClass(root, 'is-multi-selected', Boolean(summary));
|
|
543
566
|
trigger.setAttribute('aria-label', `${label ? `${label}: ` : ''}${text}`);
|
|
544
|
-
trigger.setAttribute('data-empty', String(!option && !state.value));
|
|
567
|
+
trigger.setAttribute('data-empty', String(multiple ? !state.values.length : !option && !state.value));
|
|
545
568
|
if (state.disabled) trigger.setAttribute('disabled', ''); else trigger.removeAttribute('disabled');
|
|
546
569
|
}
|
|
547
570
|
|
|
@@ -552,7 +575,8 @@ export function workspaceCombobox(doc, {
|
|
|
552
575
|
}
|
|
553
576
|
}
|
|
554
577
|
|
|
555
|
-
function renderList() {
|
|
578
|
+
function renderList({ reveal = false } = {}) {
|
|
579
|
+
const scrollTop = list.scrollTop;
|
|
556
580
|
const terms = comboboxText(state.query).split(/\s+/u).filter(Boolean);
|
|
557
581
|
const matches = terms.length
|
|
558
582
|
? state.options.filter(option => { const text = comboboxText(`${option.label}\n${option.hint}\n${option.keywords}`); return terms.every(term => text.includes(term)); })
|
|
@@ -562,25 +586,37 @@ export function workspaceCombobox(doc, {
|
|
|
562
586
|
if (state.active >= state.shown.length) state.active = state.shown.length - 1;
|
|
563
587
|
list.replaceChildren();
|
|
564
588
|
state.shown.forEach((option, index) => {
|
|
565
|
-
const selected = option.value === state.value;
|
|
589
|
+
const selected = multiple ? option.value ? state.values.includes(option.value) : state.values.length === 0 : option.value === state.value;
|
|
566
590
|
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
|
|
591
|
+
const optionLabel = el(doc, 'span', { className: 'bb-ws-combobox-option-label', text: option.label });
|
|
592
|
+
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 })); } }
|
|
593
|
+
item.append(optionLabel);
|
|
594
|
+
if (showHints && option.hint) item.append(el(doc, 'span', { className: 'bb-ws-combobox-option-hint', text: option.hint }));
|
|
569
595
|
item.addEventListener('pointerdown', event => event.preventDefault?.());
|
|
570
596
|
item.addEventListener('click', () => choose(option));
|
|
571
597
|
list.append(item);
|
|
572
598
|
});
|
|
573
599
|
const active = list.children?.[state.active];
|
|
574
600
|
activeDescendant(active);
|
|
575
|
-
|
|
601
|
+
if (scrollTop !== undefined) list.scrollTop = scrollTop;
|
|
602
|
+
if (reveal) {
|
|
603
|
+
const activeRect = active?.getBoundingClientRect?.(), listRect = list.getBoundingClientRect?.();
|
|
604
|
+
const top = activeRect && listRect ? activeRect.top - listRect.top + list.scrollTop : active?.offsetTop;
|
|
605
|
+
const height = activeRect?.height ?? active?.offsetHeight;
|
|
606
|
+
if (Number.isFinite(top) && Number.isFinite(height)) {
|
|
607
|
+
if (top < list.scrollTop) list.scrollTop = top;
|
|
608
|
+
else if (top + height > list.scrollTop + list.clientHeight) list.scrollTop = top + height - list.clientHeight;
|
|
609
|
+
}
|
|
610
|
+
}
|
|
576
611
|
const rest = matches.length - state.shown.length;
|
|
612
|
+
status.hidden = !showCount && matches.length > 0 && rest === 0;
|
|
577
613
|
status.textContent = !matches.length ? emptyText : rest > 0 ? `${matches.length}件中${state.shown.length}件を表示。ほか${rest}件は絞り込むと出ます` : `${matches.length}件`;
|
|
578
614
|
}
|
|
579
615
|
|
|
580
616
|
function move(index) {
|
|
581
617
|
if (!state.shown.length) return;
|
|
582
618
|
state.active = Math.min(state.shown.length - 1, Math.max(0, index));
|
|
583
|
-
renderList();
|
|
619
|
+
renderList({ reveal: true });
|
|
584
620
|
}
|
|
585
621
|
|
|
586
622
|
function removeListeners() { doc.removeEventListener?.('pointerdown', outside); }
|
|
@@ -590,11 +626,11 @@ export function workspaceCombobox(doc, {
|
|
|
590
626
|
if (state.disabled) return;
|
|
591
627
|
if (!state.open) { state.open = true; doc.addEventListener?.('pointerdown', outside); }
|
|
592
628
|
state.query = query; search.value = query; search.hidden = !usesSearch();
|
|
593
|
-
const selectedIndex = state.options.findIndex(option => option.value === state.value);
|
|
629
|
+
const selectedIndex = state.options.findIndex(option => multiple ? state.values.includes(option.value) : option.value === state.value);
|
|
594
630
|
state.active = query ? 0 : Math.max(0, selectedIndex);
|
|
595
631
|
popup.hidden = false; trigger.setAttribute('aria-expanded', 'true');
|
|
596
|
-
renderList();
|
|
597
|
-
focusTarget().focus?.();
|
|
632
|
+
renderList({ reveal: true });
|
|
633
|
+
focusTarget().focus?.({ preventScroll: true });
|
|
598
634
|
}
|
|
599
635
|
|
|
600
636
|
function close(returnFocus = true) {
|
|
@@ -605,6 +641,11 @@ export function workspaceCombobox(doc, {
|
|
|
605
641
|
}
|
|
606
642
|
|
|
607
643
|
function choose(option) {
|
|
644
|
+
if (multiple) {
|
|
645
|
+
state.active = state.shown.findIndex(candidate => candidate.value === option.value);
|
|
646
|
+
state.values = !option.value ? [] : state.values.includes(option.value) ? state.values.filter(value => value !== option.value) : [...state.values, option.value];
|
|
647
|
+
renderTrigger(); renderList(); onChange?.([...state.values], option); return;
|
|
648
|
+
}
|
|
608
649
|
const changed = option.value !== state.value;
|
|
609
650
|
state.value = option.value; renderTrigger(); close(true);
|
|
610
651
|
if (changed) onChange?.(option.value, option);
|
|
@@ -621,6 +662,7 @@ export function workspaceCombobox(doc, {
|
|
|
621
662
|
// Home and End move the caret while a search box is shown.
|
|
622
663
|
if (!usesSearch()) Object.assign(keys, { Home: () => move(0), End: () => move(state.shown.length - 1) });
|
|
623
664
|
if (event.key === 'Tab') { close(false); return; }
|
|
665
|
+
if (multiple && event.key === ' ' && !usesSearch()) keys[' '] = keys.Enter;
|
|
624
666
|
const action = keys[event.key];
|
|
625
667
|
if (!action) return;
|
|
626
668
|
event.preventDefault?.(); event.stopPropagation?.();
|
|
@@ -641,12 +683,16 @@ export function workspaceCombobox(doc, {
|
|
|
641
683
|
return {
|
|
642
684
|
root, trigger, popup, search, list,
|
|
643
685
|
get value() { return state.value; },
|
|
686
|
+
get values() { return [...state.values]; },
|
|
644
687
|
get isOpen() { return state.open; },
|
|
645
688
|
open, close,
|
|
646
|
-
update({ options: nextOptions, value: nextValue, disabled } = {}) {
|
|
689
|
+
update({ options: nextOptions, value: nextValue, values: nextValues, disabled } = {}) {
|
|
690
|
+
const previous = JSON.stringify([state.options, state.value, state.values, state.disabled]);
|
|
647
691
|
if (nextOptions !== undefined) setOptions(nextOptions);
|
|
648
692
|
if (nextValue !== undefined) state.value = String(nextValue ?? '');
|
|
693
|
+
if (nextValues !== undefined) state.values = [...new Set((Array.isArray(nextValues) ? nextValues : []).map(String))].filter(Boolean);
|
|
649
694
|
if (disabled !== undefined) { state.disabled = Boolean(disabled); if (state.disabled) close(false); }
|
|
695
|
+
if (previous === JSON.stringify([state.options, state.value, state.values, state.disabled])) return;
|
|
650
696
|
renderTrigger();
|
|
651
697
|
if (state.open) { search.hidden = !usesSearch(); renderList(); }
|
|
652
698
|
},
|
|
@@ -718,3 +764,48 @@ export function workspaceTabList(root) {
|
|
|
718
764
|
root.className = classes.join(' ');
|
|
719
765
|
return root;
|
|
720
766
|
}
|
|
767
|
+
|
|
768
|
+
/** The shared shallow dropdown chevron, sized and colored through shared CSS. */
|
|
769
|
+
export function workspaceDropdownChevron(doc) {
|
|
770
|
+
const wrap = el(doc, 'span', { className: 'bb-ws-combobox-chevron', attrs: { 'aria-hidden': 'true' } });
|
|
771
|
+
const create = tag => typeof doc.createElementNS === 'function' ? doc.createElementNS('http://www.w3.org/2000/svg', tag) : doc.createElement(tag);
|
|
772
|
+
const svg = create('svg'); svg.setAttribute('viewBox', '0 0 12 8'); svg.setAttribute('width', '10'); svg.setAttribute('height', '6'); svg.setAttribute('class', 'bb-ws-dropdown-chevron');
|
|
773
|
+
const path = create('path'); path.setAttribute('d', 'M1 2.5l5 3 5-3'); svg.append(path); wrap.append(svg); return wrap;
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
/** Opt-in shared search band. The host retains scope options and query handlers. */
|
|
777
|
+
export function workspaceSearchBand(doc, { root, query, filters, sort, reset, onResetSort } = {}) {
|
|
778
|
+
root ||= el(doc, 'div'); root.classList.add('bb-ws-search-band');
|
|
779
|
+
const primary = el(doc, 'div', { className: 'bb-ws-toolbar-primary' });
|
|
780
|
+
const controls = el(doc, 'div', { className: 'bb-ws-toolbar-controls' });
|
|
781
|
+
const search = el(doc, 'span', { className: 'bb-ws-toolbar-query' }); search.append(workspaceActionIcon(doc, 'search'), query);
|
|
782
|
+
const scopeSlot = el(doc, 'span', { className: 'bb-ws-toolbar-scope' });
|
|
783
|
+
const trigger = workspaceButton(doc, { variant: 'quiet', attrs: { 'aria-label': 'フィルター', title: 'フィルター' } });
|
|
784
|
+
trigger.classList.add('bb-ws-toolbar-filter'); trigger.append(workspaceActionIcon(doc, 'filter'));
|
|
785
|
+
const filter = workspaceFilterPopover(doc, { content: filters, trigger,
|
|
786
|
+
onToggle: open => { if (open) sort?.close(false); },
|
|
787
|
+
});
|
|
788
|
+
filter.root.classList.add('bb-ws-toolbar-filter-group'); filter.panel.classList.add('bb-ws-toolbar-filter-panel');
|
|
789
|
+
if (reset) {
|
|
790
|
+
reset.textContent = 'フィルターを解除'; reset.setAttribute('aria-label', 'フィルターを解除');
|
|
791
|
+
const footer = el(doc, 'div', { className: 'bb-ws-menu-reset' }); footer.append(reset); filters.append(footer);
|
|
792
|
+
}
|
|
793
|
+
const closeFilter = () => { if (!filter.panel.hidden) trigger.click(); };
|
|
794
|
+
const clear = () => { closeFilter(); trigger.focus({ preventScroll: true }); };
|
|
795
|
+
const sortClick = () => closeFilter();
|
|
796
|
+
const sortReset = workspaceButton(doc, { text: '初期順に戻す', attrs: { 'aria-label': '並べ替えを初期順に戻す' } });
|
|
797
|
+
const resetSort = () => { sort?.close(false); onResetSort?.(); sort?.trigger.focus({ preventScroll: true }); };
|
|
798
|
+
if (sort) {
|
|
799
|
+
sort.root.classList.add('bb-ws-toolbar-sort'); sort.trigger.classList.add('bb-ws-toolbar-sort-trigger');
|
|
800
|
+
sort.trigger.replaceChildren(workspaceActionIcon(doc, 'sort')); sort.trigger.setAttribute('title', '並べ替え');
|
|
801
|
+
sort.popup.append(sortReset); sortReset.addEventListener('click', resetSort);
|
|
802
|
+
sort.trigger.addEventListener('click', sortClick); sort.trigger.addEventListener('keydown', sortClick);
|
|
803
|
+
}
|
|
804
|
+
controls.append(search, scopeSlot, filter.root); if (sort) controls.append(sort.root); root.replaceChildren(primary, controls);
|
|
805
|
+
reset?.addEventListener('click', clear);
|
|
806
|
+
return { root, primary, scopeSlot, filter,
|
|
807
|
+
setFiltered(active) { toggleWorkspaceClass(filter.root, 'is-filtered', Boolean(active)); trigger.setAttribute('aria-label', active ? 'フィルター(適用中)' : 'フィルター'); },
|
|
808
|
+
setSorted(active) { toggleWorkspaceClass(sort?.root, 'is-sorted', Boolean(active)); sortReset.hidden = !active; },
|
|
809
|
+
destroy() { filter.destroy(); reset?.removeEventListener('click', clear); sortReset.removeEventListener('click', resetSort); sort?.trigger.removeEventListener('click', sortClick); sort?.trigger.removeEventListener('keydown', sortClick); },
|
|
810
|
+
};
|
|
811
|
+
}
|