blockly 10.3.0-beta.0 → 10.3.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/README.md +48 -34
- package/blockly.min.js +269 -258
- package/blockly_compressed.js +232 -224
- package/blockly_compressed.js.map +1 -1
- package/blocks_compressed.js.map +1 -1
- package/core/block.d.ts +2 -0
- package/core/block_dragger.d.ts +7 -3
- package/core/block_svg.d.ts +11 -13
- package/core/events/events_block_field_intermediate_change.d.ts +6 -0
- package/core/field.d.ts +18 -0
- package/core/field_input.d.ts +6 -1
- package/core/flyout_base.d.ts +9 -1
- package/core/gesture.d.ts +2 -2
- package/core/icons/comment_icon.d.ts +1 -0
- package/core/icons/icon.d.ts +19 -0
- package/core/icons/mutator_icon.d.ts +1 -0
- package/core/icons/warning_icon.d.ts +1 -0
- package/core/interfaces/i_icon.d.ts +8 -0
- package/core/interfaces/i_rendered_element.d.ts +19 -0
- package/core/layer_manager.d.ts +74 -0
- package/core/layers.d.ts +18 -0
- package/core/rendered_connection.d.ts +0 -6
- package/core/serialization/blocks.d.ts +2 -1
- package/core/workspace_svg.d.ts +14 -1
- package/dart_compressed.js +14 -11
- package/dart_compressed.js.map +1 -1
- package/javascript_compressed.js +37 -34
- package/javascript_compressed.js.map +1 -1
- package/lua_compressed.js +14 -13
- package/lua_compressed.js.map +1 -1
- package/package.json +2 -2
- package/php_compressed.js +26 -22
- package/php_compressed.js.map +1 -1
- package/python_compressed.js +14 -12
- package/python_compressed.js.map +1 -1
package/README.md
CHANGED
|
@@ -5,26 +5,10 @@ blocks together to build programs. All code is free and open source.
|
|
|
5
5
|
|
|
6
6
|
The source for this module is in the [Blockly repo](http://github.com/google/blockly).
|
|
7
7
|
|
|
8
|
-
## Installation
|
|
9
|
-
|
|
10
|
-
You can install this package either via `npm` or `unpkg`.
|
|
11
|
-
|
|
12
|
-
### npm
|
|
13
|
-
|
|
14
|
-
```bash
|
|
15
|
-
npm install blockly
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
### unpkg
|
|
19
|
-
|
|
20
|
-
```html
|
|
21
|
-
<script src="https://unpkg.com/blockly/blockly.min.js"></script>
|
|
22
|
-
```
|
|
23
|
-
|
|
24
8
|
## Example Usage
|
|
25
9
|
|
|
26
10
|
```js
|
|
27
|
-
import Blockly from 'blockly';
|
|
11
|
+
import * as Blockly from 'blockly/core';
|
|
28
12
|
Blockly.inject('blocklyDiv', {
|
|
29
13
|
...
|
|
30
14
|
})
|
|
@@ -34,46 +18,76 @@ Blockly.inject('blocklyDiv', {
|
|
|
34
18
|
|
|
35
19
|
For samples on how to integrate Blockly into your project, view the list of samples at [blockly-samples](https://github.com/google/blockly-samples).
|
|
36
20
|
|
|
37
|
-
|
|
21
|
+
## Installation
|
|
38
22
|
|
|
39
|
-
|
|
40
|
-
Blockly core, Blockly built-in blocks, the JavaScript generator and the English lang files.
|
|
23
|
+
You can install this package either via `npm` or `unpkg`.
|
|
41
24
|
|
|
42
|
-
|
|
25
|
+
### unpkg
|
|
26
|
+
|
|
27
|
+
```html
|
|
28
|
+
<script src="https://unpkg.com/blockly/blockly.min.js"></script>
|
|
29
|
+
```
|
|
43
30
|
|
|
44
|
-
|
|
31
|
+
When importing from unpkg, you can access imports from the global namespace.
|
|
45
32
|
|
|
46
33
|
```js
|
|
47
|
-
|
|
34
|
+
// Access Blockly.
|
|
35
|
+
Blockly.thing;
|
|
36
|
+
// Access the default blocks.
|
|
37
|
+
Blockly.Blocks['block_type'];
|
|
38
|
+
// Access the javascript generator.
|
|
39
|
+
javascript.javascriptGenerator;
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### npm
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npm install blockly
|
|
48
46
|
```
|
|
49
47
|
|
|
50
|
-
|
|
48
|
+
## Imports
|
|
49
|
+
|
|
50
|
+
Note: Using import of our package targets requires you to use a bundler (like webpack), since Blockly is packaged as a UMD, rather than an ESM.
|
|
51
51
|
|
|
52
52
|
```js
|
|
53
|
+
// Import Blockly core.
|
|
54
|
+
import * as Blockly from 'blockly/core';
|
|
55
|
+
// Import the default blocks.
|
|
53
56
|
import * as libraryBlocks from 'blockly/blocks';
|
|
57
|
+
// Import a generator.
|
|
58
|
+
import {javascriptGenerator} from 'blockly/javascript';
|
|
59
|
+
// Import a message file.
|
|
60
|
+
import * as En from 'blockly/msg/en';
|
|
54
61
|
```
|
|
55
62
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
If your application needs to generate code from the Blockly blocks, you'll want to include a generator.
|
|
63
|
+
## Requires
|
|
59
64
|
|
|
60
65
|
```js
|
|
61
|
-
|
|
66
|
+
// Require Blockly core.
|
|
67
|
+
const Blockly = require('blockly/core');
|
|
68
|
+
// Require the default blocks.
|
|
69
|
+
const libraryBlocks = require('blockly/blocks');
|
|
70
|
+
// Require a generator.
|
|
71
|
+
const {javascriptGenerator} = require('blockly/javascript');
|
|
72
|
+
// Require a message file.
|
|
73
|
+
const En = require('blockly/msg/en');
|
|
62
74
|
```
|
|
63
75
|
|
|
64
|
-
|
|
76
|
+
## Applying messages
|
|
65
77
|
|
|
66
|
-
|
|
78
|
+
Once you have the message files, you also need to apply them.
|
|
67
79
|
|
|
68
80
|
```js
|
|
69
|
-
|
|
70
|
-
Blockly.setLocale(Fr);
|
|
81
|
+
Blockly.setLocal(En);
|
|
71
82
|
```
|
|
72
83
|
|
|
73
|
-
To import the French lang files. Once you've imported the specific lang module, you'll also want to set the locale in Blockly.
|
|
74
|
-
|
|
75
84
|
For a full list of supported Blockly locales, see: [https://github.com/google/blockly/tree/master/msg/js](https://github.com/google/blockly/tree/master/msg/js)
|
|
76
85
|
|
|
86
|
+
## Docs
|
|
87
|
+
|
|
88
|
+
For more information about how to use Blockly, check out our
|
|
89
|
+
[devsite](https://developers.google.com/blockly/guides/overview).
|
|
90
|
+
|
|
77
91
|
## License
|
|
78
92
|
|
|
79
93
|
Apache 2.0
|