scratchblocks-plus 1.0.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.
- package/LICENSE +19 -0
- package/README.md +193 -0
- package/browser.es.js +8 -0
- package/browser.js +8 -0
- package/build/scratchblocks-plus.min.es.js +12 -0
- package/build/scratchblocks-plus.min.es.js.map +1 -0
- package/build/scratchblocks-plus.min.js +12 -0
- package/build/scratchblocks-plus.min.js.map +1 -0
- package/build/translations-all-es.js +11 -0
- package/build/translations-all-es.js.map +1 -0
- package/build/translations-all.js +11 -0
- package/build/translations-all.js.map +1 -0
- package/build/translations-es.js +11 -0
- package/build/translations-es.js.map +1 -0
- package/build/translations.js +11 -0
- package/build/translations.js.map +1 -0
- package/index.d.ts +297 -0
- package/index.js +229 -0
- package/locales/ab.json +1630 -0
- package/locales/af.json +1630 -0
- package/locales/all.d.ts +108 -0
- package/locales/all.js +161 -0
- package/locales/am.json +1925 -0
- package/locales/an.json +1630 -0
- package/locales/ar.json +1924 -0
- package/locales/ast.json +1630 -0
- package/locales/az.json +1925 -0
- package/locales/be.json +1630 -0
- package/locales/bg.json +1924 -0
- package/locales/bn.json +1630 -0
- package/locales/ca.json +1930 -0
- package/locales/ckb.json +1630 -0
- package/locales/cs.json +1930 -0
- package/locales/cy.json +1929 -0
- package/locales/da.json +1924 -0
- package/locales/de.json +1929 -0
- package/locales/el.json +1931 -0
- package/locales/eo.json +1630 -0
- package/locales/es-419.json +1924 -0
- package/locales/es.json +1929 -0
- package/locales/et.json +1924 -0
- package/locales/eu.json +1924 -0
- package/locales/fa.json +1929 -0
- package/locales/fi.json +1924 -0
- package/locales/fil.json +1631 -0
- package/locales/forums.js +37 -0
- package/locales/fr.json +1929 -0
- package/locales/fy.json +1630 -0
- package/locales/ga.json +1924 -0
- package/locales/gd.json +1929 -0
- package/locales/gl.json +1924 -0
- package/locales/ha.json +1630 -0
- package/locales/he.json +1929 -0
- package/locales/hi.json +1635 -0
- package/locales/hr.json +1929 -0
- package/locales/ht.json +1630 -0
- package/locales/hu.json +1930 -0
- package/locales/hy.json +1630 -0
- package/locales/id.json +1929 -0
- package/locales/is.json +1924 -0
- package/locales/it.json +1929 -0
- package/locales/ja-Hira.json +1637 -0
- package/locales/ja.json +1931 -0
- package/locales/ka.json +1630 -0
- package/locales/kk.json +1632 -0
- package/locales/km.json +1630 -0
- package/locales/ko.json +1924 -0
- package/locales/ku.json +1632 -0
- package/locales/lt.json +1924 -0
- package/locales/lv.json +1924 -0
- package/locales/mi.json +1924 -0
- package/locales/mn.json +1631 -0
- package/locales/nb.json +1929 -0
- package/locales/nl.json +1929 -0
- package/locales/nn.json +1630 -0
- package/locales/nso.json +1630 -0
- package/locales/oc.json +1630 -0
- package/locales/or.json +1631 -0
- package/locales/pl.json +1929 -0
- package/locales/pt-br.json +1924 -0
- package/locales/pt.json +1929 -0
- package/locales/qu.json +1630 -0
- package/locales/rap.json +1632 -0
- package/locales/ro.json +1929 -0
- package/locales/ru.json +1929 -0
- package/locales/sk.json +1924 -0
- package/locales/sl.json +1929 -0
- package/locales/sr.json +1924 -0
- package/locales/sv.json +1924 -0
- package/locales/sw.json +1630 -0
- package/locales/th.json +1924 -0
- package/locales/tn.json +1630 -0
- package/locales/tr.json +1932 -0
- package/locales/uk.json +1924 -0
- package/locales/uz.json +1631 -0
- package/locales/vi.json +1925 -0
- package/locales/xh.json +1630 -0
- package/locales/zh-cn.json +1930 -0
- package/locales/zh-tw.json +1930 -0
- package/locales/zu.json +1918 -0
- package/package.json +81 -0
- package/scratch2/blocks.js +1000 -0
- package/scratch2/draw.js +452 -0
- package/scratch2/filter.js +78 -0
- package/scratch2/index.js +12 -0
- package/scratch2/style.css.js +148 -0
- package/scratch2/style.js +214 -0
- package/scratch3/blocks.js +1134 -0
- package/scratch3/draw.js +334 -0
- package/scratch3/index.js +12 -0
- package/scratch3/style.css.js +280 -0
- package/scratch3/style.js +877 -0
- package/syntax/blocks.js +921 -0
- package/syntax/commands.js +1755 -0
- package/syntax/dropdowns.js +688 -0
- package/syntax/extensions.js +34 -0
- package/syntax/index.js +17 -0
- package/syntax/model.js +566 -0
- package/syntax/syntax.js +1091 -0
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import SVG from "./draw.js"
|
|
2
|
+
import Filter from "./filter.js"
|
|
3
|
+
import cssContent from "./style.css.js"
|
|
4
|
+
|
|
5
|
+
export default class Style {
|
|
6
|
+
static get cssContent() {
|
|
7
|
+
return cssContent
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
static makeIcons() {
|
|
11
|
+
return [
|
|
12
|
+
SVG.el("path", {
|
|
13
|
+
d: "M1.504 21L0 19.493 4.567 0h1.948l-.5 2.418s1.002-.502 3.006 0c2.006.503 3.008 2.01 6.517 2.01 3.508 0 4.463-.545 4.463-.545l-.823 9.892s-2.137 1.005-5.144.696c-3.007-.307-3.007-2.007-6.014-2.51-3.008-.502-4.512.503-4.512.503L1.504 21z",
|
|
14
|
+
fill: "#3f8d15",
|
|
15
|
+
id: "greenFlag",
|
|
16
|
+
}),
|
|
17
|
+
SVG.el("polygon", {
|
|
18
|
+
points:
|
|
19
|
+
"6.3,0.4725 12.516,0.4725 18.585,6.3 18.585,12.495 12.495,18.585 6.3,18.585 0.483,12.495 0.483,6.3 ",
|
|
20
|
+
fill: "#bb0010",
|
|
21
|
+
id: "stopSign",
|
|
22
|
+
}),
|
|
23
|
+
SVG.el("path", {
|
|
24
|
+
d: "M6.724 0C3.01 0 0 2.91 0 6.5c0 2.316 1.253 4.35 3.14 5.5H5.17v-1.256C3.364 10.126 2.07 8.46 2.07 6.5 2.07 4.015 4.152 2 6.723 2c1.14 0 2.184.396 2.993 1.053L8.31 4.13c-.45.344-.398.826.11 1.08L15 8.5 13.858.992c-.083-.547-.514-.714-.963-.37l-1.532 1.172A6.825 6.825 0 0 0 6.723 0z",
|
|
25
|
+
fill: "#fff",
|
|
26
|
+
id: "turnRight",
|
|
27
|
+
}),
|
|
28
|
+
SVG.el("path", {
|
|
29
|
+
d: "M3.637 1.794A6.825 6.825 0 0 1 8.277 0C11.99 0 15 2.91 15 6.5c0 2.316-1.253 4.35-3.14 5.5H9.83v-1.256c1.808-.618 3.103-2.285 3.103-4.244 0-2.485-2.083-4.5-4.654-4.5-1.14 0-2.184.396-2.993 1.053L6.69 4.13c.45.344.398.826-.11 1.08L0 8.5 1.142.992c.083-.547.514-.714.963-.37l1.532 1.172z",
|
|
30
|
+
fill: "#fff",
|
|
31
|
+
id: "turnLeft",
|
|
32
|
+
}),
|
|
33
|
+
SVG.el("path", {
|
|
34
|
+
d: "M0 0L4 4L0 8Z",
|
|
35
|
+
fill: "#111",
|
|
36
|
+
id: "addInput",
|
|
37
|
+
}),
|
|
38
|
+
SVG.el("path", {
|
|
39
|
+
d: "M4 0L4 8L0 4Z",
|
|
40
|
+
fill: "#111",
|
|
41
|
+
id: "delInput",
|
|
42
|
+
}),
|
|
43
|
+
SVG.setProps(
|
|
44
|
+
SVG.group([
|
|
45
|
+
SVG.el("path", {
|
|
46
|
+
d: "M8 0l2 -2l0 -3l3 0l-4 -5l-4 5l3 0l0 3l-8 0l0 2",
|
|
47
|
+
fill: "#000",
|
|
48
|
+
opacity: "0.3",
|
|
49
|
+
}),
|
|
50
|
+
SVG.move(
|
|
51
|
+
-1,
|
|
52
|
+
-1,
|
|
53
|
+
SVG.el("path", {
|
|
54
|
+
d: "M8 0l2 -2l0 -3l3 0l-4 -5l-4 5l3 0l0 3l-8 0l0 2",
|
|
55
|
+
fill: "#fff",
|
|
56
|
+
opacity: "0.9",
|
|
57
|
+
}),
|
|
58
|
+
),
|
|
59
|
+
]),
|
|
60
|
+
{
|
|
61
|
+
id: "loopArrow",
|
|
62
|
+
},
|
|
63
|
+
),
|
|
64
|
+
SVG.setProps(
|
|
65
|
+
SVG.group([
|
|
66
|
+
SVG.el("rect", {
|
|
67
|
+
x: "0",
|
|
68
|
+
y: "0",
|
|
69
|
+
width: "12",
|
|
70
|
+
height: "14",
|
|
71
|
+
fill: "#000",
|
|
72
|
+
opacity: "0.25",
|
|
73
|
+
}),
|
|
74
|
+
SVG.el("rect", {
|
|
75
|
+
x: "1",
|
|
76
|
+
y: "1",
|
|
77
|
+
width: "1",
|
|
78
|
+
height: "13",
|
|
79
|
+
fill: "#fff",
|
|
80
|
+
}),
|
|
81
|
+
SVG.el("rect", {
|
|
82
|
+
x: "11",
|
|
83
|
+
y: "1",
|
|
84
|
+
width: "1",
|
|
85
|
+
height: "13",
|
|
86
|
+
fill: "#fff",
|
|
87
|
+
}),
|
|
88
|
+
SVG.el("rect", {
|
|
89
|
+
x: "2",
|
|
90
|
+
y: "1",
|
|
91
|
+
width: "9",
|
|
92
|
+
height: "1",
|
|
93
|
+
fill: "#fff",
|
|
94
|
+
}),
|
|
95
|
+
SVG.el("rect", {
|
|
96
|
+
x: "2",
|
|
97
|
+
y: "5",
|
|
98
|
+
width: "9",
|
|
99
|
+
height: "1",
|
|
100
|
+
fill: "#fff",
|
|
101
|
+
}),
|
|
102
|
+
SVG.el("rect", {
|
|
103
|
+
x: "2",
|
|
104
|
+
y: "9",
|
|
105
|
+
width: "9",
|
|
106
|
+
height: "1",
|
|
107
|
+
fill: "#fff",
|
|
108
|
+
}),
|
|
109
|
+
SVG.el("rect", {
|
|
110
|
+
x: "2",
|
|
111
|
+
y: "13",
|
|
112
|
+
width: "9",
|
|
113
|
+
height: "1",
|
|
114
|
+
fill: "#fff",
|
|
115
|
+
}),
|
|
116
|
+
SVG.el("rect", {
|
|
117
|
+
x: "2",
|
|
118
|
+
y: "2",
|
|
119
|
+
width: "9",
|
|
120
|
+
height: "2",
|
|
121
|
+
fill: "#ea8d1c",
|
|
122
|
+
}),
|
|
123
|
+
SVG.el("rect", {
|
|
124
|
+
x: "2",
|
|
125
|
+
y: "6",
|
|
126
|
+
width: "9",
|
|
127
|
+
height: "2",
|
|
128
|
+
fill: "#ea8d1c",
|
|
129
|
+
}),
|
|
130
|
+
SVG.el("rect", {
|
|
131
|
+
x: "2",
|
|
132
|
+
y: "10",
|
|
133
|
+
width: "9",
|
|
134
|
+
height: "2",
|
|
135
|
+
fill: "#ea8d1c",
|
|
136
|
+
}),
|
|
137
|
+
SVG.el("rect", {
|
|
138
|
+
x: "11",
|
|
139
|
+
y: "0",
|
|
140
|
+
width: "1",
|
|
141
|
+
height: "1",
|
|
142
|
+
fill: "#ea8d1c",
|
|
143
|
+
}),
|
|
144
|
+
SVG.el("rect", {
|
|
145
|
+
x: "0",
|
|
146
|
+
y: "13",
|
|
147
|
+
width: "1",
|
|
148
|
+
height: "1",
|
|
149
|
+
fill: "#ea8d1c",
|
|
150
|
+
}),
|
|
151
|
+
]),
|
|
152
|
+
{
|
|
153
|
+
id: "list",
|
|
154
|
+
},
|
|
155
|
+
),
|
|
156
|
+
]
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
static makeStyle() {
|
|
160
|
+
const style = SVG.el("style")
|
|
161
|
+
style.appendChild(SVG.cdata(Style.cssContent))
|
|
162
|
+
return style
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
static bevelFilter(id, inset) {
|
|
166
|
+
const f = new Filter(id)
|
|
167
|
+
|
|
168
|
+
const alpha = "SourceAlpha"
|
|
169
|
+
const s = inset ? -1 : 1
|
|
170
|
+
const blur = f.blur(1, alpha)
|
|
171
|
+
|
|
172
|
+
f.merge([
|
|
173
|
+
"SourceGraphic",
|
|
174
|
+
f.comp(
|
|
175
|
+
"in",
|
|
176
|
+
f.flood("#fff", 0.15),
|
|
177
|
+
f.subtract(alpha, f.offset(+s, +s, blur)),
|
|
178
|
+
),
|
|
179
|
+
f.comp(
|
|
180
|
+
"in",
|
|
181
|
+
f.flood("#000", 0.7),
|
|
182
|
+
f.subtract(alpha, f.offset(-s, -s, blur)),
|
|
183
|
+
),
|
|
184
|
+
])
|
|
185
|
+
|
|
186
|
+
return f.el
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
static darkFilter(id) {
|
|
190
|
+
const f = new Filter(id)
|
|
191
|
+
|
|
192
|
+
f.merge([
|
|
193
|
+
"SourceGraphic",
|
|
194
|
+
f.comp("in", f.flood("#000", 0.2), "SourceAlpha"),
|
|
195
|
+
])
|
|
196
|
+
|
|
197
|
+
return f.el
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
static darkRect(w, h, category, el) {
|
|
201
|
+
return SVG.setProps(
|
|
202
|
+
SVG.group([
|
|
203
|
+
SVG.setProps(el, {
|
|
204
|
+
class: `sb-${category} sb-darker`,
|
|
205
|
+
}),
|
|
206
|
+
]),
|
|
207
|
+
{ width: w, height: h },
|
|
208
|
+
)
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
static get defaultFontFamily() {
|
|
212
|
+
return "Lucida Grande, Verdana, Arial, DejaVu Sans, sans-serif"
|
|
213
|
+
}
|
|
214
|
+
}
|