@kolkrabbi/kol-component 0.378.0 → 0.380.0
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 +5 -4
- package/src/atoms/Badge.jsx +1 -5
- package/src/atoms/BezierPathEditor.jsx +1 -1
- package/src/atoms/Button.jsx +88 -12
- package/src/atoms/Figure.jsx +19 -1
- package/src/atoms/FunctionPlot.jsx +1 -1
- package/src/atoms/Input.jsx +107 -7
- package/src/atoms/Kbd.jsx +42 -2
- package/src/atoms/Link.jsx +20 -0
- package/src/atoms/OriginPicker.jsx +9 -5
- package/src/atoms/Pill.jsx +1 -3
- package/src/atoms/ProgressBar.jsx +3 -6
- package/src/atoms/SectionFooter.jsx +22 -0
- package/src/atoms/SectionHeader.jsx +24 -0
- package/src/atoms/SectionLabel.jsx +0 -22
- package/src/atoms/SizeOrDownload.jsx +1 -1
- package/src/atoms/Tag.jsx +4 -7
- package/src/atoms/Textarea.jsx +12 -7
- package/src/atoms/ToggleCheckbox.jsx +25 -5
- package/src/atoms/ToggleSwitch.jsx +41 -7
- package/src/atoms/ViewToggle.jsx +2 -29
- package/src/atoms/XYPad.jsx +25 -0
- package/src/hooks/useDragResize.js +1 -1
- package/src/index.js +26 -4
- package/src/molecules/AccountMenu.jsx +16 -3
- package/src/molecules/AlignmentGrid.jsx +13 -1
- package/src/molecules/ButtonGroup.jsx +78 -15
- package/src/molecules/ButtonSplit.jsx +75 -28
- package/src/molecules/Chip.jsx +26 -0
- package/src/molecules/CodeBlock.jsx +39 -2
- package/src/molecules/ColorInputRow.jsx +125 -4
- package/src/molecules/ColorSwatch.jsx +43 -2
- package/src/molecules/ContentCard.jsx +104 -3
- package/src/molecules/ContentMedia.jsx +1 -1
- package/src/molecules/ContentRow.jsx +4 -32
- package/src/molecules/ContextMenu.jsx +0 -1
- package/src/molecules/DividerLabel.jsx +19 -0
- package/src/molecules/DocsToc.jsx +1 -16
- package/src/molecules/Dropdown.jsx +115 -18
- package/src/molecules/DropdownStepper.jsx +29 -0
- package/src/molecules/EmptyState.jsx +1 -15
- package/src/molecules/FieldPair.jsx +41 -2
- package/src/molecules/Header.jsx +4 -4
- package/src/molecules/IndexRow.jsx +1 -1
- package/src/molecules/InlineAddRow.jsx +2 -2
- package/src/molecules/LabeledControl.jsx +56 -11
- package/src/molecules/LayerRow.jsx +1 -1
- package/src/molecules/LinkAddRow.jsx +5 -7
- package/src/molecules/Menu.jsx +250 -33
- package/src/molecules/MenuFloat.jsx +6 -12
- package/src/molecules/MenuList.jsx +5 -11
- package/src/molecules/Modal.jsx +228 -55
- package/src/molecules/ModalHeader.jsx +12 -20
- package/src/molecules/ModalShell.jsx +20 -10
- package/src/molecules/NoticeBanner.jsx +1 -1
- package/src/molecules/OptionRow.jsx +1 -1
- package/src/molecules/PanelsMenu.jsx +2 -2
- package/src/molecules/ParamBindDot.jsx +29 -2
- package/src/molecules/PasswordInput.jsx +1 -1
- package/src/molecules/QuantityInput.jsx +45 -13
- package/src/molecules/QuickLookFrame.jsx +2 -31
- package/src/molecules/RailHeader.jsx +37 -16
- package/src/molecules/ReadingActions.jsx +2 -2
- package/src/molecules/ReadingNotes.jsx +3 -3
- package/src/molecules/ReadingSettings.jsx +8 -8
- package/src/molecules/SearchInput.jsx +4 -5
- package/src/molecules/SectionText.jsx +56 -10
- package/src/molecules/SettingsControls.jsx +23 -23
- package/src/molecules/Slider.jsx +103 -55
- package/src/molecules/SpecList.jsx +1 -21
- package/src/molecules/SplitToolButton.jsx +4 -6
- package/src/molecules/SwatchControls.jsx +28 -0
- package/src/molecules/SwatchGrid.jsx +39 -0
- package/src/molecules/TabsDocument.jsx +131 -0
- package/src/molecules/TabsRow.jsx +40 -50
- package/src/molecules/TaskRow.jsx +2 -2
- package/src/molecules/Toast.jsx +55 -0
- package/src/molecules/TocRow.jsx +1 -1
- package/src/molecules/TreeRow.jsx +87 -1
- package/src/molecules/WorkspaceSwitcher.jsx +3 -6
- package/src/organisms/AppItemMenuProvider.jsx +2 -2
- package/src/organisms/ColorPickerPopover.jsx +133 -4
- package/src/organisms/ColumnBrowser.jsx +1 -1
- package/src/organisms/CommandOverlay.jsx +362 -87
- package/src/organisms/ContentFilters.jsx +4 -12
- package/src/organisms/FindBar.jsx +70 -0
- package/src/organisms/FramedMediaBand.jsx +2 -2
- package/src/organisms/GalleryCarousel.jsx +1 -1
- package/src/organisms/LogoSystem.jsx +38 -0
- package/src/organisms/LogoTuner.jsx +32 -0
- package/src/organisms/MediaLibrary.jsx +1 -56
- package/src/organisms/MediaLibraryPages.jsx +1 -1
- package/src/organisms/NavRail.jsx +1 -4
- package/src/organisms/Rail.jsx +33 -1
- package/src/organisms/RailSwitcher.jsx +62 -0
- package/src/organisms/ReadingContents.jsx +65 -3
- package/src/organisms/ReadingOverview.jsx +5 -5
- package/src/organisms/ReadingPanel.jsx +1 -1
- package/src/organisms/SectionSplit.jsx +1 -1
- package/src/organisms/SettingsPanel.jsx +64 -41
- package/src/organisms/ShortcutsOverlay.jsx +46 -2
- package/src/organisms/SpectrumControls.jsx +112 -19
- package/src/organisms/StatusBar.jsx +30 -0
- package/src/organisms/Table.jsx +136 -45
- package/src/organisms/TimelineDock.jsx +281 -1
- package/src/organisms/logoBoard.jsx +61 -0
- package/src/utilities/AssetPlaceholder.jsx +1 -1
- package/src/utilities/EditorShell.jsx +42 -1
- package/src/utilities/OverlayGlassPanel.jsx +1 -1
- package/src/utilities/Popover.jsx +299 -5
- package/src/utilities/SelectionOverlay.jsx +60 -31
- package/src/utilities/kolboxGlyph.jsx +10 -0
- package/src/molecules/FloatModuleHeader.jsx +0 -11
- package/src/organisms/NavRailFloat.jsx +0 -139
package/src/organisms/Table.jsx
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import { useMemo, useState } from 'react'
|
|
1
|
+
import { Fragment, useMemo, useState } from 'react'
|
|
2
2
|
import { IconLoader } from '@kolkrabbi/kol-icons'
|
|
3
3
|
import { INDICATOR } from '../hooks/glyphLadders.js'
|
|
4
|
+
import Button from '../atoms/Button.jsx'
|
|
5
|
+
import { Tooltip } from '../utilities/Popover.jsx'
|
|
6
|
+
import KolboxGlyph from '../utilities/kolboxGlyph.jsx'
|
|
7
|
+
import { fileAgo } from '../molecules/ContentCard.jsx'
|
|
4
8
|
|
|
5
9
|
/**
|
|
6
10
|
* Table — data table.
|
|
@@ -17,15 +21,6 @@ import { INDICATOR } from '../hooks/glyphLadders.js'
|
|
|
17
21
|
* sorts itself needs no state from the page. Pass `sortValue(row)` when the
|
|
18
22
|
* rendered cell is not what should be compared (a chip, a link, a date
|
|
19
23
|
* string).
|
|
20
|
-
*
|
|
21
|
-
* FLOAT (`variant="float"`, float-everything W8 rows 115 · 116, 2026-11-04 — kol-float--style 48:2780 analytics,
|
|
22
|
-
* 48:3257 catalog): its own render, none of `.kol-table`'s rules. The head in mono (`kol-float-ruler`, 10, uppercase
|
|
23
|
-
* by the table's role) on the emphasis ink; body cells in `kol-float-timecode` (mono 12) on fg-64, or the float sans
|
|
24
|
-
* (`kol-float-hint`) for a column with `sans: true`; 12 · 16 in a cell, no rules between rows (the no-borders law —
|
|
25
|
-
* rows lift fg-08 under the pointer instead). `align: 'right'` right-aligns a column (the numbers, the share). A cell's
|
|
26
|
-
* `render` draws covers and status pills (`Pill variant="float"`) — the catalog's cover · title · status row.
|
|
27
|
-
* `framed` sets it on a sheet (surface-secondary on `--kol-float-menu-r`, 8 in) — the catalog; unframed it sits on
|
|
28
|
-
* whatever float holds it — the analytics card.
|
|
29
24
|
*/
|
|
30
25
|
const collator = new Intl.Collator(undefined, { numeric: true, sensitivity: 'base' })
|
|
31
26
|
|
|
@@ -42,7 +37,7 @@ const WIDTHS = {
|
|
|
42
37
|
column: '',
|
|
43
38
|
}
|
|
44
39
|
|
|
45
|
-
const
|
|
40
|
+
const TableDefault = ({ caption, columns, rows, variant = 'default', className = '', width = 'panel', rowClassName, compact = false, lastRule = false }) => {
|
|
46
41
|
const [sort, setSort] = useState({ key: null, dir: null })
|
|
47
42
|
|
|
48
43
|
const cycle = (key) =>
|
|
@@ -64,7 +59,6 @@ const Table = ({ caption, columns, rows, variant = 'default', className = '', wi
|
|
|
64
59
|
})
|
|
65
60
|
}, [rows, columns, sort])
|
|
66
61
|
|
|
67
|
-
if (variant === 'float') return <FloatTable caption={caption} columns={columns} rows={sorted} sort={sort} cycle={cycle} framed={framed} rowClassName={rowClassName} className={`${WIDTHS[width] ?? WIDTHS.panel} ${className}`.trim()} />
|
|
68
62
|
|
|
69
63
|
const variantClass = variant === 'simple' ? 'kol-table--simple' : ''
|
|
70
64
|
/* compact — record-surface density (RecordManager, 2026-08-09): the default
|
|
@@ -124,42 +118,139 @@ const Table = ({ caption, columns, rows, variant = 'default', className = '', wi
|
|
|
124
118
|
)
|
|
125
119
|
}
|
|
126
120
|
|
|
127
|
-
|
|
128
|
-
|
|
121
|
+
|
|
122
|
+
/* ── kolbox (plan-2026-11-18-kolbox-system W31.2 batch 5, 2026-11-18) ─────────────────────────────────────────────────
|
|
123
|
+
* kolbox's FileList with its FileListHeader and FileListRow (Figma `FileList`), carried from apps/kolbox/src/home: 20
|
|
124
|
+
* under the title row, the head row (39), then one row per file, 48 high, touching. Opens on a double click or Enter.
|
|
125
|
+
* Table's words: `rows` (the files: { id, name, modified, created, size }), `sort` ('modified' | 'created' | 'name'; the
|
|
126
|
+
* sorted column's name in the ink with its arrow). kolbox's own: `onOpen(file)`; `onSettings(file)`, `onRemove(file)`
|
|
127
|
+
* (the cog and the trash; with either, the Size column and the actions gutter), `onMenu(file, event)` (right click).
|
|
128
|
+
* Columns (Figma's file list, measured: plan-2026-11-23 W6): the star's 33, Name at half the row, then Last modified,
|
|
129
|
+
* Created and Active in file (and Size) sharing the rest; the head 39, the cells full height; the row inset 32 at the
|
|
130
|
+
* right as a margin, so its hover ends there; under 768 Created and Active in file give way. `onStar(file)`: the star, lit while
|
|
131
|
+
* `file.starred`; absent, the column is empty. `file.icon` names the name's glyph (default `file`). */
|
|
132
|
+
const FILE_COLS_KOLBOX = 'grid grid-cols-[33px_50%_repeat(3,minmax(0,1fr))] mr-8 max-md:grid-cols-[33px_minmax(0,1fr)_104px] max-md:mr-4'
|
|
133
|
+
const FILE_COLS_ACTIONS_KOLBOX = 'grid grid-cols-[33px_50%_repeat(4,minmax(0,1fr))_64px] mr-8 max-md:grid-cols-[33px_minmax(0,1fr)_104px_64px_64px] max-md:mr-4'
|
|
134
|
+
const PHONE_HIDDEN_KOLBOX = 'max-md:hidden'
|
|
135
|
+
|
|
136
|
+
function TableHeadKolbox({ sort, actions = false }) {
|
|
137
|
+
const col = (key, label, pad = 'pl-2', hide = '') => (
|
|
138
|
+
<span role="columnheader" className={`flex items-center gap-1 whitespace-nowrap ${pad} ${sort === key ? 'is-sorted' : ''} ${hide}`}>
|
|
139
|
+
{label}{sort === key && <KolboxGlyph name="arrow-down" size={12} />}
|
|
140
|
+
</span>
|
|
141
|
+
)
|
|
129
142
|
return (
|
|
130
|
-
<div className={`
|
|
131
|
-
<
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
143
|
+
<div role="row" className={`kol-table-head ${actions ? FILE_COLS_ACTIONS_KOLBOX : FILE_COLS_KOLBOX} h-[39px] shrink-0`} data-file-list-header>
|
|
144
|
+
<span role="columnheader" aria-label="Star" className="self-center" />
|
|
145
|
+
{col('name', 'Name', '')}
|
|
146
|
+
{col('modified', 'Last modified')}
|
|
147
|
+
{col('created', 'Created', 'pl-2', PHONE_HIDDEN_KOLBOX)}
|
|
148
|
+
{col('active', 'Active in file', 'pl-2', PHONE_HIDDEN_KOLBOX)}
|
|
149
|
+
{actions && col('size', 'Size')}
|
|
150
|
+
{actions && <span role="columnheader" aria-label="Actions" />}
|
|
151
|
+
</div>
|
|
152
|
+
)
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
function TableRowKolbox({ file, onOpen, actions = false, onStar, onSettings, onRemove, onMenu }) {
|
|
156
|
+
const stop = (fn) => (e) => { e.stopPropagation(); fn(file, e) }
|
|
157
|
+
return (
|
|
158
|
+
<div
|
|
159
|
+
role="row"
|
|
160
|
+
tabIndex={0}
|
|
161
|
+
aria-label={file.name}
|
|
162
|
+
onDoubleClick={() => onOpen?.(file)}
|
|
163
|
+
onKeyDown={(e) => { if (e.key === 'Enter' && e.target === e.currentTarget) onOpen?.(file) }}
|
|
164
|
+
onContextMenu={onMenu ? (e) => { e.preventDefault(); onMenu(file, e) } : undefined}
|
|
165
|
+
className={`kol-table-row ${actions ? FILE_COLS_ACTIONS_KOLBOX : FILE_COLS_KOLBOX} h-12 shrink-0 cursor-default outline-none`}
|
|
166
|
+
data-file-row={file.id}
|
|
167
|
+
>
|
|
168
|
+
<span role="cell" className="flex items-center justify-center">
|
|
169
|
+
{onStar && <Tooltip variant="kolbox" label={file.starred ? 'Unstar' : 'Star'}><Button variant="kolbox" iconOnly="star" aria-label="Star" pressed={!!file.starred} onClick={stop(onStar)} onDoubleClick={(e) => e.stopPropagation()} /></Tooltip>}
|
|
170
|
+
</span>
|
|
171
|
+
<span role="cell" className="flex min-w-0 items-center gap-3 pl-2">
|
|
172
|
+
<KolboxGlyph name={file.icon ?? 'file'} className="kol-table-icon" />
|
|
173
|
+
<span className="kol-table-name truncate">{file.name}</span>
|
|
174
|
+
</span>
|
|
175
|
+
<span role="cell" className="flex min-w-0 items-center pl-2"><span className="truncate">{fileAgo(file.modified)}</span></span>
|
|
176
|
+
<span role="cell" className={`flex min-w-0 items-center pl-2 ${PHONE_HIDDEN_KOLBOX}`}><span className="truncate">{fileAgo(file.created)}</span></span>
|
|
177
|
+
<span role="cell" className={PHONE_HIDDEN_KOLBOX} />
|
|
178
|
+
{actions && <span role="cell" className="kol-table-size flex items-center pl-2">{file.size}</span>}
|
|
179
|
+
{actions && (
|
|
180
|
+
<span role="cell" className="flex items-center justify-end" onDoubleClick={(e) => e.stopPropagation()}>
|
|
181
|
+
{onSettings && <Tooltip variant="kolbox" label="Settings"><Button variant="kolbox" iconOnly="settings-01" aria-label="Settings" onClick={stop(onSettings)} /></Tooltip>}
|
|
182
|
+
{onRemove && <Tooltip variant="kolbox" label="Delete"><Button variant="kolbox" iconOnly="trash" aria-label="Delete" onClick={stop(onRemove)} /></Tooltip>}
|
|
183
|
+
</span>
|
|
184
|
+
)}
|
|
185
|
+
</div>
|
|
186
|
+
)
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/* Folio on kolbox (2026-11-22): `columns` ({ header, width?, phone?, render(row) }, Table folio's words) draws the
|
|
190
|
+
caller's own columns in kolbox's head and rows: the same 40 head and 48 rows, the 33 gutter and the 32 inset, a column
|
|
191
|
+
with no `width` taking the rest, `phone: false` giving way under 768. `rowKey(row)` keys a row (default `row.id`).
|
|
192
|
+
Without `columns` the file list draws as before. */
|
|
193
|
+
function TableKolboxColumns({ columns, rows, rowKey = (r) => r.id, onOpen, className }) {
|
|
194
|
+
const track = (list) => ['33px', ...list.map((c) => (c.width ? `${c.width}px` : 'minmax(0,1fr)'))].join(' ')
|
|
195
|
+
const phone = columns.filter((c) => c.phone !== false)
|
|
196
|
+
const grid = 'grid grid-cols-(--kol-table-cols) gap-x-2 pr-8 max-md:grid-cols-(--kol-table-cols-phone) max-md:pr-4'
|
|
197
|
+
const hide = (c) => (c.phone === false ? 'max-md:hidden' : '')
|
|
198
|
+
return (
|
|
199
|
+
<div role="table" className={`kol-table--kolbox min-h-0 flex-1 overflow-y-auto pt-5 max-md:flex-none max-md:overflow-visible ${className}`.trim()} style={{ '--kol-table-cols': track(columns), '--kol-table-cols-phone': track(phone) }} data-file-list>
|
|
200
|
+
<div role="row" className={`kol-table-head ${grid} h-10 shrink-0 items-center`} data-file-list-header>
|
|
201
|
+
<span role="columnheader" aria-hidden />
|
|
202
|
+
{columns.map((c, i) => <span key={i} role="columnheader" className={`truncate ${hide(c)}`}>{c.header}</span>)}
|
|
203
|
+
</div>
|
|
204
|
+
{rows.map((row) => (
|
|
205
|
+
<div key={rowKey(row)} role="row" tabIndex={0} onDoubleClick={() => onOpen?.(row)} onKeyDown={(e) => { if (e.key === 'Enter' && e.target === e.currentTarget) onOpen?.(row) }}
|
|
206
|
+
className={`kol-table-row ${grid} h-12 shrink-0 cursor-default items-center outline-none`} data-file-row={rowKey(row)}>
|
|
207
|
+
<span role="cell" aria-hidden />
|
|
208
|
+
{columns.map((c, i) => <span key={i} role="cell" className={`flex min-w-0 items-center ${hide(c)}`}>{c.render(row)}</span>)}
|
|
209
|
+
</div>
|
|
210
|
+
))}
|
|
211
|
+
</div>
|
|
212
|
+
)
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
function TableKolbox({ rows = [], sort, columns, rowKey, onOpen, onStar, onSettings, onRemove, onMenu, className = '' }) {
|
|
216
|
+
if (columns) return <TableKolboxColumns columns={columns} rows={rows} rowKey={rowKey} onOpen={onOpen} className={className} />
|
|
217
|
+
const actions = !!(onSettings || onRemove)
|
|
218
|
+
return (
|
|
219
|
+
<div role="table" className={`kol-table--kolbox min-h-0 flex-1 overflow-y-auto pt-5 max-md:flex-none max-md:overflow-visible max-md:pb-28 ${className}`.trim()} data-file-list>
|
|
220
|
+
<TableHeadKolbox sort={sort} actions={actions} />
|
|
221
|
+
{rows.map((f) => <TableRowKolbox key={f.id} file={f} onOpen={onOpen} actions={actions} onStar={onStar} onSettings={onSettings} onRemove={onRemove} onMenu={onMenu} />)}
|
|
161
222
|
</div>
|
|
162
223
|
)
|
|
163
224
|
}
|
|
164
225
|
|
|
226
|
+
/* ── folio (Folio batch E, 2026-11-22) ─────────────────────────────────────────────────────────────────────────────
|
|
227
|
+
* Folio's table of books, carried from apps/folio's FolioShelf ("All books"): the head row 34 high in Folio's label
|
|
228
|
+
* type, muted, over a 2px rule in the ink; one row per book 70 high on a hairline, lit on hover, the whole row a link;
|
|
229
|
+
* columns 20 apart and a trailing arrow. Table's words: `columns` ({ header, width?, render(row) }: a column with no
|
|
230
|
+
* `width` takes the rest; `render` draws the whole cell, its own width with it) and `rows`. Folio's own: `rowKey(row)`,
|
|
231
|
+
* `rowHref(row)` with `linkComponent` (a router's Link; default `a`), and `empty` (the node drawn when there are no
|
|
232
|
+
* rows). */
|
|
233
|
+
function TableFolio({ columns = [], rows = [], rowKey = (r) => r.id, rowHref, linkComponent: L = 'a', empty, className = '' }) {
|
|
234
|
+
return (
|
|
235
|
+
<div className={`kol-table--folio flex flex-col ${className}`.trim()}>
|
|
236
|
+
<div className="kol-folio-label kol-table-head flex h-[34px] items-center gap-[20px] border-b-2">
|
|
237
|
+
{columns.map((c, i) => <p key={i} className={c.width ? 'shrink-0' : 'min-w-0 flex-1'} style={c.width ? { width: c.width } : undefined}>{c.header}</p>)}
|
|
238
|
+
<span className="w-[18px] shrink-0" />
|
|
239
|
+
</div>
|
|
240
|
+
{rows.map((row) => {
|
|
241
|
+
const href = rowHref?.(row)
|
|
242
|
+
return (
|
|
243
|
+
<L key={rowKey(row)} {...(L === 'a' ? { href } : { to: href })} className="kol-table-row group flex h-[70px] items-center gap-[20px] border-b">
|
|
244
|
+
{columns.map((c, i) => <Fragment key={i}>{c.render(row)}</Fragment>)}
|
|
245
|
+
<span className="kol-table-arrow shrink-0"><IconLoader name="arrow-right" size={18} /></span>
|
|
246
|
+
</L>
|
|
247
|
+
)
|
|
248
|
+
})}
|
|
249
|
+
{rows.length === 0 && empty}
|
|
250
|
+
</div>
|
|
251
|
+
)
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
const Table = (props) => (props.variant === 'folio' ? <TableFolio {...props} /> : props.variant === 'kolbox' ? <TableKolbox {...props} /> : <TableDefault {...props} />)
|
|
255
|
+
|
|
165
256
|
export default Table
|
|
@@ -2,6 +2,8 @@ import { useRef, useState } from 'react'
|
|
|
2
2
|
import Input from '../atoms/Input.jsx'
|
|
3
3
|
import Dropdown from '../molecules/Dropdown.jsx'
|
|
4
4
|
import { Tooltip } from '../utilities/Popover.jsx'
|
|
5
|
+
import Button from '../atoms/Button.jsx'
|
|
6
|
+
import KolboxGlyph from '../utilities/kolboxGlyph.jsx'
|
|
5
7
|
|
|
6
8
|
/* The six easings the key editor offers. The CURVES stay the consumer's
|
|
7
9
|
* (its interpolator resolves the name); this is the menu, not the math. */
|
|
@@ -239,7 +241,7 @@ function SelectedKeyEditor({ tracks, selected, setSelected, writeKeys, easingOpt
|
|
|
239
241
|
* @param {Array<{value: string, label: string}>} [easingOptions] - The key editor's easing menu (default: `TIMELINE_EASINGS`)
|
|
240
242
|
* @param {string} [className] - Extra classes on the dock
|
|
241
243
|
*/
|
|
242
|
-
|
|
244
|
+
function TimelineDockDefault({ tracks = [], t = 0, onSeek, onChange, easingOptions = TIMELINE_EASINGS, className = '' }) {
|
|
243
245
|
const [selected, setSelected] = useState(null) /* { trackId, index } */
|
|
244
246
|
|
|
245
247
|
if (tracks.length === 0) return null
|
|
@@ -259,3 +261,281 @@ export default function TimelineDock({ tracks = [], t = 0, onSeek, onChange, eas
|
|
|
259
261
|
</div>
|
|
260
262
|
)
|
|
261
263
|
}
|
|
264
|
+
|
|
265
|
+
/* ── kolbox (plan-2026-11-18-kolbox-system W31.2 batch 5, 2026-11-18) ─────────────────────────────────────────────────
|
|
266
|
+
* kolbox's MotionTimeline (Figma plan W15; the real Timeline's parts), carried from apps/kolbox/src/ui/MotionTimeline.jsx.
|
|
267
|
+
* Draws itself only, the full width of its container, 200 high (480 expanded: `--kol-kolbox-timeline-h`, `-expanded`).
|
|
268
|
+
* Header: play, Add a key at the head, the time as seconds and milliseconds, loop; the document's `title` and its layer
|
|
269
|
+
* `count`; at the right Keyframes, Fit the loop, the zoom (100, 200, 400 %), Expand; the panel toggle (`onClose`).
|
|
270
|
+
* Under it the ruler, "Layers" over the names. Body: a row per track, its name column and its lane (the clip, the keys).
|
|
271
|
+
* Its data is kolbox's, in seconds, not the default look's 0..1 keys (the batch file's table): `tracks` [{ id, name,
|
|
272
|
+
* keyframes: [t | { t, label }], icon, visible, locked, selected, sub, under, clip }], `time`, `duration`. The ruler's
|
|
273
|
+
* press or drag is `onSeek(time)`; the rest of kolbox's callbacks are kept (onPlay, onLoop, onAddKeyframe, onKeyframe,
|
|
274
|
+
* onSelect, onToggleVisible, onToggleLock, onClose, onLaneAdd, onKeyMove, onKeyDelete). A track's `icon` is the set's
|
|
275
|
+
* name. */
|
|
276
|
+
const clampK = (v, lo, hi) => Math.min(hi, Math.max(lo, v))
|
|
277
|
+
/* the real Timeline's zoom steps: the loop at 100 %, a span of it at 200 and 400 % that follows the head */
|
|
278
|
+
const ZOOMS_KOLBOX = [1, 2, 4]
|
|
279
|
+
|
|
280
|
+
/* a segment of the joined time field: the value mono 12, its unit muted, 2 apart, padding 8; commits on Enter or blur */
|
|
281
|
+
function TimeCellKolbox({ value, unit, label, onCommit }) {
|
|
282
|
+
return (
|
|
283
|
+
<label className="kol-timeline-time-cell flex shrink-0 items-center gap-0.5 px-2" data-time-segment={unit}>
|
|
284
|
+
<input
|
|
285
|
+
key={value}
|
|
286
|
+
aria-label={label}
|
|
287
|
+
defaultValue={value}
|
|
288
|
+
className="field-sizing-content min-w-0 bg-transparent outline-none"
|
|
289
|
+
onBlur={(e) => {
|
|
290
|
+
const n = parseFloat(e.target.value)
|
|
291
|
+
if (Number.isFinite(n)) onCommit(n)
|
|
292
|
+
else e.target.value = value
|
|
293
|
+
}}
|
|
294
|
+
onKeyDown={(e) => e.key === 'Enter' && e.currentTarget.blur()}
|
|
295
|
+
/>
|
|
296
|
+
<span>{unit}</span>
|
|
297
|
+
</label>
|
|
298
|
+
)
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
/* a row's eye or lock: 20 square, a 12 glyph; always drawn, as the real ones */
|
|
302
|
+
function RowToggleKolbox({ icon, label, on, onClick }) {
|
|
303
|
+
return (
|
|
304
|
+
<button
|
|
305
|
+
type="button"
|
|
306
|
+
aria-label={label}
|
|
307
|
+
aria-pressed={on}
|
|
308
|
+
onClick={(e) => { e.stopPropagation(); onClick?.() }}
|
|
309
|
+
className={`kol-timeline-toggle${on ? ' is-on' : ''} flex size-5 shrink-0 items-center justify-center outline-none focus-visible:outline-solid focus-visible:outline-1`}
|
|
310
|
+
>
|
|
311
|
+
<KolboxGlyph name={icon} size={12} />
|
|
312
|
+
</button>
|
|
313
|
+
)
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
function TimelineKolbox({
|
|
317
|
+
tracks = [], time = 0, duration = 12, playing = false, loop = false, title, count,
|
|
318
|
+
onSeek, onPlay, onLoop, onAddKeyframe, onKeyframe, onSelect, onToggleVisible, onToggleLock, onClose,
|
|
319
|
+
onLaneAdd, onKeyMove, onKeyDelete, className = '',
|
|
320
|
+
}) {
|
|
321
|
+
const ruler = useRef(null)
|
|
322
|
+
const lanes = useRef(null)
|
|
323
|
+
/* a key's drag, held here and committed once on release: { track, index, t } */
|
|
324
|
+
const [drag, setDrag] = useState(null)
|
|
325
|
+
const [zoom, setZoom] = useState(1)
|
|
326
|
+
const [expanded, setExpanded] = useState(false)
|
|
327
|
+
const [folded, setFolded] = useState(() => new Set())
|
|
328
|
+
|
|
329
|
+
/* the window over the loop: the whole loop at 100 %, else a span that follows the head */
|
|
330
|
+
const span = duration / zoom
|
|
331
|
+
const origin = zoom === 1 ? 0 : clampK(time - span / 2, 0, duration - span)
|
|
332
|
+
const X = (t) => (t - origin) / span
|
|
333
|
+
const pct = (t) => `${clampK(X(t), 0, 1) * 100}%`
|
|
334
|
+
const scrub = (e) => {
|
|
335
|
+
const r = ruler.current.getBoundingClientRect()
|
|
336
|
+
onSeek?.(origin + clampK((e.clientX - r.left) / r.width, 0, 1) * span)
|
|
337
|
+
}
|
|
338
|
+
const seconds = Math.floor(time)
|
|
339
|
+
const ms = Math.round((time - seconds) * 1000)
|
|
340
|
+
const step = span < 4 ? 1 : 2
|
|
341
|
+
const ticks = []
|
|
342
|
+
for (let t = Math.ceil(origin / step) * step; t <= origin + span + 1e-9; t += step) ticks.push(t)
|
|
343
|
+
const headIn = X(time) >= 0 && X(time) <= 1
|
|
344
|
+
const timeAt = (e) => { const r = lanes.current.getBoundingClientRect(); return origin + clampK((e.clientX - r.left) / r.width, 0, 1) * span }
|
|
345
|
+
|
|
346
|
+
const folds = new Set(tracks.filter((t) => t.under).map((t) => t.under))
|
|
347
|
+
const rows = tracks.filter((t) => !(t.under && folded.has(t.under)))
|
|
348
|
+
const fold = (id) => setFolded((s) => { const n = new Set(s); if (n.has(id)) n.delete(id); else n.add(id); return n })
|
|
349
|
+
|
|
350
|
+
return (
|
|
351
|
+
<div data-kol-timeline data-expanded={expanded || undefined} className={`kol-timeline--kolbox${expanded ? ' is-expanded' : ''} flex w-full flex-col border-t ${className}`.trim()}>
|
|
352
|
+
<div className="kol-timeline-line flex shrink-0 border-b">
|
|
353
|
+
<div className="kol-timeline-names kol-timeline-line flex shrink-0 items-center gap-1 border-r p-2">
|
|
354
|
+
<Button variant="kolbox" iconOnly={playing ? 'pause' : 'play'} aria-label={playing ? 'Pause' : 'Play'} onClick={() => onPlay?.(!playing)} />
|
|
355
|
+
{onAddKeyframe ? <Button variant="kolbox" iconOnly="diamond" aria-label="Add a key at the head" onClick={() => onAddKeyframe(time)} />
|
|
356
|
+
: <Tooltip variant="kolbox" label="Select a layer to key"><Button variant="kolbox" iconOnly="diamond" aria-label="Add a key at the head" disabled /></Tooltip>}
|
|
357
|
+
<div className="kol-timeline-time flex h-(--kol-kolbox-ctl) shrink-0 items-stretch focus-within:outline-1 focus-within:-outline-offset-1" data-time-field>
|
|
358
|
+
<TimeCellKolbox value={seconds} unit="s" label="Seconds" onCommit={(n) => onSeek?.(clampK(n + ms / 1000, 0, duration))} />
|
|
359
|
+
<span className="kol-timeline-time-rule w-px shrink-0" />
|
|
360
|
+
<TimeCellKolbox value={ms} unit="ms" label="Milliseconds" onCommit={(n) => onSeek?.(clampK(seconds + n / 1000, 0, duration))} />
|
|
361
|
+
</div>
|
|
362
|
+
<Button variant="kolbox" iconOnly="repeat" aria-label={loop ? 'Loop off' : 'Loop on'} pressed={loop} onClick={() => onLoop?.(!loop)} />
|
|
363
|
+
</div>
|
|
364
|
+
<div className="flex min-w-0 flex-1 items-center gap-2 px-4" data-timeline-toolbar>
|
|
365
|
+
{title != null && (
|
|
366
|
+
<>
|
|
367
|
+
<KolboxGlyph name="layers" className="kol-timeline-muted" />
|
|
368
|
+
<span className="kol-timeline-title min-w-0 truncate">{title}</span>
|
|
369
|
+
{count != null && <span className="kol-timeline-meta kol-timeline-mono shrink-0">{count} {count === 1 ? 'layer' : 'layers'}</span>}
|
|
370
|
+
</>
|
|
371
|
+
)}
|
|
372
|
+
<span className="kol-timeline-label ml-auto">Keyframes</span>
|
|
373
|
+
{zoom !== 1 ? <Button variant="kolbox" iconOnly="cap-round" aria-label="Fit the loop" onClick={() => setZoom(1)} />
|
|
374
|
+
: <Tooltip variant="kolbox" label="The whole loop is in view"><Button variant="kolbox" iconOnly="cap-round" aria-label="Fit the loop" disabled /></Tooltip>}
|
|
375
|
+
<button
|
|
376
|
+
type="button"
|
|
377
|
+
aria-label="Zoom the lanes"
|
|
378
|
+
onClick={() => setZoom(ZOOMS_KOLBOX[(ZOOMS_KOLBOX.indexOf(zoom) + 1) % ZOOMS_KOLBOX.length])}
|
|
379
|
+
className="kol-timeline-zoom h-(--kol-kolbox-ctl) shrink-0 px-1 tabular-nums outline-none focus-visible:outline-solid focus-visible:outline-1"
|
|
380
|
+
>
|
|
381
|
+
{zoom * 100}%
|
|
382
|
+
</button>
|
|
383
|
+
<Button variant="kolbox" iconOnly="nav-create" aria-label={expanded ? 'Fit the timeline to its lanes' : 'Expand the timeline'} pressed={expanded} onClick={() => setExpanded(!expanded)} />
|
|
384
|
+
</div>
|
|
385
|
+
<div className="kol-timeline-line flex w-11 shrink-0 items-center justify-center border-l">
|
|
386
|
+
<Button variant="kolbox" iconOnly="panel-bottom" aria-label="Timeline" onClick={onClose} />
|
|
387
|
+
</div>
|
|
388
|
+
</div>
|
|
389
|
+
{/* the ruler: Layers over the names, the seconds over the lanes; a press or a drag on it moves the head */}
|
|
390
|
+
<div className="kol-timeline-line flex h-6 shrink-0 border-b">
|
|
391
|
+
<div className="kol-timeline-names kol-timeline-line kol-timeline-meta flex shrink-0 items-center border-r px-4">Layers</div>
|
|
392
|
+
<div
|
|
393
|
+
className="relative min-w-0 flex-1 cursor-ew-resize touch-none px-4 select-none"
|
|
394
|
+
onPointerDown={(e) => {
|
|
395
|
+
e.currentTarget.setPointerCapture(e.pointerId)
|
|
396
|
+
scrub(e)
|
|
397
|
+
}}
|
|
398
|
+
onPointerMove={(e) => e.currentTarget.hasPointerCapture(e.pointerId) && scrub(e)}
|
|
399
|
+
>
|
|
400
|
+
<div ref={ruler} className="relative h-full">
|
|
401
|
+
{ticks.map((t) => (
|
|
402
|
+
<div key={t} className="absolute inset-y-0 flex flex-col items-start" style={{ left: pct(t) }}>
|
|
403
|
+
<span className="kol-timeline-tick h-1.5 w-px" />
|
|
404
|
+
<span className="kol-timeline-meta kol-timeline-mono -translate-x-1/2">{t}s</span>
|
|
405
|
+
</div>
|
|
406
|
+
))}
|
|
407
|
+
{headIn && (
|
|
408
|
+
<div data-kol-playhead className="absolute inset-y-0 flex -translate-x-1/2 flex-col items-center" style={{ left: pct(time) }}>
|
|
409
|
+
<span className="kol-timeline-head h-4 w-2 rounded-full" />
|
|
410
|
+
<span className="kol-timeline-head w-px flex-1" />
|
|
411
|
+
</div>
|
|
412
|
+
)}
|
|
413
|
+
</div>
|
|
414
|
+
</div>
|
|
415
|
+
<div className="kol-timeline-line w-11 shrink-0 border-l" />
|
|
416
|
+
</div>
|
|
417
|
+
<div className="min-h-0 flex-1 overflow-y-auto">
|
|
418
|
+
<div className="flex min-h-full">
|
|
419
|
+
<div className="kol-timeline-names kol-timeline-line shrink-0 border-r px-2 py-1">
|
|
420
|
+
{rows.map((t) => (
|
|
421
|
+
<div
|
|
422
|
+
key={t.id}
|
|
423
|
+
data-timeline-row={t.id}
|
|
424
|
+
aria-current={t.selected || undefined}
|
|
425
|
+
onClick={onSelect && !t.sub ? () => onSelect(t) : undefined}
|
|
426
|
+
className={`kol-timeline-row${t.selected ? ' is-selected' : ''} flex h-7 items-center gap-2 rounded-sm px-2 ${t.sub ? 'pl-8' : ''} ${onSelect && !t.sub ? 'cursor-pointer' : ''}`}
|
|
427
|
+
>
|
|
428
|
+
{t.icon && !t.sub && <KolboxGlyph name={t.icon} className="kol-timeline-muted" />}
|
|
429
|
+
<span className={`kol-timeline-name${t.sub ? ' is-sub' : ''} min-w-0 flex-1 truncate`}>{t.name}</span>
|
|
430
|
+
{folds.has(t.id) && (
|
|
431
|
+
<Button variant="kolbox"
|
|
432
|
+
iconOnly={folded.has(t.id) ? 'chevron-right' : 'chevron-down'}
|
|
433
|
+
aria-label={folded.has(t.id) ? 'Show the morph’s tracks' : 'Hide the morph’s tracks'}
|
|
434
|
+
onClick={(e) => { e.stopPropagation(); fold(t.id) }}
|
|
435
|
+
className="size-5!"
|
|
436
|
+
/>
|
|
437
|
+
)}
|
|
438
|
+
{t.visible !== undefined && <RowToggleKolbox icon={t.visible ? 'eye-on' : 'eye-off'} label={t.visible ? 'Hide layer' : 'Show layer'} on={false} onClick={() => onToggleVisible?.(t)} />}
|
|
439
|
+
{t.locked !== undefined && <RowToggleKolbox icon={t.locked ? 'lock' : 'unlock'} label={t.locked ? 'Unlock layer' : 'Lock layer'} on={t.locked} onClick={() => onToggleLock?.(t)} />}
|
|
440
|
+
</div>
|
|
441
|
+
))}
|
|
442
|
+
</div>
|
|
443
|
+
<div className="kol-timeline-ground relative min-w-0 flex-1 px-4 py-1">
|
|
444
|
+
<div ref={lanes} className="relative h-full overflow-hidden">
|
|
445
|
+
{rows.map((t) => {
|
|
446
|
+
const empty = t.keyframes.length === 0
|
|
447
|
+
const clip = t.clip ?? (empty ? `${duration.toFixed(2)} s` : null)
|
|
448
|
+
return (
|
|
449
|
+
<div key={t.id} className={`relative h-7 ${onLaneAdd && !empty ? 'cursor-copy' : ''}`}
|
|
450
|
+
onPointerDown={onLaneAdd && !empty ? (e) => { if (!e.target.closest('[data-keyframe],[data-keyframe-label]')) onLaneAdd(t, timeAt(e)) } : undefined}>
|
|
451
|
+
{/* the clip: the loop's length on the lane, its name at its left; lit with the row */}
|
|
452
|
+
<div
|
|
453
|
+
data-clip
|
|
454
|
+
className={`kol-timeline-clip${t.selected ? ' is-selected' : ''} absolute inset-y-0.5 rounded-sm`}
|
|
455
|
+
style={{ left: `${X(0) * 100}%`, width: `${(X(duration) - X(0)) * 100}%` }}
|
|
456
|
+
>
|
|
457
|
+
{clip && <span className={`kol-timeline-meta pointer-events-none absolute top-1/2 left-2.5 -translate-y-1/2 whitespace-nowrap${t.clip == null ? ' kol-timeline-mono' : ''}`}>{clip}</span>}
|
|
458
|
+
</div>
|
|
459
|
+
{t.keyframes.map((key, i) => {
|
|
460
|
+
const k0 = typeof key === 'number' ? { t: key } : key
|
|
461
|
+
const k = drag?.track === t.id && drag.index === i ? { ...k0, t: drag.t } : k0
|
|
462
|
+
const last = i === t.keyframes.length - 1 && k.t > duration / 2
|
|
463
|
+
return (
|
|
464
|
+
<span key={i}>
|
|
465
|
+
<span data-keyframe className="kol-timeline-key absolute top-1/2 size-2 -translate-1/2 rotate-45" style={{ left: `clamp(var(--kol-spacing-1), ${X(k.t) * 100}%, 100% - var(--kol-spacing-1))` }}
|
|
466
|
+
onPointerDown={(onKeyMove || onKeyDelete) ? (e) => {
|
|
467
|
+
e.stopPropagation()
|
|
468
|
+
if (e.altKey) { onKeyDelete?.(t, i); return }
|
|
469
|
+
if (!onKeyMove) return
|
|
470
|
+
e.currentTarget.setPointerCapture(e.pointerId)
|
|
471
|
+
setDrag({ track: t.id, index: i, t: k0.t, from: k0.t })
|
|
472
|
+
} : undefined}
|
|
473
|
+
onPointerMove={drag?.track === t.id && drag.index === i ? (e) => setDrag({ ...drag, t: timeAt(e) }) : undefined}
|
|
474
|
+
onPointerUp={drag?.track === t.id && drag.index === i ? () => { if (drag.t !== drag.from) onKeyMove(t, i, drag.t); setDrag(null) } : undefined} />
|
|
475
|
+
{/* a key's label after its diamond (the last one before it); pressing it calls onKeyframe */}
|
|
476
|
+
{k.label && (
|
|
477
|
+
<button
|
|
478
|
+
type="button"
|
|
479
|
+
data-keyframe-label
|
|
480
|
+
aria-label={`Edit step ${k.label}`}
|
|
481
|
+
onClick={() => onKeyframe?.(t, i, k)}
|
|
482
|
+
className="kol-timeline-meta kol-timeline-keylabel absolute inset-y-0 truncate"
|
|
483
|
+
style={last
|
|
484
|
+
? { right: `calc(${(1 - clampK(X(k.t), 0, 1)) * 100}% + var(--kol-spacing-2))`, maxWidth: `${100 / t.keyframes.length}%` }
|
|
485
|
+
: { left: `calc(${clampK(X(k.t), 0, 1) * 100}% + var(--kol-spacing-2))`, maxWidth: `${100 / t.keyframes.length}%` }}
|
|
486
|
+
>
|
|
487
|
+
{k.label}
|
|
488
|
+
</button>
|
|
489
|
+
)}
|
|
490
|
+
</span>
|
|
491
|
+
)
|
|
492
|
+
})}
|
|
493
|
+
</div>
|
|
494
|
+
)
|
|
495
|
+
})}
|
|
496
|
+
{headIn && <span className="kol-timeline-head pointer-events-none absolute inset-y-0 w-px -translate-x-1/2" style={{ left: pct(time) }} />}
|
|
497
|
+
</div>
|
|
498
|
+
</div>
|
|
499
|
+
<div className="kol-timeline-ground w-11 shrink-0" />
|
|
500
|
+
</div>
|
|
501
|
+
</div>
|
|
502
|
+
</div>
|
|
503
|
+
)
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
/* ── folio (Folio migration batch D, 2026-11-22) ──────────────────────────────────────────────────────────────────────
|
|
507
|
+
* Folio's Timeline, carried from apps/folio's EditorChrome.jsx: the default dock's frame, padded 8 by 16 under a rule,
|
|
508
|
+
* the names in a 120 column, a 16 ruler and 20 lanes at radius 4, keys 9 diamonds, the playhead 1.5; Folio's inks (the
|
|
509
|
+
* rule, the surface lanes, the ink keys, the green head, the muted time and names). Display only: no key editing. The
|
|
510
|
+
* default's words, `tracks`, `t` (0..1) and `onSeek(t)`; a track's `keys` are Folio's, plain positions 0..1 (the
|
|
511
|
+
* default's are `{ t, v }`). */
|
|
512
|
+
function TimelineFolio({ tracks = [], t = 0, onSeek, className = '' }) {
|
|
513
|
+
const seek = (e) => {
|
|
514
|
+
const r = e.currentTarget.getBoundingClientRect()
|
|
515
|
+
onSeek?.(Math.min(1, Math.max(0, (e.clientX - r.left) / r.width)))
|
|
516
|
+
}
|
|
517
|
+
const head = <span aria-hidden className="kol-timeline-head absolute inset-y-0 w-[1.5px]" style={{ left: `${t * 100}%` }} />
|
|
518
|
+
return (
|
|
519
|
+
<div className={`kol-timeline--folio flex select-none flex-col gap-[4px] border-t px-[16px] py-[8px] ${className}`.trim()}>
|
|
520
|
+
<div className="flex items-center gap-[12px]">
|
|
521
|
+
<span className="kol-timeline-time w-[120px] shrink-0 text-right tabular-nums">{t.toFixed(2)}</span>
|
|
522
|
+
<div role="slider" aria-label="Time" aria-valuemin={0} aria-valuemax={1} aria-valuenow={t} className="kol-timeline-lane relative h-[16px] flex-1 cursor-ew-resize rounded-[4px]"
|
|
523
|
+
onPointerDown={(e) => { e.currentTarget.setPointerCapture(e.pointerId); seek(e) }} onPointerMove={(e) => e.buttons && seek(e)}>{head}</div>
|
|
524
|
+
</div>
|
|
525
|
+
{tracks.map((tr) => (
|
|
526
|
+
<div key={tr.id} className="flex items-center gap-[12px]">
|
|
527
|
+
<span title={tr.label} className="kol-timeline-name w-[120px] shrink-0 truncate text-right">{tr.label}</span>
|
|
528
|
+
<div className="kol-timeline-lane relative h-[20px] flex-1 rounded-[4px]">
|
|
529
|
+
{head}
|
|
530
|
+
{tr.keys.map((k) => <span key={k} aria-hidden className="kol-timeline-key absolute top-1/2 size-[9px] -translate-x-1/2 -translate-y-1/2 rotate-45 rounded-[1.5px]" style={{ left: `${k * 100}%` }} />)}
|
|
531
|
+
</div>
|
|
532
|
+
</div>
|
|
533
|
+
))}
|
|
534
|
+
</div>
|
|
535
|
+
)
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
export default function TimelineDock(props) {
|
|
539
|
+
if (props.variant === 'folio') return <TimelineFolio {...props} />
|
|
540
|
+
return props.variant === 'kolbox' ? <TimelineKolbox {...props} /> : <TimelineDockDefault {...props} />
|
|
541
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react'
|
|
2
|
+
import { KeylineGuide } from '../atoms/IconPlate.jsx'
|
|
3
|
+
|
|
4
|
+
/* What LogoSystem and LogoTuner share (from apps/tuner, W27.4 2026-11-19): the board, the keylines on it, the labels,
|
|
5
|
+
* the ground the keylines are drawn on. The board is the Line Swell canvas's 1200 x 800 frame with its origin at the
|
|
6
|
+
* centre; it scales to its box and keeps its ratio. Its inks are `.kol-logo-*` rules in kol-components-organisms.css. */
|
|
7
|
+
|
|
8
|
+
/* which ground the keylines sit on: the page's data-theme, followed on a flip */
|
|
9
|
+
export function useLight() {
|
|
10
|
+
const read = () => document.documentElement.dataset.theme === 'light'
|
|
11
|
+
const [light, setLight] = useState(read)
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
const o = new MutationObserver(() => setLight(read()))
|
|
14
|
+
o.observe(document.documentElement, { attributes: true, attributeFilter: ['data-theme'] })
|
|
15
|
+
return () => o.disconnect()
|
|
16
|
+
}, [])
|
|
17
|
+
return light
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/* the 24-unit keylines from KeylineGuide, laid on the board at `box` around (ox, oy) */
|
|
21
|
+
export function Keylines({ box, ox = 0, oy = 0, light }) {
|
|
22
|
+
return (
|
|
23
|
+
<foreignObject x={ox - box / 2} y={oy - box / 2} width={box} height={box} pointerEvents="none">
|
|
24
|
+
<div style={{ position: 'relative', width: '100%', height: '100%' }}><KeylineGuide light={light} /></div>
|
|
25
|
+
</foreignObject>
|
|
26
|
+
)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/* the canvas's palettes (line-swell.js PALETTES), ink then ground; `custom` takes the settings' own ink and ground */
|
|
30
|
+
const PALETTES = {
|
|
31
|
+
'ink on paper': ['#111111', '#f4f4f4'], 'paper on ink': ['#ffffff', '#000000'], 'white on blue': ['#ffffff', '#0a1fff'],
|
|
32
|
+
'blue on paper': ['#0a1fff', '#f1f1f1'], 'red on ink': ['#e5303f', '#111111'], 'light on grey': ['#fafafa', '#35363a'],
|
|
33
|
+
}
|
|
34
|
+
/* the board's own inks when the settings carry a palette (as the canvas boards draw), else null: the theme's inks.
|
|
35
|
+
`light` says which keylines suit the ground (the engine's keylines rule: luminance over 128) */
|
|
36
|
+
export function inksOf(p) {
|
|
37
|
+
if (!p?.palette) return null
|
|
38
|
+
const pal = PALETTES[p.palette] ?? PALETTES['ink on paper'], custom = p.palette === 'custom'
|
|
39
|
+
const ink = custom ? (p.ink || pal[0]) : pal[0], ground = custom ? (p.ground || pal[1]) : pal[1]
|
|
40
|
+
const g = String(ground).replace('#', ''), lum = g.length === 6 ? parseInt(g.slice(0, 2), 16) * 0.299 + parseInt(g.slice(2, 4), 16) * 0.587 + parseInt(g.slice(4, 6), 16) * 0.114 : 255
|
|
41
|
+
return { ink, ground, light: lum > 128 }
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/* the board: the 1200 x 800 frame, centred and scaled to fit; `svgRef` reads pointer positions in board units.
|
|
45
|
+
`inks` (inksOf): the ground behind the board and the ink of its form, lines and labels; the grey form is the
|
|
46
|
+
canvas's #b3b3b3 there */
|
|
47
|
+
export function Board({ svgRef, label, inks = null, children }) {
|
|
48
|
+
return (
|
|
49
|
+
<svg ref={svgRef} viewBox="0 0 1200 800" preserveAspectRatio="xMidYMid meet" role="img" aria-label={label}
|
|
50
|
+
style={inks ? { '--kol-logo-ink': inks.ink, '--kol-logo-ground': inks.ground } : undefined}
|
|
51
|
+
className={`kol-logo-board block h-full w-full touch-none select-none${inks ? ' is-inked' : ''}`}>
|
|
52
|
+
<g transform="translate(600 400)">{children}</g>
|
|
53
|
+
</svg>
|
|
54
|
+
)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/* labels the engine places on the board, as text in board units so they scale with it; the canvas laid them as 15/16
|
|
58
|
+
* HTML with its top 13 above the point, so the baseline lands 1 above it */
|
|
59
|
+
export function Labels({ list }) {
|
|
60
|
+
return list.map((l, i) => <text key={i} x={l.x} y={l.y - 1} className="kol-logo-label" pointerEvents="none" xmlSpace="preserve">{l.t}</text>)
|
|
61
|
+
}
|
|
@@ -21,7 +21,7 @@ export default function AssetPlaceholder({
|
|
|
21
21
|
const label = [category, name].filter(Boolean).join(' · ')
|
|
22
22
|
return (
|
|
23
23
|
<div
|
|
24
|
-
className={`kol-asset-placeholder flex flex-col items-center justify-center gap-[6px] w-full p-6 border border-dashed border-[var(--kol-fg-24)] ${radius ? 'rounded-[var(--kol-radius-
|
|
24
|
+
className={`kol-asset-placeholder flex flex-col items-center justify-center gap-[6px] w-full p-6 border border-dashed border-[var(--kol-fg-24)] ${radius ? 'rounded-[var(--kol-radius-4)]' : ''} bg-[var(--kol-fg-02)] text-fg-48 font-mono text-center box-border ${className}`.trim()}
|
|
25
25
|
style={{ aspectRatio }}
|
|
26
26
|
role="img"
|
|
27
27
|
aria-label={`${label || 'asset'} — ${note}`}
|