Skip to content

Commit 9d2954a

Browse files
authored
Merge pull request #25 from cbcode1/release-1.7
Release 1.7.0
2 parents d84c42a + 5f258ac commit 9d2954a

File tree

4 files changed

+9240
-8892
lines changed

4 files changed

+9240
-8892
lines changed

API.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Block Based Code (`@webwriter/block-based-code@1.7.0`)
2+
[License: MIT](LICENSE) | Version: 1.7.0
3+
4+
Write block-based code (e.g. Scratch) and run it.
5+
6+
## Snippets
7+
[Snippets](https://webwriter.app/docs/snippets/snippets/) are examples and templates using the package's widgets.
8+
9+
| Name | Import Path |
10+
| :--: | :---------: |
11+
| Bouncing Dvd | `@webwriter/block-based-code/snippets/bouncing-dvd.html` |
12+
13+
14+
15+
## `WebwriterBlocks` (`<webwriter-block-based-code>`)
16+
The main component of the Blocks widget.
17+
18+
### Usage
19+
20+
Use with a CDN (e.g. [jsdelivr](https://jsdelivr.com)):
21+
```html
22+
<link href="https://cdn.jsdelivr.net/npm/@webwriter/block-based-code/widgets/webwriter-block-based-code.css" rel="stylesheet">
23+
<script type="module" src="https://cdn.jsdelivr.net/npm/@webwriter/block-based-code/widgets/webwriter-block-based-code.js"></script>
24+
<webwriter-block-based-code></webwriter-block-based-code>
25+
```
26+
27+
Or use with a bundler (e.g. [Vite](https://vite.dev)):
28+
29+
```
30+
npm install @webwriter/block-based-code
31+
```
32+
33+
```html
34+
<link href="@webwriter/block-based-code/widgets/webwriter-block-based-code.css" rel="stylesheet">
35+
<script type="module" src="@webwriter/block-based-code/widgets/webwriter-block-based-code.js"></script>
36+
<webwriter-block-based-code></webwriter-block-based-code>
37+
```
38+
39+
## Fields
40+
| Name (Attribute Name) | Type | Description | Default | Reflects |
41+
| :-------------------: | :--: | :---------: | :-----: | :------: |
42+
| `readonly` (`readonly`) | `0 \| 1` | Whether the widget is in read-only mode, only effective when contentEditable is false. | `0` ||
43+
| `stageType` (`stageType`) | `StageType` | The selected stage type. | - ||
44+
| `usableBlocks` (`usableBlocks`) | `SelectedBlocks` | The usable blocks. Only blocks in this list can be used in the editor. | `["events:when_start_clicked"]` ||
45+
| `editorState` (`editorState`) | `object` | The editor state. | `{}` ||
46+
| `WebwriterBlocks.scopedElements` | `Record<string, typeof LitElement>` | - | - ||
47+
| `WebwriterBlocks.shadowRootOptions` | `ShadowRootInit` | - | - ||
48+
49+
*Fields including [properties](https://developer.mozilla.org/en-US/docs/Glossary/Property/JavaScript) and [attributes](https://developer.mozilla.org/en-US/docs/Glossary/Attribute) define the current state of the widget and offer customization options.*
50+
51+
## Editing config
52+
| Name | Value |
53+
| :--: | :---------: |
54+
55+
56+
*The [editing config](https://webwriter.app/docs/packages/configuring/#editingconfig) defines how explorable authoring tools such as [WebWriter](https://webwriter.app) treat the widget.*
57+
58+
*No public methods, slots, events, custom CSS properties, or CSS parts.*
59+
60+
61+
---
62+
*Generated with @webwriter/build@1.9.0*

custom-elements.json

Lines changed: 284 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,284 @@
1+
{
2+
"schemaVersion": "1.0.0",
3+
"readme": "",
4+
"modules": [
5+
{
6+
"kind": "javascript-module",
7+
"path": "widgets/webwriter-block-based-code.ts",
8+
"declarations": [
9+
{
10+
"kind": "class",
11+
"description": "The main component of the Blocks widget.",
12+
"name": "WebwriterBlocks",
13+
"members": [
14+
{
15+
"kind": "field",
16+
"name": "readonly",
17+
"type": {
18+
"text": "0 | 1"
19+
},
20+
"privacy": "public",
21+
"default": "0",
22+
"description": "Whether the widget is in read-only mode, only effective when contentEditable is false.",
23+
"attribute": "readonly",
24+
"reflects": true
25+
},
26+
{
27+
"kind": "field",
28+
"name": "stageType",
29+
"type": {
30+
"text": "StageType"
31+
},
32+
"privacy": "public",
33+
"description": "The selected stage type.",
34+
"attribute": "stageType",
35+
"reflects": true
36+
},
37+
{
38+
"kind": "field",
39+
"name": "usableBlocks",
40+
"type": {
41+
"text": "SelectedBlocks"
42+
},
43+
"privacy": "public",
44+
"default": "[\"events:when_start_clicked\"]",
45+
"description": "The usable blocks. Only blocks in this list can be used in the editor.",
46+
"attribute": "usableBlocks",
47+
"reflects": true
48+
},
49+
{
50+
"kind": "field",
51+
"name": "editorState",
52+
"type": {
53+
"text": "object"
54+
},
55+
"privacy": "public",
56+
"default": "{}",
57+
"description": "The editor state.",
58+
"attribute": "editorState",
59+
"reflects": true
60+
},
61+
{
62+
"kind": "field",
63+
"name": "availableBlocks",
64+
"type": {
65+
"text": "BlockTypes[]"
66+
},
67+
"privacy": "private",
68+
"default": "[]",
69+
"description": "The available blocks. These are all blocks that can be understood by the stage."
70+
},
71+
{
72+
"kind": "field",
73+
"name": "readableCode",
74+
"type": {
75+
"text": "string"
76+
},
77+
"privacy": "private",
78+
"default": "\"\"",
79+
"description": "The readable generated code."
80+
},
81+
{
82+
"kind": "field",
83+
"name": "executableCode",
84+
"type": {
85+
"text": "string"
86+
},
87+
"privacy": "private",
88+
"default": "\"\"",
89+
"description": "The executable generated code."
90+
},
91+
{
92+
"kind": "field",
93+
"name": "editor",
94+
"type": {
95+
"text": "Editor"
96+
},
97+
"privacy": "private",
98+
"description": "The editor element."
99+
},
100+
{
101+
"kind": "field",
102+
"name": "stage",
103+
"type": {
104+
"text": "Stage"
105+
},
106+
"privacy": "private",
107+
"description": "The stage element."
108+
},
109+
{
110+
"kind": "field",
111+
"name": "scopedElements",
112+
"type": {
113+
"text": "Record<string, typeof LitElement>"
114+
},
115+
"privacy": "public",
116+
"static": true,
117+
"readonly": true
118+
},
119+
{
120+
"kind": "field",
121+
"name": "shadowRootOptions",
122+
"type": {
123+
"text": "ShadowRootInit"
124+
},
125+
"privacy": "public",
126+
"static": true,
127+
"readonly": true
128+
},
129+
{
130+
"kind": "field",
131+
"name": "isFullscreen",
132+
"type": {
133+
"text": "boolean"
134+
},
135+
"privacy": "private",
136+
"description": "Whether the editor is in fullscreen mode.",
137+
"readonly": true
138+
},
139+
{
140+
"kind": "method",
141+
"name": "handleFullscreenToggle",
142+
"privacy": "private",
143+
"description": "Handles the fullscreen toggle event."
144+
},
145+
{
146+
"kind": "method",
147+
"name": "handleEditorChange",
148+
"privacy": "private",
149+
"return": {
150+
"type": {
151+
"text": "void"
152+
}
153+
},
154+
"parameters": [
155+
{
156+
"name": "event",
157+
"type": {
158+
"text": "EditorChangeEvent"
159+
},
160+
"description": "The editor change event."
161+
}
162+
],
163+
"description": "Handles the editor change event."
164+
},
165+
{
166+
"kind": "method",
167+
"name": "handleCodeHighlighting",
168+
"privacy": "private",
169+
"return": {
170+
"type": {
171+
"text": "void"
172+
}
173+
},
174+
"parameters": [
175+
{
176+
"name": "event",
177+
"type": {
178+
"text": "CodeHighlightingEvent"
179+
},
180+
"description": "The code highlighting event."
181+
}
182+
],
183+
"description": "Handles the code highlighting event."
184+
},
185+
{
186+
"kind": "method",
187+
"name": "handleOptionsChange",
188+
"privacy": "private",
189+
"return": {
190+
"type": {
191+
"text": "Promise<void>"
192+
}
193+
},
194+
"parameters": [
195+
{
196+
"name": "event",
197+
"type": {
198+
"text": "OptionsChangeEvent"
199+
},
200+
"description": "The options change event."
201+
}
202+
],
203+
"description": "Handles the options change event."
204+
},
205+
{
206+
"kind": "method",
207+
"name": "setBlocks",
208+
"privacy": "private",
209+
"return": {
210+
"type": {
211+
"text": "void"
212+
}
213+
},
214+
"description": "Sets the available and usable blocks after changing the stage type."
215+
}
216+
],
217+
"attributes": [
218+
{
219+
"name": "readonly",
220+
"type": {
221+
"text": "0 | 1"
222+
},
223+
"default": "0",
224+
"description": "Whether the widget is in read-only mode, only effective when contentEditable is false.",
225+
"fieldName": "readonly"
226+
},
227+
{
228+
"name": "stageType",
229+
"type": {
230+
"text": "StageType"
231+
},
232+
"description": "The selected stage type.",
233+
"fieldName": "stageType"
234+
},
235+
{
236+
"name": "usableBlocks",
237+
"type": {
238+
"text": "SelectedBlocks"
239+
},
240+
"default": "[\"events:when_start_clicked\"]",
241+
"description": "The usable blocks. Only blocks in this list can be used in the editor.",
242+
"fieldName": "usableBlocks"
243+
},
244+
{
245+
"name": "editorState",
246+
"type": {
247+
"text": "object"
248+
},
249+
"default": "{}",
250+
"description": "The editor state.",
251+
"fieldName": "editorState"
252+
}
253+
],
254+
"superclass": {
255+
"name": "LitElementWw",
256+
"package": "@webwriter/lit"
257+
},
258+
"tagName": "webwriter-block-based-code",
259+
"customElement": true,
260+
"modulePath": "widgets/webwriter-block-based-code.ts",
261+
"definitionPath": "widgets/webwriter-block-based-code.ts"
262+
}
263+
],
264+
"exports": [
265+
{
266+
"kind": "js",
267+
"name": "WebwriterBlocks",
268+
"declaration": {
269+
"name": "WebwriterBlocks",
270+
"module": "widgets/webwriter-block-based-code.ts"
271+
}
272+
},
273+
{
274+
"kind": "custom-element-definition",
275+
"name": "webwriter-block-based-code",
276+
"declaration": {
277+
"name": "WebwriterBlocks",
278+
"module": "widgets/webwriter-block-based-code.ts"
279+
}
280+
}
281+
]
282+
}
283+
]
284+
}

0 commit comments

Comments
 (0)