npm.io
1.0.0 • Published 22h ago

@univerjs/ui

Licence
Apache-2.0
Version
1.0.0
Deps
0
Vulns
0
Weekly
0
Stars
14.8K

@univerjs/ui

npm version license downloads

@univerjs/ui provides Univer's shared application UI framework, workbench services, menu infrastructure, dialogs, clipboard services, and Facade UI APIs.

Package Overview

Package UMD global CSS Locales Facade entry
@univerjs/ui UniverUi Yes Yes Yes

Installation

pnpm add @univerjs/ui
# or
npm install @univerjs/ui

Keep all @univerjs/* packages on the same version.

Usage

import '@univerjs/ui/lib/index.css';
import EnUS from '@univerjs/ui/locale/en-US';
import { UniverUIPlugin } from '@univerjs/ui';

univer.registerPlugin(UniverUIPlugin);

// Merge EnUS into your Univer locale map when this package contributes UI text.

Exported plugin classes:

  • UniverUIPlugin
  • UniverMobileUIPlugin

Format painter

The desktop Start ribbon has one format painter entry. A single click captures a detached format snapshot for one application; a double click keeps it active until Escape or another click on the entry. Unsupported targets do not consume the snapshot. The canvas displays a brush cursor on supported targets and an unavailable cursor elsewhere.

FormatPainterSessionService coordinates the local session. Host adapters claim the active editing context and apply formatting through their domain commands. A higher-priority shape selection prevents a stale cell selection from becoming the source. Changing the focused Unit or disposing the source Unit cancels the session. The session itself is not persisted.

The icon-only clear-formatting button below the format painter resets the active domain's formatting without removing content. Clearing cancels an active brush; each domain applies the change through its undoable commands.

Resources

Keywords