@nitro-bolt/scratchblocks 1.1.0

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 (106) hide show
  1. package/LICENSE +18 -0
  2. package/README.md +205 -0
  3. package/browser.es.js +8 -0
  4. package/browser.js +8 -0
  5. package/build/scratchblocks.min.es.js +11 -0
  6. package/build/scratchblocks.min.es.js.map +1 -0
  7. package/build/scratchblocks.min.js +11 -0
  8. package/build/scratchblocks.min.js.map +1 -0
  9. package/build/translations-all-es.js +10 -0
  10. package/build/translations-all.js +10 -0
  11. package/build/translations-es.js +10 -0
  12. package/build/translations.js +10 -0
  13. package/index.js +163 -0
  14. package/locales/ab.json +261 -0
  15. package/locales/af.json +261 -0
  16. package/locales/all.js +161 -0
  17. package/locales/am.json +262 -0
  18. package/locales/an.json +261 -0
  19. package/locales/ar.json +261 -0
  20. package/locales/ast.json +261 -0
  21. package/locales/az.json +262 -0
  22. package/locales/be.json +261 -0
  23. package/locales/bg.json +261 -0
  24. package/locales/bn.json +261 -0
  25. package/locales/ca.json +267 -0
  26. package/locales/ckb.json +261 -0
  27. package/locales/cs.json +267 -0
  28. package/locales/cy.json +266 -0
  29. package/locales/da.json +261 -0
  30. package/locales/de.json +266 -0
  31. package/locales/el.json +268 -0
  32. package/locales/eo.json +261 -0
  33. package/locales/es-419.json +261 -0
  34. package/locales/es.json +266 -0
  35. package/locales/et.json +261 -0
  36. package/locales/eu.json +261 -0
  37. package/locales/fa.json +266 -0
  38. package/locales/fi.json +261 -0
  39. package/locales/fil.json +262 -0
  40. package/locales/forums.js +37 -0
  41. package/locales/fr.json +266 -0
  42. package/locales/fy.json +261 -0
  43. package/locales/ga.json +261 -0
  44. package/locales/gd.json +266 -0
  45. package/locales/gl.json +261 -0
  46. package/locales/ha.json +261 -0
  47. package/locales/he.json +266 -0
  48. package/locales/hi.json +266 -0
  49. package/locales/hr.json +266 -0
  50. package/locales/ht.json +261 -0
  51. package/locales/hu.json +267 -0
  52. package/locales/hy.json +261 -0
  53. package/locales/id.json +266 -0
  54. package/locales/is.json +261 -0
  55. package/locales/it.json +266 -0
  56. package/locales/ja-Hira.json +268 -0
  57. package/locales/ja.json +268 -0
  58. package/locales/ka.json +261 -0
  59. package/locales/kk.json +263 -0
  60. package/locales/km.json +261 -0
  61. package/locales/ko.json +261 -0
  62. package/locales/ku.json +263 -0
  63. package/locales/lt.json +261 -0
  64. package/locales/lv.json +261 -0
  65. package/locales/mi.json +261 -0
  66. package/locales/mn.json +262 -0
  67. package/locales/nb.json +266 -0
  68. package/locales/nl.json +266 -0
  69. package/locales/nn.json +261 -0
  70. package/locales/nso.json +261 -0
  71. package/locales/oc.json +261 -0
  72. package/locales/or.json +262 -0
  73. package/locales/pl.json +266 -0
  74. package/locales/pt-br.json +261 -0
  75. package/locales/pt.json +266 -0
  76. package/locales/qu.json +261 -0
  77. package/locales/rap.json +263 -0
  78. package/locales/ro.json +266 -0
  79. package/locales/ru.json +266 -0
  80. package/locales/sk.json +261 -0
  81. package/locales/sl.json +266 -0
  82. package/locales/sr.json +261 -0
  83. package/locales/sv.json +261 -0
  84. package/locales/sw.json +261 -0
  85. package/locales/th.json +261 -0
  86. package/locales/tn.json +261 -0
  87. package/locales/tr.json +269 -0
  88. package/locales/uk.json +261 -0
  89. package/locales/uz.json +262 -0
  90. package/locales/vi.json +262 -0
  91. package/locales/xh.json +261 -0
  92. package/locales/zh-cn.json +266 -0
  93. package/locales/zh-tw.json +266 -0
  94. package/locales/zu.json +261 -0
  95. package/package.json +77 -0
  96. package/scratch3/blocks.js +959 -0
  97. package/scratch3/draw.js +404 -0
  98. package/scratch3/index.js +12 -0
  99. package/scratch3/style.css.js +226 -0
  100. package/scratch3/style.js +807 -0
  101. package/syntax/blocks.js +467 -0
  102. package/syntax/commands.js +1692 -0
  103. package/syntax/extensions.js +33 -0
  104. package/syntax/index.js +17 -0
  105. package/syntax/model.js +427 -0
  106. package/syntax/syntax.js +941 -0
