Skip to content

Put the playground online and let it explain what Maple is - #19

Merged
NetWin merged 5 commits into
incrementfrom
feature/playground-showcase
Oct 24, 2026
Merged

NetWin merged 5 commits into
incrementfrom
feature/playground-showcase

Conversation

@NetWin

@NetWin NetWin commented Oct 24, 2026

Copy link
Copy Markdown
Owner

What changes

The playground becomes something you can hand to someone who has never heard of Maple:

  • It is published at https://netwin.github.io/maple/, deployed from master after each release run. The root
    and library READMEs link to it.
  • It explains itself. A first visit opens a What is Maple? dialog: what Maple is, how it works (parse,
    interpret, isolate), what a script can't do, how to read the panes, and how to install it. The header button
    reopens it.
  • It demos by example. An Examples menu loads eight scripts, from what Maple is for (a pricing rule with a
    host function, a data transformation) to how it keeps scripts in (no host globals, a blocked prototype escape, no
    eval, a runaway loop stopped at the operation limit, instance vs. run data, errors like JavaScript). The pricing
    rule replaces the old "Hello, name" greeting as the default.
  • The context is host code now. The JSON context pane becomes Host context, a JavaScript module whose
    INSTANCE_DATA export becomes the instance's globals and RUN_DATA the data of each run, so scripts can call
    host functions. The panes are named after the trust boundary: Host context, Script (sandboxed),
    Output.

Nothing changes for hosts or scripts using the library: no library code, docs or divergences are touched.

Commits scoped to playground no longer release @netwin/maple and stay out of its release notes, so the
playground can use honest feat and fix commits.

How

  • Release config: release.config.js gets { scope: 'playground', release: false } in the commit analyzer's
    rules, and a hidden twin of every release notes type scoped to playground. The preset uses the first type entry
    that matches, so the hidden ones go first.
  • Host context module: each edit puts the module source behind a new blob URL, revoking the old one. The Maple
    worker imports it once per URL and keeps one Maple per module and limits, so state the module keeps (a counter
    in a host function) lasts until the next edit, as it would in a long-lived host. host-module.ts checks the
    exports: both optional, anything else (or a module that fails to load) shows as Host module failed, apart
    from Maple's own errors. The Benchmark imports its own URL; js-interpreter gets { ...INSTANCE_DATA, ...RUN_DATA }.
  • Double run on load: the debounced input resource also notifies on status changes, which ran the script twice
    on load. Invisible before, but with stateful host functions it showed. A runInput computed with an equality
    check now drops unchanged input.
  • Welcome dialog: a native <dialog>, animated with @starting-style and transition-behavior: allow-discrete
    only (no motion with prefers-reduced-motion). The content scrolls inside the dialog, so the rounded corners clip
    the scrollbar; the close button at the top takes the focus, so opening never scrolls to the bottom (iOS Safari).
  • Header: the version comes from a JSON import of packages/maple/package.json; only the string ends up in the
    bundle. Below sm, the header buttons show icons only.
  • Pages: the pages job in push.yml runs after release and checks out the tip of master, so the version
    the playground shows includes a release commit just pushed. It builds with --base-href /maple/ and deploys with
    upload-pages-artifact and deploy-pages. Pages is enabled with GitHub Actions as its source, and the
    github-pages environment allows deployments from master only.

Tests, parity and docs

  • Tests: no library change, so no new specs; the playground has no test runner. pnpm format, lint,
    typecheck, test and build pass. Every example was run through Maple in Node, and the error messages of
    "Errors like JavaScript" match Node's. In Chrome: host module errors, read-only instance data, shadowing, state
    across runs, the Benchmark with host functions, all examples, the dialog in both themes and at phone width. A
    production build served under /maple/ loads Monaco, fonts and both workers. The release rules were dry-run with
    the real commit analyzer and notes generator.
  • Parity: none; the library is unchanged.
  • Docs: the playground README describes the host context, the dialog and the examples; CONTRIBUTING.md
    mentions that playground commits don't release. The pages job itself only runs on master, so its first run
    after the release is its real test.

The Context pane becomes the Host context: a JavaScript module the worker
imports from a blob URL. INSTANCE_DATA becomes the instance's globals and
RUN_DATA the data of each run, so scripts can call host functions.
A first visit opens a dialog on what Maple is and how to read the
playground. An Examples menu loads scripts that show what Maple is for
and how it keeps scripts in, and the header links to GitHub and npm and
shows the library's version.
The pages job publishes the playground to https://netwin.github.io/maple/
after each release run on master, and the READMEs link to it.
@NetWin NetWin self-assigned this Oct 24, 2026
@github-actions

Copy link
Copy Markdown

📋 Release Preview

Changelog

0.5.1 (2026-10-24)

