Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
404 changes: 6 additions & 398 deletions apps/demo/demo/player-page.css

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions apps/demo/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,9 @@ export default defineConfig(({ command }) => ({
// `dist/h5p-plan.js` first (`build` in package.json), as `pnpm dev` does.
alias: [
{ find: /^@missing-elements\/h5p-offline-player$/, replacement: ELEMENT },
// The page's stylesheet the same way: player-page.css imports it by the package's name, and
// here that is the source, so the demo needs no build of the player for it either.
{ find: /^@missing-elements\/h5p-offline-player\/page\.css$/, replacement: resolve(playerDir, 'page', 'page.css') },
{ find: /^@missing-elements\/h5p-cmi5$/, replacement: CMI5 }
]
},
Expand Down
9 changes: 9 additions & 0 deletions design/demo.md
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,15 @@ SPA-fallback trap described above cannot happen there.
longest prefix of the page's — so a page names no current link. The footers stay in the pages:
each lists its own links. The per-page metadata — title, description, Open Graph and Twitter
tags, each written two or three times — is the obvious next candidate and has not been done.
- **The page's design is the player's `page.css`** (2026-11-10, #170). The colours for light and
dark, the bar, the buttons, the status strip, the player's box, cards and messages moved from
`player-page.css` to `packages/player/page/page.css`, which the player ships in `dist/` and the
demo imports first; the config aliases the package path to the source, as it does the element's.
The verifier's preview, the extension's page and the build page import the same file, so
the pages around the player look the same and cannot drift from the demo. The bar's three-column
grid applies to a bar with a nav (`.topbar:has(nav)`): a bar of a brand and its actions keeps the
actions at its end. The owner asked for it on 2026-11-10, after the verifier's preview opened in
Claude's browser panel in the browser's system styles.
- **Caching.** Hashed files under `/assets/` are immutable; `h5p-sw.js` and `frame-assets/` are
`no-cache`; `fixtures/` revalidate hourly. `frame-assets/` was hourly, with a day of
`stale-while-revalidate`, until #49: its file names stay the same from one runtime to the next,
Expand Down
5 changes: 5 additions & 0 deletions design/layout.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ packages/player/ @missing-elements/h5p-offline-player — the published
tests/package-types.ts the published declarations as a caller on `nodenext` sees them, checked by
tsconfig.consumer.json (see *Types for the plain-JS packages*)
public/ generated, not in git: the runtime's dist/ as frame-assets/, and the test fixtures
page/ page.css and mark.svg, copied to dist/ by build-workers (#170): the page around the
player as the demo draws it — colours for light and dark, the bar, buttons, the
status strip, the player's box — exported as `./page.css`; the demo imports the
source by alias, h5p-verify's preview, the extension's page and the build
page take it from the package, so none of them drifts from the demo
NOTICE.md zip.js's notice, and where the runtime went; shipped with the package

packages/runtime/ @missing-elements/h5p-runtime — the H5P core runtime, GPL-3.0-only, a package of its
Expand Down
6 changes: 6 additions & 0 deletions design/verify.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ driver along and the normalizer should not.
download-url`) was the other way: it changes how the content looks, takes two clicks, and its
dialog's button is English whatever the content's language.

- **The preview page is the demo's page** (2026-11-10, #170): it links the player's `page.css` and
`mark.svg`, served from `dist/` as the element's script is, so the bar with the mark, the
Download button, the theme switch and the status strip with its state dot and timer are the
demo's own rules, not a copy that drifts. The owner found the system-styled page out of place
beside the demo and in Claude's browser panel, where the preview opens for them.

Not built, deliberately: steps that click through the content and check the xAPI it sends, and a
content digest for reviewing what was generated. A check of library versions against the hub's
catalogue, the commonest reason a package that plays here is refused on upload (h5p-cli builds
Expand Down
15 changes: 14 additions & 1 deletion design/vscode.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,9 @@ and committed, as are the app's install screenshots (`pnpm demo:screenshots`), w
comes from neither, and played trusted, sharing the page's origin, it can post as the page, so the
most it can do is misreport its own state. Until 2026-10-27 the webview relayed whatever the page
posted, a `mode` among them, which the extension took for the tab's switches and Open in Browser
played by. `tests/html.test.ts` runs both scripts in Node against stand-ins for their elements.
played by. The page takes one message the other way, the theme, from its parent window at the
webview's origin, as `light` or `dark` and nothing else. `tests/html.test.ts` runs both scripts
in Node against stand-ins for their elements.
- **A file that is not on this computer is copied first.** `extensionKind` is `ui` alone, so the
extension runs beside the webview, which reaches only this computer's loopback; a remote or
virtual workspace's file is copied to a temporary folder through `workspace.fs`, and copied again
Expand All @@ -152,6 +154,17 @@ and committed, as are the app's install screenshots (`pnpm demo:screenshots`), w
the pattern is a glob: until 2026-10-27 it was, and `quiz [v2].h5p` never matched itself, so its
previews never played again. The suite's file is named `package [v2] {draft}.h5p` for that.

- **The page is the demo's page** (2026-11-10, #170): it links the player's `page.css`, carried in
`assets/player/` with the element's files, so the player's box while it loads and the page's
colours are the demo's rules. The bar above it keeps VS Code's own theme colours, as an editor's
page should. The page's colours follow VS Code's theme, not the system's: the page is a frame
of its own, and its `prefers-color-scheme` is the system's, which need not be the editor's (found
in review, on #171). The webview reads the theme from the class VS Code puts on its body, a
high-contrast theme as the light or dark one it is built on, and names it in the page's address,
which the server writes onto `<html>` as `data-theme` before anything is drawn; a theme changed
while the preview is open goes to the page as a message, since a reload would lose the
learner's place.

Tests. `tests/*.test.ts` run in Node with the rest of `pnpm test`: the server against the built
player, runtime and pack, with its run of ports and Restricted Mode, and the webview's and the
page's scripts run against stand-ins. `tests/vscode/run.mjs` downloads VS Code into
Expand Down
15 changes: 15 additions & 0 deletions docs/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,21 @@ Words and AR Scavenger. A frame from another site gets neither unless the page a
embed package's [README](../packages/embed#readme) has the page's query parameters, the policy
files it writes for each kind of host, and the SCORM package it can write instead.

## A page in the demo's look

The player ships the demo's page styles as `@missing-elements/h5p-offline-player/page.css`: its
colours for light and dark, the bar, buttons, the status strip and the player's box while it
loads; `dist/mark.svg` is the mark. `h5p-verify --preview`, the H5P Preview extension and
the build page draw their pages with it, and a page of your own can, through a bundler that takes
CSS (Vite, webpack 5 with a CSS loader):

```js
import '@missing-elements/h5p-offline-player/page.css'
```

Without a bundler, copy `dist/page.css` beside your page, as the element's own files are, and link
it. It names no other file.

## When something goes wrong

[Troubleshooting](troubleshooting.md) lists the symptoms, causes and fixes. A site that allows
Expand Down
1 change: 1 addition & 0 deletions packages/player/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"types": "./types/plan.d.ts",
"default": "./dist/h5p-plan.js"
},
"./page.css": "./dist/page.css",
"./dist/*": "./dist/*"
},
"files": [
Expand Down
Loading
Loading