react-native-blockly 0.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 (51) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +91 -0
  3. package/lib/module/classes/blockly.js +24 -0
  4. package/lib/module/classes/blockly.js.map +1 -0
  5. package/lib/module/classes/blocklyViewConfig.js +39 -0
  6. package/lib/module/classes/blocklyViewConfig.js.map +1 -0
  7. package/lib/module/index.js +60 -0
  8. package/lib/module/index.js.map +1 -0
  9. package/lib/module/package.json +1 -0
  10. package/lib/module/parsers/parseToString.js +86 -0
  11. package/lib/module/parsers/parseToString.js.map +1 -0
  12. package/lib/module/parsers/stringToBlockly.js +87 -0
  13. package/lib/module/parsers/stringToBlockly.js.map +1 -0
  14. package/lib/module/types/blockly-types.d.js +4 -0
  15. package/lib/module/types/blockly-types.d.js.map +1 -0
  16. package/lib/module/types/blockly-view-types.d.js +4 -0
  17. package/lib/module/types/blockly-view-types.d.js.map +1 -0
  18. package/lib/module/utils/blocklyConstants.js +36 -0
  19. package/lib/module/utils/blocklyConstants.js.map +1 -0
  20. package/lib/module/utils/defaults.js +20 -0
  21. package/lib/module/utils/defaults.js.map +1 -0
  22. package/lib/module/utils/showWarnings.js +75 -0
  23. package/lib/module/utils/showWarnings.js.map +1 -0
  24. package/lib/typescript/package.json +1 -0
  25. package/lib/typescript/src/classes/blockly.d.ts +16 -0
  26. package/lib/typescript/src/classes/blockly.d.ts.map +1 -0
  27. package/lib/typescript/src/classes/blocklyViewConfig.d.ts +14 -0
  28. package/lib/typescript/src/classes/blocklyViewConfig.d.ts.map +1 -0
  29. package/lib/typescript/src/index.d.ts +16 -0
  30. package/lib/typescript/src/index.d.ts.map +1 -0
  31. package/lib/typescript/src/parsers/parseToString.d.ts +47 -0
  32. package/lib/typescript/src/parsers/parseToString.d.ts.map +1 -0
  33. package/lib/typescript/src/parsers/stringToBlockly.d.ts +14 -0
  34. package/lib/typescript/src/parsers/stringToBlockly.d.ts.map +1 -0
  35. package/lib/typescript/src/utils/blocklyConstants.d.ts +17 -0
  36. package/lib/typescript/src/utils/blocklyConstants.d.ts.map +1 -0
  37. package/lib/typescript/src/utils/defaults.d.ts +10 -0
  38. package/lib/typescript/src/utils/defaults.d.ts.map +1 -0
  39. package/lib/typescript/src/utils/showWarnings.d.ts +15 -0
  40. package/lib/typescript/src/utils/showWarnings.d.ts.map +1 -0
  41. package/package.json +155 -0
  42. package/src/classes/blockly.ts +25 -0
  43. package/src/classes/blocklyViewConfig.ts +36 -0
  44. package/src/index.tsx +65 -0
  45. package/src/parsers/parseToString.ts +92 -0
  46. package/src/parsers/stringToBlockly.ts +89 -0
  47. package/src/types/blockly-types.d.ts +28 -0
  48. package/src/types/blockly-view-types.d.ts +89 -0
  49. package/src/utils/blocklyConstants.ts +92 -0
  50. package/src/utils/defaults.ts +19 -0
  51. package/src/utils/showWarnings.ts +93 -0
