@kolkrabbi/kol-component 0.311.1 → 0.311.3
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 +1 -1
- package/src/hooks/canvasZoom.js +1 -1
- package/src/hooks/railSlot.jsx +1 -1
- package/src/molecules/AppItem.jsx +1 -1
- package/src/molecules/Modal.jsx +1 -1
- package/src/organisms/MediaLibrary.jsx +1 -1
- package/src/organisms/MediaLibraryPages.jsx +1 -1
- package/src/utilities/AsciiCursor.jsx +23 -15
- package/src/utilities/Popover.jsx +2 -2
- package/src/utilities/masthead.js +1 -1
package/package.json
CHANGED
package/src/hooks/canvasZoom.js
CHANGED
|
@@ -16,4 +16,4 @@ import { createContext } from 'react'
|
|
|
16
16
|
* `@kolkrabbi/kol-component` exports it from the barrel as `CanvasZoomContext`,
|
|
17
17
|
* and `Canvas.jsx` re-exports it under the same name it always had.
|
|
18
18
|
*/
|
|
19
|
-
export const CanvasZoomContext = createContext(1)
|
|
19
|
+
export const CanvasZoomContext = (globalThis[Symbol.for('@kolkrabbi/kol-component/CanvasZoomContext')] ??= createContext(1))
|
package/src/hooks/railSlot.jsx
CHANGED
|
@@ -14,7 +14,7 @@ import { createContext, useContext, useMemo, useState } from 'react'
|
|
|
14
14
|
*
|
|
15
15
|
* Monitor's shape (`src/hooks/useRailSlot.jsx`), shipped so its NavRail fork can retire.
|
|
16
16
|
*/
|
|
17
|
-
const RailSlotContext = createContext(null)
|
|
17
|
+
const RailSlotContext = (globalThis[Symbol.for('@kolkrabbi/kol-component/RailSlotContext')] ??= createContext(null))
|
|
18
18
|
|
|
19
19
|
export function useRailSlot() {
|
|
20
20
|
return useContext(RailSlotContext)
|
|
@@ -25,7 +25,7 @@ import formatSize from '../utilities/formatSize.js'
|
|
|
25
25
|
* rail and no right-click menu.
|
|
26
26
|
*/
|
|
27
27
|
|
|
28
|
-
export const MenuCtx = createContext(null)
|
|
28
|
+
export const MenuCtx = (globalThis[Symbol.for('@kolkrabbi/kol-component/MenuCtx')] ??= createContext(null))
|
|
29
29
|
|
|
30
30
|
export const useAsk = () => {
|
|
31
31
|
const modal = useModal()
|
package/src/molecules/Modal.jsx
CHANGED
|
@@ -62,7 +62,7 @@ import ToggleCheckbox from '../atoms/ToggleCheckbox.jsx'
|
|
|
62
62
|
* via portal, so it floats above any rail / scroll-context.
|
|
63
63
|
*/
|
|
64
64
|
|
|
65
|
-
const ModalCtx = createContext(null)
|
|
65
|
+
const ModalCtx = (globalThis[Symbol.for('@kolkrabbi/kol-component/ModalCtx')] ??= createContext(null))
|
|
66
66
|
|
|
67
67
|
export function ModalProvider({ children }) {
|
|
68
68
|
const [state, setState] = useState(null)
|
|
@@ -58,7 +58,7 @@ import { filterMedia } from '../utilities/mediaSearch.js'
|
|
|
58
58
|
* write auth does not belong in a browser-shipped package.
|
|
59
59
|
*/
|
|
60
60
|
|
|
61
|
-
const MediaLibraryContext = createContext(null)
|
|
61
|
+
const MediaLibraryContext = (globalThis[Symbol.for('@kolkrabbi/kol-component/MediaLibraryContext')] ??= createContext(null))
|
|
62
62
|
|
|
63
63
|
const isImage = (ct) => !!ct && ct.startsWith('image/')
|
|
64
64
|
const isVideo = (ct) => !!ct && ct.startsWith('video/')
|
|
@@ -316,7 +316,7 @@ function TagEditor({ tags = [], onChange, suggestions = [] }) {
|
|
|
316
316
|
* own anatomy (twisty, drag hit, table columns) and take the ramp's box and glyph, OptionRow's
|
|
317
317
|
* fills (picked = the pressed white, the folder you are in = the trail) and the one item type,
|
|
318
318
|
* `kol-item-name`, that the columns and the grid use. */
|
|
319
|
-
const RowSize = createContext('md')
|
|
319
|
+
const RowSize = (globalThis[Symbol.for('@kolkrabbi/kol-component/RowSize')] ??= createContext('md'))
|
|
320
320
|
|
|
321
321
|
/* `depth` indents a row under the folder it was expanded from; `expanded`/`onToggle` draw the
|
|
322
322
|
* disclosure twisty. A folder row without `onToggle` keeps the old behaviour exactly — one chevron
|
|
@@ -149,17 +149,23 @@ function Firework({ x, y, type, onDone }) {
|
|
|
149
149
|
const frames = allFrameSets[type]
|
|
150
150
|
|
|
151
151
|
useEffect(() => {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
152
|
+
// Advance frames on a clock; report completion from an effect. `onDone` used
|
|
153
|
+
// to be called inside the setFrame updater — React runs updaters during the
|
|
154
|
+
// child's render, so the parent's setFireworks fired mid-render ("Cannot
|
|
155
|
+
// update a component (AsciiCursorOverlay) while rendering Firework") on every
|
|
156
|
+
// burst. The updater also restarted the interval on each parent re-render
|
|
157
|
+
// (onDone is a fresh closure per render), stalling the burst while the
|
|
158
|
+
// cursor moved. (kolkrabbi.io's mobile audit 2026-08-25, lost in the DS copy —
|
|
159
|
+
// AsciiCursorFireworkSetStateInRender 2026-10-29)
|
|
160
|
+
const interval = setInterval(() => setFrame((f) => Math.min(f + 1, frames.length - 1)), 130)
|
|
161
161
|
return () => clearInterval(interval)
|
|
162
|
-
}, [frames
|
|
162
|
+
}, [frames])
|
|
163
|
+
const doneRef = useRef(false)
|
|
164
|
+
useEffect(() => {
|
|
165
|
+
if (doneRef.current || frame < frames.length - 1) return
|
|
166
|
+
doneRef.current = true
|
|
167
|
+
onDone()
|
|
168
|
+
}, [frame, frames, onDone])
|
|
163
169
|
|
|
164
170
|
return (
|
|
165
171
|
<div
|
|
@@ -387,8 +393,9 @@ function AsciiCrosshair({ overlayRef }) {
|
|
|
387
393
|
</div>
|
|
388
394
|
))
|
|
389
395
|
)}
|
|
390
|
-
{/* Foreground layer
|
|
391
|
-
|
|
396
|
+
{/* Foreground layer — 0.9 in light, 0.5 in dark (kolkrabbi.io's `.ascii-cursor-fg`, carried 2026-10-29): at one 0.5
|
|
397
|
+
* the glyphs washed out on light surfaces */}
|
|
398
|
+
<div className="opacity-90 [:is([data-theme=dark],.dark)_&]:opacity-50" style={{ color: 'var(--kol-surface-on-primary)', position: 'relative' }}>
|
|
392
399
|
{crosshair.map((line, i) => (
|
|
393
400
|
<div key={i}>{line}</div>
|
|
394
401
|
))}
|
|
@@ -460,7 +467,6 @@ function AsciiCursorOverlay({ hideCursor }) {
|
|
|
460
467
|
}
|
|
461
468
|
|
|
462
469
|
const handleContextMenu = (e) => {
|
|
463
|
-
e.preventDefault()
|
|
464
470
|
const now = Date.now()
|
|
465
471
|
if (now - lastInvaderTime.current < 2500) return
|
|
466
472
|
lastInvaderTime.current = now
|
|
@@ -499,8 +505,10 @@ function AsciiCursorOverlay({ hideCursor }) {
|
|
|
499
505
|
* with an ASCII crosshair (diamond variant over interactive elements) and
|
|
500
506
|
* layers ambient effects on top of the page: drifting cursor stars,
|
|
501
507
|
* click-triggered ASCII fireworks, and a right-click Space Invader that
|
|
502
|
-
* drops in, fires, and exits (rate-limited to one per 2.5s
|
|
503
|
-
*
|
|
508
|
+
* drops in, fires, and exits (rate-limited to one per 2.5s). The context menu
|
|
509
|
+
* still opens — the invader is an easter egg, the menu is the browser's
|
|
510
|
+
* (kolkrabbi.io 2026-08-25: swallowing it took copy, open-in-new-tab and
|
|
511
|
+
* inspect off every page).
|
|
504
512
|
*
|
|
505
513
|
* Singleton — mount once at the app root. Portals into `document.body` so
|
|
506
514
|
* it floats above any scroll context. Pure decoration, so it hard-gates:
|
|
@@ -148,7 +148,7 @@ export function usePopover({
|
|
|
148
148
|
/* A tooltip inside a tooltip's trigger (a disabled switch's reason inside its
|
|
149
149
|
* row's hint) hides the outer one while it is open, and hands it back on leave
|
|
150
150
|
* — the innermost wins, as the native `title` it replaced behaved. */
|
|
151
|
-
const TooltipNest = createContext(null)
|
|
151
|
+
const TooltipNest = (globalThis[Symbol.for('@kolkrabbi/kol-component/TooltipNest')] ??= createContext(null))
|
|
152
152
|
|
|
153
153
|
/* `asChild` (the native-title sweep, 2026-09-26): the tooltip attaches to its one child element
|
|
154
154
|
* instead of wrapping it in a span — for a trigger whose box IS the layout (a grid cell, a rail row,
|
|
@@ -260,7 +260,7 @@ function TooltipOn({
|
|
|
260
260
|
* style — extra inline styles merged with floatingStyles
|
|
261
261
|
*/
|
|
262
262
|
/* how many floats this one is opened from inside — context crosses portals, the DOM order does not */
|
|
263
|
-
const FloatDepth = createContext(0)
|
|
263
|
+
const FloatDepth = (globalThis[Symbol.for('@kolkrabbi/kol-component/FloatDepth')] ??= createContext(0))
|
|
264
264
|
|
|
265
265
|
export function PopoverPanel({
|
|
266
266
|
popover,
|
|
@@ -26,7 +26,7 @@ export const TITLE_ROLES = {
|
|
|
26
26
|
mono: { sm: 'kol-mono-heading-03', md: 'kol-mono-display-03', lg: 'kol-mono-display-02', xl: 'kol-mono-display-02' },
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
export const MastheadContext = createContext(null)
|
|
29
|
+
export const MastheadContext = (globalThis[Symbol.for('@kolkrabbi/kol-component/MastheadContext')] ??= createContext(null))
|
|
30
30
|
|
|
31
31
|
/** the masthead in effect — the page's own `masthead` prop, else the Shell's, else null */
|
|
32
32
|
export function useMasthead(own) {
|