docs: add README and a live example page#3
Conversation
Adds a README documenting all 15 components, theming, the <ep-editor> API, and the dev/test/build workflow. Adds examples/index.html — a single-page live demo wiring up every component (buttons, inputs, cards, dropdown, color picker/wheel, chat, modal, toasts, notifications, themed editor) with an event log. Run with `pnpm dev` and open /examples/. examples/verify.mjs drives the page in headless Chromium to confirm every element upgrades and the interactions work (used to validate the demo). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
Review Summary by QodoAdd README, live demo, and verification tests
WalkthroughsDescription• Add comprehensive README documenting all 15 components with reference table • Create single-page live demo (examples/index.html) showcasing every component • Add Playwright verification script (examples/verify.mjs) validating demo functionality • Document theming system, editor API, and development workflow Diagramflowchart LR
A["Documentation"] -->|README.md| B["Component Reference<br/>Theming Guide<br/>Editor API"]
A -->|examples/index.html| C["Live Demo<br/>All Components<br/>Event Log"]
A -->|examples/verify.mjs| D["Playwright Tests<br/>Element Upgrades<br/>Interactions"]
C -->|validates| D
File Changes1. README.md
|
Code Review by Qodo
1.
|
The browser-test job used `pnpm dlx playwright install`, which fetches the latest Playwright at runtime and installs browser revisions that don't match the project-pinned playwright@1.59.1 — so the expected chrome-headless-shell binary was missing and the job failed with 'Executable doesn't exist'. Switch to `pnpm exec` so the pinned CLI installs the matching browser. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
| const check = async (label, fn) => { | ||
| try { const v = await fn(); console.log(`${v ? '✓' : '✗'} ${label}${v && v !== true ? ' → ' + v : ''}`); return !!v; } | ||
| catch (e) { console.log(`✗ ${label} → ${e.message}`); return false; } | ||
| }; | ||
|
|
||
| // every custom element upgraded (has a shadowRoot or is defined) | ||
| const tags = ['ep-theme','ep-button','ep-input','ep-checkbox','ep-card','ep-dropdown', | ||
| 'ep-toolbar-select','ep-color-picker','ep-color-wheel','ep-user-badge','ep-chat-message', | ||
| 'ep-modal','ep-toast-container','ep-editor']; | ||
| for (const t of tags) { | ||
| await check(`<${t}> upgraded`, () => page.evaluate((tag) => { | ||
| const el = document.querySelector(tag); | ||
| return !!(el && (el.shadowRoot || customElements.get(tag))); | ||
| }, t)); | ||
| } |
There was a problem hiding this comment.
2. Verify ignores failed checks 🐞 Bug ☼ Reliability
examples/verify.mjs logs failures from check() but discards the returned boolean and exits based only on captured console errors, so it can exit 0 even when one or more checks fail.
Agent Prompt
## Issue description
The verification script's `check()` helper returns a boolean but callers ignore it, so failed checks don't affect the exit code. The process exit status is currently determined only by `errors.length`, which can let broken interactions/components pass verification.
## Issue Context
This script is meant to validate the demo page. It should return non-zero if *either*:
- any `check()` fails, or
- any console/page errors were captured.
## Fix Focus Areas
- examples/verify.mjs[12-26]
- examples/verify.mjs[58-62]
## Suggested fix
- Track failures, e.g.:
- `let failed = 0;`
- `if (!(await check(...))) failed++;`
- At the end, exit non-zero when `failed > 0 || errors.length > 0`.
- (Recommended) Wrap the main body in `try/finally` to always `await browser.close()` even if navigation/clicks throw.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
…onents The demo's <body> background and the <ep-editor> sat outside the themed cascade, so switching themes left the dominant page background light and the editor white — making it look like theming "didn't work". - Move the page surface into a `.page` div inside <ep-theme> so its background/text track the active theme. - Map the editor's own tokens (--ep-editor-bg/-color/-link-color) onto the theme tokens so it isn't a white box in dark mode. - Add a fallback banner shown when components don't upgrade (page opened outside the Vite dev server) with instructions, removed once <ep-theme> is defined. - Harden verify.mjs: assert the RENDERED page + editor backgrounds change on theme switch (the previous check only read a CSS var), and make the target port configurable (PORT, default 5173). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The demo's editor toolbar used generic text buttons ("B", "• List",
"↶ Undo"), which look nothing like Etherpad's editbar. Etherpad uses
monochrome icon buttons (buttonicon-bold/italic/underline/strikethrough,
list/undo/redo) on a transparent bar. Rebuilt the toolbar with
`ep-button variant="icon"` + SVG glyphs, grouped with separators on a
bg-coloured bar flush above the editor.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The toolbar used hand-picked Lucide SVG paths to approximate bold/italic/ underline/strikethrough; the bold one rendered as a hollow stroked shape and looked wrong. Bundle Etherpad's actual fontawesome-etherpad.woff2 and use the real glyph codepoints (bold e845, italic e847, underline e846, strikethrough e848, ul e82a, ol e844, undo e84b, redo e84c) so the editbar icons are identical to Etherpad's. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
What
The repo had no README and no runnable example, so this adds both.
README.mdDocuments the library end to end:
<ep-theme>(the 4 built-in token sets + runtime registration).<ep-editor>API (Etherpad's Ace engine as a web component) including the collaboration/changeset methods.playfunctions double as the browser test suite.examples/index.htmlA single-page live demo wiring up every component — buttons, inputs, checkboxes, cards, dropdown, toolbar-select, color picker + wheel (driving a user badge), chat messages, modal, toasts, notifications, and a themed
<ep-editor>with a working formatting toolbar — plus a theme switcher and a live event log.Run it from the repo root:
pnpm dev # open http://localhost:5173/examples/examples/verify.mjsA small Playwright script (used to validate the demo) that loads the page in headless Chromium and asserts every element upgrades and the key interactions (modal, toast, notification, theme switch, editor) work.
Verification
From a clean
pnpm install:pnpm test --run→ 82 tests / 15 files passpnpm typecheck→ cleanpnpm build→ emitsdist/node examples/verify.mjs→ all 20 checks pass, no console errors🤖 Generated with Claude Code
Also: CI fix
The browser-test job was already failing (on the open dependabot PR too) because
pnpm dlx playwright installfetched the latest Playwright instead of the pinned1.59.1, leaving the expectedchrome-headless-shellbinary missing. Switched topnpm execso the pinned CLI installs the matching browser — this unblocks the test job for this PR and the repo generally.