@dskripchenko/embed

中文文档
1.7.0发布于 2026/11/01MITES Module零依赖构建来源已验证

Drop-in custom elements for any web page from a CDN: video and audio players, Mermaid diagrams, OpenAPI references, process flows, live markdown and a WYSIWYG editor, sharing one Vue runtime and cooperating through a block registry and an event bus.

原始使用文档
文档目录7 节
  1. Elements
  2. Working together
  3. Loader or bundle
  4. Browsers
  5. Known limitations
  6. Development
  7. License

@dskripchenko/embed

npm license

Video and audio players, Mermaid diagrams, OpenAPI references, process flows, live markdown and a WYSIWYG editor — as HTML tags on any page: plain HTML, a CMS, WordPress, Blade, React. One script from a CDN. The elements share one Vue and one UI kit, render each other's blocks, and talk through DOM events.

English · Русский · Deutsch · 中文

<head>
  <script src="https://cdn.jsdelivr.net/npm/@dskripchenko/embed@1/dist/embed.js"></script>
</head>
<body>
  <dsk-flow src="/process.json" poll-url="/process/state" openapi-target="#api" media-target="#tour"></dsk-flow>
  <dsk-video id="tour" src="/tour.mp4">
    <track kind="chapters" src="/tour.chapters.vtt" default>
  </dsk-video>
  <dsk-openapi id="api" src="/openapi.yaml" height="720"></dsk-openapi>

  <dsk-markdown>
    <script type="text/markdown">
      ```mermaid
      sequenceDiagram
        Shop->>Payments: charge
      ```
    </script>
  </dsk-markdown>

  <form method="post"><dsk-editor name="body"></dsk-editor></form>
</body>

Clicking a process step opens its API operation and plays its chapter of the video; the markdown's diagram is live; the editor submits HTML with the form.

Elements

Built on
<dsk-video>player: sources and quality menu, subtitles, chapters, thumbnails, HLS@dskripchenko/ui
<dsk-audio>player, playlist, waveform@dskripchenko/ui
<dsk-diagram>Mermaid, PlantUML, Graphviz DOT, D2, DBML, Structurizr, Wardley → SVG, no Vue loaded@dskripchenko/diagrams
<dsk-openapi>full reference (several specs), one operation, or a live API block@dskripchenko/openapi
<dsk-flow>process view with monitoring, toggles and sub-processes over plain HTTP — or the editor@dskripchenko/flow
<dsk-asyncapi>AsyncAPI 2.x / 3.0 reference of an event-driven API@dskripchenko/openapi
<dsk-bpmn>, <dsk-dmn>BPMN processes and DMN decisions as laid out in the modeler — a view or the editor@dskripchenko/bpmn
<dsk-drawio>draw.io files to SVG, page tabs, no Vue loaded@dskripchenko/drawio
<dsk-kanban>a kanban board written as markup: columns, lanes, tags, WIP limits; drag cards, edit them, a lock@dskripchenko/ui
<dsk-calendar>events written as markup, with repeats: day, week, month, year, agenda; drag, an event builder, a lock@dskripchenko/ui
<dsk-board>infinite whiteboard: shapes, stickies, frames, connectors, pen — a view, an editor, or a shared board edited in real time@dskripchenko/board
<dsk-markdown>markdown with live blocks: diagrams in every syntax above, bpmn, dmn, drawio, openapi, asyncapi, flow, board, kanban, calendar, video, audio@dskripchenko/ui
<dsk-editor>WYSIWYG with the same live blocks; a form field@dskripchenko/wysiwyg

All of them: attributes ↔ properties, dsk:* events, ready, loading="lazy", light DOM (your CSS applies); diagrams, processes, flows, boards and references open full screen. → Elements

