canvasengine 2.0.0-beta.1 → 2.0.1-beta.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/README.md +8 -0
- package/compiler/dist/index.d.ts +9 -0
- package/{dist/compiler/vite.js → compiler/dist/index.js} +4 -4
- package/compiler/dist/index.js.map +1 -0
- package/{src/compiler/vite.ts → compiler/index.ts} +3 -3
- package/compiler/package-lock.json +1850 -0
- package/compiler/package.json +27 -0
- package/compiler/tsconfig.json +29 -0
- package/compiler/tsup.config.ts +14 -0
- package/dist/index.js +0 -8
- package/dist/index.js.map +1 -1
- package/index.d.ts +6 -0
- package/package.json +14 -22
- package/src/directives/Scheduler.ts +0 -11
- package/tsconfig.json +2 -7
- package/tsup.config.ts +11 -26
- package/.cursorrules +0 -0
- package/dist/compiler/vite.js.map +0 -1
- package/logo.png +0 -0
- package/starter/assets/logo.png +0 -0
- package/starter/components/app.ce +0 -18
- package/starter/components/hello.ce +0 -34
- package/starter/index.html +0 -21
- package/starter/main.ts +0 -4
- package/starter/package.json +0 -16
- package/starter/vite.config.ts +0 -12
- /package/{src/compiler → compiler}/grammar.pegjs +0 -0
package/index.d.ts
ADDED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "canvasengine",
|
|
3
3
|
"description": "A reactive HTML5 Canvas management library built on top of PixiJS",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.1-beta.2",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -18,60 +18,47 @@
|
|
|
18
18
|
"scripts": {
|
|
19
19
|
"dev": "cd sample && vite",
|
|
20
20
|
"build": "tsup",
|
|
21
|
-
"
|
|
22
|
-
"preview": "vite preview",
|
|
21
|
+
"watch": "tsup --watch",
|
|
23
22
|
"test": "vitest",
|
|
24
|
-
"docs": "
|
|
25
|
-
"
|
|
26
|
-
"publish": "npm run build && npm publish"
|
|
23
|
+
"docs:build": "cd docs && npm run build",
|
|
24
|
+
"prepublishOnly": "npm run build"
|
|
27
25
|
},
|
|
28
26
|
"dependencies": {
|
|
29
27
|
"@barvynkoa/particle-emitter": "^0.0.1",
|
|
30
|
-
"@pixi/layers": "^2.1.0",
|
|
31
|
-
"@pixi/lights": "^4.1.0",
|
|
32
28
|
"@pixi/tilemap": "^5.0.1",
|
|
33
29
|
"@rpgjs/tiled": "^4.3.0",
|
|
34
30
|
"@signe/reactive": "^1.0.1",
|
|
35
|
-
"animejs": "^3.2.2",
|
|
36
|
-
"d-path-parser": "^1.0.0",
|
|
37
|
-
"framer-motion": "^11.11.9",
|
|
38
31
|
"howler": "^2.2.4",
|
|
39
|
-
"peggy": "^3.0.2",
|
|
40
32
|
"pixi-filters": "^6.0.5",
|
|
41
|
-
"pixi-viewport": "^
|
|
33
|
+
"pixi-viewport": "^6.0.3",
|
|
42
34
|
"pixi.js": "^8.6.4",
|
|
43
35
|
"popmotion": "^11.0.5",
|
|
44
36
|
"revolt-fx": "^1.3.5",
|
|
45
37
|
"rxjs": "^7.8.1",
|
|
46
|
-
"stats.js": "^0.17.0",
|
|
47
|
-
"svg-arc-to-cubic-bezier": "^3.2.0",
|
|
48
|
-
"tinycolor2": "^1.6.0",
|
|
49
|
-
"tsup": "^8.2.4",
|
|
50
38
|
"yoga-layout": "^2.0.1"
|
|
51
39
|
},
|
|
52
40
|
"devDependencies": {
|
|
53
41
|
"@types/howler": "^2.2.11",
|
|
54
42
|
"@types/node": "^22.10.2",
|
|
55
43
|
"@types/stats.js": "^0.17.3",
|
|
56
|
-
"acorn": "^8.12.1",
|
|
57
44
|
"canvas": "^2.11.2",
|
|
58
45
|
"dedent": "^1.5.3",
|
|
59
46
|
"eslint": "^8.57.0",
|
|
60
47
|
"jsdom": "^25.0.1",
|
|
61
48
|
"lightningcss": "^1.28.2",
|
|
62
49
|
"rollup-plugin-node-polyfills": "^0.2.1",
|
|
63
|
-
"
|
|
50
|
+
"tsup": "^8.2.4",
|
|
64
51
|
"vite": "^5.4.4",
|
|
65
|
-
"vitepress": "^1.3.4",
|
|
66
52
|
"vitest": "^1.6.0",
|
|
67
|
-
"vitest-webgl-canvas-mock": "^1.1.0"
|
|
53
|
+
"vitest-webgl-canvas-mock": "^1.1.0",
|
|
54
|
+
"typescript": "^5.6.2"
|
|
68
55
|
},
|
|
69
56
|
"author": "Samuel Ronce",
|
|
70
57
|
"license": "MIT",
|
|
71
58
|
"homepage": "https://canvasengine.net",
|
|
72
59
|
"repository": {
|
|
73
60
|
"type": "git",
|
|
74
|
-
"url": "https://github.com/RSamaium/CanvasEngine.git"
|
|
61
|
+
"url": "git+https://github.com/RSamaium/CanvasEngine.git"
|
|
75
62
|
},
|
|
76
63
|
"bugs": {
|
|
77
64
|
"url": "https://github.com/RSamaium/CanvasEngine/issues"
|
|
@@ -84,5 +71,10 @@
|
|
|
84
71
|
],
|
|
85
72
|
"publishConfig": {
|
|
86
73
|
"access": "public"
|
|
74
|
+
},
|
|
75
|
+
"overrides": {
|
|
76
|
+
"revolt-fx": {
|
|
77
|
+
"pixi.js": "^8.6.4"
|
|
78
|
+
}
|
|
87
79
|
}
|
|
88
80
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { WritableSignal } from '@signe/reactive';
|
|
2
|
-
import Stats from 'stats.js';
|
|
3
2
|
import { Directive, registerDirective } from '../engine/directive';
|
|
4
3
|
import { Element } from '../engine/reactive';
|
|
5
4
|
import * as Utils from '../engine/utils';
|
|
@@ -22,8 +21,6 @@ export class Scheduler extends Directive {
|
|
|
22
21
|
private _stop: boolean = false
|
|
23
22
|
private tick: WritableSignal<Tick | null>
|
|
24
23
|
|
|
25
|
-
private stats = new Stats()
|
|
26
|
-
|
|
27
24
|
onInit(element: Element) {
|
|
28
25
|
this.tick = element.propObservables?.tick as any
|
|
29
26
|
}
|
|
@@ -36,22 +33,15 @@ export class Scheduler extends Directive {
|
|
|
36
33
|
this.lastTimestamp = this.lastTimestamp || this.timestamp // first
|
|
37
34
|
this.deltaTime = Utils.preciseNow() - this.timestamp
|
|
38
35
|
this.timestamp = timestamp
|
|
39
|
-
this.stats.begin()
|
|
40
36
|
this.tick.set({
|
|
41
37
|
timestamp: this.timestamp,
|
|
42
38
|
deltaTime: this.deltaTime,
|
|
43
39
|
frame: this.frame,
|
|
44
40
|
deltaRatio: ~~this.deltaTime / ~~Utils.fps2ms(this.fps)
|
|
45
41
|
})
|
|
46
|
-
this.stats.end()
|
|
47
42
|
this.lastTimestamp = this.timestamp
|
|
48
43
|
this.frame++
|
|
49
44
|
}
|
|
50
|
-
|
|
51
|
-
private showPanel() {
|
|
52
|
-
this.stats.showPanel(0)
|
|
53
|
-
}
|
|
54
|
-
|
|
55
45
|
/**
|
|
56
46
|
* start the schedule
|
|
57
47
|
* @return {Scheduler} returns this scheduler instance
|
|
@@ -64,7 +54,6 @@ export class Scheduler extends Directive {
|
|
|
64
54
|
if (options.maxFps) this.maxFps = options.maxFps
|
|
65
55
|
if (options.fps) this.fps = options.fps
|
|
66
56
|
if (options.delay) this.requestedDelay = options.delay
|
|
67
|
-
this.showPanel()
|
|
68
57
|
const requestAnimationFrame = (fn: (timestamp: number) => void) => {
|
|
69
58
|
if (Utils.isBrowser()) {
|
|
70
59
|
window.requestAnimationFrame(fn.bind(this))
|
package/tsconfig.json
CHANGED
|
@@ -19,14 +19,9 @@
|
|
|
19
19
|
"noImplicitReturns": false,
|
|
20
20
|
"declaration": true,
|
|
21
21
|
"experimentalDecorators": true,
|
|
22
|
-
"emitDecoratorMetadata":
|
|
22
|
+
"emitDecoratorMetadata": true,
|
|
23
23
|
"stripInternal": true,
|
|
24
24
|
"skipLibCheck": true,
|
|
25
25
|
"types": ["node"]
|
|
26
|
-
}
|
|
27
|
-
"include": [
|
|
28
|
-
"src",
|
|
29
|
-
"sample"
|
|
30
|
-
],
|
|
31
|
-
|
|
26
|
+
}
|
|
32
27
|
}
|
package/tsup.config.ts
CHANGED
|
@@ -1,28 +1,13 @@
|
|
|
1
1
|
import { defineConfig } from 'tsup'
|
|
2
2
|
|
|
3
|
-
export default
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}),
|
|
15
|
-
|
|
16
|
-
defineConfig({
|
|
17
|
-
format: ['esm'],
|
|
18
|
-
target: 'node20',
|
|
19
|
-
splitting: true,
|
|
20
|
-
clean: false,
|
|
21
|
-
shims: false,
|
|
22
|
-
dts: true,
|
|
23
|
-
sourcemap: true,
|
|
24
|
-
entry: ['src/compiler/vite.ts'],
|
|
25
|
-
outDir: 'dist/compiler',
|
|
26
|
-
external: ['vite', 'acorn', 'peggy', 'typescript'],
|
|
27
|
-
})
|
|
28
|
-
]
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
format: ['esm'],
|
|
5
|
+
target: 'es2020',
|
|
6
|
+
splitting: true,
|
|
7
|
+
clean: true,
|
|
8
|
+
shims: false,
|
|
9
|
+
dts: true,
|
|
10
|
+
sourcemap: true,
|
|
11
|
+
entry: ['src/index.ts'],
|
|
12
|
+
outDir: 'dist'
|
|
13
|
+
})
|
package/.cursorrules
DELETED
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/compiler/vite.ts"],"sourcesContent":["import { createFilter } from \"vite\";\nimport { parse } from \"acorn\";\nimport fs from \"fs\";\nimport pkg from \"peggy\";\nimport path from \"path\";\nimport * as ts from \"typescript\"; // Import TypeScript package\nimport { fileURLToPath } from 'url';\n\nconst { generate } = pkg;\n\nconst DEV_SRC = \"../../src\"\n\nexport default function canvasengine() {\n const filter = createFilter(\"**/*.ce\");\n\n // Convert import.meta.url to a file path\n const __filename = fileURLToPath(import.meta.url);\n const __dirname = path.dirname(__filename);\n\n const grammar = fs.readFileSync(\n path.join(__dirname, \"grammar.pegjs\").replace(\"dist/compiler/grammar.pegjs\", \"src/compiler/grammar.pegjs\"), \n \"utf8\");\n const parser = generate(grammar);\n const isDev = process.env.NODE_ENV === \"development\";\n const FLAG_COMMENT = \"/*--[TPL]--*/\";\n\n const PRIMITIVE_COMPONENTS = [\n \"Canvas\",\n \"Sprite\",\n \"Text\",\n \"Joystick\",\n \"Viewport\",\n \"Graphics\",\n \"Container\",\n \"ImageMap\",\n \"NineSliceSprite\",\n \"Rect\",\n \"Circle\",\n \"svg\"\n ];\n\n return {\n name: \"vite-plugin-ce\",\n transform(code: string, id: string) {\n if (!filter(id)) return;\n\n // Extract the script content\n const scriptMatch = code.match(/<script>([\\s\\S]*?)<\\/script>/);\n let scriptContent = scriptMatch ? scriptMatch[1].trim() : \"\";\n \n // Transform SVG tags to Svg components\n let template = code.replace(/<script>[\\s\\S]*?<\\/script>/, \"\")\n .replace(/^\\s+|\\s+$/g, '');\n \n // Add SVG transformation\n template = template.replace(/<svg>([\\s\\S]*?)<\\/svg>/g, (match, content) => {\n return `<Svg content=\"${content.trim()}\" />`;\n });\n \n const parsedTemplate = parser.parse(template);\n\n // trick to avoid typescript remove imports in scriptContent\n scriptContent += FLAG_COMMENT + parsedTemplate\n\n let transpiledCode = ts.transpileModule(scriptContent, {\n compilerOptions: {\n module: ts.ModuleKind.Preserve,\n },\n }).outputText;\n\n // remove code after /*---*/\n transpiledCode = transpiledCode.split(FLAG_COMMENT)[0]\n\n // Use Acorn to parse the script content\n const parsed = parse(transpiledCode, {\n sourceType: \"module\",\n ecmaVersion: 2020,\n });\n\n // Extract imports\n const imports = parsed.body.filter(\n (node) => node.type === \"ImportDeclaration\"\n );\n\n // Extract non-import statements from scriptContent\n const nonImportCode = parsed.body\n .filter((node) => node.type !== \"ImportDeclaration\")\n .map((node) => transpiledCode.slice(node.start, node.end))\n .join(\"\\n\");\n\n let importsCode = imports\n .map((imp) => {\n let importCode = transpiledCode.slice(imp.start, imp.end);\n if (isDev && importCode.includes(\"from 'canvasengine'\")) {\n importCode = importCode.replace(\n \"from 'canvasengine'\",\n `from '${DEV_SRC}'`\n );\n }\n return importCode;\n })\n .join(\"\\n\");\n\n // Define an array for required imports\n const requiredImports = [\"h\", \"computed\", \"cond\", \"loop\"];\n\n // Check for missing imports\n const missingImports = requiredImports.filter(\n (importName) =>\n !imports.some(\n (imp) =>\n imp.specifiers &&\n imp.specifiers.some(\n (spec) =>\n spec.type === \"ImportSpecifier\" &&\n spec.imported && \n 'name' in spec.imported &&\n spec.imported.name === importName\n )\n )\n );\n\n // Add missing imports\n if (missingImports.length > 0) {\n const additionalImportCode = `import { ${missingImports.join(\n \", \"\n )} } from ${isDev ? `'${DEV_SRC}'` : \"'canvasengine'\"};`;\n importsCode = `${additionalImportCode}\\n${importsCode}`;\n }\n\n // Check for primitive components in parsedTemplate\n const primitiveImports = PRIMITIVE_COMPONENTS.filter((component) =>\n parsedTemplate.includes(`h(${component}`)\n );\n\n // Add missing imports for primitive components\n primitiveImports.forEach((component) => {\n const importStatement = `import { ${component} } from ${\n isDev ? `'${DEV_SRC}'` : \"'canvasengine'\"\n };`;\n if (!importsCode.includes(importStatement)) {\n importsCode = `${importStatement}\\n${importsCode}`;\n }\n });\n\n // Generate the output\n const output = String.raw`\n ${importsCode}\n import { useProps, useDefineProps } from ${isDev ? `'${DEV_SRC}'` : \"'canvasengine'\"}\n\n export default function component($$props) {\n const $props = useProps($$props)\n const defineProps = useDefineProps($$props)\n ${nonImportCode}\n let $this = ${parsedTemplate}\n return $this\n }\n `;\n\n return {\n code: output,\n map: null,\n };\n },\n };\n}\n"],"mappings":";AAAA,SAAS,oBAAoB;AAC7B,SAAS,aAAa;AACtB,OAAO,QAAQ;AACf,OAAO,SAAS;AAChB,OAAO,UAAU;AACjB,YAAY,QAAQ;AACpB,SAAS,qBAAqB;AAE9B,IAAM,EAAE,SAAS,IAAI;AAErB,IAAM,UAAU;AAED,SAAR,eAAgC;AACrC,QAAM,SAAS,aAAa,SAAS;AAGrC,QAAM,aA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,IAAI,OAAO,MAAM,gBAAgB;AAAA;AAAA;AAAA;AAAA;AAAA,UAKhF,aAAa;AAAA,sBACD,cAAc;AAAA;AAAA;AAAA;AAK9B,aAAO;AAAA,QACL,MAAM;AAAA,QACN,KAAK;AAAA,MACP;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
|
package/logo.png
DELETED
|
Binary file
|
package/starter/assets/logo.png
DELETED
|
Binary file
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
<Canvas
|
|
2
|
-
backgroundColor="#fff"
|
|
3
|
-
width="100%"
|
|
4
|
-
height="100%"
|
|
5
|
-
antialias="true"
|
|
6
|
-
>
|
|
7
|
-
<Container
|
|
8
|
-
width="100%"
|
|
9
|
-
height="100%"
|
|
10
|
-
justifyContent="center"
|
|
11
|
-
alignItems="center">
|
|
12
|
-
<HelloWorld text="CanvasEngine" />
|
|
13
|
-
</Container>
|
|
14
|
-
</Canvas>
|
|
15
|
-
|
|
16
|
-
<script>
|
|
17
|
-
import HelloWorld from "./hello.ce";
|
|
18
|
-
</script>
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
<Container flexDirection="column" width="500px">
|
|
2
|
-
<Sprite
|
|
3
|
-
image="/assets/logo.png"
|
|
4
|
-
anchor="0.5"
|
|
5
|
-
rotation
|
|
6
|
-
scale
|
|
7
|
-
@pointerenter={onEnter}
|
|
8
|
-
@pointerleave={onLeave}
|
|
9
|
-
/>
|
|
10
|
-
<Text text size="70" fontFamily="Helvetica" x="90" y="-30" />
|
|
11
|
-
</Container>
|
|
12
|
-
|
|
13
|
-
<script>
|
|
14
|
-
import { signal, tick, animatedSignal, Easing } from "canvasengine";
|
|
15
|
-
|
|
16
|
-
const { text } = defineProps();
|
|
17
|
-
const rotation = signal(0);
|
|
18
|
-
const scale = animatedSignal(1, {
|
|
19
|
-
duration: 300,
|
|
20
|
-
ease: Easing.easeInOut,
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
tick(() => {
|
|
24
|
-
rotation.update(rotation => rotation + 0.01);
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
const onEnter = () => {
|
|
28
|
-
scale.set(1.5);
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const onLeave = () => {
|
|
32
|
-
scale.set(1);
|
|
33
|
-
};
|
|
34
|
-
</script>
|
package/starter/index.html
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8" />
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
-
<title>Canvas Engine</title>
|
|
7
|
-
<style>
|
|
8
|
-
body, html, #root {
|
|
9
|
-
margin: 0;
|
|
10
|
-
padding: 0;
|
|
11
|
-
height: 100vh;
|
|
12
|
-
width: 100vw;
|
|
13
|
-
overflow: hidden;
|
|
14
|
-
}
|
|
15
|
-
</style>
|
|
16
|
-
</head>
|
|
17
|
-
<body>
|
|
18
|
-
<div id="root"></div>
|
|
19
|
-
<script type="module" src="/main.ts"></script>
|
|
20
|
-
</body>
|
|
21
|
-
</html>
|
package/starter/main.ts
DELETED
package/starter/package.json
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "template",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"description": "",
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"dev": "vite"
|
|
8
|
-
},
|
|
9
|
-
"keywords": [],
|
|
10
|
-
"author": "",
|
|
11
|
-
"license": "ISC",
|
|
12
|
-
"type": "module",
|
|
13
|
-
"devDependencies": {
|
|
14
|
-
"vite": "^6.0.3"
|
|
15
|
-
}
|
|
16
|
-
}
|
package/starter/vite.config.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from 'vite'
|
|
2
|
-
import vitePluginCe from 'canvasengine/compiler'
|
|
3
|
-
|
|
4
|
-
// https://vitejs.dev/config/
|
|
5
|
-
export default defineConfig({
|
|
6
|
-
plugins: [vitePluginCe()],
|
|
7
|
-
resolve: {
|
|
8
|
-
alias: {
|
|
9
|
-
path: 'rollup-plugin-node-polyfills/polyfills/path',
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
});
|
|
File without changes
|