package/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 AlanSilvaaa
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,91 @@
1
+ <div align=center>
2
+ <img src="react-native-blockly-logo.png" alt="React native blockly logo" width="400">
3
+ </div>
4
+
5
+ <div align="center">
6
+
7
+ [![Lint](https://img.shields.io/github/actions/workflow/status/AlanSilvaaa/react-native-blockly/ci.yml?branch=main&label=lint&logo=eslint)](https://github.com/AlanSilvaaa/react-native-blockly/actions/workflows/ci.yml)
8
+ [![Test](https://img.shields.io/github/actions/workflow/status/AlanSilvaaa/react-native-blockly/ci.yml?branch=main&label=test&logo=jest)](https://github.com/AlanSilvaaa/react-native-blockly/actions/workflows/ci.yml)
9
+ [![Build Library](https://img.shields.io/github/actions/workflow/status/AlanSilvaaa/react-native-blockly/ci.yml?branch=main&label=build%20library&logo=typescript)](https://github.com/AlanSilvaaa/react-native-blockly/actions/workflows/ci.yml)
10
+ [![Build Web](https://img.shields.io/github/actions/workflow/status/AlanSilvaaa/react-native-blockly/ci.yml?branch=main&label=build%20web&logo=expo)](https://github.com/AlanSilvaaa/react-native-blockly/actions/workflows/ci.yml)
11
+
12
+ </div>
13
+
14
+ npm package that serves as a bridge between React Native and Google's [Blockly](https://developers.google.com/blockly) UNPKG version
15
+
16
+ ## General Overview
17
+
18
+ This library bridges Google's Blockly visual programming framework with React Native by wrapping a WebView component. Some of the characteristics of the package are:
19
+
20
+ - **Block Management**: Define custom blocks with configurable properties (type, messages, colors, tooltips, connections)
21
+ - **Toolbox Configuration**: Create dynamic toolboxes with organized block categories and accessibility controls
22
+ - **Workspace Customization**: Configure workspace behavior including scrolling, trash can, and visual settings
23
+ - **HTML Generation**: Automatically transpile block definitions and configurations into executable HTML/JavaScript
24
+ - **Validation System**: Built-in validation to ensure block-toolbox consistency and prevent runtime errors
25
+ - **WebView Integration**: Seamless embedding of Blockly workspace within React Native components using react-native-webview
26
+
27
+ > [!IMPORTANT]
28
+ > Beause we are using the UNPKG version, somethings may not work the way the npm version of Blockly does, as stated by Google [here](https://developers.google.com/blockly/guides/get-started/get-the-code#unpkg).
29
+
30
+ ## Installation
31
+ use npm or yarn to install the package:
32
+ ```bash
33
+ npm install react-native-blockly
34
+ ```
35
+
36
+ ## Usage
37
+ Here is a simple example of how to use the library:
38
+ ```tsx
39
+ import BlocklyView, { Blockly, BlocklyViewConfig } from 'react-native-blockly'
40
+
41
+ const blockly = new Blockly();
42
+ const config = new BlocklyViewConfig();
43
+
44
+ blockly.createBlock({
45
+ type: 'helloWorld',
46
+ message0: 'Hello World',
47
+ output: null,
48
+ colour: 230,
49
+ tooltip: 'Command to say hello',
50
+ helpUrl: '',
51
+ code: 'return "Hello World!"'
52
+ });
53
+
54
+ config.setToolbox({
55
+ kind: 'flyoutToolbox',
56
+ contents: [
57
+ {
58
+ kind: 'block',
59
+ type: 'helloWorld'
60
+ }
61
+ ]
62
+ });
63
+
64
+ function onMessage(data: string) {
65
+ console.log('Message from Blockly:', data); // on this case, data would be "Hello World!"
66
+ }
67
+
68
+ export default function App() {
69
+ return (
70
+ <BlocklyView Blockly={blockly} Config={config} onMessage={onMessage} />
71
+ );
72
+ }
73
+ ```
74
+
75
+ To see more examples, check the [examples directory](./example).
76
+
77
+
78
+ ## Contributing
79
+
80
+ See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
81
+
82
+ ## License
83
+
84
+ MIT
85
+
86
+ ## Author
87
+ [@AlanSilvaaa](https://github.com/AlanSilvaaa)
88
+
89
+ ---
90
+
91
+ Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Blockly class to manage blockly configuration.
5
+ */
6
+ export class Blockly {
7
+ blocks = [];
8
+ createBlocks(blocks) {
9
+ this.blocks.push(...blocks);
10
+ }
11
+
12
+ /**
13
+ * Creates a blockly block and add it to the blocks array.
14
+ *
15
+ * @param block - Block object to be added to the blocks array
16
+ */
17
+ createBlock(block) {
18
+ this.blocks.push(block);
19
+ }
20
+ getBlocks() {
21
+ return this.blocks;
22
+ }
23
+ }
24
+ //# sourceMappingURL=blockly.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Blockly","blocks","createBlocks","push","createBlock","block","getBlocks"],"sourceRoot":"..\\..\\..\\src","sources":["classes/blockly.ts"],"mappings":";;AAEA;AACA;AACA;AACA,OAAO,MAAMA,OAAO,CAAC;EACnBC,MAAM,GAAY,EAAE;EAEpBC,YAAYA,CAACD,MAAe,EAAQ;IAClC,IAAI,CAACA,MAAM,CAACE,IAAI,CAAC,GAAGF,MAAM,CAAC;EAC7B;;EAEA;AACF;AACA;AACA;AACA;EACEG,WAAWA,CAACC,KAAY,EAAQ;IAC9B,IAAI,CAACJ,MAAM,CAACE,IAAI,CAACE,KAAK,CAAC;EACzB;EAEAC,SAASA,CAAA,EAAY;IACnB,OAAO,IAAI,CAACL,MAAM;EACpB;AACF","ignoreList":[]}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+
3
+ import { DEFAULT_BUTTON_TEXT, DEFAULT_BUTTON_STYLE } from "../utils/defaults.js";
4
+ export class BlocklyViewConfig {
5
+ toolbox = {
6
+ kind: '',
7
+ contents: []
8
+ };
9
+ workspace = {
10
+ scrollbars: false,
11
+ trashcan: false
12
+ };
13
+ buttonConfig = {
14
+ text: DEFAULT_BUTTON_TEXT,
15
+ style: DEFAULT_BUTTON_STYLE
16
+ };
17
+ setToolbox(toolbox) {
18
+ this.toolbox = toolbox;
19
+ }
20
+ getToolbox() {
21
+ return this.toolbox;
22
+ }
23
+ setWorkspace(workspace) {
24
+ this.workspace = workspace;
25
+ }
26
+ getWorkspace() {
27
+ return this.workspace;
28
+ }
29
+ setButtonConfig(buttonConfig) {
30
+ this.buttonConfig = {
31
+ ...this.buttonConfig,
32
+ ...buttonConfig
33
+ };
34
+ }
35
+ getButtonConfig() {
36
+ return this.buttonConfig;
37
+ }
38
+ }
39
+ //# sourceMappingURL=blocklyViewConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["DEFAULT_BUTTON_TEXT","DEFAULT_BUTTON_STYLE","BlocklyViewConfig","toolbox","kind","contents","workspace","scrollbars","trashcan","buttonConfig","text","style","setToolbox","getToolbox","setWorkspace","getWorkspace","setButtonConfig","getButtonConfig"],"sourceRoot":"..\\..\\..\\src","sources":["classes/blocklyViewConfig.ts"],"mappings":";;AAEA,SAASA,mBAAmB,EAAEC,oBAAoB,QAAQ,sBAAmB;AAE7E,OAAO,MAAMC,iBAAiB,CAAC;EAC7BC,OAAO,GAAY;IAAEC,IAAI,EAAE,EAAE;IAAEC,QAAQ,EAAE;EAAG,CAAC;EAC7CC,SAAS,GAAc;IAAEC,UAAU,EAAE,KAAK;IAAEC,QAAQ,EAAE;EAAM,CAAC;EAC7DC,YAAY,GAAiB;IAC3BC,IAAI,EAAEV,mBAAmB;IACzBW,KAAK,EAAEV;EACT,CAAC;EAEDW,UAAUA,CAACT,OAAgB,EAAQ;IACjC,IAAI,CAACA,OAAO,GAAGA,OAAO;EACxB;EAEAU,UAAUA,CAAA,EAAY;IACpB,OAAO,IAAI,CAACV,OAAO;EACrB;EAEAW,YAAYA,CAACR,SAAoB,EAAQ;IACvC,IAAI,CAACA,SAAS,GAAGA,SAAS;EAC5B;EAEAS,YAAYA,CAAA,EAAc;IACxB,OAAO,IAAI,CAACT,SAAS;EACvB;EAEAU,eAAeA,CAACP,YAA0B,EAAQ;IAChD,IAAI,CAACA,YAAY,GAAG;MAAE,GAAG,IAAI,CAACA,YAAY;MAAE,GAAGA;IAAa,CAAC;EAC/D;EAEAQ,eAAeA,CAAA,EAAiB;IAC9B,OAAO,IAAI,CAACR,YAAY;EAC1B;AACF","ignoreList":[]}
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+
3
+ import WebView from 'react-native-webview';
4
+ import { parseBlocksToString, parseToolboxToString, parseWorkspaceToString, parseButtonConfigToString } from "./parsers/parseToString.js";
5
+ import { stringToBlockly } from "./parsers/stringToBlockly.js";
6
+ import { Blockly } from "./classes/blockly.js";
7
+ import { BlocklyViewConfig } from "./classes/blocklyViewConfig.js";
8
+ import { blockInToolbox, noReturnStatement } from "./utils/showWarnings.js";
9
+
10
+ // Export both classes so they can be imported by users
11
+ import { jsx as _jsx } from "react/jsx-runtime";
12
+ export { Blockly, BlocklyViewConfig };
13
+ /**
14
+ * BlocklyView wrapper for rendering the Blockly workspace.
15
+ *
16
+ * It takes an instance of the Blockly class, a BlocklyViewConfig instance, and an optional onMessage callback and
17
+ * parses the contents to generate an HTML and load it on the WebView.
18
+ *
19
+ * @param param0 - Props for the component
20
+ * @returns JSX.Element
21
+ */
22
+ export default function BlocklyView({
23
+ Blockly,
24
+ Config,
25
+ onMessage,
26
+ style
27
+ }) {
28
+ /**
29
+ * parse the contents of the Blockly instance and Config to generate the HTML string
30
+ * that will be loaded in the WebView.
31
+ */
32
+ const blocks = parseBlocksToString(Blockly.getBlocks());
33
+ const toolbox = parseToolboxToString(Config.getToolbox());
34
+ const workspace = parseWorkspaceToString(Config.getWorkspace());
35
+ const buttonConfig = parseButtonConfigToString(Config.getButtonConfig());
36
+ const blocklyHtml = stringToBlockly(blocks, toolbox, workspace, buttonConfig);
37
+
38
+ /**
39
+ * Show warnings
40
+ */
41
+ blockInToolbox(Blockly.getBlocks(), Config.getToolbox());
42
+ noReturnStatement(Blockly.getBlocks());
43
+ return /*#__PURE__*/_jsx(WebView, {
44
+ originWhitelist: ['*'],
45
+ source: {
46
+ html: blocklyHtml,
47
+ baseUrl: 'file:///android_asset/'
48
+ },
49
+ style: style || {
50
+ flex: 1
51
+ },
52
+ onMessage: event => {
53
+ // console.log('Message received from webview:', event.nativeEvent.data);
54
+ if (onMessage) {
55
+ onMessage(event.nativeEvent.data); // Call the callback with the data
56
+ }
57
+ }
58
+ });
59
+ }
60
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["WebView","parseBlocksToString","parseToolboxToString","parseWorkspaceToString","parseButtonConfigToString","stringToBlockly","Blockly","BlocklyViewConfig","blockInToolbox","noReturnStatement","jsx","_jsx","BlocklyView","Config","onMessage","style","blocks","getBlocks","toolbox","getToolbox","workspace","getWorkspace","buttonConfig","getButtonConfig","blocklyHtml","originWhitelist","source","html","baseUrl","flex","event","nativeEvent","data"],"sourceRoot":"..\\..\\src","sources":["index.tsx"],"mappings":";;AAAA,OAAOA,OAAO,MAAM,sBAAsB;AAK1C,SACEC,mBAAmB,EACnBC,oBAAoB,EACpBC,sBAAsB,EACtBC,yBAAyB,QACpB,4BAAyB;AAChC,SAASC,eAAe,QAAQ,8BAA2B;AAC3D,SAASC,OAAO,QAAQ,sBAAmB;AAC3C,SAASC,iBAAiB,QAAQ,gCAA6B;AAC/D,SAASC,cAAc,EAAEC,iBAAiB,QAAQ,yBAAsB;;AAExE;AAAA,SAAAC,GAAA,IAAAC,IAAA;AACA,SAASL,OAAO,EAAEC,iBAAiB;AAGnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASK,WAAWA,CAAC;EAClCN,OAAO;EACPO,MAAM;EACNC,SAAS;EACTC;AACgB,CAAC,EAAE;EACnB;AACF;AACA;AACA;EACE,MAAMC,MAAM,GAAGf,mBAAmB,CAACK,OAAO,CAACW,SAAS,CAAC,CAAC,CAAC;EACvD,MAAMC,OAAO,GAAGhB,oBAAoB,CAACW,MAAM,CAACM,UAAU,CAAC,CAAC,CAAC;EACzD,MAAMC,SAAS,GAAGjB,sBAAsB,CAACU,MAAM,CAACQ,YAAY,CAAC,CAAC,CAAC;EAC/D,MAAMC,YAAY,GAAGlB,yBAAyB,CAACS,MAAM,CAACU,eAAe,CAAC,CAAC,CAAC;EACxE,MAAMC,WAAW,GAAGnB,eAAe,CAACW,MAAM,EAAEE,OAAO,EAAEE,SAAS,EAAEE,YAAY,CAAC;;EAE7E;AACF;AACA;EACEd,cAAc,CAACF,OAAO,CAACW,SAAS,CAAC,CAAC,EAAEJ,MAAM,CAACM,UAAU,CAAC,CAAC,CAAC;EACxDV,iBAAiB,CAACH,OAAO,CAACW,SAAS,CAAC,CAAC,CAAC;EAEtC,oBACEN,IAAA,CAACX,OAAO;IACNyB,eAAe,EAAE,CAAC,GAAG,CAAE;IACvBC,MAAM,EAAE;MAAEC,IAAI,EAAEH,WAAW;MAAEI,OAAO,EAAE;IAAyB,CAAE;IACjEb,KAAK,EAAEA,KAAK,IAAI;MAAEc,IAAI,EAAE;IAAE,CAAE;IAC5Bf,SAAS,EAAGgB,KAAK,IAAK;MACpB;MACA,IAAIhB,SAAS,EAAE;QACbA,SAAS,CAACgB,KAAK,CAACC,WAAW,CAACC,IAAI,CAAC,CAAC,CAAC;MACrC;IACF;EAAE,CACH,CAAC;AAEN","ignoreList":[]}
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Parses the blocks array to a string representation.
5
+ *
6
+ * If the block has a 'code' property, it uses that as the code generation logic.
7
+ * Otherwise, it defaults to returning a function call with the block type name.
8
+ * e.g. for a block of type 'moveForward', it will generate code: `return 'moveForward()\n'`; if
9
+ * no code property is provided.
10
+ *
11
+ * @param blocks - array of Block objects
12
+ * @returns a string representation of the blocks in JSON format
13
+ */
14
+ export function parseBlocksToString(blocks) {
15
+ let htmlString = '';
16
+ blocks.forEach(block => {
17
+ htmlString += `
18
+ Blockly.defineBlocksWithJsonArray([
19
+ {
20
+ "type": "${block.type}",
21
+ "message0": "${block.message0}",
22
+ "colour": ${block.colour || 230},
23
+ "tooltip": "${block.tooltip || 'No tooltip'}",
24
+ "previousStatement": null,
25
+ "nextStatement": null,
26
+ "helpUrl": ""
27
+ }
28
+ ]);
29
+
30
+ javascript.javascriptGenerator.forBlock['${block.type}'] = function (block) {
31
+ ${block.code ? block.code : `return '${block.type}()\\n'`};
32
+ };
33
+ `;
34
+ });
35
+ return htmlString;
36
+ }
37
+
38
+ /**
39
+ * Parses the toolbox object to a string representation.
40
+ *
41
+ * @param toolbox - toolbox object
42
+ * @returns a string representation of the toolbox in JSON format
43
+ */
44
+ export function parseToolboxToString(toolbox) {
45
+ return JSON.stringify(toolbox);
46
+ }
47
+
48
+ /**
49
+ * Parses the workspace object to a string representation.
50
+ *
51
+ * @param workspace - workspace object
52
+ * @returns a string representation of the workspace in JSON format
53
+ */
54
+ export function parseWorkspaceToString(workspace) {
55
+ return JSON.stringify(workspace);
56
+ }
57
+
58
+ /**
59
+ * Converts a CSSProperties object to an inline style string
60
+ *
61
+ * @param styles CSS properties object
62
+ * @returns inline style string
63
+ */
64
+ export function cssObjectToString(styles) {
65
+ return Object.entries(styles).map(([key, value]) => {
66
+ // Convert camelCase to kebab-case
67
+ const kebabKey = key.replace(/([A-Z])/g, '-$1').toLowerCase();
68
+ return `${kebabKey}: ${value}`;
69
+ }).join('; ');
70
+ }
71
+
72
+ /**
73
+ * Parses the button configuration to string representation.
74
+ *
75
+ * @param buttonConfig - button configuration object
76
+ * @returns an object with text and style as strings
77
+ */
78
+ export function parseButtonConfigToString(buttonConfig) {
79
+ const text = buttonConfig?.text ?? '';
80
+ const style = buttonConfig?.style ? cssObjectToString(buttonConfig.style) : '';
81
+ return {
82
+ text,
83
+ style
84
+ };
85
+ }
86
+ //# sourceMappingURL=parseToString.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["parseBlocksToString","blocks","htmlString","forEach","block","type","message0","colour","tooltip","code","parseToolboxToString","toolbox","JSON","stringify","parseWorkspaceToString","workspace","cssObjectToString","styles","Object","entries","map","key","value","kebabKey","replace","toLowerCase","join","parseButtonConfigToString","buttonConfig","text","style"],"sourceRoot":"..\\..\\..\\src","sources":["parsers/parseToString.ts"],"mappings":";;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,mBAAmBA,CAACC,MAAe,EAAU;EAC3D,IAAIC,UAAU,GAAG,EAAE;EACnBD,MAAM,CAACE,OAAO,CAAEC,KAAY,IAAK;IAC/BF,UAAU,IAAI;AAClB;AACA;AACA,qBAAqBE,KAAK,CAACC,IAAI;AAC/B,yBAAyBD,KAAK,CAACE,QAAQ;AACvC,sBAAsBF,KAAK,CAACG,MAAM,IAAI,GAAG;AACzC,wBAAwBH,KAAK,CAACI,OAAO,IAAI,YAAY;AACrD;AACA;AACA;AACA;AACA;AACA;AACA,iDAAiDJ,KAAK,CAACC,IAAI;AAC3D,UAAUD,KAAK,CAACK,IAAI,GAAGL,KAAK,CAACK,IAAI,GAAG,WAAWL,KAAK,CAACC,IAAI,QAAQ;AACjE;AACA,KAAK;EACH,CAAC,CAAC;EACF,OAAOH,UAAU;AACnB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASQ,oBAAoBA,CAACC,OAAgB,EAAU;EAC7D,OAAOC,IAAI,CAACC,SAAS,CAACF,OAAO,CAAC;AAChC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASG,sBAAsBA,CAACC,SAAoB,EAAU;EACnE,OAAOH,IAAI,CAACC,SAAS,CAACE,SAAS,CAAC;AAClC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,iBAAiBA,CAACC,MAAqB,EAAU;EAC/D,OAAOC,MAAM,CAACC,OAAO,CAACF,MAAM,CAAC,CAC1BG,GAAG,CAAC,CAAC,CAACC,GAAG,EAAEC,KAAK,CAAC,KAAK;IACrB;IACA,MAAMC,QAAQ,GAAGF,GAAG,CAACG,OAAO,CAAC,UAAU,EAAE,KAAK,CAAC,CAACC,WAAW,CAAC,CAAC;IAC7D,OAAO,GAAGF,QAAQ,KAAKD,KAAK,EAAE;EAChC,CAAC,CAAC,CACDI,IAAI,CAAC,IAAI,CAAC;AACf;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,yBAAyBA,CAACC,YAA0B,EAGlE;EACA,MAAMC,IAAI,GAAGD,YAAY,EAAEC,IAAI,IAAI,EAAE;EACrC,MAAMC,KAAK,GAAGF,YAAY,EAAEE,KAAK,GAC7Bd,iBAAiB,CAACY,YAAY,CAACE,KAAK,CAAC,GACrC,EAAE;EAEN,OAAO;IAAED,IAAI;IAAEC;EAAM,CAAC;AACxB","ignoreList":[]}
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+
3
+ import { DEFAULT_BUTTON_TEXT, DEFAULT_BUTTON_STYLE } from "../utils/defaults.js";
4
+ import { cssObjectToString } from "./parseToString.js";
5
+
6
+ /**
7
+ * Main function to convert all of the characteristics of a Blockly instance into a string
8
+ *
9
+ * @param blocks blocks string
10
+ * @param toolbox toolbox string
11
+ * @param workspace workspace string (JSON stringified workspace configuration)
12
+ * @param buttonConfig parsed button configuration with text and style as strings
13
+ * @returns a complete HTML string ready to be loaded in the WebView
14
+ */
15
+ export function stringToBlockly(blocks, toolbox, workspace, buttonConfig) {
16
+ return `
17
+ <!DOCTYPE html>
18
+ <html>
19
+ <head>
20
+ <meta charset="utf-8" />
21
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
22
+ <title>Custom Blockly Block</title>
23
+ <style>
24
+ html, body {
25
+ font-family: Arial, sans-serif;
26
+ margin: 0;
27
+ padding: 0;
28
+ width: 100%;
29
+ height: 100%;
30
+ overflow: hidden;
31
+ }
32
+ body {
33
+ display: flex;
34
+ flex-direction: column;
35
+ }
36
+ #blocklyDiv {
37
+ flex: 1;
38
+ width: 100%;
39
+ }
40
+ </style>
41
+ </head>
42
+ <body>
43
+ <div id="blocklyDiv"></div>
44
+ <button id="runCodeButton" style="${buttonConfig.style || cssObjectToString(DEFAULT_BUTTON_STYLE)}">${buttonConfig.text || DEFAULT_BUTTON_TEXT}</button>
45
+
46
+ <!-- Import required Blockly packages -->
47
+ <script src="https://unpkg.com/blockly/blockly_compressed.js"></script>
48
+ <script src="https://unpkg.com/blockly/blocks_compressed.js"></script>
49
+ <script src="https://unpkg.com/blockly/javascript_compressed.js"></script>
50
+ <script src="https://unpkg.com/blockly/msg/en.js"></script>
51
+ <script>
52
+ // Define the custom block using JSON
53
+ console.log('Blockly namespace:', typeof Blockly);
54
+ console.log('Blockly.JavaScript namespace:', typeof Blockly.JavaScript);
55
+ console.log('javascript.javascriptGenerator:', typeof javascript.javascriptGenerator);
56
+
57
+ ${blocks ?? ''}
58
+
59
+ // Define the toolbox with the custom block
60
+ const toolbox = ${toolbox || `{}`};
61
+
62
+ // Parse workspace configuration
63
+ const workspaceConfig = ${workspace || `{}`};
64
+
65
+ // Inject Blockly into the workspace
66
+ const workspace = Blockly.inject('blocklyDiv', {
67
+ toolbox: toolbox,
68
+ ...workspaceConfig,
69
+ });
70
+
71
+ // Run the code when the button is clicked
72
+ document.getElementById('runCodeButton').addEventListener('click', () => {
73
+ const code = Blockly.JavaScript.workspaceToCode(workspace);
74
+ console.log('Generated Code:', code); // For debugging
75
+ try {
76
+ // eval(code); // Execute the code
77
+ window.ReactNativeWebView.postMessage(code); // Send the code to the app
78
+ } catch (error) {
79
+ alert('Error: ' + error.message);
80
+ }
81
+ });
82
+ </script>
83
+ </body>
84
+ </html>
85
+ `;
86
+ }
87
+ //# sourceMappingURL=stringToBlockly.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["DEFAULT_BUTTON_TEXT","DEFAULT_BUTTON_STYLE","cssObjectToString","stringToBlockly","blocks","toolbox","workspace","buttonConfig","style","text"],"sourceRoot":"..\\..\\..\\src","sources":["parsers/stringToBlockly.ts"],"mappings":";;AAAA,SAASA,mBAAmB,EAAEC,oBAAoB,QAAQ,sBAAmB;AAC7E,SAASC,iBAAiB,QAAQ,oBAAiB;;AAEnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,eAAeA,CAC7BC,MAAc,EACdC,OAAe,EACfC,SAAiB,EACjBC,YAA6C,EACrC;EACR,OAAO;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwCA,YAAY,CAACC,KAAK,IAAIN,iBAAiB,CAACD,oBAAoB,CAAC,KAAKM,YAAY,CAACE,IAAI,IAAIT,mBAAmB;AAClJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQI,MAAM,IAAI,EAAE;AACpB;AACA;AACA,wBAAwBC,OAAO,IAAI,IAAI;AACvC;AACA;AACA,gCAAgCC,SAAS,IAAI,IAAI;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+
3
+ export {};
4
+ //# sourceMappingURL=blockly-types.d.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"..\\..\\..\\src","sources":["types/blockly-types.d.ts"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+
3
+ export {};
4
+ //# sourceMappingURL=blockly-view-types.d.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"..\\..\\..\\src","sources":["types/blockly-view-types.d.ts"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Array of standard Blockly block types that are available by default.
5
+ * These blocks are built into the Blockly library and don't need to be
6
+ * defined in the custom blocks array.
7
+ */
8
+ export const STANDARD_BLOCKLY_BLOCK_TYPES = [
9
+ // Logic blocks
10
+ 'logic_compare', 'logic_operation', 'logic_negate', 'logic_boolean', 'logic_null', 'logic_ternary',
11
+ // Control flow blocks
12
+ 'controls_if', 'controls_ifelse', 'controls_repeat_ext', 'controls_whileUntil', 'controls_for', 'controls_forEach', 'controls_flow_statements',
13
+ // Math blocks
14
+ 'math_number', 'math_arithmetic', 'math_single', 'math_trig', 'math_constant', 'math_number_property', 'math_round', 'math_on_list', 'math_modulo', 'math_constrain', 'math_random_int', 'math_random_float', 'math_atan2',
15
+ // Text blocks
16
+ 'text', 'text_multiline', 'text_join', 'text_append', 'text_length', 'text_isEmpty', 'text_indexOf', 'text_charAt', 'text_getSubstring', 'text_changeCase', 'text_trim', 'text_count', 'text_replace', 'text_reverse', 'text_print', 'text_prompt_ext',
17
+ // List blocks
18
+ 'lists_create_with', 'lists_create_empty', 'lists_repeat', 'lists_length', 'lists_isEmpty', 'lists_indexOf', 'lists_getIndex', 'lists_setIndex', 'lists_getSublist', 'lists_split', 'lists_sort', 'lists_reverse',
19
+ // Color blocks
20
+ 'colour_picker', 'colour_random', 'colour_rgb', 'colour_blend',
21
+ // Variable blocks
22
+ 'variables_get', 'variables_set',
23
+ // Function/Procedure blocks
24
+ 'procedures_defnoreturn', 'procedures_defreturn', 'procedures_callnoreturn', 'procedures_callreturn', 'procedures_ifreturn'];
25
+
26
+ /**
27
+ * Set of standard Blockly block types for efficient lookup.
28
+ * Used for runtime validation.
29
+ */
30
+ export const STANDARD_BLOCKLY_BLOCKS = new Set(STANDARD_BLOCKLY_BLOCK_TYPES);
31
+
32
+ /**
33
+ * Type representing all standard Blockly block types.
34
+ * Derived from the constant array to ensure type and runtime values stay in sync.
35
+ */
36
+ //# sourceMappingURL=blocklyConstants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["STANDARD_BLOCKLY_BLOCK_TYPES","STANDARD_BLOCKLY_BLOCKS","Set"],"sourceRoot":"..\\..\\..\\src","sources":["utils/blocklyConstants.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,4BAA4B,GAAG;AAC1C;AACA,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,YAAY,EACZ,eAAe;AACf;AACA,aAAa,EACb,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,cAAc,EACd,kBAAkB,EAClB,0BAA0B;AAC1B;AACA,aAAa,EACb,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,eAAe,EACf,sBAAsB,EACtB,YAAY,EACZ,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,YAAY;AACZ;AACA,MAAM,EACN,gBAAgB,EAChB,WAAW,EACX,aAAa,EACb,aAAa,EACb,cAAc,EACd,cAAc,EACd,aAAa,EACb,mBAAmB,EACnB,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,cAAc,EACd,cAAc,EACd,YAAY,EACZ,iBAAiB;AACjB;AACA,mBAAmB,EACnB,oBAAoB,EACpB,cAAc,EACd,cAAc,EACd,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,aAAa,EACb,YAAY,EACZ,eAAe;AACf;AACA,eAAe,EACf,eAAe,EACf,YAAY,EACZ,cAAc;AACd;AACA,eAAe,EACf,eAAe;AACf;AACA,wBAAwB,EACxB,sBAAsB,EACtB,yBAAyB,EACzB,uBAAuB,EACvB,qBAAqB,CACb;;AAEV;AACA;AACA;AACA;AACA,OAAO,MAAMC,uBAAuB,GAAG,IAAIC,GAAG,CAACF,4BAA4B,CAAC;;AAE5E;AACA;AACA;AACA","ignoreList":[]}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Default text for the run code button
5
+ */
6
+ export const DEFAULT_BUTTON_TEXT = 'Run Code';
7
+
8
+ /**
9
+ * Default CSS styles for the run code button
10
+ */
11
+ export const DEFAULT_BUTTON_STYLE = {
12
+ marginTop: '15px',
13
+ padding: '10px 20px',
14
+ backgroundColor: '#007bff',
15
+ color: 'white',
16
+ border: 'none',
17
+ borderRadius: '5px',
18
+ cursor: 'pointer'
19
+ };
20
+ //# sourceMappingURL=defaults.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["DEFAULT_BUTTON_TEXT","DEFAULT_BUTTON_STYLE","marginTop","padding","backgroundColor","color","border","borderRadius","cursor"],"sourceRoot":"..\\..\\..\\src","sources":["utils/defaults.ts"],"mappings":";;AAEA;AACA;AACA;AACA,OAAO,MAAMA,mBAAmB,GAAG,UAAU;;AAE7C;AACA;AACA;AACA,OAAO,MAAMC,oBAAmC,GAAG;EACjDC,SAAS,EAAE,MAAM;EACjBC,OAAO,EAAE,WAAW;EACpBC,eAAe,EAAE,SAAS;EAC1BC,KAAK,EAAE,OAAO;EACdC,MAAM,EAAE,MAAM;EACdC,YAAY,EAAE,KAAK;EACnBC,MAAM,EAAE;AACV,CAAC","ignoreList":[]}
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+
3
+ import { STANDARD_BLOCKLY_BLOCKS } from "./blocklyConstants.js";
4
+
5
+ /**
6
+ * Validates if blocks and toolbox have matching pairs and shows warnings for mismatches
7
+ *
8
+ * @param blocks - Array of block definitions
9
+ * @param toolbox - Toolbox configuration
10
+ */
11
+ export function blockInToolbox(blocks, toolbox) {
12
+ const warnings = [];
13
+ const missingInToolbox = [];
14
+ const missingInBlocks = [];
15
+
16
+ // If no toolbox is provided, show warning and return
17
+ if (!toolbox) {
18
+ console.warn('No toolbox provided. Blocks will not be accessible in the workspace.');
19
+ return;
20
+ }
21
+
22
+ // Extract block types from blocks array
23
+ const blockTypes = new Set(blocks.map(block => block.type));
24
+
25
+ // Extract block types from toolbox contents
26
+ const toolboxTypes = new Set(toolbox.contents.filter(item => item.kind === 'block').map(item => item.type));
27
+
28
+ // Check for blocks that are defined but not in toolbox
29
+ blockTypes.forEach(blockType => {
30
+ if (!toolboxTypes.has(blockType)) {
31
+ missingInToolbox.push(blockType);
32
+ warnings.push(`Block '${blockType}' is defined but not available in the toolbox. Users won't be able to access this block.`);
33
+ }
34
+ });
35
+
36
+ // Check for toolbox items that reference undefined blocks
37
+ // Exclude standard Blockly blocks from this check
38
+ toolboxTypes.forEach(toolboxType => {
39
+ if (!blockTypes.has(toolboxType) && !STANDARD_BLOCKLY_BLOCKS.has(toolboxType)) {
40
+ missingInBlocks.push(toolboxType);
41
+ warnings.push(`Toolbox references block '${toolboxType}' but this block is not defined. This will cause runtime errors.`);
42
+ }
43
+ });
44
+
45
+ // Show warnings if any issues found
46
+ if (warnings.length > 0) {
47
+ console.warn('Block/Toolbox validation issues found:');
48
+ warnings.forEach(warning => console.warn(warning));
49
+ }
50
+ }
51
+
52
+ /**
53
+ * Validates if blocks with custom code have a return statement and shows warnings for missing returns
54
+ *
55
+ * @param blocks - Array of block definitions
56
+ */
57
+ export function noReturnStatement(blocks) {
58
+ const warnings = [];
59
+
60
+ // Check each block that has custom code
61
+ blocks.forEach(block => {
62
+ if (block.code && typeof block.code === 'string') {
63
+ // Check if the code contains a return statement
64
+ const hasReturnStatement = /\breturn\b/.test(block.code);
65
+ if (!hasReturnStatement) {
66
+ warnings.push(`Block '${block.type}' has custom code but no return statement. This may cause unexpected behavior in code generation.`);
67
+ }
68
+ }
69
+ });
70
+ if (warnings.length > 0) {
71
+ console.warn('Block code validation issues found:');
72
+ warnings.forEach(warning => console.warn(warning));
73
+ }
74
+ }
75
+ //# sourceMappingURL=showWarnings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["STANDARD_BLOCKLY_BLOCKS","blockInToolbox","blocks","toolbox","warnings","missingInToolbox","missingInBlocks","console","warn","blockTypes","Set","map","block","type","toolboxTypes","contents","filter","item","kind","forEach","blockType","has","push","toolboxType","length","warning","noReturnStatement","code","hasReturnStatement","test"],"sourceRoot":"..\\..\\..\\src","sources":["utils/showWarnings.ts"],"mappings":";;AACA,SACEA,uBAAuB,QAElB,uBAAoB;;AAE3B;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,cAAcA,CAACC,MAAe,EAAEC,OAAuB,EAAQ;EAC7E,MAAMC,QAAkB,GAAG,EAAE;EAC7B,MAAMC,gBAA0B,GAAG,EAAE;EACrC,MAAMC,eAAyB,GAAG,EAAE;;EAEpC;EACA,IAAI,CAACH,OAAO,EAAE;IACZI,OAAO,CAACC,IAAI,CACV,sEACF,CAAC;IACD;EACF;;EAEA;EACA,MAAMC,UAAU,GAAG,IAAIC,GAAG,CAACR,MAAM,CAACS,GAAG,CAAEC,KAAK,IAAKA,KAAK,CAACC,IAAI,CAAC,CAAC;;EAE7D;EACA,MAAMC,YAAY,GAAG,IAAIJ,GAAG,CAC1BP,OAAO,CAACY,QAAQ,CACbC,MAAM,CAAEC,IAAI,IAAKA,IAAI,CAACC,IAAI,KAAK,OAAO,CAAC,CACvCP,GAAG,CAAEM,IAAI,IAAKA,IAAI,CAACJ,IAAI,CAC5B,CAAC;;EAED;EACAJ,UAAU,CAACU,OAAO,CAAEC,SAAS,IAAK;IAChC,IAAI,CAACN,YAAY,CAACO,GAAG,CAACD,SAAS,CAAC,EAAE;MAChCf,gBAAgB,CAACiB,IAAI,CAACF,SAAS,CAAC;MAChChB,QAAQ,CAACkB,IAAI,CACX,UAAUF,SAAS,0FACrB,CAAC;IACH;EACF,CAAC,CAAC;;EAEF;EACA;EACAN,YAAY,CAACK,OAAO,CAAEI,WAAW,IAAK;IACpC,IACE,CAACd,UAAU,CAACY,GAAG,CAACE,WAAW,CAAC,IAC5B,CAACvB,uBAAuB,CAACqB,GAAG,CAACE,WAAgC,CAAC,EAC9D;MACAjB,eAAe,CAACgB,IAAI,CAACC,WAAW,CAAC;MACjCnB,QAAQ,CAACkB,IAAI,CACX,6BAA6BC,WAAW,kEAC1C,CAAC;IACH;EACF,CAAC,CAAC;;EAEF;EACA,IAAInB,QAAQ,CAACoB,MAAM,GAAG,CAAC,EAAE;IACvBjB,OAAO,CAACC,IAAI,CAAC,wCAAwC,CAAC;IACtDJ,QAAQ,CAACe,OAAO,CAAEM,OAAO,IAAKlB,OAAO,CAACC,IAAI,CAACiB,OAAO,CAAC,CAAC;EACtD;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,iBAAiBA,CAACxB,MAAe,EAAQ;EACvD,MAAME,QAAkB,GAAG,EAAE;;EAE7B;EACAF,MAAM,CAACiB,OAAO,CAAEP,KAAK,IAAK;IACxB,IAAIA,KAAK,CAACe,IAAI,IAAI,OAAOf,KAAK,CAACe,IAAI,KAAK,QAAQ,EAAE;MAChD;MACA,MAAMC,kBAAkB,GAAG,YAAY,CAACC,IAAI,CAACjB,KAAK,CAACe,IAAI,CAAC;MAExD,IAAI,CAACC,kBAAkB,EAAE;QACvBxB,QAAQ,CAACkB,IAAI,CACX,UAAUV,KAAK,CAACC,IAAI,mGACtB,CAAC;MACH;IACF;EACF,CAAC,CAAC;EAEF,IAAIT,QAAQ,CAACoB,MAAM,GAAG,CAAC,EAAE;IACvBjB,OAAO,CAACC,IAAI,CAAC,qCAAqC,CAAC;IACnDJ,QAAQ,CAACe,OAAO,CAAEM,OAAO,IAAKlB,OAAO,CAACC,IAAI,CAACiB,OAAO,CAAC,CAAC;EACtD;AACF","ignoreList":[]}
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -0,0 +1,16 @@
1
+ import type { Block } from '../types/blockly-types';
2
+ /**
3
+ * Blockly class to manage blockly configuration.
4
+ */
5
+ export declare class Blockly {
6
+ blocks: Block[];
7
+ createBlocks(blocks: Block[]): void;
8
+ /**
9
+ * Creates a blockly block and add it to the blocks array.
10
+ *
11
+ * @param block - Block object to be added to the blocks array
12
+ */
13
+ createBlock(block: Block): void;
14
+ getBlocks(): Block[];
15
+ }
16
+ //# sourceMappingURL=blockly.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blockly.d.ts","sourceRoot":"","sources":["../../../../src/classes/blockly.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAEpD;;GAEG;AACH,qBAAa,OAAO;IAClB,MAAM,EAAE,KAAK,EAAE,CAAM;IAErB,YAAY,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI;IAInC;;;;OAIG;IACH,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;IAI/B,SAAS,IAAI,KAAK,EAAE;CAGrB"}
@@ -0,0 +1,14 @@
1
+ import type { Toolbox, Workspace } from '../types/blockly-types';
2
+ import type { ButtonConfig } from '../types/blockly-view-types';
3
+ export declare class BlocklyViewConfig {
4
+ toolbox: Toolbox;
5
+ workspace: Workspace;
6
+ buttonConfig: ButtonConfig;
7
+ setToolbox(toolbox: Toolbox): void;
8
+ getToolbox(): Toolbox;
9
+ setWorkspace(workspace: Workspace): void;
10
+ getWorkspace(): Workspace;
11
+ setButtonConfig(buttonConfig: ButtonConfig): void;
12
+ getButtonConfig(): ButtonConfig;
13
+ }
14
+ //# sourceMappingURL=blocklyViewConfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blocklyViewConfig.d.ts","sourceRoot":"","sources":["../../../../src/classes/blocklyViewConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAGhE,qBAAa,iBAAiB;IAC5B,OAAO,EAAE,OAAO,CAA8B;IAC9C,SAAS,EAAE,SAAS,CAA0C;IAC9D,YAAY,EAAE,YAAY,CAGxB;IAEF,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAIlC,UAAU,IAAI,OAAO;IAIrB,YAAY,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI;IAIxC,YAAY,IAAI,SAAS;IAIzB,eAAe,CAAC,YAAY,EAAE,YAAY,GAAG,IAAI;IAIjD,eAAe,IAAI,YAAY;CAGhC"}