sb3-types 0.1.9 → 0.1.14

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,18 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __defProp = Object.defineProperty;
3
+ var __exportAll = (all, no_symbols) => {
4
+ let target = {};
5
+ for (var name in all) {
6
+ __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
+ }
11
+ if (!no_symbols) {
12
+ __defProp(target, Symbol.toStringTag, { value: "Module" });
13
+ }
14
+ return target;
15
+ };
16
+
17
+ //#endregion
18
+ export { __exportAll as t };
@@ -0,0 +1,2 @@
1
+ import { m as shadow_d_exports, u as inputtype_d_exports } from "../inputtype-DoQnRd2F.mjs";
2
+ export { inputtype_d_exports as InputType, shadow_d_exports as Shadow };
@@ -0,0 +1,39 @@
1
+ import { t as __exportAll } from "../chunk-DQk6qfdC.mjs";
2
+
3
+ //#region enums/shadow.ts
4
+ var shadow_exports = /* @__PURE__ */ __exportAll({
5
+ DiffBlock: () => DiffBlock,
6
+ No: () => No,
7
+ SameBlock: () => SameBlock
8
+ });
9
+ const SameBlock = 1;
10
+ const No = 2;
11
+ const DiffBlock = 3;
12
+
13
+ //#endregion
14
+ //#region enums/inputtype.ts
15
+ var inputtype_exports = /* @__PURE__ */ __exportAll({
16
+ Angle: () => Angle,
17
+ Broadcast: () => Broadcast,
18
+ Color: () => Color,
19
+ Integer: () => Integer,
20
+ List: () => List,
21
+ Number: () => Number,
22
+ PositiveInteger: () => PositiveInteger,
23
+ PositiveNumber: () => PositiveNumber,
24
+ String: () => String,
25
+ Variable: () => Variable
26
+ });
27
+ const Number = 4;
28
+ const PositiveNumber = 5;
29
+ const PositiveInteger = 6;
30
+ const Integer = 7;
31
+ const Angle = 8;
32
+ const Color = 9;
33
+ const String = 10;
34
+ const Broadcast = 11;
35
+ const Variable = 12;
36
+ const List = 13;
37
+
38
+ //#endregion
39
+ export { inputtype_exports as InputType, shadow_exports as Shadow };
@@ -0,0 +1,70 @@
1
+ declare namespace shadow_d_exports {
2
+ export { All$1 as All, DiffBlock, No, SameBlock };
3
+ }
4
+ /**
5
+ * @module
6
+ * Shadow type indicating the appearance of the shadow.
7
+ */
8
+ /** unobscured shadow */
9
+ type SameBlock = 1;
10
+ declare const SameBlock: SameBlock;
11
+ /** no shadow */
12
+ type No = 2;
13
+ declare const No: No;
14
+ /** obscured shadow */
15
+ type DiffBlock = 3;
16
+ declare const DiffBlock: DiffBlock;
17
+ /**
18
+ * Shadow type indicating the appearance of the shadow.
19
+ */
20
+ type All$1 = SameBlock | No | DiffBlock;
21
+ declare namespace inputtype_d_exports {
22
+ export { All, Angle, Broadcast, Color, Integer, List, Number, PositiveInteger, PositiveNumber, String, Variable };
23
+ }
24
+ /**
25
+ * @module
26
+ * Primitive type identifiers.
27
+ */
28
+ /** When accepting all numbers */
29
+ type Number = 4;
30
+ declare const Number: Number;
31
+ /** When accepting all positive numbers */
32
+ type PositiveNumber = 5;
33
+ declare const PositiveNumber: PositiveNumber;
34
+ /** When accepting all positive integers */
35
+ type PositiveInteger = 6;
36
+ declare const PositiveInteger: PositiveInteger;
37
+ /** When accepting all integers */
38
+ type Integer = 7;
39
+ declare const Integer: Integer;
40
+ /**
41
+ * A wheel from -180 to 180 is displayed when editing the value.
42
+ */
43
+ type Angle = 8;
44
+ declare const Angle: Angle;
45
+ /**
46
+ * Color picker appears when editing value.
47
+ * @example "#rrggbb"
48
+ */
49
+ type Color = 9;
50
+ declare const Color: Color;
51
+ /** When accepting all strings (and numbers) */
52
+ type String = 10;
53
+ declare const String: String;
54
+ /** It is a message. */
55
+ type Broadcast = 11;
56
+ declare const Broadcast: Broadcast;
57
+ /**
58
+ * It is a round variable block.
59
+ */
60
+ type Variable = 12;
61
+ declare const Variable: Variable;
62
+ /**
63
+ * It is a round list block.
64
+ */
65
+ type List = 13;
66
+ declare const List: List;
67
+ /** Primitive type identifiers. */
68
+ type All = Number | PositiveNumber | PositiveInteger | Integer | Angle | Color | String | Broadcast | Variable | List;
69
+ //#endregion
70
+ export { List as a, String as c, DiffBlock as d, No as f, Integer as i, Variable as l, shadow_d_exports as m, Broadcast as n, Number as o, SameBlock as p, Color as r, PositiveNumber as s, Angle as t, inputtype_d_exports as u };
@@ -1,205 +1,255 @@
1
+ import { a as List$1, c as String, d as DiffBlock, f as No, i as Integer, l as Variable, n as Broadcast, o as Number, p as SameBlock, r as Color, s as PositiveNumber, t as Angle } from "./inputtype-DoQnRd2F.mjs";
2
+
3
+ //#region primitive.d.ts
1
4
  /**
2
- * @module
3
- * @example
4
- * ```ts
5
- * import type { ScratchProject } from '@pnsk-lab/sb3-types'
5
+ * Represents a number primitive in Scratch 3.0.
6
6
  */
