@unson/brainbase-mcp 0.47.2 → 0.47.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/entity-index-cache.d.ts +38 -0
- package/dist/entity-index-cache.js +146 -0
- package/package.json +6 -2
- package/ui/area-nav.css +3 -42
- package/ui/area-nav.js +5 -3
- package/ui/brainbase-tokens.css +8 -0
- package/ui/graph-registry-view.css +2 -37
- package/ui/graph-registry-view.js +3 -1
- package/ui/inbox.css +2 -27
- package/ui/inbox.js +3 -1
- package/ui/project-workspace.css +0 -26
- package/ui/project-workspace.js +2 -0
- package/ui/workspace-kit.css +81 -0
- package/ui/workspace-kit.js +11 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reusable, host-independent entity index cache.
|
|
3
|
+
*
|
|
4
|
+
* A host that resolves entity indexes (search, list_entities, get_entity,
|
|
5
|
+
* resolve_entity) rebuilds the whole index on every call today. This cache
|
|
6
|
+
* keeps a single in-memory index and only rebuilds when the TTL expires, the
|
|
7
|
+
* caller invalidates it, or an optional revision marker changes. It is
|
|
8
|
+
* provider-agnostic and stores no tenant, member, role, approval, or audit
|
|
9
|
+
* data; the caller supplies both the index builder and the optional revision
|
|
10
|
+
* change detector.
|
|
11
|
+
*/
|
|
12
|
+
export interface EntityIndexCacheOptions<T> {
|
|
13
|
+
build: () => Promise<T>;
|
|
14
|
+
ttlMs: number;
|
|
15
|
+
now?: () => number;
|
|
16
|
+
revision?: () => Promise<string | null | undefined>;
|
|
17
|
+
}
|
|
18
|
+
export interface EntityIndexCachePeek<T> {
|
|
19
|
+
value: T;
|
|
20
|
+
builtAt: number;
|
|
21
|
+
revision?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface EntityIndexCacheStats {
|
|
24
|
+
builds: number;
|
|
25
|
+
hits: number;
|
|
26
|
+
invalidations: number;
|
|
27
|
+
}
|
|
28
|
+
export interface EntityIndexCache<T> {
|
|
29
|
+
get(): Promise<T>;
|
|
30
|
+
invalidate(reason?: string): void;
|
|
31
|
+
peek(): EntityIndexCachePeek<T> | null;
|
|
32
|
+
stats(): EntityIndexCacheStats;
|
|
33
|
+
}
|
|
34
|
+
export declare class EntityIndexUnstableError extends Error {
|
|
35
|
+
readonly code = "entity_index_unstable";
|
|
36
|
+
constructor(message: string);
|
|
37
|
+
}
|
|
38
|
+
export declare function createEntityIndexCache<T>(options: EntityIndexCacheOptions<T>): EntityIndexCache<T>;
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reusable, host-independent entity index cache.
|
|
3
|
+
*
|
|
4
|
+
* A host that resolves entity indexes (search, list_entities, get_entity,
|
|
5
|
+
* resolve_entity) rebuilds the whole index on every call today. This cache
|
|
6
|
+
* keeps a single in-memory index and only rebuilds when the TTL expires, the
|
|
7
|
+
* caller invalidates it, or an optional revision marker changes. It is
|
|
8
|
+
* provider-agnostic and stores no tenant, member, role, approval, or audit
|
|
9
|
+
* data; the caller supplies both the index builder and the optional revision
|
|
10
|
+
* change detector.
|
|
11
|
+
*/
|
|
12
|
+
export class EntityIndexUnstableError extends Error {
|
|
13
|
+
code = 'entity_index_unstable';
|
|
14
|
+
constructor(message) {
|
|
15
|
+
super(message);
|
|
16
|
+
this.name = 'EntityIndexUnstableError';
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export function createEntityIndexCache(options) {
|
|
20
|
+
if (typeof options?.build !== 'function') {
|
|
21
|
+
throw new TypeError('entity index cache requires a build function');
|
|
22
|
+
}
|
|
23
|
+
if (typeof options.ttlMs !== 'number' || !Number.isFinite(options.ttlMs) || options.ttlMs <= 0) {
|
|
24
|
+
throw new TypeError('entity index cache ttlMs must be a positive finite number');
|
|
25
|
+
}
|
|
26
|
+
const now = options.now ?? Date.now;
|
|
27
|
+
const revisionFn = options.revision;
|
|
28
|
+
const MAX_STABLE_BUILD_ATTEMPTS = 3;
|
|
29
|
+
const MAX_RESOLVE_ATTEMPTS = 3;
|
|
30
|
+
let entry = null;
|
|
31
|
+
let inflightGet = null;
|
|
32
|
+
let generation = 0;
|
|
33
|
+
let builds = 0;
|
|
34
|
+
let hits = 0;
|
|
35
|
+
let invalidations = 0;
|
|
36
|
+
async function readRevision() {
|
|
37
|
+
if (!revisionFn) {
|
|
38
|
+
return { ok: true, value: undefined };
|
|
39
|
+
}
|
|
40
|
+
try {
|
|
41
|
+
return { ok: true, value: await revisionFn() };
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
return { ok: false, value: undefined };
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
async function buildStable() {
|
|
48
|
+
for (let attempt = 1;; attempt++) {
|
|
49
|
+
let before = { ok: true, value: undefined };
|
|
50
|
+
if (revisionFn) {
|
|
51
|
+
before = await readRevision();
|
|
52
|
+
}
|
|
53
|
+
builds++;
|
|
54
|
+
const value = await options.build();
|
|
55
|
+
let after = { ok: true, value: undefined };
|
|
56
|
+
if (revisionFn) {
|
|
57
|
+
after = await readRevision();
|
|
58
|
+
}
|
|
59
|
+
if (!before.ok || !after.ok) {
|
|
60
|
+
// Fail-closed: when the revision cannot be read before or after the
|
|
61
|
+
// build we cannot prove the index is current, so it is never cached.
|
|
62
|
+
// The freshly built value is still returned to this caller (matching
|
|
63
|
+
// the serve path, which rebuilds rather than rejects on a revision
|
|
64
|
+
// read failure), but the next get() rebuilds instead of serving an
|
|
65
|
+
// unverified index within the TTL.
|
|
66
|
+
return { value, revision: undefined, commit: false };
|
|
67
|
+
}
|
|
68
|
+
if (before.value === after.value) {
|
|
69
|
+
return { value, revision: after.value, commit: true };
|
|
70
|
+
}
|
|
71
|
+
if (attempt >= MAX_STABLE_BUILD_ATTEMPTS) {
|
|
72
|
+
throw new EntityIndexUnstableError(`entity index did not stabilize after ${MAX_STABLE_BUILD_ATTEMPTS} builds: revision kept changing`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
async function resolve() {
|
|
77
|
+
for (let attempt = 1;; attempt++) {
|
|
78
|
+
const startedGeneration = generation;
|
|
79
|
+
if (entry && now() - entry.builtAt < options.ttlMs) {
|
|
80
|
+
let serve = true;
|
|
81
|
+
if (revisionFn) {
|
|
82
|
+
try {
|
|
83
|
+
const revision = await revisionFn();
|
|
84
|
+
if (revision !== entry.revision) {
|
|
85
|
+
serve = false;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
serve = false;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
if (serve && startedGeneration === generation) {
|
|
93
|
+
hits++;
|
|
94
|
+
return entry.value;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
let built;
|
|
98
|
+
try {
|
|
99
|
+
built = await buildStable();
|
|
100
|
+
}
|
|
101
|
+
catch (error) {
|
|
102
|
+
entry = null;
|
|
103
|
+
throw error;
|
|
104
|
+
}
|
|
105
|
+
if (startedGeneration !== generation) {
|
|
106
|
+
if (attempt >= MAX_RESOLVE_ATTEMPTS) {
|
|
107
|
+
throw new EntityIndexUnstableError(`entity index was invalidated ${MAX_RESOLVE_ATTEMPTS} times while resolving; giving up`);
|
|
108
|
+
}
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
if (built.commit) {
|
|
112
|
+
entry = { value: built.value, builtAt: now(), revision: built.revision };
|
|
113
|
+
}
|
|
114
|
+
return built.value;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
function get() {
|
|
118
|
+
if (inflightGet) {
|
|
119
|
+
return inflightGet;
|
|
120
|
+
}
|
|
121
|
+
const promise = resolve().finally(() => {
|
|
122
|
+
inflightGet = null;
|
|
123
|
+
});
|
|
124
|
+
inflightGet = promise;
|
|
125
|
+
return promise;
|
|
126
|
+
}
|
|
127
|
+
function invalidate(_reason) {
|
|
128
|
+
invalidations++;
|
|
129
|
+
entry = null;
|
|
130
|
+
generation++;
|
|
131
|
+
}
|
|
132
|
+
function peek() {
|
|
133
|
+
if (!entry) {
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
const result = { value: entry.value, builtAt: entry.builtAt };
|
|
137
|
+
if (typeof entry.revision === 'string') {
|
|
138
|
+
result.revision = entry.revision;
|
|
139
|
+
}
|
|
140
|
+
return result;
|
|
141
|
+
}
|
|
142
|
+
function stats() {
|
|
143
|
+
return { builds, hits, invalidations };
|
|
144
|
+
}
|
|
145
|
+
return { get, invalidate, peek, stats };
|
|
146
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unson/brainbase-mcp",
|
|
3
|
-
"version": "0.47.
|
|
3
|
+
"version": "0.47.3",
|
|
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",
|
|
@@ -15,6 +15,10 @@
|
|
|
15
15
|
"types": "./dist/index.d.ts",
|
|
16
16
|
"import": "./dist/index.js"
|
|
17
17
|
},
|
|
18
|
+
"./entity-index-cache": {
|
|
19
|
+
"types": "./dist/entity-index-cache.d.ts",
|
|
20
|
+
"import": "./dist/entity-index-cache.js"
|
|
21
|
+
},
|
|
18
22
|
"./judgment-dag": {
|
|
19
23
|
"types": "./dist/judgment-dag.d.ts",
|
|
20
24
|
"import": "./dist/judgment-dag.js"
|
|
@@ -620,5 +624,5 @@
|
|
|
620
624
|
"url": "https://github.com/Unson-LLC/brainbase/issues"
|
|
621
625
|
},
|
|
622
626
|
"homepage": "https://github.com/Unson-LLC/brainbase#readme",
|
|
623
|
-
"gitHead": "
|
|
627
|
+
"gitHead": "dad2927281fa28f8c3340ebd265f5042aa6b262d"
|
|
624
628
|
}
|
package/ui/area-nav.css
CHANGED
|
@@ -60,8 +60,7 @@
|
|
|
60
60
|
.bb-area-link[hidden],
|
|
61
61
|
.bb-area-section[hidden],
|
|
62
62
|
.bb-area-section-label[hidden],
|
|
63
|
-
.bb-area-section-links[hidden]
|
|
64
|
-
.bb-area-tabs[hidden] {
|
|
63
|
+
.bb-area-section-links[hidden] {
|
|
65
64
|
display: none;
|
|
66
65
|
}
|
|
67
66
|
|
|
@@ -83,49 +82,11 @@
|
|
|
83
82
|
text-align: center;
|
|
84
83
|
}
|
|
85
84
|
|
|
86
|
-
.bb-area-tabs {
|
|
87
|
-
display: flex;
|
|
88
|
-
gap: var(--bb-space-1);
|
|
89
|
-
overflow-x: auto;
|
|
90
|
-
border-bottom: 1px solid var(--bb-color-border);
|
|
91
|
-
padding: 0 var(--bb-space-5);
|
|
92
|
-
background: var(--bb-color-paper);
|
|
93
|
-
scrollbar-width: none;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
.bb-area-tab {
|
|
97
|
-
min-height: 44px;
|
|
98
|
-
display: inline-flex;
|
|
99
|
-
flex: 0 0 auto;
|
|
100
|
-
align-items: center;
|
|
101
|
-
gap: var(--bb-space-2);
|
|
102
|
-
border-bottom: 2px solid transparent;
|
|
103
|
-
padding: 0 var(--bb-space-3);
|
|
104
|
-
color: var(--bb-color-muted);
|
|
105
|
-
font-size: 13px;
|
|
106
|
-
font-weight: 620;
|
|
107
|
-
text-decoration: none;
|
|
108
|
-
white-space: nowrap;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
.bb-area-tab:hover {
|
|
112
|
-
color: var(--bb-color-ink);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
.bb-area-tab[aria-current="page"] {
|
|
116
|
-
border-bottom-color: var(--bb-color-accent);
|
|
117
|
-
color: var(--bb-color-accent);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
.bb-area-tab:focus-visible,
|
|
121
85
|
.bb-area-link:focus-visible,
|
|
122
86
|
.bb-area-section-link:focus-visible {
|
|
123
87
|
outline: 2px solid var(--bb-color-accent);
|
|
124
88
|
outline-offset: -2px;
|
|
125
89
|
}
|
|
126
90
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
padding: 0 var(--bb-space-4);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
91
|
+
.bb-area-tabs { padding-inline: var(--bb-space-5); background: var(--bb-color-paper); }
|
|
92
|
+
@media (max-width: 760px) { .bb-area-tabs { padding-inline: var(--bb-space-4); } }
|
package/ui/area-nav.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { workspaceTabList } from './workspace-kit.js';
|
|
1
2
|
/*
|
|
2
3
|
* Area navigation shared by OSS Personal and the organization edition
|
|
3
4
|
* (brainbase-project ledger D10).
|
|
@@ -148,14 +149,15 @@ export function createAreaNav({
|
|
|
148
149
|
const screenHref = (screen) => screen.href ?? hrefFor(screen.id);
|
|
149
150
|
const areaLabel = (area) => area.label ?? area.screens[0].label;
|
|
150
151
|
|
|
151
|
-
const countBadge = (count, ariaLabel) => makeElement(doc, 'span', {
|
|
152
|
-
className: 'bb-area-count',
|
|
152
|
+
const countBadge = (count, ariaLabel, tab = false) => makeElement(doc, 'span', {
|
|
153
|
+
className: tab ? 'bb-area-count bb-ws-tab-count' : 'bb-area-count',
|
|
153
154
|
text: count,
|
|
154
155
|
attrs: { 'aria-label': ariaLabel },
|
|
155
156
|
});
|
|
156
157
|
|
|
157
158
|
const nav = makeElement(doc, 'nav', { className: 'bb-area-nav', attrs: { 'aria-label': label, 'data-contract-version': AREA_NAV_CONTRACT_VERSION } });
|
|
158
159
|
const tabs = makeElement(doc, 'nav', { className: 'bb-area-tabs' });
|
|
160
|
+
workspaceTabList(tabs);
|
|
159
161
|
tabs.hidden = true;
|
|
160
162
|
const areaLinks = new Map();
|
|
161
163
|
const linkClass = ['bb-area-link', linkClassName].filter(Boolean).join(' ');
|
|
@@ -295,7 +297,7 @@ export function createAreaNav({
|
|
|
295
297
|
});
|
|
296
298
|
tab.append(makeElement(doc, 'span', { text: screen.label }));
|
|
297
299
|
if (Number.isInteger(screen.count)) {
|
|
298
|
-
tab.append(countBadge(screen.count, screen.waiting ? `待っているもの${screen.count}件` : `${screen.count}
|
|
300
|
+
tab.append(countBadge(screen.count, screen.waiting ? `待っているもの${screen.count}件` : `${screen.count}件`, true));
|
|
299
301
|
}
|
|
300
302
|
if (!screen.external) tab.addEventListener('click', (event) => onSelect?.(screen.id, event));
|
|
301
303
|
return tab;
|
package/ui/brainbase-tokens.css
CHANGED
|
@@ -97,4 +97,12 @@
|
|
|
97
97
|
--bb-toolbar-caret-y: -3px;
|
|
98
98
|
--bb-radius-menu: 4px;
|
|
99
99
|
--bb-color-filter-selected: color-mix(in srgb, var(--bb-color-brand-indigo) 10%, var(--bb-color-paper));
|
|
100
|
+
/* Explicitly opted-in tab strips. */
|
|
101
|
+
--bb-tab-height: 44px;
|
|
102
|
+
--bb-tab-font-size: 13px;
|
|
103
|
+
--bb-tab-line-height: 20px;
|
|
104
|
+
--bb-tab-font-weight: 500;
|
|
105
|
+
--bb-tab-indicator-size: 2px;
|
|
106
|
+
--bb-tab-count-size: 20px;
|
|
107
|
+
--bb-tab-count-font-size: 12px;
|
|
100
108
|
}
|
|
@@ -14,43 +14,6 @@
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
/* The kinds as tabs, with their counts. */
|
|
17
|
-
.bb-gr-tabs {
|
|
18
|
-
display: flex;
|
|
19
|
-
flex-wrap: wrap;
|
|
20
|
-
gap: 4px;
|
|
21
|
-
margin-top: 14px;
|
|
22
|
-
border-bottom: 1px solid var(--bb-color-border);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.bb-gr-tab {
|
|
26
|
-
display: inline-flex;
|
|
27
|
-
align-items: baseline;
|
|
28
|
-
gap: 6px;
|
|
29
|
-
margin-bottom: -1px;
|
|
30
|
-
border: 0;
|
|
31
|
-
border-bottom: 2px solid transparent;
|
|
32
|
-
padding: 8px 12px;
|
|
33
|
-
background: transparent;
|
|
34
|
-
color: var(--bb-color-muted);
|
|
35
|
-
font: inherit;
|
|
36
|
-
font-size: 13px;
|
|
37
|
-
cursor: pointer;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.bb-gr-tab:hover {
|
|
41
|
-
color: var(--bb-color-ink);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.bb-gr-tab.is-selected {
|
|
45
|
-
border-bottom-color: var(--bb-color-accent);
|
|
46
|
-
color: var(--bb-color-ink);
|
|
47
|
-
font-weight: 680;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.bb-gr-tab:focus-visible {
|
|
51
|
-
outline: 2px solid var(--bb-color-focus);
|
|
52
|
-
outline-offset: -2px;
|
|
53
|
-
}
|
|
54
17
|
|
|
55
18
|
.bb-gr-tab-count {
|
|
56
19
|
color: var(--bb-color-quiet);
|
|
@@ -321,3 +284,5 @@
|
|
|
321
284
|
color: var(--bb-color-quiet);
|
|
322
285
|
font-size: 12px;
|
|
323
286
|
}
|
|
287
|
+
|
|
288
|
+
.bb-gr-tabs { margin-top: 14px; }
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { workspaceTabList } from './workspace-kit.js';
|
|
1
2
|
/*
|
|
2
3
|
* 「情報と関係」: what the local Graph holds, how records are connected, and
|
|
3
4
|
* where to correct a mistake so the next MCP use sees the fix.
|
|
@@ -468,6 +469,7 @@ export function createGraphRegistryView({
|
|
|
468
469
|
.map(({ id }) => id)
|
|
469
470
|
.filter((id) => id === selected || counts.get(id)?.count !== 0);
|
|
470
471
|
const tabs = makeElement(doc, 'div', { className: 'bb-gr-tabs', attrs: { role: 'tablist', 'aria-label': '種類' } });
|
|
472
|
+
workspaceTabList(tabs);
|
|
471
473
|
for (const id of ['', ...ids]) {
|
|
472
474
|
const item = counts.get(id);
|
|
473
475
|
const count = Number.isInteger(item?.count) ? String(item.count)
|
|
@@ -477,7 +479,7 @@ export function createGraphRegistryView({
|
|
|
477
479
|
attrs: { type: 'button', role: 'tab', 'aria-selected': id === selected ? 'true' : 'false', 'data-type': id, 'data-focus-key': `type:${id}` },
|
|
478
480
|
});
|
|
479
481
|
tab.append(makeElement(doc, 'span', { text: id ? kindLabel(id) : 'すべて' }));
|
|
480
|
-
if (count) tab.append(makeElement(doc, 'span', { className: 'bb-gr-tab-count', text: count }));
|
|
482
|
+
if (count) tab.append(makeElement(doc, 'span', { className: 'bb-gr-tab-count bb-ws-tab-count', text: count }));
|
|
481
483
|
tab.addEventListener('click', () => {
|
|
482
484
|
if (state.query.type === id) return;
|
|
483
485
|
state.query.type = id;
|
package/ui/inbox.css
CHANGED
|
@@ -6,33 +6,6 @@
|
|
|
6
6
|
* warning tone, never left out. Uses only the shared tokens in
|
|
7
7
|
* brainbase-tokens.css.
|
|
8
8
|
*/
|
|
9
|
-
.bb-inbox-tabs {
|
|
10
|
-
display: flex;
|
|
11
|
-
gap: var(--bb-space-1);
|
|
12
|
-
margin: 0 0 var(--bb-space-4);
|
|
13
|
-
border-bottom: 1px solid var(--bb-color-border);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.bb-inbox-tab {
|
|
17
|
-
display: inline-flex;
|
|
18
|
-
align-items: center;
|
|
19
|
-
gap: 6px;
|
|
20
|
-
margin-bottom: -1px;
|
|
21
|
-
border: 0;
|
|
22
|
-
border-bottom: 2px solid transparent;
|
|
23
|
-
padding: 8px 12px;
|
|
24
|
-
background: transparent;
|
|
25
|
-
color: var(--bb-color-muted);
|
|
26
|
-
font: inherit;
|
|
27
|
-
font-size: 14px;
|
|
28
|
-
cursor: pointer;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.bb-inbox-tab.is-selected {
|
|
32
|
-
border-bottom-color: var(--bb-color-accent);
|
|
33
|
-
color: var(--bb-color-ink);
|
|
34
|
-
font-weight: 600;
|
|
35
|
-
}
|
|
36
9
|
|
|
37
10
|
.bb-inbox-count {
|
|
38
11
|
min-width: 20px;
|
|
@@ -187,3 +160,5 @@ a.bb-inbox-title:focus-visible {
|
|
|
187
160
|
width: 100%;
|
|
188
161
|
}
|
|
189
162
|
}
|
|
163
|
+
|
|
164
|
+
.bb-inbox-tabs { margin: 0 0 var(--bb-space-4); }
|
package/ui/inbox.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { workspaceTabList } from './workspace-kit.js';
|
|
1
2
|
/*
|
|
2
3
|
* 受信箱 (story-inbox-stage1-v1, docs/specs/inbox-stage1.md).
|
|
3
4
|
*
|
|
@@ -386,6 +387,7 @@ export function createInboxUI({
|
|
|
386
387
|
|
|
387
388
|
function renderTabs(waitingCount) {
|
|
388
389
|
const bar = el(doc, 'div', { className: 'bb-inbox-tabs', attrs: { role: 'tablist', 'aria-label': '受信箱' } });
|
|
390
|
+
workspaceTabList(bar);
|
|
389
391
|
for (const [id, label] of [['waiting', '対応待ち'], ['notices', 'お知らせ']]) {
|
|
390
392
|
const selected = state.route.tab === id;
|
|
391
393
|
const tab = el(doc, 'button', {
|
|
@@ -394,7 +396,7 @@ export function createInboxUI({
|
|
|
394
396
|
attrs: { type: 'button', role: 'tab', 'aria-selected': selected ? 'true' : 'false' },
|
|
395
397
|
});
|
|
396
398
|
if (id === 'waiting' && Number.isInteger(waitingCount) && waitingCount > 0) {
|
|
397
|
-
tab.append(el(doc, 'span', { className: 'bb-inbox-count', text: waitingCount, attrs: { 'aria-label': `${waitingCount}件` } }));
|
|
399
|
+
tab.append(el(doc, 'span', { className: 'bb-inbox-count bb-ws-tab-count', text: waitingCount, attrs: { 'aria-label': `${waitingCount}件` } }));
|
|
398
400
|
}
|
|
399
401
|
tab.addEventListener('click', () => go({ tab: id, view: 'waiting' }));
|
|
400
402
|
bar.append(tab);
|
package/ui/project-workspace.css
CHANGED
|
@@ -67,32 +67,6 @@
|
|
|
67
67
|
gap: var(--bb-space-1);
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
.bb-pkw-tabs {
|
|
71
|
-
display: flex;
|
|
72
|
-
flex-wrap: wrap;
|
|
73
|
-
gap: var(--bb-space-1);
|
|
74
|
-
border-bottom: 1px solid var(--bb-color-border-strong);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
.bb-pkw-tab {
|
|
78
|
-
border: 0;
|
|
79
|
-
border-bottom: 2px solid transparent;
|
|
80
|
-
padding: 10px 14px;
|
|
81
|
-
color: var(--bb-color-muted);
|
|
82
|
-
background: transparent;
|
|
83
|
-
font: inherit;
|
|
84
|
-
font-size: 12px;
|
|
85
|
-
font-weight: 720;
|
|
86
|
-
cursor: pointer;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
.bb-pkw-tab:hover,
|
|
90
|
-
.bb-pkw-tab.is-active {
|
|
91
|
-
border-bottom-color: var(--bb-color-accent);
|
|
92
|
-
color: var(--bb-color-accent-strong);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
.bb-pkw-tab:focus-visible,
|
|
96
70
|
.bb-pkw-graph-item:focus-visible,
|
|
97
71
|
.bb-pkw-record-link:focus-visible {
|
|
98
72
|
outline: 3px solid color-mix(in srgb, var(--bb-color-focus) 45%, var(--bb-color-panel));
|
package/ui/project-workspace.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { workspaceTabList } from './workspace-kit.js';
|
|
1
2
|
/*
|
|
2
3
|
* Shared project knowledge workspace.
|
|
3
4
|
*
|
|
@@ -1253,6 +1254,7 @@ export function createProjectKnowledgeWorkspace({
|
|
|
1253
1254
|
});
|
|
1254
1255
|
const body = makeElement(doc, 'div', { className: 'bb-pkw-body' });
|
|
1255
1256
|
const tabs = makeElement(doc, 'div', { className: 'bb-pkw-tabs', attrs: { role: 'tablist', 'aria-label': 'プロジェクト情報の表示' } });
|
|
1257
|
+
workspaceTabList(tabs);
|
|
1256
1258
|
const panels = makeElement(doc, 'div', { className: 'bb-pkw-panels' });
|
|
1257
1259
|
root.append(makeElement(doc, 'div', { className: 'bb-pkw-kicker', text: 'プロジェクトの記録' }));
|
|
1258
1260
|
const header = makeElement(doc, 'header', { className: 'bb-pkw-header' });
|
package/ui/workspace-kit.css
CHANGED
|
@@ -737,3 +737,84 @@
|
|
|
737
737
|
.bb-ws-compact-toolbar .bb-ws-toolbar-filter-group.is-filtered .bb-ws-toolbar-filter, .bb-ws-compact-toolbar .bb-ws-toolbar-sort-trigger { width: calc(var(--bb-control-compact-height) + var(--bb-space-1)); padding: var(--bb-space-1); }
|
|
738
738
|
.bb-ws-compact-toolbar .bb-ws-toolbar-filter-panel { position: fixed; top: calc(var(--bb-toolbar-height) * 2 + var(--bb-space-5)); right: var(--bb-space-4); width: calc(100vw - var(--bb-space-6)); max-width: none; max-height: calc(100dvh - var(--bb-toolbar-height) * 2 - var(--bb-space-6) - var(--bb-space-4)); overflow-y: auto; }
|
|
739
739
|
}
|
|
740
|
+
|
|
741
|
+
/* Opt-in tab appearance. The caller owns selection, keyboard input and navigation. */
|
|
742
|
+
.bb-ws-tabs {
|
|
743
|
+
display: flex;
|
|
744
|
+
flex-wrap: nowrap;
|
|
745
|
+
align-items: stretch;
|
|
746
|
+
justify-content: flex-start;
|
|
747
|
+
gap: 0;
|
|
748
|
+
min-width: 0;
|
|
749
|
+
max-width: 100%;
|
|
750
|
+
min-height: var(--bb-tab-height);
|
|
751
|
+
padding: 0;
|
|
752
|
+
border: 0;
|
|
753
|
+
border-radius: 0;
|
|
754
|
+
background: transparent;
|
|
755
|
+
box-shadow: inset 0 -1px 0 var(--bb-color-border);
|
|
756
|
+
overflow-x: auto;
|
|
757
|
+
overflow-y: hidden;
|
|
758
|
+
scrollbar-width: none;
|
|
759
|
+
}
|
|
760
|
+
.bb-ws-tabs > :is([role="tab"], a, button) {
|
|
761
|
+
position: relative;
|
|
762
|
+
flex: 0 0 auto;
|
|
763
|
+
display: inline-flex;
|
|
764
|
+
align-items: center;
|
|
765
|
+
justify-content: center;
|
|
766
|
+
gap: 6px;
|
|
767
|
+
box-sizing: border-box;
|
|
768
|
+
width: auto;
|
|
769
|
+
height: var(--bb-tab-height);
|
|
770
|
+
min-height: var(--bb-tab-height);
|
|
771
|
+
margin: 0;
|
|
772
|
+
padding: 0 var(--bb-space-3);
|
|
773
|
+
border: 0;
|
|
774
|
+
border-radius: 0;
|
|
775
|
+
background: transparent;
|
|
776
|
+
box-shadow: none;
|
|
777
|
+
color: var(--bb-color-muted);
|
|
778
|
+
font-family: var(--bb-font-sans);
|
|
779
|
+
font-size: var(--bb-tab-font-size);
|
|
780
|
+
line-height: var(--bb-tab-line-height);
|
|
781
|
+
font-weight: var(--bb-tab-font-weight);
|
|
782
|
+
white-space: nowrap;
|
|
783
|
+
text-decoration: none;
|
|
784
|
+
}
|
|
785
|
+
.bb-ws-tabs > :is([role="tab"], a, button):hover {
|
|
786
|
+
color: var(--bb-color-muted);
|
|
787
|
+
background: transparent;
|
|
788
|
+
box-shadow: none;
|
|
789
|
+
}
|
|
790
|
+
.bb-ws-tabs > :is([role="tab"], a, button):is([aria-selected="true"], [aria-current="page"], [aria-pressed="true"]),
|
|
791
|
+
.bb-ws-tabs > :is([role="tab"], a, button):is([aria-selected="true"], [aria-current="page"], [aria-pressed="true"]):hover {
|
|
792
|
+
color: var(--bb-color-ink);
|
|
793
|
+
background: transparent;
|
|
794
|
+
box-shadow: inset 0 calc(-1 * var(--bb-tab-indicator-size)) 0 var(--bb-color-ink);
|
|
795
|
+
}
|
|
796
|
+
.bb-ws-tabs > :is([role="tab"], a, button):focus-visible {
|
|
797
|
+
outline: var(--bb-tab-indicator-size) solid var(--bb-color-ink);
|
|
798
|
+
outline-offset: -4px;
|
|
799
|
+
}
|
|
800
|
+
.bb-ws-tabs .bb-ws-tab-count {
|
|
801
|
+
display: inline-flex;
|
|
802
|
+
align-items: center;
|
|
803
|
+
justify-content: center;
|
|
804
|
+
box-sizing: border-box;
|
|
805
|
+
min-width: var(--bb-tab-count-size);
|
|
806
|
+
height: var(--bb-tab-count-size);
|
|
807
|
+
padding: 0 6px;
|
|
808
|
+
border-radius: var(--bb-tab-count-size);
|
|
809
|
+
color: var(--bb-color-ink);
|
|
810
|
+
background: var(--bb-color-canvas);
|
|
811
|
+
font-size: var(--bb-tab-count-font-size);
|
|
812
|
+
line-height: var(--bb-tab-count-size);
|
|
813
|
+
font-weight: var(--bb-tab-font-weight);
|
|
814
|
+
}
|
|
815
|
+
.bb-ws-tabs::-webkit-scrollbar { display: none; }
|
|
816
|
+
.bb-ws-tabs[hidden],
|
|
817
|
+
.bb-ws-tabs > [hidden] { display: none; }
|
|
818
|
+
.bb-ws-tabs--summary > [role="tab"] { flex-direction: column; align-items: flex-start; gap: 0; }
|
|
819
|
+
.bb-ws-tabs--summary > [role="tab"] strong { font: inherit; }
|
|
820
|
+
.bb-ws-tabs--summary > [role="tab"] small { margin: 0; }
|
package/ui/workspace-kit.js
CHANGED
|
@@ -707,3 +707,14 @@ export function workspaceCompactToolbar(doc, { root, query, filters, sort, reset
|
|
|
707
707
|
filter.destroy(); reset?.removeEventListener('click', clear); sort?.trigger.removeEventListener('click', sortClick); sort?.trigger.removeEventListener('keydown', sortClick);
|
|
708
708
|
} };
|
|
709
709
|
}
|
|
710
|
+
|
|
711
|
+
/** Apply the common tab appearance without changing semantics, state or handlers.
|
|
712
|
+
* Hosts may also use the documented bb-ws-tabs CSS class directly.
|
|
713
|
+
*/
|
|
714
|
+
export function workspaceTabList(root) {
|
|
715
|
+
if (!root || typeof root.className !== 'string') throw new TypeError('tab_root_required');
|
|
716
|
+
const classes = root.className.split(/\s+/u).filter(Boolean);
|
|
717
|
+
if (!classes.includes('bb-ws-tabs')) classes.push('bb-ws-tabs');
|
|
718
|
+
root.className = classes.join(' ');
|
|
719
|
+
return root;
|
|
720
|
+
}
|