@kolkrabbi/kol-component 0.341.0 → 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.341.0",
3
+ "version": "0.341.1",
4
4
  "description": "The core component library",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -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
@@ -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' : ''}