@@ -0,0 +1,404 @@
1
+ /* for constructing SVGs */
2
+
3
+ // set by SVG.init
4
+ let document
5
+ let xml
6
+
7
+ const directProps = {
8
+ textContent: true,
9
+ }
10
+
11
+ export default class SVG {
12
+ static init(window) {
13
+ document = window.document
14
+ const DOMParser = window.DOMParser
15
+ xml = new DOMParser().parseFromString("<xml></xml>", "application/xml")
16
+ SVG.XMLSerializer = window.XMLSerializer
17
+ }
18
+
19
+ static makeCanvas() {
20
+ return document.createElement("canvas")
21
+ }
22
+
23
+ static cdata(content) {
24
+ return xml.createCDATASection(content)
25
+ }
26
+
27
+ static el(name, props) {
28
+ const el = document.createElementNS("http://www.w3.org/2000/svg", name)
29
+ return SVG.setProps(el, props)
30
+ }
31
+
32
+ static setProps(el, props) {
33
+ for (const key in props) {
34
+ const value = String(props[key])
35
+ if (directProps[key]) {
36
+ el[key] = value
37
+ } else if (
38
+ props[key] != null &&
39
+ Object.prototype.hasOwnProperty.call(props, key)
40
+ ) {
41
+ el.setAttributeNS(null, key, value)
42
+ }
43
+ }
44
+ return el
45
+ }
46
+
47
+ static withChildren(el, children) {
48
+ for (const child of children) {
49
+ el.appendChild(child)
50
+ }
51
+ return el
52
+ }
53
+
54
+ static group(children) {
55
+ return SVG.withChildren(SVG.el("g"), children)
56
+ }
57
+
58
+ static newSVG(width, height, scale) {
59
+ return SVG.el("svg", {
60
+ version: "1.1",
61
+ width: width * scale,
62
+ height: height * scale,
63
+ viewBox: `0 0 ${width * scale} ${height * scale}`,
64
+ })
65
+ }
66
+
67
+ static polygon(props) {
68
+ return SVG.el("polygon", { ...props, points: props.points.join(" ") })
69
+ }
70
+
71
+ static path(props) {
72
+ return SVG.el("path", { ...props, path: null, d: props.path.join(" ") })
73
+ }
74
+
75
+ static text(x, y, content, props) {
76
+ const text = SVG.el("text", { ...props, x: x, y: y, textContent: content })
77
+ return text
78
+ }
79
+
80
+ static symbol(href) {
81
+ return SVG.el("use", {
82
+ href: href,
83
+ })
84
+ }
85
+
86
+ static move(dx, dy, el) {
87
+ SVG.setProps(el, {
88
+ transform: `translate(${dx} ${dy})`,
89
+ })
90
+ return el
91
+ }
92
+
93
+ /* shapes */
94
+
95
+ static rect(w, h, props) {
96
+ return SVG.el("rect", { ...props, x: 0, y: 0, width: w, height: h })
97
+ }
98
+
99
+ static roundRect(w, h, props) {
100
+ return SVG.rect(w, h, { ...props, rx: 4, ry: 4 })
101
+ }
102
+
103
+ static pillRect(w, h, props) {
104
+ // Keep ordinary one-row outputs fully rounded. Straight side walls only
105
+ // appear once the block grows beyond the 48px output-shape threshold.
106
+ const r = Math.min(24, h / 2)
107
+ return SVG.rect(w, h, { ...props, rx: r, ry: r })
108
+ }
109
+
110
+ static pointedPath(w, h) {
111
+ const r = Math.min(24, h / 2)
112
+ return [
113
+ `M ${r} 0`,
114
+ `L ${w - r} 0 ${w} ${r}`,
115
+ h > 2 * r ? `V ${h - r}` : "",
116
+ `L ${w - r} ${h}`,
117
+ `L ${r} ${h} 0 ${h - r}`,
118
+ h > 2 * r ? `V ${r}` : "",
119
+ `L ${r} 0`,
120
+ "Z",
121
+ ].filter(Boolean)
122
+ }
123
+
124
+ static pointedRect(w, h, props) {
125
+ return SVG.path({ ...props, path: SVG.pointedPath(w, h) })
126
+ }
127
+
128
+ static objectPath(w, h) {
129
+ const r = Math.min(h / 2, w / 2)
130
+ const left = 0.5
131
+ const right = w - 0.5
132
+ if (h > 48) {
133
+ const corner = Math.min(12, w / 4)
134
+ const inset = Math.min(6, corner / 2)
135
+ const halfTip = 5
136
+ const middle = h / 2
137
+ return [
138
+ `M ${left + corner} 0`,
139
+ `H ${right - corner}`,
140
+ `C ${right - inset} 0 ${right - inset} ${corner}`,
141
+ `${right - inset} ${middle - halfTip}`,
142
+ `C ${right - inset} ${middle - 2}`,
143
+ `${right} ${middle - 2}`,
144
+ `${right} ${middle}`,
145
+ `C ${right} ${middle + 2}`,
146
+ `${right - inset} ${middle + 2}`,
147
+ `${right - inset} ${middle + halfTip}`,
148
+ `V ${h - corner}`,
149
+ `C ${right - inset} ${h} ${right - corner} ${h}`,
150
+ `${right - corner} ${h}`,
151
+ `H ${left + corner}`,
152
+ `C ${left + inset} ${h} ${left + inset} ${h - corner}`,
153
+ `${left + inset} ${middle + halfTip}`,
154
+ `C ${left + inset} ${middle + 2}`,
155
+ `${left} ${middle + 2}`,
156
+ `${left} ${middle}`,
157
+ `C ${left} ${middle - 2}`,
158
+ `${left + inset} ${middle - 2}`,
159
+ `${left + inset} ${middle - halfTip}`,
160
+ `V ${corner}`,
161
+ `C ${left + inset} 0 ${left + corner} 0`,
162
+ `${left + corner} 0`,
163
+ "Z",
164
+ ]
165
+ }
166
+ return [
167
+ `M ${left + r} 0`,
168
+ `H ${right - r}`,
169
+ `C ${right - 0.4375 * r} ${0.125 * r}`,
170
+ `${right - 0.75 * r} ${r}`,
171
+ `${right} ${r}`,
172
+ `C ${right - 0.75 * r} ${r}`,
173
+ `${right - 0.4375 * r} ${1.875 * r}`,
174
+ `${right - r} ${2 * r}`,
175
+ `H ${left + r}`,
176
+ `C ${left + 0.4375 * r} ${1.875 * r}`,
177
+ `${left + 0.75 * r} ${r}`,
178
+ `${left} ${r}`,
179
+ `C ${left + 0.75 * r} ${r}`,
180
+ `${left + 0.4375 * r} ${0.125 * r}`,
181
+ `${left + r} 0`,
182
+ "Z",
183
+ ]
184
+ }
185
+
186
+ static objectRect(w, h, props) {
187
+ return SVG.path({
188
+ ...props,
189
+ "stroke-linejoin": "round",
190
+ path: SVG.objectPath(w, h),
191
+ })
192
+ }
193
+
194
+ static topNotch(w, y) {
195
+ return `c 2 0 3 1 4 2
196
+ l 4 4
197
+ c 1 1 2 2 4 2
198
+ h 12
199
+ c 2 0 3 -1 4 -2
200
+ l 4 -4
201
+ c 1 -1 2 -2 4 -2
202
+ L ${w - 4} ${y}
203
+ a 4 4 0 0 1 4 4`
204
+ }
205
+
206
+ static getTop(w) {
207
+ return `M 0 4
208
+ A 4 4 0 0 1 4 0
209
+ H 12 ${SVG.topNotch(w, 0)}`
210
+ }
211
+
212
+ static getRingTop(w) {
213
+ return `M 0 3
214
+ L 3 0
215
+ L 7 0
216
+ L 10 3
217
+ L 16 3
218
+ L 19 0
219
+ L ${w - 3} 0
220
+ L ${w} 3`
221
+ }
222
+
223
+ static getRightAndBottom(w, y, hasNotch, inset) {
224
+ if (typeof inset === "undefined") {
225
+ inset = 0
226
+ }
227
+
228
+ let arr = [`L ${w} ${y - 4}`, `a 4 4 0 0 1 -4 4`]
229
+
230
+ if (hasNotch) {
231
+ arr = arr.concat([
232
+ `L ${inset + 48} ${y}`,
233
+ "c -2 0 -3 1 -4 2",
234
+ "l -4 4",
235
+ "c -1 1 -2 2 -4 2",
236
+ "h -12",
237
+ "c -2 0 -3 -1 -4 -2",
238
+ "l -4 -4",
239
+ "c -1 -1 -2 -2 -4 -2",
240
+ ])
241
+ }
242
+ if (inset === 0) {
243
+ arr.push("L", inset + 4, y)
244
+ arr.push("a 4 4 0 0 1 -4 -4")
245
+ } else {
246
+ arr.push("L", inset + 4, y)
247
+ arr.push("a 4 4 0 0 0 -4 4")
248
+ }
249
+ return arr.join(" ")
250
+ }
251
+
252
+ static getArm(w, armTop) {
253
+ return `L 16 ${armTop - 4}
254
+ a 4 4 0 0 0 4 4
255
+ L 28 ${armTop} ${SVG.topNotch(w, armTop)}`
256
+ }
257
+
258
+ static getArmNoNotch(w, armTop) {
259
+ return `L 16 ${armTop - 4}
260
+ a 4 4 0 0 0 4 4
261
+ L 28 ${armTop} L ${w - 4} ${armTop}
262
+ a 4 4 0 0 1 4 4`
263
+ }
264
+
265
+ static stackRect(w, h, props) {
266
+ return SVG.path({
267
+ ...props,
268
+ path: [SVG.getTop(w), SVG.getRightAndBottom(w, h, true, 0), "Z"],
269
+ })
270
+ }
271
+
272
+ static capPath(w, h) {
273
+ return [SVG.getTop(w), SVG.getRightAndBottom(w, h, false, 0), "Z"]
274
+ }
275
+
276
+ static capRect(w, h, props) {
277
+ return SVG.path({ ...props, path: SVG.capPath(w, h) })
278
+ }
279
+
280
+ static getHatTop(w) {
281
+ return `M 0 16 c 25,-22 71,-22 96,0 L ${w - 4} 16 a 4 4 0 0 1 4 4`
282
+ }
283
+
284
+ static getCatTop(w) {
285
+ return `M 0 32
286
+ c2.6,-2.3 5.5,-4.3 8.5,-6.2c-1,-12.5 5.3,-23.3 8.4,-24.8c3.7,-1.8 16.5,13.1 18.4,15.4c8.4,-1.3 17,-1.3 25.4,0c1.9,-2.3 14.7,-17.2 18.4,-15.4c3.1,1.5 9.4,12.3 8.4,24.8c3,1.8 5.9,3.9 8.5,6.1
287
+ L ${w - 4} 32
288
+ a 4 4 0 0 1 4 4`
289
+ }
290
+
291
+ static hatRect(w, h, props) {
292
+ return SVG.path({
293
+ ...props,
294
+ path: [SVG.getHatTop(w), SVG.getRightAndBottom(w, h, true, 0), "Z"],
295
+ })
296
+ }
297
+
298
+ static catHat(w, h, props) {
299
+ return SVG.group([
300
+ SVG.path({
301
+ ...props,
302
+ path: [SVG.getCatTop(w), SVG.getRightAndBottom(w, h, true, 0), "Z"],
303
+ }),
304
+ SVG.move(
305
+ 0,
306
+ 32,
307
+ SVG.setProps(
308
+ SVG.group([
309
+ SVG.el("circle", {
310
+ cx: 29.1,
311
+ cy: -3.3,
312
+ r: 3.4,
313
+ }),
314
+ SVG.el("circle", {
315
+ cx: 59.2,
316
+ cy: -3.3,
317
+ r: 3.4,
318
+ }),
319
+ SVG.el("path", {
320
+ d: "M45.6,0.1c-0.9,0-1.7-0.3-2.3-0.9c-0.6,0.6-1.3,0.9-2.2,0.9c-0.9,0-1.8-0.3-2.3-0.9c-1-1.1-1.1-2.6-1.1-2.8c0-0.5,0.5-1,1-1l0,0c0.6,0,1,0.5,1,1c0,0.4,0.1,1.7,1.4,1.7c0.5,0,0.7-0.2,0.8-0.3c0.3-0.3,0.4-1,0.4-1.3c0-0.1,0-0.1,0-0.2c0-0.5,0.5-1,1-1l0,0c0.5,0,1,0.4,1,1c0,0,0,0.1,0,0.2c0,0.3,0.1,0.9,0.4,1.2C44.8-2.2,45-2,45.5-2s0.7-0.2,0.8-0.3c0.3-0.4,0.4-1.1,0.3-1.3c0-0.5,0.4-1,0.9-1.1c0.5,0,1,0.4,1.1,0.9c0,0.2,0.1,1.8-0.8,2.8C47.5-0.4,46.8,0.1,45.6,0.1z",
321
+ }),
322
+ ]),
323
+ {
324
+ fill: "#000",
325
+ "fill-opacity": 0.6,
326
+ },
327
+ ),
328
+ ),
329
+ SVG.move(
330
+ 0,
331
+ 32,
332
+ SVG.el("path", {
333
+ d: "M73.1-15.6c1.7-4.2,4.5-9.1,5.8-8.5c1.6,0.8,5.4,7.9,5,15.4c0,0.6-0.7,0.7-1.1,0.5c-3-1.6-6.4-2.8-8.6-3.6C72.8-12.3,72.4-13.7,73.1-15.6z",
334
+ fill: "#FFD5E6",
335
+ transform: "translate(0, 32)",
336
+ }),
337
+ ),
338
+ SVG.move(
339
+ 0,
340
+ 32,
341
+ SVG.el("path", {
342
+ d: "M22.4-15.6c-1.7-4.2-4.5-9.1-5.8-8.5c-1.6,0.8-5.4,7.9-5,15.4c0,0.6,0.7,0.7,1.1,0.5c3-1.6,6.4-2.8,8.6-3.6C22.8-12.3,23.2-13.7,22.4-15.6z",
343
+ fill: "#FFD5E6",
344
+ transform: "translate(0, 32)",
345
+ }),
346
+ ),
347
+ ])
348
+ }
349
+
350
+ static getProcHatTop(w) {
351
+ return `M 0 20 a 20 20 0 0 1 20 -20 L ${w - 20} 0 a 20,20 0 0,1 20,20`
352
+ }
353
+
354
+ static procHatRect(w, h, props) {
355
+ return SVG.path({
356
+ ...props,
357
+ path: [SVG.getProcHatTop(w), SVG.getRightAndBottom(w, h, true, 0), "Z"],
358
+ })
359
+ }
360
+
361
+ static mouthRect(w, h, isFinal, lines, props) {
362
+ let y = lines[0].height
363
+ const p = [SVG.getTop(w), SVG.getRightAndBottom(w, y, true, 16)]
364
+ for (let i = 1; i < lines.length; i += 2) {
365
+ const isLast = i + 2 === lines.length
366
+
367
+ const line = lines[i]
368
+ y += line.height - 3
369
+
370
+ if (line.isFinal) {
371
+ p.push(SVG.getArmNoNotch(w, y))
372
+ } else {
373
+ p.push(SVG.getArm(w, y))
374
+ }
375
+
376
+ const hasNotch = !(isLast && isFinal)
377
+ const inset = isLast ? 0 : 16
378
+ y += lines[i + 1].height + 3
379
+ p.push(SVG.getRightAndBottom(w, y, hasNotch, inset))
380
+ }
381
+ p.push("Z")
382
+ return SVG.path({ ...props, path: p })
383
+ }
384
+
385
+ static commentRect(w, h, props) {
386
+ return SVG.roundRect(w, h, { ...props, class: "sb3-comment" })
387
+ }
388
+
389
+ static commentLine(width, props) {
390
+ return SVG.move(
391
+ -width,
392
+ 9,
393
+ SVG.rect(width, 2, { ...props, class: "sb3-comment-line" }),
394
+ )
395
+ }
396
+
397
+ static strikethroughLine(w, props) {
398
+ return SVG.path({
399
+ ...props,
400
+ path: ["M", 0, 0, "L", w, 0],
401
+ class: "sb3-diff sb3-diff-del",
402
+ })
403
+ }
404
+ }
@@ -0,0 +1,12 @@
1
+ import SVG from "./draw.js"
2
+ import { LabelView } from "./blocks.js"
3
+ import style from "./style.js"
4
+
5
+ export function init(window) {
6
+ SVG.init(window)
7
+
8
+ LabelView.measuring = SVG.makeCanvas().getContext("2d")
9
+ }
10
+
11
+ export const makeStyle = style.makeStyle
12
+ export { newView } from "./blocks.js"
@@ -0,0 +1,226 @@
1
+ // Processed by Rollup
2
+
3
+ const common = `
4
+ .sb3-label {
5
+ font: 500 12pt "Helvetica Neue", Helvetica, Arial, sans-serif;
6
+ word-spacing: +1pt;
7
+ }
8
+
9
+ .sb3-literal-number,
10
+ .sb3-literal-string,
11
+ .sb3-literal-number-dropdown,
12
+ .sb3-literal-dropdown {
13
+ word-spacing: 0;
14
+ }
15
+
16
+ .sb3-diff {
17
+ fill: none;
18
+ stroke: #000;
19
+ }
20
+ .sb3-diff-ins {
21
+ stroke-width: 2px;
22
+ }
23
+ .sb3-diff-del {
24
+ stroke-width: 3px;
25
+ }
26
+ `
27
+
28
+ // These override colors defined per style
29
+ const commonOverride = `
30
+ /* Note: comment colors are different from Scratch. */
31
+
32
+ .sb3-comment {
33
+ fill: #ffffa5;
34
+ stroke: #d0d1d2;
35
+ stroke-width: 1;
36
+ }
37
+ .sb3-comment-line {
38
+ fill: #ffff80;
39
+ }
40
+ /* specificity */
41
+ .sb3-comment-label, .sb3-label.sb3-comment-label {
42
+ font: 400 12pt "Helvetica Neue", Helvetica, Arial, sans-serif;
43
+ fill: #000;
44
+ word-spacing: 0;
45
+ }`
46
+
47
+ const createRule = (category, name, style) => `
48
+ svg${name} .sb3-${category} {
49
+ fill: ${style[category + "Primary"]};
50
+ stroke: ${style[category + "Tertiary"]};
51
+ }
52
+ svg${name} .sb3-${category}-alt {
53
+ fill: ${style[category + "Secondary"]};
54
+ }
55
+ svg${name} .sb3-${category}-dark {
56
+ fill: ${style[category + "Tertiary"]};
57
+ }
58
+ `
59
+
60
+ const create = (name, style) => `
61
+ ${createRule("motion", name, style)}
62
+ ${createRule("looks", name, style)}
63
+ ${createRule("sound", name, style)}
64
+ ${createRule("control", name, style)}
65
+ ${createRule("events", name, style)}
66
+ ${createRule("sensing", name, style)}
67
+ ${createRule("operators", name, style)}
68
+ ${createRule("variables", name, style)}
69
+ ${createRule("list", name, style)}
70
+ ${createRule("custom", name, style)}
71
+ ${createRule("extension", name, style)}
72
+ ${createRule("obsolete", name, style)}
73
+ ${createRule("grey", name, style)}
74
+
75
+ svg${name} .sb3-label {
76
+ fill: ${style.label};
77
+ }
78
+
79
+ svg${name} .sb3-input-color {
80
+ stroke: ${style.inputColorStroke};
81
+ }
82
+
83
+ svg${name} .sb3-input-number,
84
+ svg${name} .sb3-input-string {
85
+ fill: ${style.inputFill};
86
+ }
87
+ svg${name} .sb3-literal-number,
88
+ svg${name} .sb3-literal-string {
89
+ fill: ${style.literal};
90
+ }
91
+
92
+ svg${name} .sb3-custom-arg {
93
+ fill: ${style.customPrimary};
94
+ stroke: ${style.customTertiary};
95
+ }
96
+ `
97
+
98
+ const originalStyle = {
99
+ label: "#fff",
100
+ inputColorStroke: "#fff",
101
+ inputFill: "#fff",
102
+ /* Blockly color: text */
103
+ literal: "#575e75",
104
+
105
+ motionPrimary: "#4c97ff",
106
+ motionSecondary: "#4280d7",
107
+ motionTertiary: "#3373cc",
108
+
109
+ looksPrimary: "#9966ff",
110
+ looksSecondary: "#855cd6",
111
+ looksTertiary: "#774dcb",
112
+
113
+ soundPrimary: "#cf63cf",
114
+ soundSecondary: "#c94fc9",
115
+ soundTertiary: "#bd42bd",
116
+
117
+ controlPrimary: "#ffab19",
118
+ controlSecondary: "#ec9c13",
119
+ controlTertiary: "#cf8b17",
120
+
121
+ eventsPrimary: "#ffbf00",
122
+ eventsSecondary: "#e6ac00",
123
+ eventsTertiary: "#cc9900",
124
+
125
+ sensingPrimary: "#5cb1d6",
126
+ sensingSecondary: "#47a8d1",
127
+ sensingTertiary: "#2e8eb8",
128
+
129
+ operatorsPrimary: "#59c059",
130
+ operatorsSecondary: "#46b946",
131
+ operatorsTertiary: "#389438",
132
+
133
+ variablesPrimary: "#ff8c1a",
134
+ variablesSecondary: "#ff8000",
135
+ variablesTertiary: "#db6e00",
136
+
137
+ listPrimary: "#ff661a",
138
+ listSecondary: "#ff5500",
139
+ listTertiary: "#e64d00",
140
+
141
+ customPrimary: "#ff6680",
142
+ customSecondary: "#ff4d6a",
143
+ customTertiary: "#ff3355",
144
+
145
+ extensionPrimary: "#0fbd8c",
146
+ extensionSecondary: "#0da57a",
147
+ extensionTertiary: "#0b8e69",
148
+
149
+ /**
150
+ * Custom color types. Not defined by Scratch.
151
+ */
152
+ obsoletePrimary: "#ed4242",
153
+ obsoleteSecondary: "#db3333",
154
+ obsoleteTertiary: "#ca2b2b",
155
+
156
+ /* From early prototype colors */
157
+ greyPrimary: "#bfbfbf",
158
+ greySecondary: "#b2b2b2",
159
+ greyTertiary: "#909090",
160
+ }
161
+
162
+ const highContrastStyle = {
163
+ label: "#000",
164
+ inputColorStroke: "#fff",
165
+ inputFill: "#fff",
166
+ literal: "#000",
167
+
168
+ motionPrimary: "#80b5ff",
169
+ motionSecondary: "#b3d2ff",
170
+ motionTertiary: "#3373cc",
171
+
172
+ looksPrimary: "#ccb3ff",
173
+ looksSecondary: "#ddccff",
174
+ looksTertiary: "#774dcb",
175
+
176
+ soundPrimary: "#e19de1",
177
+ soundSecondary: "#ffb3ff",
178
+ soundTertiary: "#bd42bd",
179
+
180
+ controlPrimary: "#ffbe4c",
181
+ controlSecondary: "#ffda99",
182
+ controlTertiary: "#cf8b17",
183
+
184
+ eventsPrimary: "#ffd966",
185
+ eventsSecondary: "#ffecb3",
186
+ eventsTertiary: "#cc9900",
187
+
188
+ sensingPrimary: "#85c4e0",
189
+ sensingSecondary: "#aed8ea",
190
+ sensingTertiary: "#2e8eb8",
191
+
192
+ operatorsPrimary: "#7ece7e",
193
+ operatorsSecondary: "#b5e3b5",
194
+ operatorsTertiary: "#389438",
195
+
196
+ variablesPrimary: "#ffa54c",
197
+ variablesSecondary: "#ffcc99",
198
+ variablesTertiary: "#db6e00",
199
+
200
+ listPrimary: "#ff9966",
201
+ listSecondary: "#ffcab0",
202
+ listTertiary: "#e64d00",
203
+
204
+ customPrimary: "#ff99aa",
205
+ customSecondary: "#ffccd5",
206
+ customTertiary: "#e64d00",
207
+
208
+ extensionPrimary: "#13ecaf",
209
+ extensionSecondary: "#75f0cd",
210
+ extensionTertiary: "#0b8e69",
211
+
212
+ /* Manually picked to be readable on black text */
213
+ obsoletePrimary: "#fc6666",
214
+ obsoleteSecondary: "#fcb0b0",
215
+ obsoleteTertiary: "#d32121",
216
+
217
+ greyPrimary: "#bfbfbf",
218
+ greySecondary: "#b2b2b2",
219
+ /* Changed to be AAA against #000000, was AA */
220
+ greyTertiary: "#959595",
221
+ }
222
+
223
+ export default common +
224
+ create("", originalStyle) +
225
+ create(".scratchblocks-style-scratch3-high-contrast", highContrastStyle) +
226
+ commonOverride