#566 Show a timeline in any page or AI chat reply with
–
- github
- github/openchronology/timeline-app
- github/openchronology/timeline-app#566
- pull request
- state:merged
Adds `@openchronology/timeline` (`packages/timeline`): the offline editor as an ` ` element that pages, docs sites and AI chats' artifacts can load from jsDelivr or unpkg. ```html <script src="https://cdn.jsdelivr.net/npm/@openchronology/timeline@ /dist/timeline.js"> { "title": "Moon landings", "presentation": "gregorian", "events": [ … ] } ``` - **Element** (`packages/timeline/src/element.js`): the offline HTML in a sandboxed `srcdoc` frame (scripts only, opaque origin, no network). Its timeline can be written inline, set with `element.timeline = doc`, or fetched from `src`. It fills in `format`, `version`, `description`, and a `presentation` named by its mode, so a model writes only what matters. Attributes: `mode="view"`, `height`, `theme`, `title`. Text that isn't JSON is reported in place of the frame. - **Editor** (`src/app.ts`, `src/styles.css`): the offline file opens a ` ` in its page at its default view, optionally in view mode. It uses a compact layout without the site header, keeping the title, View mode and Export (`body[data-inline]`). - **Build:** `npm run build:timeline` (`scripts/timeline-package.mjs`, `--version` from the tag) writes `dist/timeline.js` (~730 KB) plus LICENSE, NOTICE and THIRD_PARTY. - **Release:** a new `npm` job publishes stable releases with provenance once the `NPM_TOKEN` secret is set; without it, it posts a notice and publishes nothing. - **Tests:** `test/timeline-package-browser.mjs` runs in each browser job. It loads the element under an artifact-like CSP (`script-src 'self' 'unsafe-inline'`) and checks: the short-form timeline opens with its default view and Gregorian dates, in view mode, in the requested theme and height; the frame can't reach its parent; replacing the timeline by script works; broken JSON is reported. - **Docs:** the package README (its npm page), a sharing section "In other pages and AI chats", and a line in `/llms.txt` so models find it. Locally: typecheck, `npm test`, `test:offline:browser` and the new test pass (Chromium; Firefox and WebKit run in CI). 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_011fFY8eruEi1xAkkMBni13B https://github.com/circagraph/timeline-app/pull/566
Related
Open #566 Show a timeline in any page or AI chat reply with in the timeline