Skip to content

Commit

Permalink
fix: packages structure
Browse files Browse the repository at this point in the history
  • Loading branch information
RSamaium committed Dec 15, 2024
1 parent 03804e7 commit 23909ac
Show file tree
Hide file tree
Showing 68 changed files with 2,100 additions and 161 deletions.
2 changes: 1 addition & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ComponentFunction } from "./src/engine/signal";
import { ComponentFunction } from "./packages/core/src/engine/signal";

declare module '*.ce' {
const content: any;
Expand Down
47 changes: 11 additions & 36 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,57 +1,32 @@
{
"name": "canvasengine",
"name": "canvasengine-project",
"description": "A reactive HTML5 Canvas management library built on top of PixiJS",
"version": "2.0.1-beta.2",
"type": "module",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js"
},
"./compiler": {
"types": "./dist/compiler/vite.js",
"import": "./dist/compiler/vite.js"
}
},
"scripts": {
"dev": "cd sample && vite",
"build": "tsup",
"watch": "tsup --watch",
"dev": "pnpm -r --filter=./packages/** --parallel run dev",
"build": "pnpm -r --filter=./packages/** run build",
"test": "vitest",
"docs:build": "cd docs && npm run build",
"prepublishOnly": "npm run build"
"release": "bumpp package.json packages/*/package.json --all",
"changeset": "changeset",
"publish:packages": "changeset publish",
"version:packages": "changeset version"
},
"dependencies": {
"@barvynkoa/particle-emitter": "^0.0.1",
"@pixi/tilemap": "^5.0.1",
"@rpgjs/tiled": "^4.3.0",
"@signe/reactive": "^1.0.1",
"howler": "^2.2.4",
"pixi-filters": "^6.0.5",
"pixi-viewport": "^6.0.3",
"pixi.js": "^8.6.4",
"popmotion": "^11.0.5",
"revolt-fx": "^1.3.5",
"rxjs": "^7.8.1",
"yoga-layout": "^2.0.1"
"@changesets/cli": "^2.27.10",
"bumpp": "^9.9.1"
},
"devDependencies": {
"@types/howler": "^2.2.11",
"@types/node": "^22.10.2",
"@types/stats.js": "^0.17.3",
"canvas": "^2.11.2",
"dedent": "^1.5.3",
"eslint": "^8.57.0",
"jsdom": "^25.0.1",
"lightningcss": "^1.28.2",
"rollup-plugin-node-polyfills": "^0.2.1",
"tsup": "^8.2.4",
"typescript": "^5.6.2",
"vite": "^5.4.4",
"vitest": "^1.6.0",
"vitest-webgl-canvas-mock": "^1.1.0",
"typescript": "^5.6.2"
"vitest-webgl-canvas-mock": "^1.1.0"
},
"author": "Samuel Ronce",
"license": "MIT",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
7 changes: 4 additions & 3 deletions compiler/package.json → packages/compiler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"types": "dist/index.d.ts",
"scripts": {
"build": "tsup",
"watch": "tsup --watch"
"dev": "tsup --watch"
},
"type": "module",
"publishConfig": {
Expand All @@ -18,10 +18,11 @@
"dependencies": {
"acorn": "^8.14.0",
"peggy": "^4.2.0",
"vite": "^6.0.3",
"typescript": "^5.7.2"
"typescript": "^5.7.2",
"vite": "^6.0.3"
},
"devDependencies": {
"@types/node": "^22.10.2",
"tsup": "^8.3.5"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const { generate } = pkg;
let parser: any;

beforeAll(() => {
const grammar = fs.readFileSync("compiler/grammar.pegjs", "utf8");
const grammar = fs.readFileSync("packages/compiler/grammar.pegjs", "utf8");
parser = generate(grammar);
});

Expand Down
File renamed without changes.
File renamed without changes.
52 changes: 52 additions & 0 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"name": "canvasengine",
"version": "2.0.1-beta.3",
"type": "module",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
"build": "tsup",
"dev": "tsup --watch"
},
"dependencies": {
"@barvynkoa/particle-emitter": "^0.0.1",
"@pixi/tilemap": "^5.0.1",
"@rpgjs/tiled": "^4.3.0",
"@signe/reactive": "^1.0.1",
"howler": "^2.2.4",
"package.json": "^2.0.1",
"pixi-filters": "^6.0.5",
"pixi-viewport": "^6.0.3",
"pixi.js": "^8.6.4",
"popmotion": "^11.0.5",
"rxjs": "^7.8.1",
"yoga-layout": "^2.0.1"
},
"devDependencies": {
"@types/howler": "^2.2.11"
},
"author": "Samuel Ronce",
"license": "MIT",
"homepage": "https://canvasengine.net",
"repository": {
"type": "git",
"url": "git+https://github.com/RSamaium/CanvasEngine.git"
},
"bugs": {
"url": "https://github.com/RSamaium/CanvasEngine/issues"
},
"keywords": [
"canvas",
"pixijs",
"reactive",
"html5"
],
"publishConfig": {
"access": "public"
},
"overrides": {
"revolt-fx": {
"pixi.js": "^8.6.4"
}
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ export { TiledMap } from './Tilemap'
export { TilingSprite } from './TilingSprite'
export { Viewport } from './Viewport'
export { ImageMap } from './DrawMap'
export { NineSliceSprite } from './NineSliceSprite'
export { NineSliceSprite } from './NineSliceSprite'
export { ComponentInstance } from './DisplayObject'
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export interface DisplayObjectProps {
pivot?: SignalOrPrimitive<{ x: number, y: number }>;
filters?: any[];
blendMode?: SignalOrPrimitive<PIXI.BLEND_MODES>;
blur?: SignalOrPrimitive<number>;

click?: PIXI.FederatedEventHandler;
mousedown?: PIXI.FederatedEventHandler;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ export class KeyboardControls extends Directive {
}

private onKeyChange(e: KeyboardEvent, isDown: boolean) {
e = e || window.event;
e = (e || window.event) as KeyboardEvent;

const keyName: string = keyCodeTable[e.keyCode];

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
7 changes: 3 additions & 4 deletions src/index.ts → packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export * from './engine/trigger'
export * from './engine/bootstrap'
export * from './engine/animation'
export { useProps, useDefineProps } from './hooks/useProps'

export * from './presets/Bar'
export * from './presets/Particle'
export * from './utils/Ease'
export * from './utils/Ease'
export * from './utils/RadialGradient'
export { isObservable } from 'rxjs'
File renamed without changes.
File renamed without changes.
19 changes: 19 additions & 0 deletions packages/presets/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "@canvasengine/presets",
"version": "2.0.1-beta.3",
"type": "module",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
"build": "tsup",
"dev": "tsup --watch"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"canvasengine": "workspace:*",
"pixi.js": "^8.6.4",
"revolt-fx": "^1.3.5"
}
}
4 changes: 1 addition & 3 deletions src/presets/Bar.ts → packages/presets/src/Bar.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { Graphics } from "../components";
import { h } from "../engine/signal";
import { Graphics, h, useProps } from "canvasengine";
import * as PIXI from "pixi.js";
import { useProps } from "../hooks/useProps";

interface BarProps {
backgroundColor?: string;
Expand Down
File renamed without changes.
4 changes: 1 addition & 3 deletions src/presets/Joystick.ts → packages/presets/src/Joystick.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
*/

import * as PIXI from "pixi.js";
import { Container, Graphics, Sprite } from "../components";
import { h } from "../engine/signal";
import { signal } from "@signe/reactive";
import { Container, Graphics, Sprite, h, signal } from "canvasengine";

export interface JoystickChangeEvent {
angle: number;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
import { Container, Graphics } from "../components";
import { h, mount } from "../engine/signal";
import { animatedSignal } from "../engine/animation";
import { RadialGradient } from "../utils/RadialGradient";
import { effect, isSignal, signal } from "@signe/reactive";
import { useProps } from "../hooks/useProps";
import { isObservable } from "rxjs";
import { Container, Graphics, h, mount, useProps, animatedSignal, RadialGradient, effect, isSignal, signal, isObservable } from "canvasengine";

export function LightSpot(opts) {
const { radius } = useProps(opts);
Expand Down Expand Up @@ -82,7 +76,7 @@ export function NightAmbiant(props) {
if (subscription) {
subscription.unsubscribe()
}
subscription = child.subscribe((event) => {
subscription = child.subscribe((event: any) => {
for (let child of event.fullElements) {
applyChildren(child)
}
Expand All @@ -95,7 +89,7 @@ export function NightAmbiant(props) {

mount((el) => {
effect(() => {
const { displayWidth, displayHeight } = el.componentInstance
const { displayWidth, displayHeight } = el.componentInstance as any
const w = +displayWidth()
const h = +displayHeight()
setTimeout(() => {
Expand Down
5 changes: 1 addition & 4 deletions src/presets/Particle.ts → packages/presets/src/Particle.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import * as PIXI from "pixi.js";
import { FX } from "revolt-fx";
import { h, mount, tick } from "../engine/signal";
import { Container } from "../components";
import { on } from "../engine/trigger";
import { useProps } from "../hooks/useProps";
import { h, mount, tick, Container, on, useProps } from "canvasengine";

export function Particle(options) {
const { emit, settings = {} } = options;
Expand Down
4 changes: 4 additions & 0 deletions packages/presets/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export * from './Bar'
export * from './Particle'
export * from './NightAmbiant'
export * from './Joystick'
Loading

0 comments on commit 23909ac

Please sign in to comment.