nuclo 0.3.36 → 0.3.38
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/README.md
CHANGED
|
@@ -791,6 +791,19 @@ On the client, call `hydrate(App, document.getElementById('app')!)` instead of `
|
|
|
791
791
|
|
|
792
792
|
`nuclo/ssr` also exports `renderManyToString(inputs)` for rendering a batch of trees at once, and `renderToStringWithContainer(input, containerTag?, containerAttrs?)` to wrap the output in a container element without a second serialization pass.
|
|
793
793
|
|
|
794
|
+
### Nuclo Logo
|
|
795
|
+
|
|
796
|
+
`nuclo/nuclo-logo` draws the Nuclo logo (mark and name) as an `<svg>`, the way nuclo.dev does. It's a separate entry, so apps that don't import it don't ship it:
|
|
797
|
+
|
|
798
|
+
```ts
|
|
799
|
+
import 'nuclo';
|
|
800
|
+
import nucloLogo from 'nuclo/nuclo-logo';
|
|
801
|
+
|
|
802
|
+
render(() => header(nucloLogo({ height: 48 }, { className: 'brand' })), document.body);
|
|
803
|
+
```
|
|
804
|
+
|
|
805
|
+
`height` is in px (default `32`). The name takes the text color. It draws itself once on mount; pass `animate: false`, or prefer reduced motion, to get the finished logo straight away. Extra modifiers after the options go on the `<svg>`.
|
|
806
|
+
|
|
794
807
|
---
|
|
795
808
|
|
|
796
809
|
## Best Practices
|
|
@@ -951,9 +964,9 @@ Registered state-dependent values (text, attributes, `list()`, `when()`) are pru
|
|
|
951
964
|
|
|
952
965
|
Full documentation is available at [https://nuclo.dev/](https://nuclo.dev/)
|
|
953
966
|
|
|
954
|
-
- [Getting Started](https://nuclo.dev/docs#quick-start)
|
|
955
|
-
- [API Reference](https://nuclo.dev/docs#api-index)
|
|
956
|
-
- [Examples](https://nuclo.dev/examples)
|
|
967
|
+
- [Getting Started](https://nuclo.dev/en/docs#quick-start)
|
|
968
|
+
- [API Reference](https://nuclo.dev/en/docs#api-index)
|
|
969
|
+
- [Examples](https://nuclo.dev/en/examples)
|
|
957
970
|
|
|
958
971
|
---
|
|
959
972
|
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=Math.PI,t=t=>Array.from({length:361},(n,r)=>{let i=r/360*2*e;return[64*Math.cos(i)+t*Math.cos(2*i),64*Math.sin(i)-t*Math.sin(2*i)]}),n=t(90),r=t(12),i=t(0);function a(e,t,a){let o=n=>n.map(([n,r])=>[t+e*n,a+e*r]);return{hub:o(i),shape:o(n),play:o(r),cx:t,cy:a,ring:96*e,wheel:32*e}}a(88/154,100,100);const o=34*e/180,s=[36,27,20,25],c=(e,t,n,r)=>({len:Math.hypot(n-e,r-t),at:i=>[e+(n-e)*i,t+(r-t)*i]}),l=(e,t,n,r,i)=>({len:n*Math.abs(i-r),at:a=>[e+n*Math.cos(r+(i-r)*a),t-n*Math.sin(r+(i-r)*a)]}),u=e=>{let t=e.reduce((e,t)=>e+t.len,0),n=0,r=0;return Array.from({length:361},(i,a)=>{let o=a/360*t;for(;n<e.length-1&&r+e[n].len<o;)r+=e[n++].len;return e[n].at((o-r)/e[n].len)})},d=(t,n)=>{let r=n?264:120,i=n?176:208,a=n?0:2*e,o=t+120;return u([c(t,r,t,i),l(t+60,i,60,e,a),c(o,i,o,r),c(o,r,o-24,r),c(o-24,r,o-24,i),l(t+60,i,36,a,e),c(t+24,i,t+24,r),c(t+24,r,t,r)])},f=t=>{let n=Math.asin(3/73),r=Math.asin(3/55),i=(e,n)=>[t+e*Math.cos(n),192-e*Math.sin(n)],a=(e,t,n)=>c(...i(e,n),...i(t,n)),s=(e,t,n,r)=>l(...i(e,t),3,n,r);return u([l(t,192,76,o+n,2*e-o-n),s(73,-o-n,-o-n,-o+e/2),a(73*Math.cos(n),55*Math.cos(r),-o),s(55,-o-r,-o+e/2,-o-r+e),l(t,192,52,2*e-o-r,o+r),s(55,o+r,o+r+e,o+1.5*e),a(55*Math.cos(r),73*Math.cos(n),o),s(73,o+n,o+1.5*e,o+n+2*e)])},p=t=>u([l(t+13,57,13,e,0),c(t+26,57,t+26,255),l(t+13,255,13,0,-e),c(t,255,t,57)]),m=t=>[u([l(t,192,76,e,3*e)]),u([l(t,192,52,e,-e)])],h=[[e=>[d(e,!0)],120],[e=>[d(e,!1)],120],[e=>[f(e+76)],76+76*Math.cos(o)],[e=>[p(e)],26],[e=>m(e+76),152]],g=n.map(e=>e[0]),_=n.map(e=>e[1]),v=1.45*144/(Math.max(..._)-Math.min(..._)),y=a(v,48-v*Math.min(...g),264-v*Math.max(..._));let b=y.cx+v*Math.max(...g)+36;const x=h.map(([e,t],n)=>{let r=e(b);return b+=t+(s[n]??0),r});function S(e,t=5){let n=e.flat(),r=Math.floor(Math.min(...n.map(e=>e[0]))-t),i=Math.floor(Math.min(...n.map(e=>e[1]))-t),a=Math.ceil(Math.max(...n.map(e=>e[0]))+t),o=Math.ceil(Math.max(...n.map(e=>e[1]))+t);return[r,i,a-r,o-i]}const C=S([y.shape,...x.flat()]),w=(e,t=360)=>e.map(e=>`M`+e.slice(0,t+1).map(e=>e.map(e=>Math.round(e*10)/10).join(`,`)).join(`L`)+(t===360?`Z`:``)).join(``),T={from:`#ea3f25`,to:`#ed6a2c`},E=`#f26a2e`,D=.2;let O=0;function k({height:e=32,animate:t=!0}={},...n){let r=`nuclo-logo-${O++}`,i=Math.round(e*C[2]/C[3]),a=+(1.2/(i/C[2])).toFixed(2),o=(e,t,n,r=!1)=>({contours:e,fill:t,start:n,end:n+(r?.6:1.4),letter:r,k:360,ink:1}),s=[o([y.shape],`url(#${r}-fill)`,0),o([y.play],`#111`,0),...x.map((e,t)=>o(e,`currentColor`,1.2+t*.39999999999999997,!0))],c=s[0],l=s[s.length-1].end+D,u=l;function d(){let e=(e,t)=>Math.min(1,Math.max(0,(u-e)/(t-e)));for(let t of s)t.k=Math.round((.5-Math.cos(Math.PI*e(t.start,t.end))/2)*360),t.ink=e(t.end,t.end+D);update(r)}function f(){if(!t||globalThis.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches)return;let e=performance.now(),n=0,r=t=>{u=Math.min(l,(t-e)/1e3),d(),u<l&&(n=requestAnimationFrame(r))};return u=0,d(),n=requestAnimationFrame(r),()=>cancelAnimationFrame(n)}let p=(e,t)=>circleSvg({cx:()=>t[e.k][0],cy:()=>t[e.k][1],r:5,fill:`currentColor`,stroke:E,"stroke-width":1.5,opacity:()=>u<=e.start?0:1-e.ink}),m=e=>lineSvg({x1:()=>y.hub[e.k][0],y1:()=>y.hub[e.k][1],x2:()=>e.contours[0][e.k][0],y2:()=>e.contours[0][e.k][1]}),h=e=>pathSvg({d:()=>w(e.contours,e.k),fill:e.fill,"fill-opacity":()=>e.ink,stroke:e.letter?e.fill:E,"stroke-width":a,"stroke-opacity":()=>e.letter||e.ink<1?1:0});return svgSvg({viewBox:C.join(` `),width:i,height:e,role:`img`,"aria-label":`Nuclo`,onMount:f},...n,scope(r),defsSvg(linearGradientSvg({id:`${r}-fill`,x1:0,y1:0,x2:0,y2:1},stopSvg({offset:`0`,"stop-color":T.from}),stopSvg({offset:`1`,"stop-color":T.to}))),gSvg({fill:`none`,stroke:E,"stroke-width":a,opacity:()=>1-c.ink},circleSvg({cx:y.cx,cy:y.cy,r:y.ring,"stroke-opacity":.25}),circleSvg({cx:()=>y.hub[c.k][0],cy:()=>y.hub[c.k][1],r:y.wheel}),m(s[0]),m(s[1])),...s.map(h),...s.flatMap(e=>e.contours.map(t=>p(e,t))))}module.exports=k;
|
|
2
|
+
//# sourceMappingURL=nuclo.logo.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nuclo.logo.cjs","names":["ic","PI","lap","t","i","d","rawShape","rawPlay","rawHub","placeIcon","place","pts","x","y","cx","s","cy","a","kern","line","x1","x0","y1","y0","arc","rad","to","from","trace","L","segs","sum","done","n","arch","up","c","end","rx","open","fo","fi","at","ang","cut","r0","r1","corner","cr","pill","ring","letters","xs","p","ys","S","brandIcon","glyphs","glyph","w","contours","box","margin","brandBox","pathD","k","v","GRADIENT","STROKE","INK_SET","instances","nucloLogo","mods","id","width","height","sw","piece","start","letter","pieces","wheel","total","now","paint","seg","draw","animate","raf","frame","ms","pen","arm"],"sources":["../../src/logo/geometry.ts","../../src/logo/index.ts"],"sourcesContent":["// The Nuclo mark and wordmark as point lists: pure math, no DOM. The components\n// draw them and scripts/render-brand.ts writes the static SVG and PNG assets\n// from them, so every logo on the site comes from this one source.\n\nexport const N = 360; // points per contour. One wheel lap draws the icon; each pen draws its glyph in the same N steps\nconst PI = Math.PI;\n\n// ── The icon: a hypotrochoid with two pens on one wheel ──────────────────\nexport const R = 96; // the fixed ring\nexport const r = 32; // the rolling wheel. R / r = 3 gives three lobes\nconst outer = 90; // the shape's pen. d > r: the lobes overlap\nconst inner = 12; // the play triangle's pen. d < r: a rounded triangle\n\n// One lap of a pen at distance d from the wheel's center, around the origin\nconst lap = (d: number) =>\n Array.from({ length: N + 1 }, (_, i) => {\n const t = (i / N) * 2 * PI;\n return [(R - r) * Math.cos(t) + d * Math.cos(((R - r) / r) * t), (R - r) * Math.sin(t) - d * Math.sin(((R - r) / r) * t)];\n });\nconst rawShape = lap(outer);\nconst rawPlay = lap(inner);\nconst rawHub = lap(0);\n\nexport type Icon = { hub: number[][]; shape: number[][]; play: number[][]; cx: number; cy: number; ring: number; wheel: number };\n\n/** The icon scaled by s with the wheel's center at (cx, cy). */\nexport function placeIcon(s: number, cx: number, cy: number): Icon {\n const place = (pts: number[][]) => pts.map(([x, y]) => [cx + s * x, cy + s * y]);\n return { hub: place(rawHub), shape: place(rawShape), play: place(rawPlay), cx, cy, ring: R * s, wheel: r * s };\n}\n\n/** The icon alone in a 200 × 200 box, the outer pen touching the box's margin. */\nexport const icon = placeIcon(88 / (R - r + outer), 100, 100);\n\n// ── The wordmark on its unit grid. U is the module; the sizes are multiples of it ──\nconst U = 24;\nconst stem = U; // every stroke, straight or round, is one unit thick\nconst xh = 6 * U; // x-height\nconst pad = 2 * U;\nconst base = 9 * U + pad; // the baseline. The l is 9 units tall\nconst top = base - xh; // the x-height line\nconst mid = top + xh / 2;\nconst ovr = 4; // round forms overshoot the x-height and the baseline, so they look aligned\nconst ro = xh / 2 + ovr; // outer radius of c and o\nconst ri = ro - stem; // their counter\nconst A = 2.5 * U; // arch radius of n and u: narrower than the bowls\nconst lw = stem + 2; // the l is two units wider: a lone stem with round ends looks lighter\nconst a = (34 * PI) / 180; // half of the c's opening\n// The space between the inks of each pair, set by eye: n–u, u–c, c–l, l–o\nconst kern = [36, 27, 20, 25];\n\n// Each contour is a chain of lines and arcs. Angles turn counterclockwise and 0 points right\ntype Seg = { len: number; at: (t: number) => number[] };\nconst line = (x0: number, y0: number, x1: number, y1: number): Seg => ({\n len: Math.hypot(x1 - x0, y1 - y0),\n at: (t) => [x0 + (x1 - x0) * t, y0 + (y1 - y0) * t],\n});\nconst arc = (cx: number, cy: number, rad: number, from: number, to: number): Seg => ({\n len: rad * Math.abs(to - from),\n at: (t) => [cx + rad * Math.cos(from + (to - from) * t), cy - rad * Math.sin(from + (to - from) * t)],\n});\n// N + 1 points along the chain, the same distance apart\nconst trace = (segs: Seg[]) => {\n const L = segs.reduce((sum, s) => sum + s.len, 0);\n let i = 0;\n let done = 0;\n return Array.from({ length: N + 1 }, (_, n) => {\n const d = (n / N) * L;\n while (i < segs.length - 1 && done + segs[i].len < d) done += segs[i++].len;\n return segs[i].at((d - done) / segs[i].len);\n });\n};\n\n// n: two stems and an arch over the top. u: the same glyph, arch under the bottom\nconst arch = (x: number, up: boolean) => {\n const y = up ? base : top; // where the stems end, flat on the line\n const c = up ? top + A - ovr : base - A + ovr; // the arch's center. The arch overshoots the line like the o does\n const end = up ? 0 : 2 * PI; // the arch turns over the top, or under the bottom\n const rx = x + 2 * A;\n return trace([\n line(x, y, x, c),\n arc(x + A, c, A, PI, end),\n line(rx, c, rx, y),\n line(rx, y, rx - stem, y),\n line(rx - stem, y, rx - stem, c),\n arc(x + A, c, A - stem, end, PI),\n line(x + stem, c, x + stem, y),\n line(x + stem, y, x, y),\n ]);\n};\n// c: the o cut open on the right, 34° above and below the center line. The cuts point at the center.\n// Their four corners are rounded by q, so the cut ends sit with the pill of the l\nconst open = (cx: number) => {\n const q = 3;\n const fo = Math.asin(q / (ro - q)); // where a corner arc meets the outer circle, from the cut\n const fi = Math.asin(q / (ri + q)); // and the inner circle\n const at = (rad: number, ang: number): [number, number] => [cx + rad * Math.cos(ang), mid - rad * Math.sin(ang)];\n const cut = (r0: number, r1: number, ang: number) => line(...at(r0, ang), ...at(r1, ang));\n const corner = (cr: number, ang: number, from: number, to: number) => arc(...at(cr, ang), q, from, to);\n return trace([\n arc(cx, mid, ro, a + fo, 2 * PI - a - fo), // the outer curve, over the top and down the left\n corner(ro - q, -a - fo, -a - fo, -a + PI / 2), // the lower cut: outer corner,\n cut((ro - q) * Math.cos(fo), (ri + q) * Math.cos(fi), -a), // the cut,\n corner(ri + q, -a - fi, -a + PI / 2, -a - fi + PI), // inner corner\n arc(cx, mid, ri, 2 * PI - a - fi, a + fi), // the counter, back up the left\n corner(ri + q, a + fi, a + fi + PI, a + 1.5 * PI), // the upper cut: inner corner,\n cut((ri + q) * Math.cos(fi), (ro - q) * Math.cos(fo), a), // the cut,\n corner(ro - q, a + fo, a + 1.5 * PI, a + fo + 2 * PI), // outer corner\n ]);\n};\n// l: a pill from the ascender line to the baseline. Its round ends overshoot both lines like the bowls do\nconst pill = (x: number) => {\n const rad = lw / 2;\n const y0 = base - 9 * U - ovr + rad; // the center of the top cap\n const y1 = base + ovr - rad; // and of the bottom cap\n return trace([arc(x + rad, y0, rad, PI, 0), line(x + lw, y0, x + lw, y1), arc(x + rad, y1, rad, 0, -PI), line(x, y1, x, y0)]);\n};\n// o: two circles. They run in opposite directions, so the fill leaves the counter open\nconst ring = (cx: number) => [trace([arc(cx, mid, ro, PI, 3 * PI)]), trace([arc(cx, mid, ri, PI, -PI)])];\n\n// Each letter: its contours at x, and the width of its ink. The c's ink stops at its terminals\nconst letters: [(x: number) => number[][][], number][] = [\n [(x) => [arch(x, true)], 2 * A],\n [(x) => [arch(x, false)], 2 * A],\n [(x) => [open(x + ro)], ro + ro * Math.cos(a)],\n [(x) => [pill(x)], lw],\n [(x) => ring(x + ro), 2 * ro],\n];\n\n// ── The lockup: icon and wordmark on one baseline ────────────────────────\n// The icon is 1.45 x-heights tall, so it leads but does not overpower the word; its lowest lobe\n// touches the baseline; the n starts 1.5 stems after the tip of the right lobe\nconst xs = rawShape.map((p) => p[0]);\nconst ys = rawShape.map((p) => p[1]);\nconst S = (1.45 * xh) / (Math.max(...ys) - Math.min(...ys));\nexport const brandIcon = placeIcon(S, pad - S * Math.min(...xs), base - S * Math.max(...ys));\n\nlet x = brandIcon.cx + S * Math.max(...xs) + 1.5 * stem;\n/** The wordmark: one list of contours per letter. */\nexport const glyphs = letters.map(([glyph, w], i) => {\n const contours = glyph(x);\n x += w + (kern[i] ?? 0);\n return contours;\n});\n\n/** The box around a drawing: [x, y, width, height], with room for the pens that ride the outlines. */\nexport function box(contours: number[][][], margin = 5): [number, number, number, number] {\n const pts = contours.flat();\n const x0 = Math.floor(Math.min(...pts.map((p) => p[0])) - margin);\n const y0 = Math.floor(Math.min(...pts.map((p) => p[1])) - margin);\n const x1 = Math.ceil(Math.max(...pts.map((p) => p[0])) + margin);\n const y1 = Math.ceil(Math.max(...pts.map((p) => p[1])) + margin);\n return [x0, y0, x1 - x0, y1 - y0];\n}\nexport const brandBox = box([brandIcon.shape, ...glyphs.flat()]);\n\n/** The path of the first k points of each contour, closed once the contour is complete. */\nexport const pathD = (contours: number[][][], k = N) =>\n contours.map((pts) => \"M\" + pts.slice(0, k + 1).map((p) => p.map((v) => Math.round(v * 10) / 10).join(\",\")).join(\"L\") + (k === N ? \"Z\" : \"\")).join(\"\");\n\nexport const GRADIENT = { from: \"#ea3f25\", to: \"#ed6a2c\" };\nexport const INK = \"#111\";\nexport const STROKE = \"#f26a2e\";\n","/**\n * nuclo/nuclo-logo — the Nuclo logo (mark and name) as a nuclo component, drawn the\n * way nuclo.dev draws it: a Spirograph wheel rolls inside a ring and its two pens\n * trace the mark; then a pen writes each letter, n to o, each inking as the next begins.\n *\n * import nucloLogo from \"nuclo/nuclo-logo\";\n * main(nucloLogo({ height: 48 }));\n *\n * Its own entry, so apps that never show the logo never ship it. It builds on the\n * runtime's globals (svgSvg, scope, update, …), so the app imports \"nuclo\" as usual.\n * The svg starts finished, which is what SSR sends; on mount it is drawn again unless\n * `animate` is off or the visitor prefers reduced motion.\n */\nimport { brandBox, brandIcon as ic, glyphs, pathD, GRADIENT, INK, N, STROKE } from \"./geometry\";\n\nexport type NucloLogoOptions = {\n\t/** Height in px; the width follows the logo's proportions. Default 32. */\n\theight?: number;\n\t/** Draw the logo when it mounts. Default true. */\n\tanimate?: boolean;\n};\n\nconst ICON_DRAW = 1.4; // seconds the wheel takes\nconst LETTER_DRAW = 0.6; // seconds a pen takes per letter\nconst LEAD = 0.2; // how early each letter starts, before the last one ends\nconst INK_SET = 0.2; // seconds the ink takes to set, once the pen has closed the outline\n\n// One drawn thing: its contours, its fill and when its pen runs. k is how many points are drawn, ink its fill\ntype Piece = { contours: number[][][]; fill: string; start: number; end: number; letter: boolean; k: number; ink: number };\n\nlet instances = 0;\n\nexport default function nucloLogo({ height = 32, animate = true }: NucloLogoOptions = {}, ...mods: SVGElementModifierLike<\"svg\">[]) {\n\tconst id = `nuclo-logo-${instances++}`;\n\tconst width = Math.round((height * brandBox[2]) / brandBox[3]);\n\tconst sw = +(1.2 / (width / brandBox[2])).toFixed(2); // a ~1.2px pen line whatever the size\n\n\tconst piece = (contours: number[][][], fill: string, start: number, letter = false): Piece =>\n\t\t({ contours, fill, start, end: start + (letter ? LETTER_DRAW : ICON_DRAW), letter, k: N, ink: 1 });\n\tconst pieces = [\n\t\tpiece([ic.shape], `url(#${id}-fill)`, 0),\n\t\tpiece([ic.play], INK, 0),\n\t\t...glyphs.map((contours, i) => piece(contours, \"currentColor\", ICON_DRAW - LEAD + i * (LETTER_DRAW - LEAD), true)),\n\t];\n\tconst wheel = pieces[0];\n\tconst total = pieces[pieces.length - 1].end + INK_SET;\n\tlet now = total; // seconds into the drawing: the finished logo until it is drawn\n\n\tfunction paint() {\n\t\tconst seg = (from: number, to: number) => Math.min(1, Math.max(0, (now - from) / (to - from)));\n\t\tfor (const p of pieces) {\n\t\t\tp.k = Math.round((0.5 - Math.cos(Math.PI * seg(p.start, p.end)) / 2) * N);\n\t\t\tp.ink = seg(p.end, p.end + INK_SET); // fills only once the outline is closed\n\t\t}\n\t\tupdate(id);\n\t}\n\n\t// onMount runs before the first paint, so the finished logo never flashes\n\tfunction draw() {\n\t\tif (!animate || globalThis.matchMedia?.(\"(prefers-reduced-motion: reduce)\").matches) return;\n\t\tconst start = performance.now();\n\t\tlet raf = 0;\n\t\tconst frame = (ms: number) => {\n\t\t\tnow = Math.min(total, (ms - start) / 1000);\n\t\t\tpaint();\n\t\t\tif (now < total) raf = requestAnimationFrame(frame);\n\t\t};\n\t\tnow = 0;\n\t\tpaint();\n\t\traf = requestAnimationFrame(frame);\n\t\treturn () => cancelAnimationFrame(raf);\n\t}\n\n\t// A pen is on the page from the moment it starts until its ink has set\n\tconst pen = (p: Piece, pts: number[][]) =>\n\t\tcircleSvg({ cx: () => pts[p.k][0], cy: () => pts[p.k][1], r: 5, fill: \"currentColor\", stroke: STROKE, \"stroke-width\": 1.5, opacity: () => (now <= p.start ? 0 : 1 - p.ink) });\n\n\tconst arm = (p: Piece) =>\n\t\tlineSvg({ x1: () => ic.hub[p.k][0], y1: () => ic.hub[p.k][1], x2: () => p.contours[0][p.k][0], y2: () => p.contours[0][p.k][1] });\n\n\t// The line a pen has drawn so far. It fills when the contour closes\n\tconst trace = (p: Piece) =>\n\t\tpathSvg({ d: () => pathD(p.contours, p.k), fill: p.fill, \"fill-opacity\": () => p.ink, stroke: p.letter ? p.fill : STROKE, \"stroke-width\": sw, \"stroke-opacity\": () => (p.letter || p.ink < 1 ? 1 : 0) });\n\n\treturn svgSvg(\n\t\t{ viewBox: brandBox.join(\" \"), width, height, role: \"img\", \"aria-label\": \"Nuclo\", onMount: draw },\n\t\t...mods,\n\t\tscope(id),\n\t\tdefsSvg(\n\t\t\tlinearGradientSvg(\n\t\t\t\t{ id: `${id}-fill`, x1: 0, y1: 0, x2: 0, y2: 1 },\n\t\t\t\tstopSvg({ offset: \"0\", \"stop-color\": GRADIENT.from }),\n\t\t\t\tstopSvg({ offset: \"1\", \"stop-color\": GRADIENT.to }),\n\t\t\t),\n\t\t),\n\t\t// The ring, the wheel and its arms fade out as the mark's ink sets\n\t\tgSvg(\n\t\t\t{ fill: \"none\", stroke: STROKE, \"stroke-width\": sw, opacity: () => 1 - wheel.ink },\n\t\t\tcircleSvg({ cx: ic.cx, cy: ic.cy, r: ic.ring, \"stroke-opacity\": 0.25 }),\n\t\t\tcircleSvg({ cx: () => ic.hub[wheel.k][0], cy: () => ic.hub[wheel.k][1], r: ic.wheel }),\n\t\t\tarm(pieces[0]),\n\t\t\tarm(pieces[1]),\n\t\t),\n\t\t...pieces.map(trace),\n\t\t...pieces.flatMap((p) => p.contours.map((pts) => pen(p, pts))),\n\t);\n}\n"],"mappings":"AAKA,MAAMC,EAAK,KAAK,GASVC,EAAO,GACX,MAAM,KAAK,CAAE,OAAQ,GAAM,GAAI,EAAG,IAAM,CACtC,IAAMC,EAAKC,EAAA,IAAS,EAAIH,EACxB,MAAO,CAAE,GAAS,KAAK,IAAIE,CAAC,EAAIE,EAAI,KAAK,IAAM,EAAcF,CAAC,EAAI,GAAS,KAAK,IAAIA,CAAC,EAAIE,EAAI,KAAK,IAAM,EAAcF,CAAC,CAAC,CAC1H,CAAC,EACGG,EAAWJ,EAAI,EAAK,EACpBK,EAAUL,EAAI,EAAK,EACnBM,EAASN,EAAI,CAAC,EAKpB,SAAgBO,EAAU,EAAW,EAAY,EAAkB,CACjE,IAAMC,EAAS,GAAoBC,EAAI,KAAK,CAACC,EAAGC,KAAO,CAACC,EAAKC,EAAIH,EAAGI,EAAKD,EAAIF,CAAC,CAAC,EAC/E,MAAO,CAAE,IAAKH,EAAM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,KAAM,MAAO,aAAc,QAAS,QAASuB,CAAK,EAChG,GAAGd,EACH,MAAMC,CAAE,EACR,QACC,kBACC,CAAE,GAAI,GAAGA,EAAG,OAAQ,GAAI,EAAG,GAAI,EAAG,GAAI,EAAG,GAAI,CAAE,EAC/C,QAAQ,CAAE,OAAQ,IAAK,aAAcN,EAAS,IAAK,CAAC,EACpD,QAAQ,CAAE,OAAQ,IAAK,aAAcA,EAAS,EAAG,CAAC,CACnD,CACD,EAEA,KACC,CAAE,KAAM,OAAQ,OAAQC,EAAQ,eAAgBQ,EAAI,YAAe,EAAIK,EAAM,GAAI,EACjF,UAAU,CAAE,GAAIjF,EAAG,GAAI,GAAIA,EAAG,GAAI,EAAGA,EAAG,KAAM,iBAAkB,GAAK,CAAC,EACtE,UAAU,CAAE,OAAUA,EAAG,IAAIiF,EAAM,EAAE,CAAC,GAAI,OAAUjF,EAAG,IAAIiF,EAAM,EAAE,CAAC,GAAI,EAAGjF,EAAG,KAAM,CAAC,EACrF4F,EAAIZ,EAAO,EAAE,EACbY,EAAIZ,EAAO,EAAE,CACd,EACA,GAAGA,EAAO,IAAIpD,CAAK,EACnB,GAAGoD,EAAO,QAAS,GAAM3B,EAAE,SAAS,IAAK,GAAQsC,EAAItC,EAAG1C,CAAG,CAAC,CAAC,CAC9D,CACD,C"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=Math.PI,t=t=>Array.from({length:361},(n,r)=>{let i=r/360*2*e;return[64*Math.cos(i)+t*Math.cos(2*i),64*Math.sin(i)-t*Math.sin(2*i)]}),n=t(90),r=t(12),i=t(0);function a(e,t,a){let o=n=>n.map(([n,r])=>[t+e*n,a+e*r]);return{hub:o(i),shape:o(n),play:o(r),cx:t,cy:a,ring:96*e,wheel:32*e}}a(88/154,100,100);const o=34*e/180,s=[36,27,20,25],c=(e,t,n,r)=>({len:Math.hypot(n-e,r-t),at:i=>[e+(n-e)*i,t+(r-t)*i]}),l=(e,t,n,r,i)=>({len:n*Math.abs(i-r),at:a=>[e+n*Math.cos(r+(i-r)*a),t-n*Math.sin(r+(i-r)*a)]}),u=e=>{let t=e.reduce((e,t)=>e+t.len,0),n=0,r=0;return Array.from({length:361},(i,a)=>{let o=a/360*t;for(;n<e.length-1&&r+e[n].len<o;)r+=e[n++].len;return e[n].at((o-r)/e[n].len)})},d=(t,n)=>{let r=n?264:120,i=n?176:208,a=n?0:2*e,o=t+120;return u([c(t,r,t,i),l(t+60,i,60,e,a),c(o,i,o,r),c(o,r,o-24,r),c(o-24,r,o-24,i),l(t+60,i,36,a,e),c(t+24,i,t+24,r),c(t+24,r,t,r)])},f=t=>{let n=Math.asin(3/73),r=Math.asin(3/55),i=(e,n)=>[t+e*Math.cos(n),192-e*Math.sin(n)],a=(e,t,n)=>c(...i(e,n),...i(t,n)),s=(e,t,n,r)=>l(...i(e,t),3,n,r);return u([l(t,192,76,o+n,2*e-o-n),s(73,-o-n,-o-n,-o+e/2),a(73*Math.cos(n),55*Math.cos(r),-o),s(55,-o-r,-o+e/2,-o-r+e),l(t,192,52,2*e-o-r,o+r),s(55,o+r,o+r+e,o+1.5*e),a(55*Math.cos(r),73*Math.cos(n),o),s(73,o+n,o+1.5*e,o+n+2*e)])},p=t=>u([l(t+13,57,13,e,0),c(t+26,57,t+26,255),l(t+13,255,13,0,-e),c(t,255,t,57)]),m=t=>[u([l(t,192,76,e,3*e)]),u([l(t,192,52,e,-e)])],h=[[e=>[d(e,!0)],120],[e=>[d(e,!1)],120],[e=>[f(e+76)],76+76*Math.cos(o)],[e=>[p(e)],26],[e=>m(e+76),152]],g=n.map(e=>e[0]),_=n.map(e=>e[1]),v=1.45*144/(Math.max(..._)-Math.min(..._)),y=a(v,48-v*Math.min(...g),264-v*Math.max(..._));let b=y.cx+v*Math.max(...g)+36;const x=h.map(([e,t],n)=>{let r=e(b);return b+=t+(s[n]??0),r});function S(e,t=5){let n=e.flat(),r=Math.floor(Math.min(...n.map(e=>e[0]))-t),i=Math.floor(Math.min(...n.map(e=>e[1]))-t),a=Math.ceil(Math.max(...n.map(e=>e[0]))+t),o=Math.ceil(Math.max(...n.map(e=>e[1]))+t);return[r,i,a-r,o-i]}const C=S([y.shape,...x.flat()]),w=(e,t=360)=>e.map(e=>`M`+e.slice(0,t+1).map(e=>e.map(e=>Math.round(e*10)/10).join(`,`)).join(`L`)+(t===360?`Z`:``)).join(``),T={from:`#ea3f25`,to:`#ed6a2c`},E=`#f26a2e`,D=.2;let O=0;function k({height:e=32,animate:t=!0}={},...n){let r=`nuclo-logo-${O++}`,i=Math.round(e*C[2]/C[3]),a=+(1.2/(i/C[2])).toFixed(2),o=(e,t,n,r=!1)=>({contours:e,fill:t,start:n,end:n+(r?.6:1.4),letter:r,k:360,ink:1}),s=[o([y.shape],`url(#${r}-fill)`,0),o([y.play],`#111`,0),...x.map((e,t)=>o(e,`currentColor`,1.2+t*.39999999999999997,!0))],c=s[0],l=s[s.length-1].end+D,u=l;function d(){let e=(e,t)=>Math.min(1,Math.max(0,(u-e)/(t-e)));for(let t of s)t.k=Math.round((.5-Math.cos(Math.PI*e(t.start,t.end))/2)*360),t.ink=e(t.end,t.end+D);update(r)}function f(){if(!t||globalThis.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches)return;let e=performance.now(),n=0,r=t=>{u=Math.min(l,(t-e)/1e3),d(),u<l&&(n=requestAnimationFrame(r))};return u=0,d(),n=requestAnimationFrame(r),()=>cancelAnimationFrame(n)}let p=(e,t)=>circleSvg({cx:()=>t[e.k][0],cy:()=>t[e.k][1],r:5,fill:`currentColor`,stroke:E,"stroke-width":1.5,opacity:()=>u<=e.start?0:1-e.ink}),m=e=>lineSvg({x1:()=>y.hub[e.k][0],y1:()=>y.hub[e.k][1],x2:()=>e.contours[0][e.k][0],y2:()=>e.contours[0][e.k][1]}),h=e=>pathSvg({d:()=>w(e.contours,e.k),fill:e.fill,"fill-opacity":()=>e.ink,stroke:e.letter?e.fill:E,"stroke-width":a,"stroke-opacity":()=>e.letter||e.ink<1?1:0});return svgSvg({viewBox:C.join(` `),width:i,height:e,role:`img`,"aria-label":`Nuclo`,onMount:f},...n,scope(r),defsSvg(linearGradientSvg({id:`${r}-fill`,x1:0,y1:0,x2:0,y2:1},stopSvg({offset:`0`,"stop-color":T.from}),stopSvg({offset:`1`,"stop-color":T.to}))),gSvg({fill:`none`,stroke:E,"stroke-width":a,opacity:()=>1-c.ink},circleSvg({cx:y.cx,cy:y.cy,r:y.ring,"stroke-opacity":.25}),circleSvg({cx:()=>y.hub[c.k][0],cy:()=>y.hub[c.k][1],r:y.wheel}),m(s[0]),m(s[1])),...s.map(h),...s.flatMap(e=>e.contours.map(t=>p(e,t))))}export{k as default};
|
|
2
|
+
//# sourceMappingURL=nuclo.logo.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nuclo.logo.mjs","names":["ic","PI","lap","t","i","d","rawShape","rawPlay","rawHub","placeIcon","place","pts","x","y","cx","s","cy","a","kern","line","x1","x0","y1","y0","arc","rad","to","from","trace","L","segs","sum","done","n","arch","up","c","end","rx","open","fo","fi","at","ang","cut","r0","r1","corner","cr","pill","ring","letters","xs","p","ys","S","brandIcon","glyphs","glyph","w","contours","box","margin","brandBox","pathD","k","v","GRADIENT","STROKE","INK_SET","instances","nucloLogo","mods","id","width","height","sw","piece","start","letter","pieces","wheel","total","now","paint","seg","draw","animate","raf","frame","ms","pen","arm"],"sources":["../../src/logo/geometry.ts","../../src/logo/index.ts"],"sourcesContent":["// The Nuclo mark and wordmark as point lists: pure math, no DOM. The components\n// draw them and scripts/render-brand.ts writes the static SVG and PNG assets\n// from them, so every logo on the site comes from this one source.\n\nexport const N = 360; // points per contour. One wheel lap draws the icon; each pen draws its glyph in the same N steps\nconst PI = Math.PI;\n\n// ── The icon: a hypotrochoid with two pens on one wheel ──────────────────\nexport const R = 96; // the fixed ring\nexport const r = 32; // the rolling wheel. R / r = 3 gives three lobes\nconst outer = 90; // the shape's pen. d > r: the lobes overlap\nconst inner = 12; // the play triangle's pen. d < r: a rounded triangle\n\n// One lap of a pen at distance d from the wheel's center, around the origin\nconst lap = (d: number) =>\n Array.from({ length: N + 1 }, (_, i) => {\n const t = (i / N) * 2 * PI;\n return [(R - r) * Math.cos(t) + d * Math.cos(((R - r) / r) * t), (R - r) * Math.sin(t) - d * Math.sin(((R - r) / r) * t)];\n });\nconst rawShape = lap(outer);\nconst rawPlay = lap(inner);\nconst rawHub = lap(0);\n\nexport type Icon = { hub: number[][]; shape: number[][]; play: number[][]; cx: number; cy: number; ring: number; wheel: number };\n\n/** The icon scaled by s with the wheel's center at (cx, cy). */\nexport function placeIcon(s: number, cx: number, cy: number): Icon {\n const place = (pts: number[][]) => pts.map(([x, y]) => [cx + s * x, cy + s * y]);\n return { hub: place(rawHub), shape: place(rawShape), play: place(rawPlay), cx, cy, ring: R * s, wheel: r * s };\n}\n\n/** The icon alone in a 200 × 200 box, the outer pen touching the box's margin. */\nexport const icon = placeIcon(88 / (R - r + outer), 100, 100);\n\n// ── The wordmark on its unit grid. U is the module; the sizes are multiples of it ──\nconst U = 24;\nconst stem = U; // every stroke, straight or round, is one unit thick\nconst xh = 6 * U; // x-height\nconst pad = 2 * U;\nconst base = 9 * U + pad; // the baseline. The l is 9 units tall\nconst top = base - xh; // the x-height line\nconst mid = top + xh / 2;\nconst ovr = 4; // round forms overshoot the x-height and the baseline, so they look aligned\nconst ro = xh / 2 + ovr; // outer radius of c and o\nconst ri = ro - stem; // their counter\nconst A = 2.5 * U; // arch radius of n and u: narrower than the bowls\nconst lw = stem + 2; // the l is two units wider: a lone stem with round ends looks lighter\nconst a = (34 * PI) / 180; // half of the c's opening\n// The space between the inks of each pair, set by eye: n–u, u–c, c–l, l–o\nconst kern = [36, 27, 20, 25];\n\n// Each contour is a chain of lines and arcs. Angles turn counterclockwise and 0 points right\ntype Seg = { len: number; at: (t: number) => number[] };\nconst line = (x0: number, y0: number, x1: number, y1: number): Seg => ({\n len: Math.hypot(x1 - x0, y1 - y0),\n at: (t) => [x0 + (x1 - x0) * t, y0 + (y1 - y0) * t],\n});\nconst arc = (cx: number, cy: number, rad: number, from: number, to: number): Seg => ({\n len: rad * Math.abs(to - from),\n at: (t) => [cx + rad * Math.cos(from + (to - from) * t), cy - rad * Math.sin(from + (to - from) * t)],\n});\n// N + 1 points along the chain, the same distance apart\nconst trace = (segs: Seg[]) => {\n const L = segs.reduce((sum, s) => sum + s.len, 0);\n let i = 0;\n let done = 0;\n return Array.from({ length: N + 1 }, (_, n) => {\n const d = (n / N) * L;\n while (i < segs.length - 1 && done + segs[i].len < d) done += segs[i++].len;\n return segs[i].at((d - done) / segs[i].len);\n });\n};\n\n// n: two stems and an arch over the top. u: the same glyph, arch under the bottom\nconst arch = (x: number, up: boolean) => {\n const y = up ? base : top; // where the stems end, flat on the line\n const c = up ? top + A - ovr : base - A + ovr; // the arch's center. The arch overshoots the line like the o does\n const end = up ? 0 : 2 * PI; // the arch turns over the top, or under the bottom\n const rx = x + 2 * A;\n return trace([\n line(x, y, x, c),\n arc(x + A, c, A, PI, end),\n line(rx, c, rx, y),\n line(rx, y, rx - stem, y),\n line(rx - stem, y, rx - stem, c),\n arc(x + A, c, A - stem, end, PI),\n line(x + stem, c, x + stem, y),\n line(x + stem, y, x, y),\n ]);\n};\n// c: the o cut open on the right, 34° above and below the center line. The cuts point at the center.\n// Their four corners are rounded by q, so the cut ends sit with the pill of the l\nconst open = (cx: number) => {\n const q = 3;\n const fo = Math.asin(q / (ro - q)); // where a corner arc meets the outer circle, from the cut\n const fi = Math.asin(q / (ri + q)); // and the inner circle\n const at = (rad: number, ang: number): [number, number] => [cx + rad * Math.cos(ang), mid - rad * Math.sin(ang)];\n const cut = (r0: number, r1: number, ang: number) => line(...at(r0, ang), ...at(r1, ang));\n const corner = (cr: number, ang: number, from: number, to: number) => arc(...at(cr, ang), q, from, to);\n return trace([\n arc(cx, mid, ro, a + fo, 2 * PI - a - fo), // the outer curve, over the top and down the left\n corner(ro - q, -a - fo, -a - fo, -a + PI / 2), // the lower cut: outer corner,\n cut((ro - q) * Math.cos(fo), (ri + q) * Math.cos(fi), -a), // the cut,\n corner(ri + q, -a - fi, -a + PI / 2, -a - fi + PI), // inner corner\n arc(cx, mid, ri, 2 * PI - a - fi, a + fi), // the counter, back up the left\n corner(ri + q, a + fi, a + fi + PI, a + 1.5 * PI), // the upper cut: inner corner,\n cut((ri + q) * Math.cos(fi), (ro - q) * Math.cos(fo), a), // the cut,\n corner(ro - q, a + fo, a + 1.5 * PI, a + fo + 2 * PI), // outer corner\n ]);\n};\n// l: a pill from the ascender line to the baseline. Its round ends overshoot both lines like the bowls do\nconst pill = (x: number) => {\n const rad = lw / 2;\n const y0 = base - 9 * U - ovr + rad; // the center of the top cap\n const y1 = base + ovr - rad; // and of the bottom cap\n return trace([arc(x + rad, y0, rad, PI, 0), line(x + lw, y0, x + lw, y1), arc(x + rad, y1, rad, 0, -PI), line(x, y1, x, y0)]);\n};\n// o: two circles. They run in opposite directions, so the fill leaves the counter open\nconst ring = (cx: number) => [trace([arc(cx, mid, ro, PI, 3 * PI)]), trace([arc(cx, mid, ri, PI, -PI)])];\n\n// Each letter: its contours at x, and the width of its ink. The c's ink stops at its terminals\nconst letters: [(x: number) => number[][][], number][] = [\n [(x) => [arch(x, true)], 2 * A],\n [(x) => [arch(x, false)], 2 * A],\n [(x) => [open(x + ro)], ro + ro * Math.cos(a)],\n [(x) => [pill(x)], lw],\n [(x) => ring(x + ro), 2 * ro],\n];\n\n// ── The lockup: icon and wordmark on one baseline ────────────────────────\n// The icon is 1.45 x-heights tall, so it leads but does not overpower the word; its lowest lobe\n// touches the baseline; the n starts 1.5 stems after the tip of the right lobe\nconst xs = rawShape.map((p) => p[0]);\nconst ys = rawShape.map((p) => p[1]);\nconst S = (1.45 * xh) / (Math.max(...ys) - Math.min(...ys));\nexport const brandIcon = placeIcon(S, pad - S * Math.min(...xs), base - S * Math.max(...ys));\n\nlet x = brandIcon.cx + S * Math.max(...xs) + 1.5 * stem;\n/** The wordmark: one list of contours per letter. */\nexport const glyphs = letters.map(([glyph, w], i) => {\n const contours = glyph(x);\n x += w + (kern[i] ?? 0);\n return contours;\n});\n\n/** The box around a drawing: [x, y, width, height], with room for the pens that ride the outlines. */\nexport function box(contours: number[][][], margin = 5): [number, number, number, number] {\n const pts = contours.flat();\n const x0 = Math.floor(Math.min(...pts.map((p) => p[0])) - margin);\n const y0 = Math.floor(Math.min(...pts.map((p) => p[1])) - margin);\n const x1 = Math.ceil(Math.max(...pts.map((p) => p[0])) + margin);\n const y1 = Math.ceil(Math.max(...pts.map((p) => p[1])) + margin);\n return [x0, y0, x1 - x0, y1 - y0];\n}\nexport const brandBox = box([brandIcon.shape, ...glyphs.flat()]);\n\n/** The path of the first k points of each contour, closed once the contour is complete. */\nexport const pathD = (contours: number[][][], k = N) =>\n contours.map((pts) => \"M\" + pts.slice(0, k + 1).map((p) => p.map((v) => Math.round(v * 10) / 10).join(\",\")).join(\"L\") + (k === N ? \"Z\" : \"\")).join(\"\");\n\nexport const GRADIENT = { from: \"#ea3f25\", to: \"#ed6a2c\" };\nexport const INK = \"#111\";\nexport const STROKE = \"#f26a2e\";\n","/**\n * nuclo/nuclo-logo — the Nuclo logo (mark and name) as a nuclo component, drawn the\n * way nuclo.dev draws it: a Spirograph wheel rolls inside a ring and its two pens\n * trace the mark; then a pen writes each letter, n to o, each inking as the next begins.\n *\n * import nucloLogo from \"nuclo/nuclo-logo\";\n * main(nucloLogo({ height: 48 }));\n *\n * Its own entry, so apps that never show the logo never ship it. It builds on the\n * runtime's globals (svgSvg, scope, update, …), so the app imports \"nuclo\" as usual.\n * The svg starts finished, which is what SSR sends; on mount it is drawn again unless\n * `animate` is off or the visitor prefers reduced motion.\n */\nimport { brandBox, brandIcon as ic, glyphs, pathD, GRADIENT, INK, N, STROKE } from \"./geometry\";\n\nexport type NucloLogoOptions = {\n\t/** Height in px; the width follows the logo's proportions. Default 32. */\n\theight?: number;\n\t/** Draw the logo when it mounts. Default true. */\n\tanimate?: boolean;\n};\n\nconst ICON_DRAW = 1.4; // seconds the wheel takes\nconst LETTER_DRAW = 0.6; // seconds a pen takes per letter\nconst LEAD = 0.2; // how early each letter starts, before the last one ends\nconst INK_SET = 0.2; // seconds the ink takes to set, once the pen has closed the outline\n\n// One drawn thing: its contours, its fill and when its pen runs. k is how many points are drawn, ink its fill\ntype Piece = { contours: number[][][]; fill: string; start: number; end: number; letter: boolean; k: number; ink: number };\n\nlet instances = 0;\n\nexport default function nucloLogo({ height = 32, animate = true }: NucloLogoOptions = {}, ...mods: SVGElementModifierLike<\"svg\">[]) {\n\tconst id = `nuclo-logo-${instances++}`;\n\tconst width = Math.round((height * brandBox[2]) / brandBox[3]);\n\tconst sw = +(1.2 / (width / brandBox[2])).toFixed(2); // a ~1.2px pen line whatever the size\n\n\tconst piece = (contours: number[][][], fill: string, start: number, letter = false): Piece =>\n\t\t({ contours, fill, start, end: start + (letter ? LETTER_DRAW : ICON_DRAW), letter, k: N, ink: 1 });\n\tconst pieces = [\n\t\tpiece([ic.shape], `url(#${id}-fill)`, 0),\n\t\tpiece([ic.play], INK, 0),\n\t\t...glyphs.map((contours, i) => piece(contours, \"currentColor\", ICON_DRAW - LEAD + i * (LETTER_DRAW - LEAD), true)),\n\t];\n\tconst wheel = pieces[0];\n\tconst total = pieces[pieces.length - 1].end + INK_SET;\n\tlet now = total; // seconds into the drawing: the finished logo until it is drawn\n\n\tfunction paint() {\n\t\tconst seg = (from: number, to: number) => Math.min(1, Math.max(0, (now - from) / (to - from)));\n\t\tfor (const p of pieces) {\n\t\t\tp.k = Math.round((0.5 - Math.cos(Math.PI * seg(p.start, p.end)) / 2) * N);\n\t\t\tp.ink = seg(p.end, p.end + INK_SET); // fills only once the outline is closed\n\t\t}\n\t\tupdate(id);\n\t}\n\n\t// onMount runs before the first paint, so the finished logo never flashes\n\tfunction draw() {\n\t\tif (!animate || globalThis.matchMedia?.(\"(prefers-reduced-motion: reduce)\").matches) return;\n\t\tconst start = performance.now();\n\t\tlet raf = 0;\n\t\tconst frame = (ms: number) => {\n\t\t\tnow = Math.min(total, (ms - start) / 1000);\n\t\t\tpaint();\n\t\t\tif (now < total) raf = requestAnimationFrame(frame);\n\t\t};\n\t\tnow = 0;\n\t\tpaint();\n\t\traf = requestAnimationFrame(frame);\n\t\treturn () => cancelAnimationFrame(raf);\n\t}\n\n\t// A pen is on the page from the moment it starts until its ink has set\n\tconst pen = (p: Piece, pts: number[][]) =>\n\t\tcircleSvg({ cx: () => pts[p.k][0], cy: () => pts[p.k][1], r: 5, fill: \"currentColor\", stroke: STROKE, \"stroke-width\": 1.5, opacity: () => (now <= p.start ? 0 : 1 - p.ink) });\n\n\tconst arm = (p: Piece) =>\n\t\tlineSvg({ x1: () => ic.hub[p.k][0], y1: () => ic.hub[p.k][1], x2: () => p.contours[0][p.k][0], y2: () => p.contours[0][p.k][1] });\n\n\t// The line a pen has drawn so far. It fills when the contour closes\n\tconst trace = (p: Piece) =>\n\t\tpathSvg({ d: () => pathD(p.contours, p.k), fill: p.fill, \"fill-opacity\": () => p.ink, stroke: p.letter ? p.fill : STROKE, \"stroke-width\": sw, \"stroke-opacity\": () => (p.letter || p.ink < 1 ? 1 : 0) });\n\n\treturn svgSvg(\n\t\t{ viewBox: brandBox.join(\" \"), width, height, role: \"img\", \"aria-label\": \"Nuclo\", onMount: draw },\n\t\t...mods,\n\t\tscope(id),\n\t\tdefsSvg(\n\t\t\tlinearGradientSvg(\n\t\t\t\t{ id: `${id}-fill`, x1: 0, y1: 0, x2: 0, y2: 1 },\n\t\t\t\tstopSvg({ offset: \"0\", \"stop-color\": GRADIENT.from }),\n\t\t\t\tstopSvg({ offset: \"1\", \"stop-color\": GRADIENT.to }),\n\t\t\t),\n\t\t),\n\t\t// The ring, the wheel and its arms fade out as the mark's ink sets\n\t\tgSvg(\n\t\t\t{ fill: \"none\", stroke: STROKE, \"stroke-width\": sw, opacity: () => 1 - wheel.ink },\n\t\t\tcircleSvg({ cx: ic.cx, cy: ic.cy, r: ic.ring, \"stroke-opacity\": 0.25 }),\n\t\t\tcircleSvg({ cx: () => ic.hub[wheel.k][0], cy: () => ic.hub[wheel.k][1], r: ic.wheel }),\n\t\t\tarm(pieces[0]),\n\t\t\tarm(pieces[1]),\n\t\t),\n\t\t...pieces.map(trace),\n\t\t...pieces.flatMap((p) => p.contours.map((pts) => pen(p, pts))),\n\t);\n}\n"],"mappings":"AAKA,MAAMC,EAAK,KAAK,GASVC,EAAO,GACX,MAAM,KAAK,CAAE,OAAQ,GAAM,GAAI,EAAG,IAAM,CACtC,IAAMC,EAAKC,EAAA,IAAS,EAAIH,EACxB,MAAO,CAAE,GAAS,KAAK,IAAIE,CAAC,EAAIE,EAAI,KAAK,IAAM,EAAcF,CAAC,EAAI,GAAS,KAAK,IAAIA,CAAC,EAAIE,EAAI,KAAK,IAAM,EAAcF,CAAC,CAAC,CAC1H,CAAC,EACGG,EAAWJ,EAAI,EAAK,EACpBK,EAAUL,EAAI,EAAK,EACnBM,EAASN,EAAI,CAAC,EAKpB,SAAgBO,EAAU,EAAW,EAAY,EAAkB,CACjE,IAAMC,EAAS,GAAoBC,EAAI,KAAK,CAACC,EAAGC,KAAO,CAACC,EAAKC,EAAIH,EAAGI,EAAKD,EAAIF,CAAC,CAAC,EAC/E,MAAO,CAAE,IAAKH,EAAMF,CAAM,EAAG,MAAOE,EAAMJ,CAAQ,EAAG,KAAMI,EAAMH,CAAO,EAAG,KAAI,KAAI,KAAA,GAAUQ,EAAG,MAAA,GAAWA,CAAE,CAC/G,CAGoBN,EAAU,GAAM,IAAgB,IAAK,GAAG,EAG5D,MAYMQ,EAAK,GAAKhB,EAAM,IAEhBiB,EAAO,CAAC,GAAI,GAAI,GAAI,EAAE,EAItBC,GAAQ,EAAY,EAAY,EAAY,KAAqB,CACrE,IAAK,KAAK,MAAMC,EAAKC,EAAIC,EAAKC,CAAE,EAChC,GAAK,GAAM,CAACF,GAAMD,EAAKC,GAAMlB,EAAGoB,GAAMD,EAAKC,GAAMpB,CAA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,EAAG,GAAI,EAAGA,EAAG,KAAM,iBAAkB,GAAK,CAAC,EACtE,UAAU,CAAE,OAAUA,EAAG,IAAIiF,EAAM,EAAE,CAAC,GAAI,OAAUjF,EAAG,IAAIiF,EAAM,EAAE,CAAC,GAAI,EAAGjF,EAAG,KAAM,CAAC,EACrF4F,EAAIZ,EAAO,EAAE,EACbY,EAAIZ,EAAO,EAAE,CACd,EACA,GAAGA,EAAO,IAAIpD,CAAK,EACnB,GAAGoD,EAAO,QAAS,GAAM3B,EAAE,SAAS,IAAK,GAAQsC,EAAItC,EAAG1C,CAAG,CAAC,CAAC,CAC9D,CACD,C"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuclo",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.38",
|
|
5
5
|
"description": "Lightweight, type-safe DOM library with plain mutable state and explicit updates — global tag builders, SSR, hydration, and typed CSS, no virtual DOM, no compiler.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "Danilo Celestino de Castro (https://github.com/dan2dev)",
|
|
@@ -34,6 +34,11 @@
|
|
|
34
34
|
"import": "./dist/polyfill/nuclo.polyfill.mjs",
|
|
35
35
|
"require": "./dist/polyfill/nuclo.polyfill.cjs"
|
|
36
36
|
},
|
|
37
|
+
"./nuclo-logo": {
|
|
38
|
+
"types": "./types/nuclo-logo.d.ts",
|
|
39
|
+
"import": "./dist/logo/nuclo.logo.mjs",
|
|
40
|
+
"require": "./dist/logo/nuclo.logo.cjs"
|
|
41
|
+
},
|
|
37
42
|
"./types": {
|
|
38
43
|
"types": "./types/index.d.ts"
|
|
39
44
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type declarations for the `nuclo/nuclo-logo` subpath.
|
|
3
|
+
*
|
|
4
|
+
* Hand-written (mirroring src/logo/index.ts) and shipped from `types/` like the
|
|
5
|
+
* other subpaths, so they stay typed when `dist/` holds only watch-mode bundles.
|
|
6
|
+
*
|
|
7
|
+
* import nucloLogo from "nuclo/nuclo-logo";
|
|
8
|
+
* main(nucloLogo({ height: 48 }));
|
|
9
|
+
*
|
|
10
|
+
* The logo builds on the nuclo runtime's globals, so the app imports "nuclo" too.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
// Load the ambient nuclo globals (SVGElementModifierLike, DetachedSVGElementFactory, …).
|
|
14
|
+
import "./index";
|
|
15
|
+
|
|
16
|
+
export type NucloLogoOptions = {
|
|
17
|
+
/** Height in px; the width follows the logo's proportions. Default 32. */
|
|
18
|
+
height?: number;
|
|
19
|
+
/** Draw the logo when it mounts (skipped under prefers-reduced-motion). Default true. */
|
|
20
|
+
animate?: boolean;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The Nuclo logo, mark and name, as an `<svg>`. The name takes the text color
|
|
25
|
+
* (currentColor). Extra modifiers (classes, attributes) go on the svg.
|
|
26
|
+
*/
|
|
27
|
+
export default function nucloLogo(
|
|
28
|
+
options?: NucloLogoOptions,
|
|
29
|
+
...mods: SVGElementModifierLike<"svg">[]
|
|
30
|
+
): DetachedSVGElementFactory<"svg">;
|