Skip to content

Add live demo documentation - #584

Merged
tywalch merged 16 commits into
masterfrom
feat/add-live-demo-documentation
Jul 24, 2026
Merged

Add live demo documentation#584
tywalch merged 16 commits into
masterfrom
feat/add-live-demo-documentation

Conversation

@tywalch

@tywalch tywalch commented Jul 23, 2026

Copy link
Copy Markdown
Owner

No description provided.

tywalch added 6 commits July 6, 2026 23:42
- 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
@netlify

netlify Bot commented Jul 23, 2026

Copy link
Copy Markdown

Deploy Preview for electrodb-dev ready!

Name Link
🔨 Latest commit 78b6a53
🔍 Latest deploy log https://app.netlify.com/projects/electrodb-dev/deploys/6a62d7c55c508c000859cf90
😎 Deploy Preview https://deploy-preview-584--electrodb-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

tywalch added 10 commits July 23, 2026 13:36
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.
@tywalch
tywalch merged commit 0209f44 into master Jul 24, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant