From dd6d8d9c3bc8e879a06e0b8ec23d233ec0d9e68a Mon Sep 17 00:00:00 2001 From: Loren Norman Date: Thu, 10 Jul 2025 14:39:28 -0400 Subject: [PATCH] sandbox page, multiple sidebars, select field docs --- app/blocks/math/round.js | 16 +++----- docs/.vitepress/config.js | 33 ++++++++++++++-- docs/components/blockly_workspace.vue | 55 ++++++++++++++++----------- docs/sandbox.md | 9 +++++ export_documentation.js | 35 +++++++++-------- src/block_definition.js | 20 +--------- src/docs/render_block.js | 2 +- src/docs/render_block_fields.js | 22 ++++++++--- src/util.js | 20 ++++++++++ 9 files changed, 136 insertions(+), 76 deletions(-) create mode 100644 docs/sandbox.md create mode 100644 src/util.js diff --git a/app/blocks/math/round.js b/app/blocks/math/round.js index aeebf28..379add1 100644 --- a/app/blocks/math/round.js +++ b/app/blocks/math/round.js @@ -20,17 +20,13 @@ export default { fields: { OPERATION: { - description: ` - Round: rounds up if .5 or higher, down otherwise - Floor: rounds down - Ceiling: rounds up - `, - bytecodeProperty: "operation", + description: "Select which rounding operation to perform on the input:", options: [ - ["Round", "round"], - ["Floor", "floor"], - ["Ceiling", "ceiling"], - ] + ["Round", "round", "if .5 or higher: round up; otherwise round down"], + ["Floor", "floor", "rounds down"], + ["Ceiling", "ceiling", "rounds up"], + ], + bytecodeProperty: "operation", } }, diff --git a/docs/.vitepress/config.js b/docs/.vitepress/config.js index dc5d88b..e4f7eb7 100644 --- a/docs/.vitepress/config.js +++ b/docs/.vitepress/config.js @@ -39,15 +39,42 @@ export default defineConfig({ }, nav: [ + { text: '🪏', link: '/sandbox' }, { text: 'Home', link: '/' }, { text: 'Getting Started', link: '/getting-started' }, { text: 'The Blocks', link: '/block-index' }, { text: 'Examples', link: '/automation-examples' } ], - sidebar: [ - blocksSidebar - ], + sidebar: { + // covers /blocks/* and /block-index + "/block": [ blocksSidebar ], + + // devtools for the sandbox + "/sandbox": [ + { + "text": "Tools", + "items": [ + { + "text": "Custom Feed Names", + "link": "#" + }, + { + "text": "Weather Locations", + "link": "#" + }, + { + "text": "IO Bytecode Explorer", + "link": "#" + }, + { + "text": "Blockly JSON Explorer", + "link": "#" + }, + ] + } + ], + }, socialLinks: [ { icon: 'github', link: REPO } diff --git a/docs/components/blockly_workspace.vue b/docs/components/blockly_workspace.vue index 519e490..bc09c35 100644 --- a/docs/components/blockly_workspace.vue +++ b/docs/components/blockly_workspace.vue @@ -1,33 +1,42 @@ @@ -38,8 +47,10 @@