@kolkrabbi/kol-component 0.382.0 → 0.383.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 +3 -4
- package/src/index.js +0 -5
- package/src/organisms/LogoSystem.jsx +0 -38
- package/src/organisms/LogoTuner.jsx +0 -32
- package/src/organisms/logoBoard.jsx +0 -61
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kolkrabbi/kol-component",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.383.0",
|
|
4
4
|
"description": "The core component library",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -32,10 +32,9 @@
|
|
|
32
32
|
"embla-carousel-react": "^8.6.0",
|
|
33
33
|
"pdfjs-dist": "^6.3.289",
|
|
34
34
|
"react-syntax-highlighter": "^16.1.1",
|
|
35
|
-
"@kolkrabbi/kol-growth": "^0.5.0",
|
|
36
|
-
"@kolkrabbi/kol-markdown": "^0.2.0",
|
|
37
35
|
"@kolkrabbi/kol-search": "^0.3.0",
|
|
38
|
-
"@kolkrabbi/kol-
|
|
36
|
+
"@kolkrabbi/kol-growth": "^0.5.0",
|
|
37
|
+
"@kolkrabbi/kol-markdown": "^0.2.0"
|
|
39
38
|
},
|
|
40
39
|
"peerDependencies": {
|
|
41
40
|
"@kolkrabbi/kol-icons": ">=0.69.0",
|
package/src/index.js
CHANGED
|
@@ -277,11 +277,6 @@ export { default as FeaturedCarousel } from './organisms/FeaturedCarousel.jsx'
|
|
|
277
277
|
export { default as FeaturesCardSection } from './organisms/FeaturesCardSection.jsx'
|
|
278
278
|
/* the growing line on @kolkrabbi/kol-growth (GrowthLineStage, kol-atlas 2026-10-30) */
|
|
279
279
|
export { default as GrowthLineStage } from './organisms/GrowthLineStage.jsx'
|
|
280
|
-
/* the form tuner's two boards on @kolkrabbi/kol-tuner (W27.4, 2026-11-19) */
|
|
281
|
-
export { default as LogoSystem } from './organisms/LogoSystem.jsx'
|
|
282
|
-
export { default as LogoTuner } from './organisms/LogoTuner.jsx'
|
|
283
|
-
/* the boards' palettes, for a host drawing beside them (a sheet of rolls) */
|
|
284
|
-
export { inksOf as logoInks } from './organisms/logoBoard.jsx'
|
|
285
280
|
/* the app loader's runtime half and its intro claim (LoaderAppIntro, kol-fxr 2026-11-01) — here because GrowthLineStage
|
|
286
281
|
* claims it; kol-framework re-exports it, which stays its documented home */
|
|
287
282
|
export { hideLoaderApp, claimIntro, introClaimed, endIntro, releaseIntro } from './utilities/loaderApp.js'
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { useMemo, useRef } from 'react'
|
|
2
|
-
import { system, systemDrag, grid } from '@kolkrabbi/kol-tuner'
|
|
3
|
-
import { Board, Keylines, Labels, inksOf, useLight } from './logoBoard.jsx'
|
|
4
|
-
|
|
5
|
-
/* LOGOSYSTEM (W27.4, 2026-11-19): the System board of @kolkrabbi/kol-tuner (the canvas's system-01-arcs), a mark built
|
|
6
|
-
* from measures, nothing placed by hand. It draws the form, the wedges, the construction and the math, the grid, the
|
|
7
|
-
* keylines, a reference image and the six handles (y, axisAt, x, angle, footAt, footSize). The settings are the host's:
|
|
8
|
-
* `settings` is the engine's System props as they stand, a handle drag calls `onDrag(key, value)` with the measure under
|
|
9
|
-
* the pointer, a double-click on a handle calls `onDragReset()`, a file dropped on the board calls `onFile(file)`.
|
|
10
|
-
* `reference` is `{ src, w, h }`, drawn faint behind the form. `peek` draws the form alone. */
|
|
11
|
-
export default function LogoSystem({ settings: p, reference, peek = false, onDrag, onDragReset, onFile, className = '' }) {
|
|
12
|
-
const inks = inksOf(p), themeLight = useLight(), light = inks ? inks.light : themeLight, svg = useRef(null), dragging = useRef(null)
|
|
13
|
-
const v = useMemo(() => system(p), [p])
|
|
14
|
-
const grey = p.fill === 'grey', strokeAlpha = grey ? 0.85 : 0.5
|
|
15
|
-
const gridD = p.grid && p.grid !== 'off' && !peek && v.measures ? grid(p.grid, (+p.gridStep || 1) * v.measures.x * (v.box || 480), +p.gridTurn || 0) : ''
|
|
16
|
-
const at = (e) => { const pt = svg.current.createSVGPoint(); pt.x = e.clientX; pt.y = e.clientY; const q = pt.matrixTransform(svg.current.getScreenCTM().inverse()); return [q.x - 600, q.y - 400] }
|
|
17
|
-
const move = (e) => { const k = dragging.current; if (!k) return; const m = at(e); onDrag?.(k, systemDrag(p, k, m[0], m[1])) }
|
|
18
|
-
const refBox = reference && (() => { const k = Math.min(v.box / reference.w, v.box / reference.h), w = reference.w * k, h = reference.h * k; return { x: -w / 2, y: -h / 2, w, h } })()
|
|
19
|
-
|
|
20
|
-
return (
|
|
21
|
-
<div className={`h-full w-full ${className}`.trim()} onDragOver={(e) => e.preventDefault()} onDrop={(e) => { e.preventDefault(); onFile?.(e.dataTransfer.files[0]) }}>
|
|
22
|
-
<Board svgRef={svg} inks={inks} label="Mark built from a few measures">
|
|
23
|
-
{refBox && <image href={reference.src} x={refBox.x} y={refBox.y} width={refBox.w} height={refBox.h} className="kol-logo-ref" />}
|
|
24
|
-
{gridD && <path d={gridD} className="kol-logo-grid" />}
|
|
25
|
-
<path d={v.d} className={`kol-logo-form${grey && !peek ? ' is-grey' : ''}`} />
|
|
26
|
-
{!peek && p.math && <path d={v.wedges} className="kol-logo-wedges" />}
|
|
27
|
-
{!peek && <path d={(p.construction ? v.guides : '') + (p.math ? v.dims : '')} className="kol-logo-lines" opacity={strokeAlpha} />}
|
|
28
|
-
{!peek && p.handles && v.handlePts.map((h) => (
|
|
29
|
-
<circle key={h.k} data-handle={h.k} cx={h.p[0]} cy={h.p[1]} r="9" className="kol-logo-handle"
|
|
30
|
-
onPointerDown={(e) => { e.preventDefault(); e.stopPropagation(); dragging.current = h.k; e.currentTarget.setPointerCapture(e.pointerId) }}
|
|
31
|
-
onPointerMove={move} onPointerUp={() => { dragging.current = null }} onDoubleClick={(e) => { e.preventDefault(); dragging.current = null; onDragReset?.() }} />
|
|
32
|
-
))}
|
|
33
|
-
{p.keylines && !peek && <Keylines box={(v.box || 480) * 1.2} light={light} />}
|
|
34
|
-
{!peek && p.math && <Labels list={v.dimLabels} />}
|
|
35
|
-
</Board>
|
|
36
|
-
</div>
|
|
37
|
-
)
|
|
38
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { useMemo } from 'react'
|
|
2
|
-
import { tuner } from '@kolkrabbi/kol-tuner'
|
|
3
|
-
import { Board, Keylines, Labels, inksOf, useLight } from './logoBoard.jsx'
|
|
4
|
-
|
|
5
|
-
/* LOGOTUNER (W27.4, 2026-11-19): the Tuner board of @kolkrabbi/kol-tuner (the canvas's tuner-01-form), a dropped logo
|
|
6
|
-
* rebuilt from circles and lines on one ladder. It draws the form, the traced line, the circles and dots, the curvature
|
|
7
|
-
* comb, the grid, the keylines and the labels. The settings are the host's: `settings` is the engine's Tuner props,
|
|
8
|
-
* `image` the `Image` it reads (an SVG carries its text as `image.__svg`), and a file dropped on the board or picked by
|
|
9
|
-
* a click calls `onFile(file)`; the host reads it into `image`. `peek` draws the tuned form alone. */
|
|
10
|
-
export default function LogoTuner({ settings: p, image = null, peek = false, onFile, className = '' }) {
|
|
11
|
-
const inks = inksOf(p), themeLight = useLight(), light = inks ? inks.light : themeLight
|
|
12
|
-
const v = useMemo(() => tuner(peek ? { ...p, view: 'tuned' } : p, image), [p, image, peek])
|
|
13
|
-
const grey = p.fill !== 'ink', strokeAlpha = grey ? 0.85 : 0.5
|
|
14
|
-
const pick = (e) => { onFile?.(e.target.files[0]); e.target.value = '' }
|
|
15
|
-
|
|
16
|
-
return (
|
|
17
|
-
<label className={`block h-full w-full cursor-pointer ${className}`.trim()} title="Choose a logo: an SVG or a black and white image"
|
|
18
|
-
onDragOver={(e) => e.preventDefault()} onDrop={(e) => { e.preventDefault(); onFile?.(e.dataTransfer.files[0]) }}>
|
|
19
|
-
<Board inks={inks} label="A form rebuilt from circles and lines">
|
|
20
|
-
{!peek && v.gridD && <path d={v.gridD} className="kol-logo-grid" />}
|
|
21
|
-
<path d={v.d} className={`kol-logo-form${grey && !peek ? ' is-grey' : ''}`} fillRule={v.fillRule || 'evenodd'} />
|
|
22
|
-
{!peek && [v.comb0, v.comb1, v.comb2].map((d, i) => d && <path key={i} d={d} className={`kol-logo-comb is-${i}`} />)}
|
|
23
|
-
{!peek && p.outline && p.view !== 'original' && <path d={v.orig} className="kol-logo-trace" />}
|
|
24
|
-
{!peek && <path d={(p.construction ? v.circles : '') + (p.math ? v.guides : '')} className="kol-logo-lines" opacity={strokeAlpha} />}
|
|
25
|
-
{!peek && p.construction && <path d={v.dots} className="kol-logo-dots" />}
|
|
26
|
-
{!peek && p.keylines && <Keylines box={(v.box || 480) * 1.2} ox={v.boxX} oy={v.boxY} light={light} />}
|
|
27
|
-
{!peek && p.math && <Labels list={v.labels} />}
|
|
28
|
-
</Board>
|
|
29
|
-
<input type="file" accept="image/*,.svg" aria-label="Choose a logo: an SVG or a black and white image" className="sr-only" onChange={pick} />
|
|
30
|
-
</label>
|
|
31
|
-
)
|
|
32
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState } from 'react'
|
|
2
|
-
import { KeylineGuide } from '../atoms/IconPlate.jsx'
|
|
3
|
-
|
|
4
|
-
/* What LogoSystem and LogoTuner share (from apps/tuner, W27.4 2026-11-19): the board, the keylines on it, the labels,
|
|
5
|
-
* the ground the keylines are drawn on. The board is the Line Swell canvas's 1200 x 800 frame with its origin at the
|
|
6
|
-
* centre; it scales to its box and keeps its ratio. Its inks are `.kol-logo-*` rules in kol-components-organisms.css. */
|
|
7
|
-
|
|
8
|
-
/* which ground the keylines sit on: the page's data-theme, followed on a flip */
|
|
9
|
-
export function useLight() {
|
|
10
|
-
const read = () => document.documentElement.dataset.theme === 'light'
|
|
11
|
-
const [light, setLight] = useState(read)
|
|
12
|
-
useEffect(() => {
|
|
13
|
-
const o = new MutationObserver(() => setLight(read()))
|
|
14
|
-
o.observe(document.documentElement, { attributes: true, attributeFilter: ['data-theme'] })
|
|
15
|
-
return () => o.disconnect()
|
|
16
|
-
}, [])
|
|
17
|
-
return light
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/* the 24-unit keylines from KeylineGuide, laid on the board at `box` around (ox, oy) */
|
|
21
|
-
export function Keylines({ box, ox = 0, oy = 0, light }) {
|
|
22
|
-
return (
|
|
23
|
-
<foreignObject x={ox - box / 2} y={oy - box / 2} width={box} height={box} pointerEvents="none">
|
|
24
|
-
<div style={{ position: 'relative', width: '100%', height: '100%' }}><KeylineGuide light={light} /></div>
|
|
25
|
-
</foreignObject>
|
|
26
|
-
)
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/* the canvas's palettes (line-swell.js PALETTES), ink then ground; `custom` takes the settings' own ink and ground */
|
|
30
|
-
const PALETTES = {
|
|
31
|
-
'ink on paper': ['#111111', '#f4f4f4'], 'paper on ink': ['#ffffff', '#000000'], 'white on blue': ['#ffffff', '#0a1fff'],
|
|
32
|
-
'blue on paper': ['#0a1fff', '#f1f1f1'], 'red on ink': ['#e5303f', '#111111'], 'light on grey': ['#fafafa', '#35363a'],
|
|
33
|
-
}
|
|
34
|
-
/* the board's own inks when the settings carry a palette (as the canvas boards draw), else null: the theme's inks.
|
|
35
|
-
`light` says which keylines suit the ground (the engine's keylines rule: luminance over 128) */
|
|
36
|
-
export function inksOf(p) {
|
|
37
|
-
if (!p?.palette) return null
|
|
38
|
-
const pal = PALETTES[p.palette] ?? PALETTES['ink on paper'], custom = p.palette === 'custom'
|
|
39
|
-
const ink = custom ? (p.ink || pal[0]) : pal[0], ground = custom ? (p.ground || pal[1]) : pal[1]
|
|
40
|
-
const g = String(ground).replace('#', ''), lum = g.length === 6 ? parseInt(g.slice(0, 2), 16) * 0.299 + parseInt(g.slice(2, 4), 16) * 0.587 + parseInt(g.slice(4, 6), 16) * 0.114 : 255
|
|
41
|
-
return { ink, ground, light: lum > 128 }
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/* the board: the 1200 x 800 frame, centred and scaled to fit; `svgRef` reads pointer positions in board units.
|
|
45
|
-
`inks` (inksOf): the ground behind the board and the ink of its form, lines and labels; the grey form is the
|
|
46
|
-
canvas's #b3b3b3 there */
|
|
47
|
-
export function Board({ svgRef, label, inks = null, children }) {
|
|
48
|
-
return (
|
|
49
|
-
<svg ref={svgRef} viewBox="0 0 1200 800" preserveAspectRatio="xMidYMid meet" role="img" aria-label={label}
|
|
50
|
-
style={inks ? { '--kol-logo-ink': inks.ink, '--kol-logo-ground': inks.ground } : undefined}
|
|
51
|
-
className={`kol-logo-board block h-full w-full touch-none select-none${inks ? ' is-inked' : ''}`}>
|
|
52
|
-
<g transform="translate(600 400)">{children}</g>
|
|
53
|
-
</svg>
|
|
54
|
-
)
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/* labels the engine places on the board, as text in board units so they scale with it; the canvas laid them as 15/16
|
|
58
|
-
* HTML with its top 13 above the point, so the baseline lands 1 above it */
|
|
59
|
-
export function Labels({ list }) {
|
|
60
|
-
return list.map((l, i) => <text key={i} x={l.x} y={l.y - 1} className="kol-logo-label" pointerEvents="none" xmlSpace="preserve">{l.t}</text>)
|
|
61
|
-
}
|