Skip to content

Commit

Permalink
Browser: Added Canvas support #15 partial
Browse files Browse the repository at this point in the history
Implemented unit tests where possible.
Drawing methods will be tested visually later.
Implemented classes for DOM point and matrix operations.
Moved component classes to separate folder.
Fixed debugging source-mapped ST files with Firefox.
(Is still a todo for other browser projects)
Updated NPM packages.
  • Loading branch information
FunctionPoint committed Aug 4, 2024
1 parent e6c480f commit 9b5ae07
Show file tree
Hide file tree
Showing 63 changed files with 695 additions and 379 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
**/node_modules
**/out
/Browser/web/App.js
/Browser/web/Smalltalk
/Browser/web/Script
/Examples/Balls/web/App.js
/Examples/Balls/web/Smalltalk
/Examples/Benchmark/web/App.js
Expand Down
35 changes: 23 additions & 12 deletions Browser/.vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,17 @@
"reAttach": true,
"url": "http://localhost:3000",
"webRoot": "${workspaceFolder}/web",
"preLaunchTask": "Compile Smalltalk"
// In FireFox, enable this to let the debugger find mappped *.st files.
// But then the *.js files will not open correctly anymore.
// A workaround is to copy (merge) the entire Smalltalk source folder to web/Smalltalk
// "pathMappings": [
// {
// "url": "http://localhost:3000/Smalltalk",
// "path": "${workspaceFolder}../Smalltalk"
// }
// ]
"preLaunchTask": "Compile Smalltalk",
"pathMappings": [
{
"url": "http://localhost:3000/src",
"path": "${workspaceFolder}/src"
},
{
"url": "http://localhost:3000/Smalltalk",
"path": "${workspaceFolder}/../Smalltalk"
}
]
},
{
"name": "Launch Firefox test",
Expand All @@ -61,7 +62,17 @@
"reAttach": true,
"url": "http://localhost:3000/?test",
"webRoot": "${workspaceFolder}/web",
"preLaunchTask": "Compile Smalltalk"
"preLaunchTask": "Compile Smalltalk",
"pathMappings": [
{
"url": "http://localhost:3000/src",
"path": "${workspaceFolder}/src"
},
{
"url": "http://localhost:3000/Smalltalk",
"path": "${workspaceFolder}/../Smalltalk"
}
]
}
]
}
}
4 changes: 2 additions & 2 deletions Browser/.vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"label": "Compile Smalltalk",
"type": "shell",
"command": "node",
"args": [ "../Compiler/out/App.js", "../Smalltalk/Core", "../Smalltalk/Browser", "src", "web/Smalltalk" ],
// "args": [ "../Compiler/out/App.js", "-s", "../Smalltalk/Core", "../Smalltalk/Browser", "src", "web/Smalltalk" ],
"args": [ "../Compiler/out/App.js", "../Smalltalk/Core", "../Smalltalk/Browser", "src", "web/Script" ],
// "args": [ "../Compiler/out/App.js", "-s", "../Smalltalk/Core", "../Smalltalk/Browser", "src", "web/Script" ],
"options": {
"cwd": "${workspaceFolder}"
},
Expand Down
2 changes: 1 addition & 1 deletion Browser/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ tsc

# Compile Smalltalk

node ../Compiler/out/App.js ../Smalltalk/Core ../Smalltalk/Browser src web/Smalltalk
node ../Compiler/out/App.js ../Smalltalk/Core ../Smalltalk/Browser src web/Script

# Check for and run .env file for locations of enabled browsers to test.

Expand Down
2 changes: 1 addition & 1 deletion Browser/src/App.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Invoke the start method on a new BrowserApp ST object.

let moduleName: string = "./Smalltalk/BrowserApp.js";
let moduleName: string = "./Script/BrowserApp.js";
import( moduleName )
.then( module => { module.stMyBrowserApp$class.$new().$start(); } );
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.
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.
31 changes: 16 additions & 15 deletions Compiler/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Compiler/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"type": "module",
"dependencies": {
"@types/node": "^20.14.10",
"@types/node": "^22.1.0",
"source-map": "^0.7.4"
}
}
89 changes: 67 additions & 22 deletions Examples/Shop/Server/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Examples/Shop/Server/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"type": "module",
"dependencies": {
"@types/node": "^20.14.10",
"@types/node": "^22.1.0",
"express": "^4.19.2",
"express-session": "^1.18.0",
"http-terminator": "^3.2.0",
"mariadb": "^3.3.1",
"mysql2": "^3.10.2",
"mysql2": "^3.11.0",
"node-fetch": "^3.3.2",
"pg": "^8.12.0"
}
Expand Down
Loading

0 comments on commit 9b5ae07

Please sign in to comment.