Add live demo documentation - #584
Merged
Merged
Conversation
- playground/browser.js: output (params, messages, clear) now flows through a configurable listener via window.ElectroDB.configure(); the original DOM rendering into #param-container remains the default so existing consumers are unaffected. Error reference links open in a new tab. - www: new LiveExample control (src/components/LiveExample) renders a docs example as tabs — Example / Entity / Table Definition — and executes the example in the browser against the mocked ElectroDB client to display its generated DynamoDB parameters live, plus an "Edit in Playground" deep link into electrodb.fun's multi-file (#files) format. - Examples live as real TypeScript modules under www/src/examples/<name>/ (example.ts imports the entity from ./entity.ts, which imports the table name from ./table.ts), so each example is self-contained and type-checked against the repo's index.d.ts by `npm run check` — examples can no longer drift from the API, and per-example schema deviations stay local. - Sources are transpiled to CommonJS at build time (no TS compiler shipped to the client); the control hydrates lazily with client:visible. - Convert mutations/put and queries/get as exemplar pages, replacing the shared "Example Setup" partial and hard-coded Equivalent Parameters JSON.
Astro 1.6 failed to render MDX pages on Node 20+ (undici body assertion in renderPage), forcing builds onto Node 18/22. The site now builds and checks cleanly on Node 24. - astro ^5, @astrojs/mdx ^4, @astrojs/react ^4, add @astrojs/check for `astro check`, typescript ^5.7 - Drop the unused @astrojs/image integration (and sharp) and the preact renderer: the four remaining preact components (ThemeToggleButton, TableOfContents, SidebarToggle, PackageInstall) are converted to React so the site uses a single JSX renderer and needs no include/exclude filters - Fix strictness fallout: type-only Frontmatter import (verbatimModuleSyntax), explicit PropsWithChildren where React 18 types dropped implicit children - import.meta.glob `as: "raw"` → `query/import` form for Vite 6 - tsconfig: drop the TS5 ignoreDeprecations shim; exclude dist/ and public/
The mocked client now records the call stack (with a temporarily raised stack limit, since collection and create paths sit deeper than V8's default 10 frames) when parameters are created, and passes it to configured listeners via onParams. The playground UI uses it to link each generated params block to the query that produced it; the DOM fallback ignores it.
Bulk conversion of runnable ElectroDB snippets across mutations, queries, modeling, core-concepts, recipes, and examples pages to the interactive LiveExample control: each snippet now lives as a self-contained, type-checked example directory (example.ts + entity/table, plus entities/service for Service-based walkthroughs) rendered with tabs and live-generated DynamoDB parameters. Adjacent hard-coded "Equivalent Parameters" JSON blocks and stale "Try it out!" badge links were removed with their snippets; intentionally failing "Bad:" examples now display their real thrown error. Response Format and Execution Options sections remain static. Also: LiveExample tab labels/ordering extended for entities.ts/service.ts; task-manager validate callbacks return booleans so entity schema inference stays literal. Not yet converted (pending follow-up): mutations/patch, examples/ human-resources, library-system, version-control; modeling/collections and examples/task-manager are partially converted (valid, some snippets still static). Unreferenced example dirs (patch-*, human-resources-*, two collections-*) are staged groundwork for those pages.
- The site's global inline-code rule (background, padding, and a border that repeats on every wrapped line box of an inline element) was leaking into the control's code blocks, drawing a line under every line of code; the control's <code> now opts out entirely (all: unset), like the site's own pre.astro-code > code - The control now follows the site-level theme instead of hardcoding dark colors: theme-scoped CSS variables mirror theme.css (explicit .theme-light/ .theme-dark classes, OS preference otherwise) with a GitHub-light palette for code, tokens, output, and messages in light mode; dark mode now also tracks the site's --theme-code-bg rather than a hardcoded value
- www/scripts/test-examples.mjs executes every src/examples/<dir>/example.ts against this repository's ElectroDB with a mocked DynamoDB client (the same way the LiveExample control runs them in the browser) and fails if any example throws; examples that intentionally demonstrate an error opt in via an expected-error.txt marker, for which NOT throwing is the failure - .github/workflows/docs.yml runs `npm run check` (compile), the new `npm run test:examples`, and the full site build on changes to www/ or the library source - Fix a real bug the new test caught: the playground mock client returned UnprocessedKeys from batchWrite, but electrodb reads UnprocessedItems, so batch-put/batch-delete examples threw "unprocessed is not iterable"; rebuilt and re-vendored the browser bundle - Mark the two intentionally-failing query examples as expected errors and remove four incomplete example dirs left by an interrupted conversion
✅ Deploy Preview for electrodb-dev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
The sidebar open-state rule tied the scoped display:none at (1,1,0), so bundle order decided whether the hamburger worked; a body prefix lifts it to (1,1,1) and wins deterministically. The MobileTOC list icon read as a second hamburger next to the real one, so it's gone.
…ip it bottom: 0 anchors to the layout viewport, which extends behind Safari's bottom toolbar; an explicit 100dvh-based height tracks the toolbar, and the scroller keeps safe-area padding for the home indicator.
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.
No description provided.