@turbowarp/types 0.0.12 → 0.0.13

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.
@@ -0,0 +1,45 @@
1
+ name: Deploy playground
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ push:
6
+ branches: [master]
7
+
8
+ concurrency:
9
+ group: "deploy"
10
+ cancel-in-progress: true
11
+
12
+ jobs:
13
+ build:
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
17
+ with:
18
+ persist-credentials: false
19
+ - name: Install Node.js
20
+ uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af
21
+ with:
22
+ node-version: 20
23
+ cache: npm
24
+ - name: Install dependencies
25
+ run: npm ci
26
+ - name: Build documentation
27
+ run: npm run build
28
+ - name: Upload artifact
29
+ uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa
30
+ with:
31
+ path: ./docs/
32
+
33
+ deploy:
34
+ environment:
35
+ name: github-pages
36
+ url: ${{ steps.deployment.outputs.page_url }}
37
+ permissions:
38
+ pages: write
39
+ id-token: write
40
+ runs-on: ubuntu-latest
41
+ needs: build
42
+ steps:
43
+ - name: Deploy to GitHub Pages
44
+ id: deployment
45
+ uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e
@@ -2,28 +2,25 @@ name: Validate TypeScript
2
2
 
3
3
  on:
4
4
  push:
5
- branches: [ "master" ]
6
5
  pull_request:
7
- branches: [ "master" ]
8
6
 
9
7
  jobs:
10
8
  test:
11
9
  runs-on: ubuntu-latest
12
10
 
13
11
  steps:
14
- - uses: actions/checkout@v3
15
- - name: Setup Node.js environment
16
- uses: actions/setup-node@v3.4.1
12
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
17
13
  with:
18
- node-version: 14.x
14
+ persist-credentials: false
15
+ - name: Setup Node.js
16
+ uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af
17
+ with:
18
+ node-version: 20
19
+ cache: npm
19
20
  - name: Install dependencies
20
21
  run: npm ci
21
22
  - name: Validate TypeScript
22
23
  run: npm test
23
24
  - name: Validate individual .d.ts files
24
25
  run: |
25
- set -e
26
- for i in index.d.ts types/*.d.ts; do
27
- echo "Validating $i"
28
- npx tsc "$i" --target es6 --noEmit
29
- done
26
+ parallel -v npx tsc --target es6 --noEmit ::: index.d.ts types/*.d.ts
package/README.md CHANGED
@@ -4,6 +4,8 @@ Scratch doesn't provide type definitions for their libraries, so we wrote our ow
4
4
 
5
5
  This repository only contains types for the vanilla (LLK) Scratch runtime and editor. For the additional types in the TurboWarp runtimes, see [@turbowarp/types-tw](https://github.com/TurboWarp/types-tw).
6
6
 
7
+ A possibly more human-readable version of the TypeScript definitions can be found at: https://turbowarp.github.io/types/
8
+
7
9
  |Module|Status|
8
10
  |:-:|:-:|
9
11
  |scratch-vm|✅|
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@turbowarp/types",
3
- "version": "0.0.12",
3
+ "version": "0.0.13",
4
4
  "description": "Type definitions for the Scratch VM and editor",
5
5
  "keywords": [
6
6
  "scratch"
@@ -12,7 +12,8 @@
12
12
  },
13
13
  "scripts": {
14
14
  "test": "tsc",
15
- "watch": "tsc -w"
15
+ "watch": "tsc -w",
16
+ "build": "typedoc types/*"
16
17
  },
17
18
  "repository": {
18
19
  "type": "git",
@@ -24,8 +25,8 @@
24
25
  "url": "https://github.com/TurboWarp/types/issues"
25
26
  },
26
27
  "homepage": "https://github.com/TurboWarp/types#readme",
27
- "dependencies": {},
28
28
  "devDependencies": {
29
+ "typedoc": "^0.25.12",
29
30
  "typescript": "^4.7.4"
30
31
  }
31
32
  }
@@ -604,8 +604,8 @@ declare class RenderWebGL extends EventEmitter<RenderWebGL.ScratchRenderEventMap
604
604
  updateDrawableSkinId(drawableId: number, skinId: number): void;
605
605
  updateDrawablePosition(drawableId: number, position: [number, number]): void;
606
606
  updateDrawableDirection(drawableId: number, direction: number): void;
607
- updateDrawableScale(drawableId: number, scale: number): void;
608
- updateDrawableDirectionScale(drawableId: number, direction: number, scale: number): void;
607
+ updateDrawableScale(drawableId: number, scale: [number, number]): void;
608
+ updateDrawableDirectionScale(drawableId: number, direction: number, scale: [number, number]): void;
609
609
  updateDrawableVisible(drawableId: number, visible: boolean): void;
610
610
  updateDrawableEffect(drawableId: number, effectName: RenderWebGL.Effect, value: number): void;
611
611
  /**
@@ -180,6 +180,12 @@ declare namespace VM {
180
180
  forceNoGlow: boolean;
181
181
  }
182
182
 
183
+ interface RuntimeScriptCache {
184
+ container: Blocks;
185
+ blockId: string;
186
+ fieldsOfInputs: Record<string, Field>;
187
+ }
188
+
183
189
  interface BaseVariable {
184
190
  id: string;
185
191
  name: string;
@@ -909,7 +915,7 @@ declare namespace VM {
909
915
  interface UserData {
910
916
  _username: string;
911
917
  getUsername(): string;
912
- postData(data: UserData): void;
918
+ postData(data: UserDataData): void;
913
919
  }
914
920
 
915
921
  interface VideoProvider {
@@ -1202,7 +1208,7 @@ declare namespace VM {
1202
1208
 
1203
1209
  allScriptsDo(callback: (blockId: string, target: Target) => void, target?: Target): void;
1204
1210
 
1205
- allScriptsByOpcodeDo(opcode: string, callback: (blockId: string, target: Target) => void, target?: Target): void;
1211
+ allScriptsByOpcodeDo(opcode: string, callback: (script: RuntimeScriptCache, target: Target) => void, target?: Target): void;
1206
1212
 
1207
1213
  sequencer: Sequencer;
1208
1214