@scratch-compiler/client 0.1.0 → 0.1.1

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.
Files changed (2) hide show
  1. package/README.md +60 -0
  2. package/package.json +2 -2
package/README.md ADDED
@@ -0,0 +1,60 @@
1
+ # @scratch-compiler/client
2
+
3
+ Browser runtime used by `@scratch-compiler/cli` output.
4
+
5
+ It provides:
6
+
7
+ - `Stage` (backdrop rendering, variable/list monitors)
8
+ - `Sprite` (costumes, movement, basic events)
9
+
10
+ ## Install
11
+
12
+ ```bash
13
+ npm i @scratch-compiler/client
14
+ ```
15
+
16
+ ## Basic Usage
17
+
18
+ ```js
19
+ import { Stage, Sprite } from "@scratch-compiler/client";
20
+
21
+ const myStage = new Stage(
22
+ {
23
+ name: "Stage",
24
+ isStage: true,
25
+ costumes: [
26
+ // costumes from Scratch project.json (md5ext must exist in ./assets)
27
+ ],
28
+ currentCostume: 0,
29
+ },
30
+ "sb3-container",
31
+ );
32
+
33
+ myStage.draw();
34
+
35
+ const sprite = new Sprite({
36
+ name: "Sprite1",
37
+ isStage: false,
38
+ costumes: [],
39
+ currentCostume: 0,
40
+ x: 0,
41
+ y: 0,
42
+ direction: 90,
43
+ size: 100,
44
+ visible: true,
45
+ });
46
+
47
+ sprite.draw(myStage);
48
+ ```
49
+
50
+ ## Assets
51
+
52
+ The runtime loads costume assets from `./assets/<md5ext>` at runtime. If you are not using the CLI output, ensure you serve an `assets/` folder next to your page.
53
+
54
+ ## Variable/List Monitors (DOM)
55
+
56
+ ```js
57
+ myStage.renderVariable("Score", 10);
58
+ myStage.renderList("Items", ["a", "b", "c"]);
59
+ ```
60
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scratch-compiler/client",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Scratch runtime for the browser",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -15,7 +15,7 @@
15
15
  },
16
16
  "dependencies": {
17
17
  "konva": "^10.2.3",
18
- "@scratch-compiler/types": "0.1.0"
18
+ "@scratch-compiler/types": "0.1.1"
19
19
  },
20
20
  "devDependencies": {
21
21
  "esbuild": "^0.27.4",