@kolkrabbi/kol-component 0.341.0 → 0.342.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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kolkrabbi/kol-component",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.342.0",
|
|
4
4
|
"description": "The core component library",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"embla-carousel-react": "^8.6.0",
|
|
30
30
|
"pdfjs-dist": "^6.3.289",
|
|
31
31
|
"react-syntax-highlighter": "^16.1.1",
|
|
32
|
-
"@kolkrabbi/kol-
|
|
32
|
+
"@kolkrabbi/kol-search": "^0.3.0",
|
|
33
33
|
"@kolkrabbi/kol-markdown": "^0.2.0",
|
|
34
|
-
"@kolkrabbi/kol-
|
|
34
|
+
"@kolkrabbi/kol-growth": "^0.5.0"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"@kolkrabbi/kol-icons": ">=0.61.1",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"react-dom": "^18.3.0 || ^19.0.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@kolkrabbi/kol-icons": "^0.
|
|
45
|
+
"@kolkrabbi/kol-icons": "^0.65.0"
|
|
46
46
|
},
|
|
47
47
|
"files": [
|
|
48
48
|
"src",
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
847
|
-
*
|
|
848
|
-
*
|
|
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
|
-
|
|
851
|
-
|
|
852
|
-
|
|
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,
|
|
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
|
-
|
|
1982
|
-
|
|
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={
|
|
2218
|
+
<div ref={viewRef} className="relative">
|
|
2228
2219
|
<ColumnBrowser
|
|
2229
2220
|
autoFocus={autoFocus}
|
|
2230
2221
|
className={atTitleRoot ? 'is-root' : ''}
|
|
@@ -51,6 +51,11 @@ import { Tooltip } from '../utilities/Popover.jsx'
|
|
|
51
51
|
* @param {string} accentColor outline + handle + label color (default var(--kol-accent-primary))
|
|
52
52
|
* @param {Function} labelFormatter (box) => string — dimension readout (default `${round(w)} × ${round(h)}`)
|
|
53
53
|
* @param {string} rotateTitle tooltip on the rotate handle (default 'Rotate')
|
|
54
|
+
* @param {'float'} variant THE FLOAT LOOK (plan-2026-11-05-float-editor W2.6; his frame 19:6066 — "New text" ·
|
|
55
|
+
* "600 × 160"): a solid 1px oq-64 outline, 6 square handles filled at full ink, the
|
|
56
|
+
* rotate handle a 6 circle, `name` above the box's top-left (`kol-float-label`, oq-64) and
|
|
57
|
+
* the size cap under it (`kol-float-ruler` on oq-08, the float list round). Unset, as before
|
|
58
|
+
* @param {string} name the object's name, drawn above the box by the float look
|
|
54
59
|
*/
|
|
55
60
|
const HANDLE_DIRS = [
|
|
56
61
|
{ dir: 'NW', cursor: 'nwse-resize', x: 0, y: 0 },
|
|
@@ -76,6 +81,8 @@ export default function SelectionOverlay({
|
|
|
76
81
|
accentColor = 'var(--kol-accent-primary)',
|
|
77
82
|
labelFormatter = (b) => `${Math.round(b.w)} × ${Math.round(b.h)}`,
|
|
78
83
|
rotateTitle = 'Rotate',
|
|
84
|
+
variant,
|
|
85
|
+
name,
|
|
79
86
|
}) {
|
|
80
87
|
/* Chrome renders in virtual px inside the zoomed transform — divide by zoom
|
|
81
88
|
* so handles / outline / label stay screen-constant at any zoom. 1 outside a
|
|
@@ -83,6 +90,7 @@ export default function SelectionOverlay({
|
|
|
83
90
|
const zoom = useContext(CanvasZoomContext)
|
|
84
91
|
|
|
85
92
|
if (!box || box.x == null) return null /* no positional box → no chrome */
|
|
93
|
+
if (variant === 'float') return <FloatSelection box={box} zoom={zoom} showHandles={showHandles} showRotate={showRotate} showLabel={showLabel} name={name} labelFormatter={labelFormatter} rotateTitle={rotateTitle} />
|
|
86
94
|
|
|
87
95
|
const { x, y, w, h } = box
|
|
88
96
|
const size = handleSize / zoom
|
|
@@ -196,3 +204,41 @@ export default function SelectionOverlay({
|
|
|
196
204
|
</>
|
|
197
205
|
)
|
|
198
206
|
}
|
|
207
|
+
|
|
208
|
+
/* the float look — the same handles and data-handle routing, drawn as his frame draws the selection; every screen-constant
|
|
209
|
+
* size divides by the zoom (6 handles, the 1px outline) and the two labels counter-scale, as the default look does */
|
|
210
|
+
function FloatSelection({ box, zoom, showHandles = true, showRotate, showLabel = true, name, labelFormatter, rotateTitle }) {
|
|
211
|
+
const { x, y, w, h } = box
|
|
212
|
+
const size = 6 / zoom
|
|
213
|
+
const rotate = showRotate ?? showHandles
|
|
214
|
+
const rot = typeof box.rotation === 'number' ? box.rotation : 0
|
|
215
|
+
const ink = 'var(--kol-surface-on-primary)'
|
|
216
|
+
const counter = { transform: `scale(${1 / zoom})`, pointerEvents: 'none', whiteSpace: 'nowrap', zIndex: 100 }
|
|
217
|
+
return (
|
|
218
|
+
<>
|
|
219
|
+
<div style={{ position: 'absolute', left: x, top: y, width: w, height: h, transform: rot ? `rotate(${rot}deg)` : undefined, pointerEvents: 'none', zIndex: 100 }}>
|
|
220
|
+
<div style={{ position: 'absolute', inset: 0, boxShadow: `0 0 0 ${1 / zoom}px var(--kol-oq-64)` }} />
|
|
221
|
+
{rotate && (
|
|
222
|
+
<Tooltip label={rotateTitle} asChild>
|
|
223
|
+
<div data-handle="ROT" style={{ position: 'absolute', left: `calc(50% - ${size / 2}px)`, top: -(ROTATE_OFFSET / zoom), width: size, height: size, borderRadius: '50%', background: ink, cursor: 'grab', pointerEvents: 'auto' }} />
|
|
224
|
+
</Tooltip>
|
|
225
|
+
)}
|
|
226
|
+
{showHandles && HANDLE_DIRS.map(({ dir, cursor, x: hx, y: hy }) => (
|
|
227
|
+
<div key={dir} data-handle={dir} style={{ position: 'absolute', left: `calc(${hx * 100}% - ${size / 2}px)`, top: `calc(${hy * 100}% - ${size / 2}px)`, width: size, height: size, background: ink, cursor, pointerEvents: 'auto' }} />
|
|
228
|
+
))}
|
|
229
|
+
</div>
|
|
230
|
+
{/* each label hangs off a zero-size anchor so the counter-scale keeps its edge on the anchor */}
|
|
231
|
+
{showLabel && name && (
|
|
232
|
+
<div style={{ position: 'absolute', left: x, top: y - 8 / zoom, width: 0, height: 0, zIndex: 100 }}>
|
|
233
|
+
<span className="kol-float-label text-oq-64" style={{ ...counter, position: 'absolute', left: 0, bottom: 0, transformOrigin: 'left bottom' }}>{name}</span>
|
|
234
|
+
</div>
|
|
235
|
+
)}
|
|
236
|
+
{showLabel && (
|
|
237
|
+
<div style={{ position: 'absolute', left: x + w / 2, top: y + h + 8 / zoom, width: 0, height: 0, zIndex: 100 }}>
|
|
238
|
+
<span className="kol-float-ruler text-emphasis bg-oq-08 rounded-[var(--kol-float-list-r)] px-2 py-1"
|
|
239
|
+
style={{ ...counter, position: 'absolute', left: 0, top: 0, transform: `translateX(-50%) scale(${1 / zoom})`, transformOrigin: 'top center' }}>{labelFormatter(box)}</span>
|
|
240
|
+
</div>
|
|
241
|
+
)}
|
|
242
|
+
</>
|
|
243
|
+
)
|
|
244
|
+
}
|