Migrating to the new elements

Moving a site from an earlier layout of the framework.

The old names below still work for one release. Each warns once in the console; remove it before the next release.

Before Now
<script src="https://github.com/playgroundkit/code-playgrounds/raw/main/docs/.../element/code-playground.js"> .../element/define.js (the old file still defines the elements and re-exports the entries)
outputs="…" on <code-playground> tabs="…"
storage="browser" storage="indexeddb"
id="x" as the share name share="x" (id is an ordinary id)
el.seed(output, items) el.seed(snapshot), a snapshot from output(id) or a build
el.run(output, args) el.run(output, { args })

Removed without a replacement of the same name:

Before Now
playground-ready event state.editor === "ready" (the playground-state event, or playground(page).ready() in tests)
data-status, data-output on the host the same attributes on the pane inside the shadow root; CSS states :state(running), :state(stale), … on the host
el.items(), el.status(), el.declaredOutputs() el.output(id) (a snapshot with items and status), el.outputs
run event detail trigger: "user" by and trigger of the run
the former blue-and-GitHub colours the default look changed (D76): transparent frame, hairlines mixed from the text colour, calmer syntax colours, quiet buttons. Keywords, strings and the like use other hues now (--pg-red is errors and deletions only). To keep a former colour, set its token (--pg-accent: #0969da, --pg-token-keyword: #cf222e, --pg-bg: #fff, --pg-code-bg: #f6f8fa, --pg-border: #d0d7de); styling.md lists them all
data-theme on an ancestor color-scheme (light dark follows the system); see styling.md
playgrounds/core/* imports code-playgrounds/core, code-playgrounds/element, code-playgrounds/highlight, code-playgrounds/items
imports from playgrounds/* (the npm package's former name) code-playgrounds/*; the playgrounds command keeps its name
graph SVG in item events graphSvg(item) from code-playgrounds/items

What a page does before the element's code has loaded is unchanged in kind: attributes and properties work at once, run() and the like return a promise that waits, and mark(), seed() and stop() run when the code arrives. elements.md lists every member.

The languages moved to their own repository

Every ready-made language, packages.site and the demo site are in playgroundkit/languages. This repository is the framework and holds no real language. A flake that used a language from here changes its input:

Before Now
inputs.playgrounds.url = "github:playgroundkit/code-playgrounds", used for its languages github:playgroundkit/languages, whose flakeModules.default imports the framework's module and fills its registry; the framework is its input code-playgrounds
packages.<lang> (.#ocaml, .#haskell, …) the same names in languages
engines.<id> (inputs.playgrounds.engines.ocaml pkgs { … }) inputs.languages.engines.<id>, with the same arguments
lib.ocamlCheck, lib.mk<Lang>Engine (mkOcamlEngine, …) the same names on languages' lib; mk<Lang>Engine is engines.<lang> and still works for one release
the flake module's built-in engines, playgrounds.languages.<id>.enable of a language the same option, once languages' module is imported; with only this repository's module, playgrounds.engines is empty and a language needs package or an engine registered there
packages.site (the repository's site) packages.site in languages

A site that only makes a language (lib.mkLanguage, lib.checkLanguage) or builds the directory from packages (lib.mkPlaygrounds) needs no change. A language's checks that drive the engine import code-playgrounds/conformance.

This page as MarkdownSource on GitHub