web/bugc-react: add curated example selector to the docs BugPlayground#247
Open
gnidan wants to merge 1 commit into
Open
web/bugc-react: add curated example selector to the docs BugPlayground#247gnidan wants to merge 1 commit into
gnidan wants to merge 1 commit into
Conversation
#243) The docs BugPlayground only ever showed one program; the example picker lived in the standalone packages/playground app. Port a lean version into the docs widget (gnidan #33). - bugc-react: add a curated `bugExamples` set (Counter, Function calls, Arrays & loops) as a reusable export. Sources are distilled from packages/bugc/examples and stripped of the `/*@test*/` behavioral annotations the raw files carry, so they read cleanly in an editor. examples.test.ts asserts each compiles to bytecode without errors (guards against a typo in an inlined source); adds the missing vitest.config.ts so the package's test script runs. - web BugPlayground: add an optional `examples` prop (defaults to bugExamples) and an Example dropdown in the header controls. The selector shows only when no `initialCode` is passed — so the bare playground page gains it while inline single-example doc embeds stay unchanged. Selecting an example loads its source and recompiles. Additive; does not affect the tracer or #227. Example sources verified to compile via the new tests; UI wiring mirrors the existing optimizer selector.
Contributor
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The docs BugPlayground only ever showed one program; the example
picker lived in the standalone
packages/playgroundapp. This ports alean version into the docs widget.
bugExamplesset (Counter, Functioncalls, Arrays & loops) as a reusable export. Sources are distilled
from
packages/bugc/examplesand stripped of the/*@test*/behavioral annotations the raw files carry, so they read cleanly in
an editor.
examples.test.tsasserts each compiles to bytecodewithout errors (guards against a typo in an inlined source); adds the
missing
vitest.config.tsso the package's test script runs.examplesprop (defaults tobugExamples) and an Example dropdown in the header controls. Theselector shows only when no
initialCodeis passed — so the bareplayground page gains it while inline single-example doc embeds stay
unchanged. Selecting an example loads its source and recompiles.
Additive; no dependency on the transform-context work. Example sources
are verified to compile via the new tests; the UI wiring mirrors the
existing optimizer selector.