@axion-engine/core 0.0.1 → 0.0.2
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/axion-platform/src/components/AxionCanvas.d.ts.map +1 -1
- package/dist/axion-platform/src/components/SceneRegistry.d.ts +5 -0
- package/dist/axion-platform/src/components/SceneRegistry.d.ts.map +1 -0
- package/dist/axion-worker.js +162 -162
- package/dist/axion-worker.js.map +4 -4
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +3 -3
- package/dist/worker/{AxionWorker.d.ts → hooks/AxionWorker.d.ts} +1 -2
- package/dist/worker/hooks/AxionWorker.d.ts.map +1 -0
- package/package.json +1 -1
- package/dist/worker/AxionWorker.d.ts.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { AxionContext } from "./axion-platform";
|
|
2
|
-
export { AxionCanvas } from "./axion-platform";
|
|
3
|
-
export { AxionEngine } from "./axion-platform";
|
|
1
|
+
export { AxionContext } from "./axion-platform/src/context/AxionContext";
|
|
2
|
+
export { AxionCanvas } from "./axion-platform/src/components/AxionCanvas";
|
|
3
|
+
export { AxionEngine } from "./axion-platform/src/context/AxionContext";
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../packages/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../packages/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,2CAA2C,CAAA;AACtE,OAAO,EAAC,WAAW,EAAC,MAAM,6CAA6C,CAAA;AACvE,OAAO,EAAC,WAAW,EAAC,MAAM,2CAA2C,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createContext as
|
|
1
|
+
import{createContext as f}from"react";import{jsx as x}from"react/jsx-runtime";var i=f(null),u=({worker:a,children:t})=>x(i.Provider,{value:a,children:t});import{useContext as C,useEffect as h,useRef as m}from"react";import{jsx as N}from"react/jsx-runtime";var e=null,l=!1,p=0,w=4,A=8,I=12,v=({shadows:a})=>{let t=C(i),c=m(null);return h(()=>{if(!c.current||!t)return;let n=c.current,d=setTimeout(()=>{if(l&&e){e.parentNode!==n&&n.appendChild(e);return}l=!0,e=document.createElement("canvas"),e.style.width="100%",e.style.height="100%";try{let o=e.transferControlToOffscreen(),s=new ArrayBuffer(16),r=new DataView(s);r.setUint32(p,window.innerWidth),r.setUint32(w,window.innerHeight),r.setFloat32(A,window.devicePixelRatio),r.setUint8(I,a?1:0),t.postMessage({type:"INIT",canvas:o,config:s},[o,s]),n.appendChild(e),console.log("\u{1F680} Axion ENGINE: Binary Handshake Success.")}catch(o){console.warn("Axion Bridge: Handshake race condition caught.",o)}},50);return()=>{clearTimeout(d),e&&e.parentNode===n&&n.removeChild(e)}},[t]),N("div",{ref:c,style:{width:"100%",height:"100%"}})};export{v as AxionCanvas,i as AxionContext,u as AxionEngine};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../packages/axion-platform/src/context/AxionContext.tsx", "../packages/axion-platform/src/components/AxionCanvas.tsx"],
|
|
4
|
-
"sourcesContent": ["// src/context/AxionContext.tsx\r\nimport React, { Context, createContext, ReactNode } from \"react\";\r\nexport const AxionContext: Context<Worker | null> = createContext<Worker | null>(null);\r\n\r\n// 2. The Engine Provider (Manages the Worker)\r\nexport const AxionEngine = ({ worker, children }: { worker: Worker, children: ReactNode }): React.JSX.Element => {\r\n return (\r\n <AxionContext.Provider value={worker}>\r\n {children}\r\n </AxionContext.Provider>\r\n );\r\n};", "\r\nimport React, { useContext, useEffect, useRef } from \"react\";\r\nimport { AxionContext } from \"../context/AxionContext\";\r\n\r\
|
|
5
|
-
"mappings": "AACA,OAAyB,iBAAAA,MAAgC,QAMjD,cAAAC,MAAA,oBALD,IAAMC,EAAuCF,EAA6B,IAAI,EAGxEG,EAAc,CAAC,CAAE,OAAAC,EAAQ,SAAAC,CAAS,IAEvCJ,EAACC,EAAa,SAAb,CAAsB,MAAOE,EACzB,SAAAC,EACL,ECRR,OAAgB,cAAAC,EAAY,aAAAC,EAAW,UAAAC,MAAc,
|
|
6
|
-
"names": ["createContext", "jsx", "AxionContext", "AxionEngine", "worker", "children", "useContext", "useEffect", "useRef", "jsx", "GLOBAL_CANVAS", "INITIALIZED", "AxionCanvas", "shadows", "worker", "useContext", "AxionContext", "containerRef", "useRef", "useEffect", "container", "timeoutId", "offscreen", "e"]
|
|
4
|
+
"sourcesContent": ["// src/context/AxionContext.tsx\r\nimport React, { Context, createContext, ReactNode } from \"react\";\r\nexport const AxionContext: Context<Worker | null> = createContext<Worker | null>(null);\r\n\r\n// 2. The Engine Provider (Manages the Worker)\r\nexport const AxionEngine = ({ worker, children }: { worker: Worker, children: ReactNode }): React.JSX.Element => {\r\n return (\r\n <AxionContext.Provider value={worker}>\r\n {children}\r\n </AxionContext.Provider>\r\n );\r\n};", "\r\nimport React, { useContext, useEffect, useRef } from \"react\";\r\nimport { AxionContext } from \"../context/AxionContext\";\r\n\r\nlet GLOBAL_CANVAS: HTMLCanvasElement | null = null;\r\nlet INITIALIZED = false;\r\nconst CONFIG_WIDTH = 0;\r\nconst CONFIG_HEIGHT = 4;\r\nconst CONFIG_DPR = 8;\r\nconst CONFIG_SHADOWS = 12;\r\n\r\nexport const AxionCanvas = ({ shadows }: { shadows?: boolean }): React.JSX.Element => {\r\n const worker = useContext(AxionContext);\r\n const containerRef = useRef<HTMLDivElement>(null);\r\n\r\n useEffect(() => {\r\n if (!containerRef.current || !worker) return;\r\n\r\n const container = containerRef.current;\r\n\r\n const timeoutId = setTimeout(() => {\r\n if (INITIALIZED && GLOBAL_CANVAS) {\r\n if (GLOBAL_CANVAS.parentNode !== container) {\r\n container.appendChild(GLOBAL_CANVAS);\r\n }\r\n return;\r\n }\r\n\r\n INITIALIZED = true;\r\n GLOBAL_CANVAS = document.createElement('canvas');\r\n GLOBAL_CANVAS.style.width = '100%';\r\n GLOBAL_CANVAS.style.height = '100%';\r\n\r\n try {\r\n const offscreen = GLOBAL_CANVAS.transferControlToOffscreen();\r\n\r\n // --- NEW: CREATE INITIALIZATION BUFFER ---\r\n const initBuffer = new ArrayBuffer(16); // 16 bytes is enough for 4 values\r\n const view = new DataView(initBuffer);\r\n\r\n view.setUint32(CONFIG_WIDTH, window.innerWidth);\r\n view.setUint32(CONFIG_HEIGHT, window.innerHeight);\r\n view.setFloat32(CONFIG_DPR, window.devicePixelRatio);\r\n view.setUint8(CONFIG_SHADOWS, shadows ? 1 : 0);\r\n\r\n worker.postMessage({\r\n type: 'INIT',\r\n canvas: offscreen,\r\n config: initBuffer // Send the buffer here\r\n }, [offscreen, initBuffer]); // Transfer BOTH to the worker\r\n // -----------------------------------------\r\n\r\n container.appendChild(GLOBAL_CANVAS);\r\n console.log(\"\uD83D\uDE80 Axion ENGINE: Binary Handshake Success.\");\r\n } catch (e) {\r\n console.warn(\"Axion Bridge: Handshake race condition caught.\", e);\r\n }\r\n }, 50);\r\n\r\n return () => {\r\n clearTimeout(timeoutId);\r\n if (GLOBAL_CANVAS && GLOBAL_CANVAS.parentNode === container) {\r\n container.removeChild(GLOBAL_CANVAS);\r\n }\r\n };\r\n }, [worker]);\r\n\r\n return <div ref={containerRef} style={{ width: '100%', height: '100%' }} />;\r\n};"],
|
|
5
|
+
"mappings": "AACA,OAAyB,iBAAAA,MAAgC,QAMjD,cAAAC,MAAA,oBALD,IAAMC,EAAuCF,EAA6B,IAAI,EAGxEG,EAAc,CAAC,CAAE,OAAAC,EAAQ,SAAAC,CAAS,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,YAAYd,CAAa,CAE3C,CACJ,EAAG,CAACQ,CAAM,CAAC,EAEJT,EAAC,OAAI,IAAKY,EAAc,MAAO,CAAE,MAAO,OAAQ,OAAQ,MAAO,EAAG,CAC7E",
|
|
6
|
+
"names": ["createContext", "jsx", "AxionContext", "AxionEngine", "worker", "children", "useContext", "useEffect", "useRef", "jsx", "GLOBAL_CANVAS", "INITIALIZED", "CONFIG_WIDTH", "CONFIG_HEIGHT", "CONFIG_DPR", "CONFIG_SHADOWS", "AxionCanvas", "shadows", "worker", "useContext", "AxionContext", "containerRef", "useRef", "useEffect", "container", "timeoutId", "offscreen", "initBuffer", "view", "e"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* AxionWorker.
|
|
2
|
+
* AxionWorker.tsx
|
|
3
3
|
* This utility resolves the worker path based on whether the engine
|
|
4
4
|
* is running in development (via yalc/linked) or production.
|
|
5
5
|
*/
|
|
6
|
-
export declare const createOrionWorker: (customPath?: string) => Worker;
|
|
7
6
|
//# sourceMappingURL=AxionWorker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AxionWorker.d.ts","sourceRoot":"","sources":["../../../packages/worker/hooks/AxionWorker.tsx"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AxionWorker.d.ts","sourceRoot":"","sources":["../../packages/worker/AxionWorker.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAcH,eAAO,MAAM,iBAAiB,GAAI,aAAa,MAAM,KAAG,MASvD,CAAC"}
|