-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
68 changed files
with
3,581 additions
and
3,373 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: Code quality | ||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
quality: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Setup Biome | ||
uses: biomejs/setup-biome@v2 | ||
with: | ||
version: latest | ||
- name: Run Biome | ||
run: biome ci . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"$schema": "https://biomejs.dev/schemas/1.8.3/schema.json", | ||
"files": { | ||
"ignore": ["**/dist/*", "**/docs/*", "**/*_pb.ts", "**/bundle/*"] | ||
}, | ||
"linter": { | ||
"enabled": true, | ||
"rules": { | ||
"recommended": true | ||
} | ||
}, | ||
"organizeImports": { | ||
"enabled": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,32 @@ | ||
{ | ||
"name": "ts-topology-examples-canvas", | ||
"version": "0.0.23-5", | ||
"license": "MIT", | ||
"scripts": { | ||
"build": "vite build", | ||
"clean": "rm -rf dist/ node_modules/", | ||
"dev": "vite serve", | ||
"start": "ts-node ./src/index.ts" | ||
}, | ||
"dependencies": { | ||
"@topology-foundation/crdt": "0.0.23-5", | ||
"@topology-foundation/network": "0.0.23-5", | ||
"@topology-foundation/node": "0.0.23-5", | ||
"@topology-foundation/object": "0.0.23-5", | ||
"crypto-browserify": "^3.12.0", | ||
"process": "^0.11.10", | ||
"stream-browserify": "^3.0.0", | ||
"ts-node": "^10.9.2", | ||
"vm-browserify": "^1.1.2" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^22.4.1", | ||
"ts-loader": "^9.3.1", | ||
"typescript": "^5.5.4", | ||
"vite": "^5.4.1", | ||
"vite-plugin-node-polyfills": "^0.22.0", | ||
"webpack": "^5.74.0", | ||
"webpack-cli": "^5.1.4", | ||
"webpack-dev-server": "^5.0.4" | ||
} | ||
"name": "ts-topology-examples-canvas", | ||
"version": "0.0.23-5", | ||
"license": "MIT", | ||
"scripts": { | ||
"build": "vite build", | ||
"clean": "rm -rf dist/ node_modules/", | ||
"dev": "vite serve", | ||
"start": "ts-node ./src/index.ts" | ||
}, | ||
"dependencies": { | ||
"@topology-foundation/crdt": "0.0.23-5", | ||
"@topology-foundation/network": "0.0.23-5", | ||
"@topology-foundation/node": "0.0.23-5", | ||
"@topology-foundation/object": "0.0.23-5", | ||
"crypto-browserify": "^3.12.0", | ||
"process": "^0.11.10", | ||
"stream-browserify": "^3.0.0", | ||
"ts-node": "^10.9.2", | ||
"vm-browserify": "^1.1.2" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^22.4.1", | ||
"ts-loader": "^9.3.1", | ||
"typescript": "^5.5.4", | ||
"vite": "^5.4.1", | ||
"vite-plugin-node-polyfills": "^0.22.0", | ||
"webpack": "^5.74.0", | ||
"webpack-cli": "^5.1.4", | ||
"webpack-dev-server": "^5.0.4" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,23 @@ | ||
import { TopologyObject_Operation } from "@topology-foundation/object"; | ||
import { Canvas } from "./objects/canvas"; | ||
import type { TopologyObject_Operation } from "@topology-foundation/object"; | ||
import type { Canvas } from "./objects/canvas"; | ||
|
||
export function handleObjectOps( | ||
canvas: Canvas, | ||
ops: TopologyObject_Operation[], | ||
canvas: Canvas, | ||
ops: TopologyObject_Operation[], | ||
) { | ||
// In this case we only have paint | ||
// `paint(${node.getPeerId()}, [${[x, y]}], [${painting}])` | ||
try { | ||
for (const op of ops) { | ||
const offset = op.args[1] | ||
.split(",") | ||
.map((s: string) => parseInt(s, 10)) as [number, number]; | ||
const rgb = op.args[2].split(",").map((s: string) => parseInt(s, 10)) as [ | ||
number, | ||
number, | ||
number, | ||
]; | ||
canvas.paint(op.args[0], offset, rgb); | ||
} | ||
} catch (e) { | ||
console.error(e); | ||
} | ||
// In this case we only have paint | ||
// `paint(${node.getPeerId()}, [${[x, y]}], [${painting}])` | ||
try { | ||
for (const op of ops) { | ||
const offset = op.args[1] | ||
.split(",") | ||
.map((s: string) => Number.parseInt(s, 10)) as [number, number]; | ||
const rgb = op.args[2] | ||
.split(",") | ||
.map((s: string) => Number.parseInt(s, 10)) as [number, number, number]; | ||
canvas.paint(op.args[0], offset, rgb); | ||
} | ||
} catch (e) { | ||
console.error(e); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.