@kolkrabbi/kol-component 0.340.1 → 0.341.1

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kolkrabbi/kol-component",
3
- "version": "0.340.1",
3
+ "version": "0.341.1",
4
4
  "description": "The core component library",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -0,0 +1,26 @@
1
+ import { useEffect, useRef, useState } from 'react'
2
+
3
+ /**
4
+ * useFloatPresence — keeps a float in the tree for `ms` after `open` goes false, so its leave can play
5
+ * (FloatActionStatesAndMotion, kol-website 2026-11-04). CSS cannot animate an unmount; this is the whole of the JS.
6
+ * Reduced motion, or `ms` 0, unmounts at once.
7
+ *
8
+ * @param {boolean} open
9
+ * @param {number} ms how long the leave runs (`floatMotion(motion).ms`)
10
+ * @returns {{ mounted: boolean, entering: boolean, exiting: boolean }} `entering` — opened after having been closed (never
11
+ * on first mount, so a page does not animate its chrome in on load)
12
+ */
13
+ export default function useFloatPresence(open, ms) {
14
+ const [state, setState] = useState(open ? 'open' : 'closed')
15
+ const first = useRef(true)
16
+ useEffect(() => {
17
+ if (first.current) { first.current = false; return undefined }
18
+ if (open) { setState('enter'); return undefined }
19
+ const still = typeof window !== 'undefined' && window.matchMedia?.('(prefers-reduced-motion: reduce)').matches
20
+ if (!ms || still) { setState('closed'); return undefined }
21
+ setState('exit')
22
+ const t = setTimeout(() => setState('closed'), ms)
23
+ return () => clearTimeout(t)
24
+ }, [open, ms])
25
+ return { mounted: open || state !== 'closed', entering: open && state !== 'open', exiting: !open && state !== 'closed' }
26
+ }
package/src/index.js CHANGED
@@ -55,6 +55,7 @@ export { default as OverlayGlassPanel } from './utilities/OverlayGlassPanel.jsx'
55
55
  export { default as Pill } from './atoms/Pill.jsx'
56
56
  export { usePopover, PopoverPanel, Tooltip } from './utilities/Popover.jsx'
57
57
  export { floatSurfaceClass, FLOAT_SURFACES } from './utilities/tone.js'
58
+ export { floatMotion, FLOAT_MOTION } from './utilities/motion.js'
58
59
  /* armLongPress — the touch hold the panel value controls report (moved from kol-hardware 2026-10-01) */
59
60
  export { armLongPress } from './utilities/armLongPress.js'
60
61
  export { default as ContextMenu, useContextMenu } from './molecules/ContextMenu.jsx'
@@ -324,6 +325,7 @@ export { SOLO, ADJACENT, INDICATOR, glyphSize, indicatorSize } from './hooks/gly
324
325
 
325
326
  // hooks
326
327
  export { default as usePrefersReducedMotion } from './hooks/usePrefersReducedMotion.js'
328
+ export { default as useFloatPresence } from './hooks/useFloatPresence.js'
327
329
  export { default as useReveal } from './hooks/useReveal.js'
328
330
  export { default as useScrollSpy } from './hooks/useScrollSpy.js'
329
331
  export { default as useScrollFade } from './hooks/useScrollFade.js'