Working together

  • One runtime. The loader writes an import map pinning Vue, the kit and the plugin packages to the exact versions of the release; every element and live block renders in one Vue app context — one locale, one theme, one set of block renderers.
  • Blocks. DskEmbed.blocks.register('chart', renderer) — the live-block contract of the kit and the editor — makes ```chart live in markdown, in the editor and in DskEmbed.renderBlocks(root), which turns stored HTML (<pre><code class="language-…">) into widgets. → Blocks
  • Configuration. DskEmbed.configure({ theme: 'light' | 'dark' | 'system', locale: 'en' | 'ru' }), or just the page's <html data-theme lang>. → Configuration and events
  • Events. DskEmbed.on('node', …), or addEventListener('dsk:node', …) on any ancestor; React and other hosts use refs and plain listeners. → Frameworks

Loader or bundle

gzipped
dist/embed.js — the loader9.1 KBClassic script; elements, API, import map. Everything else on demand.
dist/embed.bundle.js — the fat bundle563 KB (2.0 MB)Everything inside; no import map, no further requests.
dist/bundles/<plugin>.js — one plugin each91–227 KBVue and the kit inside; several on a page share one runtime. → Getting started

What the loader fetches on demand (gzip -9 of the published files; jsDelivr serves Brotli, a little smaller):

First element of…Fetches
any Vue elementVue runtime 41.5 KB, @dskripchenko/ui 102.6 KB (its icons inside) + CSS 30.1 KBonce per page
<dsk-video> / <dsk-audio>plugin 3.5 KB; the HLS adapter 14.6 KB only for .m3u8
<dsk-diagram>plugin 0.8 KB, @dskripchenko/diagrams 99.7 KB, kit tokens 2.4 KBno Vue, no kit components
<dsk-openapi>plugin 1.4 KB, @dskripchenko/openapi 180.5 KB + CSS 10.5 KB, icons 5.2 KB
<dsk-flow>plugin 2.5 KB, @dskripchenko/flow 79.9 KB + CSS 4.6 KB, icons 5.2 KB; the Mermaid import (2.4 KB + diagrams) only for Mermaid sources and the editor
<dsk-board>plugin 1.3 KB, @dskripchenko/board 46.4 KB (its icons inside) + CSS 1.9 KB
<dsk-markdown>plugin 0.5 KBblocks load their own plugins
<dsk-editor>plugin 1.1 KB, @dskripchenko/wysiwyg 18.2 KB + CSS 2.3 KB, icons 5.2 KB

The icons file (76 icons, one file) is shared: fetched once, by the first of openapi, flow and the editor.

→ Getting started: snippets, self-hosting, composing with your own import map, CSP, versioning.

Browsers

Current Chromium, Safari and Firefox. The loader needs import maps; there is no legacy build. Tested in Chromium and WebKit (Playwright): both builds, both themes, both languages, desktop and phone.

Known limitations

  • The theme is page-wide (<html data-theme>): the kit's themes are defined on :root, and its menus and dialogs live in <body>.

Development

pnpm install
pnpm build              # dist/ and the size table
pnpm test               # unit tests (vitest, jsdom)
pnpm lint && pnpm typecheck
node scripts/fixtures.mjs           # media fixtures for the browser check (ffmpeg)
pnpm check:browser                  # Chromium + WebKit against a local mirror of the CDN
node scripts/mirror.mjs <dir>       # self-hosting: the runtime in the CDN's layout
node scripts/demo.mjs <dir> --local # the demo page (examples/demo) for a host site

The browser check serves node_modules the way jsDelivr serves npm (/npm/<pkg>@<version>/…, exact versions only) from a second origin, so the import map, cross-origin module loading and the version pins are exercised for real.

License

MIT

版本与发布记录

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

版本发布日期距今
1.7.0latest2026/11/012 天前
1.6.02026/10/312 天前
1.5.32026/10/312 天前
1.5.22026/10/312 天前
1.5.12026/10/313 天前
1.5.02026/10/313 天前

关于 @dskripchenko/embed 的常见问题

@dskripchenko/embed 是什么?

来自CDN的任何网页的自定义元素:视频和音频播放器,Mermaid图表,OpenAPI引用,流程流,实时标记和所见即所编辑器,共享一个Vue运行时,并通过块注册表和事件总线进行协作。

如何安装 @dskripchenko/embed?

在项目目录运行 npm install @dskripchenko/embed,或使用 pnpm add / yarn add / bun add。

@dskripchenko/embed 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/dskripchenko__embed 是否存在。

@dskripchenko/embed 支持 ESM 还是 CommonJS?

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

@dskripchenko/embed 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=20。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@dskripchenko/embed 可以商用吗?

@dskripchenko/embed 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@dskripchenko/embed 还在维护吗?

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