7
-
8
- import type { Shadow } from './enums/index.ts'
9
- import type { InputPrimitive, TopLevelPrimitive } from './primitive.ts'
10
-
7
+ interface NumPrimitive {
8
+ /** Primitive type identifier. */
9
+ 0: Number | PositiveNumber | PositiveNumber | Integer | Angle;
10
+ /** The value of the number primitive, which can be a string or a number. */
11
+ 1: string | number;
12
+ }
13
+ /**
14
+ * Represents a color primitive in Scratch 3.0.
15
+ */
16
+ interface ColorPrimitive {
17
+ /** Primitive type identifier. */
18
+ 0: Color;
19
+ /** The color value in hex format (e.g., #RRGGBB). */
20
+ 1: `#${string}`;
21
+ }
22
+ /**
23
+ * Represents a text primitive in Scratch 3.0.
24
+ */
25
+ interface TextPrimitive {
26
+ /** Primitive type identifier. */
27
+ 0: String;
28
+ /** The value of the text primitive, which can be a string or a number. */
29
+ 1: string | number;
30
+ }
31
+ /**
32
+ * Represents a broadcast primitive in Scratch 3.0.
33
+ */
34
+ interface BroadcastPrimitive {
35
+ /** Primitive type identifier. */
36
+ 0: Broadcast;
37
+ /** The name of broadcast message. */
38
+ 1: string;
39
+ /** The broadcast message ID. */
40
+ 2: string;
41
+ }
42
+ /**
43
+ * Represents a variable primitive in Scratch 3.0.
44
+ */
45
+ interface VariablePrimitive {
46
+ /** Primitive type identifier. */
47
+ 0: Variable;
48
+ /** The name of the variable. */
49
+ 1: string;
50
+ /** The ID of the variable. */
51
+ 2: string;
52
+ /** x position */
53
+ 3?: number;
54
+ /** y position */
55
+ 4?: number;
56
+ }
57
+ /**
58
+ * Represents a list primitive in Scratch 3.0.
59
+ */
60
+ interface ListPrimitive {
61
+ /** Primitive type identifier. */
62
+ 0: List$1;
63
+ /** The name of the list. */
64
+ 1: string;
65
+ /** The ID of the list. */
66
+ 2: string;
67
+ /** x position */
68
+ 3?: number;
69
+ /** y position */
70
+ 4?: number;
71
+ }
72
+ /**
73
+ * Represents input primitives in Scratch 3.0.
74
+ */
75
+ type InputPrimitive = NumPrimitive | ColorPrimitive | TextPrimitive | BroadcastPrimitive | VariablePrimitive | ListPrimitive;
76
+ /**
77
+ * Top-level primitive block
78
+ */
79
+ type TopLevelPrimitive = VariablePrimitive | ListPrimitive;
80
+ //#endregion
81
+ //#region mod.d.ts
11
82
  /**
12
83
  * Scratch 3.0 Project Schema
13
84
  */
