@turbowarp/types 0.0.8 → 0.0.9

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@turbowarp/types",
3
- "version": "0.0.8",
3
+ "version": "0.0.9",
4
4
  "description": "Type definitions for the Scratch VM and editor",
5
5
  "keywords": [
6
6
  "scratch"
@@ -61,7 +61,6 @@
61
61
  }
62
62
  },
63
63
  {
64
- opcode: 'button',
65
64
  blockType: Scratch.BlockType.BUTTON,
66
65
  func: 'MAKE_A_VARIABLE',
67
66
  text: 'button text'
@@ -64,6 +64,9 @@ if (target) {
64
64
  const doesNotExist: undefined = target;
65
65
  }
66
66
 
67
+ runtime._editingTarget as VM.Target;
68
+ runtime.getEditingTarget() as VM.Target;
69
+
67
70
  const audioEngine = new AudioEngine();
68
71
  vm.attachAudioEngine(audioEngine);
69
72
  audioEngine.audioContext.suspend();
@@ -14,7 +14,6 @@ declare namespace Scratch {
14
14
 
15
15
  namespace BlockType {
16
16
  const BOOLEAN: 'Boolean';
17
- /** @deprecated very incomplete and not useful yet */
18
17
  const BUTTON: 'button';
19
18
  const COMMAND: 'command';
20
19
  /** @deprecated does not work in compiler */
@@ -101,29 +100,31 @@ declare namespace Scratch {
101
100
  );
102
101
 
103
102
  interface AbstractBlock {
103
+ text: string | string[];
104
+ filter?: Array<'target' | 'sprite'>;
105
+ }
106
+ interface ExecutableBlock extends AbstractBlock {
104
107
  opcode: string;
105
108
  func?: string;
106
- text: string | string[];
107
109
  arguments?: Record<string, Argument>;
108
110
  hideFromPalette?: boolean;
109
- filter?: Array<'target' | 'sprite'>;
110
111
  blockIconURI?: string;
111
112
  }
112
- interface BooleanBlock extends AbstractBlock {
113
+ interface BooleanBlock extends ExecutableBlock {
113
114
  blockType: 'Boolean';
114
115
  }
115
116
  interface ButtonBlock extends AbstractBlock {
116
117
  blockType: 'button';
117
118
  func: 'MAKE_A_LIST' | 'MAKE_A_PROCEDURE' | 'MAKE_A_VARIABLE';
118
119
  }
119
- interface CommandBlock extends AbstractBlock {
120
+ interface CommandBlock extends ExecutableBlock {
120
121
  blockType: 'command';
121
122
  /**
122
123
  * Defaults to false.
123
124
  */
124
125
  isTerminal?: boolean;
125
126
  }
126
- interface ConditionalBlock extends AbstractBlock {
127
+ interface ConditionalBlock extends ExecutableBlock {
127
128
  blockType: 'conditional';
128
129
  /**
129
130
  * Defaults to false.
@@ -134,7 +135,7 @@ declare namespace Scratch {
134
135
  */
135
136
  branchCount?: number;
136
137
  }
137
- interface EventBlock extends AbstractBlock {
138
+ interface EventBlock extends ExecutableBlock {
138
139
  blockType: 'event';
139
140
  /**
140
141
  * This must be explicitly set to false, otherwise the block will not work.
@@ -146,7 +147,7 @@ declare namespace Scratch {
146
147
  */
147
148
  shouldRestartExistingThreads?: boolean;
148
149
  }
149
- interface HatBlock extends AbstractBlock {
150
+ interface HatBlock extends ExecutableBlock {
150
151
  blockType: 'hat';
151
152
  /**
152
153
  * Defaults to true.
@@ -157,14 +158,14 @@ declare namespace Scratch {
157
158
  */
158
159
  shouldRestartExistingThreads?: boolean;
159
160
  }
160
- interface ReporterBlock extends AbstractBlock {
161
+ interface ReporterBlock extends ExecutableBlock {
161
162
  blockType: 'reporter';
162
163
  /**
163
164
  * Defaults to false.
164
165
  */
165
166
  disableMonitor?: boolean;
166
167
  }
167
- interface LoopBlock extends AbstractBlock {
168
+ interface LoopBlock extends ExecutableBlock {
168
169
  blockType: 'loop';
169
170
  /**
170
171
  * Defaults to false.
@@ -1144,7 +1144,7 @@ declare namespace VM {
1144
1144
  getTargetById(targetId: string): Target | undefined;
1145
1145
 
1146
1146
  /**
1147
- * Find a sprite's original target (not a clone) using the sprite's name.
1147
+ * Find a sprite's original target (not a clone or stage) using the sprite's name.
1148
1148
  * Returns undefined if the target doesn't exist.
1149
1149
  */
1150
1150
  getSpriteTargetByName(spriteName: string): Target | undefined;
@@ -1313,6 +1313,7 @@ declare namespace VM {
1313
1313
 
1314
1314
  emitProjectChanged(): void;
1315
1315
 
1316
+ _editingTarget: Target | null;
1316
1317
  getEditingTarget(): Target | null;
1317
1318
 
1318
1319
  setEditingTarget(target: Target): void;