@kolkrabbi/kol-component 0.378.0 → 0.379.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 +4 -3
- package/src/atoms/BezierPathEditor.jsx +1 -1
- package/src/atoms/Button.jsx +84 -1
- package/src/atoms/Figure.jsx +19 -1
- package/src/atoms/FunctionPlot.jsx +1 -1
- package/src/atoms/Input.jsx +105 -1
- package/src/atoms/Kbd.jsx +42 -2
- package/src/atoms/Link.jsx +20 -0
- package/src/atoms/OriginPicker.jsx +9 -5
- package/src/atoms/SectionFooter.jsx +22 -0
- package/src/atoms/SectionHeader.jsx +24 -0
- package/src/atoms/SizeOrDownload.jsx +1 -1
- package/src/atoms/Textarea.jsx +11 -2
- package/src/atoms/ToggleCheckbox.jsx +23 -1
- package/src/atoms/ToggleSwitch.jsx +39 -0
- package/src/atoms/ViewToggle.jsx +2 -2
- package/src/atoms/XYPad.jsx +25 -0
- package/src/hooks/useDragResize.js +1 -1
- package/src/index.js +26 -3
- package/src/molecules/AccountMenu.jsx +14 -1
- package/src/molecules/AlignmentGrid.jsx +13 -1
- package/src/molecules/ButtonGroup.jsx +73 -1
- package/src/molecules/ButtonSplit.jsx +64 -3
- 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 +3 -3
- package/src/molecules/DividerLabel.jsx +19 -0
- package/src/molecules/Dropdown.jsx +111 -1
- package/src/molecules/DropdownStepper.jsx +29 -0
- package/src/molecules/FieldPair.jsx +41 -2
- package/src/molecules/LabeledControl.jsx +51 -0
- package/src/molecules/Menu.jsx +239 -3
- package/src/molecules/Modal.jsx +214 -9
- package/src/molecules/ModalShell.jsx +18 -5
- package/src/molecules/OptionRow.jsx +1 -1
- package/src/molecules/ParamBindDot.jsx +29 -2
- package/src/molecules/QuantityInput.jsx +48 -0
- package/src/molecules/RailHeader.jsx +32 -2
- package/src/molecules/SectionText.jsx +54 -1
- package/src/molecules/Slider.jsx +101 -2
- 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 +35 -1
- package/src/molecules/Toast.jsx +55 -0
- package/src/molecules/TreeRow.jsx +87 -1
- 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 +396 -21
- 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 -1
- package/src/organisms/MediaLibraryPages.jsx +1 -1
- package/src/organisms/Rail.jsx +33 -1
- package/src/organisms/RailSwitcher.jsx +62 -0
- package/src/organisms/ReadingContents.jsx +63 -1
- package/src/organisms/SectionSplit.jsx +1 -1
- package/src/organisms/SettingsPanel.jsx +45 -1
- 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 +141 -2
- 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 +298 -2
- package/src/utilities/SelectionOverlay.jsx +74 -1
- package/src/utilities/kolboxGlyph.jsx +10 -0
|
@@ -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}`}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useRef } from 'react'
|
|
2
2
|
import Divider from '../atoms/Divider.jsx'
|
|
3
3
|
import useDragResize from '../hooks/useDragResize.js'
|
|
4
|
+
import useMediaQuery from '../hooks/useMediaQuery.js'
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* EditorShell — the two-rail editor layout frame.
|
|
@@ -63,7 +64,7 @@ import useDragResize from '../hooks/useDragResize.js'
|
|
|
63
64
|
* @param {string|number} height shell height (default '100dvh'; pass a bounded value to embed)
|
|
64
65
|
* @param {string} className extra classes merged onto the shell root
|
|
65
66
|
*/
|
|
66
|
-
|
|
67
|
+
function EditorShellDefault({
|
|
67
68
|
topbar,
|
|
68
69
|
leftHeader,
|
|
69
70
|
left,
|
|
@@ -179,3 +180,43 @@ function Rail({ side, header, footer, width, resizable, children }) {
|
|
|
179
180
|
</aside>
|
|
180
181
|
)
|
|
181
182
|
}
|
|
183
|
+
|
|
184
|
+
/* ── kolbox (plan-2026-11-18-kolbox-system W31.2 batch 5, 2026-11-18) ─────────────────────────────────────────────────
|
|
185
|
+
* kolbox's Shell (plan 3.1), carried from apps/kolbox/src/ui/Shell.jsx: `topbar`, then `left`, the canvas (children),
|
|
186
|
+
* `right`; no gutters, the regions' own edge lines shared, radius 12 on the outer shell only. The rails are fixed, the
|
|
187
|
+
* canvas flexes. `canvasFooter` (kolbox's timeline) floats over the canvas's foot, the canvas's width, under neither
|
|
188
|
+
* rail, out of the layout flow; `toolbar` (the tool dock or the transport) floats at the canvas's bottom centre, 12 above (Figma's, W3)
|
|
189
|
+
* its foot, and an open canvasFooter covers it. Under 768: the canvas on top, the canvasFooter under it (its lanes keep
|
|
190
|
+
* 768 and slide sideways), then both rails in one column at half the display, the right rail first. */
|
|
191
|
+
function EditorShellKolbox({ topbar, left, right, canvasFooter, toolbar, children, className = '' }) {
|
|
192
|
+
const phone = useMediaQuery('(max-width: 767px)')
|
|
193
|
+
const canvas = (
|
|
194
|
+
<main className="kol-editor-canvas--kolbox relative min-w-0 flex-1 overflow-hidden" data-canvas>
|
|
195
|
+
{children}
|
|
196
|
+
{toolbar && <div className="pointer-events-none absolute inset-x-0 bottom-0 z-10 flex justify-center pb-3 *:pointer-events-auto max-md:px-2" data-toolbar>{toolbar}</div>}
|
|
197
|
+
{canvasFooter && !phone && <div className="absolute inset-x-0 bottom-0 z-20" data-timeline>{canvasFooter}</div>}
|
|
198
|
+
</main>
|
|
199
|
+
)
|
|
200
|
+
return (
|
|
201
|
+
<div className={`kol-editor-shell--kolbox relative flex h-full flex-col overflow-hidden ${className}`.trim()} data-shell>
|
|
202
|
+
{topbar}
|
|
203
|
+
{phone ? (
|
|
204
|
+
<>
|
|
205
|
+
{canvas}
|
|
206
|
+
{canvasFooter && <div className="shrink-0 overflow-x-auto" data-timeline><div className="w-[768px]">{canvasFooter}</div></div>}
|
|
207
|
+
{(left || right) && <div className="h-[50dvh] shrink-0 overflow-y-auto" data-shell-rails>{right}{left}</div>}
|
|
208
|
+
</>
|
|
209
|
+
) : (
|
|
210
|
+
<div className="flex min-h-0 flex-1">
|
|
211
|
+
{left}
|
|
212
|
+
{canvas}
|
|
213
|
+
{right}
|
|
214
|
+
</div>
|
|
215
|
+
)}
|
|
216
|
+
</div>
|
|
217
|
+
)
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
export default function EditorShell(props) {
|
|
221
|
+
return props.variant === 'kolbox' ? <EditorShellKolbox {...props} /> : <EditorShellDefault {...props} />
|
|
222
|
+
}
|
|
@@ -31,7 +31,7 @@ export default function OverlayGlassPanel({
|
|
|
31
31
|
|
|
32
32
|
return (
|
|
33
33
|
<div
|
|
34
|
-
className={`flex flex-col ${alignCls} ${gap} rounded-[var(--kol-radius-
|
|
34
|
+
className={`flex flex-col ${alignCls} ${gap} rounded-[var(--kol-radius-2)] ${padding} ${maxWidth ? `${maxWidth} mx-auto` : ''} ${className}`.trim()}
|
|
35
35
|
style={{
|
|
36
36
|
backgroundColor: `color-mix(in srgb, var(--kol-surface-primary) ${surfaceOpacity}%, transparent)`,
|
|
37
37
|
/* a PANEL, not a scrim: the blur is this surface's whole point and the
|