14
- export interface ScratchProject {
15
- meta: Meta
16
- targets: (Stage | Sprite)[]
85
+ interface ScratchProject {
86
+ meta: Meta;
87
+ targets: (Stage | Sprite)[];
17
88
  }
18
-
19
89
  /**
20
90
  * Metadata for the Scratch Project
21
91
  */
22
- export interface Meta {
92
+ interface Meta {
23
93
  /**
24
94
  * Semantic versioning of the project
25
95
  * @pattern ^(3\.[0-9]+\.[0-9]+)$
26
96
  */
27
- semver: string
28
-
97
+ semver: string;
29
98
  /**
30
99
  * Version of the Scratch Virtual Machine
31
100
  * @pattern ^([0-9]+\.[0-9]+\.[0-9]+)($|-)
32
101
  */
33
- vm?: string
34
-
102
+ vm?: string;
35
103
  /**
36
104
  * Agent used for creating the project
37
105
  */
38
- agent?: string
39
-
106
+ agent?: string;
40
107
  /**
41
108
  * Origin of the project
42
109
  */
43
- origin?: string
110
+ origin?: string;
44
111
  }
45
-
46
112
  /**
47
113
  * Stage type, representing the backdrop and stage-specific properties
48
114
  */
49
- export interface Stage extends Target {
115
+ interface Stage extends Target {
50
116
  /**
51
117
  * Name of the stage
52
118
  */
53
- name: 'Stage'
54
-
119
+ name: 'Stage';
55
120
  /**
56
121
  * Indicates that this target is a stage
57
122
  */
58
- isStage: true
59
-
123
+ isStage: true;
60
124
  /**
61
125
  * Tempo of the stage
62
126
  */
63
- tempo?: number
64
-
127
+ tempo?: number;
65
128
  /**
66
129
  * Transparency level of the video
67
130
  */
68
- videoTransparency?: number
69
-
131
+ videoTransparency?: number;
70
132
  /**
71
133
  * State of the video
72
134
  */
73
- videoState?: 'on' | 'off' | 'on-flipped'
74
-
135
+ videoState?: 'on' | 'off' | 'on-flipped';
75
136
  /**
76
137
  * Layer order of the stage
77
138
  */
78
- layerOrder?: 0
139
+ layerOrder?: 0;
79
140
  }
80
-
81
141
  /**
82
142
  * Sprite type, representing the individual characters in the project
83
143
  */
84
- export interface Sprite extends Target {
144
+ interface Sprite extends Target {
85
145
  /**
86
146
  * Name of the sprite
87
147
  * @not "\_stage\_"
88
148
  */
89
- name: string
90
-
149
+ name: string;
91
150
  /**
92
151
  * Indicates that this target is not a stage
93
152
  */
94
- isStage: false
95
-
153
+ isStage: false;
96
154
  /**
97
155
  * Visibility of the sprite
98
156
  */
99
- visible?: boolean
100
-
157
+ visible?: boolean;
101
158
  /**
102
159
  * X position of the sprite
103
160
  */
104
- x?: number
105
-
161
+ x?: number;
106
162
  /**
107
163
  * Y position of the sprite
108
164
  */
109
- y?: number
110
-
165
+ y?: number;
111
166
  /**
112
167
  * Size of the sprite
113
168
  */
114
- size?: number
115
-
169
+ size?: number;
116
170
  /**
117
171
  * Direction the sprite is facing
118
172
  */
119
- direction?: number
120
-
173
+ direction?: number;
121
174
  /**
122
175
  * Whether the sprite is draggable
123
176
  */
124
- draggable?: boolean
125
-
177
+ draggable?: boolean;
126
178
  /**
127
179
  * Rotation style of the sprite
128
180
  */
129
- rotationStyle?: 'all around' | "don't rotate" | 'left-right'
130
-
181
+ rotationStyle?: 'all around' | "don't rotate" | 'left-right';
131
182
  /**
132
183
  * Layer order of the sprite
133
184
  * @minimum 1
134
185
  */
135
- layerOrder?: number
186
+ layerOrder?: number;
136
187
  }
137
-
138
188
  /**
139
189
  * Common properties for both stages and sprites
140
190
  */
141
- export interface Target {
191
+ interface Target {
142
192
  /**
143
193
  * Index of the current costume
144
194
  * @minimum 0
145
195
  */
146
- currentCostume: number
147
-
196
+ currentCostume: number;
148
197
  /**
149
198
  * Blocks associated with this target
150
199
  */
151
- blocks: { [id: string]: Block | TopLevelPrimitive }
152
-
200
+ blocks: {
201
+ [id: string]: Block | TopLevelPrimitive;
202
+ };
153
203
  /**
154
204
  * Variables associated with this target
155
205
  */
156
- variables: { [id: string]: ScalarVariable }
157
-
206
+ variables: {
207
+ [id: string]: ScalarVariable;
208
+ };
158
209
  /**
159
210
  * Lists associated with this target
160
211
  */
161
- lists: { [id: string]: List }
162
-
212
+ lists: {
213
+ [id: string]: List;
214
+ };
163
215
  /**
164
216
  * Broadcast messages associated with this target
165
217
  */
166
- broadcasts: { [id: string]: string }
167
-
218
+ broadcasts: {
219
+ [id: string]: string;
220
+ };
168
221
  /**
169
222
  * Comments associated with this target
170
223
  */
171
- comments?: { [id: string]: Comment }
172
-
224
+ comments?: {
225
+ [id: string]: Comment;
226
+ };
173
227
  /**
174
228
  * Costumes associated with this target
175
229
  */
176
- costumes: Costume[]
177
-
230
+ costumes: Costume[];
178
231
  /**
179
232
  * Sounds associated with this target
180
233
  */
181
- sounds: Sound[]
182
-
234
+ sounds: Sound[];
183
235
  /**
184
236
  * Volume of the target
185
237
  */
186
- volume?: number
238
+ volume?: number;
187
239
  }
188
-
189
240
  /**
190
241
  * Definition for a block
191
242
  * @see https://en.scratch-wiki.info/wiki/Scratch_File_Format#Blocks
192
243
  */
193
- export interface Block {
244
+ interface Block {
194
245
  /**
195
246
  * A string naming the block.
196
247
  */
197
- opcode: string
198
-
248
+ opcode: string;
199
249
  /**
200
250
  * Comment associated with the block
201
251
  */
202
- comment?: string
252
+ comment?: string;
203
253
  /**
204
254
  * An object associating names with arrays representing inputs into which other blocks may be dropped, including C mouths.
205
255
  * The first element of each array is 1 if the input is a shadow, 2 if there is no shadow, and 3 if there is a shadow but it is obscured by the input.
@@ -207,15 +257,15 @@ export interface Block {
207
257
  * If there is an obscured shadow, the third element is its ID or an array representing it.
208
258
  * @related {@link Input}
209
259
  */
210
- inputs?: { [id: string]: Input }
211
-
260
+ inputs?: {
261
+ [id: string]: Input;
262
+ };
212
263
  /**
213
264
  * Fields are text boxes, drop-down menus, etc.
214
265
  * These are used directly in {@link https://en.scratch-wiki.info/wiki/Blocks blocks} where there is an {@link https://en.scratch-wiki.info/wiki/Argument input} into which one cannot drop a {@link https://en.scratch-wiki.info/wiki/Reporter_Block reporter}.
215
266
  * However, more often than not, one should be able to do this;
216
267
  * in this case no field exists directly in the block, but an input does, and that input may have a shadow block in it.
217
-
218
- * An object associating names with arrays representing fields.
268
+ * An object associating names with arrays representing fields.
219
269
  * The first element of each array is the field's value.
220
270
  * For certain fields, such as variable and broadcast dropdown menus, there is also a second element, which is the ID of the field's value.
221
271
  * @example ```json
@@ -224,246 +274,194 @@ export interface Block {
224
274
  * ```
225
275
  */
226
276
  fields?: {
227
- [id: string]: Fields
228
- }
229
-
277
+ [id: string]: Fields;
278
+ };
230
279
  /**
231
280
  * The ID of the following block or `null`.
232
281
  */
233
- next?: string | null
234
-
282
+ next?: string | null;
235
283
  /**
236
284
  * False if the block has a parent and true otherwise.
237
285
  */
238
- topLevel?: boolean
239
-
286
+ topLevel?: boolean;
240
287
  /**
241
288
  * If the block is a {@link https://en.scratch-wiki.info/wiki/Stack_Block stack block} and is preceded, this is the ID of the preceding block.
242
289
  * If the block is the first stack block in a {@link https://en.scratch-wiki.info/wiki/C_Block C mouth}, this is the ID of the C block.
243
290
  * If the block is an input to another block, this is the ID of that other block.
244
291
  * Otherwise it is `null`.
245
292
  */
246
- parent?: string | null
247
-
293
+ parent?: string | null;
248
294
  /**
249
295
  * True if this is a shadow block and false otherwise.
250
296
  */
251
- shadow?: boolean
252
-
297
+ shadow?: boolean;
253
298
  /**
254
299
  * X position of the block
255
300
  */
256
- x?: number
257
-
301
+ x?: number;
258
302
  /**
259
303
  * Y position of the block
260
304
  */
261
- y?: number
262
-
305
+ y?: number;
263
306
  /**
264
307
  * Mutation data for the block
308
+ * A special block is used to hold data.
265
309
  */
266
- mutation?: Mutation
310
+ mutation?: Mutation;
267
311
  }
268
-
269
312
  /**
270
313
  * look {@link Block.mutation}
271
314
  */
272
- export type Mutation =
273
- | Mutation_procedures_call
274
- | Mutation_procedures_prototype
275
- | Mutation_control_stop
276
-
315
+ type Mutation = Mutation_procedures_call | Mutation_procedures_prototype | Mutation_control_stop;
277
316
  interface MutationBase {
278
317
  /** The tag name, which is always 'mutation'. */
279
- tagName?: 'mutation'
280
-
318
+ tagName?: 'mutation';
281
319
  /** An array of child elements (typically empty). */
282
- children?: []
320
+ children?: [];
283
321
  }
284
-
285
322
  interface Mutation_procedures_call extends MutationBase {
286
323
  /** The procedure code for custom blocks. */
287
- proccode?: string
288
- /*
289
- * https://github.com/scratchfoundation/scratch-parser/blob/665f05d739a202d565a4af70a201909393d456b2/lib/sb3_definitions.json#L282-L284
290
- * ではstring
291
- * https://en.scratch-wiki.info/wiki/Scratch_File_Format
292
- * ではAn array of the ids of the argumentsとの記述。
293
- /** The IDs of arguments for the procedure. */
294
- argumentids?: string | string[]
295
-
324
+ proccode?: string;
325
+ argumentids?: string | string[];
296
326
  /** Indicates if the procedure is a warp (runs without screen refresh). */
297
- warp?: 'true' | 'false' | 'null' | boolean | null
327
+ warp?: 'true' | 'false' | 'null' | boolean | null;
298
328
  }
299
329
  interface Mutation_procedures_prototype extends MutationBase {
300
330
  /**
301
331
  * An array of the names of the arguments. This is only present when the block has an opcode of procedures_prototype.
302
332
  */
303
- argumentnames: string | string[]
333
+ argumentnames: string | string[];
304
334
  /**
305
335
  * An array of the defaults of the arguments; for string/number arguments, this is an empty string, and for boolean arguments it is false. This is only present when the block has an opcode of procedures_prototype.
306
336
  */
307
- argumentdefaults: (string | boolean)[]
337
+ argumentdefaults: (string | boolean)[];
308
338
  }
309
339
  interface Mutation_control_stop extends MutationBase {
310
340
  /** Indicates if the procedure has a next block. */
311
- hasnext?: 'true' | 'false' | 'null' | boolean | null
341
+ hasnext?: 'true' | 'false' | 'null' | boolean | null;
312
342
  }
313
-
314
343
  /**
315
344
  * Definition for a comment
316
345
  */
317
- export interface Comment {
346
+ interface Comment {
318
347
  /**
319
348
  * ID of the block this comment is attached to
320
349
  */
321
- blockId?: string | null
322
-
350
+ blockId?: string | null;
323
351
  /**
324
352
  * Text of the comment
325
353
  * @maxLength 8000
326
354
  */
327
- text: string
328
-
355
+ text: string;
329
356
  /**
330
357
  * Indicates if the comment is minimized
331
358
  */
332
- minimized?: boolean
333
-
359
+ minimized?: boolean;
334
360
  /**
335
361
  * X position of the comment
336
362
  */
337
- x?: number | null
338
-
363
+ x?: number | null;
339
364
  /**
340
365
  * Y position of the comment
341
366
  */
342
- y?: number | null
343
-
367
+ y?: number | null;
344
368
  /**
345
369
  * Width of the comment
346
370
  */
347
- width?: number
348
-
371
+ width?: number;
349
372
  /**
350
373
  * Height of the comment
351
374
  */
352
- height?: number
375
+ height?: number;
353
376
  }
354
-
355
377
  /**
356
378
  * Costume definition
357
379
  */
358
- export interface Costume {
380
+ interface Costume {
359
381
  /**
360
382
  * Asset ID of the costume
361
383
  * @pattern ^[a-fA-F0-9]{32}$
362
384
  */
363
- assetId: string
364
-
385
+ assetId: string;
365
386
  /**
366
387
  * Bitmap resolution of the costume
367
388
  */
368
- bitmapResolution?: number
369
-
389
+ bitmapResolution?: number;
370
390
  /**
371
391
  * Data format of the costume
372
392
  * @enum ["png", "svg", "jpeg", "jpg", "bmp", "gif"]
373
393
  */
374
- dataFormat: 'png' | 'svg' | 'jpeg' | 'jpg' | 'bmp' | 'gif'
375
-
394
+ dataFormat: 'png' | 'svg' | 'jpeg' | 'jpg' | 'bmp' | 'gif';
376
395
  /**
377
396
  * MD5 extension of the costume
378
397
  * @pattern ^[a-fA-F0-9]{32}\.[a-zA-Z]+$
379
398
  */
380
- md5ext?: string
381
-
399
+ md5ext?: string;
382
400
  /**
383
401
  * Name of the costume
384
402
  */
385
- name: string
386
-
403
+ name: string;
387
404
  /**
388
405
  * X coordinate of the costume's rotation center
389
406
  */
390
- rotationCenterX?: number
391
-
407
+ rotationCenterX?: number;
392
408
  /**
393
409
  * Y coordinate of the costume's rotation center
394
410
  */
395
- rotationCenterY?: number
411
+ rotationCenterY?: number;
396
412
  }
397
-
398
413
  /**
399
414
  * Sound definition
400
415
  */
401
- export interface Sound {
416
+ interface Sound {
402
417
  /**
403
418
  * Asset ID of the sound
404
419
  * @pattern ^[a-fA-F0-9]{32}$
405
420
  */
406
- assetId: string
407
-
421
+ assetId: string;
408
422
  /**
409
423
  * Data format of the sound
410
424
  */
411
- dataFormat: 'wav' | 'wave' | 'mp3'
412
-
425
+ dataFormat: 'wav' | 'wave' | 'mp3';
413
426
  /**
414
427
  * MD5 extension of the sound
415
428
  * @pattern ^[a-fA-F0-9]{32}\.[a-zA-Z0-9]+$
416
429
  */
417
- md5ext?: string
418
-
430
+ md5ext?: string;
419
431
  /**
420
432
  * Name of the sound
421
433
  */
422
- name: string
423
-
434
+ name: string;
424
435
  /**
425
436
  * Sample rate of the sound
426
437
  */
427
- rate?: number
428
-
438
+ rate?: number;
429
439
  /**
430
440
  * Sample count of the sound
431
441
  */
432
- sampleCount?: number
442
+ sampleCount?: number;
433
443
  }
434
-
435
444
  /**
436
445
  * Represents a scalar value, which can be a string, number, or boolean.
437
446
  */
438
- export type ScalarVal = string | number | boolean
439
-
447
+ type ScalarVal = string | number | boolean;
440
448
  /**
441
449
  * Represents a scalar variable.
442
450
  */
443
- export type ScalarVariable = [
444
- displayName: string,
445
- defaultValue: ScalarVal,
446
- isCloudVariable?: boolean,
447
- ]
448
-
451
+ type ScalarVariable = [displayName: string, defaultValue: ScalarVal, isCloudVariable?: boolean];
449
452
  /**
450
453
  * Represents a list.
451
454
  */
452
- export type List = [displayName: string, defaultValue: ScalarVal[]]
453
-
454
- export type InputPrimitiveOrReference = InputPrimitive | /* blockId */ string
455
-
455
+ type List = [displayName: string, defaultValue: ScalarVal[]];
456
+ type InputPrimitiveOrReference = InputPrimitive | /* blockId */string;
456
457
  /**
457
458
  * The input value held by the block
458
459
  * @related
459
460
  */
460
- export type Input =
461
- | [Shadow.UnObscured | Shadow.No, InputPrimitiveOrReference]
462
- | [Shadow.Obscured, InputPrimitiveOrReference, InputPrimitiveOrReference]
463
-
461
+ type Input = [SameBlock | No, InputPrimitiveOrReference] | [DiffBlock, InputPrimitiveOrReference, InputPrimitiveOrReference];
464
462
  /**
465
463
  * look {@link Block.fields}
466
464
  */
467
- export type Fields = [string, null] | [string, string]
468
-
469
- export * from './primitive'
465
+ type Fields = [string, null] | [string, string];
466
+ //#endregion
467
+ export { Block, BroadcastPrimitive, ColorPrimitive, Comment, Costume, Fields, Input, InputPrimitive, InputPrimitiveOrReference, List, ListPrimitive, Meta, Mutation, NumPrimitive, ScalarVal, ScalarVariable, ScratchProject, Sound, Sprite, Stage, Target, TextPrimitive, TopLevelPrimitive, VariablePrimitive };
package/dist/mod.mjs ADDED
@@ -0,0 +1 @@
1
+ export { };
package/package.json CHANGED
@@ -2,7 +2,12 @@
2
2
  "name": "sb3-types",
3
3
  "module": "index.ts",
4
4
  "type": "module",
5
- "version": "0.1.9",
5
+ "version": "0.1.14",
6
+ "files": [
7
+ "dist",
8
+ "LICENSE",
9
+ "README.md"
10
+ ],
6
11
  "exports": {
7
12
  ".": {
8
13
  "default": "./dist/mod.mjs",
@@ -14,9 +19,11 @@
14
19
  }
15
20
  },
16
21
  "scripts": {
17
- "publish": "jsr publish",
22
+ "publish:jsr": "jsr publish",
18
23
  "format": "biome format",
19
24
  "lint": "biome lint",
25
+ "check:ts": "tsc --noEmit",
26
+ "check": "bun run lint && bun run check:ts",
20
27
  "format:fix": "biome format --fix"
21
28
  },
22
29
  "devDependencies": {
@@ -27,5 +34,8 @@
27
34
  },
28
35
  "peerDependencies": {
29
36
  "typescript": "^5.0.0"
37
+ },
38
+ "repository": {
39
+ "url": "https://github.com/pnsk-lab/sb3-types"
30
40
  }
31
41
  }
@@ -1,19 +0,0 @@
1
- name: Publish
2
- on:
3
- push:
4
- branches:
5
- - main
6
-
7
- jobs:
8
- publish:
9
- runs-on: ubuntu-latest
10
-
11
- permissions:
12
- contents: read
13
- id-token: write
14
-
15
- steps:
16
- - uses: actions/checkout@v4
17
-
18
- - name: Publish package
19
- run: npx jsr publish
File without changes
package/biome.json DELETED
@@ -1,22 +0,0 @@
1
- {
2
- "$schema": "https://biomejs.dev/schemas/1.8.1/schema.json",
3
- "organizeImports": {
4
- "enabled": true
5
- },
6
- "linter": {
7
- "enabled": true,
8
- "rules": {
9
- "recommended": true
10
- }
11
- },
12
- "formatter": {
13
- "indentWidth": 2,
14
- "indentStyle": "space"
15
- },
16
- "javascript": {
17
- "formatter": {
18
- "semicolons": "asNeeded",
19
- "quoteStyle": "single"
20
- }
21
- }
22
- }
package/enum.ts DELETED
@@ -1 +0,0 @@
1
- export { Shadow, InputType } from './enums'
package/enums/index.ts DELETED
@@ -1,13 +0,0 @@
1
- /**
2
- * @module
3
- * re-export the enums
4
- */
5
- /**
6
- * Shadow type indicating the appearance of the shadow.
7
- */
8
- export * as Shadow from './shadow'
9
-
10
- /**
11
- * enum of InputType
12
- */
13
- export * as InputType from './inputtype'
@@ -1,58 +0,0 @@
1
- /**
2
- * @module
3
- * Primitive type identifiers.
4
- */
5
- /** When accepting all numbers */
6
- export type Number = 4
7
- // 汚染されるのはこのモジュールだけなので問題なし
8
- // biome-ignore lint/suspicious/noShadowRestrictedNames: <explanation>
9
- export const Number: Number = 4
10
- /** When accepting all positive numbers */
11
- export type PossiveNumber = 5
12
- export const PossiveNumber: PossiveNumber = 5
13
- /** When accepting all positive integers */
14
- export type PossiveInteger = 6
15
- export const PossiveInteger: PossiveInteger = 6
16
- /** When accepting all integers */
17
- export type Integer = 7
18
- export const Integer: Integer = 7
19
- /**
20
- * A wheel from -180 to 180 is displayed when editing the value.
21
- */
22
- export type Angle = 8
23
- export const Angle: Angle = 8
24
- /**
25
- * Color picker appears when editing value.
26
- * @example "#rrggbb"
27
- */
28
- export type Color = 9
29
- export const Color: Color = 9
30
- /** When accepting all strings (and numbers) */
31
- export type String = 10
32
- // biome-ignore lint/suspicious/noShadowRestrictedNames: <explanation>
33
- export const String: String = 10
34
- /** It is a message. */
35
- export type Broadcast = 11
36
- export const Broadcast: Broadcast = 11
37
- /**
38
- * It is a round variable block.
39
- */
40
- export type Variable = 12
41
- export const Variable: Variable = 12
42
- /**
43
- * It is a round list block.
44
- */
45
- export type List = 13
46
- export const List: List = 13
47
- /** Primitive type identifiers. */
48
- export type All =
49
- | Number
50
- | PossiveNumber
51
- | PossiveInteger
52
- | Integer
53
- | Angle
54
- | Color
55
- | String
56
- | Broadcast
57
- | Variable
58
- | List
package/enums/shadow.ts DELETED
@@ -1,17 +0,0 @@
1
- /**
2
- * @module
3
- * Shadow type indicating the appearance of the shadow.
4
- */
5
- /** unobscured shadow */
6
- export type UnObscured = 1
7
- export const UnObscured: UnObscured = 1
8
- /** no shadow */
9
- export type No = 2
10
- export const No: No = 2
11
- /** obscured shadow */
12
- export type Obscured = 3
13
- export const Obscured: Obscured = 3
14
- /**
15
- * Shadow type indicating the appearance of the shadow.
16
- */
17
- export type All = UnObscured | No | Obscured
package/jsr.json DELETED
@@ -1,16 +0,0 @@
1
- {
2
- "$schema": "https://jsr.io/schema/config-file.v1.json",
3
- "name": "@pnsk-lab/sb3-types",
4
- "exports": {
5
- ".": "./mod.ts",
6
- "./enum": "./enum.ts"
7
- },
8
- "version": "0.1.9",
9
- "publish": {
10
- "include": [
11
- "package.json",
12
- "README.md",
13
- "**/*.ts"
14
- ]
15
- }
16
- }
package/primitive.ts DELETED
@@ -1,103 +0,0 @@
1
- import type { InputType } from './enums'
2
-
3
- /**
4
- * Represents a number primitive in Scratch 3.0.
5
- */
6
-
7
- export interface NumPrimitive {
8
- /** Primitive type identifier. */
9
- 0:
10
- | InputType.Number
11
- | InputType.PossiveNumber
12
- | InputType.PossiveInteger
13
- | InputType.Integer
14
- | InputType.Angle
15
-
16
- /** The value of the number primitive, which can be a string or a number. */
17
- 1: string | number
18
- }
19
-
20
- /**
21
- * Represents a color primitive in Scratch 3.0.
22
- */
23
- export interface ColorPrimitive {
24
- /** Primitive type identifier. */
25
- 0: InputType.Color
26
-
27
- /** The color value in hex format (e.g., #RRGGBB). */
28
- 1: `#${string}`
29
- }
30
-
31
- /**
32
- * Represents a text primitive in Scratch 3.0.
33
- */
34
- export interface TextPrimitive {
35
- /** Primitive type identifier. */
36
- 0: InputType.String
37
-
38
- /** The value of the text primitive, which can be a string or a number. */
39
- 1: string | number
40
- } /**
41
- * Represents a broadcast primitive in Scratch 3.0.
42
- */
43
- export interface BroadcastPrimitive {
44
- /** Primitive type identifier. */
45
- 0: InputType.Broadcast
46
-
47
- /** The name of broadcast message. */
48
- 1: string
49
-
50
- /** The broadcast message ID. */
51
- 2: string
52
- } /**
53
- * Represents a variable primitive in Scratch 3.0.
54
- */
55
- export interface VariablePrimitive {
56
- /** Primitive type identifier. */
57
- 0: InputType.Variable
58
-
59
- /** The name of the variable. */
60
- 1: string
61
-
62
- /** The ID of the variable. */
63
- 2: string
64
-
65
- /** x position */
66
- 3?: number
67
-
68
- /** y position */
69
- 4?: number
70
- } /**
71
- * Represents a list primitive in Scratch 3.0.
72
- */
73
- export interface ListPrimitive {
74
- /** Primitive type identifier. */
75
- 0: InputType.List
76
-
77
- /** The name of the list. */
78
- 1: string
79
-
80
- /** The ID of the list. */
81
- 2: string
82
-
83
- /** x position */
84
- 3?: number
85
-
86
- /** y position */
87
- 4?: number
88
- }
89
- /**
90
- * Represents input primitives in Scratch 3.0.
91
- */
92
- export type InputPrimitive =
93
- | NumPrimitive
94
- | ColorPrimitive
95
- | TextPrimitive
96
- | BroadcastPrimitive
97
- | VariablePrimitive
98
- | ListPrimitive
99
- /**
100
- * Top-level primitive block
101
- */
102
-
103
- export type TopLevelPrimitive = VariablePrimitive | ListPrimitive
package/tsconfig.json DELETED
@@ -1,24 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- // Enable latest features
4
- "lib": ["ESNext", "DOM"],
5
- "target": "ESNext",
6
- "module": "ESNext",
7
- "moduleDetection": "force",
8
- "jsx": "react-jsx",
9
- "allowJs": true,
10
- // Bundler mode
11
- "moduleResolution": "bundler",
12
- "allowImportingTsExtensions": true,
13
- "verbatimModuleSyntax": true,
14
- "noEmit": true,
15
- // Best practices
16
- "strict": true,
17
- "skipLibCheck": true,
18
- "noFallthroughCasesInSwitch": true,
19
- // Some stricter flags (disabled by default)
20
- "noUnusedLocals": false,
21
- "noUnusedParameters": false,
22
- "noPropertyAccessFromIndexSignature": false
23
- }
24
- }
package/tsdown.config.ts DELETED
@@ -1,6 +0,0 @@
1
- import { defineConfig } from "tsdown";
2
-
3
- export default defineConfig({
4
- entry: ["mod.ts", "enums/index.ts"],
5
- dts: true,
6
- });