@particle-academy/fancy-3d-three 0.1.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/LICENSE +21 -0
- package/README.md +95 -0
- package/dist/engine.cjs +80 -0
- package/dist/engine.cjs.map +1 -0
- package/dist/engine.d.cts +5 -0
- package/dist/engine.d.ts +5 -0
- package/dist/engine.js +58 -0
- package/dist/engine.js.map +1 -0
- package/dist/index.cjs +788 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +283 -0
- package/dist/index.d.ts +283 -0
- package/dist/index.js +744 -0
- package/dist/index.js.map +1 -0
- package/dist/react.cjs +333 -0
- package/dist/react.cjs.map +1 -0
- package/dist/react.d.cts +64 -0
- package/dist/react.d.ts +64 -0
- package/dist/react.js +309 -0
- package/dist/react.js.map +1 -0
- package/package.json +94 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/painters.ts","../src/primitives.ts","../src/layouts.ts","../src/index.ts"],"names":["THREE","material","mesh","DecalGeometry","THREE2","THREE3"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEO,IAAM,SAAA,GAAY;AAKzB,SAAS,MAAA,CAAO,IAAY,CAAA,EAAmB;AAC7C,EAAA,OAAO,CAAA,GAAI,GAAA;AACb;AAEA,SAAS,WAAA,CAAY,GAAA,EAA+B,CAAA,EAAW,CAAA,EAAW,QAAA,EAAmB;AAC3F,EAAA,MAAM,CAAA,GAAI,MAAA,CAAO,CAAA,EAAG,CAAC,CAAA;AACrB,EAAA,GAAA,CAAI,SAAA,GAAY,SAAA;AAChB,EAAA,SAAA,CAAU,KAAK,CAAA,EAAG,CAAA,EAAG,CAAA,EAAG,CAAA,EAAG,KAAK,CAAC,CAAA;AACjC,EAAA,GAAA,CAAI,IAAA,EAAK;AACT,EAAA,GAAA,CAAI,WAAA,GAAc,WAAW,SAAA,GAAY,SAAA;AACzC,EAAA,GAAA,CAAI,SAAA,GAAA,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AM,CAAA,IAAK,GAAA,CAAI,CAAA;AACnE,EAAA,MAAM,EAAA,GAAK,KAAA,CAAM,KAAA,CAAM,GAAA,CAAI,CAAC,CAAA,KAAM,CAAA,CAAE,QAAA,CAAS,CAAA,IAAK,CAAA,CAAE,IAAA,EAAM,CAAA,IAAK,GAAA,CAAI,CAAA;AACnE,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,IAAA,CAAK,GAAA,CAAI,GAAG,EAAE,CAAA;AAAA,IACpB,IAAA,EAAM,IAAA,CAAK,GAAA,CAAI,GAAG,EAAE,CAAA;AAAA,IACpB,IAAA,EAAM,IAAA,CAAK,GAAA,CAAI,GAAG,EAAE,CAAA;AAAA,IACpB,IAAA,EAAM,IAAA,CAAK,GAAA,CAAI,GAAG,EAAE;AAAA,GACtB;AACF","file":"index.cjs","sourcesContent":["import type { WidgetSpec } from \"@particle-academy/fancy-3d\";\n\nexport const TEX_SCALE = 2; // retina-ish texture sharpness\n\n/** Scale factor against the painters' design-time canvas (240px tall). All\n * widget painters multiply their padding / font sizes by this so the layout\n * looks the same at any pixel resolution. */\nfunction unitOf(_w: number, h: number): number {\n return h / 240;\n}\n\nfunction paintCardBg(ctx: CanvasRenderingContext2D, w: number, h: number, selected: boolean) {\n const u = unitOf(w, h);\n ctx.fillStyle = \"#0f172a\";\n roundRect(ctx, 0, 0, w, h, 14 * u);\n ctx.fill();\n ctx.strokeStyle = selected ? \"#6366f1\" : \"#1e293b\";\n ctx.lineWidth = (selected ? 4 : 2) * u;\n ctx.stroke();\n}\n\nfunction roundRect(ctx: CanvasRenderingContext2D, x: number, y: number, w: number, h: number, r: number) {\n ctx.beginPath();\n ctx.moveTo(x + r, y);\n ctx.arcTo(x + w, y, x + w, y + h, r);\n ctx.arcTo(x + w, y + h, x, y + h, r);\n ctx.arcTo(x, y + h, x, y, r);\n ctx.arcTo(x, y, x + w, y, r);\n ctx.closePath();\n}\n\nfunction paintLabel(ctx: CanvasRenderingContext2D, text: string, x: number, y: number) {\n ctx.fillStyle = \"#94a3b8\";\n ctx.font = \"600 22px ui-sans-serif, system-ui, sans-serif\";\n ctx.textBaseline = \"top\";\n ctx.fillText(text.toUpperCase(), x, y);\n}\n\nfunction paintSparkline(ctx: CanvasRenderingContext2D, values: number[], x: number, y: number, w: number, h: number, variant: \"line\" | \"bar\" | \"area\", color: string) {\n const max = Math.max(...values, 1);\n const min = Math.min(...values, 0);\n const range = max - min || 1;\n const step = w / Math.max(values.length - 1, 1);\n\n if (variant === \"bar\") {\n const bw = w / values.length - 4;\n ctx.fillStyle = color;\n values.forEach((v, i) => {\n const bh = ((v - min) / range) * h;\n ctx.fillRect(x + i * (bw + 4), y + h - bh, bw, Math.max(bh, 1));\n });\n return;\n }\n\n ctx.beginPath();\n values.forEach((v, i) => {\n const px = x + i * step;\n const py = y + h - ((v - min) / range) * h;\n if (i === 0) ctx.moveTo(px, py);\n else ctx.lineTo(px, py);\n });\n\n if (variant === \"area\") {\n ctx.lineTo(x + w, y + h);\n ctx.lineTo(x, y + h);\n ctx.closePath();\n ctx.fillStyle = color + \"44\";\n ctx.fill();\n ctx.beginPath();\n values.forEach((v, i) => {\n const px = x + i * step;\n const py = y + h - ((v - min) / range) * h;\n if (i === 0) ctx.moveTo(px, py);\n else ctx.lineTo(px, py);\n });\n }\n\n ctx.strokeStyle = color;\n ctx.lineWidth = 3;\n ctx.stroke();\n}\nexport function paintWidget(ctx: CanvasRenderingContext2D, spec: WidgetSpec, w: number, h: number, selected: boolean) {\n paintCardBg(ctx, w, h, selected);\n const pad = 20;\n\n switch (spec.kind) {\n case \"kpi\": {\n paintLabel(ctx, spec.label, pad, pad);\n ctx.fillStyle = \"#f1f5f9\";\n ctx.font = \"700 56px ui-sans-serif, system-ui, sans-serif\";\n ctx.fillText(spec.value, pad, pad + 32);\n if (spec.delta) {\n ctx.fillStyle = spec.trend === \"up\" ? \"#10b981\" : spec.trend === \"down\" ? \"#f43f5e\" : \"#94a3b8\";\n ctx.font = \"600 22px ui-sans-serif, system-ui, sans-serif\";\n ctx.fillText(spec.delta, pad, pad + 92);\n }\n break;\n }\n case \"chart\": {\n paintLabel(ctx, spec.title, pad, pad);\n paintSparkline(ctx, spec.series, pad, pad + 36, w - pad * 2, h - pad * 2 - 36, spec.variant, spec.color ?? \"#6366f1\");\n break;\n }\n case \"kanban\": {\n const colW = (w - pad * 2 - (spec.columns.length - 1) * 10) / spec.columns.length;\n spec.columns.forEach((col, i) => {\n const cx = pad + i * (colW + 10);\n ctx.fillStyle = \"#1e293b\";\n roundRect(ctx, cx, pad, colW, h - pad * 2, 8);\n ctx.fill();\n paintLabel(ctx, col.title, cx + 8, pad + 10);\n col.cards.forEach((c, j) => {\n ctx.fillStyle = \"#0f172a\";\n roundRect(ctx, cx + 8, pad + 44 + j * 38, colW - 16, 30, 6);\n ctx.fill();\n ctx.fillStyle = \"#cbd5e1\";\n ctx.font = \"500 20px ui-sans-serif, system-ui, sans-serif\";\n ctx.fillText(c, cx + 16, pad + 50 + j * 38);\n });\n });\n break;\n }\n case \"table\": {\n paintLabel(ctx, spec.title, pad, pad);\n ctx.fillStyle = \"#94a3b8\";\n ctx.font = \"600 18px ui-sans-serif, system-ui, sans-serif\";\n const colW = (w - pad * 2) / spec.columns.length;\n spec.columns.forEach((c, i) => ctx.fillText(c, pad + i * colW, pad + 38));\n ctx.fillStyle = \"#cbd5e1\";\n ctx.font = \"400 18px ui-sans-serif, system-ui, sans-serif\";\n spec.rows.forEach((row, ri) => {\n row.forEach((cell, ci) => ctx.fillText(String(cell), pad + ci * colW, pad + 70 + ri * 28));\n });\n break;\n }\n case \"profile\": {\n ctx.fillStyle = \"#6366f1\";\n ctx.beginPath();\n ctx.arc(pad + 30, pad + 30, 28, 0, Math.PI * 2);\n ctx.fill();\n ctx.fillStyle = \"#fff\";\n ctx.font = \"700 24px ui-sans-serif, system-ui, sans-serif\";\n ctx.textAlign = \"center\";\n ctx.fillText(spec.initials, pad + 30, pad + 22);\n ctx.textAlign = \"left\";\n ctx.fillStyle = \"#f1f5f9\";\n ctx.font = \"600 24px ui-sans-serif, system-ui, sans-serif\";\n ctx.fillText(spec.name, pad + 76, pad + 12);\n ctx.fillStyle = \"#94a3b8\";\n ctx.font = \"400 20px ui-sans-serif, system-ui, sans-serif\";\n ctx.fillText(spec.role, pad + 76, pad + 40);\n if (spec.status) {\n ctx.fillStyle = spec.status === \"online\" ? \"#10b981\" : spec.status === \"away\" ? \"#f59e0b\" : \"#64748b\";\n ctx.beginPath();\n ctx.arc(pad + 50, pad + 50, 6, 0, Math.PI * 2);\n ctx.fill();\n }\n break;\n }\n case \"callout\": {\n const tone = spec.tone === \"danger\" ? \"#f43f5e\" : spec.tone === \"warning\" ? \"#f59e0b\" : spec.tone === \"success\" ? \"#10b981\" : \"#3b82f6\";\n ctx.fillStyle = tone + \"22\";\n roundRect(ctx, 4, 4, w - 8, h - 8, 12);\n ctx.fill();\n ctx.fillStyle = tone;\n ctx.fillRect(12, 12, 4, h - 24);\n ctx.fillStyle = \"#f1f5f9\";\n ctx.font = \"600 22px ui-sans-serif, system-ui, sans-serif\";\n ctx.fillText(spec.title, 28, pad);\n ctx.fillStyle = \"#cbd5e1\";\n ctx.font = \"400 18px ui-sans-serif, system-ui, sans-serif\";\n wrapText(ctx, spec.body, 28, pad + 32, w - 40, 22);\n break;\n }\n case \"form\": {\n paintLabel(ctx, spec.title, pad, pad);\n spec.fields.forEach((f, i) => {\n const y = pad + 40 + i * 44;\n ctx.fillStyle = \"#cbd5e1\";\n ctx.font = \"500 18px ui-sans-serif, system-ui, sans-serif\";\n ctx.fillText(f.label, pad, y);\n ctx.fillStyle = \"#1e293b\";\n roundRect(ctx, w - pad - 100, y - 4, 100, 28, 6);\n ctx.fill();\n if (f.type === \"switch\") {\n ctx.fillStyle = \"#6366f1\";\n roundRect(ctx, w - pad - 60, y - 4, 60, 28, 14);\n ctx.fill();\n ctx.fillStyle = \"#fff\";\n ctx.beginPath();\n ctx.arc(w - pad - 18, y + 10, 10, 0, Math.PI * 2);\n ctx.fill();\n }\n });\n break;\n }\n case \"action\": {\n paintLabel(ctx, spec.title, pad, pad);\n let bx = pad;\n const by = pad + 40;\n spec.buttons.forEach((b) => {\n const tw = ctx.measureText(b.label).width + 24;\n ctx.fillStyle = b.variant === \"primary\" ? \"#6366f1\" : b.variant === \"ghost\" ? \"transparent\" : \"#1e293b\";\n if (b.variant !== \"ghost\") {\n roundRect(ctx, bx, by, tw, 36, 8);\n ctx.fill();\n }\n ctx.fillStyle = b.variant === \"primary\" ? \"#fff\" : \"#cbd5e1\";\n ctx.font = \"600 18px ui-sans-serif, system-ui, sans-serif\";\n ctx.fillText(b.label, bx + 12, by + 9);\n bx += tw + 8;\n });\n break;\n }\n case \"timeline\": {\n paintLabel(ctx, spec.title, pad, pad);\n spec.events.forEach((e, i) => {\n const y = pad + 40 + i * 32;\n ctx.fillStyle = \"#6366f1\";\n ctx.beginPath();\n ctx.arc(pad + 4, y + 10, 4, 0, Math.PI * 2);\n ctx.fill();\n ctx.strokeStyle = \"#1e293b\";\n if (i < spec.events.length - 1) {\n ctx.beginPath();\n ctx.moveTo(pad + 4, y + 14);\n ctx.lineTo(pad + 4, y + 32);\n ctx.stroke();\n }\n ctx.fillStyle = \"#94a3b8\";\n ctx.font = \"500 14px ui-monospace, monospace\";\n ctx.fillText(e.at, pad + 16, y);\n ctx.fillStyle = \"#cbd5e1\";\n ctx.font = \"400 18px ui-sans-serif, system-ui, sans-serif\";\n ctx.fillText(e.label, pad + 60, y);\n });\n break;\n }\n case \"code\": {\n paintLabel(ctx, spec.title, pad, pad);\n ctx.fillStyle = \"#020617\";\n roundRect(ctx, pad, pad + 36, w - pad * 2, h - pad * 2 - 36, 8);\n ctx.fill();\n ctx.fillStyle = \"#a5b4fc\";\n ctx.font = \"400 16px ui-monospace, monospace\";\n const lines = spec.code.split(\"\\n\");\n lines.forEach((ln, i) => ctx.fillText(ln, pad + 14, pad + 56 + i * 22));\n break;\n }\n case \"image\": {\n ctx.fillStyle = \"#1e293b\";\n roundRect(ctx, pad, pad, w - pad * 2, h - pad * 2, 8);\n ctx.fill();\n ctx.fillStyle = \"#64748b\";\n ctx.font = \"400 18px ui-sans-serif, system-ui, sans-serif\";\n ctx.textAlign = \"center\";\n ctx.fillText(spec.alt, w / 2, h / 2);\n ctx.textAlign = \"left\";\n break;\n }\n case \"text\": {\n ctx.fillStyle = \"#f1f5f9\";\n ctx.font = \"700 26px ui-sans-serif, system-ui, sans-serif\";\n ctx.fillText(spec.heading, pad, pad);\n ctx.fillStyle = \"#cbd5e1\";\n ctx.font = \"400 18px ui-sans-serif, system-ui, sans-serif\";\n wrapText(ctx, spec.body, pad, pad + 38, w - pad * 2, 22);\n break;\n }\n case \"screen\": {\n const bezel = spec.bezel ?? \"#0b0f17\";\n const t = spec.bezelThickness ?? 14;\n const on = spec.on ?? true;\n const brightness = spec.brightness ?? (on ? 1 : 0.06);\n const bg = spec.background ?? \"#020617\";\n\n // Outer bezel\n ctx.fillStyle = bezel;\n roundRect(ctx, 0, 0, w, h, 18);\n ctx.fill();\n // Inner screen area\n const sx = t;\n const sy = t;\n const sw = w - t * 2;\n const sh = h - t * 2;\n ctx.save();\n ctx.fillStyle = bg;\n roundRect(ctx, sx, sy, sw, sh, 8);\n ctx.fill();\n ctx.beginPath();\n roundRect(ctx, sx, sy, sw, sh, 8);\n ctx.clip();\n ctx.translate(sx, sy);\n // Apply brightness as global alpha multiplier\n ctx.globalAlpha = brightness;\n const c = spec.content;\n if (c.type === \"label\") {\n ctx.fillStyle = \"#e2e8f0\";\n ctx.font = \"700 32px ui-sans-serif, system-ui, sans-serif\";\n ctx.textAlign = \"center\";\n ctx.textBaseline = \"middle\";\n ctx.fillText(c.title, sw / 2, sh / 2 - (c.subtitle ? 16 : 0));\n if (c.subtitle) {\n ctx.fillStyle = \"#94a3b8\";\n ctx.font = \"400 18px ui-sans-serif, system-ui, sans-serif\";\n ctx.fillText(c.subtitle, sw / 2, sh / 2 + 18);\n }\n ctx.textAlign = \"left\";\n ctx.textBaseline = \"alphabetic\";\n } else if (c.type === \"paint\") {\n c.paint(ctx, sw, sh);\n } else if (c.type === \"image\") {\n // Image content is best painted by the consumer via \"paint\" — labels\n // serve as a fallback so the screen still has identifiable content.\n ctx.fillStyle = \"#475569\";\n ctx.font = \"500 16px ui-sans-serif, system-ui, sans-serif\";\n ctx.textAlign = \"center\";\n ctx.fillText(c.alt ?? \"image\", sw / 2, sh / 2);\n ctx.textAlign = \"left\";\n }\n ctx.globalAlpha = 1;\n ctx.restore();\n // Power LED\n ctx.fillStyle = on ? \"#10b981\" : \"#475569\";\n ctx.beginPath();\n ctx.arc(w - t - 6, h - t - 6, 4, 0, Math.PI * 2);\n ctx.fill();\n // Subtle glass reflection\n const grad = ctx.createLinearGradient(sx, sy, sx, sy + sh);\n grad.addColorStop(0, \"rgba(255,255,255,0.08)\");\n grad.addColorStop(0.4, \"rgba(255,255,255,0)\");\n ctx.fillStyle = grad;\n ctx.beginPath();\n roundRect(ctx, sx, sy, sw, sh, 8);\n ctx.fill();\n break;\n }\n case \"demoPage\": {\n const u = unitOf(w, h);\n const padX = w * 0.06;\n const headerH = h * 0.22;\n const titleY = headerH + h * 0.12;\n const titleSize = h * 0.16;\n const descY = titleY + titleSize * 0.6;\n const descSize = h * 0.072;\n const descLine = descSize * 1.4;\n const chipSize = h * 0.052;\n const pathSize = h * 0.052;\n const ctaSize = h * 0.075;\n const ctaH = ctaSize * 2;\n\n // Accent header bar — slightly overlaps card top to visually anchor\n ctx.fillStyle = spec.accent;\n roundRect(ctx, 0, 0, w, headerH, 14 * u);\n ctx.fill();\n // Squared bottom on the accent bar (cancel rounded bottom corners)\n ctx.fillRect(0, headerH - 14 * u, w, 14 * u);\n\n // Category chip\n ctx.fillStyle = \"rgba(255,255,255,0.22)\";\n const chipText = spec.category.toUpperCase();\n ctx.font = `700 ${chipSize}px ui-sans-serif, system-ui, sans-serif`;\n ctx.textBaseline = \"top\";\n const chipPad = chipSize * 0.7;\n const chipW = ctx.measureText(chipText).width + chipPad * 2;\n const chipH = chipSize * 1.85;\n const chipY = (headerH - chipH) / 2;\n roundRect(ctx, padX, chipY, chipW, chipH, chipH / 2);\n ctx.fill();\n ctx.fillStyle = \"#fff\";\n ctx.fillText(chipText, padX + chipPad, chipY + (chipH - chipSize) / 2);\n\n // Path on right\n ctx.fillStyle = \"rgba(255,255,255,0.9)\";\n ctx.font = `500 ${pathSize}px ui-monospace, monospace`;\n const pathW = ctx.measureText(spec.path).width;\n ctx.fillText(spec.path, w - padX - pathW, chipY + (chipH - chipSize) / 2);\n\n // Title\n ctx.fillStyle = \"#f8fafc\";\n ctx.font = `800 ${titleSize}px ui-sans-serif, system-ui, sans-serif`;\n ctx.fillText(spec.name, padX, titleY);\n\n // Description (wrapped, clipped before reaching the CTA)\n ctx.fillStyle = \"#94a3b8\";\n ctx.font = `400 ${descSize}px ui-sans-serif, system-ui, sans-serif`;\n const ctaY = h - padX - ctaH;\n wrapText(ctx, spec.description, padX, descY, w - padX * 2, descLine, ctaY - descLine);\n\n // CTA at bottom\n ctx.fillStyle = spec.accent;\n const ctaText = \"Open demo →\";\n ctx.font = `600 ${ctaSize}px ui-sans-serif, system-ui, sans-serif`;\n const ctaTextPad = ctaSize * 0.9;\n const ctaW = ctx.measureText(ctaText).width + ctaTextPad * 2;\n roundRect(ctx, padX, ctaY, ctaW, ctaH, ctaH * 0.25);\n ctx.fill();\n ctx.fillStyle = \"#0f172a\";\n ctx.fillText(ctaText, padX + ctaTextPad, ctaY + (ctaH - ctaSize) / 2);\n ctx.textBaseline = \"alphabetic\";\n break;\n }\n }\n}\n\nfunction wrapText(\n ctx: CanvasRenderingContext2D,\n text: string,\n x: number,\n y: number,\n maxW: number,\n lineH: number,\n maxY?: number\n) {\n const words = text.split(\" \");\n let line = \"\";\n let yy = y;\n for (const word of words) {\n const test = line ? `${line} ${word}` : word;\n if (ctx.measureText(test).width > maxW && line) {\n if (maxY !== undefined && yy > maxY) return;\n ctx.fillText(line, x, yy);\n line = word;\n yy += lineH;\n } else {\n line = test;\n }\n }\n if (line && (maxY === undefined || yy <= maxY)) ctx.fillText(line, x, yy);\n}\n","/**\n * 3D shape primitives for `@particle-academy/fancy-3d` — three.js edition.\n *\n * A primitive is a three.js mesh that can host UI content on its surface —\n * either a flat color, a freeform 2D paint callback, or a `WidgetSpec`\n * rendered through the same painters as the three.js adapter.\n *\n * Every primitive returns a three.js `Mesh` (or a `Group` for composites),\n * ready to position in your scene. Pass `scene` to also add it for you.\n *\n * Mirrors `@particle-academy/fancy-3d-babylon`'s primitive API: same function\n * names, same option shapes. Differences from the Babylon adapter are minor and\n * idiomatic to three (e.g. `doubleSided?: boolean` instead of a `sideOrientation`\n * enum; `scene` is optional since three meshes exist independent of a scene).\n */\nimport * as THREE from \"three\";\nimport { DecalGeometry } from \"three/examples/jsm/geometries/DecalGeometry.js\";\nimport type { WidgetSpec } from \"@particle-academy/fancy-3d\";\nimport { TEX_SCALE, paintWidget } from \"./painters\";\n\nexport type PaintFn = (ctx: CanvasRenderingContext2D, width: number, height: number) => void;\n\nexport type SurfaceContent =\n | { type: \"color\"; color: string }\n | { type: \"paint\"; paint: PaintFn; pixelWidth?: number; pixelHeight?: number; transparent?: boolean }\n | { type: \"widget\"; widget: WidgetSpec; pixelWidth?: number; pixelHeight?: number; selected?: boolean };\n\nconst DEFAULT_DENSITY = 120;\nconst MAX_TEXTURE_AXIS = 1024;\n\nfunction autoPixelSize(worldWidth: number, worldHeight: number, density = DEFAULT_DENSITY) {\n let w = Math.max(96, Math.round(worldWidth * density));\n let h = Math.max(96, Math.round(worldHeight * density));\n const scale = Math.min(1, MAX_TEXTURE_AXIS / Math.max(w, h));\n if (scale < 1) {\n w = Math.round(w * scale);\n h = Math.round(h * scale);\n }\n return { w, h };\n}\n\n/** Draw onto a fresh retina canvas and wrap it in a three CanvasTexture. */\nfunction canvasTexture(w: number, h: number, draw: (ctx: CanvasRenderingContext2D) => void): THREE.CanvasTexture {\n const canvas = document.createElement(\"canvas\");\n canvas.width = Math.max(1, Math.round(w * TEX_SCALE));\n canvas.height = Math.max(1, Math.round(h * TEX_SCALE));\n const ctx = canvas.getContext(\"2d\") as CanvasRenderingContext2D;\n ctx.scale(TEX_SCALE, TEX_SCALE);\n draw(ctx);\n const tex = new THREE.CanvasTexture(canvas);\n tex.colorSpace = THREE.SRGBColorSpace;\n tex.anisotropy = 4;\n tex.needsUpdate = true;\n return tex;\n}\n\ninterface Surface {\n material: THREE.Material;\n texture: THREE.CanvasTexture | null;\n}\n\n/**\n * Resolve a SurfaceContent to a three material (+ optional texture). UI surfaces\n * (paint/widget) use an unlit `MeshBasicMaterial` so text stays readable\n * regardless of scene lighting — matching the Babylon adapter's self-emissive\n * panels. Flat colors use a lit `MeshStandardMaterial` so structure reads form.\n */\nfunction buildSurface(surface: SurfaceContent, autoSize?: { worldWidth: number; worldHeight: number }): Surface {\n if (surface.type === \"color\") {\n const color = new THREE.Color(surface.color);\n const material = new THREE.MeshStandardMaterial({\n color,\n emissive: color.clone().multiplyScalar(0.15),\n roughness: 0.7,\n metalness: 0.0,\n });\n return { material, texture: null };\n }\n\n let w = surface.pixelWidth;\n let h = surface.pixelHeight;\n if ((w == null || h == null) && autoSize) {\n const auto = autoPixelSize(autoSize.worldWidth, autoSize.worldHeight);\n w = w ?? auto.w;\n h = h ?? auto.h;\n }\n w = w ?? 512;\n h = h ?? 512;\n\n const transparent = surface.type === \"widget\" || (surface.type === \"paint\" && !!surface.transparent);\n const texture = canvasTexture(w, h, (ctx) => {\n if (surface.type === \"paint\") surface.paint(ctx, w!, h!);\n else paintWidget(ctx, surface.widget, w!, h!, surface.selected ?? false);\n });\n const material = new THREE.MeshBasicMaterial({ map: texture, transparent, toneMapped: false });\n return { material, texture };\n}\n\n/** Add to a scene/group if one was supplied (parity with Babylon's auto-add). */\nfunction attach<T extends THREE.Object3D>(obj: T, scene?: THREE.Object3D): T {\n if (scene) scene.add(obj);\n return obj;\n}\n\n/* ------------------------------------------------------------------ */\n/* Panel — flat 2D plane with one surface */\n/* ------------------------------------------------------------------ */\n\nexport interface PanelOpts {\n scene?: THREE.Object3D;\n name?: string;\n width: number;\n height: number;\n surface: SurfaceContent;\n /** Render both faces (e.g. for self-luminous screens). */\n doubleSided?: boolean;\n}\n\nexport function createPanel(opts: PanelOpts): THREE.Mesh {\n const geo = new THREE.PlaneGeometry(opts.width, opts.height);\n const { material } = buildSurface(opts.surface, { worldWidth: opts.width, worldHeight: opts.height });\n if (opts.doubleSided) material.side = THREE.DoubleSide;\n const mesh = new THREE.Mesh(geo, material);\n mesh.name = opts.name ?? \"panel\";\n return attach(mesh, opts.scene);\n}\n\n/* ------------------------------------------------------------------ */\n/* Billboard — panel that can be set to always face the camera */\n/* ------------------------------------------------------------------ */\n\nexport interface BillboardOpts extends PanelOpts {\n /** When true, the mesh is flagged to always face the camera. `<Stage>` honors\n * the flag each frame; outside a Stage, call `mesh.lookAt(camera.position)`. */\n faceCamera?: boolean;\n}\n\nexport function createBillboard(opts: BillboardOpts): THREE.Mesh {\n const m = createPanel({ ...opts, scene: undefined, name: opts.name ?? \"billboard\" });\n if (opts.faceCamera) m.userData.faceCamera = true;\n return attach(m, opts.scene);\n}\n\n/* ------------------------------------------------------------------ */\n/* Building — rectangular box with optional facade texture */\n/* ------------------------------------------------------------------ */\n\nexport interface BuildingOpts {\n scene?: THREE.Object3D;\n name?: string;\n width: number;\n height: number;\n depth: number;\n /** Surface applied to all 6 faces (cheap path). */\n surface?: SurfaceContent;\n /** Per-face surfaces; missing faces use `surface` or a default grey. */\n faces?: Partial<Record<BoxFace, SurfaceContent>>;\n}\n\nexport type BoxFace = \"front\" | \"back\" | \"right\" | \"left\" | \"top\" | \"bottom\";\n\n/** three BoxGeometry group order: +X, -X, +Y, -Y, +Z, -Z. */\nconst THREE_FACE_ORDER: BoxFace[] = [\"right\", \"left\", \"top\", \"bottom\", \"front\", \"back\"];\n\nexport function createBuilding(opts: BuildingOpts): THREE.Mesh {\n const geo = new THREE.BoxGeometry(opts.width, opts.height, opts.depth);\n\n if (opts.surface && !opts.faces) {\n const { material } = buildSurface(opts.surface, { worldWidth: opts.width, worldHeight: opts.height });\n const mesh = new THREE.Mesh(geo, material);\n mesh.name = opts.name ?? \"building\";\n return attach(mesh, opts.scene);\n }\n\n // Per-face: three exposes 6 geometry groups, one per face — assign a material\n // array in +X,-X,+Y,-Y,+Z,-Z order.\n const materials = THREE_FACE_ORDER.map((face) => {\n const surface = opts.faces?.[face] ?? opts.surface ?? { type: \"color\" as const, color: \"#475569\" };\n const isSide = face === \"front\" || face === \"back\";\n return buildSurface(surface, { worldWidth: isSide ? opts.width : opts.depth, worldHeight: opts.height }).material;\n });\n const mesh = new THREE.Mesh(geo, materials);\n mesh.name = opts.name ?? \"building\";\n return attach(mesh, opts.scene);\n}\n\n/* ------------------------------------------------------------------ */\n/* Pillar — alias for a tall narrow building */\n/* ------------------------------------------------------------------ */\n\nexport interface PillarOpts {\n scene?: THREE.Object3D;\n name?: string;\n thickness: number;\n height: number;\n surface?: SurfaceContent;\n}\n\nexport function createPillar(opts: PillarOpts): THREE.Mesh {\n return createBuilding({\n scene: opts.scene,\n name: opts.name ?? \"pillar\",\n width: opts.thickness,\n depth: opts.thickness,\n height: opts.height,\n surface: opts.surface,\n });\n}\n\n/* ------------------------------------------------------------------ */\n/* Cylinder — tube with content wrapping the side */\n/* ------------------------------------------------------------------ */\n\nexport interface CylinderOpts {\n scene?: THREE.Object3D;\n name?: string;\n radius: number;\n height: number;\n surface: SurfaceContent;\n tessellation?: number;\n}\n\nexport function createCylinder(opts: CylinderOpts): THREE.Mesh {\n const geo = new THREE.CylinderGeometry(opts.radius, opts.radius, opts.height, opts.tessellation ?? 48, 1, false);\n const { material } = buildSurface(opts.surface, { worldWidth: opts.radius * 2 * Math.PI, worldHeight: opts.height });\n const mesh = new THREE.Mesh(geo, material);\n mesh.name = opts.name ?? \"cylinder\";\n return attach(mesh, opts.scene);\n}\n\n/* ------------------------------------------------------------------ */\n/* CurvedPanel — a partial cylindrical sheet (like a wraparound ad) */\n/* ------------------------------------------------------------------ */\n\nexport interface CurvedPanelOpts {\n scene?: THREE.Object3D;\n name?: string;\n width: number; // arc length\n height: number;\n arc: number; // radians spanned\n surface: SurfaceContent;\n tessellation?: number;\n}\n\nexport function createCurvedPanel(opts: CurvedPanelOpts): THREE.Mesh {\n const radius = opts.width / opts.arc;\n const segments = Math.max(8, opts.tessellation ?? 48);\n // Open-ended partial cylinder, centered on the +Z axis (thetaStart offsets the\n // arc so it's symmetric about the camera's default forward direction).\n const geo = new THREE.CylinderGeometry(\n radius,\n radius,\n opts.height,\n segments,\n 1,\n true,\n Math.PI / 2 - opts.arc / 2,\n opts.arc,\n );\n const { material } = buildSurface(opts.surface, { worldWidth: opts.width, worldHeight: opts.height });\n material.side = THREE.DoubleSide;\n const mesh = new THREE.Mesh(geo, material);\n mesh.name = opts.name ?? \"curved-panel\";\n return attach(mesh, opts.scene);\n}\n\n/* ------------------------------------------------------------------ */\n/* Sphere — full sphere with equirectangular surface */\n/* ------------------------------------------------------------------ */\n\nexport interface SphereOpts {\n scene?: THREE.Object3D;\n name?: string;\n diameter: number;\n surface: SurfaceContent;\n segments?: number;\n}\n\nexport function createSphere(opts: SphereOpts): THREE.Mesh {\n const geo = new THREE.SphereGeometry(opts.diameter / 2, opts.segments ?? 32, opts.segments ?? 32);\n const { material } = buildSurface(opts.surface, { worldWidth: opts.diameter * Math.PI, worldHeight: (opts.diameter * Math.PI) / 2 });\n const mesh = new THREE.Mesh(geo, material);\n mesh.name = opts.name ?? \"sphere\";\n return attach(mesh, opts.scene);\n}\n\n/* ------------------------------------------------------------------ */\n/* Disc — flat disc/circle */\n/* ------------------------------------------------------------------ */\n\nexport interface DiscOpts {\n scene?: THREE.Object3D;\n name?: string;\n radius: number;\n surface: SurfaceContent;\n tessellation?: number;\n}\n\nexport function createDisc(opts: DiscOpts): THREE.Mesh {\n const geo = new THREE.CircleGeometry(opts.radius, opts.tessellation ?? 64);\n const { material } = buildSurface(opts.surface, { worldWidth: opts.radius * 2, worldHeight: opts.radius * 2 });\n const mesh = new THREE.Mesh(geo, material);\n mesh.name = opts.name ?? \"disc\";\n return attach(mesh, opts.scene);\n}\n\n/* ------------------------------------------------------------------ */\n/* Card3D — an extruded panel (gives panels physical depth) */\n/* ------------------------------------------------------------------ */\n\nexport interface Card3DOpts {\n scene?: THREE.Object3D;\n name?: string;\n width: number;\n height: number;\n /** Extrusion depth. Defaults to a thin 0.06 — like real foam-board signage. */\n depth?: number;\n /** Surface for the front face (the visible UI). */\n front: SurfaceContent;\n /** Surface for the side and back faces. Defaults to a dark color. */\n edge?: SurfaceContent;\n}\n\nexport function createCard3D(opts: Card3DOpts): THREE.Mesh {\n const edge = opts.edge ?? { type: \"color\" as const, color: \"#0b0f17\" };\n return createBuilding({\n scene: opts.scene,\n name: opts.name ?? \"card3d\",\n width: opts.width,\n height: opts.height,\n depth: opts.depth ?? 0.06,\n faces: { front: opts.front, back: edge, top: edge, bottom: edge, left: edge, right: edge },\n });\n}\n\n/* ------------------------------------------------------------------ */\n/* Sign — a panel mounted on a post */\n/* ------------------------------------------------------------------ */\n\nexport interface SignOpts {\n scene?: THREE.Object3D;\n name?: string;\n width: number;\n height: number;\n postHeight?: number;\n postThickness?: number;\n surface: SurfaceContent;\n postColor?: string;\n}\n\nexport interface SignResult {\n root: THREE.Group;\n panel: THREE.Mesh;\n post: THREE.Mesh;\n}\n\nexport function createSign(opts: SignOpts): SignResult {\n const name = opts.name ?? \"sign\";\n const postHeight = opts.postHeight ?? 1.4;\n const postThickness = opts.postThickness ?? 0.12;\n const postColor = opts.postColor ?? \"#1f2937\";\n\n const root = new THREE.Group();\n root.name = `${name}-root`;\n\n const panel = createBillboard({ name: `${name}-panel`, width: opts.width, height: opts.height, surface: opts.surface });\n panel.position.set(0, postHeight + opts.height / 2, 0);\n root.add(panel);\n\n const post = new THREE.Mesh(\n new THREE.BoxGeometry(postThickness, postHeight, postThickness),\n new THREE.MeshStandardMaterial({ color: new THREE.Color(postColor), roughness: 0.6 }),\n );\n post.name = `${name}-post`;\n post.position.set(0, postHeight / 2, 0);\n root.add(post);\n\n attach(root, opts.scene);\n return { root, panel, post };\n}\n\n/* ------------------------------------------------------------------ */\n/* Monitor — a 3D display: extruded bezel + recessed screen face */\n/* ------------------------------------------------------------------ */\n\nexport interface MonitorOpts {\n scene?: THREE.Object3D;\n name?: string;\n width: number;\n height: number;\n /** Front-to-back depth of the display chassis. Defaults to 0.18. */\n depth?: number;\n /** Bezel color. Defaults to near-black. */\n bezel?: string;\n /** Screen surface — color, paint, or widget. */\n screen: SurfaceContent;\n /** Optional kickstand height — when set, the monitor sits on a base. */\n standHeight?: number;\n}\n\nexport interface MonitorResult {\n root: THREE.Group;\n body: THREE.Mesh;\n screen: THREE.Mesh;\n stand?: THREE.Mesh;\n}\n\nexport function createMonitor(opts: MonitorOpts): MonitorResult {\n const name = opts.name ?? \"monitor\";\n const depth = opts.depth ?? 0.18;\n const bezelColor = new THREE.Color(opts.bezel ?? \"#0b0f17\");\n const bodyMat = new THREE.MeshStandardMaterial({ color: bezelColor, roughness: 0.5, metalness: 0.1 });\n\n const root = new THREE.Group();\n root.name = `${name}-root`;\n\n const body = new THREE.Mesh(new THREE.BoxGeometry(opts.width, opts.height, depth), bodyMat);\n body.name = `${name}-body`;\n root.add(body);\n\n // Screen face — a plane on the +Z front of the bezel (PlaneGeometry faces +Z\n // by default, which is where the default camera sits, so no flip needed).\n const screenInset = 0.04;\n const screen = createPanel({\n name: `${name}-screen`,\n width: opts.width - screenInset * 2,\n height: opts.height - screenInset * 2,\n surface: opts.screen,\n });\n screen.position.set(0, 0, depth / 2 + 0.005);\n root.add(screen);\n\n let stand: THREE.Mesh | undefined;\n if (opts.standHeight && opts.standHeight > 0) {\n stand = new THREE.Mesh(new THREE.BoxGeometry(opts.width * 0.3, opts.standHeight, depth * 1.5), bodyMat);\n stand.name = `${name}-stand`;\n stand.position.set(0, -opts.height / 2 - opts.standHeight / 2, 0);\n root.add(stand);\n }\n\n attach(root, opts.scene);\n return { root, body, screen, stand };\n}\n\n/* ------------------------------------------------------------------ */\n/* Decal — project a 2D pattern onto another mesh's surface */\n/* ------------------------------------------------------------------ */\n\nexport interface DecalOpts {\n scene?: THREE.Object3D;\n name?: string;\n /** The mesh to project the decal onto. */\n target: THREE.Mesh;\n /** World-space position the projector sits at. */\n position: THREE.Vector3;\n /** Direction the projector points. Defaults to -Z. */\n normal?: THREE.Vector3;\n /** Size of the decal box. */\n size: { width: number; height: number; depth?: number };\n /** Rotation around the projection axis (radians). */\n angle?: number;\n /** Surface to project. */\n surface: SurfaceContent;\n}\n\nexport function createDecal(opts: DecalOpts): THREE.Mesh {\n const name = opts.name ?? \"decal\";\n const normal = (opts.normal ?? new THREE.Vector3(0, 0, -1)).clone().normalize();\n\n // Orientation: align the decal projector's forward (+Z) to the normal, plus a\n // roll of `angle` around that axis.\n const quat = new THREE.Quaternion().setFromUnitVectors(new THREE.Vector3(0, 0, 1), normal);\n if (opts.angle) quat.multiply(new THREE.Quaternion().setFromAxisAngle(new THREE.Vector3(0, 0, 1), opts.angle));\n const orientation = new THREE.Euler().setFromQuaternion(quat);\n const size = new THREE.Vector3(opts.size.width, opts.size.height, opts.size.depth ?? 1);\n\n const geo = new DecalGeometry(opts.target, opts.position, orientation, size);\n const { material } = buildSurface(opts.surface, { worldWidth: opts.size.width, worldHeight: opts.size.height });\n // Decals sit on top of the target — offset to avoid z-fighting + show the\n // target through transparent borders.\n (material as THREE.MeshBasicMaterial).transparent = true;\n material.polygonOffset = true;\n material.polygonOffsetFactor = -4;\n material.depthWrite = false;\n const mesh = new THREE.Mesh(geo, material);\n mesh.name = name;\n return attach(mesh, opts.scene);\n}\n\n/* ------------------------------------------------------------------ */\n/* Helper: paint a widget onto a fresh CanvasTexture (escape hatch) */\n/* ------------------------------------------------------------------ */\n\nexport function createWidgetTexture(\n name: string,\n widget: WidgetSpec,\n pixelWidth: number,\n pixelHeight: number,\n selected = false,\n): THREE.CanvasTexture {\n const tex = canvasTexture(pixelWidth, pixelHeight, (ctx) => paintWidget(ctx, widget, pixelWidth, pixelHeight, selected));\n tex.name = name;\n return tex;\n}\n","/**\n * Layout helpers — map 2D scene-node positions onto 3D arrangements (three.js).\n *\n * All layout functions take the same shape: a SceneNode, the Object3D that was\n * built for it, the scene's bounds, and layout-specific options. They mutate\n * `obj.position` (and sometimes `obj.rotation.y`) in place.\n *\n * Pair with `sceneBounds(scene)` from the package root to compute the bounds.\n * Mirrors `@particle-academy/fancy-3d-babylon`'s layout API.\n */\nimport * as THREE from \"three\";\nimport type { SceneNode } from \"@particle-academy/fancy-3d\";\n\ninterface Bounds {\n minX: number;\n maxX: number;\n minY: number;\n maxY: number;\n}\n\nfunction sizeOf(node: SceneNode): { w: number; h: number } {\n return { w: node.size?.w ?? 200, h: node.size?.h ?? 120 };\n}\n\nfunction normalizedCenter(node: SceneNode, bounds: Bounds) {\n const { w, h } = sizeOf(node);\n const cx = (node.position.x + w / 2 - bounds.minX) / Math.max(1, bounds.maxX - bounds.minX);\n const cy = (node.position.y + h / 2 - bounds.minY) / Math.max(1, bounds.maxY - bounds.minY);\n return { cx, cy };\n}\n\n/* ------------------------------------------------------------------ */\n/* Grid — flat XY grid in front of the camera */\n/* ------------------------------------------------------------------ */\n\nexport interface GridLayoutOpts {\n /** Pixel-to-world unit ratio. Defaults to 1/120. */\n scale?: number;\n /** World-space center of the grid. Defaults to (0, 0, 0). */\n origin?: THREE.Vector3;\n}\n\nexport function placeOnGrid(node: SceneNode, obj: THREE.Object3D, bounds: Bounds, opts: GridLayoutOpts = {}) {\n const scale = opts.scale ?? 1 / 120;\n const origin = opts.origin ?? new THREE.Vector3(0, 0, 0);\n const { w, h } = sizeOf(node);\n const cx = node.position.x + w / 2 - (bounds.minX + bounds.maxX) / 2;\n const cy = node.position.y + h / 2 - (bounds.minY + bounds.maxY) / 2;\n obj.position.set(origin.x + cx * scale, origin.y - cy * scale, origin.z);\n}\n\n/* ------------------------------------------------------------------ */\n/* Wall — gallery layout against a vertical plane */\n/* ------------------------------------------------------------------ */\n\nexport interface WallLayoutOpts {\n z?: number;\n spreadX?: number;\n spreadY?: number;\n centerY?: number;\n}\n\nexport function placeOnWall(node: SceneNode, obj: THREE.Object3D, bounds: Bounds, opts: WallLayoutOpts = {}) {\n const spreadX = opts.spreadX ?? 10;\n const spreadY = opts.spreadY ?? 4;\n const centerY = opts.centerY ?? 1.5;\n const z = opts.z ?? 0;\n const { cx, cy } = normalizedCenter(node, bounds);\n obj.position.set((cx - 0.5) * spreadX, centerY + (0.5 - cy) * spreadY, z);\n obj.rotation.y = 0;\n}\n\n/* ------------------------------------------------------------------ */\n/* Arc — partial cylinder */\n/* ------------------------------------------------------------------ */\n\nexport interface ArcLayoutOpts {\n radius?: number;\n arc?: number;\n height?: number;\n baseY?: number;\n}\n\nexport function placeOnArc(node: SceneNode, obj: THREE.Object3D, bounds: Bounds, opts: ArcLayoutOpts = {}) {\n const radius = opts.radius ?? 6;\n const arc = opts.arc ?? Math.PI * 0.9;\n const height = opts.height ?? 6;\n const baseY = opts.baseY ?? 0;\n const { cx, cy } = normalizedCenter(node, bounds);\n const angle = (cx - 0.5) * arc;\n obj.position.set(Math.sin(angle) * radius, baseY + (0.5 - cy) * height, Math.cos(angle) * radius);\n obj.rotation.y = angle;\n}\n\n/* ------------------------------------------------------------------ */\n/* Path — distribute along a sequence of waypoints */\n/* ------------------------------------------------------------------ */\n\nexport interface PathLayoutOpts {\n waypoints: THREE.Vector3[];\n faceForward?: boolean;\n byIndex?: boolean;\n nodeCount?: number;\n}\n\nfunction lerpPath(waypoints: THREE.Vector3[], t: number): { pos: THREE.Vector3; tangent: THREE.Vector3 } {\n if (waypoints.length === 0) return { pos: new THREE.Vector3(0, 0, 0), tangent: new THREE.Vector3(0, 0, 1) };\n if (waypoints.length === 1) return { pos: waypoints[0].clone(), tangent: new THREE.Vector3(0, 0, 1) };\n const segments = waypoints.length - 1;\n const scaled = Math.max(0, Math.min(1, t)) * segments;\n const i = Math.min(segments - 1, Math.floor(scaled));\n const local = scaled - i;\n const a = waypoints[i];\n const b = waypoints[i + 1];\n const pos = a.clone().lerp(b, local);\n const tangent = b.clone().sub(a).normalize();\n return { pos, tangent };\n}\n\nexport function placeOnPath(node: SceneNode, obj: THREE.Object3D, bounds: Bounds, opts: PathLayoutOpts) {\n const faceForward = opts.faceForward ?? true;\n let t: number;\n if (opts.byIndex) {\n const total = opts.nodeCount ?? Math.max(1, bounds.maxX - bounds.minX);\n const idx = node.position.x;\n t = total > 1 ? idx / (total - 1) : 0.5;\n } else {\n const { cx } = normalizedCenter(node, bounds);\n t = cx;\n }\n const { pos, tangent } = lerpPath(opts.waypoints, t);\n obj.position.copy(pos);\n if (faceForward) obj.rotation.y = Math.atan2(tangent.x, tangent.z);\n}\n\n/* ------------------------------------------------------------------ */\n/* Sphere — wrap nodes onto a sphere surface */\n/* ------------------------------------------------------------------ */\n\nexport interface SphereLayoutOpts {\n radius?: number;\n center?: THREE.Vector3;\n latSpan?: number;\n lonSpan?: number;\n}\n\nexport function placeOnSphere(node: SceneNode, obj: THREE.Object3D, bounds: Bounds, opts: SphereLayoutOpts = {}) {\n const radius = opts.radius ?? 5;\n const center = opts.center ?? new THREE.Vector3(0, 0, 0);\n const latSpan = opts.latSpan ?? Math.PI * 0.7;\n const lonSpan = opts.lonSpan ?? Math.PI * 2;\n const { cx, cy } = normalizedCenter(node, bounds);\n const lon = (cx - 0.5) * lonSpan;\n const lat = (0.5 - cy) * latSpan;\n const x = radius * Math.cos(lat) * Math.sin(lon);\n const y = radius * Math.sin(lat);\n const z = radius * Math.cos(lat) * Math.cos(lon);\n obj.position.set(center.x + x, center.y + y, center.z + z);\n obj.rotation.y = lon;\n}\n","/**\n * three.js adapter for `@particle-academy/fancy-3d`.\n *\n * Each widget kind paints onto a 2D HTMLCanvasElement that becomes a three\n * `CanvasTexture`, applied to a plane mesh sized to the widget's pixel rect.\n * The same `Scene` data renders recognizably across the DOM, Babylon, and\n * three.js adapters.\n *\n * `three` is a peer dependency — only consumers building 3D scenes install it.\n *\n * import { renderScene } from \"@particle-academy/fancy-3d\";\n * import { createThreeAdapter, placeOnArc, sceneBounds } from \"@particle-academy/fancy-3d-three\";\n */\nimport * as THREE from \"three\";\nimport type {\n AdapterContext,\n Scene,\n SceneNode,\n WidgetAdapter,\n WidgetSpec,\n} from \"@particle-academy/fancy-3d\";\n\nimport { TEX_SCALE, paintWidget } from \"./painters\";\nexport { TEX_SCALE, paintWidget } from \"./painters\";\n\nconst WORLD_SCALE = 1 / 180; // pixels → world units\n\n/* ------------------------------------------------------------------ */\n/* Adapter */\n/* ------------------------------------------------------------------ */\n\nexport interface ThreeAdapterDeps {\n /** The three Scene meshes are added to. */\n scene3D: THREE.Scene;\n /** Pixel size for the widget (the scene node's `size` field). */\n sizeFor(spec: WidgetSpec): { w: number; h: number };\n}\n\nexport function createThreeAdapter(deps: ThreeAdapterDeps): WidgetAdapter<THREE.Object3D> {\n return {\n render(spec: WidgetSpec, ctx: AdapterContext): THREE.Object3D {\n const { w, h } = deps.sizeFor(spec);\n const canvas = document.createElement(\"canvas\");\n canvas.width = Math.max(1, Math.round(w * TEX_SCALE));\n canvas.height = Math.max(1, Math.round(h * TEX_SCALE));\n const c = canvas.getContext(\"2d\") as CanvasRenderingContext2D;\n c.scale(TEX_SCALE, TEX_SCALE);\n paintWidget(c, spec, w, h, ctx.selected);\n\n const tex = new THREE.CanvasTexture(canvas);\n tex.colorSpace = THREE.SRGBColorSpace;\n tex.anisotropy = 4;\n tex.needsUpdate = true;\n\n const mat = new THREE.MeshBasicMaterial({ map: tex, transparent: true, toneMapped: false });\n const geo = new THREE.PlaneGeometry(w * WORLD_SCALE, h * WORLD_SCALE);\n const plane = new THREE.Mesh(geo, mat);\n plane.name = `node-${ctx.nodeId}`;\n plane.userData = { nodeId: ctx.nodeId, kind: spec.kind };\n deps.scene3D.add(plane);\n return plane;\n },\n };\n}\n\n/* ------------------------------------------------------------------ */\n/* Layout helpers */\n/* ------------------------------------------------------------------ */\n\n/**\n * \"3D Desktop\" layout — wraps the scene's 2D positions onto a partial cylinder\n * facing the camera. DOM `x` becomes angle around the cylinder, DOM `y` becomes\n * height.\n */\nexport function placeOnCylinder(\n node: SceneNode,\n obj: THREE.Object3D,\n bounds: { minX: number; maxX: number; minY: number; maxY: number },\n opts: { radius?: number; arc?: number } = {},\n) {\n const radius = opts.radius ?? 6;\n const arc = opts.arc ?? Math.PI * 0.9; // ~160°\n const rangeX = bounds.maxX - bounds.minX || 1;\n const rangeY = bounds.maxY - bounds.minY || 1;\n const cx = (node.position.x + (node.size?.w ?? 200) / 2 - bounds.minX) / rangeX;\n const cy = (node.position.y + (node.size?.h ?? 120) / 2 - bounds.minY) / rangeY;\n const angle = (cx - 0.5) * arc;\n const height = (0.5 - cy) * 6;\n obj.position.set(Math.sin(angle) * radius, height, Math.cos(angle) * radius);\n // Rotate around Y so the plane's front (+Z normal) points outward toward the\n // orbiting camera.\n obj.rotation.set(0, angle, 0);\n}\n\nexport function sceneBounds(scene: Scene) {\n const xs = scene.nodes.map((n) => n.position.x);\n const ys = scene.nodes.map((n) => n.position.y);\n const xe = scene.nodes.map((n) => n.position.x + (n.size?.w ?? 200));\n const ye = scene.nodes.map((n) => n.position.y + (n.size?.h ?? 120));\n return {\n minX: Math.min(...xs),\n maxX: Math.max(...xe),\n minY: Math.min(...ys),\n maxY: Math.max(...ye),\n };\n}\n\nexport * from \"./primitives\";\nexport * from \"./layouts\";\n"]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import { WidgetSpec, SceneNode, WidgetAdapter, Scene } from '@particle-academy/fancy-3d';
|
|
3
|
+
|
|
4
|
+
declare const TEX_SCALE = 2;
|
|
5
|
+
declare function paintWidget(ctx: CanvasRenderingContext2D, spec: WidgetSpec, w: number, h: number, selected: boolean): void;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* 3D shape primitives for `@particle-academy/fancy-3d` — three.js edition.
|
|
9
|
+
*
|
|
10
|
+
* A primitive is a three.js mesh that can host UI content on its surface —
|
|
11
|
+
* either a flat color, a freeform 2D paint callback, or a `WidgetSpec`
|
|
12
|
+
* rendered through the same painters as the three.js adapter.
|
|
13
|
+
*
|
|
14
|
+
* Every primitive returns a three.js `Mesh` (or a `Group` for composites),
|
|
15
|
+
* ready to position in your scene. Pass `scene` to also add it for you.
|
|
16
|
+
*
|
|
17
|
+
* Mirrors `@particle-academy/fancy-3d-babylon`'s primitive API: same function
|
|
18
|
+
* names, same option shapes. Differences from the Babylon adapter are minor and
|
|
19
|
+
* idiomatic to three (e.g. `doubleSided?: boolean` instead of a `sideOrientation`
|
|
20
|
+
* enum; `scene` is optional since three meshes exist independent of a scene).
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
type PaintFn = (ctx: CanvasRenderingContext2D, width: number, height: number) => void;
|
|
24
|
+
type SurfaceContent = {
|
|
25
|
+
type: "color";
|
|
26
|
+
color: string;
|
|
27
|
+
} | {
|
|
28
|
+
type: "paint";
|
|
29
|
+
paint: PaintFn;
|
|
30
|
+
pixelWidth?: number;
|
|
31
|
+
pixelHeight?: number;
|
|
32
|
+
transparent?: boolean;
|
|
33
|
+
} | {
|
|
34
|
+
type: "widget";
|
|
35
|
+
widget: WidgetSpec;
|
|
36
|
+
pixelWidth?: number;
|
|
37
|
+
pixelHeight?: number;
|
|
38
|
+
selected?: boolean;
|
|
39
|
+
};
|
|
40
|
+
interface PanelOpts {
|
|
41
|
+
scene?: THREE.Object3D;
|
|
42
|
+
name?: string;
|
|
43
|
+
width: number;
|
|
44
|
+
height: number;
|
|
45
|
+
surface: SurfaceContent;
|
|
46
|
+
/** Render both faces (e.g. for self-luminous screens). */
|
|
47
|
+
doubleSided?: boolean;
|
|
48
|
+
}
|
|
49
|
+
declare function createPanel(opts: PanelOpts): THREE.Mesh;
|
|
50
|
+
interface BillboardOpts extends PanelOpts {
|
|
51
|
+
/** When true, the mesh is flagged to always face the camera. `<Stage>` honors
|
|
52
|
+
* the flag each frame; outside a Stage, call `mesh.lookAt(camera.position)`. */
|
|
53
|
+
faceCamera?: boolean;
|
|
54
|
+
}
|
|
55
|
+
declare function createBillboard(opts: BillboardOpts): THREE.Mesh;
|
|
56
|
+
interface BuildingOpts {
|
|
57
|
+
scene?: THREE.Object3D;
|
|
58
|
+
name?: string;
|
|
59
|
+
width: number;
|
|
60
|
+
height: number;
|
|
61
|
+
depth: number;
|
|
62
|
+
/** Surface applied to all 6 faces (cheap path). */
|
|
63
|
+
surface?: SurfaceContent;
|
|
64
|
+
/** Per-face surfaces; missing faces use `surface` or a default grey. */
|
|
65
|
+
faces?: Partial<Record<BoxFace, SurfaceContent>>;
|
|
66
|
+
}
|
|
67
|
+
type BoxFace = "front" | "back" | "right" | "left" | "top" | "bottom";
|
|
68
|
+
declare function createBuilding(opts: BuildingOpts): THREE.Mesh;
|
|
69
|
+
interface PillarOpts {
|
|
70
|
+
scene?: THREE.Object3D;
|
|
71
|
+
name?: string;
|
|
72
|
+
thickness: number;
|
|
73
|
+
height: number;
|
|
74
|
+
surface?: SurfaceContent;
|
|
75
|
+
}
|
|
76
|
+
declare function createPillar(opts: PillarOpts): THREE.Mesh;
|
|
77
|
+
interface CylinderOpts {
|
|
78
|
+
scene?: THREE.Object3D;
|
|
79
|
+
name?: string;
|
|
80
|
+
radius: number;
|
|
81
|
+
height: number;
|
|
82
|
+
surface: SurfaceContent;
|
|
83
|
+
tessellation?: number;
|
|
84
|
+
}
|
|
85
|
+
declare function createCylinder(opts: CylinderOpts): THREE.Mesh;
|
|
86
|
+
interface CurvedPanelOpts {
|
|
87
|
+
scene?: THREE.Object3D;
|
|
88
|
+
name?: string;
|
|
89
|
+
width: number;
|
|
90
|
+
height: number;
|
|
91
|
+
arc: number;
|
|
92
|
+
surface: SurfaceContent;
|
|
93
|
+
tessellation?: number;
|
|
94
|
+
}
|
|
95
|
+
declare function createCurvedPanel(opts: CurvedPanelOpts): THREE.Mesh;
|
|
96
|
+
interface SphereOpts {
|
|
97
|
+
scene?: THREE.Object3D;
|
|
98
|
+
name?: string;
|
|
99
|
+
diameter: number;
|
|
100
|
+
surface: SurfaceContent;
|
|
101
|
+
segments?: number;
|
|
102
|
+
}
|
|
103
|
+
declare function createSphere(opts: SphereOpts): THREE.Mesh;
|
|
104
|
+
interface DiscOpts {
|
|
105
|
+
scene?: THREE.Object3D;
|
|
106
|
+
name?: string;
|
|
107
|
+
radius: number;
|
|
108
|
+
surface: SurfaceContent;
|
|
109
|
+
tessellation?: number;
|
|
110
|
+
}
|
|
111
|
+
declare function createDisc(opts: DiscOpts): THREE.Mesh;
|
|
112
|
+
interface Card3DOpts {
|
|
113
|
+
scene?: THREE.Object3D;
|
|
114
|
+
name?: string;
|
|
115
|
+
width: number;
|
|
116
|
+
height: number;
|
|
117
|
+
/** Extrusion depth. Defaults to a thin 0.06 — like real foam-board signage. */
|
|
118
|
+
depth?: number;
|
|
119
|
+
/** Surface for the front face (the visible UI). */
|
|
120
|
+
front: SurfaceContent;
|
|
121
|
+
/** Surface for the side and back faces. Defaults to a dark color. */
|
|
122
|
+
edge?: SurfaceContent;
|
|
123
|
+
}
|
|
124
|
+
declare function createCard3D(opts: Card3DOpts): THREE.Mesh;
|
|
125
|
+
interface SignOpts {
|
|
126
|
+
scene?: THREE.Object3D;
|
|
127
|
+
name?: string;
|
|
128
|
+
width: number;
|
|
129
|
+
height: number;
|
|
130
|
+
postHeight?: number;
|
|
131
|
+
postThickness?: number;
|
|
132
|
+
surface: SurfaceContent;
|
|
133
|
+
postColor?: string;
|
|
134
|
+
}
|
|
135
|
+
interface SignResult {
|
|
136
|
+
root: THREE.Group;
|
|
137
|
+
panel: THREE.Mesh;
|
|
138
|
+
post: THREE.Mesh;
|
|
139
|
+
}
|
|
140
|
+
declare function createSign(opts: SignOpts): SignResult;
|
|
141
|
+
interface MonitorOpts {
|
|
142
|
+
scene?: THREE.Object3D;
|
|
143
|
+
name?: string;
|
|
144
|
+
width: number;
|
|
145
|
+
height: number;
|
|
146
|
+
/** Front-to-back depth of the display chassis. Defaults to 0.18. */
|
|
147
|
+
depth?: number;
|
|
148
|
+
/** Bezel color. Defaults to near-black. */
|
|
149
|
+
bezel?: string;
|
|
150
|
+
/** Screen surface — color, paint, or widget. */
|
|
151
|
+
screen: SurfaceContent;
|
|
152
|
+
/** Optional kickstand height — when set, the monitor sits on a base. */
|
|
153
|
+
standHeight?: number;
|
|
154
|
+
}
|
|
155
|
+
interface MonitorResult {
|
|
156
|
+
root: THREE.Group;
|
|
157
|
+
body: THREE.Mesh;
|
|
158
|
+
screen: THREE.Mesh;
|
|
159
|
+
stand?: THREE.Mesh;
|
|
160
|
+
}
|
|
161
|
+
declare function createMonitor(opts: MonitorOpts): MonitorResult;
|
|
162
|
+
interface DecalOpts {
|
|
163
|
+
scene?: THREE.Object3D;
|
|
164
|
+
name?: string;
|
|
165
|
+
/** The mesh to project the decal onto. */
|
|
166
|
+
target: THREE.Mesh;
|
|
167
|
+
/** World-space position the projector sits at. */
|
|
168
|
+
position: THREE.Vector3;
|
|
169
|
+
/** Direction the projector points. Defaults to -Z. */
|
|
170
|
+
normal?: THREE.Vector3;
|
|
171
|
+
/** Size of the decal box. */
|
|
172
|
+
size: {
|
|
173
|
+
width: number;
|
|
174
|
+
height: number;
|
|
175
|
+
depth?: number;
|
|
176
|
+
};
|
|
177
|
+
/** Rotation around the projection axis (radians). */
|
|
178
|
+
angle?: number;
|
|
179
|
+
/** Surface to project. */
|
|
180
|
+
surface: SurfaceContent;
|
|
181
|
+
}
|
|
182
|
+
declare function createDecal(opts: DecalOpts): THREE.Mesh;
|
|
183
|
+
declare function createWidgetTexture(name: string, widget: WidgetSpec, pixelWidth: number, pixelHeight: number, selected?: boolean): THREE.CanvasTexture;
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Layout helpers — map 2D scene-node positions onto 3D arrangements (three.js).
|
|
187
|
+
*
|
|
188
|
+
* All layout functions take the same shape: a SceneNode, the Object3D that was
|
|
189
|
+
* built for it, the scene's bounds, and layout-specific options. They mutate
|
|
190
|
+
* `obj.position` (and sometimes `obj.rotation.y`) in place.
|
|
191
|
+
*
|
|
192
|
+
* Pair with `sceneBounds(scene)` from the package root to compute the bounds.
|
|
193
|
+
* Mirrors `@particle-academy/fancy-3d-babylon`'s layout API.
|
|
194
|
+
*/
|
|
195
|
+
|
|
196
|
+
interface Bounds {
|
|
197
|
+
minX: number;
|
|
198
|
+
maxX: number;
|
|
199
|
+
minY: number;
|
|
200
|
+
maxY: number;
|
|
201
|
+
}
|
|
202
|
+
interface GridLayoutOpts {
|
|
203
|
+
/** Pixel-to-world unit ratio. Defaults to 1/120. */
|
|
204
|
+
scale?: number;
|
|
205
|
+
/** World-space center of the grid. Defaults to (0, 0, 0). */
|
|
206
|
+
origin?: THREE.Vector3;
|
|
207
|
+
}
|
|
208
|
+
declare function placeOnGrid(node: SceneNode, obj: THREE.Object3D, bounds: Bounds, opts?: GridLayoutOpts): void;
|
|
209
|
+
interface WallLayoutOpts {
|
|
210
|
+
z?: number;
|
|
211
|
+
spreadX?: number;
|
|
212
|
+
spreadY?: number;
|
|
213
|
+
centerY?: number;
|
|
214
|
+
}
|
|
215
|
+
declare function placeOnWall(node: SceneNode, obj: THREE.Object3D, bounds: Bounds, opts?: WallLayoutOpts): void;
|
|
216
|
+
interface ArcLayoutOpts {
|
|
217
|
+
radius?: number;
|
|
218
|
+
arc?: number;
|
|
219
|
+
height?: number;
|
|
220
|
+
baseY?: number;
|
|
221
|
+
}
|
|
222
|
+
declare function placeOnArc(node: SceneNode, obj: THREE.Object3D, bounds: Bounds, opts?: ArcLayoutOpts): void;
|
|
223
|
+
interface PathLayoutOpts {
|
|
224
|
+
waypoints: THREE.Vector3[];
|
|
225
|
+
faceForward?: boolean;
|
|
226
|
+
byIndex?: boolean;
|
|
227
|
+
nodeCount?: number;
|
|
228
|
+
}
|
|
229
|
+
declare function placeOnPath(node: SceneNode, obj: THREE.Object3D, bounds: Bounds, opts: PathLayoutOpts): void;
|
|
230
|
+
interface SphereLayoutOpts {
|
|
231
|
+
radius?: number;
|
|
232
|
+
center?: THREE.Vector3;
|
|
233
|
+
latSpan?: number;
|
|
234
|
+
lonSpan?: number;
|
|
235
|
+
}
|
|
236
|
+
declare function placeOnSphere(node: SceneNode, obj: THREE.Object3D, bounds: Bounds, opts?: SphereLayoutOpts): void;
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* three.js adapter for `@particle-academy/fancy-3d`.
|
|
240
|
+
*
|
|
241
|
+
* Each widget kind paints onto a 2D HTMLCanvasElement that becomes a three
|
|
242
|
+
* `CanvasTexture`, applied to a plane mesh sized to the widget's pixel rect.
|
|
243
|
+
* The same `Scene` data renders recognizably across the DOM, Babylon, and
|
|
244
|
+
* three.js adapters.
|
|
245
|
+
*
|
|
246
|
+
* `three` is a peer dependency — only consumers building 3D scenes install it.
|
|
247
|
+
*
|
|
248
|
+
* import { renderScene } from "@particle-academy/fancy-3d";
|
|
249
|
+
* import { createThreeAdapter, placeOnArc, sceneBounds } from "@particle-academy/fancy-3d-three";
|
|
250
|
+
*/
|
|
251
|
+
|
|
252
|
+
interface ThreeAdapterDeps {
|
|
253
|
+
/** The three Scene meshes are added to. */
|
|
254
|
+
scene3D: THREE.Scene;
|
|
255
|
+
/** Pixel size for the widget (the scene node's `size` field). */
|
|
256
|
+
sizeFor(spec: WidgetSpec): {
|
|
257
|
+
w: number;
|
|
258
|
+
h: number;
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
declare function createThreeAdapter(deps: ThreeAdapterDeps): WidgetAdapter<THREE.Object3D>;
|
|
262
|
+
/**
|
|
263
|
+
* "3D Desktop" layout — wraps the scene's 2D positions onto a partial cylinder
|
|
264
|
+
* facing the camera. DOM `x` becomes angle around the cylinder, DOM `y` becomes
|
|
265
|
+
* height.
|
|
266
|
+
*/
|
|
267
|
+
declare function placeOnCylinder(node: SceneNode, obj: THREE.Object3D, bounds: {
|
|
268
|
+
minX: number;
|
|
269
|
+
maxX: number;
|
|
270
|
+
minY: number;
|
|
271
|
+
maxY: number;
|
|
272
|
+
}, opts?: {
|
|
273
|
+
radius?: number;
|
|
274
|
+
arc?: number;
|
|
275
|
+
}): void;
|
|
276
|
+
declare function sceneBounds(scene: Scene): {
|
|
277
|
+
minX: number;
|
|
278
|
+
maxX: number;
|
|
279
|
+
minY: number;
|
|
280
|
+
maxY: number;
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
export { type ArcLayoutOpts, type BillboardOpts, type BoxFace, type BuildingOpts, type Card3DOpts, type CurvedPanelOpts, type CylinderOpts, type DecalOpts, type DiscOpts, type GridLayoutOpts, type MonitorOpts, type MonitorResult, type PaintFn, type PanelOpts, type PathLayoutOpts, type PillarOpts, type SignOpts, type SignResult, type SphereLayoutOpts, type SphereOpts, type SurfaceContent, TEX_SCALE, type ThreeAdapterDeps, type WallLayoutOpts, createBillboard, createBuilding, createCard3D, createCurvedPanel, createCylinder, createDecal, createDisc, createMonitor, createPanel, createPillar, createSign, createSphere, createThreeAdapter, createWidgetTexture, paintWidget, placeOnArc, placeOnCylinder, placeOnGrid, placeOnPath, placeOnSphere, placeOnWall, sceneBounds };
|