@kolkrabbi/kol-component 0.331.0 → 0.333.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.331.0",
3
+ "version": "0.333.0",
4
4
  "description": "The core component library",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -26,8 +26,8 @@
26
26
  "embla-carousel-react": "^8.6.0",
27
27
  "pdfjs-dist": "^6.3.289",
28
28
  "react-syntax-highlighter": "^16.1.1",
29
+ "@kolkrabbi/kol-growth": "^0.5.0",
29
30
  "@kolkrabbi/kol-search": "^0.3.0",
30
- "@kolkrabbi/kol-growth": "^0.4.0",
31
31
  "@kolkrabbi/kol-markdown": "^0.2.0"
32
32
  },
33
33
  "peerDependencies": {
@@ -75,7 +75,10 @@ import { floatSurfaceClass } from '../utilities/tone.js'
75
75
  * @param {boolean} [labels=false] the tab bar with labels: 66 tall, items 58 tall and 84 wide, 4 in, a 24 glyph over an 11 label
76
76
  * @param {boolean} [foldable=false] a sideways swipe (> 40px) folds the pill into a 28×72 edge tab; a tap restores it
77
77
  * @param {boolean} [folded] · {Function} [onFoldChange] the folded state, controlled (else the pill holds it)
78
- * @param {'left'|'right'} [foldSide='left'] the screen edge the tab sits on
78
+ * @param {'left'|'right'|'swipe'} [foldSide='left'] the screen edge the tab sits on; `swipe` — the edge the swipe went toward
79
+ * (FloatFoldBothSidesGrey, kol-fxr 2026-11-03)
80
+ * @param {'ground'|'handle'} [foldTone='ground'] the edge tab's look: `ground` is the pill's own; `handle` is the grey edge
81
+ * handle (iOS's), `--kol-oq-24` with an `--kol-oq-96` chevron, whatever the pill's `surface`
79
82
  * Tabs are `{ id, label }` or `{ value, label }` (either key), plus `icon` for stacked; a stacked tab's `selected`
80
83
  * lights it whatever `value` is — action slots (the transport) light more than one.
81
84
  */
@@ -103,7 +106,7 @@ export const tabbarPillSlot = (at, { count, labels = false, split = false } = {}
103
106
  /* the collapse's motion — one duration for the width and the glyph swap (300, user 2026-10-23: 180 read as abrupt) */
104
107
  const COLLAPSE_MS = 300
105
108
 
106
- export default function TabsRow({ tabs: raw = [], value, onChange, onClose, onMinimise, variant, look: lookLegacy, type = 'mono', filled = false, placement = 'inline', shape = 'bar', collapsed = false, onExpand, edge, border, shadow, dock, active, foldable, folded, onFoldChange, foldSide, surface, split, labels, size, tracked = false, overflow = 'scroll', ariaLabel, className, style }) {
109
+ export default function TabsRow({ tabs: raw = [], value, onChange, onClose, onMinimise, variant, look: lookLegacy, type = 'mono', filled = false, placement = 'inline', shape = 'bar', collapsed = false, onExpand, edge, border, shadow, dock, active, foldable, folded, onFoldChange, foldSide, foldTone, surface, split, labels, size, tracked = false, overflow = 'scroll', ariaLabel, className, style }) {
107
110
  const tabs = raw.map((t) => ({ ...t, id: t.id ?? t.value }))
108
111
  const look = variant ?? lookLegacy ?? 'underline'
109
112
  const wrap = overflow === 'wrap'
@@ -111,7 +114,7 @@ export default function TabsRow({ tabs: raw = [], value, onChange, onClose, onMi
111
114
  if (look === 'float') return <Overflow mode={overflow} value={value}><ChipTabs tabs={tabs} value={value} onChange={onChange} size={size ?? 'md'} float ariaLabel={ariaLabel} className={`${wrap ? 'flex-wrap ' : ''}${className ?? ''}`} /></Overflow>
112
115
  if (look === 'chip') return <Overflow mode={overflow} value={value}><ChipTabs tabs={tabs} value={value} onChange={onChange} size={size ?? 'sm'} filled={filled} ariaLabel={ariaLabel} className={`${wrap ? 'flex-wrap ' : ''}${className ?? ''}`} /></Overflow>
113
116
  if (look === 'text') return <Overflow mode={overflow} value={value}><TextTabs tabs={tabs} value={value} onChange={onChange} size={size ?? 14} tracked={tracked} className={`${wrap ? 'flex-wrap gap-y-2 ' : ''}${className ?? 'gap-6'}`} style={style} /></Overflow>
114
- if (look === 'stacked') return <StackedTabs tabs={tabs} value={value} onChange={onChange} placement={placement} shape={shape} collapsed={collapsed} onExpand={onExpand} edge={edge} border={border} shadow={shadow} dock={dock} active={active} foldable={foldable} folded={folded} onFoldChange={onFoldChange} foldSide={foldSide} surface={surface} split={split} labels={labels} ariaLabel={ariaLabel} className={className ?? ''} />
117
+ if (look === 'stacked') return <StackedTabs tabs={tabs} value={value} onChange={onChange} placement={placement} shape={shape} collapsed={collapsed} onExpand={onExpand} edge={edge} border={border} shadow={shadow} dock={dock} active={active} foldable={foldable} folded={folded} onFoldChange={onFoldChange} foldSide={foldSide} foldTone={foldTone} surface={surface} split={split} labels={labels} ariaLabel={ariaLabel} className={className ?? ''} />
115
118
  return <Overflow mode={overflow} value={value}><UnderlineTabs tabs={tabs} value={value} onChange={onChange} onClose={onClose} onMinimise={onMinimise} wrap={wrap} type={type} /></Overflow>
116
119
  }
117
120
 
@@ -174,9 +177,10 @@ function TextTabs({ tabs, value, onChange, size, tracked, className, style }) {
174
177
  /* the fold: a sideways swipe past this folds the pill, as frame E's prototype measures it */
175
178
  const FOLD_SWIPE = 40
176
179
 
177
- function StackedTabs({ tabs, value, onChange, placement, shape = 'bar', collapsed = false, onExpand, edge = 'bottom', border = true, shadow = false, dock = false, active: activeShape = 'fill', foldable = false, folded: foldedProp, onFoldChange, foldSide = 'left', surface = 'solid', split: splitProp = false, labels = false, ariaLabel = 'Sections', className }) {
180
+ function StackedTabs({ tabs, value, onChange, placement, shape = 'bar', collapsed = false, onExpand, edge = 'bottom', border = true, shadow = false, dock = false, active: activeShape = 'fill', foldable = false, folded: foldedProp, onFoldChange, foldSide: foldSideProp = 'left', foldTone = 'ground', surface = 'solid', split: splitProp = false, labels = false, ariaLabel = 'Sections', className }) {
178
181
  const [foldedOwn, setFoldedOwn] = useState(false)
179
182
  const swipe = useRef({ x: null, swiped: false })
183
+ const [swipeSide, setSwipeSide] = useState('left')
180
184
  if (tabs.length === 0) return null
181
185
  const phone = placement === 'phone'
182
186
  const pill = phone && shape === 'pill'
@@ -199,26 +203,28 @@ function StackedTabs({ tabs, value, onChange, placement, shape = 'bar', collapse
199
203
  onPointerUp: (e) => {
200
204
  const { x } = swipe.current
201
205
  swipe.current.x = null
202
- if (x != null && Math.abs(e.clientX - x) > FOLD_SWIPE) { swipe.current.swiped = true; setFolded(true) }
206
+ if (x != null && Math.abs(e.clientX - x) > FOLD_SWIPE) { swipe.current.swiped = true; setSwipeSide(e.clientX < x ? 'left' : 'right'); setFolded(true) }
203
207
  },
204
208
  /* a swipe that ended on a slot must not also press it */
205
209
  onClickCapture: (e) => { if (swipe.current.swiped) { swipe.current.swiped = false; e.stopPropagation(); e.preventDefault() } },
206
210
  style: { touchAction: 'pan-y' },
207
211
  } : {}
208
212
  if (isFolded) {
213
+ const foldSide = foldSideProp === 'swipe' ? swipeSide : foldSideProp
214
+ const handle = foldTone === 'handle'
209
215
  /* THE EDGE TAB (frame E): 28×72 flush to the screen edge, the pill's ground, no border, a chevron pointing back in */
210
216
  return (
211
217
  <button
212
218
  type="button"
213
219
  aria-label={`Show ${ariaLabel.toLowerCase()}`}
214
220
  onClick={() => setFolded(false)}
215
- className={`kol-mobile-tabbar-tab md:hidden fixed z-[calc(var(--kol-z-sticky)+1)] flex items-center justify-center cursor-pointer ${material}`.trim()}
221
+ className={`kol-mobile-tabbar-tab md:hidden fixed z-[calc(var(--kol-z-sticky)+1)] flex items-center justify-center cursor-pointer ${handle ? '' : material}`.trim()}
216
222
  style={{
217
223
  [foldSide]: 0,
218
224
  [top ? 'top' : 'bottom']: `calc(env(safe-area-inset-${top ? 'top' : 'bottom'}, 0px) + ${TABBAR_PILL_INSET + 8}px)`,
219
225
  width: 28, height: 72, padding: 0, border: 'none',
220
226
  borderRadius: foldSide === 'left' ? '0 16px 16px 0' : '16px 0 0 16px',
221
- ...(glass ? {} : { background: 'var(--kol-surface-secondary)' }), color: RAIL_ROW.rest,
227
+ ...(handle ? { background: 'var(--kol-oq-24)' } : glass ? {} : { background: 'var(--kol-surface-secondary)' }), color: handle ? RAIL_ROW.active : RAIL_ROW.rest,
222
228
  }}
223
229
  >
224
230
  <Icon name={foldSide === 'left' ? 'chevron-right' : 'chevron-left'} size={18} />
@@ -1,5 +1,5 @@
1
1
  import { useEffect, useRef } from 'react'
2
- import { Growth, densityFrom, mulberry32, orbCanvas, pathCanvas } from '@kolkrabbi/kol-growth'
2
+ import { Growth, densityFrom, mulberry32, orbCanvas, outline, pathCanvas, pathRing } from '@kolkrabbi/kol-growth'
3
3
  import usePrefersReducedMotion from '../hooks/usePrefersReducedMotion.js'
4
4
  import { claimIntro, endIntro, hideLoaderApp, releaseIntro } from '../utilities/loaderApp.js'
5
5
 
@@ -32,6 +32,11 @@ import { claimIntro, endIntro, hideLoaderApp, releaseIntro } from '../utilities/
32
32
  * REDUCED MOTION — no intro (`onIntroBreath` and `onIntroEnd` fire at once), no wave, no pointer force: the finished line is grown off
33
33
  * screen and drawn once.
34
34
  *
35
+ * THE SEED (GrowthLineSeedOutline, kol-atlas 2026-11-01): `seed="centre"` (default) starts a small ring at the shape's
36
+ * centre of darkness (the intro's at the box's centre); `seed="outline"` starts one ring on the shape's edge — the path
37
+ * itself for a path `d`, the density's 0.5 iso-line otherwise — inset `minGap` so it starts inside, and the line fills
38
+ * inward. A number is still the rng seed (the same number grows the same line).
39
+ *
35
40
  * `shape` — 'orb' · an SVG path `d` (centred at `fit` of the box) · `(w, h) => canvas` (dark on light). */
36
41
  const ORB_PARAMS = { minGap: 6, maxGap: 24, contrast: 1.4, growth: 2.5 }
37
42
  const WAVE = { ms: 24000, a: 9, l: 640 }
@@ -92,16 +97,19 @@ export default function GrowthLineStage({ shape = 'orb', fit, params = ORB_PARAM
92
97
  fitCanvas()
93
98
  const src = shapeCanvas(shapeRef.current, w, h, k)
94
99
  if (!src) return false
95
- sim = new Growth({ w, h, density: densityFrom(src), rand: seed == null ? Math.random : mulberry32(seed), cap: capOf() })
100
+ sim = new Growth({ w, h, density: densityFrom(src), rand: typeof seed === 'number' ? mulberry32(seed) : Math.random, cap: capOf() })
96
101
  sim.setParams({ bleed: 48, settle: 60, ...(intro && !reduced ? INTRO_PARAMS : params) })
102
+ /* the outline seed: the path itself, or the density's iso-line; null (nothing traced) falls back to the centre */
103
+ const ring = seed === 'outline' && (typeof shapeRef.current === 'string' && shapeRef.current !== 'orb' ? pathRing(shapeRef.current, w / h, k) : outline(sim.density))
104
+ const seedAt = (...centre) => (ring ? sim.seed({ points: ring, inset: sim.minGap }) : sim.seed(...centre))
97
105
  if (intro && !reduced) {
98
- sim.seed(0.5, 0.5)
106
+ seedAt(0.5, 0.5)
99
107
  const probe = document.createElement('span'); probe.className = 'text-emphasis'; canvas.parentElement.append(probe)
100
108
  it = { t0: 0, ink: 1, out: 0, bright: getComputedStyle(probe).color, mark: sim.density, mix: null }
101
109
  probe.remove(); masks()
102
110
  claim = claimIntro()
103
111
  } else {
104
- sim.seed()
112
+ seedAt()
105
113
  if (intro) { breathRef.current?.(); endRef.current?.() }
106
114
  }
107
115
  return true