@unson/brainbase-mcp 0.50.10 → 0.50.12
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 +3 -2
- package/ui/brainbase-tokens.css +27 -3
- package/ui/workspace-kit.css +164 -0
- package/ui/workspace-kit.js +181 -20
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unson/brainbase-mcp",
|
|
3
|
-
"version": "0.50.
|
|
3
|
+
"version": "0.50.12",
|
|
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,6 +624,7 @@
|
|
|
624
624
|
"@types/node": "^22.15.29",
|
|
625
625
|
"@types/pg": "^8.23.1",
|
|
626
626
|
"esbuild": "0.28.2",
|
|
627
|
+
"modern-web-guidance": "1.0.0",
|
|
627
628
|
"pg": "^8.23.1",
|
|
628
629
|
"three": "0.186.1",
|
|
629
630
|
"tsx": "^4.19.4",
|
|
@@ -644,5 +645,5 @@
|
|
|
644
645
|
"url": "https://github.com/Unson-LLC/brainbase/issues"
|
|
645
646
|
},
|
|
646
647
|
"homepage": "https://github.com/Unson-LLC/brainbase#readme",
|
|
647
|
-
"gitHead": "
|
|
648
|
+
"gitHead": "7c08b2f49b7276b1ea655c633b3194cf17d3ff6e"
|
|
648
649
|
}
|
package/ui/brainbase-tokens.css
CHANGED
|
@@ -177,9 +177,9 @@
|
|
|
177
177
|
--bb-page-title-font-size: 20px;
|
|
178
178
|
--bb-page-title-line-height: 28px;
|
|
179
179
|
--bb-page-title-font-weight: 600;
|
|
180
|
-
--bb-page-header-padding-top:
|
|
181
|
-
--bb-page-header-padding-bottom:
|
|
182
|
-
--bb-page-header-height:
|
|
180
|
+
--bb-page-header-padding-top: 0px;
|
|
181
|
+
--bb-page-header-padding-bottom: 0px;
|
|
182
|
+
--bb-page-header-height: 52px;
|
|
183
183
|
--bb-search-band-header-height: var(--bb-page-header-height);
|
|
184
184
|
--bb-search-band-scope-padding: 13px;
|
|
185
185
|
--bb-search-band-scope-viewport-reserve: 192px;
|
|
@@ -190,4 +190,28 @@
|
|
|
190
190
|
--bb-create-hover: var(--bb-color-action-hover);
|
|
191
191
|
--bb-radius-pill: 999px;
|
|
192
192
|
|
|
193
|
+
/* Additive neutral compositions; existing palette aliases retain their values. */
|
|
194
|
+
--bb-color-slate: #475569;
|
|
195
|
+
--bb-color-line-soft: var(--bb-inbox-border-subtle);
|
|
196
|
+
--bb-color-placeholder: #9aa3af;
|
|
197
|
+
--bb-composed-chip-hover: rgb(36 50 75 / .1);
|
|
198
|
+
--bb-shadow-card-row-hover: 0 8px 18px -10px rgb(36 50 75 / .45);
|
|
199
|
+
--bb-shadow-card-preview: 0 8px 18px -12px rgb(36 50 75 / .45);
|
|
200
|
+
--bb-row-move-duration: 320ms;
|
|
201
|
+
--bb-row-move-ease: cubic-bezier(.2,.8,.2,1);
|
|
202
|
+
--bb-shadow-compact-dropdown: 0 0 0 1px rgb(27 36 51 / .08), 0 12px 28px rgb(27 36 51 / .18);
|
|
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-input-frame-width: 600px;
|
|
205
|
+
--bb-control-panel-width: 372px;
|
|
206
|
+
--bb-control-panel-duration: 160ms;
|
|
207
|
+
--bb-compact-dropdown-duration: 140ms;
|
|
208
|
+
--bb-compact-dropdown-offset: -6px;
|
|
209
|
+
--bb-compact-dropdown-scale: .98;
|
|
210
|
+
--bb-header-tab-color-duration: 200ms;
|
|
211
|
+
--bb-header-tab-duration: 300ms;
|
|
212
|
+
--bb-header-tab-ease: cubic-bezier(.3,1.4,.5,1);
|
|
213
|
+
--bb-input-frame-duration: 220ms;
|
|
214
|
+
--bb-input-frame-ease: cubic-bezier(.2,.7,.2,1);
|
|
215
|
+
--bb-shadow-input-frame: -12px 0 40px rgb(36 50 75 / .12);
|
|
216
|
+
--bb-color-input-frame-overlay: rgb(32 41 57 / .18);
|
|
193
217
|
}
|
package/ui/workspace-kit.css
CHANGED
|
@@ -1020,3 +1020,167 @@
|
|
|
1020
1020
|
|
|
1021
1021
|
.bb-ws-button.bb-ws-filter-chip:focus-visible { outline: 2px solid var(--bb-color-mint); outline-offset: 2px; }
|
|
1022
1022
|
.bb-ws-filter-anchor[data-pointer-focus] .bb-ws-filter-popover select:focus-visible { outline: none; box-shadow: none; }
|
|
1023
|
+
|
|
1024
|
+
/* Common page chrome; caller-owned tabs and tools retain their lifecycle. */
|
|
1025
|
+
.bb-ws-topbar { height: var(--bb-page-header-height); min-height: var(--bb-page-header-height); padding: 0 24px; gap: 8px; box-shadow: inset 0 -1px 0 var(--bb-color-border); }
|
|
1026
|
+
.bb-ws-topbar.has-query { gap: 8px; padding: 0 24px; padding-inline-end:var(--bb-page-header-inline-end, var(--bb-space-5)); }
|
|
1027
|
+
.bb-ws-topbar.has-tabs > h1 { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
|
|
1028
|
+
.bb-ws-topbar-tabs { display: flex; align-self: stretch; min-width: 0; }
|
|
1029
|
+
.bb-ws-topbar-tools { display: flex; align-items: center; flex: none; gap: 8px; margin-left: auto; }
|
|
1030
|
+
.bb-ws-topbar.has-query .bb-ws-topbar-tools { margin-left: 0; }
|
|
1031
|
+
.bb-ws-topbar.has-tabs .bb-ws-search-control { width: 210px; height: 32px; padding: 0 10px; gap: 8px; border-radius: 7px; }
|
|
1032
|
+
.bb-ws-topbar.has-tabs .bb-ws-search-control > .bb-ws-action-icon { width: 14px; height: 14px; }
|
|
1033
|
+
.bb-ws-topbar.has-tabs .bb-ws-search-control > input { font-size: 12.5px; }
|
|
1034
|
+
.bb-ws-topbar-tools > .bb-ws-button { height: 32px; min-height: 32px; padding: 0 12px 0 9px; gap: 5px; border-radius: 7px; font-size: 12.5px; }
|
|
1035
|
+
.bb-ws-topbar-tools > .bb-ws-button .bb-ws-action-icon { width: 14px; height: 14px; }
|
|
1036
|
+
.bb-ws-topbar.has-tabs { flex-wrap: nowrap; }
|
|
1037
|
+
@media (max-width: 600px) {
|
|
1038
|
+
.bb-ws-topbar.has-query:not(.has-tabs) { height: auto; min-height: var(--bb-page-header-height); }
|
|
1039
|
+
.bb-ws-topbar.has-tabs .bb-ws-search-control { flex: 1; min-width: 72px; }
|
|
1040
|
+
.bb-ws-topbar.has-tabs { padding-inline: 12px; }
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
/* Explicit header view tabs; all other strip appearances stay unchanged. */
|
|
1044
|
+
.bb-ws-tabs.bb-ws-tabs--header { --bb-tab-indicator-duration: var(--bb-header-tab-duration); --bb-tab-indicator-ease: var(--bb-header-tab-ease); gap: 2px; height: 100%; min-height: 52px; box-shadow: none; --bb-tab-indicator-size: 3px; }
|
|
1045
|
+
.bb-ws-tabs--header > :is([role="tab"],a,button) { transition:color var(--bb-header-tab-color-duration); gap: normal; height: 100%; min-height: 52px; padding: 0 14px; font-size: 15px; font-weight: 600; }
|
|
1046
|
+
.bb-ws-tabs--header > :is([role="tab"],a,button):is([aria-selected="true"],[aria-current="page"],[aria-pressed="true"]) { color: var(--bb-color-action); font-weight: 700; }
|
|
1047
|
+
.bb-ws-tabs--header > :is([role="tab"],a,button):is([aria-selected="true"],[aria-current="page"],[aria-pressed="true"]),
|
|
1048
|
+
.bb-ws-tabs--header > :is([role="tab"],a,button):is([aria-selected="true"],[aria-current="page"],[aria-pressed="true"]):hover { box-shadow: inset 0 -3px 0 var(--bb-color-action); }
|
|
1049
|
+
.bb-ws-tabs--header.is-indicator-ready > :is([role="tab"],a,button):is([aria-selected="true"],[aria-current="page"],[aria-pressed="true"]),
|
|
1050
|
+
.bb-ws-tabs--header.is-indicator-ready > :is([role="tab"],a,button):is([aria-selected="true"],[aria-current="page"],[aria-pressed="true"]):hover { box-shadow: none; }
|
|
1051
|
+
.bb-ws-tabs--header.is-indicator-ready::after { height: 3px; border-radius: 3px 3px 0 0; background: var(--bb-color-action); }
|
|
1052
|
+
.bb-ws-tabs--header .bb-ws-tab-count { min-height:0; display: inline-grid; place-items: center; min-width: 22px; height: 22px; margin-left: 7px; padding: 0 7px; border-radius: 999px; background: var(--bb-color-accent-soft); color: var(--bb-color-action); font-size: 11.5px; font-weight: 600; }
|
|
1053
|
+
.bb-ws-tabs--header [aria-selected="true"] .bb-ws-tab-count,
|
|
1054
|
+
.bb-ws-tabs--header [aria-current="page"] .bb-ws-tab-count,
|
|
1055
|
+
.bb-ws-tabs--header [aria-pressed="true"] .bb-ws-tab-count { background: var(--bb-color-mint); }
|
|
1056
|
+
|
|
1057
|
+
/* Compact choices opt in to the sample's surface and motion. */
|
|
1058
|
+
.bb-ws-combobox--compact .bb-ws-combobox-trigger { width: auto; min-height: 28px; height: 28px; gap: 8px; padding: 0 8px 0 10px; border: 0; border-radius: 6px; box-shadow: none; background: transparent; color: var(--bb-color-ink); font: 500 13px/1.6 var(--bb-font-sans); }
|
|
1059
|
+
.bb-ws-combobox--compact .bb-ws-combobox-trigger[aria-expanded="true"] { color: var(--bb-color-action); }
|
|
1060
|
+
.bb-ws-combobox--compact .bb-ws-combobox-popup { top: calc(100% + 4px); width: max-content; min-width: 150px; max-height: 260px; padding: 4px; gap: 4px; border: 0; border-radius: 10px; box-shadow: var(--bb-shadow-compact-dropdown); animation: bb-ws-compact-dropdown-in var(--bb-compact-dropdown-duration) ease-out; }
|
|
1061
|
+
.bb-ws-combobox--compact .bb-ws-combobox-list { max-height: 240px; }
|
|
1062
|
+
.bb-ws-combobox--compact .bb-ws-combobox-option { min-height: 32px; padding: 0 10px; gap: 8px; border-radius: 8px; background: transparent; box-shadow: none; color: var(--bb-color-ink); font: 400 13px/1.6 var(--bb-font-sans); }
|
|
1063
|
+
.bb-ws-combobox--compact .bb-ws-combobox-option:hover { background: var(--bb-color-canvas); }
|
|
1064
|
+
.bb-ws-combobox--compact .bb-ws-combobox-option.is-active { outline: 1px solid var(--bb-color-action); outline-offset: -1px; box-shadow: none; }
|
|
1065
|
+
.bb-ws-combobox--compact .bb-ws-combobox-option[aria-selected="true"] { font-weight: 600; }
|
|
1066
|
+
.bb-ws-combobox--compact .bb-ws-combobox-option::before { color: var(--bb-color-action); }
|
|
1067
|
+
.bb-ws-combobox--compact .bb-ws-combobox-popup.is-closing { pointer-events: none; animation: bb-ws-compact-dropdown-out var(--bb-compact-dropdown-duration) ease-out forwards; }
|
|
1068
|
+
@keyframes bb-ws-compact-dropdown-in { from { transform: translateY(var(--bb-compact-dropdown-offset)) scale(var(--bb-compact-dropdown-scale)); opacity: 0; } to { transform: none; opacity: 1; } }
|
|
1069
|
+
@keyframes bb-ws-compact-dropdown-out { from { transform: none; opacity: 1; } to { transform: translateY(var(--bb-compact-dropdown-offset)) scale(var(--bb-compact-dropdown-scale)); opacity: 0; } }
|
|
1070
|
+
|
|
1071
|
+
/* Two-column panel content remains caller supplied. */
|
|
1072
|
+
.bb-ws-filter-popover.bb-ws-filter-popover--panel { top: 40px; display: block; width: var(--bb-control-panel-width); padding: 6px 0; border: 0; border-radius: 14px; overflow: visible; box-shadow: var(--bb-shadow-control-panel); animation: bb-ws-compact-dropdown-in var(--bb-control-panel-duration) var(--bb-filter-enter-ease); }
|
|
1073
|
+
.bb-ws-filter-popover--panel.is-closing { animation: bb-ws-filter-exit var(--bb-control-panel-duration) var(--bb-filter-enter-ease) forwards; --bb-filter-exit-distance: -6px; }
|
|
1074
|
+
@media (prefers-reduced-motion: reduce) {
|
|
1075
|
+
.bb-ws-combobox--compact .bb-ws-combobox-popup,
|
|
1076
|
+
.bb-ws-combobox--compact .bb-ws-combobox-popup.is-closing,
|
|
1077
|
+
.bb-ws-filter-popover.bb-ws-filter-popover--panel,
|
|
1078
|
+
.bb-ws-filter-popover--panel.is-closing { animation: none; }
|
|
1079
|
+
}
|
|
1080
|
+
|
|
1081
|
+
.bb-ws-search-control.bb-ws-search-control--compact { width: 210px; height: 32px; padding: 0 10px; gap: 8px; border-radius: 7px; }
|
|
1082
|
+
.bb-ws-search-control--compact > .bb-ws-action-icon { width: 14px; height: 14px; }
|
|
1083
|
+
.bb-ws-search-control.bb-ws-search-control--compact > input { font-size: 12.5px; }
|
|
1084
|
+
|
|
1085
|
+
.bb-ws-topbar-tools .bb-ws-filter-icon-trigger { min-width:32px; width:32px; height:32px; min-height:32px; border-radius:7px; }
|
|
1086
|
+
|
|
1087
|
+
/* Explicit compositions; no screen-specific or business selectors. */
|
|
1088
|
+
.bb-ws-condition-chips { display:flex; flex-wrap:wrap; align-items:center; gap:6px; min-width:0; }
|
|
1089
|
+
.bb-ws-condition-chip { display:inline-flex; align-items:center; gap:2px; height:24px; padding:0 3px 0 10px; border-radius:6px; background:var(--bb-color-accent-soft); color:var(--bb-color-action); font-size:12px; font-weight:500; white-space:nowrap; }
|
|
1090
|
+
.bb-ws-condition-chip > button { display:grid; place-items:center; width:18px; min-height:0; height:18px; padding:0; border:0; border-radius:4px; background:none; color:inherit; }
|
|
1091
|
+
.bb-ws-condition-chip > button:hover { background:var(--bb-composed-chip-hover); }
|
|
1092
|
+
.bb-ws-condition-chip svg { width:10px; height:10px; stroke:currentColor; stroke-width:2.2; fill:none; stroke-linecap:round; }
|
|
1093
|
+
.bb-ws-condition-reset { display:grid; place-items:center; flex:none; width:24px; height:24px; padding:0; border:0; border-radius:6px; background:none; color:var(--bb-color-slate); }
|
|
1094
|
+
.bb-ws-condition-reset:hover { background:var(--bb-color-line-soft); color:var(--bb-color-action); }
|
|
1095
|
+
.bb-ws-condition-reset svg { width:14px; height:14px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
|
|
1096
|
+
.bb-ws-pills { display:flex; gap:2px; }
|
|
1097
|
+
.bb-ws-pills > button { display:inline-flex; align-items:center; gap:8px; width:auto; min-height:0; height:28px; padding:0 11px; border:0; border-radius:var(--bb-radius-pill); background:none; color:var(--bb-color-slate); font:500 12.5px var(--bb-font-sans); white-space:nowrap; }
|
|
1098
|
+
.bb-ws-pills > button:not(:disabled):hover { background:var(--bb-color-canvas); }
|
|
1099
|
+
.bb-ws-pills > button[aria-pressed="true"] { background:var(--bb-color-action); color:var(--bb-color-action-text); font-weight:600; }
|
|
1100
|
+
.bb-ws-pills > button:disabled { opacity:.35; cursor:default; }
|
|
1101
|
+
|
|
1102
|
+
.bb-ws-control-row { display:grid; grid-template-columns:92px minmax(0,1fr); align-items:center; min-height:44px; padding:0 16px; }
|
|
1103
|
+
.bb-ws-control-row + .bb-ws-control-row { box-shadow:inset 0 1px 0 var(--bb-color-line-soft); }
|
|
1104
|
+
.bb-ws-control-row.is-tight { min-height:38px; box-shadow:none; }
|
|
1105
|
+
.bb-ws-control-label { color:var(--bb-color-slate); font-size:12.5px; }
|
|
1106
|
+
.bb-ws-control-slot { display:flex; align-items:center; justify-content:flex-end; gap:6px; min-width:0; }
|
|
1107
|
+
.bb-ws-form-row { display:grid; grid-template-columns:96px minmax(0,1fr); align-items:center; min-height:52px; box-shadow:inset 0 -1px 0 var(--bb-color-line-soft); }
|
|
1108
|
+
.bb-ws-form-row.is-top { align-items:start; padding:14px 0; }
|
|
1109
|
+
.bb-ws-form-label { display:flex; align-items:center; gap:3px; color:var(--bb-color-slate); font-size:12.5px; white-space:nowrap; }
|
|
1110
|
+
.bb-ws-form-required { color:var(--bb-color-review); font-size:13.5px; font-weight:700; -webkit-text-stroke:.7px currentColor; }
|
|
1111
|
+
.bb-ws-form-row:focus-within { box-shadow:inset 0 -2px 0 var(--bb-color-action); }
|
|
1112
|
+
.bb-ws-input-frame { width:600px; background:var(--bb-color-canvas); }
|
|
1113
|
+
.bb-ws-input-frame .bb-ws-detail-content { display:flex; flex-direction:column; min-height:calc(100% - 52px); padding:0; }
|
|
1114
|
+
.bb-ws-input-frame .bb-ws-detail-closebar { height:52px; min-height:52px; padding:12px 14px; background:var(--bb-color-canvas); border:0; }
|
|
1115
|
+
.bb-ws-input-tools { display:flex; align-items:center; gap:8px; margin-left:auto; }
|
|
1116
|
+
.bb-ws-input-top { padding:0 28px 20px; }
|
|
1117
|
+
.bb-ws-input-top > h2 { margin:0 0 14px; color:var(--bb-color-action); font-size:17px; font-weight:700; }
|
|
1118
|
+
.bb-ws-input-fields { flex:1; padding:6px 28px 24px; background:var(--bb-color-paper); box-shadow:inset 0 1px 0 var(--bb-color-border); }
|
|
1119
|
+
.bb-ws-input-fields input[type="text"], .bb-ws-input-fields textarea { box-sizing:border-box; width:100%; border:0; outline:0; background:none; color:var(--bb-color-ink); font:inherit; font-size:14px; }
|
|
1120
|
+
.bb-ws-input-fields input[type="text"] { height:52px; font-size:15px; font-weight:600; }
|
|
1121
|
+
.bb-ws-input-fields input::placeholder, .bb-ws-input-fields textarea::placeholder { color:var(--bb-color-placeholder); font-weight:400; }
|
|
1122
|
+
.bb-ws-input-fields textarea { min-height:120px; resize:vertical; line-height:1.8; }
|
|
1123
|
+
.bb-ws-input-fields input[type="date"], .bb-ws-input-fields input[type="datetime-local"] { width:auto; height:32px; padding:0 8px; border:0; border-radius:7px; outline:0; background:none; box-shadow:inset 0 0 0 1px var(--bb-color-border); color:var(--bb-color-ink); font:inherit; font-size:13px; }
|
|
1124
|
+
.bb-ws-input-fields .bb-ws-pills > button { height:30px; padding:0 12px; font-size:13px; }
|
|
1125
|
+
.bb-ws-input-footer { justify-content:flex-end; position:sticky; bottom:0; display:flex; align-items:center; gap:10px; padding:14px 28px; background:var(--bb-color-paper); box-shadow:inset 0 1px 0 var(--bb-color-border); }
|
|
1126
|
+
.bb-ws-input-footer > button { height:36px; min-height:0; padding:0 16px; border:0; border-radius:8px; background:none; color:var(--bb-color-slate); font-size:13px; font-weight:500; }
|
|
1127
|
+
.bb-ws-input-footer > button:hover { background:var(--bb-color-canvas); }
|
|
1128
|
+
.bb-ws-input-footer > button.is-primary { background:var(--bb-color-action); color:var(--bb-color-action-text); font-weight:600; }
|
|
1129
|
+
.bb-ws-input-footer > button.is-primary:hover { background:var(--bb-color-action-hover); }
|
|
1130
|
+
.bb-ws-input-footer > button:disabled { opacity:.4; cursor:default; }
|
|
1131
|
+
.bb-ws-card-row { box-sizing:border-box; position:relative; display:grid; grid-template-columns:var(--bb-card-columns,minmax(0,1fr)); column-gap:20px; align-items:center; width:100%; min-height:48px; margin-bottom:3px; padding:0 16px 0 22px; border:0; border-radius:8px; background:var(--bb-color-paper); color:var(--bb-color-ink); font:400 13px/1.6 var(--bb-font-sans); text-align:left; transition:box-shadow 150ms; }
|
|
1132
|
+
.bb-ws-card-row::before { content:""; position:absolute; left:0; top:0; bottom:0; width:5px; border-radius:8px 0 0 8px; background:var(--bb-card-stripe,var(--bb-color-border)); }
|
|
1133
|
+
.bb-ws-card-row:hover { box-shadow:var(--bb-shadow-card-row-hover); }
|
|
1134
|
+
.bb-ws-card-row.is-selected { box-shadow:0 0 0 2px var(--bb-color-action); }
|
|
1135
|
+
.bb-ws-card-row.is-preview { margin-bottom:0; min-height:52px; column-gap:16px; box-shadow:var(--bb-shadow-card-preview); }
|
|
1136
|
+
.bb-ws-card-cell { min-width:0; }
|
|
1137
|
+
.bb-ws-pills > button:focus-visible, .bb-ws-card-row:focus-visible, .bb-ws-condition-chips button:focus-visible { outline:2px solid var(--bb-color-focus); outline-offset:2px; }
|
|
1138
|
+
@media (prefers-reduced-motion:reduce) { .bb-ws-card-row { transition:none; } }
|
|
1139
|
+
@media (max-width:600px) { .bb-ws-input-frame { width:100%; } .bb-ws-input-fields { padding-inline:16px; } .bb-ws-input-top, .bb-ws-input-footer { padding-inline:16px; } }
|
|
1140
|
+
|
|
1141
|
+
.bb-ws-input-frame.bb-ws-drawer { width:var(--bb-input-frame-width); background:var(--bb-color-canvas); }
|
|
1142
|
+
.bb-ws-topbar.has-tabs .bb-ws-search-control, .bb-ws-search-control.bb-ws-search-control--compact { border:0; box-shadow:inset 0 0 0 1px var(--bb-color-border); font-size:12.5px; }
|
|
1143
|
+
.bb-ws-filter-popover.bb-ws-filter-popover--panel { gap:normal; }
|
|
1144
|
+
|
|
1145
|
+
/* The form frame uses the selected full-width slide, with the shared lifecycle. */
|
|
1146
|
+
.bb-ws-input-frame.bb-ws-drawer { border-left:0; box-shadow:var(--bb-shadow-input-frame); }
|
|
1147
|
+
.bb-ws-input-frame.bb-ws-drawer[open] { animation:bb-ws-input-frame-in var(--bb-input-frame-duration) var(--bb-input-frame-ease); }
|
|
1148
|
+
.bb-ws-input-frame.bb-ws-drawer.is-closing { animation:bb-ws-input-frame-out var(--bb-input-frame-duration) var(--bb-input-frame-ease) both; }
|
|
1149
|
+
.bb-ws-input-frame.bb-ws-drawer::backdrop { background:var(--bb-color-input-frame-overlay); }
|
|
1150
|
+
@keyframes bb-ws-input-frame-in { from { transform:translateX(100%); } to { transform:none; } }
|
|
1151
|
+
@keyframes bb-ws-input-frame-out { from { transform:none; } to { transform:translateX(100%); } }
|
|
1152
|
+
.bb-ws-input-frame .bb-ws-detail-closebar > .bb-ws-button { width:30px; height:30px; min-height:0; padding:0; border:0; border-radius:6px; background:none; font-size:0; color:var(--bb-color-muted); }
|
|
1153
|
+
.bb-ws-input-frame .bb-ws-detail-closebar > .bb-ws-button::before { content:'×'; font-size:22px; }
|
|
1154
|
+
.bb-ws-input-frame .bb-ws-detail-closebar > .bb-ws-button:hover { background:var(--bb-color-canvas); }
|
|
1155
|
+
.bb-ws-topbar-tools .bb-ws-filter-anchor > .bb-ws-button { width:32px; height:32px; min-height:0; padding:0; border:0; border-radius:7px; background:none; }
|
|
1156
|
+
.bb-ws-topbar-tools .bb-ws-filter-anchor > .bb-ws-button::after { display:none; }
|
|
1157
|
+
.bb-ws-input-fields .bb-ws-combobox--compact .bb-ws-combobox-trigger { height:32px; border-radius:7px; }
|
|
1158
|
+
.bb-ws-input-fields .bb-ws-combobox--compact .bb-ws-combobox-popup { min-width:200px; }
|
|
1159
|
+
.bb-ws-input-fields .bb-ws-combobox--compact .bb-ws-combobox-option { min-height:34px; }
|
|
1160
|
+
@media(prefers-reduced-motion:reduce) { .bb-ws-input-frame.bb-ws-drawer[open], .bb-ws-input-frame.bb-ws-drawer.is-closing { animation:none; } }
|
|
1161
|
+
@media(max-width:600px) { .bb-ws-input-frame.bb-ws-drawer { width:100vw; } }
|
|
1162
|
+
|
|
1163
|
+
.bb-ws-input-frame .bb-ws-detail-closebar { position:absolute; left:0; right:0; top:0; background:transparent; pointer-events:none; }
|
|
1164
|
+
.bb-ws-input-frame .bb-ws-detail-closebar button, .bb-ws-input-frame .bb-ws-input-tools { pointer-events:auto; }
|
|
1165
|
+
.bb-ws-input-frame .bb-ws-input-top { padding-top:22px; }
|
|
1166
|
+
.bb-ws-input-frame.has-tools .bb-ws-input-top { padding-top:52px; }
|
|
1167
|
+
.bb-ws-input-frame .bb-ws-input-top > h2 { padding-right:24px; }
|
|
1168
|
+
.bb-ws-input-frame .bb-ws-detail-content { min-height:100dvh; }
|
|
1169
|
+
|
|
1170
|
+
.bb-ws-combobox--compact.is-boxed .bb-ws-combobox-trigger,
|
|
1171
|
+
.bb-ws-input-fields .bb-ws-combobox--compact .bb-ws-combobox-trigger { box-shadow:inset 0 0 0 1px var(--bb-color-border); }
|
|
1172
|
+
.bb-ws-combobox--compact.is-active .bb-ws-combobox-trigger { background:var(--bb-color-accent-soft); color:var(--bb-color-action); font-weight:500; }
|
|
1173
|
+
|
|
1174
|
+
@media(prefers-reduced-motion:reduce) { .bb-ws-tabs--header > :is([role="tab"],a,button) { transition:none; } }
|
|
1175
|
+
|
|
1176
|
+
.bb-ws-combobox--compact.bb-ws-combobox-multiple .bb-ws-combobox-option { grid-template-columns:15px minmax(0,1fr) auto; }
|
|
1177
|
+
.bb-ws-combobox--compact.bb-ws-combobox-multiple .bb-ws-combobox-option::before { display:none; }
|
|
1178
|
+
.bb-ws-combobox-check { display:grid; place-items:center; width:15px; height:15px; border-radius:4px; box-shadow:inset 0 0 0 1.5px var(--bb-color-placeholder); color:transparent; }
|
|
1179
|
+
.bb-ws-combobox-check .bb-ws-action-icon { width:11px; height:11px; stroke-width:3; }
|
|
1180
|
+
.bb-ws-combobox-option[aria-selected="true"] > .bb-ws-combobox-check { background:var(--bb-color-action); color:var(--bb-color-action-text); box-shadow:none; }
|
|
1181
|
+
|
|
1182
|
+
.bb-ws-combobox--compact:not(.bb-ws-combobox-multiple) .bb-ws-combobox-option { grid-template-columns:14px minmax(0,1fr) auto; }
|
|
1183
|
+
.bb-ws-combobox--compact:not(.bb-ws-combobox-multiple) .bb-ws-combobox-option::before { display:none; }
|
|
1184
|
+
.bb-ws-combobox-mark { display:grid; place-items:center; width:14px; height:14px; color:var(--bb-color-action); }
|
|
1185
|
+
.bb-ws-combobox-mark .bb-ws-action-icon { width:14px; height:14px; stroke-width:2.4; visibility:hidden; }
|
|
1186
|
+
.bb-ws-combobox-option[aria-selected="true"] .bb-ws-combobox-mark .bb-ws-action-icon { visibility:visible; }
|
package/ui/workspace-kit.js
CHANGED
|
@@ -84,29 +84,64 @@ export function workspacePageHeader(doc, { crumbs = [], title, lead, help, prese
|
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
/** Shared search presentation. The caller keeps the input, value and handlers. */
|
|
87
|
-
export function workspaceSearchControl(doc, { input } = {}) {
|
|
87
|
+
export function workspaceSearchControl(doc, { input, appearance } = {}) {
|
|
88
88
|
if (!input || typeof input.tagName !== 'string') throw new TypeError('search_input_required');
|
|
89
89
|
const search = el(doc, 'label', { className: 'bb-ws-search-control' });
|
|
90
|
+
if (appearance === 'compact') toggleWorkspaceClass(search, 'bb-ws-search-control--compact', true);
|
|
90
91
|
search.append(workspaceActionIcon(doc, 'search'), input);
|
|
91
92
|
return search;
|
|
92
93
|
}
|
|
93
94
|
|
|
94
95
|
/** A shared title bar, with an optional search input owned by the caller. */
|
|
95
|
-
export function workspaceTopbar(doc, { title = '', query } = {}) {
|
|
96
|
+
export function workspaceTopbar(doc, { title = '', query, tabs, tools } = {}) {
|
|
96
97
|
const header = el(doc, 'header', { className: 'bb-ws-topbar' });
|
|
97
98
|
header.append(el(doc, 'h1', { text: title }));
|
|
98
99
|
let search;
|
|
99
100
|
let currentQuery;
|
|
101
|
+
let tabsSlot;
|
|
102
|
+
let toolsSlot;
|
|
103
|
+
header.setTabs = content => {
|
|
104
|
+
if (Array.isArray(content) && !content.some(Boolean)) content = null;
|
|
105
|
+
tabsSlot?.remove(); tabsSlot = null;
|
|
106
|
+
if (content) {
|
|
107
|
+
tabsSlot = el(doc, 'div', { className: 'bb-ws-topbar-tabs' });
|
|
108
|
+
appendContent(tabsSlot, doc, content); header.append(tabsSlot);
|
|
109
|
+
if (search) header.append(search);
|
|
110
|
+
if (toolsSlot) header.append(toolsSlot);
|
|
111
|
+
}
|
|
112
|
+
toggleWorkspaceClass(header, 'has-tabs', Boolean(content));
|
|
113
|
+
};
|
|
114
|
+
header.setTools = content => {
|
|
115
|
+
if (Array.isArray(content) && !content.some(Boolean)) content = null;
|
|
116
|
+
toolsSlot?.remove(); toolsSlot = null;
|
|
117
|
+
if (content) { toolsSlot = el(doc, 'div', { className: 'bb-ws-topbar-tools' }); appendContent(toolsSlot, doc, content); header.append(toolsSlot); }
|
|
118
|
+
toggleWorkspaceClass(header, 'has-tools', Boolean(content));
|
|
119
|
+
};
|
|
100
120
|
header.setQuery = input => {
|
|
101
121
|
if (input === currentQuery) return;
|
|
102
122
|
search?.remove(); search = null; currentQuery = input;
|
|
103
|
-
if (input) { search = workspaceSearchControl(doc, { input }); header.append(search); }
|
|
123
|
+
if (input) { search = workspaceSearchControl(doc, { input }); header.append(search); if (toolsSlot) header.append(toolsSlot); }
|
|
104
124
|
toggleWorkspaceClass(header, 'has-query', Boolean(input));
|
|
105
125
|
};
|
|
106
|
-
header.setQuery(query);
|
|
126
|
+
header.setTabs(tabs); header.setQuery(query); header.setTools(tools);
|
|
107
127
|
return header;
|
|
108
128
|
}
|
|
109
129
|
|
|
130
|
+
/**
|
|
131
|
+
* Backdrop click closes a modal. Browsers with `closedby` do it natively and fire `cancel`,
|
|
132
|
+
* which the caller already handles; the pointer check is the fallback where it is missing (Safari).
|
|
133
|
+
*/
|
|
134
|
+
function workspaceLightDismiss(doc, dialog, close) {
|
|
135
|
+
dialog.setAttribute('closedby', 'any');
|
|
136
|
+
const NativeDialog = doc.defaultView?.HTMLDialogElement;
|
|
137
|
+
if (NativeDialog && 'closedBy' in NativeDialog.prototype) return;
|
|
138
|
+
dialog.addEventListener('click', event => {
|
|
139
|
+
if (event.target !== dialog) return;
|
|
140
|
+
const rect = dialog.getBoundingClientRect();
|
|
141
|
+
if (event.clientX < rect.left || event.clientX > rect.right || event.clientY < rect.top || event.clientY > rect.bottom) close();
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
|
|
110
145
|
/** A reusable right inspector whose content can refresh without replacing the modal. */
|
|
111
146
|
export function workspaceDetailDrawer(doc, { title = '詳細', opener, onClose } = {}) {
|
|
112
147
|
const dialog = workspaceApplyDrawer(el(doc, 'dialog', { className: 'bb-ws-dialog bb-ws-detail-drawer' }));
|
|
@@ -135,11 +170,7 @@ export function workspaceDetailDrawer(doc, { title = '詳細', opener, onClose }
|
|
|
135
170
|
const button = workspaceButton(doc, { text: '閉じる', onClick: () => close() });
|
|
136
171
|
head.append(label, button); dialog.append(head, body); doc.body.append(dialog);
|
|
137
172
|
dialog.addEventListener('cancel', event => { event.preventDefault(); close(); });
|
|
138
|
-
|
|
139
|
-
if (event.target !== dialog) return;
|
|
140
|
-
const rect = dialog.getBoundingClientRect();
|
|
141
|
-
if (event.clientX < rect.left || event.clientX > rect.right || event.clientY < rect.top || event.clientY > rect.bottom) close();
|
|
142
|
-
});
|
|
173
|
+
workspaceLightDismiss(doc, dialog, () => close());
|
|
143
174
|
return {
|
|
144
175
|
dialog,
|
|
145
176
|
setContent(...content) { if (!disposed) body.replaceChildren(...content); },
|
|
@@ -387,7 +418,7 @@ export function workspaceCloseDrawer(dialog, finish) {
|
|
|
387
418
|
};
|
|
388
419
|
const complete = () => { if (!active) return; cancel(); finish(); };
|
|
389
420
|
const ended = event => {
|
|
390
|
-
if (event.target === dialog &&
|
|
421
|
+
if (event.target === dialog && ['bb-ws-drawer-out', 'bb-ws-input-frame-out'].includes(event.animationName)) complete();
|
|
391
422
|
};
|
|
392
423
|
drawerClosings.set(dialog, cancel);
|
|
393
424
|
dialog.addEventListener('animationend', ended);
|
|
@@ -432,11 +463,7 @@ export function workspaceDialog(doc, { title, content, opener, presentation = 'c
|
|
|
432
463
|
const body = el(doc, 'div', { className: 'bb-ws-dialog-body' }); appendContent(body, doc, content);
|
|
433
464
|
dialog.append(head, body); doc.body.append(dialog);
|
|
434
465
|
dialog.addEventListener('cancel', event => { event.preventDefault(); dialog.close(); });
|
|
435
|
-
|
|
436
|
-
if (event.target !== dialog) return;
|
|
437
|
-
const rect = dialog.getBoundingClientRect();
|
|
438
|
-
if (event.clientX < rect.left || event.clientX > rect.right || event.clientY < rect.top || event.clientY > rect.bottom) dialog.close();
|
|
439
|
-
});
|
|
466
|
+
workspaceLightDismiss(doc, dialog, () => dialog.close());
|
|
440
467
|
dialog.addEventListener('close', cleanup, { once: true });
|
|
441
468
|
try { dialog.showModal(); close.focus(); } catch (error) { cleanup(); throw error; }
|
|
442
469
|
return dialog;
|
|
@@ -465,6 +492,7 @@ export function workspaceFilterPopover(doc, { content, open = false, onToggle, t
|
|
|
465
492
|
const panel = suppliedPanel || el(doc, 'div', { className: 'bb-ws-filter-popover', attrs: { id: `bb-ws-filter-${nextWorkspaceSequence()}`, role: 'region', 'aria-label': '詳細検索' } });
|
|
466
493
|
if (!panel.id && !panel.getAttribute?.('id')) panel.setAttribute('id', `bb-ws-filter-${nextWorkspaceSequence()}`);
|
|
467
494
|
panel.classList?.add('bb-ws-filter-popover');
|
|
495
|
+
if (appearance === 'panel') toggleWorkspaceClass(panel, 'bb-ws-filter-popover--panel', true);
|
|
468
496
|
const control = trigger || workspaceButton(doc, { text: appearance === 'icon' ? undefined : '詳細検索', variant: 'quiet' });
|
|
469
497
|
if (appearance === 'icon') {
|
|
470
498
|
control.classList?.add('bb-ws-filter-icon-trigger');
|
|
@@ -505,7 +533,7 @@ export function workspaceFilterPopover(doc, { content, open = false, onToggle, t
|
|
|
505
533
|
panel.setAttribute('inert', ''); panel.setAttribute('aria-hidden', 'true');
|
|
506
534
|
if (wasOpen && panel.isConnected !== false && panel.classList && !reducedMotion(panel)) {
|
|
507
535
|
panel.classList.add('is-closing'); panel.addEventListener('animationend', ended);
|
|
508
|
-
timer = setTimeout(finishExit, animationFallback(panel, 50, 230));
|
|
536
|
+
timer = setTimeout(finishExit, animationFallback(panel, 50, appearance === 'panel' ? 210 : 230));
|
|
509
537
|
} else panel.hidden = true;
|
|
510
538
|
}
|
|
511
539
|
onToggle?.(next);
|
|
@@ -625,11 +653,12 @@ function comboboxText(value) {
|
|
|
625
653
|
export function workspaceCombobox(doc, {
|
|
626
654
|
label, options = [], value = '', placeholder = '選択してください', searchLabel, searchPlaceholder = '絞り込む',
|
|
627
655
|
emptyText = '一致する候補はありません', limit = 100, searchable = 'auto', className, onChange,
|
|
628
|
-
multiple = false, values = [], renderIcon, showCount = true, showHints = true, align = 'start',
|
|
656
|
+
multiple = false, values = [], renderIcon, showCount = true, showHints = true, align = 'start', appearance,
|
|
629
657
|
} = {}) {
|
|
630
658
|
const sequence = nextWorkspaceSequence();
|
|
631
659
|
const listId = `bb-ws-combobox-${sequence}-list`;
|
|
632
660
|
const root = el(doc, 'span', { className: ['bb-ws-combobox', className].filter(Boolean).join(' ') });
|
|
661
|
+
if (appearance === 'compact') toggleWorkspaceClass(root, 'bb-ws-combobox--compact', true);
|
|
633
662
|
if (multiple) root.classList?.add('bb-ws-combobox-multiple');
|
|
634
663
|
if (align === 'end') root.classList?.add('bb-ws-combobox-align-end');
|
|
635
664
|
const trigger = el(doc, 'button', { className: 'bb-ws-combobox-trigger', attrs: { type: 'button', 'aria-haspopup': 'listbox', 'aria-expanded': 'false', 'aria-controls': listId } });
|
|
@@ -648,6 +677,10 @@ export function workspaceCombobox(doc, {
|
|
|
648
677
|
root.append(trigger, popup);
|
|
649
678
|
|
|
650
679
|
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 };
|
|
680
|
+
let exitTimer;
|
|
681
|
+
const cancelExit = () => { clearTimeout(exitTimer); exitTimer = undefined; popup.removeEventListener?.('animationend', exitEnded); toggleWorkspaceClass(popup, 'is-closing', false); };
|
|
682
|
+
const finishExit = () => { cancelExit(); if (!state.open) popup.hidden = true; };
|
|
683
|
+
const exitEnded = event => { if (event.target === popup && event.animationName === 'bb-ws-compact-dropdown-out') finishExit(); };
|
|
651
684
|
const usesSearch = () => searchable === true || (searchable === 'auto' && state.options.length > 8);
|
|
652
685
|
const focusTarget = () => (usesSearch() ? search : list);
|
|
653
686
|
const chosen = () => state.options.find(option => option.value === state.value);
|
|
@@ -696,6 +729,10 @@ export function workspaceCombobox(doc, {
|
|
|
696
729
|
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 } });
|
|
697
730
|
const optionLabel = el(doc, 'span', { className: 'bb-ws-combobox-option-label', text: option.label });
|
|
698
731
|
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 })); } }
|
|
732
|
+
if (appearance === 'compact') {
|
|
733
|
+
const check = el(doc, 'span', { className: multiple ? 'bb-ws-combobox-check' : 'bb-ws-combobox-mark', attrs: { 'aria-hidden': 'true' } });
|
|
734
|
+
check.append(workspaceActionIcon(doc, 'check')); item.append(check);
|
|
735
|
+
}
|
|
699
736
|
item.append(optionLabel);
|
|
700
737
|
if (showHints && option.hint) item.append(el(doc, 'span', { className: 'bb-ws-combobox-option-hint', text: option.hint }));
|
|
701
738
|
item.addEventListener('pointerdown', event => event.preventDefault?.());
|
|
@@ -730,6 +767,7 @@ export function workspaceCombobox(doc, {
|
|
|
730
767
|
|
|
731
768
|
function open(query = '') {
|
|
732
769
|
if (state.disabled) return;
|
|
770
|
+
cancelExit(); popup.inert = false; popup.removeAttribute?.('inert'); popup.removeAttribute?.('aria-hidden');
|
|
733
771
|
if (!state.open) { state.open = true; doc.addEventListener?.('pointerdown', outside); }
|
|
734
772
|
state.query = query; search.value = query; search.hidden = !usesSearch();
|
|
735
773
|
const selectedIndex = state.options.findIndex(option => multiple ? state.values.includes(option.value) : option.value === state.value);
|
|
@@ -742,7 +780,12 @@ export function workspaceCombobox(doc, {
|
|
|
742
780
|
function close(returnFocus = true) {
|
|
743
781
|
if (!state.open) return;
|
|
744
782
|
state.open = false; removeListeners();
|
|
745
|
-
|
|
783
|
+
if (appearance === 'compact' && !reducedMotion(popup) && popup.isConnected !== false) {
|
|
784
|
+
popup.inert = true; popup.setAttribute('inert', ''); popup.setAttribute('aria-hidden', 'true');
|
|
785
|
+
toggleWorkspaceClass(popup, 'is-closing', true); popup.addEventListener?.('animationend', exitEnded);
|
|
786
|
+
exitTimer = setTimeout(finishExit, animationFallback(popup, 50, 190));
|
|
787
|
+
} else popup.hidden = true;
|
|
788
|
+
trigger.setAttribute('aria-expanded', 'false'); activeDescendant(null);
|
|
746
789
|
if (returnFocus) trigger.focus?.();
|
|
747
790
|
}
|
|
748
791
|
|
|
@@ -802,7 +845,7 @@ export function workspaceCombobox(doc, {
|
|
|
802
845
|
renderTrigger();
|
|
803
846
|
if (state.open) { search.hidden = !usesSearch(); renderList(); }
|
|
804
847
|
},
|
|
805
|
-
destroy() { close(false); removeListeners(); },
|
|
848
|
+
destroy() { close(false); removeListeners(); cancelExit(); popup.hidden = true; },
|
|
806
849
|
};
|
|
807
850
|
}
|
|
808
851
|
|
|
@@ -811,7 +854,7 @@ export function workspaceActionIcon(doc, name) {
|
|
|
811
854
|
const svg = typeof doc.createElementNS === 'function' ? doc.createElementNS('http://www.w3.org/2000/svg', 'svg') : doc.createElement('svg');
|
|
812
855
|
for (const [key, value] of Object.entries({ class: 'bb-ws-action-icon', viewBox: '0 0 24 24', 'aria-hidden': 'true' })) svg.setAttribute(key, value);
|
|
813
856
|
const path = typeof doc.createElementNS === 'function' ? doc.createElementNS('http://www.w3.org/2000/svg', 'path') : doc.createElement('path');
|
|
814
|
-
const paths = { plus: 'M12 5v14M5 12h14', search: 'M21 21l-4.35-4.35M19 11a8 8 0 1 1-16 0 8 8 0 0 1 16 0', filter: 'M4 7h16M7 12h10M10 17h4', sort: 'M8 4v16m-3-3 3 3 3-3M16 20V4m-3 3 3-3 3 3' };
|
|
857
|
+
const paths = { check: 'M5 12l5 5 9-10', sliders: 'M4 8h8M18 8h2M4 16h2M12 16h8 M17.4 8a2.4 2.4 0 1 1-4.8 0 2.4 2.4 0 0 1 4.8 0 M11.4 16a2.4 2.4 0 1 1-4.8 0 2.4 2.4 0 0 1 4.8 0', plus: 'M12 5v14M5 12h14', search: 'M21 21l-4.35-4.35M19 11a8 8 0 1 1-16 0 8 8 0 0 1 16 0', filter: 'M4 7h16M7 12h10M10 17h4', sort: 'M8 4v16m-3-3 3 3 3-3M16 20V4m-3 3 3-3 3 3' };
|
|
815
858
|
path.setAttribute('d', paths[name] || paths.filter); svg.append(path); return svg;
|
|
816
859
|
}
|
|
817
860
|
|
|
@@ -888,6 +931,7 @@ export function workspaceTabStrip(root, { memoryKey, appearance } = {}) {
|
|
|
888
931
|
workspaceTabList(root);
|
|
889
932
|
if (appearance === 'prominent') toggleWorkspaceClass(root, 'bb-ws-tabs--prominent', true);
|
|
890
933
|
if (appearance === 'segmented') toggleWorkspaceClass(root, 'bb-ws-tabs--segmented', true);
|
|
934
|
+
if (appearance === 'header') toggleWorkspaceClass(root, 'bb-ws-tabs--header', true);
|
|
891
935
|
if (tabStrips.has(root)) return tabStrips.get(root);
|
|
892
936
|
const doc = root.ownerDocument;
|
|
893
937
|
const view = doc?.defaultView;
|
|
@@ -1023,3 +1067,120 @@ export function workspaceSearchBand(doc, { root, query, filters, sort, reset, on
|
|
|
1023
1067
|
destroy() { filter.destroy(); reset?.removeEventListener('click', clear); sortReset.removeEventListener('click', resetSort); sort?.trigger.removeEventListener('click', sortClick); sort?.trigger.removeEventListener('keydown', sortClick); },
|
|
1024
1068
|
};
|
|
1025
1069
|
}
|
|
1070
|
+
|
|
1071
|
+
/** Business-neutral compositions. Labels, values and mutations belong to the host. */
|
|
1072
|
+
|
|
1073
|
+
export function workspaceConditionChips(doc, { items = [], reset, resetLabel = '初めの状態に戻す' } = {}) {
|
|
1074
|
+
const root = el(doc, 'div', { className: 'bb-ws-condition-chips' });
|
|
1075
|
+
for (const { label, onRemove } of items) {
|
|
1076
|
+
const chip = el(doc, 'span', { className: 'bb-ws-condition-chip' });
|
|
1077
|
+
chip.append(el(doc, 'span', { text: label }));
|
|
1078
|
+
const remove = workspaceButton(doc, { attrs: { 'aria-label': `${label}を解除` }, onClick: onRemove });
|
|
1079
|
+
const svg = doc.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
|
1080
|
+
svg.setAttribute('viewBox', '0 0 24 24'); svg.setAttribute('aria-hidden', 'true');
|
|
1081
|
+
const path = doc.createElementNS('http://www.w3.org/2000/svg', 'path');
|
|
1082
|
+
path.setAttribute('d', 'M6 6l12 12M18 6L6 18'); svg.append(path); remove.append(svg);
|
|
1083
|
+
chip.append(remove); root.append(chip);
|
|
1084
|
+
}
|
|
1085
|
+
if (reset) {
|
|
1086
|
+
const button = workspaceButton(doc, { attrs: { 'aria-label': resetLabel, title: resetLabel }, onClick: reset });
|
|
1087
|
+
button.className = 'bb-ws-condition-reset';
|
|
1088
|
+
const svg = doc.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
|
1089
|
+
svg.setAttribute('viewBox', '0 0 24 24'); svg.setAttribute('aria-hidden', 'true');
|
|
1090
|
+
const path = doc.createElementNS('http://www.w3.org/2000/svg', 'path');
|
|
1091
|
+
path.setAttribute('d', 'M4 5v5h5 M4.6 10A8 8 0 1 1 6.3 17.7'); svg.append(path); button.append(svg); root.append(button);
|
|
1092
|
+
}
|
|
1093
|
+
return root;
|
|
1094
|
+
}
|
|
1095
|
+
|
|
1096
|
+
export function workspacePills(doc, { label, items = [], value, onChange } = {}) {
|
|
1097
|
+
const root = el(doc, 'div', { className: 'bb-ws-pills', attrs: { role: 'group', 'aria-label': label } });
|
|
1098
|
+
const buttons = items.map(item => {
|
|
1099
|
+
const button = workspaceButton(doc, { text: item.label, disabled: Boolean(item.disabled),
|
|
1100
|
+
attrs: { 'aria-pressed': String(item.value === value) }, onClick: () => onChange?.(item.value, item) });
|
|
1101
|
+
if (item.icon) button.prepend(item.icon);
|
|
1102
|
+
root.append(button); return button;
|
|
1103
|
+
});
|
|
1104
|
+
root.update = next => buttons.forEach((button, i) => button.setAttribute('aria-pressed', String(items[i].value === next)));
|
|
1105
|
+
return root;
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1108
|
+
export function workspaceControlRow(doc, { label, control, tight = false } = {}) {
|
|
1109
|
+
const root = el(doc, 'div', { className: `bb-ws-control-row${tight ? ' is-tight' : ''}` });
|
|
1110
|
+
const slot = el(doc, 'div', { className: 'bb-ws-control-slot' });
|
|
1111
|
+
if (control) slot.append(control);
|
|
1112
|
+
root.append(el(doc, 'span', { className: 'bb-ws-control-label', text: label }), slot);
|
|
1113
|
+
return root;
|
|
1114
|
+
}
|
|
1115
|
+
|
|
1116
|
+
export function workspaceFormRow(doc, { label, control, required = false, top = false } = {}) {
|
|
1117
|
+
const root = el(doc, 'div', { className: `bb-ws-form-row${top ? ' is-top' : ''}` });
|
|
1118
|
+
const caption = el(doc, control?.id ? 'label' : 'span', { className: 'bb-ws-form-label', text: label,
|
|
1119
|
+
attrs: { for: control?.id || undefined } });
|
|
1120
|
+
if (required) {
|
|
1121
|
+
caption.append(el(doc, 'span', { className: 'bb-ws-form-required', text: '※', attrs: { 'aria-label': '必須' } }));
|
|
1122
|
+
control?.setAttribute('aria-required', 'true');
|
|
1123
|
+
if (control && ['INPUT', 'TEXTAREA', 'SELECT'].includes(control.tagName)) control.required = true;
|
|
1124
|
+
}
|
|
1125
|
+
if (control && !control.id && !control.getAttribute('aria-label') && !control.getAttribute('aria-labelledby')) control.setAttribute('aria-label', label);
|
|
1126
|
+
root.append(caption); if (control) root.append(control);
|
|
1127
|
+
return root;
|
|
1128
|
+
}
|
|
1129
|
+
|
|
1130
|
+
/** Uses the canonical modal, Escape/backdrop/close animation and focus return. */
|
|
1131
|
+
export function workspaceInputFrame(doc, { title, opener, onClose, tools = [], preview, rows = [], footer = [], showTitle = true } = {}) {
|
|
1132
|
+
const drawer = workspaceDetailDrawer(doc, { title, opener, onClose });
|
|
1133
|
+
drawer.dialog.classList.add('bb-ws-input-frame');
|
|
1134
|
+
if (tools.length) drawer.dialog.classList.add('has-tools');
|
|
1135
|
+
drawer.dialog.querySelector('.bb-ws-detail-closebar > button')?.setAttribute('aria-label', '閉じる');
|
|
1136
|
+
const top = el(doc, 'div', { className: 'bb-ws-input-top' });
|
|
1137
|
+
const toolRow = el(doc, 'div', { className: 'bb-ws-input-tools' }); toolRow.append(...tools);
|
|
1138
|
+
const heading = el(doc, 'h2', { text: title }); if (showTitle) top.append(heading); if (preview) top.append(preview);
|
|
1139
|
+
const form = el(doc, 'div', { className: 'bb-ws-input-fields' }); form.append(...rows);
|
|
1140
|
+
const foot = el(doc, 'div', { className: 'bb-ws-input-footer' }); foot.append(...footer);
|
|
1141
|
+
drawer.dialog.querySelector('.bb-ws-detail-closebar').prepend(toolRow);
|
|
1142
|
+
drawer.setContent(top, form, foot);
|
|
1143
|
+
return { ...drawer, top, tools: toolRow, fields: form, footer: foot,
|
|
1144
|
+
setTitle(next) { drawer.setTitle(next); heading.textContent = String(next); },
|
|
1145
|
+
};
|
|
1146
|
+
}
|
|
1147
|
+
|
|
1148
|
+
export function workspaceCardRow(doc, { cells = [], stripe, selected = false, key, onSelect, label, preview = false } = {}) {
|
|
1149
|
+
const root = el(doc, onSelect ? 'button' : 'div', { className: `bb-ws-card-row${selected ? ' is-selected' : ''}${preview ? ' is-preview' : ''}`,
|
|
1150
|
+
attrs: { type: onSelect ? 'button' : undefined, 'data-key': key, 'aria-label': label, 'aria-pressed': onSelect ? String(selected) : undefined } });
|
|
1151
|
+
if (stripe) root.style.setProperty('--bb-card-stripe', stripe);
|
|
1152
|
+
for (const cell of cells) {
|
|
1153
|
+
const slot = el(doc, 'span', { className: 'bb-ws-card-cell' });
|
|
1154
|
+
if (cell && typeof cell === 'object' && cell.tagName) slot.append(cell); else slot.textContent = String(cell ?? '');
|
|
1155
|
+
root.append(slot);
|
|
1156
|
+
}
|
|
1157
|
+
if (onSelect) root.addEventListener('click', () => onSelect(key));
|
|
1158
|
+
return root;
|
|
1159
|
+
}
|
|
1160
|
+
|
|
1161
|
+
/** FLIP keyed retained or redrawn rows; capture immediately before a host redraw. */
|
|
1162
|
+
export function workspaceRowMotion(root) {
|
|
1163
|
+
let previous = new Map();
|
|
1164
|
+
const animations = new Set();
|
|
1165
|
+
return {
|
|
1166
|
+
capture() { previous = new Map(Array.from(root.querySelectorAll('[data-key]'), node => [node.getAttribute('data-key'), node.getBoundingClientRect().top])); },
|
|
1167
|
+
play() {
|
|
1168
|
+
for (const animation of animations) animation.cancel(); animations.clear();
|
|
1169
|
+
if (root.ownerDocument.defaultView?.matchMedia?.('(prefers-reduced-motion: reduce)').matches) { previous.clear(); return; }
|
|
1170
|
+
const style = root.ownerDocument.defaultView?.getComputedStyle(root);
|
|
1171
|
+
const rawDuration = style?.getPropertyValue('--bb-row-move-duration').trim();
|
|
1172
|
+
const amount = parseFloat(rawDuration);
|
|
1173
|
+
const duration = Number.isFinite(amount) && amount >= 0 ? amount * (rawDuration.endsWith('ms') ? 1 : 1000) : 320;
|
|
1174
|
+
const easing = style?.getPropertyValue('--bb-row-move-ease').trim() || 'cubic-bezier(.2,.8,.2,1)';
|
|
1175
|
+
for (const node of root.querySelectorAll('[data-key]')) {
|
|
1176
|
+
const old = previous.get(node.getAttribute('data-key'));
|
|
1177
|
+
const dy = old === undefined ? 0 : old - node.getBoundingClientRect().top;
|
|
1178
|
+
if (!dy || !node.animate) continue;
|
|
1179
|
+
const animation = node.animate([{ transform: `translateY(${dy}px)` }, { transform: 'none' }], { duration, easing });
|
|
1180
|
+
animations.add(animation); animation.finished?.then(() => animations.delete(animation), () => animations.delete(animation));
|
|
1181
|
+
}
|
|
1182
|
+
previous.clear();
|
|
1183
|
+
},
|
|
1184
|
+
destroy() { for (const animation of animations) animation.cancel(); animations.clear(); previous.clear(); },
|
|
1185
|
+
};
|
|
1186
|
+
}
|