@foxford/blockly-ide
v0.2.0
Published
Embeddable Blockly Legacy React component.
Readme
@foxford/blockly-ide
Embeddable Blockly Legacy React component.
Install
pnpm add @foxford/blockly-ideThe host application must provide compatible versions of @foxford/ui,
react, react-dom, and styled-components.
The package is ESM-only. CommonJS require() is not supported.
Usage
import { Blockly } from '@foxford/blockly-ide'
<Blockly
config={{
template: 'maze',
commands: ['moveForward', 'turnLeft', 'turnRight'],
map: [
['1', '1', '1'],
['1', '1', '1'],
['1', '1', '1'],
],
}}
locale="ru-RU"
/>Blockly runtime assets are loaded from https://static.ngcdn.ru/blockly/ and
are not included in the npm package.
Props
config— required mechanic config, includestemplateand mechanic-specific fields.locale— current locale (ru-RU/en-US, other locales fallback toen-US).savedCode— optional XML code to restore.- callbacks:
onCodeChange(code)onError(code)onFinish(code)onGameStatusChange(status)onNextLevel()
Development
pnpm dev