@@ -670,6 +670,9 @@ export default function ColumnBrowser({
670
670
  return { col, idx: Math.max(0, idx) }
671
671
  }
672
672
  const [cursor, setCursor] = useState(() => seedCursor(prefix))
673
+ /* the column an arrow key just landed in; the reveal effect below scrolls it in and clears it */
674
+ const revealCol = useRef(null)
675
+ const arrowTo = (c) => { revealCol.current = c.col; setCursor(c) }
673
676
  useEffect(() => {
674
677
  if (keepCursor.current) { keepCursor.current = false; return }
675
678
  setCursor(seedCursor(prefix))
@@ -749,7 +752,7 @@ export default function ColumnBrowser({
749
752
  shiftAnchor.current.last = idx
750
753
  const a = shiftAnchor.current.idx
751
754
  const keyOf = (it) => (it.type === 'folder' ? lv[col] + it.name : it.o.key)
752
- setCursor({ col, idx })
755
+ arrowTo({ col, idx })
753
756
  onSelectKeys(items.slice(Math.min(a, idx), Math.max(a, idx) + 1).map(keyOf), false)
754
757
  return
755
758
  }
@@ -757,13 +760,13 @@ export default function ColumnBrowser({
757
760
  /* an arrow that did not move the cursor does nothing — re-landing on an
758
761
  * open folder re-fired onPrefix (ColumnBrowserCursorSeed) */
759
762
  if (idx === cursor.idx && col === cursor.col) return
760
- setCursor({ col, idx })
763
+ arrowTo({ col, idx })
761
764
  land(lv[col], items[idx])
762
765
  } else if (e.key === 'ArrowRight') {
763
766
  // Into the open folder's column, first row.
764
767
  if (lv[col + 1]) {
765
768
  const next = itemsAt(lv[col + 1])
766
- setCursor({ col: col + 1, idx: 0 })
769
+ arrowTo({ col: col + 1, idx: 0 })
767
770
  land(lv[col + 1], next[0])
768
771
  }
769
772
  } else if (col > 0) {
@@ -771,7 +774,7 @@ export default function ColumnBrowser({
771
774
  const parentItems = itemsAt(lv[col - 1])
772
775
  const opened = lv[col].slice(lv[col - 1].length)
773
776
  const idx = Math.max(0, parentItems.findIndex((it) => it.type === 'folder' && it.name === opened))
774
- setCursor({ col: col - 1, idx })
777
+ arrowTo({ col: col - 1, idx })
775
778
  pick(null)
776
779
  selectOnly(lv[col])
777
780
  onPrefix(lv[col])
@@ -843,13 +846,16 @@ export default function ColumnBrowser({
843
846
  onSelect: (keys, additive) => onSelectKeys?.(keys, additive),
844
847
  })
845
848
  const isPicked = (key) => selectedKeys?.has(key)
846
- /* THE DEEPEST COLUMN STAYS IN VIEW (user 2026-09-23: arrowing onto a file left the preview
847
- * clipped under the frame's right edge). Whenever the trail or the pick changes, the strip scrolls
848
- * to its end — the newest column, or the preview, is always the one you just reached. */
849
+ /* THE STRIP HOLDS STILL (ColumnStripHoldsStill, user 2026-11-05, superseding 2026-09-23's
850
+ * slide-to-end: *"nothing ever moves your horizontal location other then the mouse or the
851
+ * arrows. never auto slide between columns."*). A click never scrolls the strip. An arrow key
852
+ * that lands in a column off-screen brings THAT column in by the least amount — never the end. */
849
853
  useEffect(() => {
850
- const box = marquee.ref.current
851
- if (box && box.scrollWidth > box.clientWidth) box.scrollTo({ left: box.scrollWidth, behavior: 'smooth' })
852
- }, [prefix, picked?.key, selectedKeys?.size, previewPlacement]) // eslint-disable-line react-hooks/exhaustive-deps
854
+ if (revealCol.current == null) return
855
+ const ul = marquee.ref.current?.querySelectorAll(':scope > .kol-column-browser-column')[revealCol.current]
856
+ revealCol.current = null
857
+ ul?.scrollIntoView({ inline: 'nearest', block: 'nearest', behavior: 'smooth' })
858
+ }, [cursor]) // eslint-disable-line react-hooks/exhaustive-deps
853
859
 
854
860
  if (stack) {
855
861
  /* THE CURRENT LEVEL IS THE LIST (StackModeChromeAndAncestors, kol-r2b2
@@ -6,6 +6,8 @@ import Kbd from '../atoms/Kbd.jsx'
6
6
  import OptionRow from '../molecules/OptionRow.jsx'
7
7
  import Button from '../atoms/Button.jsx'
8
8
  import { floatSurfaceClass } from '../utilities/tone.js'
9
+ import { floatMotion } from '../utilities/motion.js'
10
+ import useFloatPresence from '../hooks/useFloatPresence.js'
9
11
  import { shortcutInScope } from './ShortcutsOverlay.jsx'
10
12
 
11
13
  /* ONE COLUMN (2026-09-30): rows, headings and footer sit on the field's own
@@ -154,6 +156,9 @@ function unfold(rows, opened) {
154
156
  * is RailTrigger's (`kol-more-sheet-float` on `--kol-float-menu-r`, the float surface and
155
157
  * shadow), the field the float SearchInput, the rows float Buttons (Inter, `--kol-float-row`,
156
158
  * the lit row fg-16). Unset, the search modal is drawn as before. FloatLayout's `search` passes its own
159
+ * @param {boolean|Object} [motion=true] with `surface`, the card fades and scales in and out over a fading scrim, held in
160
+ * the tree while it leaves (FloatActionStatesAndMotion, 2026-11-04): `true` the
161
+ * `--kol-float-*` tokens · `false` none · `{ duration, ease }` per app
157
162
  */
158
163
  export default function CommandOverlay({
159
164
  open,
@@ -183,8 +188,12 @@ export default function CommandOverlay({
183
188
  shortcuts = [],
184
189
  currentPath,
185
190
  surface,
191
+ motion = true,
186
192
  }) {
187
193
  const float = surface != null
194
+ const fm = floatMotion(motion)
195
+ const presence = useFloatPresence(open, float ? fm.ms : 0)
196
+ const exit = float && presence.exiting ? '' : undefined
188
197
  const panelRef = useRef(null)
189
198
  const listRef = useRef(null)
190
199
  const listId = useId()
@@ -236,7 +245,7 @@ export default function CommandOverlay({
236
245
  listRef.current?.querySelectorAll('[role="option"]')[active]?.scrollIntoView({ block: 'nearest' })
237
246
  }, [active])
238
247
 
239
- if (!open) return null
248
+ if (!(float ? presence.mounted : open)) return null
240
249
 
241
250
  /* A row that KEEPS THE MODAL OPEN — `keepOpen`, or an `action` row (the contract below always said
242
251
  * so; until 0.252.0 every pick closed — ShellSearchOverlayActionKeepsOpen, kol-fxr 2026-10-13). It
@@ -310,7 +319,7 @@ export default function CommandOverlay({
310
319
  }
311
320
 
312
321
  return (
313
- <div className="fixed inset-0 flex items-start justify-center pt-[20vh]" style={{ zIndex: 'var(--kol-z-modal, 100)' }}>
322
+ <div className="fixed inset-0 flex items-start justify-center pt-[20vh]" style={{ zIndex: 'var(--kol-z-modal, 100)', ...(float ? fm.style : null) }}>
314
323
  {/* A BUTTON, not a div (OverlayScrimTapDismiss, 2026-09-01): iOS Safari
315
324
  * does not bubble tap-clicks from non-interactive elements, so the div's
316
325
  * onClick never fired on a phone and the only way out was the close
@@ -319,7 +328,8 @@ export default function CommandOverlay({
319
328
  <button
320
329
  type="button"
321
330
  aria-label="Close search"
322
- className="absolute inset-0 kol-overlay-scrim"
331
+ className={`absolute inset-0 kol-overlay-scrim${float ? ' kol-float-fade' : ''}`}
332
+ data-exit={exit}
323
333
  onClick={onClose}
324
334
  />
325
335
  <div
@@ -330,7 +340,8 @@ export default function CommandOverlay({
330
340
  role="dialog"
331
341
  aria-modal="true"
332
342
  aria-label="Search"
333
- className={`${float ? `kol-more-sheet kol-more-sheet-float kol-float-chrome ${floatSurfaceClass(surface, true)} relative w-full overflow-hidden` : 'kol-overlay-panel'} mx-4 ${noField ? 'outline-none ' : ''}${expanded ? 'max-w-[var(--kol-content-panel)]' : 'max-w-lg'}`}
343
+ data-exit={exit}
344
+ className={`${float ? `kol-more-sheet kol-more-sheet-float kol-float-chrome kol-float-motion ${floatSurfaceClass(surface, true)} relative w-full overflow-hidden` : 'kol-overlay-panel'} mx-4 ${noField ? 'outline-none ' : ''}${expanded ? 'max-w-[var(--kol-content-panel)]' : 'max-w-lg'}`}
334
345
  >
335
346
  {/* THE MODE, said out loud (user 2026-08-01: "how do you set search
336
347
  * mode? theres no helper, message or mode clearly readble"). Two
@@ -1,4 +1,4 @@
1
- import { Fragment, createContext, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react'
1
+ import { Fragment, createContext, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react'
2
2
  import { registerCredentialedOrigin } from '../utilities/credentials.js'
3
3
  import formatSize from '../utilities/formatSize.js'
4
4
  import { ROW_HEIGHT, ROW_FILL } from '../molecules/OptionRow.jsx'
@@ -1978,11 +1978,10 @@ export function MediaLibraryBrowse({
1978
1978
  const at = files.findIndex((f) => f.key === selectCursorRef.current)
1979
1979
  setQuickLook({ files, index: at === -1 ? 0 : at })
1980
1980
  }, [rowSelection]) // eslint-disable-line react-hooks/exhaustive-deps
1981
- const columnsRef = useRef(null)
1982
- /* the view box (whichever view is mounted) and the page root — what `fill` measures */
1981
+ /* the view box (whichever view is mounted) and the page root — what `fill` measures. THE STRIP
1982
+ * HOLDS STILL (ColumnStripHoldsStill, 2026-11-05): no effect here slides the columns any more —
1983
+ * ColumnBrowser owns its strip, and only the mouse or the arrows move it. */
1983
1984
  const [viewEl, viewRef] = useState(null)
1984
- /* stable, so the columns box is not re-attached (null, then itself) on every render */
1985
- const columnsBox = useCallback((el) => { columnsRef.current = el; viewRef(el) }, [])
1986
1985
  const pageRef = useRef(null)
1987
1986
  const fill = settings.columnHeight === 'fill'
1988
1987
  const fillH = useFillHeight(fill, viewEl, pageRef)
@@ -2146,14 +2145,6 @@ export function MediaLibraryBrowse({
2146
2145
  }
2147
2146
  }
2148
2147
 
2149
- useEffect(() => {
2150
- if (folderView !== 'columns') return undefined
2151
- const root = columnsRef.current?.querySelector('[tabindex="0"]')
2152
- if (!root) return undefined
2153
- const id = requestAnimationFrame(() => root.scrollTo({ left: root.scrollWidth, behavior: 'smooth' }))
2154
- return () => cancelAnimationFrame(id)
2155
- }, [folderView, prefix, atTitleRoot, pickedFile, bucketMeta.id])
2156
-
2157
2148
  if (error) return <p className="kol-mono-12 text-ui-error">Error: {error}</p>
2158
2149
  /* NOT SELECTABLE (user 2026-09-23, superseding 2026-09-22's selectable crumbs: *"instead of this
2159
2150
  * highlight, could we make a hover click to copy path?"*). A drag across the line painted the
@@ -2224,7 +2215,7 @@ export function MediaLibraryBrowse({
2224
2215
  const treeObjects = keep ? sortedObjects.filter((o) => keep.has(o.key)) : sortedObjects
2225
2216
  return (
2226
2217
  folderView === 'columns' || phone ? (
2227
- <div ref={columnsBox} className="relative">
2218
+ <div ref={viewRef} className="relative">
2228
2219
  <ColumnBrowser
2229
2220
  autoFocus={autoFocus}
2230
2221
  className={atTitleRoot ? 'is-root' : ''}
@@ -3,6 +3,7 @@ import { Icon } from '@kolkrabbi/kol-icons'
3
3
  import Kbd from '../atoms/Kbd.jsx'
4
4
  import TreeRow from '../molecules/TreeRow.jsx'
5
5
  import { Tooltip } from '../utilities/Popover.jsx'
6
+ import { floatMotion } from '../utilities/motion.js'
6
7
 
7
8
  /* taxonomy-ok: organism — nests TreeRow (molecule) + Kbd (atom) + Tooltip (utility) + kol-icons's Icon. */
8
9
 
@@ -34,10 +35,15 @@ import { Tooltip } from '../utilities/Popover.jsx'
34
35
  * @param {ReactNode} [footer]
35
36
  * @param {Function} [onItemHover] collapsed only: `(item, element)` when the pointer enters a slot, `(null, null)` when it
36
37
  * leaves — the seam a hover flyout hangs off (kol-shell's RailFlyout, FloatLayout 2026-11-04)
38
+ * @param {boolean|Object} [motion=true] expand ↔ collapse eases the width and fades the new rows in, and the slots and rows ease
39
+ * their hover (`.kol-float-rail`, FloatActionStatesAndMotion 2026-11-04): `true` the
40
+ * `--kol-float-*` tokens · `false` none · `{ duration, ease }` per app. Hide and show are
41
+ * FloatLayout's (it holds the rail while it leaves)
37
42
  */
38
43
  const isOn = (path, current) => !!path && path === current
39
44
 
40
- export default function NavRailFloat({ items = [], currentPath = '', onNavigate, collapsed = false, onCollapsedChange, title, icon = 'grid', onSwitch, switcher, onSearch, onHide, defaultExpanded = [], footer, onItemHover, className = '' }) {
45
+ export default function NavRailFloat({ items = [], currentPath = '', onNavigate, collapsed = false, onCollapsedChange, title, icon = 'grid', onSwitch, switcher, onSearch, onHide, defaultExpanded = [], footer, onItemHover, motion = true, className = '' }) {
46
+ const motionStyle = floatMotion(motion).style
41
47
  const [open, setOpen] = useState(() => new Set(defaultExpanded))
42
48
  const toggle = (path) => setOpen((s) => { const n = new Set(s); n.has(path) ? n.delete(path) : n.add(path); return n })
43
49
  const go = (path) => () => onNavigate?.(path)
@@ -52,7 +58,7 @@ export default function NavRailFloat({ items = [], currentPath = '', onNavigate,
52
58
  </Tooltip>
53
59
  )
54
60
  return (
55
- <nav aria-label="Navigation" className={`flex h-full w-[72px] flex-col items-center gap-1 rounded-[var(--kol-float-menu-r)] bg-surface-secondary shadow-[var(--kol-shadow-float)] py-3.5 ${className}`.trim()}>
61
+ <nav aria-label="Navigation" style={motionStyle} className={`kol-float-rail flex h-full w-[72px] flex-col items-center gap-1 rounded-[var(--kol-float-menu-r)] bg-surface-secondary shadow-[var(--kol-shadow-float)] py-3.5 ${className}`.trim()}>
56
62
  {onCollapsedChange && slot('expand', 'Expand', 'panel-left', { well: true, onClick: () => onCollapsedChange(false) })}
57
63
  <div className="flex min-h-0 w-full flex-1 flex-col items-center gap-1 overflow-y-auto py-3 [scrollbar-width:none]">
58
64
  {items.map((it, i) => {
@@ -74,7 +80,7 @@ export default function NavRailFloat({ items = [], currentPath = '', onNavigate,
74
80
  }
75
81
 
76
82
  return (
77
- <nav aria-label="Navigation" className={`flex h-full w-[280px] flex-col gap-3 rounded-[var(--kol-float-menu-r)] bg-surface-secondary shadow-[var(--kol-shadow-float)] p-3 ${className}`.trim()}>
83
+ <nav aria-label="Navigation" style={motionStyle} className={`kol-float-rail flex h-full w-[280px] flex-col gap-3 rounded-[var(--kol-float-menu-r)] bg-surface-secondary shadow-[var(--kol-shadow-float)] p-3 ${className}`.trim()}>
78
84
  {switcher ?? (title && (
79
85
  <button type="button" onClick={onSwitch} className="flex h-10 w-full items-center gap-2.5 rounded-[var(--kol-float-list-r)] px-2.5 text-left cursor-pointer hover:bg-fg-08 focus-visible:outline-none focus-visible:shadow-[var(--kol-float-focus)]">
80
86
  <Icon name={icon} size={18} className="shrink-0 text-oq-96" />
@@ -1,5 +1,7 @@
1
1
  import { cloneElement, createContext, isValidElement, useContext, useLayoutEffect, useState, version as reactVersion } from 'react'
2
2
  import { toneClass, TONE_VARS } from './tone.js'
3
+ import { floatMotion } from './motion.js'
4
+ import useFloatPresence from '../hooks/useFloatPresence.js'
3
5
  import {
4
6
  useFloating,
5
7
  autoUpdate,
@@ -260,6 +262,10 @@ function TooltipOn({
260
262
  * focus — wrap in FloatingFocusManager (default: true)
261
263
  * className — extra classes on the panel
262
264
  * style — extra inline styles merged with floatingStyles
265
+ * motion — the float card's enter and leave (FloatActionStatesAndMotion, 2026-11-04): unset, the panel
266
+ * mounts and unmounts as it always has; `true` · `{ duration, ease }` fades it in and out from its
267
+ * trigger's side (`.kol-float-motion`, `--kol-float-*`), held in the tree while it leaves; `false`
268
+ * the same card with no motion
263
269
  */
264
270
  /* how many floats this one is opened from inside — context crosses portals, the DOM order does not */
265
271
  const FloatDepth = (globalThis[Symbol.for('@kolkrabbi/kol-component/FloatDepth')] ??= createContext(0))
@@ -278,18 +284,21 @@ export function PopoverPanel({
278
284
  * that, so nothing existing moves; a tone paints that tone's ground instead,
279
285
  * through the same `toneClass` every other control uses. */
280
286
  tone,
287
+ motion,
281
288
  className = '',
282
289
  style: extraStyle,
283
290
  }) {
284
291
  const depth = useContext(FloatDepth)
285
- if (!popover.open) return null
292
+ const fm = motion == null ? null : floatMotion(motion)
293
+ const presence = useFloatPresence(popover.open, fm?.ms ?? 0)
294
+ if (!(fm ? presence.mounted : popover.open)) return null
286
295
 
287
296
  const { refs, floatingStyles, context, getFloatingProps } = popover
288
297
  /* kol-popover-float rides every floating node (panel chrome or not): it
289
298
  * carries the stacking guarantee — floats must top overlay chrome
290
299
  * (.kol-overlay z-100), or a dropdown inside a FullscreenOverlay renders
291
300
  * under the sheet and its options can't be clicked. */
292
- const cls = ['kol-popover-float', panel && 'kol-popover', tone && toneClass(tone), className].filter(Boolean).join(' ')
301
+ const cls = ['kol-popover-float', panel && 'kol-popover', tone && toneClass(tone), fm && 'kol-float-motion', className].filter(Boolean).join(' ')
293
302
 
294
303
  /* `data-editor-keep-selection` mirrors the marker on the EditorShell
295
304
  * root. Popovers render via FloatingPortal (mounted on <body>, outside
@@ -301,9 +310,11 @@ export function PopoverPanel({
301
310
  const node = (
302
311
  <div
303
312
  ref={refs.setFloating}
304
- style={{ ...floatingStyles, ...(depth ? { '--kol-float-depth': depth } : null), ...extraStyle }}
313
+ style={{ ...floatingStyles, ...(depth ? { '--kol-float-depth': depth } : null), ...fm?.style, ...extraStyle }}
305
314
  className={cls}
306
315
  data-editor-keep-selection
316
+ data-side={fm ? popover.placement?.split('-')[0] : undefined}
317
+ data-exit={fm && presence.exiting ? '' : undefined}
307
318
  {...getFloatingProps()}
308
319
  >
309
320
  <FloatDepth.Provider value={depth + 1}>{children}</FloatDepth.Provider>
@@ -112,3 +112,25 @@ export const GRAB_COLUMN = {
112
112
  range: 1,
113
113
  travel: { duration: 2.8, ease: EASE.outGsap },
114
114
  }
115
+
116
+ /* THE FLOAT FAMILY'S MOTION (FloatActionStatesAndMotion, kol-website 2026-11-04). The CSS side is `--kol-float-*` in
117
+ * kol-design-tokens.css and `.kol-float-motion` · `-rail` · `-turn` in kol-animation.css; these are the same numbers for
118
+ * the one thing CSS cannot do — hold a card in the tree while it leaves. */
119
+ export const FLOAT_MOTION = { duration: DURATION.base, rail: DURATION.slow, hoverOpacity: 0.88, pressScale: 0.96 }
120
+
121
+ /**
122
+ * floatMotion — the `motion` prop of the float pieces and FloatLayout, resolved once:
123
+ * true (default) the tokens
124
+ * false no motion — the durations go to 0ms
125
+ * { duration, ease } per app: `duration` in ms (both clocks), `ease` a CSS curve or a cubic-bezier array (EASE.*)
126
+ * Returns `{ style, ms, rail }`: `style` sets the `--kol-float-*` vars on the piece's root (or nothing), `ms` / `rail` how long
127
+ * a card or the rail is held in the tree while it leaves.
128
+ */
129
+ export function floatMotion(motion = true) {
130
+ if (motion === false) return { style: { '--kol-float-duration': '0ms', '--kol-float-duration-rail': '0ms' }, ms: 0, rail: 0 }
131
+ const o = motion && typeof motion === 'object' ? motion : {}
132
+ const style = {}
133
+ if (o.duration != null) style['--kol-float-duration'] = style['--kol-float-duration-rail'] = `${o.duration}ms`
134
+ if (o.ease) style['--kol-float-ease'] = Array.isArray(o.ease) ? `cubic-bezier(${o.ease.join(', ')})` : o.ease
135
+ return { style: Object.keys(style).length ? style : undefined, ms: o.duration ?? FLOAT_MOTION.duration, rail: o.duration ?? FLOAT_MOTION.rail }
136
+ }