📖 Documentation

  • evaluator: describe the evaluator layout for contributors (a3d21bc)

🛠️ Code Refactoring

  • evaluator: bind patterns and resolve references through an Interpreter interface (2980f8c)
  • evaluator: move budget, frames and error raising into RunContext (b13e606)
  • evaluator: move calls and closures into calls.ts (9a2e29d)
  • evaluator: move error descriptions of nodes into describe.ts (e0c82ad)
  • evaluator: move host and intrinsic calls into HostBridge (ccd7479)
  • evaluator: move the language files into evaluator/language (c303875)
  • evaluator: split expressions into member access, literals, operators and assignments (9a18edb)
  • evaluator: split statements into blocks, loops and control flow (b2b48c2)

🔄️ Continuous Integration

  • release: don't release commits scoped to the playground (0dd3209)

@NetWin
NetWin marked this pull request as ready for review October 24, 2026 07:18
Copilot AI lite review requested due to automatic review settings October 24, 2026 07:18

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unresolved critical release/configuration issues and moderate host-module, benchmark, and mobile-layout issues remain.

6 open issues
What changed in this PR

This pull request turns the Maple playground into a public, self-explanatory browser demo with editable host modules, examples, benchmarking, and GitHub Pages deployment.

Changes:

  • Adds a welcome dialog, examples menu, responsive navigation, project links, and version display.
  • Replaces JSON context input with JavaScript host modules supporting instance data, run data, and host functions.
  • Updates workers, runners, benchmarking, persistence, and documentation for the host-module model.
  • Configures playground-only release handling and GitHub Pages deployment from master.
File Description
release.config.js Adds playground-specific release suppression and hidden changelog rules.
README.md Links to the hosted playground.
packages/​maple/​README.md Links to the hosted playground from the library documentation.
apps/​maple-playground/​src/​app/​ui/​welcome-dialog.ts Implements welcome dialog behavior.
apps/​maple-playground/​src/​app/​ui/​welcome-dialog.html Adds explanatory Maple introduction content.
apps/​maple-playground/​src/​app/​ui/​settings-menu.html Makes settings controls responsive.
apps/​maple-playground/​src/​app/​ui/​examples-menu.ts Implements example selection behavior.
apps/​maple-playground/​src/​app/​ui/​examples-menu.html Adds the Examples popover menu.
apps/​maple-playground/​src/​app/​ui/​benchmark-panel.html Updates benchmark terminology for host context.
apps/​maple-playground/​src/​app/​data-access/​runner.ts Runs scripts using generated host-module URLs.
apps/​maple-playground/​src/​app/​data-access/​project.ts Provides package version and project links.
apps/​maple-playground/​src/​app/​data-access/​playground.ts Persists host context, examples, and welcome state.
apps/​maple-playground/​src/​app/​data-access/​maple.worker.ts Imports host modules and reuses Maple instances.
apps/​maple-playground/​src/​app/​data-access/​maple-worker-protocol.ts Updates the worker protocol for host-module URLs.
apps/​maple-playground/​src/​app/​data-access/​js-interpreter-engine.ts Updates benchmark documentation for host data.
apps/​maple-playground/​src/​app/​data-access/​host-module.ts Creates, imports, and validates host-context modules.
apps/​maple-playground/​src/​app/​data-access/​examples.ts Defines the eight educational examples.
apps/​maple-playground/​src/​app/​data-access/​benchmark.worker.ts Benchmarks host modules in Maple and js-interpreter.
apps/​maple-playground/​src/​app/​data-access/​benchmark.ts Manages benchmark host-module URLs.
apps/​maple-playground/​src/​app/​data-access/​benchmark-protocol.ts Updates benchmark request handling for host modules.
apps/​maple-playground/​src/​app/​app.ts Integrates examples, onboarding, host context, and execution.
apps/​maple-playground/​src/​app/​app.html Adds the new header, panes, links, and welcome dialog.
apps/​maple-playground/​README.md Documents the public playground, host modules, examples, and deployment.
apps/​maple-playground/​angular.json Configures the development server.
.github/​workflows/​push.yml Builds and deploys the playground to GitHub Pages.

Review effort: Lite

Comment thread apps/maple-playground/src/app/data-access/project.ts
Comment thread release.config.js
Comment thread apps/maple-playground/src/app/app.html
Comment thread apps/maple-playground/src/app/data-access/benchmark.worker.ts
Comment thread apps/maple-playground/src/app/data-access/host-module.ts
Comment thread apps/maple-playground/README.md Outdated
@NetWin
NetWin merged commit 2864f12 into increment Oct 24, 2026
8 checks passed
@NetWin
NetWin deleted the feature/playground-showcase branch October 24, 2026 07:31
@NetWin NetWin mentioned this pull request Oct 24, 2026
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 0.5.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants