@datalayer/decks

中文文档
1.0.6发布于 2026/10/26SEE LICENSE IN LICENSETypeScriptES Module构建来源已验证近 30 天下载 4140

Presentations described as data: a spec-driven Reveal.js deck engine, and the Reactor plugin that lists, opens and creates decks in any Reactor shell.

原始使用文档
文档目录5 节
  1. Installation
  2. Usage
  3. Notes, Play and Video
  4. Agents
  5. Development

Datalayer

☰ 🃏 Datalayer Decks

Slide decks, described as data — and the Reactor plugin that puts them in any Reactor shell.

spec (.ts, YAML-shaped)
   ↓  validation
template            branding, palette, type scale, layout overrides
   ↓
slide library       reusable semantic slide types
   ↓
@revealjs/react → Reveal.js

A spec says type: metrics; how a metrics slide looks is the template's business. That is what lets one deck be an application deck, a conference talk and a dark projection deck by changing one word.

Installation

pip install datalayer_decks
datalayer decks serve          # http://127.0.0.1:8797, opens the browser
datalayer decks serve my-deck.yaml  # load YAML and open this deck directly
datalayer decks list

Installing the package adds a decks group to the Datalayer CLI — serve, list, show, delete — through the reactor's datalayer.cli entry-point group; datalayer-decks is the same group on its own. serve runs the decks API (/decks, JSON specs on disk) and the interface built from app/ from one origin. The interface is a Reactor shell: the decks plugin in the sidebar and main slots, the plugins manager, the command palette, and — at the header's right edge — the appearance menu of @datalayer/primer-addons, the color mode and theme chooser the Datalayer header wears. Set DATALAYER_DECKS_DIR (or --decks-dir) to choose where decks are stored (~/.datalayer/decks otherwise).

A YAML file passed to serve is loaded into a temporary store and opened at its deck URL, so trying a file does not alter the user's normal deck catalog. Pass --decks-dir as well when the imported copy should persist. A diagram is ordinary spec content, either as a full slide or inside a column:

- type: mermaid
  title: From specification to screen
  diagram: |
    flowchart LR
      YAML[Deck YAML] --> Validate
      Validate --> Reveal[Reveal.js]

Installed beside any other Reactor host, the same wheel publishes itself as an extension: the routes join that host, and the Decks plugin — built by extension/ as a Module Federation container into share/datalayer/reactor/extensions/decks — is loaded into that host's shell through federation, no import needed. See python-packaged extensions.

Usage

import { registerDecks, DeckView, DecksHostProvider } from '@datalayer/decks';
import { DecksPlugin } from '@datalayer/decks/plugin';
  • @datalayer/decks — the engine: types, validateDeck, the slide library, the templates (datalayer, datalayer-brand, datalayer-ink), DeckRenderer, DeckView, DeckPrintView, DeckAccess, and two registries the host fills — the deck catalog (registerDecks) and the components a spec may name (registerDeckComponents).
  • @datalayer/decks/plugin — DecksPlugin: a list in the sidebar slot, the open deck in main, a "Decks" entry in the shell's view selector, and commands with keystrokes.
CommandKeystrokeDoes
decks.listMod+Shift+Dclose the open deck, show the list
decks.newMod+Alt+Nthe "new deck" dialog
decks.open—open a deck by id ({ id, slide? })
decks.renameF2rename the open deck (or { id }): title, address, family
decks.delete—delete the open deck (or { id }), after asking
decks.goToSlide—move the open deck to a slide ({ slide })
decks.nextSlide / decks.previousSlideAlt+→ / Alt+←move through the open deck
decks.presentMod+Shift+Fthe open deck, fullscreen
decks.printMod+Shift+Pthe print view, for Save as PDF

What the engine needs from the application around it — the theme, a footer logo, whether the reader is signed in — arrives through DecksHostProvider, with defaults that make a bare mount work.

Notes, Play and Video

Every slide may carry notes. Above a deck, Notes shows them to the presenter (never in the PDF). When the host gives a voice (DecksHost.useNarrator, a DeckNarrator), two more buttons follow Download PDF:

  • Play reads the notes aloud, slide after slide, as captions at the bottom of the slide; a slide without notes stays four seconds.
  • Video makes the same into a video file, in the browser: each slide drawn at 1920×1080 (fragments shown, fonts, pictures and Mermaid diagrams waited for), each sentence voiced by the narrator's synthesize(sentence) — the whole audio of one sentence, in a format AudioContext.decodeAudioData reads — and the deck recorded with the sentence being said as a caption, with MediaRecorder: MP4 where the browser records it, WebM otherwise. It records in real time, with its progress, Sound on/off and Cancel above the deck, and keeps going in a background tab. You see and hear it as it records — the deck on screen follows the slide being recorded, with its caption, as Play does, and goes back where you were at the end; Sound off silences the speakers only, the video keeps its sound. Then it offers the video and a WebVTT captions file with the same sentences and timings, named after the deck.

A host that keeps the video passes DeckView a videoPublisher (DeckVideoPublisher: a label, publish(made, spec), and what to say once published) — or gives it once, for every deck under it, as DecksHost.videoPublisher (how a host keeps the video of a deck the plugin draws; DeckView's own prop wins). Video then reads as the label, and the video — with its captions and poster, the first slide as a 1920×1080 PNG — is handed to publish as soon as it is made, with spec, the deck as it was when Video was pressed, so the host can tell later whether the video is still the deck's; a refusal shows its reason with Upload again.

The landing does this twice. On a deck's page in its space, the video is saved with the deck (Spacer, PUT /api/spacer/v1/decks/{id}/video, in the private bucket): the next time the page opens it plays above the slides with Download, without being made again, and Video reads Make again — the page says so when the deck was edited after it was made. Publishing that deck to the Library offers Publish as a video, which copies the saved video into the Library's public one. On a published deck's Library page, its owner's Make the video uploads straight to the Library.

A narrator without synthesize gives no Video button. A narrator that cannot speak for this reader (unavailable, with needsSignIn when signing in is the way out) has both buttons say why rather than play or record.

Agents

Everything an agent may do with decks is declared by this plugin, as one AgentTools bundle (src/plugin/agentTools.json): the data — decks_list_decks, decks_get_deck, decks_create_deck, decks_update_deck, the per-slide edits, decks_delete_deck — and the screen — decks_open, decks_go_to_slide, decks_next_slide, decks_previous_slide, decks_present, decks_print, decks_list. Each is a command the plugin registers (DECKS_DATA_COMMANDS, DECKS_COMMANDS), run on the page against the catalog and the store — saved to this server when the plugin was given one — and answering with what the model needs next. No agentspec names a deck tool; example-decks declares tools: [] and gets them all from the plugin it is mounted beside.

The Python half serves the same file from GET /plugins/agent-tools, and registers the data half of the suite under the same ids (datalayer_decks/commands.py, through provide_slash_commands) — so on a host with no browser the commands the bundle names are commands the reactor actually has, reachable from reactor commands list and reactor commands run decks.getDeck '{"id": "talks/hello"}' as much as from an agent. The seven that move a deck on screen stay with the browser plugin: a store has no screen.

In the datalayer decks interface itself, --reactor-plugins ai-agents puts the Decks agent (example-decks) beside the decks: a floating chat on a temporary inference key, with the bundle above as its tools, read from the reactor rather than declared — see plugins/ai-agents. example-decks and worker-pitcher (the landing's deck editor agent) name the same frontend toolset, decks, in agentspecs.

In a Loop (@datalayer/agent-runtimes), @datalayer/loop-plugin-decks mounts this plugin beside the chat — the list in the sidebar, a Deck editor view, a menu on the composer — and the chat hands the agent the bundle's commands as tools, so an agent writes and drives a deck with no server behind it. The DecksAgent example shows it.

Development

make install          # pip install -e ".[test]"
make build-lib        # tsc → lib/
make build-app        # the interface → share/datalayer/reactor/apps/decks
make build-extension  # the container → share/datalayer/reactor/extensions/decks
make wheel            # both, then the wheel (hatch_build.py builds what is missing)
make test
make dev-app          # Rsbuild on :5190, against `datalayer decks serve` on :8797
make example          # serve examples/welcome/welcome.yaml directly

The container build needs @module-federation/rsbuild-plugin (a devDependency): npm install once in this package.

The deck definitions of a product stay with that product: the Datalayer landing keeps its specs, its registry entries and its design-system illustrations, and mounts this package around them.

版本与发布记录

@datalayer/decks 共发布 7 个版本,首次发布于 2026/09/18;过去 12 个月发布了 7 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.0.6latest2026/10/2616 天前
1.0.52026/10/2616 天前
1.0.42026/09/261 个月前
1.0.32026/09/261 个月前
1.0.22026/09/201 个月前
1.0.12026/09/191 个月前

关于 @datalayer/decks 的常见问题

@datalayer/decks 是什么?

Presentations described as data: a spec-driven Reveal.js deck engine, and the Reactor plugin that lists, opens and creates decks in any Reactor shell.

如何安装 @datalayer/decks?

在项目目录运行 npm install @datalayer/decks,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(>=18)、react-dom(>=18)、@primer/react(^37.31.0)、@datalayer/design(^1.0.2)、@datalayer/reactor(^1.0.4)、@primer/octicons-react(>=19.35.0)、@datalayer/primer-addons(^1.0.23)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@datalayer/decks 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@datalayer/decks 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@datalayer/decks 可以商用吗?

@datalayer/decks 使用 SEE LICENSE IN LICENSE 许可。许可条款写在包内的独立文件中,请阅读该文件确认可否商用。以上为概括,不构成法律意见,请以许可原文为准。

@datalayer/decks 的下载量有多少?

根据 npm 官方下载统计,@datalayer/decks 在 2026/10/12 – 2026/11/10 这 30 天内被下载 4,140 次,日均约 138 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@datalayer/decks 还在维护吗?

最新版本 1.0.6 发布于 2026/10/26(16 天前);至今共发布 7 个版本,其中过去 12 个月发布了 7 个;首次发布于 2026/09/18。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。