From 55aa3c6337efd4a9031744fafba3469aec029f74 Mon Sep 17 00:00:00 2001 From: Aleksandr Shevchuk Date: Fri, 20 Nov 2026 13:29:14 +0200 Subject: [PATCH 1/2] deps: h5p-author 0.15.0, and the build page saves the source it built (#84) --- package.json | 2 +- pnpm-lock.yaml | 18 +++++++++--------- src/assets/site.css | 2 ++ src/h5p/build/build-page.ts | 11 +++++++++++ src/h5p/build/index.njk | 16 ++++++++++++++-- src/h5p/create-with-ai/index.njk | 2 +- 6 files changed, 38 insertions(+), 13 deletions(-) diff --git a/package.json b/package.json index 54ea608..efe3d58 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "@codemirror/state": "6.7.6", "@codemirror/view": "6.43.15", "@lezer/highlight": "1.2.5", - "@missing-elements/h5p-author": "0.14.0", + "@missing-elements/h5p-author": "0.15.0", "@missing-elements/h5p-libraries": "1.1.1", "@missing-elements/h5p-offline-player": "1.7.0", "@missing-elements/h5p-runtime": "1.0.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 538f30a..b29a16d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -33,8 +33,8 @@ importers: specifier: 1.2.5 version: 1.2.5 '@missing-elements/h5p-author': - specifier: 0.14.0 - version: 0.14.0(@missing-elements/h5p-runtime@1.0.2) + specifier: 0.15.0 + version: 0.15.0(@missing-elements/h5p-runtime@1.0.2) '@missing-elements/h5p-libraries': specifier: 1.1.1 version: 1.1.1 @@ -164,8 +164,8 @@ packages: '@marijn/find-cluster-break@1.0.4': resolution: {integrity: sha512-Wy0V7+SGUjnF9/TkiM1hKVDPj7jKXduPNboMVtHTA8dySMURWqfg/JZ9E2Sq8JgSJmkl7k7Qe9FLeMSrSraWmQ==} - '@missing-elements/h5p-author@0.14.0': - resolution: {integrity: sha512-zRyknhCLbCJDHZjXftEFVj72sfZ7btSoEStW8uQhWSkO115aCzHwR3IHgp8mpdxmOwl2bV2hkTTJ0ueCeyBPWA==} + '@missing-elements/h5p-author@0.15.0': + resolution: {integrity: sha512-aw4T8zqkH/llh3UfSQOXaVHlKTq9uMKl+gDtcs7Ss6VH545UKLQIBTlVuSwMCVw1Q9xFLnivGhXfKBUvjey6jg==} engines: {node: '>=22'} hasBin: true @@ -173,8 +173,8 @@ packages: resolution: {integrity: sha512-JS7sNI45exXa9Dgb7QBoNFMmzGnc21yw0RJMzW8ym9OCKMFOar6tdYfCp55O9RzLVHUhhtwO0Os2OhGLePzoww==} engines: {node: '>=20'} - '@missing-elements/h5p-normalize@1.4.1': - resolution: {integrity: sha512-uXk7fBcFaCUtaB5emKatHwcOaTXUhHJi5nxEDIIRHnnHdrT/PKb1Ypd9PQZI5qodTvlXQkNeQ1OOIVISVrcHZw==} + '@missing-elements/h5p-normalize@1.5.0': + resolution: {integrity: sha512-qSSt8H30xCH6MTBO3w11vbtE/o5YjNH3hL2P27p6Gm3nzn1EkwdYb+lqU+zvdjT8UhtC5HPl+a8pfPJPpIcB7Q==} engines: {node: '>=22'} hasBin: true @@ -1278,10 +1278,10 @@ snapshots: '@marijn/find-cluster-break@1.0.4': {} - '@missing-elements/h5p-author@0.14.0(@missing-elements/h5p-runtime@1.0.2)': + '@missing-elements/h5p-author@0.15.0(@missing-elements/h5p-runtime@1.0.2)': dependencies: '@missing-elements/h5p-libraries': 1.1.1 - '@missing-elements/h5p-normalize': 1.4.1 + '@missing-elements/h5p-normalize': 1.5.0 '@missing-elements/h5p-offline-player': 1.7.0(@missing-elements/h5p-runtime@1.0.2) '@zip.js/zip.js': 2.25.0 zod: 4.6.7 @@ -1290,7 +1290,7 @@ snapshots: '@missing-elements/h5p-libraries@1.1.1': {} - '@missing-elements/h5p-normalize@1.4.1': + '@missing-elements/h5p-normalize@1.5.0': dependencies: '@zip.js/zip.js': 2.25.0 diff --git a/src/assets/site.css b/src/assets/site.css index 9e695fb..a879a1d 100644 --- a/src/assets/site.css +++ b/src/assets/site.css @@ -1051,6 +1051,8 @@ pre.prompt { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.9375re .build .file-list li[data-chosen="true"]::before { border: 0; border-radius: 0; background: var(--accent); mask: var(--icon-check) center / contain no-repeat; } .build .file-list li[data-chosen="false"] { color: var(--muted); } .build .hint { color: var(--muted); font-size: 0.875rem; } +/* The package and its source, side by side, and one under the other where they do not fit. */ +.build .downloads { display: flex; flex-wrap: wrap; gap: 0.6rem; } /* H5P content draws on white, whatever the page's theme. */ /* H5P content draws on white, whatever the page's theme. Clipped to the box's corners. */ .player-box { margin: 1rem 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: clip; background: #ffffff; } diff --git a/src/h5p/build/build-page.ts b/src/h5p/build/build-page.ts index 70dff9f..c78b048 100644 --- a/src/h5p/build/build-page.ts +++ b/src/h5p/build/build-page.ts @@ -60,6 +60,7 @@ const notesBox = $('notes-box') const notesList = $('notes') const playStep = $('play-step') const download = $('download') +const downloadSource = $('download-source') const player = $('player') as HTMLElementTagNameMap['h5p-player'] const sample = $('sample') as HTMLElementTagNameMap['h5p-player'] const sampleFigure = $('sample-figure') @@ -97,6 +98,8 @@ let typeFilesArriving: Promise | null = null let shows = 0 /** The address of the package last built, given back when the next one replaces it. */ let packageUrl: string | null = null +/** The address of its source, as the build took it, given back likewise. */ +let sourceUrl: string | null = null /** Counts builds, so that one overtaken by a newer one shows nothing. */ let builds = 0 /** Whether the address carries a source, which it then keeps in step with the source as it changes. */ @@ -304,6 +307,14 @@ async function build(): Promise { download.href = packageUrl download.download = name download.textContent = `Download ${name}` + // The source as the build took it, naming what it was built with, under the package's name: + // the file the command line writes beside a package, and the one "Or open a file" takes. + const sourceName = name.replace(/\.h5p$/, '.source.json') + if (sourceUrl) URL.revokeObjectURL(sourceUrl) + sourceUrl = URL.createObjectURL(new Blob([`${JSON.stringify(result.source, null, 2)}\n`], { type: 'application/json' })) + downloadSource.href = sourceUrl + downloadSource.download = sourceName + downloadSource.textContent = `Download ${sourceName}` showNotes([...result.notes, ...translationNotes(String(result.manifest.language ?? ''), result.translations)]) const media = result.media.length ? `, ${result.media.length} media file${result.media.length === 1 ? '' : 's'}` : '' setStatus(`Built “${title}”: ${String(result.manifest.mainLibrary)}, ${result.libraries.length} libraries${media}, ${sized(result.blob.size)}. Starting it below…`, 'building') diff --git a/src/h5p/build/index.njk b/src/h5p/build/index.njk index 6c267e6..9a9177d 100644 --- a/src/h5p/build/index.njk +++ b/src/h5p/build/index.njk @@ -103,7 +103,7 @@ csp: "default-src 'self'; script-src 'self'; style-src 'self'; img-src 'self' da
  • Privacy first, no server of ours

    -

    Your chat builds the activity in its own sandbox, or this page builds and plays it on your computer: nothing you make is sent to us. It is free and open source, and needs no account.

    +

    Your chat builds the activity in its own sandbox, or this page builds and plays it on your computer: nothing you make is sent to us. Where your source names a picture or a video by web address, the page asks that address's site for it, and YouTube or Vimeo whether the video is there. It is free and open source, and needs no account.

  • @@ -239,7 +239,19 @@ csp: "default-src 'self'; script-src 'self'; style-src 'self'; img-src 'self' da Work through all of it, wrong answers included, and check the answers and feedback against your material. The build checks the structure, not whether the content is right.

    -

    Download the .h5p

    + {#- The source goes with the package, as the command line writes it beside one (author + 0.15.0, h5p-toolkit#219): as the build took it, naming the version of its content type + it was built with, so that a later build with newer libraries can say the type has + moved. It is the build's, not the box's text, which stays as the person wrote it. -#} +

    + Download the .h5p + Download its source +

    +

    + Keep the source with the file. To change the activity later, open the source here and + build it again: it names the version of its content type it was built with, and a build + with newer libraries says if that has moved. +

    diff --git a/src/h5p/create-with-ai/index.njk b/src/h5p/create-with-ai/index.njk index 36f1117..fc83413 100644 --- a/src/h5p/create-with-ai/index.njk +++ b/src/h5p/create-with-ai/index.njk @@ -165,7 +165,7 @@ csp: "default-src 'self'; script-src 'self'; style-src 'self'; img-src 'self'; o

    From the source, the build page builds it in your browser, plays it, and saves the file - with Download the .h5p. A chat that built the file gives its source file too: open it on the + with Download the .h5p, and its source with the button beside it. A chat that built the file gives its source file too: open it on the build page to play the activity before you use it.

    {#- The whole of the archive is here, under a heading of its own, where a reader has just From 03fcebe530cea44448780a05fbfc67f23aee3663 Mon Sep 17 00:00:00 2001 From: Aleksandr Shevchuk Date: Fri, 20 Nov 2026 13:51:39 +0200 Subject: [PATCH 2/2] docs(guide): name the source's button by its label (#84) --- src/h5p/create-with-ai/index.njk | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/h5p/create-with-ai/index.njk b/src/h5p/create-with-ai/index.njk index fc83413..16d4861 100644 --- a/src/h5p/create-with-ai/index.njk +++ b/src/h5p/create-with-ai/index.njk @@ -165,8 +165,9 @@ csp: "default-src 'self'; script-src 'self'; style-src 'self'; img-src 'self'; o

    From the source, the build page builds it in your browser, plays it, and saves the file - with Download the .h5p, and its source with the button beside it. A chat that built the file gives its source file too: open it on the - build page to play the activity before you use it. + with Download the .h5p, and its source with Download its source. A chat that built the + file gives its source file too: open it on the build page to play the activity before you + use it.

    {#- The whole of the archive is here, under a heading of its own, where a reader has just seen which of the two their chat gave: nobody can tell beforehand whether a chat's code