@kolkrabbi/kol-component 0.331.0 → 0.332.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.332.0",
|
|
4
4
|
"description": "The core component library",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -26,9 +26,9 @@
|
|
|
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-
|
|
30
|
-
"@kolkrabbi/kol-
|
|
31
|
-
"@kolkrabbi/kol-
|
|
29
|
+
"@kolkrabbi/kol-growth": "^0.5.0",
|
|
30
|
+
"@kolkrabbi/kol-markdown": "^0.2.0",
|
|
31
|
+
"@kolkrabbi/kol-search": "^0.3.0"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"@kolkrabbi/kol-icons": ">=0.22.0",
|
|
@@ -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
|
|
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
|
-
|
|
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
|
-
|
|
112
|
+
seedAt()
|
|
105
113
|
if (intro) { breathRef.current?.(); endRef.current?.() }
|
|
106
114
|
}
|
|
107
115
|
return true
|