@jucie-engine/painter 1.0.1 → 1.0.3
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/dist/index.cjs +1 -1
- package/dist/index.cjs.map +4 -4
- package/dist/index.js +1 -1
- package/dist/index.js.map +4 -4
- package/package.json +4 -2
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
1
|
+
var C=Object.defineProperty;var U=Object.getOwnPropertyDescriptor;var O=Object.getOwnPropertyNames;var j=Object.prototype.hasOwnProperty;var k=(y,e)=>{for(var t in e)C(y,t,{get:e[t],enumerable:!0})},z=(y,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of O(e))!j.call(y,n)&&n!==t&&C(y,n,{get:()=>e[n],enumerable:!(r=U(e,n))||r.enumerable});return y};var H=y=>z(C({},"__esModule",{value:!0}),y);var W={};k(W,{HitRegistry:()=>x,Painter:()=>$,defineBrush:()=>B,defineLayer:()=>A});module.exports=H(W);var _=require("@jucie-engine/core");var F={"2D":"2d",WEBGL:"webgl",WEBGL2:"webgl2",BITMAPRENDERER:"bitmaprenderer"};var L=require("@jucie-state/reactive"),S=require("@jucie-engine/core");var x=class{#t=new Map;register(e,t){if(!e)throw new Error("Hit area must have an id");return this.#t.set(e,{id:e,...t}),()=>this.unregister(e)}unregister(e){this.#t.delete(e)}get(e){return this.#t.get(e)}has(e){return this.#t.has(e)}get areas(){return Array.from(this.#t.values())}clear(){this.#t.clear()}};var B=(0,S.createDefinition)("BRUSH",[Object]),A=(0,S.createDefinition)("LAYER",[Object]),$=class extends _.ServiceProvider{#t=new Map;#o=null;#s=new Map;#n=new Map;#p=new Map;#f=!1;#c=null;#P=!1;#u=!1;#m=!1;#e={targetFPS:60,fixedTimeStep:1e3/60,timeScale:1,debug:{enabled:!1,showFPS:!0,showBounds:!0,showLayerTiming:!0}};#i={lastFrameTime:0,deltaTime:0,elapsedTime:0,frameCount:0};#h={fps:0,frameTime:0,layerTimes:new Map,brushTimes:new Map,skippedFrames:0};#d=new x;#g={x:0,y:0,state:"up"};#a=null;#r=null;#y=new Set;static manifest={name:"Painter",namespace:"painter",version:"1.0.0",defaults:{targetFPS:60,fixedTimeStep:1e3/60,timeScale:1,debug:{enabled:!1,showFPS:!0,showBounds:!0,showLayerTiming:!0}}};actions(e){return this.config&&Object.assign(this.#e,this.config),{addLayer:t=>this.addLayer(t),addLayers:(...t)=>{for(let r of t)this.addLayer(r)},updateCanvas:t=>this.updateCanvas(t),setCanvas:t=>this.setCanvas(t),setAssets:t=>this.setAssets(t),removeLayer:t=>this.removeLayer(t),start:()=>this.start(),stop:()=>this.stop(),render:()=>this.render(),setTargetFPS:t=>this.setTargetFPS(t),setTimeScale:t=>this.setTimeScale(t),setFixedTimeStep:t=>this.setFixedTimeStep(t),setDebug:t=>this.setDebug(t),getMetrics:()=>this.getMetrics(),handleResize:(t,r)=>this.handleResize(t,r),updatePointer:(t,r,n)=>this.updatePointer(t,r,n),subscribe:t=>this.subscribe(t)}}setCanvas(e){this.#o=e,Object.values(F).forEach(t=>{try{let r=e.getContext(t);r&&this.#s.set(t,r)}catch{console.warn(`Context type ${t} not supported`)}})}updateCanvas(e){let t=e(this.#o);t&&(this.#o=t)}setAssets(e){this.#p=e}start(){this.#f||(this.#f=!0,this.#b())}stop(){this.#f&&(this.#f=!1,this.#c&&(cancelAnimationFrame(this.#c),this.#c=null))}addLayer(e){var a;if((0,S.definitionType)(e)!=="LAYER")throw new Error("Invalid layer definition");let t=e._name,r=e(this.useContext,this.#d);if(r.data){let c=this.#w(`layer_${t}`,r.data);c&&this.#n.set(`layer_${t}`,c)}let n=r.children.map(c=>{var h;if((0,S.definitionType)(c)==="BRUSH"){let g=c._name,f=c(this.useContext,this.#d),b=f.data?this.#w(`brush_${g}`,f.data):()=>{},w=f.when?(0,L.createReactor)(f.when,{immediate:!0,context:this.useContext("state")}):null,d={name:g,...f,dataReactor:b,whenReactor:w};if((h=d.lifecycle)!=null&&h.onMount)try{d.lifecycle.onMount(this.#s.get(d.context||r.context))}catch(T){console.error(`Error in brush "${d.name}" onMount:`,T)}return d}return this.addLayer(c)}),i={...r,name:t,brushes:n,context:this.#s.get(r.context)};if(this.#t.set(t,i),(a=i.lifecycle)!=null&&a.onMount)try{i.lifecycle.onMount(i.context)}catch(c){console.error(`Error in layer "${t}" onMount:`,c)}return i}removeLayer(e){var n;let t=this.#t.get(e);if(!t)return;if((n=t.lifecycle)!=null&&n.onUnmount)try{t.lifecycle.onUnmount(t.context)}catch(i){console.error(`Error in layer "${e}" onUnmount:`,i)}t.brushes.forEach(i=>{var c;if((c=i.lifecycle)!=null&&c.onUnmount)try{i.lifecycle.onUnmount(this.#s.get(i.context||t.context))}catch(h){console.error(`Error in brush "${i.name}" onUnmount:`,h)}let a=this.#n.get(`painter_brush_${i.name}`);a&&(a.unsubscribe(),a.reactor.destroy(),this.#n.delete(`painter_brush_${i.name}`))});let r=this.#n.get(`painter_layer_${e}`);r&&(r.unsubscribe(),r.reactor.destroy(),this.#n.delete(`painter_layer_${e}`)),this.#t.delete(e)}#b(){this.#m||this.#u||(this.#m=!0,this.#c=requestAnimationFrame(()=>{this.#m=!1,this.#c=null,this.#T()}))}async#T(){var e,t,r,n,i,a,c,h,g,f,b,w,d,T,E,v,P;if(this.#o){this.#u=!0;try{this.#d.clear();let M=(e=this.#e.debug)!=null&&e.enabled?performance.now():0;this.#s.forEach(o=>{o.clearRect(0,0,this.#o.width,this.#o.height)});for(let o of this.#t.values()){let D=(t=this.#e.debug)!=null&&t.enabled?performance.now():0;if(o.whenReactor){let s=(r=this.#n.get(`painter_layer_${o.name}`))==null?void 0:r.reactor;if(!o.when(s()))continue}let u=o.context;if(u){if((n=o.lifecycle)!=null&&n.beforeRender)try{o.lifecycle.beforeRender(u,this.#i)}catch(s){console.error(`Error in layer "${o.name}" beforeRender:`,s),(i=o.lifecycle)!=null&&i.onError&&o.lifecycle.onError(s)}u.save(),o.settings&&Object.entries(o.settings).forEach(([s,R])=>{typeof u[s]=="function"?u[s](...Array.isArray(R)?R:[R]):u[s]=R});for(let s of o.brushes){let R=(a=this.#e.debug)!=null&&a.enabled?performance.now():0;if(s.whenReactor&&!s.whenReactor())continue;let m=s.context?this.#s.get(s.context):u;if(m){if((c=s.lifecycle)!=null&&c.beforeRender)try{s.lifecycle.beforeRender(m,this.#i)}catch(l){console.error(`Error in brush "${s.name}" beforeRender:`,l),(h=s.lifecycle)!=null&&h.onError&&s.lifecycle.onError(l);continue}m.save(),s.settings&&Object.entries(s.settings).forEach(([l,p])=>{typeof m[l]=="function"?m[l](...Array.isArray(p)?p:[p]):m[l]=p});try{let l={};if(s.assets)for(let p of s.assets)l[p]=this.#p.get(p);if(s.render(m,s.dataReactor(),l,this.#i),(g=s.lifecycle)!=null&&g.afterRender&&s.lifecycle.afterRender(m,this.#i),(f=this.#e.debug)!=null&&f.enabled){let p=performance.now()-R;this.#h.brushTimes.set(s.name,p),(b=this.#e.debug)!=null&&b.showBounds&&this.#R(m,s)}}catch(l){console.error(`Error in brush "${s.name}":`,l),(w=s.lifecycle)!=null&&w.onError&&s.lifecycle.onError(l)}finally{m.restore()}}}if(u.restore(),(d=o.lifecycle)!=null&&d.afterRender)try{o.lifecycle.afterRender(u,this.#i)}catch(s){console.error(`Error in layer "${o.name}" afterRender:`,s),(T=o.lifecycle)!=null&&T.onError&&o.lifecycle.onError(s)}if((E=this.#e.debug)!=null&&E.enabled){let s=performance.now()-D;this.#h.layerTimes.set(o.name,s),(v=this.#e.debug)!=null&&v.showBounds&&this.#x(u,o)}}}(P=this.#e.debug)!=null&&P.enabled&&this.#S()}finally{this.#u=!1}}}#R(e,t){e.save(),e.strokeStyle="rgba(0, 255, 0, 0.5)",e.lineWidth=1,e.strokeRect(0,0,e.canvas.width,e.canvas.height),e.restore()}#x(e,t){e.save(),e.strokeStyle="rgba(255, 0, 0, 0.5)",e.lineWidth=2,e.strokeRect(0,0,e.canvas.width,e.canvas.height),e.restore()}#S(){var n,i;let e=this.#s.get(F["2D"]);if(!e)return;e.save(),e.resetTransform(),e.font="12px monospace",e.fillStyle="white",e.strokeStyle="black",e.lineWidth=3;let t=20,r=15;if((n=this.#e.debug)!=null&&n.showFPS){let a=`FPS: ${Math.round(this.#h.fps)} (${this.#i.deltaTime.toFixed(2)}ms)`;e.strokeText(a,10,t),e.fillText(a,10,t),t+=r}if((i=this.#e.debug)!=null&&i.showLayerTiming){e.fillText("Layer Times:",10,t),t+=r;for(let[a,c]of this.#h.layerTimes){let h=` ${a}: ${c.toFixed(2)}ms`;e.strokeText(h,10,t),e.fillText(h,10,t),t+=r}e.fillText(this.state.get(["_transitions","pointer","currentState"]),10,t)}e.restore()}handleResize(e,t){var r,n;for(let i of this.#t.values())if((r=i.lifecycle)!=null&&r.onResize)try{i.lifecycle.onResize(e,t,i.context)}catch(a){console.error(`Error in layer "${i.name}" onResize:`,a),(n=i.lifecycle)!=null&&n.onError&&i.lifecycle.onError(a)}}#w(e,t){let r=this.useContext("state"),n=(0,L.createReactor)(t,{immediate:!0,context:r}),i=(0,L.addEffect)(n,()=>this.#b());return this.#n.set(`painter_${e}`,{reactor:n,unsubscribe:i}),n}destroy(){this.stop();for(let e of this.#t.keys())this.removeLayer(e)}setTargetFPS(e){this.#e.targetFPS=e,this.#e.fixedTimeStep=1e3/e}setTimeScale(e){this.#e.timeScale=Math.max(0,e)}setFixedTimeStep(e){this.#e.fixedTimeStep=e}setDebug(e={}){this.#e.debug||(this.#e.debug={}),Object.assign(this.#e.debug,e)}getMetrics(){return{...this.#h,deltaTime:this.#i.deltaTime,elapsedTime:this.#i.elapsedTime,frameCount:this.#i.frameCount}}updatePointer(e,t,r){var a,c,h,g,f,b,w,d,T,E,v,P,M;let n={...this.#g};this.#g={x:e,y:t,state:r};let i=this.#E(e,t);r==="down"&&(this.#r=i,i!=null&&i.onPointerDown&&((c=(a=i.onPointerDown).handler)==null||c.call(a,i.data),this.#l("pointerdown",i.onPointerDown.metadata))),r==="up"&&((h=this.#r)!=null&&h.onPointerUp&&((f=(g=this.#r.onPointerUp).handler)==null||f.call(g,this.#r.data),this.#l("pointerup",this.#r.onPointerUp.metadata)),this.#r=null),r==="move"&&((b=this.#r)!=null&&b.onPointerMove&&((d=(w=this.#r.onPointerMove).handler)==null||d.call(w,this.#r.data,{x:e,y:t}),this.#l("pointermove",this.#r.onPointerMove.metadata)),i!==this.#a&&((T=this.#a)!=null&&T.onPointerLeave&&((v=(E=this.#a.onPointerLeave).handler)==null||v.call(E,this.#a.data),this.#l("pointerleave",this.#a.onPointerLeave.metadata)),i!=null&&i.onPointerEnter&&((M=(P=i.onPointerEnter).handler)==null||M.call(P,i.data),this.#l("pointerenter",i.onPointerEnter.metadata)),this.#a=i))}subscribe(e){return this.#y.add(e),()=>this.#y.delete(e)}#E(e,t){let r=this.#d.areas.sort((n,i)=>(i.priority||0)-(n.priority||0));for(let n of r)if(this.#v(e,t,n.bounds))return n;return null}#v(e,t,r){return e>=r.x&&e<=r.x+r.width&&t>=r.y&&t<=r.y+r.height}#l(e,t){if(t)for(let r of this.#y)r({type:e,metadata:t})}};0&&(module.exports={HitRegistry,Painter,defineBrush,defineLayer});
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../src/main.js", "../src/Painter.js", "../src/ContextTypes.js"],
|
|
4
|
-
"sourcesContent": ["export { Painter, defineLayer, defineBrush } from './Painter';\n", "import { ServiceProvider } from '@jucie-engine/core';\nimport { ContextTypes } from './ContextTypes.js';\nimport { createReactor, isReactor, addEffect } from '@jucie-state/reactive';\nimport { createDefinition, definitionType } from '@jucie-engine/core';\n\nexport const defineBrush = createDefinition('BRUSH', [Object]);\nexport const defineLayer = createDefinition('LAYER', [Object]);\n\nexport class Painter extends ServiceProvider {\n #layers = new Map();\n #canvas = null;\n #contexts = new Map();\n #reactors = new Map();\n #assets = new Map();\n #isRunning = false;\n #frameId = null;\n #renderNeeded = false;\n #isRendering = false;\n #renderScheduled = false;\n\n // Timing state\n #timing = {\n lastFrameTime: 0,\n deltaTime: 0,\n elapsedTime: 0,\n frameCount: 0\n };\n\n // Debug metrics\n #metrics = {\n fps: 0,\n frameTime: 0,\n layerTimes: new Map(),\n brushTimes: new Map(),\n skippedFrames: 0\n };\n\n static manifest = {\n name: 'Painter',\n namespace: 'painter',\n version: '1.0.0',\n defaults: {\n // Timing configuration\n targetFPS: 60,\n fixedTimeStep: 1000 / 60,\n timeScale: 1.0,\n // Debug configuration\n debug: {\n enabled: false,\n showFPS: true,\n showBounds: true,\n showLayerTiming: true\n }\n }\n };\n\n actions(context) {\n return {\n addLayer: (layerDef) => this.addLayer(layerDef),\n addLayers: (...layers) => {\n for (const layer of layers) {\n this.addLayer(layer);\n }\n },\n updateCanvas: (fn) => this.updateCanvas(fn),\n setCanvas: (canvas) => this.setCanvas(canvas),\n setAssets: (assets) => this.setAssets(assets),\n removeLayer: (name) => this.removeLayer(name),\n start: () => this.start(),\n stop: () => this.stop(),\n render: () => this.render(),\n setTargetFPS: (fps) => this.setTargetFPS(fps),\n setTimeScale: (scale) => this.setTimeScale(scale),\n setFixedTimeStep: (step) => this.setFixedTimeStep(step),\n setDebug: (options) => this.setDebug(options),\n getMetrics: () => this.getMetrics()\n };\n }\n\n setCanvas(canvas) {\n this.#canvas = canvas;\n \n // Create contexts for each type\n Object.values(ContextTypes).forEach(type => {\n try {\n const ctx = canvas.getContext(type);\n if (ctx) this.#contexts.set(type, ctx);\n } catch (e) {\n console.warn(`Context type ${type} not supported`);\n }\n });\n }\n\n updateCanvas(fn) {\n const result = fn(this.#canvas);\n if (result) {\n this.#canvas = result;\n }\n }\n\n setAssets(assets) {\n this.#assets = assets;\n }\n\n start() {\n if (!this.#isRunning) {\n this.#isRunning = true;\n this.#scheduleRender();\n }\n }\n\n stop() {\n if (this.#isRunning) {\n this.#isRunning = false;\n if (this.#frameId) {\n cancelAnimationFrame(this.#frameId);\n this.#frameId = null;\n }\n }\n }\n\n addLayer(layerDef) {\n if (definitionType(layerDef) !== 'LAYER') {\n throw new Error('Invalid layer definition');\n }\n\n const name = layerDef._name;\n const config = layerDef(this.useContext);\n \n // Set up layer reactor if it has data paths\n if (config.data) {\n const dataReactor = this.#createDataReactor(`layer_${name}`, config.data);\n if (dataReactor) {\n this.#reactors.set(`layer_${name}`, dataReactor);\n }\n }\n\n // Set up brush reactors and structure\n const brushes = config.children.map(child => {\n if (definitionType(child) === 'BRUSH') {\n const name = child._name;\n const brushConfig = child();\n const dataReactor = this.#createDataReactor(`brush_${name}`, brushConfig.data, );\n const whenReactor = createReactor(brushConfig.when, {\n immediate: true,\n context: this.useContext('state')\n })\n\n const brush = {\n name,\n ...brushConfig,\n dataReactor,\n whenReactor\n };\n\n // Call brush mount hook\n if (brush.lifecycle?.onMount) {\n try {\n brush.lifecycle.onMount(this.#contexts.get(brush.context || config.context));\n } catch (error) {\n console.error(`Error in brush \"${brush.name}\" onMount:`, error);\n }\n }\n\n return brush;\n }\n // Handle nested layers recursively\n return this.addLayer(child);\n });\n\n const layer = {\n ...config,\n name,\n brushes,\n context: this.#contexts.get(config.context)\n };\n\n this.#layers.set(name, layer);\n\n // Call layer mount hook\n if (layer.lifecycle?.onMount) {\n try {\n layer.lifecycle.onMount(layer.context);\n } catch (error) {\n console.error(`Error in layer \"${name}\" onMount:`, error);\n }\n }\n\n return layer;\n }\n\n removeLayer(name) {\n const layer = this.#layers.get(name);\n if (!layer) return;\n\n // Call layer unmount hook\n if (layer.lifecycle?.onUnmount) {\n try {\n layer.lifecycle.onUnmount(layer.context);\n } catch (error) {\n console.error(`Error in layer \"${name}\" onUnmount:`, error);\n }\n }\n\n // Call brush unmount hooks and clean up reactors\n layer.brushes.forEach(brush => {\n if (brush.lifecycle?.onUnmount) {\n try {\n brush.lifecycle.onUnmount(\n this.#contexts.get(brush.context || layer.context)\n );\n } catch (error) {\n console.error(`Error in brush \"${brush.name}\" onUnmount:`, error);\n }\n }\n // Clean up brush reactor and subscription\n const reactorData = this.#reactors.get(`painter_brush_${brush.name}`);\n if (reactorData) {\n reactorData.unsubscribe();\n reactorData.reactor.destroy();\n this.#reactors.delete(`painter_brush_${brush.name}`);\n }\n });\n\n // Clean up layer reactor and subscription\n const layerReactorData = this.#reactors.get(`painter_layer_${name}`);\n if (layerReactorData) {\n layerReactorData.unsubscribe();\n layerReactorData.reactor.destroy();\n this.#reactors.delete(`painter_layer_${name}`);\n }\n\n this.#layers.delete(name);\n }\n\n #scheduleRender() {\n if (this.#renderScheduled || this.#isRendering) return;\n \n this.#renderScheduled = true;\n \n this.#frameId = requestAnimationFrame(() => {\n this.#renderScheduled = false;\n this.#frameId = null;\n this.#render();\n });\n }\n\n async #render() {\n if (!this.#canvas) return;\n this.#isRendering = true;\n \n try { \n const renderStart = this.config.debug?.enabled ? performance.now() : 0;\n\n // Clear all contexts\n this.#contexts.forEach(ctx => {\n ctx.clearRect(0, 0, this.#canvas.width, this.#canvas.height);\n });\n\n // Render layers in order\n for (const layer of this.#layers.values()) {\n const layerStart = this.config.debug?.enabled ? performance.now() : 0;\n\n // Check layer condition\n if (layer.whenReactor) {\n const layerReactor = this.#reactors.get(`painter_layer_${layer.name}`)?.reactor;\n if (!layer.when(layerReactor())) continue;\n }\n\n const ctx = layer.context;\n\n if (!ctx) continue;\n\n // Layer beforeRender hook\n if (layer.lifecycle?.beforeRender) {\n try {\n layer.lifecycle.beforeRender(ctx, this.#timing);\n } catch (error) {\n console.error(`Error in layer \"${layer.name}\" beforeRender:`, error);\n if (layer.lifecycle?.onError) layer.lifecycle.onError(error);\n }\n }\n\n // Apply layer settings\n ctx.save();\n if (layer.settings) {\n Object.entries(layer.settings).forEach(([key, value]) => {\n if (typeof ctx[key] === 'function') {\n ctx[key](...(Array.isArray(value) ? value : [value]));\n } else {\n ctx[key] = value;\n }\n });\n }\n\n // Render brushes\n for (const brush of layer.brushes) {\n const brushStart = this.config.debug?.enabled ? performance.now() : 0;\n\n if (brush.whenReactor && !brush.whenReactor()) continue;\n\n\n const brushCtx = brush.context ? \n this.#contexts.get(brush.context) : \n ctx;\n\n if (!brushCtx) continue;\n\n // Brush beforeRender hook\n if (brush.lifecycle?.beforeRender) {\n try {\n brush.lifecycle.beforeRender(brushCtx, this.#timing);\n } catch (error) {\n console.error(`Error in brush \"${brush.name}\" beforeRender:`, error);\n if (brush.lifecycle?.onError) brush.lifecycle.onError(error);\n continue;\n }\n }\n\n brushCtx.save();\n \n if (brush.settings) {\n Object.entries(brush.settings).forEach(([key, value]) => {\n if (typeof brushCtx[key] === 'function') {\n brushCtx[key](...(Array.isArray(value) ? value : [value]));\n } else {\n brushCtx[key] = value;\n }\n });\n }\n \n try {\n const requiredAssets = {};\n if (brush.assets) {\n for (const key of brush.assets) {\n requiredAssets[key] = this.#assets.get(key);\n }\n }\n brush.render(brushCtx, brush.dataReactor(), requiredAssets, this.#timing);\n\n // Brush afterRender hook\n if (brush.lifecycle?.afterRender) {\n brush.lifecycle.afterRender(brushCtx, this.#timing);\n }\n\n if (this.config.debug?.enabled) {\n const brushTime = performance.now() - brushStart;\n this.#metrics.brushTimes.set(brush.name, brushTime);\n\n if (this.config.debug?.showBounds) {\n this.#renderBrushBounds(brushCtx, brush);\n }\n }\n } catch (error) {\n console.error(`Error in brush \"${brush.name}\":`, error);\n if (brush.lifecycle?.onError) brush.lifecycle.onError(error);\n } finally {\n brushCtx.restore();\n }\n }\n\n ctx.restore();\n\n // Layer afterRender hook\n if (layer.lifecycle?.afterRender) {\n try {\n layer.lifecycle.afterRender(ctx, this.#timing);\n } catch (error) {\n console.error(`Error in layer \"${layer.name}\" afterRender:`, error);\n if (layer.lifecycle?.onError) layer.lifecycle.onError(error);\n }\n }\n\n if (this.config.debug?.enabled) {\n const layerTime = performance.now() - layerStart;\n this.#metrics.layerTimes.set(layer.name, layerTime);\n\n if (this.config.debug?.showBounds) {\n this.#renderLayerBounds(ctx, layer);\n }\n }\n }\n\n // Render debug overlay if enabled\n if (this.config.debug?.enabled) {\n this.#renderDebugOverlay();\n }\n \n } finally {\n this.#isRendering = false;\n }\n }\n\n #renderBrushBounds(ctx, brush) {\n ctx.save();\n ctx.strokeStyle = 'rgba(0, 255, 0, 0.5)';\n ctx.lineWidth = 1;\n ctx.strokeRect(0, 0, ctx.canvas.width, ctx.canvas.height);\n ctx.restore();\n }\n\n #renderLayerBounds(ctx, layer) {\n ctx.save();\n ctx.strokeStyle = 'rgba(255, 0, 0, 0.5)';\n ctx.lineWidth = 2;\n ctx.strokeRect(0, 0, ctx.canvas.width, ctx.canvas.height);\n ctx.restore();\n }\n\n #renderDebugOverlay() {\n const ctx = this.#contexts.get(ContextTypes['2D']);\n if (!ctx) return;\n\n ctx.save();\n ctx.resetTransform();\n ctx.font = '12px monospace';\n ctx.fillStyle = 'white';\n ctx.strokeStyle = 'black';\n ctx.lineWidth = 3;\n\n let y = 20;\n const lineHeight = 15;\n\n if (this.config.debug?.showFPS) {\n const text = `FPS: ${Math.round(this.#metrics.fps)} (${this.#timing.deltaTime.toFixed(2)}ms)`;\n ctx.strokeText(text, 10, y);\n ctx.fillText(text, 10, y);\n y += lineHeight;\n }\n\n if (this.config.debug?.showLayerTiming) {\n ctx.fillText('Layer Times:', 10, y);\n y += lineHeight;\n\n for (const [name, time] of this.#metrics.layerTimes) {\n const text = ` ${name}: ${time.toFixed(2)}ms`;\n ctx.strokeText(text, 10, y);\n ctx.fillText(text, 10, y);\n y += lineHeight;\n }\n\n ctx.fillText(this.state.get(['_transitions', 'pointer', 'currentState']), 10, y);\n }\n\n ctx.restore();\n }\n\n handleResize(width, height) {\n // Call onResize hooks for all layers\n for (const layer of this.#layers.values()) {\n if (layer.lifecycle?.onResize) {\n try {\n layer.lifecycle.onResize(width, height, layer.context);\n } catch (error) {\n console.error(`Error in layer \"${layer.name}\" onResize:`, error);\n if (layer.lifecycle?.onError) layer.lifecycle.onError(error);\n }\n }\n }\n }\n\n #createDataReactor(id, data) {\n const state = this.useContext('state');\n\n const reactor = createReactor(data, {\n immediate: true,\n context: state\n });\n\n const unsubscribe = addEffect(reactor, () => this.#scheduleRender());\n\n this.#reactors.set(`painter_${id}`, {\n reactor,\n unsubscribe\n });\n\n return reactor;\n }\n\n destroy() {\n this.stop();\n // Clean up all layers and reactors\n for (const name of this.#layers.keys()) {\n this.removeLayer(name);\n }\n }\n\n setTargetFPS(fps) {\n this.config.targetFPS = fps;\n this.config.fixedTimeStep = 1000 / fps;\n }\n\n setTimeScale(scale) {\n this.config.timeScale = Math.max(0, scale);\n }\n\n setFixedTimeStep(step) {\n this.config.fixedTimeStep = step;\n }\n\n setDebug(options = {}) {\n if (!this.config.debug) {\n this.config.debug = {};\n }\n Object.assign(this.config.debug, options);\n }\n\n getMetrics() {\n return {\n ...this.#metrics,\n deltaTime: this.#timing.deltaTime,\n elapsedTime: this.#timing.elapsedTime,\n frameCount: this.#timing.frameCount\n };\n }\n}", "export const ContextTypes = {\n '2D': '2d',\n 'WEBGL': 'webgl',\n 'WEBGL2': 'webgl2',\n 'BITMAPRENDERER': 'bitmaprenderer'\n};"],
|
|
5
|
-
"mappings": "4ZAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,EAAA,gBAAAC,EAAA,gBAAAC,IAAA,eAAAC,EAAAL,GCAA,IAAAM,EAAgC,8BCAzB,IAAMC,EAAe,CAC1B,KAAM,KACN,MAAS,QACT,OAAU,SACV,eAAkB,gBACpB,EDHA,IAAAC,EAAoD,iCACpDC,EAAiD,8BAEpCC,KAAc,oBAAiB,QAAS,CAAC,MAAM,CAAC,EAChDC,KAAc,oBAAiB,QAAS,CAAC,MAAM,CAAC,EAEhDC,EAAN,cAAsB,iBAAgB,CAC3CC,GAAU,IAAI,IACdC,GAAU,KACVC,GAAY,IAAI,IAChBC,GAAY,IAAI,IAChBC,GAAU,IAAI,IACdC,GAAa,GACbC,GAAW,KACXC,GAAgB,GAChBC,GAAe,GACfC,GAAmB,GAG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9B,CAEA,SAASC,EAAU,CAAC,EAAG,CAChB,KAAK,OAAO,QACf,KAAK,OAAO,MAAQ,CAAC,GAEvB,OAAO,OAAO,KAAK,OAAO,MAAOA,CAAO,CAC1C,CAEA,YAAa,CACX,MAAO,CACL,GAAG,KAAKZ,GACR,UAAW,KAAKD,GAAQ,UACxB,YAAa,KAAKA,GAAQ,YAC1B,WAAY,KAAKA,GAAQ,UAC3B,CACF,CACF",
|
|
6
|
-
"names": ["main_exports", "__export", "Painter", "defineBrush", "defineLayer", "__toCommonJS", "import_core", "ContextTypes", "import_reactive", "import_core", "defineBrush", "defineLayer", "Painter", "#layers", "#canvas", "#contexts", "#reactors", "#assets", "#isRunning", "#frameId", "#renderNeeded", "#isRendering", "#renderScheduled", "#timing", "#metrics", "context", "layerDef", "layers", "layer", "fn", "canvas", "assets", "name", "fps", "scale", "step", "options", "ContextTypes", "type", "ctx", "result", "#scheduleRender", "_a", "config", "dataReactor", "#createDataReactor", "brushes", "child", "brushConfig", "whenReactor", "brush", "error", "reactorData", "layerReactorData", "#render", "_b", "_c", "_d", "_e", "_f", "_g", "_h", "_i", "_j", "_k", "_l", "_m", "_n", "_o", "_p", "_q", "renderStart", "layerStart", "layerReactor", "key", "value", "brushStart", "brushCtx", "requiredAssets", "brushTime", "#renderBrushBounds", "layerTime", "#renderLayerBounds", "#renderDebugOverlay", "
|
|
3
|
+
"sources": ["../src/main.js", "../src/Painter.js", "../src/ContextTypes.js", "../src/HitRegistry.js"],
|
|
4
|
+
"sourcesContent": ["export { Painter, defineLayer, defineBrush } from './Painter';\nexport { HitRegistry } from './HitRegistry';", "import { ServiceProvider } from '@jucie-engine/core';\nimport { ContextTypes } from './ContextTypes.js';\nimport { createReactor, isReactor, addEffect } from '@jucie-state/reactive';\nimport { createDefinition, definitionType } from '@jucie-engine/core';\nimport { HitRegistry } from './HitRegistry.js';\n\nexport const defineBrush = createDefinition('BRUSH', [Object]);\nexport const defineLayer = createDefinition('LAYER', [Object]);\n\nexport class Painter extends ServiceProvider {\n #layers = new Map();\n #canvas = null;\n #contexts = new Map();\n #reactors = new Map();\n #assets = new Map();\n #isRunning = false;\n #frameId = null;\n #renderNeeded = false;\n #isRendering = false;\n #renderScheduled = false;\n\n // Mutable runtime config (separate from frozen config)\n #runtimeConfig = {\n targetFPS: 60,\n fixedTimeStep: 1000 / 60,\n timeScale: 1.0,\n debug: {\n enabled: false,\n showFPS: true,\n showBounds: true,\n showLayerTiming: true\n }\n };\n\n // Timing state\n #timing = {\n lastFrameTime: 0,\n deltaTime: 0,\n elapsedTime: 0,\n frameCount: 0\n };\n\n // Debug metrics\n #metrics = {\n fps: 0,\n frameTime: 0,\n layerTimes: new Map(),\n brushTimes: new Map(),\n skippedFrames: 0\n };\n\n // Hit detection state\n #hitRegistry = new HitRegistry();\n #pointerState = { x: 0, y: 0, state: 'up' };\n #hoveredArea = null;\n #activeArea = null;\n #subscribers = new Set();\n\n static manifest = {\n name: 'Painter',\n namespace: 'painter',\n version: '1.0.0',\n defaults: {\n // Timing configuration\n targetFPS: 60,\n fixedTimeStep: 1000 / 60,\n timeScale: 1.0,\n // Debug configuration\n debug: {\n enabled: false,\n showFPS: true,\n showBounds: true,\n showLayerTiming: true\n }\n }\n };\n\n actions(context) {\n // Initialize runtime config from frozen config\n if (this.config) {\n Object.assign(this.#runtimeConfig, this.config);\n }\n \n return {\n addLayer: (layerDef) => this.addLayer(layerDef),\n addLayers: (...layers) => {\n for (const layer of layers) {\n this.addLayer(layer);\n }\n },\n updateCanvas: (fn) => this.updateCanvas(fn),\n setCanvas: (canvas) => this.setCanvas(canvas),\n setAssets: (assets) => this.setAssets(assets),\n removeLayer: (name) => this.removeLayer(name),\n start: () => this.start(),\n stop: () => this.stop(),\n render: () => this.render(),\n setTargetFPS: (fps) => this.setTargetFPS(fps),\n setTimeScale: (scale) => this.setTimeScale(scale),\n setFixedTimeStep: (step) => this.setFixedTimeStep(step),\n setDebug: (options) => this.setDebug(options),\n getMetrics: () => this.getMetrics(),\n handleResize: (width, height) => this.handleResize(width, height),\n updatePointer: (x, y, state) => this.updatePointer(x, y, state),\n subscribe: (callback) => this.subscribe(callback)\n };\n }\n\n setCanvas(canvas) {\n this.#canvas = canvas;\n \n // Create contexts for each type\n Object.values(ContextTypes).forEach(type => {\n try {\n const ctx = canvas.getContext(type);\n if (ctx) this.#contexts.set(type, ctx);\n } catch (e) {\n console.warn(`Context type ${type} not supported`);\n }\n });\n }\n\n updateCanvas(fn) {\n const result = fn(this.#canvas);\n if (result) {\n this.#canvas = result;\n }\n }\n\n setAssets(assets) {\n this.#assets = assets;\n }\n\n start() {\n if (!this.#isRunning) {\n this.#isRunning = true;\n this.#scheduleRender();\n }\n }\n\n stop() {\n if (this.#isRunning) {\n this.#isRunning = false;\n if (this.#frameId) {\n cancelAnimationFrame(this.#frameId);\n this.#frameId = null;\n }\n }\n }\n\n addLayer(layerDef) {\n if (definitionType(layerDef) !== 'LAYER') {\n throw new Error('Invalid layer definition');\n }\n\n const name = layerDef._name;\n const config = layerDef(this.useContext, this.#hitRegistry);\n \n // Set up layer reactor if it has data paths\n if (config.data) {\n const dataReactor = this.#createDataReactor(`layer_${name}`, config.data);\n if (dataReactor) {\n this.#reactors.set(`layer_${name}`, dataReactor);\n }\n }\n\n // Set up brush reactors and structure\n const brushes = config.children.map(child => {\n if (definitionType(child) === 'BRUSH') {\n const name = child._name;\n const brushConfig = child(this.useContext, this.#hitRegistry);\n \n // Only create data reactor if data exists\n const dataReactor = brushConfig.data \n ? this.#createDataReactor(`brush_${name}`, brushConfig.data)\n : () => undefined;\n \n const whenReactor = brushConfig.when \n ? createReactor(brushConfig.when, {\n immediate: true,\n context: this.useContext('state')\n })\n : null;\n\n const brush = {\n name,\n ...brushConfig,\n dataReactor,\n whenReactor\n };\n\n // Call brush mount hook\n if (brush.lifecycle?.onMount) {\n try {\n brush.lifecycle.onMount(this.#contexts.get(brush.context || config.context));\n } catch (error) {\n console.error(`Error in brush \"${brush.name}\" onMount:`, error);\n }\n }\n\n return brush;\n }\n // Handle nested layers recursively\n return this.addLayer(child);\n });\n\n const layer = {\n ...config,\n name,\n brushes,\n context: this.#contexts.get(config.context)\n };\n\n this.#layers.set(name, layer);\n\n // Call layer mount hook\n if (layer.lifecycle?.onMount) {\n try {\n layer.lifecycle.onMount(layer.context);\n } catch (error) {\n console.error(`Error in layer \"${name}\" onMount:`, error);\n }\n }\n\n return layer;\n }\n\n removeLayer(name) {\n const layer = this.#layers.get(name);\n if (!layer) return;\n\n // Call layer unmount hook\n if (layer.lifecycle?.onUnmount) {\n try {\n layer.lifecycle.onUnmount(layer.context);\n } catch (error) {\n console.error(`Error in layer \"${name}\" onUnmount:`, error);\n }\n }\n\n // Call brush unmount hooks and clean up reactors\n layer.brushes.forEach(brush => {\n if (brush.lifecycle?.onUnmount) {\n try {\n brush.lifecycle.onUnmount(\n this.#contexts.get(brush.context || layer.context)\n );\n } catch (error) {\n console.error(`Error in brush \"${brush.name}\" onUnmount:`, error);\n }\n }\n // Clean up brush reactor and subscription\n const reactorData = this.#reactors.get(`painter_brush_${brush.name}`);\n if (reactorData) {\n reactorData.unsubscribe();\n reactorData.reactor.destroy();\n this.#reactors.delete(`painter_brush_${brush.name}`);\n }\n });\n\n // Clean up layer reactor and subscription\n const layerReactorData = this.#reactors.get(`painter_layer_${name}`);\n if (layerReactorData) {\n layerReactorData.unsubscribe();\n layerReactorData.reactor.destroy();\n this.#reactors.delete(`painter_layer_${name}`);\n }\n\n this.#layers.delete(name);\n }\n\n #scheduleRender() {\n if (this.#renderScheduled || this.#isRendering) return;\n \n this.#renderScheduled = true;\n \n this.#frameId = requestAnimationFrame(() => {\n this.#renderScheduled = false;\n this.#frameId = null;\n this.#render();\n });\n }\n\n async #render() {\n if (!this.#canvas) return;\n this.#isRendering = true;\n \n try {\n // Clear hit registry at start of render\n this.#hitRegistry.clear();\n \n const renderStart = this.#runtimeConfig.debug?.enabled ? performance.now() : 0;\n\n // Clear all contexts\n this.#contexts.forEach(ctx => {\n ctx.clearRect(0, 0, this.#canvas.width, this.#canvas.height);\n });\n\n // Render layers in order\n for (const layer of this.#layers.values()) {\n const layerStart = this.#runtimeConfig.debug?.enabled ? performance.now() : 0;\n\n // Check layer condition\n if (layer.whenReactor) {\n const layerReactor = this.#reactors.get(`painter_layer_${layer.name}`)?.reactor;\n if (!layer.when(layerReactor())) continue;\n }\n\n const ctx = layer.context;\n\n if (!ctx) continue;\n\n // Layer beforeRender hook\n if (layer.lifecycle?.beforeRender) {\n try {\n layer.lifecycle.beforeRender(ctx, this.#timing);\n } catch (error) {\n console.error(`Error in layer \"${layer.name}\" beforeRender:`, error);\n if (layer.lifecycle?.onError) layer.lifecycle.onError(error);\n }\n }\n\n // Apply layer settings\n ctx.save();\n if (layer.settings) {\n Object.entries(layer.settings).forEach(([key, value]) => {\n if (typeof ctx[key] === 'function') {\n ctx[key](...(Array.isArray(value) ? value : [value]));\n } else {\n ctx[key] = value;\n }\n });\n }\n\n // Render brushes\n for (const brush of layer.brushes) {\n const brushStart = this.#runtimeConfig.debug?.enabled ? performance.now() : 0;\n\n if (brush.whenReactor && !brush.whenReactor()) continue;\n\n\n const brushCtx = brush.context ? \n this.#contexts.get(brush.context) : \n ctx;\n\n if (!brushCtx) continue;\n\n // Brush beforeRender hook\n if (brush.lifecycle?.beforeRender) {\n try {\n brush.lifecycle.beforeRender(brushCtx, this.#timing);\n } catch (error) {\n console.error(`Error in brush \"${brush.name}\" beforeRender:`, error);\n if (brush.lifecycle?.onError) brush.lifecycle.onError(error);\n continue;\n }\n }\n\n brushCtx.save();\n \n if (brush.settings) {\n Object.entries(brush.settings).forEach(([key, value]) => {\n if (typeof brushCtx[key] === 'function') {\n brushCtx[key](...(Array.isArray(value) ? value : [value]));\n } else {\n brushCtx[key] = value;\n }\n });\n }\n \n try {\n const requiredAssets = {};\n if (brush.assets) {\n for (const key of brush.assets) {\n requiredAssets[key] = this.#assets.get(key);\n }\n }\n brush.render(brushCtx, brush.dataReactor(), requiredAssets, this.#timing);\n\n // Brush afterRender hook\n if (brush.lifecycle?.afterRender) {\n brush.lifecycle.afterRender(brushCtx, this.#timing);\n }\n\n if (this.#runtimeConfig.debug?.enabled) {\n const brushTime = performance.now() - brushStart;\n this.#metrics.brushTimes.set(brush.name, brushTime);\n\n if (this.#runtimeConfig.debug?.showBounds) {\n this.#renderBrushBounds(brushCtx, brush);\n }\n }\n } catch (error) {\n console.error(`Error in brush \"${brush.name}\":`, error);\n if (brush.lifecycle?.onError) brush.lifecycle.onError(error);\n } finally {\n brushCtx.restore();\n }\n }\n\n ctx.restore();\n\n // Layer afterRender hook\n if (layer.lifecycle?.afterRender) {\n try {\n layer.lifecycle.afterRender(ctx, this.#timing);\n } catch (error) {\n console.error(`Error in layer \"${layer.name}\" afterRender:`, error);\n if (layer.lifecycle?.onError) layer.lifecycle.onError(error);\n }\n }\n\n if (this.#runtimeConfig.debug?.enabled) {\n const layerTime = performance.now() - layerStart;\n this.#metrics.layerTimes.set(layer.name, layerTime);\n\n if (this.#runtimeConfig.debug?.showBounds) {\n this.#renderLayerBounds(ctx, layer);\n }\n }\n }\n\n // Render debug overlay if enabled\n if (this.#runtimeConfig.debug?.enabled) {\n this.#renderDebugOverlay();\n }\n \n } finally {\n this.#isRendering = false;\n }\n }\n\n #renderBrushBounds(ctx, brush) {\n ctx.save();\n ctx.strokeStyle = 'rgba(0, 255, 0, 0.5)';\n ctx.lineWidth = 1;\n ctx.strokeRect(0, 0, ctx.canvas.width, ctx.canvas.height);\n ctx.restore();\n }\n\n #renderLayerBounds(ctx, layer) {\n ctx.save();\n ctx.strokeStyle = 'rgba(255, 0, 0, 0.5)';\n ctx.lineWidth = 2;\n ctx.strokeRect(0, 0, ctx.canvas.width, ctx.canvas.height);\n ctx.restore();\n }\n\n #renderDebugOverlay() {\n const ctx = this.#contexts.get(ContextTypes['2D']);\n if (!ctx) return;\n\n ctx.save();\n ctx.resetTransform();\n ctx.font = '12px monospace';\n ctx.fillStyle = 'white';\n ctx.strokeStyle = 'black';\n ctx.lineWidth = 3;\n\n let y = 20;\n const lineHeight = 15;\n\n if (this.#runtimeConfig.debug?.showFPS) {\n const text = `FPS: ${Math.round(this.#metrics.fps)} (${this.#timing.deltaTime.toFixed(2)}ms)`;\n ctx.strokeText(text, 10, y);\n ctx.fillText(text, 10, y);\n y += lineHeight;\n }\n\n if (this.#runtimeConfig.debug?.showLayerTiming) {\n ctx.fillText('Layer Times:', 10, y);\n y += lineHeight;\n\n for (const [name, time] of this.#metrics.layerTimes) {\n const text = ` ${name}: ${time.toFixed(2)}ms`;\n ctx.strokeText(text, 10, y);\n ctx.fillText(text, 10, y);\n y += lineHeight;\n }\n\n ctx.fillText(this.state.get(['_transitions', 'pointer', 'currentState']), 10, y);\n }\n\n ctx.restore();\n }\n\n handleResize(width, height) {\n // Call onResize hooks for all layers\n for (const layer of this.#layers.values()) {\n if (layer.lifecycle?.onResize) {\n try {\n layer.lifecycle.onResize(width, height, layer.context);\n } catch (error) {\n console.error(`Error in layer \"${layer.name}\" onResize:`, error);\n if (layer.lifecycle?.onError) layer.lifecycle.onError(error);\n }\n }\n }\n }\n\n #createDataReactor(id, data) {\n const state = this.useContext('state');\n\n const reactor = createReactor(data, {\n immediate: true,\n context: state\n });\n\n const unsubscribe = addEffect(reactor, () => this.#scheduleRender());\n\n this.#reactors.set(`painter_${id}`, {\n reactor,\n unsubscribe\n });\n\n return reactor;\n }\n\n destroy() {\n this.stop();\n // Clean up all layers and reactors\n for (const name of this.#layers.keys()) {\n this.removeLayer(name);\n }\n }\n\n setTargetFPS(fps) {\n this.#runtimeConfig.targetFPS = fps;\n this.#runtimeConfig.fixedTimeStep = 1000 / fps;\n }\n\n setTimeScale(scale) {\n this.#runtimeConfig.timeScale = Math.max(0, scale);\n }\n\n setFixedTimeStep(step) {\n this.#runtimeConfig.fixedTimeStep = step;\n }\n\n setDebug(options = {}) {\n if (!this.#runtimeConfig.debug) {\n this.#runtimeConfig.debug = {};\n }\n Object.assign(this.#runtimeConfig.debug, options);\n }\n\n getMetrics() {\n return {\n ...this.#metrics,\n deltaTime: this.#timing.deltaTime,\n elapsedTime: this.#timing.elapsedTime,\n frameCount: this.#timing.frameCount\n };\n }\n\n // Hit Registry Methods\n updatePointer(x, y, state) {\n const prevPointer = { ...this.#pointerState };\n this.#pointerState = { x, y, state };\n\n // Hit test current position\n const hitArea = this.#hitTest(x, y);\n\n // Handle state transitions\n if (state === 'down') {\n this.#activeArea = hitArea;\n if (hitArea?.onPointerDown) {\n hitArea.onPointerDown.handler?.(hitArea.data);\n this.#notifySubscribers('pointerdown', hitArea.onPointerDown.metadata);\n }\n }\n \n if (state === 'up') {\n if (this.#activeArea?.onPointerUp) {\n this.#activeArea.onPointerUp.handler?.(this.#activeArea.data);\n this.#notifySubscribers('pointerup', this.#activeArea.onPointerUp.metadata);\n }\n this.#activeArea = null;\n }\n \n if (state === 'move') {\n // Handle drag on active area\n if (this.#activeArea?.onPointerMove) {\n this.#activeArea.onPointerMove.handler?.(this.#activeArea.data, { x, y });\n this.#notifySubscribers('pointermove', this.#activeArea.onPointerMove.metadata);\n }\n \n // Handle hover enter/leave\n if (hitArea !== this.#hoveredArea) {\n if (this.#hoveredArea?.onPointerLeave) {\n this.#hoveredArea.onPointerLeave.handler?.(this.#hoveredArea.data);\n this.#notifySubscribers('pointerleave', this.#hoveredArea.onPointerLeave.metadata);\n }\n \n if (hitArea?.onPointerEnter) {\n hitArea.onPointerEnter.handler?.(hitArea.data);\n this.#notifySubscribers('pointerenter', hitArea.onPointerEnter.metadata);\n }\n \n this.#hoveredArea = hitArea;\n }\n }\n }\n\n subscribe(callback) {\n this.#subscribers.add(callback);\n return () => this.#subscribers.delete(callback);\n }\n\n #hitTest(x, y) {\n // Sort by priority (highest first) and test\n const sorted = this.#hitRegistry.areas.sort((a, b) => \n (b.priority || 0) - (a.priority || 0)\n );\n \n for (const area of sorted) {\n if (this.#isPointInBounds(x, y, area.bounds)) {\n return area;\n }\n }\n return null;\n }\n\n #isPointInBounds(x, y, bounds) {\n return x >= bounds.x && \n x <= bounds.x + bounds.width &&\n y >= bounds.y && \n y <= bounds.y + bounds.height;\n }\n\n #notifySubscribers(type, metadata) {\n if (!metadata) return;\n for (const callback of this.#subscribers) {\n callback({ type, metadata });\n }\n }\n}", "export const ContextTypes = {\n '2D': '2d',\n 'WEBGL': 'webgl',\n 'WEBGL2': 'webgl2',\n 'BITMAPRENDERER': 'bitmaprenderer'\n};", "export class HitRegistry {\n #areas = new Map();\n\n register(id, area) {\n if (!id) {\n throw new Error('Hit area must have an id');\n }\n this.#areas.set(id, { id, ...area });\n return () => this.unregister(id);\n }\n\n unregister(id) {\n this.#areas.delete(id);\n }\n\n get(id) {\n return this.#areas.get(id);\n }\n\n has(id) {\n return this.#areas.has(id);\n }\n\n get areas() {\n return Array.from(this.#areas.values());\n }\n\n clear() {\n this.#areas.clear();\n }\n}"],
|
|
5
|
+
"mappings": "4ZAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iBAAAE,EAAA,YAAAC,EAAA,gBAAAC,EAAA,gBAAAC,IAAA,eAAAC,EAAAN,GCAA,IAAAO,EAAgC,8BCAzB,IAAMC,EAAe,CAC1B,KAAM,KACN,MAAS,QACT,OAAU,SACV,eAAkB,gBACpB,EDHA,IAAAC,EAAoD,iCACpDC,EAAiD,8BEH1C,IAAMC,EAAN,KAAkB,CACvBC,GAAS,IAAI,IAEb,SAASC,EAAIC,EAAM,CACjB,GAAI,CAACD,EACH,MAAM,IAAI,MAAM,0BAA0B,EAE5C,YAAKD,GAAO,IAAIC,EAAI,CAAE,GAAAA,EAAI,GAAGC,CAAK,CAAC,EAC5B,IAAM,KAAK,WAAWD,CAAE,CACjC,CAEA,WAAWA,EAAI,CACb,KAAKD,GAAO,OAAOC,CAAE,CACvB,CAEA,IAAIA,EAAI,CACN,OAAO,KAAKD,GAAO,IAAIC,CAAE,CAC3B,CAEA,IAAIA,EAAI,CACN,OAAO,KAAKD,GAAO,IAAIC,CAAE,CAC3B,CAEA,IAAI,O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K/C,GAAa,MAC7D,KAAK8E,GAAmB,eAAgB,KAAK9E,GAAa,eAAe,QAAQ,GAG/E4E,GAAA,MAAAA,EAAS,kBACX1B,GAAAD,EAAA2B,EAAQ,gBAAe,UAAvB,MAAA1B,EAAA,KAAAD,EAAiC2B,EAAQ,MACzC,KAAKE,GAAmB,eAAgBF,EAAQ,eAAe,QAAQ,GAGzE,KAAK5E,GAAe4E,GAG1B,CAEA,UAAUxD,EAAU,CAClB,YAAKlB,GAAa,IAAIkB,CAAQ,EACvB,IAAM,KAAKlB,GAAa,OAAOkB,CAAQ,CAChD,CAEAyD,GAAS5D,EAAGC,EAAG,CAEb,IAAM6D,EAAS,KAAKlF,GAAa,MAAM,KAAK,CAACmF,EAAGC,KAC7CA,EAAE,UAAY,IAAMD,EAAE,UAAY,EACrC,EAEA,QAAWE,KAAQH,EACjB,GAAI,KAAKI,GAAiBlE,EAAGC,EAAGgE,EAAK,MAAM,EACzC,OAAOA,EAGX,OAAO,IACT,CAEAC,GAAiBlE,EAAGC,EAAGkE,EAAQ,CAC7B,OAAOnE,GAAKmE,EAAO,GACZnE,GAAKmE,EAAO,EAAIA,EAAO,OACvBlE,GAAKkE,EAAO,GACZlE,GAAKkE,EAAO,EAAIA,EAAO,MAChC,CAEAN,GAAmBxD,EAAM+D,EAAU,CACjC,GAAKA,EACL,QAAWjE,KAAY,KAAKlB,GAC1BkB,EAAS,CAAE,KAAAE,EAAM,SAAA+D,CAAS,CAAC,CAE/B,CACF",
|
|
6
|
+
"names": ["main_exports", "__export", "HitRegistry", "Painter", "defineBrush", "defineLayer", "__toCommonJS", "import_core", "ContextTypes", "import_reactive", "import_core", "HitRegistry", "#areas", "id", "area", "defineBrush", "defineLayer", "Painter", "#layers", "#canvas", "#contexts", "#reactors", "#assets", "#isRunning", "#frameId", "#renderNeeded", "#isRendering", "#renderScheduled", "#runtimeConfig", "#timing", "#metrics", "#hitRegistry", "HitRegistry", "#pointerState", "#hoveredArea", "#activeArea", "#subscribers", "context", "layerDef", "layers", "layer", "fn", "canvas", "assets", "name", "fps", "scale", "step", "options", "width", "height", "x", "y", "state", "callback", "ContextTypes", "type", "ctx", "result", "#scheduleRender", "_a", "config", "dataReactor", "#createDataReactor", "brushes", "child", "brushConfig", "whenReactor", "brush", "error", "reactorData", "layerReactorData", "#render", "_b", "_c", "_d", "_e", "_f", "_g", "_h", "_i", "_j", "_k", "_l", "_m", "_n", "_o", "_p", "_q", "renderStart", "layerStart", "layerReactor", "key", "value", "brushStart", "brushCtx", "requiredAssets", "brushTime", "#renderBrushBounds", "layerTime", "#renderLayerBounds", "#renderDebugOverlay", "lineHeight", "text", "time", "id", "data", "reactor", "unsubscribe", "prevPointer", "hitArea", "#hitTest", "#notifySubscribers", "sorted", "a", "b", "area", "#isPointInBounds", "bounds", "metadata"]
|
|
7
7
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{ServiceProvider as
|
|
1
|
+
import{ServiceProvider as B}from"@jucie-engine/core";var P={"2D":"2d",WEBGL:"webgl",WEBGL2:"webgl2",BITMAPRENDERER:"bitmaprenderer"};import{createReactor as $,addEffect as A}from"@jucie-state/reactive";import{createDefinition as C,definitionType as M}from"@jucie-engine/core";var E=class{#t=new Map;register(e,t){if(!e)throw new Error("Hit area must have an id");return this.#t.set(e,{id:e,...t}),()=>this.unregister(e)}unregister(e){this.#t.delete(e)}get(e){return this.#t.get(e)}has(e){return this.#t.has(e)}get areas(){return Array.from(this.#t.values())}clear(){this.#t.clear()}};var D=C("BRUSH",[Object]),U=C("LAYER",[Object]),L=class extends B{#t=new Map;#o=null;#s=new Map;#n=new Map;#p=new Map;#f=!1;#c=null;#P=!1;#u=!1;#m=!1;#e={targetFPS:60,fixedTimeStep:1e3/60,timeScale:1,debug:{enabled:!1,showFPS:!0,showBounds:!0,showLayerTiming:!0}};#i={lastFrameTime:0,deltaTime:0,elapsedTime:0,frameCount:0};#h={fps:0,frameTime:0,layerTimes:new Map,brushTimes:new Map,skippedFrames:0};#d=new E;#g={x:0,y:0,state:"up"};#a=null;#r=null;#y=new Set;static manifest={name:"Painter",namespace:"painter",version:"1.0.0",defaults:{targetFPS:60,fixedTimeStep:1e3/60,timeScale:1,debug:{enabled:!1,showFPS:!0,showBounds:!0,showLayerTiming:!0}}};actions(e){return this.config&&Object.assign(this.#e,this.config),{addLayer:t=>this.addLayer(t),addLayers:(...t)=>{for(let r of t)this.addLayer(r)},updateCanvas:t=>this.updateCanvas(t),setCanvas:t=>this.setCanvas(t),setAssets:t=>this.setAssets(t),removeLayer:t=>this.removeLayer(t),start:()=>this.start(),stop:()=>this.stop(),render:()=>this.render(),setTargetFPS:t=>this.setTargetFPS(t),setTimeScale:t=>this.setTimeScale(t),setFixedTimeStep:t=>this.setFixedTimeStep(t),setDebug:t=>this.setDebug(t),getMetrics:()=>this.getMetrics(),handleResize:(t,r)=>this.handleResize(t,r),updatePointer:(t,r,n)=>this.updatePointer(t,r,n),subscribe:t=>this.subscribe(t)}}setCanvas(e){this.#o=e,Object.values(P).forEach(t=>{try{let r=e.getContext(t);r&&this.#s.set(t,r)}catch{console.warn(`Context type ${t} not supported`)}})}updateCanvas(e){let t=e(this.#o);t&&(this.#o=t)}setAssets(e){this.#p=e}start(){this.#f||(this.#f=!0,this.#b())}stop(){this.#f&&(this.#f=!1,this.#c&&(cancelAnimationFrame(this.#c),this.#c=null))}addLayer(e){var a;if(M(e)!=="LAYER")throw new Error("Invalid layer definition");let t=e._name,r=e(this.useContext,this.#d);if(r.data){let c=this.#w(`layer_${t}`,r.data);c&&this.#n.set(`layer_${t}`,c)}let n=r.children.map(c=>{var h;if(M(c)==="BRUSH"){let p=c._name,f=c(this.useContext,this.#d),g=f.data?this.#w(`brush_${p}`,f.data):()=>{},b=f.when?$(f.when,{immediate:!0,context:this.useContext("state")}):null,d={name:p,...f,dataReactor:g,whenReactor:b};if((h=d.lifecycle)!=null&&h.onMount)try{d.lifecycle.onMount(this.#s.get(d.context||r.context))}catch(w){console.error(`Error in brush "${d.name}" onMount:`,w)}return d}return this.addLayer(c)}),i={...r,name:t,brushes:n,context:this.#s.get(r.context)};if(this.#t.set(t,i),(a=i.lifecycle)!=null&&a.onMount)try{i.lifecycle.onMount(i.context)}catch(c){console.error(`Error in layer "${t}" onMount:`,c)}return i}removeLayer(e){var n;let t=this.#t.get(e);if(!t)return;if((n=t.lifecycle)!=null&&n.onUnmount)try{t.lifecycle.onUnmount(t.context)}catch(i){console.error(`Error in layer "${e}" onUnmount:`,i)}t.brushes.forEach(i=>{var c;if((c=i.lifecycle)!=null&&c.onUnmount)try{i.lifecycle.onUnmount(this.#s.get(i.context||t.context))}catch(h){console.error(`Error in brush "${i.name}" onUnmount:`,h)}let a=this.#n.get(`painter_brush_${i.name}`);a&&(a.unsubscribe(),a.reactor.destroy(),this.#n.delete(`painter_brush_${i.name}`))});let r=this.#n.get(`painter_layer_${e}`);r&&(r.unsubscribe(),r.reactor.destroy(),this.#n.delete(`painter_layer_${e}`)),this.#t.delete(e)}#b(){this.#m||this.#u||(this.#m=!0,this.#c=requestAnimationFrame(()=>{this.#m=!1,this.#c=null,this.#T()}))}async#T(){var e,t,r,n,i,a,c,h,p,f,g,b,d,w,R,x,S;if(this.#o){this.#u=!0;try{this.#d.clear();let v=(e=this.#e.debug)!=null&&e.enabled?performance.now():0;this.#s.forEach(o=>{o.clearRect(0,0,this.#o.width,this.#o.height)});for(let o of this.#t.values()){let _=(t=this.#e.debug)!=null&&t.enabled?performance.now():0;if(o.whenReactor){let s=(r=this.#n.get(`painter_layer_${o.name}`))==null?void 0:r.reactor;if(!o.when(s()))continue}let u=o.context;if(u){if((n=o.lifecycle)!=null&&n.beforeRender)try{o.lifecycle.beforeRender(u,this.#i)}catch(s){console.error(`Error in layer "${o.name}" beforeRender:`,s),(i=o.lifecycle)!=null&&i.onError&&o.lifecycle.onError(s)}u.save(),o.settings&&Object.entries(o.settings).forEach(([s,T])=>{typeof u[s]=="function"?u[s](...Array.isArray(T)?T:[T]):u[s]=T});for(let s of o.brushes){let T=(a=this.#e.debug)!=null&&a.enabled?performance.now():0;if(s.whenReactor&&!s.whenReactor())continue;let m=s.context?this.#s.get(s.context):u;if(m){if((c=s.lifecycle)!=null&&c.beforeRender)try{s.lifecycle.beforeRender(m,this.#i)}catch(l){console.error(`Error in brush "${s.name}" beforeRender:`,l),(h=s.lifecycle)!=null&&h.onError&&s.lifecycle.onError(l);continue}m.save(),s.settings&&Object.entries(s.settings).forEach(([l,y])=>{typeof m[l]=="function"?m[l](...Array.isArray(y)?y:[y]):m[l]=y});try{let l={};if(s.assets)for(let y of s.assets)l[y]=this.#p.get(y);if(s.render(m,s.dataReactor(),l,this.#i),(p=s.lifecycle)!=null&&p.afterRender&&s.lifecycle.afterRender(m,this.#i),(f=this.#e.debug)!=null&&f.enabled){let y=performance.now()-T;this.#h.brushTimes.set(s.name,y),(g=this.#e.debug)!=null&&g.showBounds&&this.#R(m,s)}}catch(l){console.error(`Error in brush "${s.name}":`,l),(b=s.lifecycle)!=null&&b.onError&&s.lifecycle.onError(l)}finally{m.restore()}}}if(u.restore(),(d=o.lifecycle)!=null&&d.afterRender)try{o.lifecycle.afterRender(u,this.#i)}catch(s){console.error(`Error in layer "${o.name}" afterRender:`,s),(w=o.lifecycle)!=null&&w.onError&&o.lifecycle.onError(s)}if((R=this.#e.debug)!=null&&R.enabled){let s=performance.now()-_;this.#h.layerTimes.set(o.name,s),(x=this.#e.debug)!=null&&x.showBounds&&this.#x(u,o)}}}(S=this.#e.debug)!=null&&S.enabled&&this.#S()}finally{this.#u=!1}}}#R(e,t){e.save(),e.strokeStyle="rgba(0, 255, 0, 0.5)",e.lineWidth=1,e.strokeRect(0,0,e.canvas.width,e.canvas.height),e.restore()}#x(e,t){e.save(),e.strokeStyle="rgba(255, 0, 0, 0.5)",e.lineWidth=2,e.strokeRect(0,0,e.canvas.width,e.canvas.height),e.restore()}#S(){var n,i;let e=this.#s.get(P["2D"]);if(!e)return;e.save(),e.resetTransform(),e.font="12px monospace",e.fillStyle="white",e.strokeStyle="black",e.lineWidth=3;let t=20,r=15;if((n=this.#e.debug)!=null&&n.showFPS){let a=`FPS: ${Math.round(this.#h.fps)} (${this.#i.deltaTime.toFixed(2)}ms)`;e.strokeText(a,10,t),e.fillText(a,10,t),t+=r}if((i=this.#e.debug)!=null&&i.showLayerTiming){e.fillText("Layer Times:",10,t),t+=r;for(let[a,c]of this.#h.layerTimes){let h=` ${a}: ${c.toFixed(2)}ms`;e.strokeText(h,10,t),e.fillText(h,10,t),t+=r}e.fillText(this.state.get(["_transitions","pointer","currentState"]),10,t)}e.restore()}handleResize(e,t){var r,n;for(let i of this.#t.values())if((r=i.lifecycle)!=null&&r.onResize)try{i.lifecycle.onResize(e,t,i.context)}catch(a){console.error(`Error in layer "${i.name}" onResize:`,a),(n=i.lifecycle)!=null&&n.onError&&i.lifecycle.onError(a)}}#w(e,t){let r=this.useContext("state"),n=$(t,{immediate:!0,context:r}),i=A(n,()=>this.#b());return this.#n.set(`painter_${e}`,{reactor:n,unsubscribe:i}),n}destroy(){this.stop();for(let e of this.#t.keys())this.removeLayer(e)}setTargetFPS(e){this.#e.targetFPS=e,this.#e.fixedTimeStep=1e3/e}setTimeScale(e){this.#e.timeScale=Math.max(0,e)}setFixedTimeStep(e){this.#e.fixedTimeStep=e}setDebug(e={}){this.#e.debug||(this.#e.debug={}),Object.assign(this.#e.debug,e)}getMetrics(){return{...this.#h,deltaTime:this.#i.deltaTime,elapsedTime:this.#i.elapsedTime,frameCount:this.#i.frameCount}}updatePointer(e,t,r){var a,c,h,p,f,g,b,d,w,R,x,S,v;let n={...this.#g};this.#g={x:e,y:t,state:r};let i=this.#E(e,t);r==="down"&&(this.#r=i,i!=null&&i.onPointerDown&&((c=(a=i.onPointerDown).handler)==null||c.call(a,i.data),this.#l("pointerdown",i.onPointerDown.metadata))),r==="up"&&((h=this.#r)!=null&&h.onPointerUp&&((f=(p=this.#r.onPointerUp).handler)==null||f.call(p,this.#r.data),this.#l("pointerup",this.#r.onPointerUp.metadata)),this.#r=null),r==="move"&&((g=this.#r)!=null&&g.onPointerMove&&((d=(b=this.#r.onPointerMove).handler)==null||d.call(b,this.#r.data,{x:e,y:t}),this.#l("pointermove",this.#r.onPointerMove.metadata)),i!==this.#a&&((w=this.#a)!=null&&w.onPointerLeave&&((x=(R=this.#a.onPointerLeave).handler)==null||x.call(R,this.#a.data),this.#l("pointerleave",this.#a.onPointerLeave.metadata)),i!=null&&i.onPointerEnter&&((v=(S=i.onPointerEnter).handler)==null||v.call(S,i.data),this.#l("pointerenter",i.onPointerEnter.metadata)),this.#a=i))}subscribe(e){return this.#y.add(e),()=>this.#y.delete(e)}#E(e,t){let r=this.#d.areas.sort((n,i)=>(i.priority||0)-(n.priority||0));for(let n of r)if(this.#v(e,t,n.bounds))return n;return null}#v(e,t,r){return e>=r.x&&e<=r.x+r.width&&t>=r.y&&t<=r.y+r.height}#l(e,t){if(t)for(let r of this.#y)r({type:e,metadata:t})}};export{E as HitRegistry,L as Painter,D as defineBrush,U as defineLayer};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../src/Painter.js", "../src/ContextTypes.js"],
|
|
4
|
-
"sourcesContent": ["import { ServiceProvider } from '@jucie-engine/core';\nimport { ContextTypes } from './ContextTypes.js';\nimport { createReactor, isReactor, addEffect } from '@jucie-state/reactive';\nimport { createDefinition, definitionType } from '@jucie-engine/core';\n\nexport const defineBrush = createDefinition('BRUSH', [Object]);\nexport const defineLayer = createDefinition('LAYER', [Object]);\n\nexport class Painter extends ServiceProvider {\n #layers = new Map();\n #canvas = null;\n #contexts = new Map();\n #reactors = new Map();\n #assets = new Map();\n #isRunning = false;\n #frameId = null;\n #renderNeeded = false;\n #isRendering = false;\n #renderScheduled = false;\n\n // Timing state\n #timing = {\n lastFrameTime: 0,\n deltaTime: 0,\n elapsedTime: 0,\n frameCount: 0\n };\n\n // Debug metrics\n #metrics = {\n fps: 0,\n frameTime: 0,\n layerTimes: new Map(),\n brushTimes: new Map(),\n skippedFrames: 0\n };\n\n static manifest = {\n name: 'Painter',\n namespace: 'painter',\n version: '1.0.0',\n defaults: {\n // Timing configuration\n targetFPS: 60,\n fixedTimeStep: 1000 / 60,\n timeScale: 1.0,\n // Debug configuration\n debug: {\n enabled: false,\n showFPS: true,\n showBounds: true,\n showLayerTiming: true\n }\n }\n };\n\n actions(context) {\n return {\n addLayer: (layerDef) => this.addLayer(layerDef),\n addLayers: (...layers) => {\n for (const layer of layers) {\n this.addLayer(layer);\n }\n },\n updateCanvas: (fn) => this.updateCanvas(fn),\n setCanvas: (canvas) => this.setCanvas(canvas),\n setAssets: (assets) => this.setAssets(assets),\n removeLayer: (name) => this.removeLayer(name),\n start: () => this.start(),\n stop: () => this.stop(),\n render: () => this.render(),\n setTargetFPS: (fps) => this.setTargetFPS(fps),\n setTimeScale: (scale) => this.setTimeScale(scale),\n setFixedTimeStep: (step) => this.setFixedTimeStep(step),\n setDebug: (options) => this.setDebug(options),\n getMetrics: () => this.getMetrics()\n };\n }\n\n setCanvas(canvas) {\n this.#canvas = canvas;\n \n // Create contexts for each type\n Object.values(ContextTypes).forEach(type => {\n try {\n const ctx = canvas.getContext(type);\n if (ctx) this.#contexts.set(type, ctx);\n } catch (e) {\n console.warn(`Context type ${type} not supported`);\n }\n });\n }\n\n updateCanvas(fn) {\n const result = fn(this.#canvas);\n if (result) {\n this.#canvas = result;\n }\n }\n\n setAssets(assets) {\n this.#assets = assets;\n }\n\n start() {\n if (!this.#isRunning) {\n this.#isRunning = true;\n this.#scheduleRender();\n }\n }\n\n stop() {\n if (this.#isRunning) {\n this.#isRunning = false;\n if (this.#frameId) {\n cancelAnimationFrame(this.#frameId);\n this.#frameId = null;\n }\n }\n }\n\n addLayer(layerDef) {\n if (definitionType(layerDef) !== 'LAYER') {\n throw new Error('Invalid layer definition');\n }\n\n const name = layerDef._name;\n const config = layerDef(this.useContext);\n \n // Set up layer reactor if it has data paths\n if (config.data) {\n const dataReactor = this.#createDataReactor(`layer_${name}`, config.data);\n if (dataReactor) {\n this.#reactors.set(`layer_${name}`, dataReactor);\n }\n }\n\n // Set up brush reactors and structure\n const brushes = config.children.map(child => {\n if (definitionType(child) === 'BRUSH') {\n const name = child._name;\n const brushConfig = child();\n const dataReactor = this.#createDataReactor(`brush_${name}`, brushConfig.data, );\n const whenReactor = createReactor(brushConfig.when, {\n immediate: true,\n context: this.useContext('state')\n })\n\n const brush = {\n name,\n ...brushConfig,\n dataReactor,\n whenReactor\n };\n\n // Call brush mount hook\n if (brush.lifecycle?.onMount) {\n try {\n brush.lifecycle.onMount(this.#contexts.get(brush.context || config.context));\n } catch (error) {\n console.error(`Error in brush \"${brush.name}\" onMount:`, error);\n }\n }\n\n return brush;\n }\n // Handle nested layers recursively\n return this.addLayer(child);\n });\n\n const layer = {\n ...config,\n name,\n brushes,\n context: this.#contexts.get(config.context)\n };\n\n this.#layers.set(name, layer);\n\n // Call layer mount hook\n if (layer.lifecycle?.onMount) {\n try {\n layer.lifecycle.onMount(layer.context);\n } catch (error) {\n console.error(`Error in layer \"${name}\" onMount:`, error);\n }\n }\n\n return layer;\n }\n\n removeLayer(name) {\n const layer = this.#layers.get(name);\n if (!layer) return;\n\n // Call layer unmount hook\n if (layer.lifecycle?.onUnmount) {\n try {\n layer.lifecycle.onUnmount(layer.context);\n } catch (error) {\n console.error(`Error in layer \"${name}\" onUnmount:`, error);\n }\n }\n\n // Call brush unmount hooks and clean up reactors\n layer.brushes.forEach(brush => {\n if (brush.lifecycle?.onUnmount) {\n try {\n brush.lifecycle.onUnmount(\n this.#contexts.get(brush.context || layer.context)\n );\n } catch (error) {\n console.error(`Error in brush \"${brush.name}\" onUnmount:`, error);\n }\n }\n // Clean up brush reactor and subscription\n const reactorData = this.#reactors.get(`painter_brush_${brush.name}`);\n if (reactorData) {\n reactorData.unsubscribe();\n reactorData.reactor.destroy();\n this.#reactors.delete(`painter_brush_${brush.name}`);\n }\n });\n\n // Clean up layer reactor and subscription\n const layerReactorData = this.#reactors.get(`painter_layer_${name}`);\n if (layerReactorData) {\n layerReactorData.unsubscribe();\n layerReactorData.reactor.destroy();\n this.#reactors.delete(`painter_layer_${name}`);\n }\n\n this.#layers.delete(name);\n }\n\n #scheduleRender() {\n if (this.#renderScheduled || this.#isRendering) return;\n \n this.#renderScheduled = true;\n \n this.#frameId = requestAnimationFrame(() => {\n this.#renderScheduled = false;\n this.#frameId = null;\n this.#render();\n });\n }\n\n async #render() {\n if (!this.#canvas) return;\n this.#isRendering = true;\n \n try { \n const renderStart = this.config.debug?.enabled ? performance.now() : 0;\n\n // Clear all contexts\n this.#contexts.forEach(ctx => {\n ctx.clearRect(0, 0, this.#canvas.width, this.#canvas.height);\n });\n\n // Render layers in order\n for (const layer of this.#layers.values()) {\n const layerStart = this.config.debug?.enabled ? performance.now() : 0;\n\n // Check layer condition\n if (layer.whenReactor) {\n const layerReactor = this.#reactors.get(`painter_layer_${layer.name}`)?.reactor;\n if (!layer.when(layerReactor())) continue;\n }\n\n const ctx = layer.context;\n\n if (!ctx) continue;\n\n // Layer beforeRender hook\n if (layer.lifecycle?.beforeRender) {\n try {\n layer.lifecycle.beforeRender(ctx, this.#timing);\n } catch (error) {\n console.error(`Error in layer \"${layer.name}\" beforeRender:`, error);\n if (layer.lifecycle?.onError) layer.lifecycle.onError(error);\n }\n }\n\n // Apply layer settings\n ctx.save();\n if (layer.settings) {\n Object.entries(layer.settings).forEach(([key, value]) => {\n if (typeof ctx[key] === 'function') {\n ctx[key](...(Array.isArray(value) ? value : [value]));\n } else {\n ctx[key] = value;\n }\n });\n }\n\n // Render brushes\n for (const brush of layer.brushes) {\n const brushStart = this.config.debug?.enabled ? performance.now() : 0;\n\n if (brush.whenReactor && !brush.whenReactor()) continue;\n\n\n const brushCtx = brush.context ? \n this.#contexts.get(brush.context) : \n ctx;\n\n if (!brushCtx) continue;\n\n // Brush beforeRender hook\n if (brush.lifecycle?.beforeRender) {\n try {\n brush.lifecycle.beforeRender(brushCtx, this.#timing);\n } catch (error) {\n console.error(`Error in brush \"${brush.name}\" beforeRender:`, error);\n if (brush.lifecycle?.onError) brush.lifecycle.onError(error);\n continue;\n }\n }\n\n brushCtx.save();\n \n if (brush.settings) {\n Object.entries(brush.settings).forEach(([key, value]) => {\n if (typeof brushCtx[key] === 'function') {\n brushCtx[key](...(Array.isArray(value) ? value : [value]));\n } else {\n brushCtx[key] = value;\n }\n });\n }\n \n try {\n const requiredAssets = {};\n if (brush.assets) {\n for (const key of brush.assets) {\n requiredAssets[key] = this.#assets.get(key);\n }\n }\n brush.render(brushCtx, brush.dataReactor(), requiredAssets, this.#timing);\n\n // Brush afterRender hook\n if (brush.lifecycle?.afterRender) {\n brush.lifecycle.afterRender(brushCtx, this.#timing);\n }\n\n if (this.config.debug?.enabled) {\n const brushTime = performance.now() - brushStart;\n this.#metrics.brushTimes.set(brush.name, brushTime);\n\n if (this.config.debug?.showBounds) {\n this.#renderBrushBounds(brushCtx, brush);\n }\n }\n } catch (error) {\n console.error(`Error in brush \"${brush.name}\":`, error);\n if (brush.lifecycle?.onError) brush.lifecycle.onError(error);\n } finally {\n brushCtx.restore();\n }\n }\n\n ctx.restore();\n\n // Layer afterRender hook\n if (layer.lifecycle?.afterRender) {\n try {\n layer.lifecycle.afterRender(ctx, this.#timing);\n } catch (error) {\n console.error(`Error in layer \"${layer.name}\" afterRender:`, error);\n if (layer.lifecycle?.onError) layer.lifecycle.onError(error);\n }\n }\n\n if (this.config.debug?.enabled) {\n const layerTime = performance.now() - layerStart;\n this.#metrics.layerTimes.set(layer.name, layerTime);\n\n if (this.config.debug?.showBounds) {\n this.#renderLayerBounds(ctx, layer);\n }\n }\n }\n\n // Render debug overlay if enabled\n if (this.config.debug?.enabled) {\n this.#renderDebugOverlay();\n }\n \n } finally {\n this.#isRendering = false;\n }\n }\n\n #renderBrushBounds(ctx, brush) {\n ctx.save();\n ctx.strokeStyle = 'rgba(0, 255, 0, 0.5)';\n ctx.lineWidth = 1;\n ctx.strokeRect(0, 0, ctx.canvas.width, ctx.canvas.height);\n ctx.restore();\n }\n\n #renderLayerBounds(ctx, layer) {\n ctx.save();\n ctx.strokeStyle = 'rgba(255, 0, 0, 0.5)';\n ctx.lineWidth = 2;\n ctx.strokeRect(0, 0, ctx.canvas.width, ctx.canvas.height);\n ctx.restore();\n }\n\n #renderDebugOverlay() {\n const ctx = this.#contexts.get(ContextTypes['2D']);\n if (!ctx) return;\n\n ctx.save();\n ctx.resetTransform();\n ctx.font = '12px monospace';\n ctx.fillStyle = 'white';\n ctx.strokeStyle = 'black';\n ctx.lineWidth = 3;\n\n let y = 20;\n const lineHeight = 15;\n\n if (this.config.debug?.showFPS) {\n const text = `FPS: ${Math.round(this.#metrics.fps)} (${this.#timing.deltaTime.toFixed(2)}ms)`;\n ctx.strokeText(text, 10, y);\n ctx.fillText(text, 10, y);\n y += lineHeight;\n }\n\n if (this.config.debug?.showLayerTiming) {\n ctx.fillText('Layer Times:', 10, y);\n y += lineHeight;\n\n for (const [name, time] of this.#metrics.layerTimes) {\n const text = ` ${name}: ${time.toFixed(2)}ms`;\n ctx.strokeText(text, 10, y);\n ctx.fillText(text, 10, y);\n y += lineHeight;\n }\n\n ctx.fillText(this.state.get(['_transitions', 'pointer', 'currentState']), 10, y);\n }\n\n ctx.restore();\n }\n\n handleResize(width, height) {\n // Call onResize hooks for all layers\n for (const layer of this.#layers.values()) {\n if (layer.lifecycle?.onResize) {\n try {\n layer.lifecycle.onResize(width, height, layer.context);\n } catch (error) {\n console.error(`Error in layer \"${layer.name}\" onResize:`, error);\n if (layer.lifecycle?.onError) layer.lifecycle.onError(error);\n }\n }\n }\n }\n\n #createDataReactor(id, data) {\n const state = this.useContext('state');\n\n const reactor = createReactor(data, {\n immediate: true,\n context: state\n });\n\n const unsubscribe = addEffect(reactor, () => this.#scheduleRender());\n\n this.#reactors.set(`painter_${id}`, {\n reactor,\n unsubscribe\n });\n\n return reactor;\n }\n\n destroy() {\n this.stop();\n // Clean up all layers and reactors\n for (const name of this.#layers.keys()) {\n this.removeLayer(name);\n }\n }\n\n setTargetFPS(fps) {\n this.config.targetFPS = fps;\n this.config.fixedTimeStep = 1000 / fps;\n }\n\n setTimeScale(scale) {\n this.config.timeScale = Math.max(0, scale);\n }\n\n setFixedTimeStep(step) {\n this.config.fixedTimeStep = step;\n }\n\n setDebug(options = {}) {\n if (!this.config.debug) {\n this.config.debug = {};\n }\n Object.assign(this.config.debug, options);\n }\n\n getMetrics() {\n return {\n ...this.#metrics,\n deltaTime: this.#timing.deltaTime,\n elapsedTime: this.#timing.elapsedTime,\n frameCount: this.#timing.frameCount\n };\n }\n}", "export const ContextTypes = {\n '2D': '2d',\n 'WEBGL': 'webgl',\n 'WEBGL2': 'webgl2',\n 'BITMAPRENDERER': 'bitmaprenderer'\n};"],
|
|
5
|
-
"mappings": "AAAA,OAAS,mBAAAA,MAAuB,qBCAzB,IAAMC,EAAe,CAC1B,KAAM,KACN,MAAS,QACT,OAAU,SACV,eAAkB,gBACpB,EDHA,OAAS,iBAAAC,EAA0B,aAAAC,MAAiB,wBACpD,OAAS,oBAAAC,EAAkB,kBAAAC,MAAsB,qBAE1C,IAAMC,EAAcF,EAAiB,QAAS,CAAC,MAAM,CAAC,EAChDG,EAAcH,EAAiB,QAAS,CAAC,MAAM,CAAC,EAEhDI,EAAN,cAAsBC,CAAgB,CAC3CC,GAAU,IAAI,IACdC,GAAU,KACVC,GAAY,IAAI,IAChBC,GAAY,IAAI,IAChBC,GAAU,IAAI,IACdC,GAAa,GACbC,GAAW,KACXC,GAAgB,GAChBC,GAAe,GACfC,GAAmB,GAGnBC,GAAU,CACR,cAAe,EACf,UAAW,EACX,YAAa,EACb,WAAY,CACd,EAGAC,GAAW,CACT,IAAK,EACL,UAAW,EACX,WAAY,IAAI,IAChB,WAAY,IAAI,IAChB,cAAe,CACjB,EAEA,OAAO,SAAW,CA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,CACL,GAAG,KAAKZ,GACR,UAAW,KAAKD,GAAQ,UACxB,YAAa,KAAKA,GAAQ,YAC1B,WAAY,KAAKA,GAAQ,UAC3B,CACF,CACF",
|
|
6
|
-
"names": ["ServiceProvider", "ContextTypes", "createReactor", "addEffect", "createDefinition", "definitionType", "defineBrush", "defineLayer", "Painter", "ServiceProvider", "#layers", "#canvas", "#contexts", "#reactors", "#assets", "#isRunning", "#frameId", "#renderNeeded", "#isRendering", "#renderScheduled", "#timing", "#metrics", "context", "layerDef", "layers", "layer", "fn", "canvas", "assets", "name", "fps", "scale", "step", "options", "ContextTypes", "type", "ctx", "result", "#scheduleRender", "_a", "config", "dataReactor", "#createDataReactor", "brushes", "child", "brushConfig", "whenReactor", "brush", "error", "reactorData", "layerReactorData", "#render", "_b", "_c", "_d", "_e", "_f", "_g", "_h", "_i", "_j", "_k", "_l", "_m", "_n", "_o", "_p", "_q", "renderStart", "layerStart", "layerReactor", "key", "value", "brushStart", "brushCtx", "requiredAssets", "brushTime", "#renderBrushBounds", "layerTime", "#renderLayerBounds", "#renderDebugOverlay", "
|
|
3
|
+
"sources": ["../src/Painter.js", "../src/ContextTypes.js", "../src/HitRegistry.js"],
|
|
4
|
+
"sourcesContent": ["import { ServiceProvider } from '@jucie-engine/core';\nimport { ContextTypes } from './ContextTypes.js';\nimport { createReactor, isReactor, addEffect } from '@jucie-state/reactive';\nimport { createDefinition, definitionType } from '@jucie-engine/core';\nimport { HitRegistry } from './HitRegistry.js';\n\nexport const defineBrush = createDefinition('BRUSH', [Object]);\nexport const defineLayer = createDefinition('LAYER', [Object]);\n\nexport class Painter extends ServiceProvider {\n #layers = new Map();\n #canvas = null;\n #contexts = new Map();\n #reactors = new Map();\n #assets = new Map();\n #isRunning = false;\n #frameId = null;\n #renderNeeded = false;\n #isRendering = false;\n #renderScheduled = false;\n\n // Mutable runtime config (separate from frozen config)\n #runtimeConfig = {\n targetFPS: 60,\n fixedTimeStep: 1000 / 60,\n timeScale: 1.0,\n debug: {\n enabled: false,\n showFPS: true,\n showBounds: true,\n showLayerTiming: true\n }\n };\n\n // Timing state\n #timing = {\n lastFrameTime: 0,\n deltaTime: 0,\n elapsedTime: 0,\n frameCount: 0\n };\n\n // Debug metrics\n #metrics = {\n fps: 0,\n frameTime: 0,\n layerTimes: new Map(),\n brushTimes: new Map(),\n skippedFrames: 0\n };\n\n // Hit detection state\n #hitRegistry = new HitRegistry();\n #pointerState = { x: 0, y: 0, state: 'up' };\n #hoveredArea = null;\n #activeArea = null;\n #subscribers = new Set();\n\n static manifest = {\n name: 'Painter',\n namespace: 'painter',\n version: '1.0.0',\n defaults: {\n // Timing configuration\n targetFPS: 60,\n fixedTimeStep: 1000 / 60,\n timeScale: 1.0,\n // Debug configuration\n debug: {\n enabled: false,\n showFPS: true,\n showBounds: true,\n showLayerTiming: true\n }\n }\n };\n\n actions(context) {\n // Initialize runtime config from frozen config\n if (this.config) {\n Object.assign(this.#runtimeConfig, this.config);\n }\n \n return {\n addLayer: (layerDef) => this.addLayer(layerDef),\n addLayers: (...layers) => {\n for (const layer of layers) {\n this.addLayer(layer);\n }\n },\n updateCanvas: (fn) => this.updateCanvas(fn),\n setCanvas: (canvas) => this.setCanvas(canvas),\n setAssets: (assets) => this.setAssets(assets),\n removeLayer: (name) => this.removeLayer(name),\n start: () => this.start(),\n stop: () => this.stop(),\n render: () => this.render(),\n setTargetFPS: (fps) => this.setTargetFPS(fps),\n setTimeScale: (scale) => this.setTimeScale(scale),\n setFixedTimeStep: (step) => this.setFixedTimeStep(step),\n setDebug: (options) => this.setDebug(options),\n getMetrics: () => this.getMetrics(),\n handleResize: (width, height) => this.handleResize(width, height),\n updatePointer: (x, y, state) => this.updatePointer(x, y, state),\n subscribe: (callback) => this.subscribe(callback)\n };\n }\n\n setCanvas(canvas) {\n this.#canvas = canvas;\n \n // Create contexts for each type\n Object.values(ContextTypes).forEach(type => {\n try {\n const ctx = canvas.getContext(type);\n if (ctx) this.#contexts.set(type, ctx);\n } catch (e) {\n console.warn(`Context type ${type} not supported`);\n }\n });\n }\n\n updateCanvas(fn) {\n const result = fn(this.#canvas);\n if (result) {\n this.#canvas = result;\n }\n }\n\n setAssets(assets) {\n this.#assets = assets;\n }\n\n start() {\n if (!this.#isRunning) {\n this.#isRunning = true;\n this.#scheduleRender();\n }\n }\n\n stop() {\n if (this.#isRunning) {\n this.#isRunning = false;\n if (this.#frameId) {\n cancelAnimationFrame(this.#frameId);\n this.#frameId = null;\n }\n }\n }\n\n addLayer(layerDef) {\n if (definitionType(layerDef) !== 'LAYER') {\n throw new Error('Invalid layer definition');\n }\n\n const name = layerDef._name;\n const config = layerDef(this.useContext, this.#hitRegistry);\n \n // Set up layer reactor if it has data paths\n if (config.data) {\n const dataReactor = this.#createDataReactor(`layer_${name}`, config.data);\n if (dataReactor) {\n this.#reactors.set(`layer_${name}`, dataReactor);\n }\n }\n\n // Set up brush reactors and structure\n const brushes = config.children.map(child => {\n if (definitionType(child) === 'BRUSH') {\n const name = child._name;\n const brushConfig = child(this.useContext, this.#hitRegistry);\n \n // Only create data reactor if data exists\n const dataReactor = brushConfig.data \n ? this.#createDataReactor(`brush_${name}`, brushConfig.data)\n : () => undefined;\n \n const whenReactor = brushConfig.when \n ? createReactor(brushConfig.when, {\n immediate: true,\n context: this.useContext('state')\n })\n : null;\n\n const brush = {\n name,\n ...brushConfig,\n dataReactor,\n whenReactor\n };\n\n // Call brush mount hook\n if (brush.lifecycle?.onMount) {\n try {\n brush.lifecycle.onMount(this.#contexts.get(brush.context || config.context));\n } catch (error) {\n console.error(`Error in brush \"${brush.name}\" onMount:`, error);\n }\n }\n\n return brush;\n }\n // Handle nested layers recursively\n return this.addLayer(child);\n });\n\n const layer = {\n ...config,\n name,\n brushes,\n context: this.#contexts.get(config.context)\n };\n\n this.#layers.set(name, layer);\n\n // Call layer mount hook\n if (layer.lifecycle?.onMount) {\n try {\n layer.lifecycle.onMount(layer.context);\n } catch (error) {\n console.error(`Error in layer \"${name}\" onMount:`, error);\n }\n }\n\n return layer;\n }\n\n removeLayer(name) {\n const layer = this.#layers.get(name);\n if (!layer) return;\n\n // Call layer unmount hook\n if (layer.lifecycle?.onUnmount) {\n try {\n layer.lifecycle.onUnmount(layer.context);\n } catch (error) {\n console.error(`Error in layer \"${name}\" onUnmount:`, error);\n }\n }\n\n // Call brush unmount hooks and clean up reactors\n layer.brushes.forEach(brush => {\n if (brush.lifecycle?.onUnmount) {\n try {\n brush.lifecycle.onUnmount(\n this.#contexts.get(brush.context || layer.context)\n );\n } catch (error) {\n console.error(`Error in brush \"${brush.name}\" onUnmount:`, error);\n }\n }\n // Clean up brush reactor and subscription\n const reactorData = this.#reactors.get(`painter_brush_${brush.name}`);\n if (reactorData) {\n reactorData.unsubscribe();\n reactorData.reactor.destroy();\n this.#reactors.delete(`painter_brush_${brush.name}`);\n }\n });\n\n // Clean up layer reactor and subscription\n const layerReactorData = this.#reactors.get(`painter_layer_${name}`);\n if (layerReactorData) {\n layerReactorData.unsubscribe();\n layerReactorData.reactor.destroy();\n this.#reactors.delete(`painter_layer_${name}`);\n }\n\n this.#layers.delete(name);\n }\n\n #scheduleRender() {\n if (this.#renderScheduled || this.#isRendering) return;\n \n this.#renderScheduled = true;\n \n this.#frameId = requestAnimationFrame(() => {\n this.#renderScheduled = false;\n this.#frameId = null;\n this.#render();\n });\n }\n\n async #render() {\n if (!this.#canvas) return;\n this.#isRendering = true;\n \n try {\n // Clear hit registry at start of render\n this.#hitRegistry.clear();\n \n const renderStart = this.#runtimeConfig.debug?.enabled ? performance.now() : 0;\n\n // Clear all contexts\n this.#contexts.forEach(ctx => {\n ctx.clearRect(0, 0, this.#canvas.width, this.#canvas.height);\n });\n\n // Render layers in order\n for (const layer of this.#layers.values()) {\n const layerStart = this.#runtimeConfig.debug?.enabled ? performance.now() : 0;\n\n // Check layer condition\n if (layer.whenReactor) {\n const layerReactor = this.#reactors.get(`painter_layer_${layer.name}`)?.reactor;\n if (!layer.when(layerReactor())) continue;\n }\n\n const ctx = layer.context;\n\n if (!ctx) continue;\n\n // Layer beforeRender hook\n if (layer.lifecycle?.beforeRender) {\n try {\n layer.lifecycle.beforeRender(ctx, this.#timing);\n } catch (error) {\n console.error(`Error in layer \"${layer.name}\" beforeRender:`, error);\n if (layer.lifecycle?.onError) layer.lifecycle.onError(error);\n }\n }\n\n // Apply layer settings\n ctx.save();\n if (layer.settings) {\n Object.entries(layer.settings).forEach(([key, value]) => {\n if (typeof ctx[key] === 'function') {\n ctx[key](...(Array.isArray(value) ? value : [value]));\n } else {\n ctx[key] = value;\n }\n });\n }\n\n // Render brushes\n for (const brush of layer.brushes) {\n const brushStart = this.#runtimeConfig.debug?.enabled ? performance.now() : 0;\n\n if (brush.whenReactor && !brush.whenReactor()) continue;\n\n\n const brushCtx = brush.context ? \n this.#contexts.get(brush.context) : \n ctx;\n\n if (!brushCtx) continue;\n\n // Brush beforeRender hook\n if (brush.lifecycle?.beforeRender) {\n try {\n brush.lifecycle.beforeRender(brushCtx, this.#timing);\n } catch (error) {\n console.error(`Error in brush \"${brush.name}\" beforeRender:`, error);\n if (brush.lifecycle?.onError) brush.lifecycle.onError(error);\n continue;\n }\n }\n\n brushCtx.save();\n \n if (brush.settings) {\n Object.entries(brush.settings).forEach(([key, value]) => {\n if (typeof brushCtx[key] === 'function') {\n brushCtx[key](...(Array.isArray(value) ? value : [value]));\n } else {\n brushCtx[key] = value;\n }\n });\n }\n \n try {\n const requiredAssets = {};\n if (brush.assets) {\n for (const key of brush.assets) {\n requiredAssets[key] = this.#assets.get(key);\n }\n }\n brush.render(brushCtx, brush.dataReactor(), requiredAssets, this.#timing);\n\n // Brush afterRender hook\n if (brush.lifecycle?.afterRender) {\n brush.lifecycle.afterRender(brushCtx, this.#timing);\n }\n\n if (this.#runtimeConfig.debug?.enabled) {\n const brushTime = performance.now() - brushStart;\n this.#metrics.brushTimes.set(brush.name, brushTime);\n\n if (this.#runtimeConfig.debug?.showBounds) {\n this.#renderBrushBounds(brushCtx, brush);\n }\n }\n } catch (error) {\n console.error(`Error in brush \"${brush.name}\":`, error);\n if (brush.lifecycle?.onError) brush.lifecycle.onError(error);\n } finally {\n brushCtx.restore();\n }\n }\n\n ctx.restore();\n\n // Layer afterRender hook\n if (layer.lifecycle?.afterRender) {\n try {\n layer.lifecycle.afterRender(ctx, this.#timing);\n } catch (error) {\n console.error(`Error in layer \"${layer.name}\" afterRender:`, error);\n if (layer.lifecycle?.onError) layer.lifecycle.onError(error);\n }\n }\n\n if (this.#runtimeConfig.debug?.enabled) {\n const layerTime = performance.now() - layerStart;\n this.#metrics.layerTimes.set(layer.name, layerTime);\n\n if (this.#runtimeConfig.debug?.showBounds) {\n this.#renderLayerBounds(ctx, layer);\n }\n }\n }\n\n // Render debug overlay if enabled\n if (this.#runtimeConfig.debug?.enabled) {\n this.#renderDebugOverlay();\n }\n \n } finally {\n this.#isRendering = false;\n }\n }\n\n #renderBrushBounds(ctx, brush) {\n ctx.save();\n ctx.strokeStyle = 'rgba(0, 255, 0, 0.5)';\n ctx.lineWidth = 1;\n ctx.strokeRect(0, 0, ctx.canvas.width, ctx.canvas.height);\n ctx.restore();\n }\n\n #renderLayerBounds(ctx, layer) {\n ctx.save();\n ctx.strokeStyle = 'rgba(255, 0, 0, 0.5)';\n ctx.lineWidth = 2;\n ctx.strokeRect(0, 0, ctx.canvas.width, ctx.canvas.height);\n ctx.restore();\n }\n\n #renderDebugOverlay() {\n const ctx = this.#contexts.get(ContextTypes['2D']);\n if (!ctx) return;\n\n ctx.save();\n ctx.resetTransform();\n ctx.font = '12px monospace';\n ctx.fillStyle = 'white';\n ctx.strokeStyle = 'black';\n ctx.lineWidth = 3;\n\n let y = 20;\n const lineHeight = 15;\n\n if (this.#runtimeConfig.debug?.showFPS) {\n const text = `FPS: ${Math.round(this.#metrics.fps)} (${this.#timing.deltaTime.toFixed(2)}ms)`;\n ctx.strokeText(text, 10, y);\n ctx.fillText(text, 10, y);\n y += lineHeight;\n }\n\n if (this.#runtimeConfig.debug?.showLayerTiming) {\n ctx.fillText('Layer Times:', 10, y);\n y += lineHeight;\n\n for (const [name, time] of this.#metrics.layerTimes) {\n const text = ` ${name}: ${time.toFixed(2)}ms`;\n ctx.strokeText(text, 10, y);\n ctx.fillText(text, 10, y);\n y += lineHeight;\n }\n\n ctx.fillText(this.state.get(['_transitions', 'pointer', 'currentState']), 10, y);\n }\n\n ctx.restore();\n }\n\n handleResize(width, height) {\n // Call onResize hooks for all layers\n for (const layer of this.#layers.values()) {\n if (layer.lifecycle?.onResize) {\n try {\n layer.lifecycle.onResize(width, height, layer.context);\n } catch (error) {\n console.error(`Error in layer \"${layer.name}\" onResize:`, error);\n if (layer.lifecycle?.onError) layer.lifecycle.onError(error);\n }\n }\n }\n }\n\n #createDataReactor(id, data) {\n const state = this.useContext('state');\n\n const reactor = createReactor(data, {\n immediate: true,\n context: state\n });\n\n const unsubscribe = addEffect(reactor, () => this.#scheduleRender());\n\n this.#reactors.set(`painter_${id}`, {\n reactor,\n unsubscribe\n });\n\n return reactor;\n }\n\n destroy() {\n this.stop();\n // Clean up all layers and reactors\n for (const name of this.#layers.keys()) {\n this.removeLayer(name);\n }\n }\n\n setTargetFPS(fps) {\n this.#runtimeConfig.targetFPS = fps;\n this.#runtimeConfig.fixedTimeStep = 1000 / fps;\n }\n\n setTimeScale(scale) {\n this.#runtimeConfig.timeScale = Math.max(0, scale);\n }\n\n setFixedTimeStep(step) {\n this.#runtimeConfig.fixedTimeStep = step;\n }\n\n setDebug(options = {}) {\n if (!this.#runtimeConfig.debug) {\n this.#runtimeConfig.debug = {};\n }\n Object.assign(this.#runtimeConfig.debug, options);\n }\n\n getMetrics() {\n return {\n ...this.#metrics,\n deltaTime: this.#timing.deltaTime,\n elapsedTime: this.#timing.elapsedTime,\n frameCount: this.#timing.frameCount\n };\n }\n\n // Hit Registry Methods\n updatePointer(x, y, state) {\n const prevPointer = { ...this.#pointerState };\n this.#pointerState = { x, y, state };\n\n // Hit test current position\n const hitArea = this.#hitTest(x, y);\n\n // Handle state transitions\n if (state === 'down') {\n this.#activeArea = hitArea;\n if (hitArea?.onPointerDown) {\n hitArea.onPointerDown.handler?.(hitArea.data);\n this.#notifySubscribers('pointerdown', hitArea.onPointerDown.metadata);\n }\n }\n \n if (state === 'up') {\n if (this.#activeArea?.onPointerUp) {\n this.#activeArea.onPointerUp.handler?.(this.#activeArea.data);\n this.#notifySubscribers('pointerup', this.#activeArea.onPointerUp.metadata);\n }\n this.#activeArea = null;\n }\n \n if (state === 'move') {\n // Handle drag on active area\n if (this.#activeArea?.onPointerMove) {\n this.#activeArea.onPointerMove.handler?.(this.#activeArea.data, { x, y });\n this.#notifySubscribers('pointermove', this.#activeArea.onPointerMove.metadata);\n }\n \n // Handle hover enter/leave\n if (hitArea !== this.#hoveredArea) {\n if (this.#hoveredArea?.onPointerLeave) {\n this.#hoveredArea.onPointerLeave.handler?.(this.#hoveredArea.data);\n this.#notifySubscribers('pointerleave', this.#hoveredArea.onPointerLeave.metadata);\n }\n \n if (hitArea?.onPointerEnter) {\n hitArea.onPointerEnter.handler?.(hitArea.data);\n this.#notifySubscribers('pointerenter', hitArea.onPointerEnter.metadata);\n }\n \n this.#hoveredArea = hitArea;\n }\n }\n }\n\n subscribe(callback) {\n this.#subscribers.add(callback);\n return () => this.#subscribers.delete(callback);\n }\n\n #hitTest(x, y) {\n // Sort by priority (highest first) and test\n const sorted = this.#hitRegistry.areas.sort((a, b) => \n (b.priority || 0) - (a.priority || 0)\n );\n \n for (const area of sorted) {\n if (this.#isPointInBounds(x, y, area.bounds)) {\n return area;\n }\n }\n return null;\n }\n\n #isPointInBounds(x, y, bounds) {\n return x >= bounds.x && \n x <= bounds.x + bounds.width &&\n y >= bounds.y && \n y <= bounds.y + bounds.height;\n }\n\n #notifySubscribers(type, metadata) {\n if (!metadata) return;\n for (const callback of this.#subscribers) {\n callback({ type, metadata });\n }\n }\n}", "export const ContextTypes = {\n '2D': '2d',\n 'WEBGL': 'webgl',\n 'WEBGL2': 'webgl2',\n 'BITMAPRENDERER': 'bitmaprenderer'\n};", "export class HitRegistry {\n #areas = new Map();\n\n register(id, area) {\n if (!id) {\n throw new Error('Hit area must have an id');\n }\n this.#areas.set(id, { id, ...area });\n return () => this.unregister(id);\n }\n\n unregister(id) {\n this.#areas.delete(id);\n }\n\n get(id) {\n return this.#areas.get(id);\n }\n\n has(id) {\n return this.#areas.has(id);\n }\n\n get areas() {\n return Array.from(this.#areas.values());\n }\n\n clear() {\n this.#areas.clear();\n }\n}"],
|
|
5
|
+
"mappings": "AAAA,OAAS,mBAAAA,MAAuB,qBCAzB,IAAMC,EAAe,CAC1B,KAAM,KACN,MAAS,QACT,OAAU,SACV,eAAkB,gBACpB,EDHA,OAAS,iBAAAC,EAA0B,aAAAC,MAAiB,wBACpD,OAAS,oBAAAC,EAAkB,kBAAAC,MAAsB,qBEH1C,IAAMC,EAAN,KAAkB,CACvBC,GAAS,IAAI,IAEb,SAASC,EAAIC,EAAM,CACjB,GAAI,CAACD,EACH,MAAM,IAAI,MAAM,0BAA0B,EAE5C,YAAKD,GAAO,IAAIC,EAAI,CAAE,GAAAA,EAAI,GAAGC,CAAK,CAAC,EAC5B,IAAM,KAAK,WAAWD,CAAE,CACjC,CAEA,WAAWA,EAAI,CACb,KAAKD,GAAO,OAAOC,CAAE,CACvB,CAEA,IAAIA,EAAI,CACN,OAAO,KAAKD,GAAO,IAAIC,CAAE,CAC3B,CAEA,IAAIA,EAAI,CACN,OAAO,KAAKD,GAAO,IAAIC,CAAE,CAC3B,CAEA,IAAI,OAAQ,CACV,OAAO,MAAM,KAAK,KAAKD,GAAO,OAAO,CAAC,CACxC,CAEA,OAAQ,CACN,KAAKA,GAAO,MAAM,CACpB,CACF,EFxBO,IAAMG,EAAcC,EAAiB,QAAS,CAAC,MAAM,CAAC,EAChDC,EAAcD,EAAiB,QAAS,CAAC,MAAM,CAAC,EAEhDE,EAAN,cAAsBC,CAAgB,CAC3CC,GAAU,IAAI,IACdC,GAAU,KACVC,GAAY,IAAI,IACh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AClB,YAAKlB,GAAa,IAAIkB,CAAQ,EACvB,IAAM,KAAKlB,GAAa,OAAOkB,CAAQ,CAChD,CAEA4D,GAAS/D,EAAGC,EAAG,CAEb,IAAMgE,EAAS,KAAKrF,GAAa,MAAM,KAAK,CAACsF,EAAGC,KAC7CA,EAAE,UAAY,IAAMD,EAAE,UAAY,EACrC,EAEA,QAAWE,KAAQH,EACjB,GAAI,KAAKI,GAAiBrE,EAAGC,EAAGmE,EAAK,MAAM,EACzC,OAAOA,EAGX,OAAO,IACT,CAEAC,GAAiBrE,EAAGC,EAAGqE,EAAQ,CAC7B,OAAOtE,GAAKsE,EAAO,GACZtE,GAAKsE,EAAO,EAAIA,EAAO,OACvBrE,GAAKqE,EAAO,GACZrE,GAAKqE,EAAO,EAAIA,EAAO,MAChC,CAEAN,GAAmB3D,EAAMkE,EAAU,CACjC,GAAKA,EACL,QAAWpE,KAAY,KAAKlB,GAC1BkB,EAAS,CAAE,KAAAE,EAAM,SAAAkE,CAAS,CAAC,CAE/B,CACF",
|
|
6
|
+
"names": ["ServiceProvider", "ContextTypes", "createReactor", "addEffect", "createDefinition", "definitionType", "HitRegistry", "#areas", "id", "area", "defineBrush", "createDefinition", "defineLayer", "Painter", "ServiceProvider", "#layers", "#canvas", "#contexts", "#reactors", "#assets", "#isRunning", "#frameId", "#renderNeeded", "#isRendering", "#renderScheduled", "#runtimeConfig", "#timing", "#metrics", "#hitRegistry", "HitRegistry", "#pointerState", "#hoveredArea", "#activeArea", "#subscribers", "context", "layerDef", "layers", "layer", "fn", "canvas", "assets", "name", "fps", "scale", "step", "options", "width", "height", "x", "y", "state", "callback", "ContextTypes", "type", "ctx", "result", "#scheduleRender", "_a", "definitionType", "config", "dataReactor", "#createDataReactor", "brushes", "child", "brushConfig", "whenReactor", "createReactor", "brush", "error", "reactorData", "layerReactorData", "#render", "_b", "_c", "_d", "_e", "_f", "_g", "_h", "_i", "_j", "_k", "_l", "_m", "_n", "_o", "_p", "_q", "renderStart", "layerStart", "layerReactor", "key", "value", "brushStart", "brushCtx", "requiredAssets", "brushTime", "#renderBrushBounds", "layerTime", "#renderLayerBounds", "#renderDebugOverlay", "lineHeight", "text", "time", "id", "data", "reactor", "unsubscribe", "addEffect", "prevPointer", "hitArea", "#hitTest", "#notifySubscribers", "sorted", "a", "b", "area", "#isPointInBounds", "bounds", "metadata"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jucie-engine/painter",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Canvas painting service for @jucie-engine/core with reactive rendering support",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -41,6 +41,8 @@
|
|
|
41
41
|
"@jucie-state/core": "^1.0.39"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"
|
|
44
|
+
"jsdom": "^27.4.0",
|
|
45
|
+
"vitest": "^3.2.4",
|
|
46
|
+
"vitest-canvas-mock": "^1.1.3"
|
|
45
47
|
}
|
|
46
48
|
}
|