@aglyn/besigner-ui

中文文档
1.19.0发布于 2026/11/07Apache-2.0TypeScriptES Module构建来源已验证近 30 天下载 9880

The React UI of Besigner, Aglyn's visual editor, as it ships in the Aglyn console: the workspace, canvas viewport, element tree, inspector forms, toolbars, drag and drop, and working drafts. Install it if you want to mount the Aglyn editor in your own app

原始使用文档
文档目录5 节
  1. Install
  2. What's in it
  3. Usage
  4. How it fits
  5. License

@aglyn/besigner-ui

The React UI of Besigner, Aglyn's visual editor, as it ships in the Aglyn console: the workspace, canvas viewport, element tree, inspector forms, toolbars, drag and drop, and working drafts. Install it if you want to mount the Aglyn editor in your own app. If you want to build a different UI over the same editing logic, take @aglyn/besigner instead.

Published to npm from the Aglyn monorepo. Versions follow semantic versioning.

Install

npm install @aglyn/besigner-ui

Peer dependencies, all required today:

  • react
  • @mui/material, @mui/system, @mui/lab
  • next
  • firebase

next and firebase are peers an embeddable editor should not need, and they are still needed today. next is a peer because the viewport canvas and the workspace editor load parts of themselves with next/dynamic. firebase is a peer because the shared working-draft store (drafts/besigner-server-draft) reads and writes Firestore itself. The package has been proven to install and bundle from the registry with these peers present, together with react-dom and MUI's Emotion packages, and without firebase-admin, any @aglyn/tenant-* package or any @aglyn/plugins-* package.

What's in it

The pieces named below are exported from the package root unless a subpath is given; every file under src/lib is also reachable by subpath.

  • Root and providers: BesignerRootProviderComponent and the withBesignerContext wrapper set up the editor app context, the drag-and-drop context, the rendered-elements registry, the components drawer and the clipboard shortcuts.
  • Workspace and viewport: WorkspaceEditorComponent, WorkspacePanelComponent, AsidePanelComponent, ViewportRootComponent, ViewportCanvasComponent and ViewportFrameComponent. The frame renders the canvas with @aglyn/aglyn-node-renderer, swapping in the editor's own leaf (NodeLeaf) for selection and drag behavior.
  • Toolbars and controls: AppBarPrimaryComponent, the secondary app bar and breadcrumbs, HistoryControlsComponent, DevicePreviewControlsComponent, PanelControlsComponent, and the scheme preview, zoom, interact and add controls.
  • Element tree and canvas chrome: NodeTreeView, NodeOverlay, NodeOutline, NodeContextMenu, node quick actions and node cards.
  • Inspector: ElementPropsForm for a component's attributes, the element styles form, the properties dialog, property value forms, and token fields (token-text-field, token-pill). The box styler (BoxStyler) is at the subpath @aglyn/besigner-ui/box-styler/index.
  • Documents and drafts: useBesignerDocument loads and saves the document being edited through a source the caller supplies; useBesignerDraft, the browser draft store (readBesignerDraft, writeBesignerDraft, clearBesignerDraft) and the Firestore draft store (readServerDraft, writeServerDraft, clearServerDraft) keep work in progress. BesignerDraftAlertComponent and BesignerConflictAlertComponent surface them.
  • Hooks: useAglynBesignerFlag, useAglynBesignerPanel, useBesignerAppContext, useLeafDrag, useLeafDrop, useDeleteElementCallback and others.
  • Host seams, as React contexts the embedding app fills: MediaPickerContext, BindingPickerContext, BesignerInspectorExtrasContext, BesignerToolbarExtrasContext, and the component promotion, interactions and layout chrome contexts.

Usage

The editor is composed from these pieces rather than mounted as one component. Import from the root:

import {
  NodeTreeView,
  ViewportCanvasComponent,
  ViewportRootComponent,
  WorkspaceEditorComponent,
  useBesignerDocument,
  withBesignerContext,
} from '@aglyn/besigner-ui'

Two things have to be in place before the editor mounts, or it throws on its first render:

  • an editor app: call initializeBesignerApp() from @aglyn/besigner once;
  • the console theme served as CSS variables: render the editor inside ThemeCssVarProvider from @aglyn/shared-ui-theme, given { light: consoleThemeLight, dark: consoleThemeDark }. A plain MUI ThemeProvider is not enough, because the editor's styles read the theme's CSS variables.

The smallest working composition is the example app in the monorepo, examples/consumers/besigner-ui: a Vite app that installs these packages from npm, registers four element types of its own, and mounts the workspace, viewport and canvas. Aglyn's CI builds it and opens it in a browser on every release.

The full composition is the console's screen editor page, under apps/console/app/(editor)/[orgSlug]/hosts/[host]/screens/[screenId]/versions/[versionId]/besigner/page.tsx. It wraps the page with withBesignerContext, loads the document with useBesignerDocument, and lays out the workspace, viewport and panels. The components the canvas can render come from plugins registered with the core, such as @aglyn/plugins-mui.

How it fits

This is the besigner-ui scope of the package map, the top of the designer stack: it imports @aglyn/besigner (the logic), @aglyn/aglyn-node-renderer, @aglyn/aglyn-markdown-editor, the core @aglyn/aglyn, and the generic @aglyn/shared-* packages. It imports no plugin, and a plugin never imports the designer UI.

License

Apache-2.0. Source: https://github.com/aglyn/aglyn/tree/main/libs/besigner/feature/designer

版本与发布记录

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

版本发布日期距今
1.19.0latest2026/11/07今天
1.18.02026/11/07今天
1.17.02026/11/07今天
1.16.02026/11/07今天
1.15.22026/11/061 天前
1.15.12026/11/061 天前

其他发布通道:beta → 1.0.0-beta.296。

关于 @aglyn/besigner-ui 的常见问题

@aglyn/besigner-ui 是什么?

The React UI of Besigner, Aglyn's visual editor, as it ships in the Aglyn console: the workspace, canvas viewport, element tree, inspector forms, toolbars, drag and drop, and working drafts. Install it if you want to mount the Aglyn editor in your own app

如何安装 @aglyn/besigner-ui?

在项目目录运行 npm install @aglyn/besigner-ui,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:next(^16.3.3)、react(^19.2.8)、@mui/lab(^9.0.0-beta.8)、firebase(^13.0.0)、react-dom(^19.2.8)、@mui/system(^9.2.0)、@mui/material(^9.3.1)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@aglyn/besigner-ui 支持 TypeScript 吗?

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

@aglyn/besigner-ui 支持 ESM 还是 CommonJS?

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

@aglyn/besigner-ui 可以商用吗?

@aglyn/besigner-ui 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@aglyn/besigner-ui 的下载量有多少?

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

@aglyn/besigner-ui 还在维护吗?

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