@cosmicdrift/kumiko-document-designer

中文文档
0.419.0发布于 2026/11/11MITTypeScriptES Module构建来源已验证近 30 天下载 1.3万

Document designer for Kumiko: template overview, layout editor (mail layout, PDF letterhead) and the PDF template editor.

原始使用文档

@cosmicdrift/kumiko-document-designer

Document designer for Kumiko: the template overview, the layout editor for the mail layout and the PDF letterhead, and the PDF template editor.

import { createTemplateResolverFeature } from "@cosmicdrift/kumiko-bundled-features/template-resolver";
import { createDocumentDesignerFeature } from "@cosmicdrift/kumiko-document-designer";
import { documentDesignerClient } from "@cosmicdrift/kumiko-document-designer/web";

// server feature list
createTemplateResolverFeature();
createDocumentDesignerFeature();

createKumikoApp({
  clientFeatures: [documentDesignerClient({ appLocales: ["de", "en"] })],
});

Overview and layout editor

Mount createDocumentDesignerFeature() after template-resolver (and managed-pages if the branding rail should link to the branding screen).

  • Screens: templates (TenantAdmin, SystemAdmin), platform-templates (SystemAdmin, adds the "customised by" column), layout-editor (opened from the "Edit" row action of a layout), mail-editor (opened from the "Edit" row action of a mail template; subject, content, resources, preview and test mail).
  • Navs: document-designer:nav:templates and document-designer:nav:platform-templates. createAdminShellFeature({ includeDocumentDesigner: true }) lists them in the admin workspaces.
  • TEMPLATE_EDITOR_SCREENS maps a template kind to the screen that edits it; adding a kind there adds the "Edit" row action.
  • PreviewRecordPickerProvider (web export) adds a "pick a record" action to the mail preview; without it the action is hidden. Picked values are shown only, the preview endpoint takes no overrides.
  • The MJML tab of the layout editor is shown to SystemAdmin only and only when the system layout is MJML.

PDF template editor

The feature declares the pdf-template-editor screen (PDF_TEMPLATE_EDITOR_SCREEN_ID) and documentDesignerClient() registers its component; the "Edit" row action of PDF rows opens it. The screen reads the template from the URL: ?slug=invoice&locale=de. PdfTemplateEditor (props slug, locale, onLocaleChange) can also be mounted directly.

Requirements: the template-resolver and renderer-puppeteer-client features on the server. A SystemAdmin (via UserRolesProvider) edits the system template, everyone else a tenant customisation. PDF preview uses pdfjs-dist in the main thread (no worker or CDN requests).

版本与发布记录

@cosmicdrift/kumiko-document-designer 共发布 63 个版本,首次发布于 2026/10/17;过去 12 个月发布了 63 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.419.0latest2026/11/11今天
0.418.02026/11/101 天前
0.417.02026/11/091 天前
0.416.02026/11/082 天前
0.415.02026/11/064 天前
0.414.02026/11/055 天前

关于 @cosmicdrift/kumiko-document-designer 的常见问题

@cosmicdrift/kumiko-document-designer 是什么?

Document designer for Kumiko: template overview, layout editor (mail layout, PDF letterhead) and the PDF template editor.

如何安装 @cosmicdrift/kumiko-document-designer?

在项目目录运行 npm install @cosmicdrift/kumiko-document-designer,或使用 pnpm add / yarn add / bun add。

@cosmicdrift/kumiko-document-designer 支持 TypeScript 吗?

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

@cosmicdrift/kumiko-document-designer 支持 ESM 还是 CommonJS?

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

@cosmicdrift/kumiko-document-designer 可以商用吗?

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

@cosmicdrift/kumiko-document-designer 的下载量有多少?

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

@cosmicdrift/kumiko-document-designer 还在维护吗?

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