@unson/brainbase-mcp 0.50.14 → 0.50.18

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.
@@ -164,9 +164,16 @@ export interface WithdrawMinutesInput {
164
164
  readonly idempotency_key?: string;
165
165
  readonly idempotency_fingerprint?: string;
166
166
  }
167
+ export interface MeetingMinutesCurrentVersionState {
168
+ readonly minutes_id: MinutesId;
169
+ readonly version_id: MinutesVersionId;
170
+ readonly status: 'pending' | 'confirmed' | 'unknown';
171
+ }
167
172
  export interface MeetingMinutesSummary {
168
173
  readonly meeting: MeetingRecord;
169
174
  readonly minutes: readonly MinutesDocumentRecord[];
175
+ /** Listing-only projection; detail callers may omit it. Contains no version content. */
176
+ readonly current_version_states?: readonly MeetingMinutesCurrentVersionState[];
170
177
  }
171
178
  export interface MeetingMinutesDetail extends MeetingMinutesSummary {
172
179
  readonly versions: readonly MinutesVersionRecord[];
@@ -617,10 +617,17 @@ function detail(snapshot, meeting) {
617
617
  }
618
618
  function summary(snapshot, meeting) {
619
619
  // A withdrawn document is taken back from listings; its detail stays readable for history.
620
- return freezeClone({
621
- meeting,
622
- minutes: snapshot.documents.filter((candidate) => candidate.meeting_id === meeting.meeting_id && !candidate.withdrawal)
620
+ const minutes = snapshot.documents.filter((candidate) => candidate.meeting_id === meeting.meeting_id && !candidate.withdrawal);
621
+ const current_version_states = minutes.map((document) => {
622
+ const version = snapshot.versions.find((candidate) => candidate.version_id === document.current_version_id
623
+ && candidate.minutes_id === document.minutes_id && candidate.meeting_id === meeting.meeting_id);
624
+ return {
625
+ minutes_id: document.minutes_id,
626
+ version_id: document.current_version_id,
627
+ status: version ? (version.confirmation ? 'confirmed' : 'pending') : 'unknown',
628
+ };
623
629
  });
630
+ return freezeClone({ meeting, minutes, current_version_states });
624
631
  }
625
632
  function assertNotWithdrawn(document) {
626
633
  if (document.withdrawal)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unson/brainbase-mcp",
3
- "version": "0.50.14",
3
+ "version": "0.50.18",
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",
@@ -649,5 +649,5 @@
649
649
  "url": "https://github.com/Unson-LLC/brainbase/issues"
650
650
  },
651
651
  "homepage": "https://github.com/Unson-LLC/brainbase#readme",
652
- "gitHead": "49bda933b45de7a7ae8b3fdd1bf254d77e32b284"
652
+ "gitHead": "c7217bea64aaf3562280a8ec55ce6e6ca590b4a9"
653
653
  }
@@ -201,6 +201,7 @@
201
201
  --bb-row-move-ease: cubic-bezier(.2,.8,.2,1);
202
202
  --bb-shadow-compact-dropdown: 0 0 0 1px rgb(27 36 51 / .08), 0 12px 28px rgb(27 36 51 / .18);
203
203
  --bb-shadow-control-panel: 0 0 0 1px rgb(27 36 51 / .08), 0 20px 44px -12px rgb(27 36 51 / .28);
204
+ --bb-shadow-compact-dialog: 0 0 0 1px rgb(27 36 51 / .08), 0 24px 60px -12px rgb(27 36 51 / .32);
204
205
  --bb-input-frame-width: 600px;
205
206
  --bb-control-panel-width: 372px;
206
207
  --bb-control-panel-duration: 160ms;
@@ -0,0 +1,149 @@
1
+ /* The table presentation is opt-in. Existing meeting screens retain their layout. */
2
+ .bb-minutes-screen.bb-minutes-table {
3
+ --bb-card-columns: 92px 48px minmax(0,1fr) 104px 200px 170px 96px;
4
+ display:flex; flex-direction:column; gap:0; height:auto; min-height:100%; overflow:visible;
5
+ font:13px/1.6 var(--bb-font-sans); background:var(--bb-color-canvas);
6
+ }
7
+ .bb-minutes-table > .bb-minutes-heading { display:none; }
8
+ .bb-minutes-table > .bb-minutes-columns { display:flex; flex-direction:column; gap:0; min-height:0; padding:14px 24px 24px; overflow:visible; }
9
+ .bb-minutes-table .bb-minutes-list-pane { display:block; border:0; border-radius:0; padding:0; background:none; overflow:visible; }
10
+ .bb-minutes-table > .bb-minutes-status { margin:8px 24px; }
11
+ .bb-minutes-table > .bb-minutes-status[hidden] { display:none; }
12
+ .mp-meaning { color:var(--bb-color-muted); font-size:12.5px; display:flex; align-items:flex-start; gap:16px; margin:0 0 16px; min-height:24px; }
13
+ .mp-chips { min-width:0; }
14
+ .mp-summary { display:flex; align-items:center; flex:none; gap:14px; margin-left:auto; height:24px; color:var(--bb-color-slate); font-size:12px; white-space:nowrap; }
15
+ .mp-summary > button,.mp-nodate { display:inline-grid; place-items:center; height:24px; padding:0 10px; border:0; border-radius:999px; background:var(--bb-color-warning-soft); color:var(--bb-color-warning); font:600 12px var(--bb-font-sans); }
16
+ .mp-summary > button:hover { background:var(--bb-color-warning-soft); box-shadow:var(--bb-shadow-card-preview); }
17
+ .mp-table-head { display:grid; grid-template-columns:var(--bb-card-columns); column-gap:20px; align-items:center; height:34px; padding:0 16px 0 22px; margin-bottom:8px; border-bottom:2px solid var(--bb-color-action); color:var(--bb-color-action); font-size:12px; font-weight:600; }
18
+ .mp-table-head > :nth-child(4) { text-align:center; }
19
+ .mp-date { display:inline-grid; grid-template-columns:40px 18px; column-gap:6px; align-items:center; font-size:13px; white-space:nowrap; font-variant-numeric:tabular-nums; }
20
+ .mp-date b { text-align:right; font-weight:400; }
21
+ .mp-date i { color:var(--bb-color-muted); font-size:12px; font-style:normal; }
22
+ .mp-date.is-today b,.mp-date.is-today i { color:var(--bb-color-action); font-weight:700; }
23
+ .mp-nodate { width:64px; height:22px; padding:0; font-size:11.5px; }
24
+ .mp-time { font-size:13px; color:var(--bb-color-slate); font-variant-numeric:tabular-nums; }
25
+ .mp-title { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:14px; font-weight:600; }
26
+ .mp-row > :nth-child(4) { justify-self:center; }
27
+ .mp-confirm { display:inline-grid; place-items:center; width:68px; height:22px; border-radius:999px; font-size:11.5px; font-weight:500; white-space:nowrap; }
28
+ .mp-confirm.is-pending { background:var(--bb-color-warning-soft); color:var(--bb-color-warning); font-weight:600; }
29
+ .mp-confirm.is-confirmed { background:var(--bb-color-accent-soft); color:var(--bb-color-success); }
30
+ .mp-unknown { color:var(--bb-color-muted); font-size:12px; }
31
+ .mp-project { display:flex; gap:8px; align-items:center; min-width:0; }
32
+ .mp-project > :last-child { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
33
+ .mp-project-initial { display:grid; place-items:center; width:20px; height:20px; flex:none; border-radius:4px; background:var(--bb-color-accent-soft); color:var(--bb-color-action); }
34
+ .mp-people { display:flex; align-items:center; min-width:0; }
35
+ .mp-avatar { display:inline-grid; place-items:center; width:22px; height:22px; border-radius:50%; background:var(--bb-inbox-context-surface); color:var(--bb-color-slate); font-size:10px; font-weight:600; margin-right:-5px; box-shadow:0 0 0 2px var(--bb-color-paper); }
36
+ .mp-people small { margin-left:10px; color:var(--bb-color-muted); font-size:11.5px; white-space:nowrap; }
37
+ .mp-people small:first-child { margin-left:0; }
38
+ .mp-note { color:var(--bb-color-slate); font-size:12.5px; white-space:nowrap; }
39
+ .mp-count { margin:16px 0 0; color:var(--bb-color-muted); font-size:12px; }
40
+ .mp-panel-group { padding:12px 16px 4px; color:var(--bb-color-muted); font-size:11.5px; font-weight:500; }
41
+ .mp-panel-foot { padding:10px 16px 6px; text-align:center; box-shadow:inset 0 1px 0 var(--bb-color-line-soft); }
42
+ .mp-panel-foot > button { color:var(--bb-color-action); background:none; border:0; font-size:12.5px; }
43
+ .mp-period-trigger { height:30px; min-height:0; padding:0 8px; border:0; border-radius:var(--bb-radius-sm); background:none; color:var(--bb-color-ink); font-size:12.5px; }
44
+ .mp-period-trigger.is-active { background:var(--bb-color-accent-soft); }
45
+ .mp-period { width:248px; padding:4px; background:var(--bb-color-paper); border-radius:var(--bb-radius-md); box-shadow:var(--bb-shadow-compact-dropdown); }
46
+ .mp-period > button { display:flex; align-items:center; width:100%; height:34px; padding:0 10px; border:0; border-radius:var(--bb-radius-sm); background:none; color:var(--bb-color-ink); font-size:12.5px; }
47
+ .mp-period button:hover { background:var(--bb-color-canvas); }
48
+ .mp-period > button[aria-pressed=true] { font-weight:600; }
49
+ .mp-calendar-head { display:flex; align-items:center; padding:6px 6px 0; height:30px; color:var(--bb-color-ink); font-size:13px; font-weight:600; }
50
+ .mp-calendar-head > button { width:26px; height:26px; padding:0; border:0; background:none; color:var(--bb-color-ink); }
51
+ .mp-calendar-head > button:first-child { margin-left:auto; }
52
+ .mp-calendar-grid { display:grid; grid-template-columns:repeat(7,32px); padding:0 6px; }
53
+ .mp-calendar-grid > span { display:grid; place-items:center; height:24px; font-size:11px; color:var(--bb-color-muted); }
54
+ .mp-calendar-grid > button { width:32px; height:30px; padding:0; border:0; background:none; color:var(--bb-color-ink); font-size:12.5px; font-variant-numeric:tabular-nums; }
55
+ .mp-calendar-grid > button.is-in { background:var(--bb-color-accent-soft); }
56
+ .mp-calendar-grid > button[aria-pressed=true] { border-radius:var(--bb-radius-sm); background:var(--bb-color-action); color:var(--bb-color-action-text); font-weight:600; }
57
+ .mp-calendar-grid > button.is-today { box-shadow:inset 0 0 0 1px var(--bb-color-action); border-radius:var(--bb-radius-sm); }
58
+ .mp-calendar-hint { padding:4px 6px 2px; margin:0; color:var(--bb-color-muted); font-size:11.5px; }
59
+ .mp-drawer-content { display:block; height:auto; overflow:visible; }
60
+ .mp-detail-fields { padding:0; }
61
+ .mp-detail-fields > .bb-minutes-detail-pane { display:flex; flex-direction:column; gap:0; border:0; padding:0; border-radius:0; background:none; overflow:visible; }
62
+ .mp-detail-card { position:relative; padding:16px 18px 14px 24px; border-radius:8px; background:var(--bb-color-paper); box-shadow:var(--bb-shadow-card-preview); }
63
+ .mp-detail-card::before { content:''; position:absolute; top:0; bottom:0; left:0; width:5px; border-radius:8px 0 0 8px; background:var(--mp-project-stripe,var(--bb-color-border)); }
64
+ .mp-detail-card h2 { font-size:18px; font-weight:700; line-height:1.5; margin:0 0 10px; overflow-wrap:anywhere; }
65
+ .mp-detail-card .mp-card-meta { display:flex; gap:18px; align-items:center; }
66
+ .mp-facts { padding:6px 28px 24px; background:var(--bb-color-paper); }
67
+ .mp-detail-section { padding:18px 28px 20px; border:0; border-radius:0; background:var(--bb-color-paper); box-shadow:inset 0 1px 0 var(--bb-color-line-soft); }
68
+ .mp-detail-tools { display:flex; align-items:center; gap:8px; }
69
+ .mp-detail-tools > button { width:30px; height:30px; padding:0; border:0; border-radius:6px; background:none; color:var(--bb-color-muted); }
70
+ .mp-detail-tools > button svg { width:16px; height:16px; }
71
+ .mp-detail-tools > button.is-editing { background:var(--bb-color-accent-soft); color:var(--bb-color-action); }
72
+ .mp-detail-footer { display:flex; gap:10px; align-items:center; width:100%; }
73
+ .mp-detail-footer > .mp-hint { margin-right:auto; color:var(--bb-color-muted); font-size:12px; }
74
+ .mp-detail-footer button { flex:none; }
75
+ .bb-minutes-edit-form .mp-edit-body { box-sizing:border-box; width:100%; min-height:300px; resize:vertical; padding:9px 11px; border:0; border-radius:var(--bb-radius-sm); outline:none; background:var(--bb-color-canvas); color:var(--bb-color-ink); font:14px/1.8 var(--bb-font-sans); box-shadow:inset 0 0 0 1px var(--bb-color-border); }
76
+ .mp-edit-body:focus-visible { background:var(--bb-color-surface); }
77
+ .mp-document-tabs { display:flex; gap:2px; margin:0 0 14px; flex-wrap:wrap; }
78
+ .mp-unsaved { display:flex; flex-wrap:wrap; gap:8px; padding:12px 28px; background:var(--bb-color-warning-soft); color:var(--bb-color-warning); font-size:13px; }
79
+ .mp-unsaved p { flex:1 0 100%; margin:0; }
80
+ .mp-new-form { display:flex; flex-direction:column; }
81
+ .mp-new-form .bb-minutes-field { display:contents; }
82
+ .mp-new-form input,.mp-new-form textarea { width:100%; min-width:0; box-sizing:border-box; border:0; outline:none; background:none; color:var(--bb-color-ink); font:14px var(--bb-font-sans); }
83
+ .mp-new-form input { height:34px; padding:0 10px; border-radius:var(--bb-radius-sm); box-shadow:inset 0 0 0 1px var(--bb-color-border); }
84
+ .mp-new-form input[name=title] { height:52px; font-size:15px; font-weight:600; box-shadow:none; padding:0; }
85
+ .mp-new-form input:focus,.mp-new-form textarea:focus { background:var(--bb-color-canvas); }
86
+ .mp-new-form textarea { min-height:120px; resize:vertical; line-height:1.8; padding:8px; }
87
+ .mp-participant-choices { display:flex; gap:6px; flex-wrap:wrap; }
88
+ .mp-version-line { display:flex; gap:10px; align-items:center; margin-top:14px; color:var(--bb-color-muted); font-size:12px; }
89
+ .mp-detail-section .bb-minutes-version-content h2,.mp-detail-section .bb-minutes-version-content h3 { font-size:14px; font-weight:700; margin:18px 0 6px; color:var(--bb-color-action); }
90
+ .mp-detail-section .bb-minutes-version-content :is(h2,h3):first-child { margin-top:0; }
91
+ .mp-detail-section .bb-minutes-version-content p { font-size:14px; line-height:1.85; margin:0 0 8px; }
92
+ .mp-detail-section .bb-minutes-version-content ul { margin:0 0 8px; padding-left:16px; }
93
+ .mp-detail-section .bb-minutes-version-content li { font-size:14px; line-height:1.75; padding:3px 0; }
94
+ .mp-detail-section .bb-minutes-version-content li::marker { color:var(--bb-color-mint); }
95
+ .mp-detail-section .bb-minutes-old-version { background:var(--bb-color-warning-soft); color:var(--bb-color-warning); }
96
+ @media(max-width:1300px) and (min-width:1201px) { .bb-minutes-screen.bb-minutes-table { --bb-card-columns:72px 44px minmax(150px,1fr) 80px 140px 100px 80px; } .mp-summary { white-space:normal; } }
97
+ @media(max-width:1200px) {
98
+ .bb-minutes-screen.bb-minutes-table { --bb-card-columns:64px 44px minmax(0,1fr); }
99
+ .bb-minutes-table > .bb-minutes-columns { padding:12px; }
100
+ .mp-meaning { flex-direction:column; gap:8px; }
101
+ .mp-summary { margin-left:0; flex-wrap:wrap; height:auto; font-size:11px; white-space:normal; }
102
+ .mp-row { row-gap:8px; padding-block:12px; }
103
+ .mp-row > :nth-child(4),.mp-row > :nth-child(5),.mp-row > :nth-child(6),.mp-row > :nth-child(7) { grid-column:3; justify-self:start; }
104
+ .mp-row > :nth-child(4) { grid-column:1 / 3; grid-row:2; }
105
+ .mp-table-head > :nth-child(n+4) { display:none; }
106
+ .mp-facts,.mp-detail-section { padding-inline:16px; }
107
+ .mp-detail-footer { flex-wrap:wrap; }
108
+ }
109
+
110
+ .mp-create-preview { --bb-card-columns:92px 48px minmax(0,1fr) 68px; }
111
+ .mp-create-preview .mp-row > :nth-child(n+5) { display:none; }
112
+ .mp-participants-fact { margin:0; padding:0 28px 24px; background:var(--bb-color-paper); border:0; border-radius:0; }
113
+ .mp-participants-fact .bb-minutes-participants-row { min-height:52px; grid-template-columns:96px minmax(0,1fr); padding:0; background:none; border:0; border-radius:0; box-shadow:inset 0 -1px 0 var(--bb-color-line-soft); }
114
+ .mp-detail-fields .mp-facts { padding-bottom:0; }
115
+ .mp-hint { margin-right:auto; color:var(--bb-color-muted); font-size:12px; }
116
+ .mp-unsaved { width:100%; box-sizing:border-box; }
117
+
118
+ .mp-panel-content .mp-calendar-popover { width:248px; padding:0; border:0; max-height:none; overflow:visible; border-radius:var(--bb-radius-md); }
119
+
120
+ .mp-panel-foot > button { height:28px; min-height:0; padding:0 10px; font:500 12.5px/1.6 var(--bb-font-sans); }
121
+ .mp-participants-control .bb-minutes-participants-row { display:flex; flex-wrap:wrap; padding:0; border:0; background:none; box-shadow:none; }
122
+ .mp-participants-control .bb-minutes-participant-items { gap:6px 14px; }
123
+ .mp-edit-form { border:0; padding:0; background:none; box-shadow:none; }
124
+
125
+ @media(max-width:1200px) { .mp-meaning { flex-direction:column; } .mp-summary { margin-left:0; } }
126
+
127
+ .mp-saved { color:var(--bb-color-muted); font-size:12px; }
128
+ .mp-save-error { padding:10px 28px; margin:0; background:var(--bb-color-danger-soft); color:var(--bb-color-inline-error); }
129
+
130
+ .mp-panel-group { padding:10px 16px 4px; color:var(--bb-color-action); font-size:12px; font-weight:700; box-shadow:inset 0 1px 0 var(--bb-color-line-soft); }
131
+ .mp-panel-foot { display:flex; padding:8px 10px 4px; margin-top:6px; text-align:left; }
132
+ .mp-panel-foot > button { height:30px; font-weight:600; }
133
+ .mp-date { width:100%; }
134
+ .mp-time { display:block; line-height:1.6; }
135
+ .mp-nodate { line-height:1.6; }
136
+ .mp-people { display:inline-flex; }
137
+
138
+ /* Body hierarchy and quiet input for the opt-in table page. */
139
+ .bb-minutes-screen.mp-drawer-content { font-size:13px; line-height:1.6; }
140
+ .mp-detail-fields .mp-facts { padding-bottom:24px; box-shadow:inset 0 1px 0 var(--bb-color-border); }
141
+ .mp-detail-section .bb-minutes-version-content .bb-minutes-md-heading { font-size:14px; font-weight:700; margin:18px 0 6px; color:var(--bb-color-action); }
142
+ .mp-detail-section .bb-minutes-version-content .bb-minutes-md-heading:first-child { margin-top:0; }
143
+ .mp-detail-section ul.bb-minutes-md-list { padding:0; list-style:none; }
144
+ .mp-detail-section ul.bb-minutes-md-list li { position:relative; padding:3px 0 3px 16px; }
145
+ .mp-detail-section ul.bb-minutes-md-list li::before { content:''; position:absolute; left:3px; top:14px; width:5px; height:5px; border-radius:50%; background:var(--bb-color-mint); }
146
+ .bb-minutes-edit-form .mp-edit-body { border-radius:var(--bb-list-control-radius); }
147
+
148
+ .mp-detail-section .bb-minutes-version-content .bb-minutes-md-heading { line-height:1.6; }
149
+ .mp-detail-section .bb-minutes-version-content ul.bb-minutes-md-list { padding:0; }
@@ -0,0 +1,276 @@
1
+ /* Opt-in meeting page presentation. The existing screen owns HTTP and mutations. */
2
+ import {
3
+ makeWorkspaceElement as element, workspaceButton as button, workspaceTopbar,
4
+ workspaceActionIcon, workspaceTabStrip, workspaceConditionChips,
5
+ workspaceControlRow, workspaceCombobox, workspaceFilterPopover,
6
+ workspaceCardRow, workspaceRowMotion,
7
+ } from './workspace-kit.js?capability=search-band-v1';
8
+
9
+ const MINE_PROJECTS = '__minutes_mine_projects__';
10
+ const WD = ['日', '月', '火', '水', '木', '金', '土'];
11
+ const VIEWS = [['recommend', 'おすすめ'], ['joined', '自分が出た会議'], ['waiting', '確認待ち'], ['all', 'すべて']];
12
+ const SORTS = [
13
+ { value: 'pending-first', label: '確認待ちを先に' },
14
+ { value: 'scheduled-desc', label: '会議が新しい順' },
15
+ { value: 'scheduled-asc', label: '会議が古い順' },
16
+ { value: 'updated-desc', label: '議事録の更新が新しい順' },
17
+ ];
18
+ const n = (doc, tag, cls, text, attrs) => element(doc, tag, { className: cls, text, attrs });
19
+ export function minutesDay(value) {
20
+ const date = new Date(value);
21
+ if (!value || Number.isNaN(date.getTime())) return '';
22
+ return new Intl.DateTimeFormat('en-CA', { timeZone: 'Asia/Tokyo', year: 'numeric', month: '2-digit', day: '2-digit' }).format(date);
23
+ }
24
+ export function minutesListState(entry) {
25
+ const docs = Array.isArray(entry?.minutes) ? entry.minutes.filter(d => !d.withdrawal) : [];
26
+ if (!docs.length) return null;
27
+ const summaries = Array.isArray(entry?.current_version_states) ? entry.current_version_states : null;
28
+ const states = docs.map(d => {
29
+ if (summaries) {
30
+ const item = summaries.find(v => v.minutes_id === d.minutes_id && v.version_id === d.current_version_id);
31
+ return ['pending', 'confirmed'].includes(item?.status) ? item.status : 'unknown';
32
+ }
33
+ const versions = [...(entry.versions ?? []), ...(d.versions ?? [])];
34
+ const v = versions.find(v => v.version_id === d.current_version_id);
35
+ if (!v) return 'unknown';
36
+ if (v.confirmation && typeof v.confirmation.actor_id === 'string' && typeof v.confirmation.confirmed_at === 'string') return 'confirmed';
37
+ return v.confirmation === undefined || v.confirmation === null ? 'pending' : 'unknown';
38
+ });
39
+ if (states.includes('pending')) return { code: 'pending', label: '確認待ち' };
40
+ if (states.every(s => s === 'confirmed')) return { code: 'confirmed', label: '確認済み' };
41
+ return null;
42
+ }
43
+ export function minutesDateCell(doc, meeting, now) {
44
+ const day = minutesDay(meeting.scheduled_at);
45
+ if (!day) return n(doc, 'span', 'mp-nodate', '日時なし');
46
+ const date = new Date(`${day}T12:00:00+09:00`);
47
+ const root = n(doc, 'span', `mp-date${day === minutesDay(now) ? ' is-today' : ''}`);
48
+ root.append(n(doc, 'b', '', day.slice(5).replace('-', '/')), n(doc, 'i', '', WD[date.getUTCDay()]));
49
+ if (day === minutesDay(now)) root.title = '今日';
50
+ return root;
51
+ }
52
+ export function minutesConfirmation(doc, value) {
53
+ return n(doc, 'span', value ? `mp-confirm is-${value.code}` : 'mp-unknown', value?.label ?? '未確認');
54
+ }
55
+
56
+ export function createMinutesPage({ doc, state, screen, toolbar, listPane, keyword, clock,
57
+ hostFilters, principalIds, projectContext, sortMeetings, matchesFilters, listState,
58
+ versionNumber, onRender, onCreate, canCreate, appendCreateUnavailable, onOpen }) {
59
+ let view = 'recommend', mine = true, noDate = false, period = '', sort = 'pending-first';
60
+ let month = minutesDay(clock()).slice(0, 7), rangeStart = '';
61
+ const boxes = [], projectBoxes = new Map();
62
+ const tabs = n(doc, 'div', '', '', { role: 'tablist', 'aria-label': '議事録の見方' });
63
+ const tabButtons = VIEWS.map(([value, label]) => {
64
+ const b = button(doc, { text: label, attrs: { role: 'tab', 'aria-selected': String(value === view) }, onClick: () => chooseView(value) });
65
+ b.append(n(doc, 'b', 'bb-ws-tab-count', '0')); tabs.append(b); return b;
66
+ });
67
+ const strip = workspaceTabStrip(tabs, { appearance: 'header' });
68
+ const add = button(doc, { text: '会議を作成', variant: 'primary', onClick: onCreate });
69
+ add.prepend(workspaceActionIcon(doc, 'plus'));
70
+ const tools = button(doc, { attrs: { 'aria-label': '表示と絞り込み', title: '表示と絞り込み' } });
71
+ tools.classList.add('bb-ws-filter-icon-trigger');
72
+ tools.append(workspaceActionIcon(doc, 'sliders'));
73
+ const panel = n(doc, 'div', 'mp-panel-content');
74
+ const pop = workspaceFilterPopover(doc, { trigger: tools, content: panel, appearance: 'panel' });
75
+ const topbar = workspaceTopbar(doc, { title: '議事録', wrap:true, tabs, query: keyword, tools: [add, pop.root] });
76
+ toolbar.replaceWith(topbar);
77
+ const meaning = n(doc, 'div', 'mp-meaning');
78
+ const chips = n(doc, 'div', 'mp-chips'), summary = n(doc, 'div', 'mp-summary');
79
+ meaning.append(chips, summary); listPane.before(meaning);
80
+ const rows = n(doc, 'div', 'mp-rows');
81
+ const motion = workspaceRowMotion(rows);
82
+ const allProjects = entries => [...new Set(entries.filter(e => joined(e)).flatMap(e => codes(e.meeting)))];
83
+ const codes = m => Array.isArray(m?.project_codes) ? m.project_codes : [];
84
+ const identities = () => (typeof principalIds === 'function' ? principalIds() : []).filter(Boolean);
85
+ const joined = e => (e.meeting.participant_ids ?? []).some(id => identities().includes(id));
86
+ const isMine = (e, entries) => codes(e.meeting).some(code => allProjects(entries).includes(code));
87
+ const hosts = () => hostFilters().filter(f => f.id);
88
+ const projectFilter = () => hosts().find(f => f.id === 'project' && f.multiple);
89
+ const selectionKey = values => JSON.stringify([...(values ?? [])].sort());
90
+ let lastProjectSelection, pendingProjectChange;
91
+ function syncProjectSelection() {
92
+ const filter = projectFilter();
93
+ if (!filter) return;
94
+ const key = selectionKey(filter.values);
95
+ if (lastProjectSelection === undefined) mine = !(filter.values ?? []).length;
96
+ else if (key !== lastProjectSelection) {
97
+ const accepted = pendingProjectChange?.key === key ? pendingProjectChange : null;
98
+ mine = accepted?.mine ?? false;
99
+ pendingProjectChange = null;
100
+ accepted?.after?.();
101
+ }
102
+ lastProjectSelection = key;
103
+ }
104
+ function changeProjects(filter, values, nextMine, after) {
105
+ if (selectionKey(values) === selectionKey(filter.values)) {
106
+ pendingProjectChange = null;
107
+ mine = nextMine; after?.(); onRender(); return;
108
+ }
109
+ // The host may defer the change behind its unsaved-edit guard. Keep the
110
+ // current preset and checks until the host actually accepts its values.
111
+ pendingProjectChange = { key: selectionKey(values), mine: nextMine, after };
112
+ filter.onChange?.(values);
113
+ onRender();
114
+ }
115
+ function matchesPreset(entry, id, entries) {
116
+ return id === 'joined' ? joined(entry) : id === 'waiting' ? listState(entry)?.code === 'pending' : id === 'recommend' ? isMine(entry, entries) : true;
117
+ }
118
+ function chooseView(value) {
119
+ const filter = projectFilter();
120
+ if (value === 'recommend' && filter?.values?.length) {
121
+ changeProjects(filter, [], true, () => applyView(value)); return;
122
+ }
123
+ pendingProjectChange = null;
124
+ applyView(value); onRender();
125
+ }
126
+ function applyView(value) {
127
+ view = value; mine = value === 'recommend'; noDate = false; period = '';
128
+ state.filters = { query: state.filters.query, from: '', to: '', participant: '', status: value === 'waiting' ? 'pending' : '' };
129
+ sort = value === 'recommend' ? 'pending-first' : 'scheduled-desc';
130
+ }
131
+ const reset = () => chooseView(view);
132
+ const box = (label, options, value, onChange, extra = {}) => {
133
+ const ctl = workspaceCombobox(doc, { label, options, value, onChange, appearance: 'compact', showCount: false, showHints: false, searchable: false, align: 'end', ...extra });
134
+ boxes.push(ctl); return ctl;
135
+ };
136
+ const sortBox = box('並び順', SORTS, sort, value => { sort = value; onRender(); }, { className: 'is-boxed' });
137
+ const whoBox = box('参加した人', [{value:'',label:'すべて'}], '', value => { state.filters.participant = value; onRender(); });
138
+ const statusBox = box('確認の状態', [{value:'',label:'すべて'}, {value:'pending',label:'確認待ち'}, {value:'confirmed',label:'確認済み'}], '', value => { state.filters.status = value; onRender(); });
139
+ const sortRow = workspaceControlRow(doc, { label: '並び順', control: sortBox.root });
140
+ const hostSlot = n(doc, 'div', 'mp-project-controls');
141
+ const whoRow = workspaceControlRow(doc, { label: '参加した人', control: whoBox.root, tight: true });
142
+ const stateRow = workspaceControlRow(doc, { label: '確認の状態', control: statusBox.root, tight: true });
143
+ const dateTrigger = button(doc, { text: 'すべて', attrs: { 'aria-label': '期間', 'aria-haspopup': 'dialog' } });
144
+ dateTrigger.classList.add('mp-period-trigger');
145
+ const calendar = n(doc, 'div', 'mp-period');
146
+ const datePop = workspaceFilterPopover(doc, { trigger: dateTrigger, content: calendar });
147
+ datePop.panel.classList.add('mp-calendar-popover');
148
+ const periodRow = workspaceControlRow(doc, { label: '期間', control: datePop.root, tight: true });
149
+ const foot = n(doc, 'div', 'mp-panel-foot'); foot.append(button(doc, { text: 'おすすめに戻す', onClick: () => chooseView('recommend') }));
150
+ panel.append(sortRow, n(doc, 'div', 'mp-panel-group', '絞り込み'), hostSlot, whoRow, periodRow, stateRow, foot);
151
+ function setPeriod(value) {
152
+ period = value; noDate = value === 'none'; state.filters.from = ''; state.filters.to = '';
153
+ const today = minutesDay(clock()), [y,m,d] = today.split('-').map(Number);
154
+ const day = date => minutesDay(date);
155
+ if (value === 'week') {
156
+ const start = new Date(`${today}T12:00:00+09:00`); const offset=(start.getUTCDay()+6)%7; start.setUTCDate(start.getUTCDate()-offset);
157
+ state.filters.from=day(start); start.setUTCDate(start.getUTCDate()+6); state.filters.to=day(start);
158
+ } else if (value === 'month' || value === 'last') {
159
+ const target = value === 'last' ? m-2 : m-1;
160
+ state.filters.from = day(new Date(Date.UTC(y,target,1,3)));
161
+ state.filters.to = day(new Date(Date.UTC(y,target+1,0,3)));
162
+ }
163
+ rangeStart=''; datePop.setOpen(false); onRender();
164
+ }
165
+ function renderCalendar() {
166
+ calendar.replaceChildren();
167
+ for (const [value,label] of [['','すべて'],['week','今週'],['month','今月'],['last','先月'],['none','日時なし']]) {
168
+ calendar.append(button(doc, { text: label, attrs: { 'aria-pressed': String(period===value) }, onClick: () => setPeriod(value) }));
169
+ }
170
+ const [y,m] = month.split('-').map(Number);
171
+ const head=n(doc,'div','mp-calendar-head',`${y}年${m}月`);
172
+ for(const [delta,label,mark] of [[-1,'前の月','‹'],[1,'次の月','›']]) head.append(button(doc,{text:mark,attrs:{'aria-label':label},onClick:()=>{month=minutesDay(new Date(Date.UTC(y,m-1+delta,1,3))).slice(0,7);renderCalendar();}}));
173
+ const grid=n(doc,'div','mp-calendar-grid','',{'aria-label':'期間のカレンダー'});
174
+ WD.forEach(w=>grid.append(n(doc,'span','',w)));
175
+ const first=new Date(Date.UTC(y,m-1,1)).getUTCDay(), days=new Date(Date.UTC(y,m,0)).getUTCDate();
176
+ for(let i=0;i<first;i++)grid.append(n(doc,'span',''));
177
+ for(let d=1;d<=days;d++){
178
+ const value=`${month}-${String(d).padStart(2,'0')}`;
179
+ const b=button(doc,{text:String(d),attrs:{'aria-label':`${y}年${m}月${d}日`,'aria-pressed':String(value===rangeStart||value===state.filters.from||value===state.filters.to)},onClick:()=>{
180
+ if(!rangeStart){rangeStart=value;renderCalendar();return;}
181
+ const [from,to]=[rangeStart,value].sort();state.filters.from=from;state.filters.to=to;noDate=false;period='custom';rangeStart='';datePop.setOpen(false);onRender();
182
+ }});
183
+ if(value===minutesDay(clock()))b.classList.add('is-today');
184
+ if(value>state.filters.from&&value<state.filters.to)b.classList.add('is-in');
185
+ grid.append(b);
186
+ }
187
+ calendar.append(head,grid,n(doc,'p','mp-calendar-hint',rangeStart?`${rangeStart} から。終わりの日を押してください`:'始まりの日を押してください'));
188
+ }
189
+ function project(meeting) {
190
+ const root=n(doc,'span','mp-project');
191
+ const context=projectContext?.(meeting);
192
+ if(context?.icon)root.append(context.icon);
193
+ root.append(n(doc,'span','',context?.label||'所属未確認'));
194
+ return {root,stripe:context?.stripe||'var(--bb-color-border)'};
195
+ }
196
+ function row(entry, { preview=false }={}) {
197
+ const m=entry.meeting, p=project(m), day=minutesDay(m.scheduled_at);
198
+ const time=day?new Intl.DateTimeFormat('ja-JP',{timeZone:'Asia/Tokyo',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}).format(new Date(m.scheduled_at)):'';
199
+ const title=n(doc,'strong','mp-title',m.title||'無題の会議');
200
+ const people=n(doc,'span','mp-people','',{'aria-label':(m.participant_ids??[]).join('、')||'参加者の記録なし'});
201
+ for(const id of (m.participant_ids??[]).slice(0,3))people.append(n(doc,'span','mp-avatar',[...id].slice(-1).join(''),{title:id}));
202
+ people.append(n(doc,'small','',(m.participant_ids??[]).length?`${m.participant_ids.length}人`:'参加者の記録なし'));
203
+ const count=entry.minutes?.length??0, version=versionNumber(entry);
204
+ const note=[version>=2?`第${version}版`:'',count>=2?`議事録 ${count}件`:''].filter(Boolean).join(' ');
205
+ const cells=[minutesDateCell(doc,m,clock()),n(doc,'span','mp-time',time),title,minutesConfirmation(doc,listState(entry)),p.root,people,n(doc,'span','mp-note',note)];
206
+ const root=workspaceCardRow(doc,{cells,stripe:p.stripe,selected:state.meetingId===m.meeting_id,key:m.meeting_id,label:m.title,preview,onSelect:preview?undefined:()=>onOpen(m.meeting_id)});
207
+ root.classList.add('mp-row');root.setAttribute('aria-expanded',String(state.meetingId===m.meeting_id));return root;
208
+ }
209
+ function render(entries) {
210
+ syncProjectSelection();
211
+ const hasStates=entries.some(listState);
212
+ for(let i=0;i<VIEWS.length;i++){
213
+ const [value]=VIEWS[i],b=tabButtons[i]; b.setAttribute('aria-selected',String(view===value));b.querySelector('b').textContent=String(entries.filter(e=>matchesPreset(e,value,entries)).length);
214
+ b.disabled=value==='waiting'&&!hasStates;
215
+ }
216
+ strip.update();add.hidden=!canCreate();
217
+ sortBox.update({value:sort});whoBox.update({value:state.filters.participant,options:[{value:'',label:'すべて'},...[...new Set(entries.flatMap(e=>e.meeting.participant_ids??[]))].sort().map(value=>({value,label:identities().includes(value)?'自分':value}))]});
218
+ stateRow.hidden=!hasStates;statusBox.update({value:state.filters.status});
219
+ for(const filter of hosts()){
220
+ let item=projectBoxes.get(filter.id);
221
+ if(!item){
222
+ const ctl=box(filter.label,filter.options,filter.value,(value, option)=>{
223
+ const current=hosts().find(f=>f.id===filter.id);
224
+ if(current?.id==='project'&&current.multiple){
225
+ const own=option?.value===MINE_PROJECTS;
226
+ changeProjects(current,own?[]:value.filter(v=>v!==MINE_PROJECTS),own);
227
+ }else{current?.onChange?.(value);onRender();}
228
+ },{multiple:filter.multiple,values:filter.values,renderIcon:option=>option.value===MINE_PROJECTS?null:filter.renderIcon?.(option)});
229
+ const root=workspaceControlRow(doc,{label:filter.label,control:ctl.root,tight:true});item={ctl,root};projectBoxes.set(filter.id,item);hostSlot.append(root);
230
+ }
231
+ const ownProjects=allProjects(entries);
232
+ const isProject=filter.id==='project'&&filter.multiple;
233
+ const options=isProject?[filter.options?.find(o=>!o.value)??{value:'',label:'すべて'},
234
+ {value:MINE_PROJECTS,label:`自分の${ownProjects.length}つ`},...(filter.options??[]).filter(o=>o.value)]:filter.options;
235
+ item.ctl.update({value:filter.value,values:isProject&&mine?ownProjects:filter.values,selectionLabel:isProject&&mine?`自分の${ownProjects.length}つ`:'',options,disabled:filter.disabled});
236
+ }
237
+ const chipItems=[];
238
+ if(mine)chipItems.push({label:'自分が関わっているプロジェクト',onRemove:()=>{mine=false;onRender();}});
239
+ if(view==='joined'&&!state.filters.participant)chipItems.push({label:'自分が出た会議',onRemove:()=>chooseView('all')});
240
+ for(const f of hosts())for(const value of f.multiple?f.values??[]:f.value?[f.value]:[])chipItems.push({label:f.options?.find(o=>o.value===value)?.label??value,onRemove:()=>{if(f.id==='project'&&f.multiple)changeProjects(f,(f.values??[]).filter(v=>v!==value),false);else{f.onChange?.(f.multiple?(f.values??[]).filter(v=>v!==value):'');onRender();}}});
241
+ if(state.filters.participant)chipItems.push({label:`${state.filters.participant}が出た会議`,onRemove:()=>{state.filters.participant='';onRender();}});
242
+ if(state.filters.status)chipItems.push({label:state.filters.status==='pending'?'確認待ち':'確認済み',onRemove:()=>{state.filters.status='';onRender();}});
243
+ const periodText=period==='custom'?`${state.filters.from.replaceAll('-','/')}〜${state.filters.to.replaceAll('-','/')}`:({'week':'今週','month':'今月','last':'先月','none':'日時なし'}[period]||'すべて');
244
+ dateTrigger.textContent=periodText;dateTrigger.classList.toggle('is-active',!!period);renderCalendar();
245
+ if(period)chipItems.push({label:periodText,onRemove:()=>setPeriod('')});
246
+ if(sort!=='scheduled-desc')chipItems.push({label:SORTS.find(o=>o.value===sort)?.label??'',onRemove:()=>{sort='scheduled-desc';onRender();}});
247
+ const changed=mine!==(view==='recommend')||period||state.filters.from||state.filters.to||state.filters.participant||state.filters.status!==(view==='waiting'?'pending':'')||sort!==(view==='recommend'?'pending-first':'scheduled-desc');
248
+ chips.replaceChildren(workspaceConditionChips(doc,{items:chipItems,reset:changed?reset:undefined,resetLabel:`「${VIEWS.find(v=>v[0]===view)[1]}」の初めに戻す`}));
249
+ summary.replaceChildren();const undated=entries.filter(e=>!minutesDay(e.meeting.scheduled_at)).length;
250
+ if(undated&&!noDate)summary.append(button(doc,{text:`日時なし ${undated}`,attrs:{'aria-label':'日時が分からない会議だけを見る'},onClick:()=>{view='all';mine=false;state.filters={query:state.filters.query,from:'',to:'',participant:'',status:''};setPeriod('none');}}));
251
+ const today=minutesDay(clock()),start=new Date(`${today}T12:00:00+09:00`);start.setUTCDate(start.getUTCDate()-(start.getUTCDay()+6)%7);
252
+ const week=minutesDay(start), previousDate=new Date(start);previousDate.setUTCDate(previousDate.getUTCDate()-7);const previous=minutesDay(previousDate);
253
+ const dates=entries.map(e=>minutesDay(e.meeting.scheduled_at)).filter(Boolean);
254
+ const count=from=>dates.filter(day=>day>=from&&day<=today).length;
255
+ summary.append(n(doc,'span','',`今週 ${count(week)} 先週 ${dates.filter(day=>day>=previous&&day<week).length} それより前 ${dates.filter(day=>day<previous).length}`));
256
+ const visible=entries.filter(e=>(!(state.filters.from||state.filters.to)||!!minutesDay(e.meeting.scheduled_at))&&matchesFilters(e,{...state.filters,status:''})&&(!state.filters.status||listState(e)?.code===state.filters.status)&&hosts().every(f=>typeof f.matches!=='function'||f.matches(e,f.multiple?f.values??[]:f.value))&&(!mine||isMine(e,entries))&&(view!=='joined'||state.filters.participant||joined(e))&&(!noDate||!minutesDay(e.meeting.scheduled_at)));
257
+ let ordered=sortMeetings(visible,sort==='pending-first'?'scheduled-desc':sort);
258
+ if(sort==='pending-first')ordered=ordered.sort((a,b)=>Number(listState(b)?.code==='pending')-Number(listState(a)?.code==='pending'));
259
+ rows.replaceChildren(...ordered.map(e=>row(e)));
260
+ const head=n(doc,'div','mp-table-head');for(const label of ['日付','時刻','会議','確認','プロジェクト','参加した人','版'])head.append(n(doc,'span','',label));
261
+ listPane.append(head,rows);motion.play();
262
+ if(!canCreate())appendCreateUnavailable(listPane);
263
+ const countNote=n(doc,'p','mp-count',`${ordered.length}件${state.nextCursor?'(続きあり・絞り込みは読込済みの会議が対象)':''}`);listPane.append(countNote);
264
+ if(!ordered.length&&!state.listError)listPane.append(n(doc,'p','bb-minutes-empty',state.loading?'会議一覧を読み込んでいます。':'条件に合う会議はありません。'));
265
+ return ordered;
266
+ }
267
+ return { render, row, project, highlightCreated(id) {
268
+ const item = [...rows.children].find(row=>row.getAttribute('data-key')===id);
269
+ if (!item) return;
270
+ item.scrollIntoView?.({block:'nearest'});
271
+ if (!doc.defaultView?.matchMedia?.('(prefers-reduced-motion: reduce)').matches && item.animate) {
272
+ const style = doc.defaultView.getComputedStyle(item);
273
+ item.animate([{background:style.getPropertyValue('--bb-color-accent-soft')},{background:style.getPropertyValue('--bb-color-paper')}],{duration:1600,easing:'ease-out'});
274
+ }
275
+ }, capture:()=>motion.capture(), destroy(){strip.destroy();pop.destroy();datePop.destroy();boxes.forEach(b=>b.destroy());motion.destroy();} };
276
+ }
@@ -1,3 +1,5 @@
1
+ @import url('./meeting-minutes-page.css');
2
+
1
3
  .bb-minutes-screen {
2
4
  --bb-color-accent: var(--bb-color-brand-indigo);
3
5
  --bb-color-accent-strong: var(--bb-color-brand-indigo);