Skip to content

Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.

chore(doc/slide): add ui-plugin-docs and ui-plugin-slides

Dushusirb8cf7025d0c2
diff --git a/cli/src/templates/base/README-zh.md b/cli/src/templates/base/README-zh.md
deleted file mode 100644
index f40dc58f36..0000000000
--- a/cli/src/templates/base/README-zh.md
+++ /dev/null
@@ -1,55 +0,0 @@
-# style-univer
-
-简体中文 | [English](./README.md)
-
-## 介绍
-
-UniverSheet <%= projectUpperValue %>插件
-
-### 安装
-
-```shell
-npm i @univerjs/<%= projectName %>
-```
-
-### 使用
-
-```js
-import {<%= projectUpperValue %>} from '@univerjs/<%= projectName %>'
-
-const univerSheet = new UniverSheet();
-univerSheet.installPlugin(new <%= projectUpperValue %>());
-```
-
-## 本地开发
-
-### 环境
-
-- [Node.js](https://nodejs.org/en/) Version >= 10
-- [npm](https://www.npmjs.com/) Version >= 6
-
-### 安装
-
-```
-pnpm install
-```
-
-### 开发
-
-```
-# 当前目录 ./packages/<%= projectName %>/
-npm run dev
-
-# 或者项目根目录 ./
-pnpm run --filter @univerjs/<%= projectName %> dev
-```
-
-### 打包
-
-```
-# 当前目录 ./packages/<%= projectName %>/
-npm run build
-
-# 或者根目录 ./
-pnpm run --filter @univerjs/<%= projectName %> build
-```
diff --git a/cli/src/templates/base/README.md b/cli/src/templates/base/README.md
index 7df1ecfaf3..f94a285cef 100644
--- a/cli/src/templates/base/README.md
+++ b/cli/src/templates/base/README.md
@@ -1,55 +1,14 @@
-# style-univer
-
-English| [简体中文](./README-zh.md)
+# @univerjs/<%= projectName %>
## Introduction
-UniverSheet Plugin <%= projectUpperValue %>
+Univer <%= projectName %>
+## Usage
### Installation
-
```shell
npm i @univerjs/<%= projectName %>
```
-### Usage
-
-```js
-import {<%= projectUpperValue %>} from '@univerjs/<%= projectName %>'
-
-const univerSheet = new UniverSheet();
-univerSheet.installPlugin(new <%= projectUpperValue %>());
-```
-
-## Local development
-
-### Requirements
-
-- [Node.js](https://nodejs.org/en/) Version >= 10
-- [npm](https://www.npmjs.com/) Version >= 6
-
-### Installation
-
-```
-pnpm install
-```
-
-### Development
-
-```
-# Current directory ./packages/<%= projectName %>/
-npm run dev
-
-# Or project root directory ./
-pnpm run --filter @univerjs/<%= projectName %> dev
-```
-
-### Package
-
-```
-# Current directory ./packages/<%= projectName %>/
-npm run build
-
-# Or root directory ./
-pnpm run --filter @univerjs/<%= projectName %> build
-```
+### API
+Check [Univer](https://github.com/dream-num/univer/)
\ No newline at end of file
diff --git a/cli/src/templates/base/package.json b/cli/src/templates/base/package.json
index aae954499a..8e0b9eb62b 100644
--- a/cli/src/templates/base/package.json
+++ b/cli/src/templates/base/package.json
@@ -51,7 +51,6 @@
"@univerjs/base-ui": "workspace:^0.0.1",
"@univerjs/base-render": "workspace:^0.0.1",
"@univerjs/core": "workspace:^0.0.1",
- "@univerjs/base-sheets": "workspace:^0.0.1",
"preact": "^10.5.14"
}
}
diff --git a/cli/src/templates/common-plugin/README-zh.md b/cli/src/templates/common-plugin/README-zh.md
deleted file mode 100644
index f40dc58f36..0000000000
--- a/cli/src/templates/common-plugin/README-zh.md
+++ /dev/null
@@ -1,55 +0,0 @@
-# style-univer
-
-简体中文 | [English](./README.md)
-
-## 介绍
-
-UniverSheet <%= projectUpperValue %>插件
-
-### 安装
-
-```shell
-npm i @univerjs/<%= projectName %>
-```
-
-### 使用
-
-```js
-import {<%= projectUpperValue %>} from '@univerjs/<%= projectName %>'
-
-const univerSheet = new UniverSheet();
-univerSheet.installPlugin(new <%= projectUpperValue %>());
-```
-
-## 本地开发
-
-### 环境
-
-- [Node.js](https://nodejs.org/en/) Version >= 10
-- [npm](https://www.npmjs.com/) Version >= 6
-
-### 安装
-
-```
-pnpm install
-```
-
-### 开发
-
-```
-# 当前目录 ./packages/<%= projectName %>/
-npm run dev
-
-# 或者项目根目录 ./
-pnpm run --filter @univerjs/<%= projectName %> dev
-```
-
-### 打包
-
-```
-# 当前目录 ./packages/<%= projectName %>/
-npm run build
-
-# 或者根目录 ./
-pnpm run --filter @univerjs/<%= projectName %> build
-```
diff --git a/cli/src/templates/common-plugin/README.md b/cli/src/templates/common-plugin/README.md
index 7df1ecfaf3..f94a285cef 100644
--- a/cli/src/templates/common-plugin/README.md
+++ b/cli/src/templates/common-plugin/README.md
@@ -1,55 +1,14 @@
-# style-univer
-
-English| [简体中文](./README-zh.md)
+# @univerjs/<%= projectName %>
## Introduction
-UniverSheet Plugin <%= projectUpperValue %>
+Univer <%= projectName %>
+## Usage
### Installation
-
```shell
npm i @univerjs/<%= projectName %>
```
-### Usage
-
-```js
-import {<%= projectUpperValue %>} from '@univerjs/<%= projectName %>'
-
-const univerSheet = new UniverSheet();
-univerSheet.installPlugin(new <%= projectUpperValue %>());
-```
-
-## Local development
-
-### Requirements
-
-- [Node.js](https://nodejs.org/en/) Version >= 10
-- [npm](https://www.npmjs.com/) Version >= 6
-
-### Installation
-
-```
-pnpm install
-```
-
-### Development
-
-```
-# Current directory ./packages/<%= projectName %>/
-npm run dev
-
-# Or project root directory ./
-pnpm run --filter @univerjs/<%= projectName %> dev
-```
-
-### Package
-
-```
-# Current directory ./packages/<%= projectName %>/
-npm run build
-
-# Or root directory ./
-pnpm run --filter @univerjs/<%= projectName %> build
-```
+### API
+Check [Univer](https://github.com/dream-num/univer/)
\ No newline at end of file
diff --git a/cli/src/templates/docs-plugin/README-zh.md b/cli/src/templates/docs-plugin/README-zh.md
deleted file mode 100644
index f40dc58f36..0000000000
--- a/cli/src/templates/docs-plugin/README-zh.md
+++ /dev/null
@@ -1,55 +0,0 @@
-# style-univer
-
-简体中文 | [English](./README.md)
-
-## 介绍
-
-UniverSheet <%= projectUpperValue %>插件
-
-### 安装
-
-```shell
-npm i @univerjs/<%= projectName %>
-```
-
-### 使用
-
-```js
-import {<%= projectUpperValue %>} from '@univerjs/<%= projectName %>'
-
-const univerSheet = new UniverSheet();
-univerSheet.installPlugin(new <%= projectUpperValue %>());
-```
-
-## 本地开发
-
-### 环境
-
-- [Node.js](https://nodejs.org/en/) Version >= 10
-- [npm](https://www.npmjs.com/) Version >= 6
-
-### 安装
-
-```
-pnpm install
-```
-
-### 开发
-
-```
-# 当前目录 ./packages/<%= projectName %>/
-npm run dev
-
-# 或者项目根目录 ./
-pnpm run --filter @univerjs/<%= projectName %> dev
-```
-
-### 打包
-
-```
-# 当前目录 ./packages/<%= projectName %>/
-npm run build
-
-# 或者根目录 ./
-pnpm run --filter @univerjs/<%= projectName %> build
-```
diff --git a/cli/src/templates/docs-plugin/README.md b/cli/src/templates/docs-plugin/README.md
index 7df1ecfaf3..f94a285cef 100644
--- a/cli/src/templates/docs-plugin/README.md
+++ b/cli/src/templates/docs-plugin/README.md
@@ -1,55 +1,14 @@
-# style-univer
-
-English| [简体中文](./README-zh.md)
+# @univerjs/<%= projectName %>
## Introduction
-UniverSheet Plugin <%= projectUpperValue %>
+Univer <%= projectName %>
+## Usage
### Installation
-
```shell
npm i @univerjs/<%= projectName %>
```
-### Usage
-
-```js
-import {<%= projectUpperValue %>} from '@univerjs/<%= projectName %>'
-
-const univerSheet = new UniverSheet();
-univerSheet.installPlugin(new <%= projectUpperValue %>());
-```
-
-## Local development
-
-### Requirements
-
-- [Node.js](https://nodejs.org/en/) Version >= 10
-- [npm](https://www.npmjs.com/) Version >= 6
-
-### Installation
-
-```
-pnpm install
-```
-
-### Development
-
-```
-# Current directory ./packages/<%= projectName %>/
-npm run dev
-
-# Or project root directory ./
-pnpm run --filter @univerjs/<%= projectName %> dev
-```
-
-### Package
-
-```
-# Current directory ./packages/<%= projectName %>/
-npm run build
-
-# Or root directory ./
-pnpm run --filter @univerjs/<%= projectName %> build
-```
+### API
+Check [Univer](https://github.com/dream-num/univer/)
\ No newline at end of file
diff --git a/cli/src/templates/sheets-plugin/README-zh.md b/cli/src/templates/sheets-plugin/README-zh.md
deleted file mode 100644
index f40dc58f36..0000000000
--- a/cli/src/templates/sheets-plugin/README-zh.md
+++ /dev/null
@@ -1,55 +0,0 @@
-# style-univer
-
-简体中文 | [English](./README.md)
-
-## 介绍
-
-UniverSheet <%= projectUpperValue %>插件
-
-### 安装
-
-```shell
-npm i @univerjs/<%= projectName %>
-```
-
-### 使用
-
-```js
-import {<%= projectUpperValue %>} from '@univerjs/<%= projectName %>'
-
-const univerSheet = new UniverSheet();
-univerSheet.installPlugin(new <%= projectUpperValue %>());
-```
-
-## 本地开发
-
-### 环境
-
-- [Node.js](https://nodejs.org/en/) Version >= 10
-- [npm](https://www.npmjs.com/) Version >= 6
-
-### 安装
-
-```
-pnpm install
-```
-
-### 开发
-
-```
-# 当前目录 ./packages/<%= projectName %>/
-npm run dev
-
-# 或者项目根目录 ./
-pnpm run --filter @univerjs/<%= projectName %> dev
-```
-
-### 打包
-
-```
-# 当前目录 ./packages/<%= projectName %>/
-npm run build
-
-# 或者根目录 ./
-pnpm run --filter @univerjs/<%= projectName %> build
-```
diff --git a/cli/src/templates/sheets-plugin/README.md b/cli/src/templates/sheets-plugin/README.md
index 7df1ecfaf3..f94a285cef 100644
--- a/cli/src/templates/sheets-plugin/README.md
+++ b/cli/src/templates/sheets-plugin/README.md
@@ -1,55 +1,14 @@
-# style-univer
-
-English| [简体中文](./README-zh.md)
+# @univerjs/<%= projectName %>
## Introduction
-UniverSheet Plugin <%= projectUpperValue %>
+Univer <%= projectName %>
+## Usage
### Installation
-
```shell
npm i @univerjs/<%= projectName %>
```
-### Usage
-
-```js
-import {<%= projectUpperValue %>} from '@univerjs/<%= projectName %>'
-
-const univerSheet = new UniverSheet();
-univerSheet.installPlugin(new <%= projectUpperValue %>());
-```
-
-## Local development
-
-### Requirements
-
-- [Node.js](https://nodejs.org/en/) Version >= 10
-- [npm](https://www.npmjs.com/) Version >= 6
-
-### Installation
-
-```
-pnpm install
-```
-
-### Development
-
-```
-# Current directory ./packages/<%= projectName %>/
-npm run dev
-
-# Or project root directory ./
-pnpm run --filter @univerjs/<%= projectName %> dev
-```
-
-### Package
-
-```
-# Current directory ./packages/<%= projectName %>/
-npm run build
-
-# Or root directory ./
-pnpm run --filter @univerjs/<%= projectName %> build
-```
+### API
+Check [Univer](https://github.com/dream-num/univer/)
\ No newline at end of file
diff --git a/cli/src/templates/slides-plugin/README-zh.md b/cli/src/templates/slides-plugin/README-zh.md
deleted file mode 100644
index f40dc58f36..0000000000
--- a/cli/src/templates/slides-plugin/README-zh.md
+++ /dev/null
@@ -1,55 +0,0 @@
-# style-univer
-
-简体中文 | [English](./README.md)
-
-## 介绍
-
-UniverSheet <%= projectUpperValue %>插件
-
-### 安装
-
-```shell
-npm i @univerjs/<%= projectName %>
-```
-
-### 使用
-
-```js
-import {<%= projectUpperValue %>} from '@univerjs/<%= projectName %>'
-
-const univerSheet = new UniverSheet();
-univerSheet.installPlugin(new <%= projectUpperValue %>());
-```
-
-## 本地开发
-
-### 环境
-
-- [Node.js](https://nodejs.org/en/) Version >= 10
-- [npm](https://www.npmjs.com/) Version >= 6
-
-### 安装
-
-```
-pnpm install
-```
-
-### 开发
-
-```
-# 当前目录 ./packages/<%= projectName %>/
-npm run dev
-
-# 或者项目根目录 ./
-pnpm run --filter @univerjs/<%= projectName %> dev
-```
-
-### 打包
-
-```
-# 当前目录 ./packages/<%= projectName %>/
-npm run build
-
-# 或者根目录 ./
-pnpm run --filter @univerjs/<%= projectName %> build
-```
diff --git a/cli/src/templates/slides-plugin/README.md b/cli/src/templates/slides-plugin/README.md
index 7df1ecfaf3..f94a285cef 100644
--- a/cli/src/templates/slides-plugin/README.md
+++ b/cli/src/templates/slides-plugin/README.md
@@ -1,55 +1,14 @@
-# style-univer
-
-English| [简体中文](./README-zh.md)
+# @univerjs/<%= projectName %>
## Introduction
-UniverSheet Plugin <%= projectUpperValue %>
+Univer <%= projectName %>
+## Usage
### Installation
-
```shell
npm i @univerjs/<%= projectName %>
```
-### Usage
-
-```js
-import {<%= projectUpperValue %>} from '@univerjs/<%= projectName %>'
-
-const univerSheet = new UniverSheet();
-univerSheet.installPlugin(new <%= projectUpperValue %>());
-```
-
-## Local development
-
-### Requirements
-
-- [Node.js](https://nodejs.org/en/) Version >= 10
-- [npm](https://www.npmjs.com/) Version >= 6
-
-### Installation
-
-```
-pnpm install
-```
-
-### Development
-
-```
-# Current directory ./packages/<%= projectName %>/
-npm run dev
-
-# Or project root directory ./
-pnpm run --filter @univerjs/<%= projectName %> dev
-```
-
-### Package
-
-```
-# Current directory ./packages/<%= projectName %>/
-npm run build
-
-# Or root directory ./
-pnpm run --filter @univerjs/<%= projectName %> build
-```
+### API
+Check [Univer](https://github.com/dream-num/univer/)
\ No newline at end of file
diff --git a/cli/src/templates/slides-plugin/package.json b/cli/src/templates/slides-plugin/package.json
index a26d48fdf1..e14de23254 100644
--- a/cli/src/templates/slides-plugin/package.json
+++ b/cli/src/templates/slides-plugin/package.json
@@ -1,7 +1,7 @@
{
"name": "@univerjs/<%= projectName %>",
"version": "0.0.1",
- "description": "UniverSheet normal <%= projectName %>",
+ "description": "Univer <%= projectName %>",
"keywords": [],
"author": "DreamNum <[email protected]>",
"license": "MIT",
diff --git a/examples/univer-doc-ts/package.json b/examples/univer-doc-ts/package.json
index e27c6490ff..96c84b314c 100644
--- a/examples/univer-doc-ts/package.json
+++ b/examples/univer-doc-ts/package.json
@@ -44,6 +44,7 @@
"@univerjs/base-ui": "workspace:^0.0.1",
"@univerjs/common-plugin-data": "workspace:^0.0.1",
"@univerjs/core": "workspace:^0.0.1",
+ "@univerjs/ui-plugin-docs": "workspace:^0.0.1",
"preact": "^10.12.1"
}
}
\ No newline at end of file
diff --git a/examples/univer-doc-ts/src/main.tsx b/examples/univer-doc-ts/src/main.tsx
index 20a5421a86..d54bedb52c 100644
--- a/examples/univer-doc-ts/src/main.tsx
+++ b/examples/univer-doc-ts/src/main.tsx
@@ -1,17 +1,26 @@
-import { UniverDoc } from '@univerjs/core';
+import { Univer, UniverDoc } from '@univerjs/core';
import { RenderEngine } from '@univerjs/base-render';
import { DocPlugin } from '@univerjs/base-docs';
-import { BaseComponentPlugin } from '@univerjs/base-ui';
import { DEFAULT_DOCUMENT_DATA_EN } from '@univerjs/common-plugin-data';
+import { DocUIPlugin } from "@univerjs/ui-plugin-docs";
-const docPluginConfig = {
- container: 'univerdoc',
-};
-const univerDoc = UniverDoc.newInstance(DEFAULT_DOCUMENT_DATA_EN);
+// univer
+const univer = new Univer();
+
+// base-render
+univer.install(new RenderEngine());
-univerDoc.installPlugin(new RenderEngine());
-univerDoc.installPlugin(new UniverComponentSheet());
+// univerdoc instance
+const univerdoc = UniverDoc.newInstance(DEFAULT_DOCUMENT_DATA_EN);
+univer.addUniverDoc(univerdoc);
-univerDoc.installPlugin(new DocPlugin(docPluginConfig));
-univerDoc.installPlugin(new BaseComponentPlugin());
+// univerdoc.installPlugin(new DocPlugin());
+univer.install(new DocUIPlugin({
+ container: 'univerdoc',
+ layout: {
+ docContainerConfig:{
+ innerLeft: true,
+ }
+ },
+}))
diff --git a/examples/univer-slide-ts/package.json b/examples/univer-slide-ts/package.json
index c8b18c71ca..5dc7df893f 100644
--- a/examples/univer-slide-ts/package.json
+++ b/examples/univer-slide-ts/package.json
@@ -41,6 +41,7 @@
"@univerjs/base-ui": "workspace:^0.0.1",
"@univerjs/common-plugin-data": "workspace:^0.0.1",
"@univerjs/core": "workspace:^0.0.1",
+ "@univerjs/ui-plugin-slides": "workspace:^0.0.1",
"preact": "^10.12.1"
}
}
\ No newline at end of file
diff --git a/examples/univer-slide-ts/src/main.tsx b/examples/univer-slide-ts/src/main.tsx
index b956165c98..6e3df16c63 100644
--- a/examples/univer-slide-ts/src/main.tsx
+++ b/examples/univer-slide-ts/src/main.tsx
@@ -1,21 +1,26 @@
-import { UniverSlide } from '@univerjs/core';
+import { Univer, UniverSlide } from '@univerjs/core';
import { RenderEngine } from '@univerjs/base-render';
import { SlidePlugin } from '@univerjs/base-slides';
-import { BaseComponentPlugin } from '@univerjs/base-ui';
import { DEFAULT_SLIDE_DATA } from '@univerjs/common-plugin-data';
+import {SlideUIPlugin} from '@univerjs/ui-plugin-slides'
-const slidePluginConfig = {
- container: 'universlide',
- layout: {
- innerLeft: true,
- },
-};
+// univer
+const univer = new Univer();
-const univerSlide = UniverSlide.newInstance(DEFAULT_SLIDE_DATA);
+// base-render
+univer.install(new RenderEngine());
-univerSlide.installPlugin(new RenderEngine());
-univerSlide.installPlugin(new UniverComponentSheet());
+// universlide instance
+const universlide = UniverSlide.newInstance(DEFAULT_SLIDE_DATA);
+univer.addUniverSlide(universlide);
-univerSlide.installPlugin(new SlidePlugin(slidePluginConfig));
-univerSlide.installPlugin(new BaseComponentPlugin());
+universlide.installPlugin(new SlidePlugin());
+univer.install(new SlideUIPlugin({
+ container: 'universlide',
+ layout: {
+ slideContainerConfig:{
+ innerLeft: true,
+ }
+ },
+}))
diff --git a/examples/univer-vanilla-ts/package.json b/examples/univer-vanilla-ts/package.json
index 689a8bb7f9..8ce316061d 100644
--- a/examples/univer-vanilla-ts/package.json
+++ b/examples/univer-vanilla-ts/package.json
@@ -48,6 +48,7 @@
"@univerjs/sheets-plugin-import-xlsx": "workspace:^0.0.1",
"@univerjs/sheets-plugin-numfmt": "workspace:^0.0.1",
"@univerjs/ui-plugin-sheets": "workspace:^0.0.1",
+ "@univerjs/ui-plugin-slides": "workspace:^0.0.1",
"preact": "^10.12.1"
}
}
\ No newline at end of file
diff --git a/examples/univer-vanilla-ts/src/main.tsx b/examples/univer-vanilla-ts/src/main.tsx
index ab52c20291..c55ea9f8e3 100644
--- a/examples/univer-vanilla-ts/src/main.tsx
+++ b/examples/univer-vanilla-ts/src/main.tsx
@@ -1,7 +1,9 @@
-import { UniverSheet, UniverDoc, UniverSlide, Univer } from '@univerjs/core';
+import { UniverSheet, UniverDoc, UniverSlide, Univer, PLUGIN_NAMES } from '@univerjs/core';
import { RenderEngine } from '@univerjs/base-render';
import { SheetPlugin } from '@univerjs/base-sheets';
+import { CanvasView as SlideCanvasView } from '@univerjs/base-slides';
import { SheetUIPlugin } from '@univerjs/ui-plugin-sheets';
+import { SlideUIPlugin } from '@univerjs/ui-plugin-slides';
import {
DEFAULT_FORMULA_DATA,
DEFAULT_FORMULA_DATA_DEMO,
@@ -19,33 +21,8 @@ import {
DEFAULT_WORKBOOK_DATA_DOWN,
} from '@univerjs/common-plugin-data';
import { ClipboardPlugin } from '@univerjs/sheets-plugin-clipboard';
-import { BaseComponentPlugin } from '@univerjs/base-ui';
import { ImportXlsxPlugin } from '@univerjs/sheets-plugin-import-xlsx';
-const uiDefaultConfigDemo = {
- container: 'universheet',
- selections: {
- 'sheet-0001': [
- {
- selection: {
- startRow: 2,
- endRow: 2,
- startColumn: 3,
- endColumn: 3,
- },
- cell: {
- row: 2,
- column: 3,
- },
- },
- ],
- },
-};
-
-const univerConfig = {
- container: 'universheet',
-};
-
// univer
const univer = new Univer();
@@ -54,7 +31,6 @@ univer.install(new RenderEngine());
// universheet instance
const universheet = UniverSheet.newInstance(DEFAULT_WORKBOOK_DATA_DEMO);
-// sheet.installPlugin(new RenderEngine());
univer.addUniverSheet(universheet);
// base-sheet
@@ -79,11 +55,28 @@ universheet.installPlugin(
})
);
-// // ui TODO: 不要安装
-// univer.install(new UniverComponentSheet());
-// univer.install(new BaseComponentPlugin(univerConfig));
+// base-slides init CanvasView
+univer.install(new SheetUIPlugin({
+ container:'universheet'
+}))
+
+
+// render canvas without ui plugin
+// const engine = univer.getGlobalContext().getPluginManager().getRequirePluginByName<RenderEngine>(PLUGIN_NAMES.BASE_RENDER).getEngine();
+// let container = document.querySelector('#universheet') as HTMLElement
+
+// // mount canvas to DOM container
+// engine.setContainer(container);
+
+// window.addEventListener('resize', () => {
+// engine.resize();
+// });
+
+// // should be clear
+// setTimeout(() => {
+// engine.resize();
+// }, 0);
-univer.install(new SheetUIPlugin())
// sheets-plugin-ui univer.install(new SheetsUI)
// const univerSheetDemo = UniverSheet.newInstance(DEFAULT_WORKBOOK_DATA_DEMO);
// const univerSheetDemo = UniverSheet.newInstance(DEFAULT_WORKBOOK_DATA_DEMO1);
diff --git a/package.json b/package.json
index a3ca33891a..6f587ad003 100644
--- a/package.json
+++ b/package.json
@@ -11,8 +11,8 @@
"start:sheet": "pnpm run --filter univer-sheet-ts start",
"dev:all": "pnpm run --filter univer-vanilla-ts dev",
"dev:preact": "pnpm run --filter univer-sheet-preact dev",
- "dev:doc": "pnpm run --filter @univerjs/base-docs dev",
- "dev:slide": "pnpm run --filter @univerjs/base-slides dev",
+ "dev:doc": "pnpm run --filter univer-doc-ts dev",
+ "dev:slide": "pnpm run --filter univer-slide-ts dev",
"d": "pnpm run --filter univer-vanilla-ts dev",
"api": "node scripts/api",
"lighthouse-dev": "start /B node scripts/dev && lighthouse http://127.0.0.1:3103 --output html --output-path ./report.html",
diff --git a/packages/base-sheets/src/SheetPlugin.ts b/packages/base-sheets/src/SheetPlugin.ts
index c03292f5bc..12b018c54e 100644
--- a/packages/base-sheets/src/SheetPlugin.ts
+++ b/packages/base-sheets/src/SheetPlugin.ts
@@ -85,7 +85,7 @@ export class SheetPlugin extends Plugin<SheetPluginObserve, SheetContext> {
}
initCanvasView() {
- const engine = this.getContext().getUniver().getGlobalContext().getPluginManager().getPluginByName<RenderEngine>(PLUGIN_NAMES.BASE_RENDER)?.getEngine()!;
+ const engine = this.getGlobalContext().getPluginManager().getRequirePluginByName<RenderEngine>(PLUGIN_NAMES.BASE_RENDER).getEngine();
this._canvasEngine = engine;
diff --git a/packages/base-slides/src/SlidePlugin.tsx b/packages/base-slides/src/SlidePlugin.tsx
index 61c59e2d83..4e76e9c121 100644
--- a/packages/base-slides/src/SlidePlugin.tsx
+++ b/packages/base-slides/src/SlidePlugin.tsx
@@ -153,7 +153,7 @@ export class SlidePlugin extends Plugin<SlidePluginObserve, SlideContext> {
}
private _initializeRender() {
- const engine = this.getPluginByName<RenderEngine>(PLUGIN_NAMES.BASE_RENDER)?.getEngine()!;
+ const engine = this.getGlobalContext().getPluginManager().getRequirePluginByName<RenderEngine>(PLUGIN_NAMES.BASE_RENDER).getEngine();
this.register(engine);
}
diff --git a/packages/base-slides/src/index.ts b/packages/base-slides/src/index.ts
index d177a18908..441345842d 100644
--- a/packages/base-slides/src/index.ts
+++ b/packages/base-slides/src/index.ts
@@ -1 +1,2 @@
export * from './SlidePlugin';
+export * from './View/Render';
diff --git a/packages/core/src/Basics/index.ts b/packages/core/src/Basics/index.ts
index 1bb5790846..ebdf6905e8 100644
--- a/packages/core/src/Basics/index.ts
+++ b/packages/core/src/Basics/index.ts
@@ -1,5 +1,6 @@
// @index('./*.ts', f => `export * from '${f.path}'`)
export * from './ContextBase';
+export * from './Context';
export * from './DocContext';
export * from './Environment';
export * from './Registry';
diff --git a/packages/sheets-plugin-find/src/Controller/FindModalController.ts b/packages/sheets-plugin-find/src/Controller/FindModalController.ts
index b0ee35a674..d67e6923f9 100644
--- a/packages/sheets-plugin-find/src/Controller/FindModalController.ts
+++ b/packages/sheets-plugin-find/src/Controller/FindModalController.ts
@@ -23,8 +23,8 @@ export class FindModalController {
}
private _initialize() {
- const sheetUiPlugin = this._plugin.getContext().getUniver().getGlobalContext().getPluginManager().getRequirePluginByName<SheetUIPlugin>(SHEET_UI_PLUGIN_NAME);
- sheetUiPlugin.addSlot(FIND_PLUGIN_NAME + FindModal.name, {
+ const sheetUIPlugin = this._plugin.getContext().getUniver().getGlobalContext().getPluginManager().getRequirePluginByName<SheetUIPlugin>(SHEET_UI_PLUGIN_NAME);
+ sheetUIPlugin.addSlot(FIND_PLUGIN_NAME + FindModal.name, {
component: FindModal,
props: {
getComponent: this.getComponent.bind(this),
diff --git a/packages/sheets-plugin-formula/src/Controller/SearchFormulaModalController.ts b/packages/sheets-plugin-formula/src/Controller/SearchFormulaModalController.ts
index 944b69055a..fc03f52c37 100644
--- a/packages/sheets-plugin-formula/src/Controller/SearchFormulaModalController.ts
+++ b/packages/sheets-plugin-formula/src/Controller/SearchFormulaModalController.ts
@@ -187,9 +187,9 @@ export class SearchFormulaController {
}
private _initRegisterComponent() {
- const sheetUiPlugin = this._plugin.getContext().getUniver().getGlobalContext().getPluginManager().getRequirePluginByName<SheetUIPlugin>(SHEET_UI_PLUGIN_NAME);
- const ComponentManager = sheetUiPlugin.getComponentManager();
- sheetUiPlugin.addSlot(FORMULA_PLUGIN_NAME + SearchFormulaModal.name, {
+ const sheetUIPlugin = this._plugin.getContext().getUniver().getGlobalContext().getPluginManager().getRequirePluginByName<SheetUIPlugin>(SHEET_UI_PLUGIN_NAME);
+ const ComponentManager = sheetUIPlugin.getComponentManager();
+ sheetUIPlugin.addSlot(FORMULA_PLUGIN_NAME + SearchFormulaModal.name, {
component: SearchFormulaModal,
props: {
getComponent: (ref: SearchFormulaModal) => {
diff --git a/packages/ui-plugin-docs/.gitignore b/packages/ui-plugin-docs/.gitignore
new file mode 100644
index 0000000000..12e1bd6bec
--- /dev/null
+++ b/packages/ui-plugin-docs/.gitignore
@@ -0,0 +1,101 @@
+#ide
+*.DS_Store
+.idea
+.vscode
+
+#npm
+package-lock.json
+
+dist
+lib
+docs/.vuepress/dist
+
+# Logs
+logs
+*.log
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+lerna-debug.log*
+
+# Runtime config
+pids
+*.pid
+*.seed
+*.pid.lock
+
+# Directory for instrumented libs generated by jscoverage/JSCover
+lib-cov
+
+# Coverage directory used by tools like istanbul
+coverage
+
+# nyc test coverage
+.nyc_output
+
+# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
+.grunt
+
+# Bower dependency directory (https://bower.io/)
+bower_components
+
+# node-waf configuration
+.lock-wscript
+
+# Compiled binary addons (https://nodejs.org/api/addons.html)
+build/Release
+
+# Dependency directories
+node_modules
+jspm_packages/
+
+# TypeScript v1 declaration files
+typings/
+
+# Optional npm cache directory
+.npm
+
+# Optional eslint cache
+.eslintcache
+
+# Optional REPL History
+.node_repl_history
+
+# Output of 'npm pack'
+*.tgz
+
+# Yarn Integrity file
+.yarn-integrity
+
+# dotenv environment variables file
+.env
+
+# next.js build output
+.next
+
+#lerna-changelog
+.changelog
+
+
+#editor workspace file
+.idea/
+
+
+.DS_Store
+
+.history
+# examples
+
+
+# Production
+/build
+
+# Generated files
+.docusaurus
+.cache-loader
+
+# Misc
+.env.local
+.env.development.local
+.env.test.local
+.env.production.local
diff --git a/packages/ui-plugin-docs/README.md b/packages/ui-plugin-docs/README.md
new file mode 100644
index 0000000000..e10e82b3bc
--- /dev/null
+++ b/packages/ui-plugin-docs/README.md
@@ -0,0 +1,14 @@
+# @univerjs/ui-plugin-docs
+
+## Introduction
+
+Univer ui plugin docs
+
+## Usage
+### Installation
+```shell
+npm i @univerjs/ui-plugin-docs
+```
+
+### API
+Check [Univer](https://github.com/dream-num/univer/)
\ No newline at end of file
diff --git a/packages/ui-plugin-docs/jest.config.js b/packages/ui-plugin-docs/jest.config.js
new file mode 100644
index 0000000000..a1ab72c760
--- /dev/null
+++ b/packages/ui-plugin-docs/jest.config.js
@@ -0,0 +1,18 @@
+/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
+module.exports = {
+ preset: 'ts-jest',
+ testEnvironment: 'jsdom',
+ moduleFileExtensions: ['js', 'ts', 'tsx'],
+
+ roots: ['<rootDir>/src'],
+ testMatch: ['**/__tests__/**/*.+(ts|tsx|js)', '**/?(*.)+(spec|test).+(ts|tsx|js)'],
+ transform: {
+ '^.+\\.(ts|tsx)$': 'ts-jest',
+ '^.+\\.tsx?$': 'babel-jest', // https://github.com/kulshekhar/ts-jest/issues/937#issuecomment-455431207
+ },
+ globals: {
+ 'ts-jest': {
+ tsConfig: 'tsconfig.json',
+ },
+ },
+};
diff --git a/packages/ui-plugin-docs/package.json b/packages/ui-plugin-docs/package.json
new file mode 100644
index 0000000000..f368e43481
--- /dev/null
+++ b/packages/ui-plugin-docs/package.json
@@ -0,0 +1,55 @@
+{
+ "name": "@univerjs/ui-plugin-docs",
+ "version": "0.0.1",
+ "description": "Univer normal ui-plugin-docs",
+ "keywords": [],
+ "author": "DreamNum <[email protected]>",
+ "license": "MIT",
+ "main": "./src/index.ts",
+ "module": "./src/index.ts",
+ "types": "./src/Types/index.d.ts",
+ "publishConfig": {
+ "main": "./lib/univer-ui-plugin-docs.cjs.js",
+ "module": "./lib/univer-ui-plugin-docs.es.js",
+ "types": "./lib/index.d.ts"
+ },
+ "exports": {
+ ".": "./src/index.ts",
+ "./*": "./src/*"
+ },
+ "directories": {
+ "lib": "lib"
+ },
+ "files": [
+ "lib"
+ ],
+ "scripts": {
+ "test": "jest",
+ "dev": "vite",
+ "build": "tsc && vite build",
+ "watch": "vite build",
+ "link": "pnpm link ./",
+ "serve": "vite preview"
+ },
+ "devDependencies": {
+ "@preact/preset-vite": "2.0.0",
+ "@testing-library/preact": "^2.0.1",
+ "@types/jest": "^27.0.1",
+ "@types/node": "^16.4.6",
+ "@vitejs/plugin-legacy": "^1.5.1",
+ "less": "^4.1.1",
+ "prettier": "^2.3.2",
+ "ts-jest": "29.0.1",
+ "ts-node": "^10.2.1",
+ "typescript": "^4.4.1-rc",
+ "vite": "^2.4.4"
+ },
+ "dependencies": {
+ "@univerjs/base-render": "workspace:^0.0.1",
+ "@univerjs/base-docs": "workspace:^0.0.1",
+ "@univerjs/base-ui": "workspace:^0.0.1",
+ "@univerjs/core": "workspace:^0.0.1",
+ "css-vars-ponyfill": "^2.4.6",
+ "preact": "^10.12.1"
+ }
+}
\ No newline at end of file
diff --git a/packages/ui-plugin-docs/src/Basic/Const/PLUGIN_NAME.ts b/packages/ui-plugin-docs/src/Basic/Const/PLUGIN_NAME.ts
new file mode 100644
index 0000000000..858c78a746
--- /dev/null
+++ b/packages/ui-plugin-docs/src/Basic/Const/PLUGIN_NAME.ts
@@ -0,0 +1 @@
+export const DOC_UI_PLUGIN_NAME = 'DocUI';
diff --git a/packages/ui-plugin-docs/src/Basic/Const/index.ts b/packages/ui-plugin-docs/src/Basic/Const/index.ts
new file mode 100644
index 0000000000..0dc96d927a
--- /dev/null
+++ b/packages/ui-plugin-docs/src/Basic/Const/index.ts
@@ -0,0 +1 @@
+export * from './PLUGIN_NAME';
diff --git a/packages/ui-plugin-docs/src/Basic/Enum/index.ts b/packages/ui-plugin-docs/src/Basic/Enum/index.ts
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/packages/ui-plugin-docs/src/Basic/Shared/index.ts b/packages/ui-plugin-docs/src/Basic/Shared/index.ts
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/packages/ui-plugin-docs/src/Basic/index.ts b/packages/ui-plugin-docs/src/Basic/index.ts
new file mode 100644
index 0000000000..640d1bb8b3
--- /dev/null
+++ b/packages/ui-plugin-docs/src/Basic/index.ts
@@ -0,0 +1,4 @@
+export * from './Const';
+export * from './Enum';
+export * from '../Locale';
+export * from './Shared';
diff --git a/packages/ui-plugin-docs/src/Controller/UIController.ts b/packages/ui-plugin-docs/src/Controller/UIController.ts
new file mode 100644
index 0000000000..d3a078f449
--- /dev/null
+++ b/packages/ui-plugin-docs/src/Controller/UIController.ts
@@ -0,0 +1,12 @@
+import { DocPlugin } from '@univerjs/base-docs';
+import { DocUIPlugin } from '../DocUIPlugin';
+
+export class UIController {
+ protected _docPlugin: DocPlugin;
+
+ protected _plugin: DocUIPlugin;
+
+ constructor(plugin: DocUIPlugin) {
+ this._plugin = plugin;
+ }
+}
diff --git a/packages/ui-plugin-docs/src/Controller/index.ts b/packages/ui-plugin-docs/src/Controller/index.ts
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/packages/ui-plugin-docs/src/DocUIPlugin.ts b/packages/ui-plugin-docs/src/DocUIPlugin.ts
new file mode 100644
index 0000000000..6f661989ae
--- /dev/null
+++ b/packages/ui-plugin-docs/src/DocUIPlugin.ts
@@ -0,0 +1,40 @@
+import { Plugin, Context, UniverDoc } from '@univerjs/core';
+import { zh, en } from './Locale';
+import { DOC_UI_PLUGIN_NAME } from './Basic/Const/PLUGIN_NAME';
+import { UIController } from './Controller/UIController';
+
+export interface IDocUIPluginConfig {}
+
+export class DocUIPlugin extends Plugin<any, Context> {
+ private _UIController: UIController;
+
+ constructor(config?: IDocUIPluginConfig) {
+ super(DOC_UI_PLUGIN_NAME);
+ }
+
+ static create(config?: IDocUIPluginConfig) {
+ return new DocUIPlugin(config);
+ }
+
+ installTo(universheetInstance: UniverDoc) {
+ universheetInstance.installPlugin(this);
+ }
+
+ initialize(): void {
+ /**
+ * load more Locale object
+ */
+ this.getLocale().load({
+ en,
+ zh,
+ });
+
+ this._UIController = new UIController(this);
+ }
+
+ onMounted(): void {
+ this.initialize();
+ }
+
+ onDestroy(): void {}
+}
diff --git a/packages/ui-plugin-docs/src/Locale/en.ts b/packages/ui-plugin-docs/src/Locale/en.ts
new file mode 100644
index 0000000000..54163bc14e
--- /dev/null
+++ b/packages/ui-plugin-docs/src/Locale/en.ts
@@ -0,0 +1,8 @@
+export default {
+ ui: {
+ tooltip: 'UI',
+ one: 'one',
+ two: 'two',
+ three: 'three',
+ },
+};
diff --git a/packages/ui-plugin-docs/src/Locale/index.ts b/packages/ui-plugin-docs/src/Locale/index.ts
new file mode 100644
index 0000000000..3ac4bcd0fd
--- /dev/null
+++ b/packages/ui-plugin-docs/src/Locale/index.ts
@@ -0,0 +1,4 @@
+import zh from './zh';
+import en from './en';
+
+export { zh, en };
diff --git a/packages/ui-plugin-docs/src/Locale/zh.ts b/packages/ui-plugin-docs/src/Locale/zh.ts
new file mode 100644
index 0000000000..3af3fac77c
--- /dev/null
+++ b/packages/ui-plugin-docs/src/Locale/zh.ts
@@ -0,0 +1,8 @@
+export default {
+ ui: {
+ tooltip: 'UI',
+ one: '一',
+ two: '二',
+ three: '三',
+ },
+};
diff --git a/packages/ui-plugin-docs/src/Model/index.ts b/packages/ui-plugin-docs/src/Model/index.ts
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/packages/ui-plugin-docs/src/Service/index.ts b/packages/ui-plugin-docs/src/Service/index.ts
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/packages/ui-plugin-docs/src/Types/index.d.ts b/packages/ui-plugin-docs/src/Types/index.d.ts
new file mode 100644
index 0000000000..752a95a0bc
--- /dev/null
+++ b/packages/ui-plugin-docs/src/Types/index.d.ts
@@ -0,0 +1,10 @@
+/// <reference types="vite/client" />
+
+export * from '../index';
+declare module '@univerjs/ui-plugin-docs' {}
+
+// use css module
+declare module '*.less' {
+ const resource: { [key: string]: string };
+ export = resource;
+}
diff --git a/packages/ui-plugin-docs/src/Types/preact.d.ts b/packages/ui-plugin-docs/src/Types/preact.d.ts
new file mode 100644
index 0000000000..0d092b3751
--- /dev/null
+++ b/packages/ui-plugin-docs/src/Types/preact.d.ts
@@ -0,0 +1,4 @@
+/// <reference types="enzyme-adapter-preact-pure" />
+import JSX = preact.JSX;
+
+declare module 'enzyme';
diff --git a/packages/ui-plugin-docs/src/View/Render/index.ts b/packages/ui-plugin-docs/src/View/Render/index.ts
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/packages/ui-plugin-docs/src/View/UI/index.ts b/packages/ui-plugin-docs/src/View/UI/index.ts
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/packages/ui-plugin-docs/src/index.ts b/packages/ui-plugin-docs/src/index.ts
new file mode 100644
index 0000000000..2438192fae
--- /dev/null
+++ b/packages/ui-plugin-docs/src/index.ts
@@ -0,0 +1 @@
+export * from './DocUIPlugin';
diff --git a/packages/ui-plugin-docs/tsconfig.json b/packages/ui-plugin-docs/tsconfig.json
new file mode 100644
index 0000000000..7d1f34cc0a
--- /dev/null
+++ b/packages/ui-plugin-docs/tsconfig.json
@@ -0,0 +1,38 @@
+{
+ "compilerOptions": {
+ "rootDir": "./",
+ "outDir": "lib",
+ "target": "ESNext",
+ "lib": [
+ "ESNext",
+ "DOM",
+ "WebWorker"
+ ],
+ "module": "ESNext",
+ "moduleResolution": "Node", //This value is needed for Node.js.
+ "declaration": true,
+ "declarationDir": "./lib",
+ "declarationMap": true,
+ "sourceMap": true,
+ "resolveJsonModule": true,
+ "strict": true,
+ "allowJs": true,
+ "baseUrl": "./",
+ "skipLibCheck": true,
+ "esModuleInterop": true, // auto allowSyntheticDefaultImports tru
+ "suppressImplicitAnyIndexErrors": true,
+ "experimentalDecorators": true,
+ "jsx": "react-jsx",
+ "jsxImportSource": "preact",
+ "strictPropertyInitialization": false,
+ "types": [
+ "jest",
+ "node",
+ "@types/jest"
+ ]
+ },
+ "include": [
+ "src/**/*",
+ "test/**/*.test.(ts|tsx|js)"
+ ]
+}
\ No newline at end of file
diff --git a/packages/ui-plugin-docs/vite.config.ts b/packages/ui-plugin-docs/vite.config.ts
new file mode 100644
index 0000000000..dcdbd9e822
--- /dev/null
+++ b/packages/ui-plugin-docs/vite.config.ts
@@ -0,0 +1,44 @@
+import { defineConfig } from 'vite';
+import path from 'path';
+import preact from '@preact/preset-vite';
+import legacy from '@vitejs/plugin-legacy';
+import { name, version } from './package.json';
+
+const resolve = (url: string) => path.resolve(__dirname, url);
+
+export default defineConfig({
+ build: {
+ // lib: {
+ // entry: resolve('src/index.ts'),
+ // name: 'BaseStyleUniver',
+ // formats: ['es', 'umd', 'cjs'],
+ // fileName: 'index',
+ // },
+ // outDir: './lib',
+ },
+ define: {
+ pkgJson: { name, version },
+ },
+ css: {
+ modules: {
+ localsConvention: 'camelCaseOnly', // dash to camelCase conversion// .apply-color -> applyColor
+ generateScopedName: 'univer-[local]', // custom prefix class name
+ },
+ preprocessorOptions: {
+ less: {
+ javascriptEnabled: true,
+ },
+ },
+ },
+ server: {
+ port: 3103,
+ open: true, // Automatically open the app in the browser on server start.
+ },
+ plugins: [
+ preact(),
+ legacy({
+ targets: ['ie >= 11'],
+ additionalLegacyPolyfills: ['regenerator-runtime/runtime'],
+ }),
+ ],
+});
diff --git a/packages/ui-plugin-sheets/index.html b/packages/ui-plugin-sheets/index.html
deleted file mode 100644
index 87007e935e..0000000000
--- a/packages/ui-plugin-sheets/index.html
+++ /dev/null
@@ -1,26 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-
-<head>
- <meta charset="UTF-8" />
- <link rel="icon" type="image/svg+xml" href="favicon.svg" />
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
- <title>Univer</title>
- <style>
- html,
- body {
- height: 100%;
- margin: 0;
- }
- </style>
-</head>
-
-<body>
- <div id="app" style="position:absolute;z-index: 99999;"></div>
- <div id="universheet" style="height: 30vh;"></div>
- <div id="univerdoc" style="height: 30vh;"></div>
- <div id="universlide" style="height: 30vh;"></div>
- <script type="module" src="/src/main.tsx"></script>
-</body>
-
-</html>
\ No newline at end of file
diff --git a/packages/ui-plugin-sheets/src/SheetUIPlugin.ts b/packages/ui-plugin-sheets/src/SheetUIPlugin.ts
index 03c359e9b0..4023b23f5e 100644
--- a/packages/ui-plugin-sheets/src/SheetUIPlugin.ts
+++ b/packages/ui-plugin-sheets/src/SheetUIPlugin.ts
@@ -1,5 +1,4 @@
-import { Plugin, UniverSheet, Tools, PLUGIN_NAMES } from '@univerjs/core';
-import { Context } from '@univerjs/core/src/Basics/Context';
+import { Plugin, UniverSheet, Tools, PLUGIN_NAMES, Context } from '@univerjs/core';
import { ComponentManager, getRefElement, RegisterManager } from '@univerjs/base-ui';
import { RenderEngine } from '@univerjs/base-render';
import { DefaultSheetUiConfig, installObserver, ISheetUIPluginConfig, SheetUIPluginObserve, SHEET_UI_PLUGIN_NAME } from './Basics';
diff --git a/packages/ui-plugin-sheets/src/main.tsx b/packages/ui-plugin-sheets/src/main.tsx
deleted file mode 100644
index 4620e73b1e..0000000000
--- a/packages/ui-plugin-sheets/src/main.tsx
+++ /dev/null
@@ -1,20 +0,0 @@
-import { UniverSheet } from '@univerjs/core';
-import { RenderEngine } from '@univerjs/base-render';
-import { SheetPlugin } from '@univerjs/base-sheets';
-
-import { DEFAULT_WORKBOOK_DATA } from '@univerjs/common-plugin-data';
-
-import { SheetUIPlugin } from './SheetUIPlugin';
-
-// sheet
-const sheetPluginConfig = {
- container: 'universheet',
-};
-
-const univerSheet = UniverSheet.newInstance(DEFAULT_WORKBOOK_DATA);
-
-univerSheet.installPlugin(new RenderEngine());
-univerSheet.installPlugin(new UniverComponentSheet());
-
-univerSheet.installPlugin(new SheetPlugin(sheetPluginConfig));
-univerSheet.installPlugin(new SheetUIPlugin());
diff --git a/packages/ui-plugin-slides/.gitignore b/packages/ui-plugin-slides/.gitignore
new file mode 100644
index 0000000000..12e1bd6bec
--- /dev/null
+++ b/packages/ui-plugin-slides/.gitignore
@@ -0,0 +1,101 @@
+#ide
+*.DS_Store
+.idea
+.vscode
+
+#npm
+package-lock.json
+
+dist
+lib
+docs/.vuepress/dist
+
+# Logs
+logs
+*.log
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+lerna-debug.log*
+
+# Runtime config
+pids
+*.pid
+*.seed
+*.pid.lock
+
+# Directory for instrumented libs generated by jscoverage/JSCover
+lib-cov
+
+# Coverage directory used by tools like istanbul
+coverage
+
+# nyc test coverage
+.nyc_output
+
+# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
+.grunt
+
+# Bower dependency directory (https://bower.io/)
+bower_components
+
+# node-waf configuration
+.lock-wscript
+
+# Compiled binary addons (https://nodejs.org/api/addons.html)
+build/Release
+
+# Dependency directories
+node_modules
+jspm_packages/
+
+# TypeScript v1 declaration files
+typings/
+
+# Optional npm cache directory
+.npm
+
+# Optional eslint cache
+.eslintcache
+
+# Optional REPL History
+.node_repl_history
+
+# Output of 'npm pack'
+*.tgz
+
+# Yarn Integrity file
+.yarn-integrity
+
+# dotenv environment variables file
+.env
+
+# next.js build output
+.next
+
+#lerna-changelog
+.changelog
+
+
+#editor workspace file
+.idea/
+
+
+.DS_Store
+
+.history
+# examples
+
+
+# Production
+/build
+
+# Generated files
+.docusaurus
+.cache-loader
+
+# Misc
+.env.local
+.env.development.local
+.env.test.local
+.env.production.local
diff --git a/packages/ui-plugin-slides/README.md b/packages/ui-plugin-slides/README.md
new file mode 100644
index 0000000000..04b81be0ef
--- /dev/null
+++ b/packages/ui-plugin-slides/README.md
@@ -0,0 +1,14 @@
+# @univerjs/ui-plugin-slides
+
+## Introduction
+
+Univer ui plugin slides
+
+## Usage
+### Installation
+```shell
+npm i @univerjs/ui-plugin-slides
+```
+
+### API
+Check [Univer](https://github.com/dream-num/univer/)
\ No newline at end of file
diff --git a/packages/ui-plugin-slides/jest.config.js b/packages/ui-plugin-slides/jest.config.js
new file mode 100644
index 0000000000..a1ab72c760
--- /dev/null
+++ b/packages/ui-plugin-slides/jest.config.js
@@ -0,0 +1,18 @@
+/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
+module.exports = {
+ preset: 'ts-jest',
+ testEnvironment: 'jsdom',
+ moduleFileExtensions: ['js', 'ts', 'tsx'],
+
+ roots: ['<rootDir>/src'],
+ testMatch: ['**/__tests__/**/*.+(ts|tsx|js)', '**/?(*.)+(spec|test).+(ts|tsx|js)'],
+ transform: {
+ '^.+\\.(ts|tsx)$': 'ts-jest',
+ '^.+\\.tsx?$': 'babel-jest', // https://github.com/kulshekhar/ts-jest/issues/937#issuecomment-455431207
+ },
+ globals: {
+ 'ts-jest': {
+ tsConfig: 'tsconfig.json',
+ },
+ },
+};
diff --git a/packages/ui-plugin-slides/package.json b/packages/ui-plugin-slides/package.json
new file mode 100644
index 0000000000..3ec7a91d73
--- /dev/null
+++ b/packages/ui-plugin-slides/package.json
@@ -0,0 +1,55 @@
+{
+ "name": "@univerjs/ui-plugin-slides",
+ "version": "0.0.1",
+ "description": "Univer normal ui-plugin-slides",
+ "keywords": [],
+ "author": "DreamNum <[email protected]>",
+ "license": "MIT",
+ "main": "./src/index.ts",
+ "module": "./src/index.ts",
+ "types": "./src/Types/index.d.ts",
+ "publishConfig": {
+ "main": "./lib/univer-ui-plugin-slides.cjs.js",
+ "module": "./lib/univer-ui-plugin-slides.es.js",
+ "types": "./lib/index.d.ts"
+ },
+ "exports": {
+ ".": "./src/index.ts",
+ "./*": "./src/*"
+ },
+ "directories": {
+ "lib": "lib"
+ },
+ "files": [
+ "lib"
+ ],
+ "scripts": {
+ "test": "jest",
+ "dev": "vite",
+ "build": "tsc && vite build",
+ "watch": "vite build",
+ "link": "pnpm link ./",
+ "serve": "vite preview"
+ },
+ "devDependencies": {
+ "@preact/preset-vite": "2.0.0",
+ "@testing-library/preact": "^2.0.1",
+ "@types/jest": "^27.0.1",
+ "@types/node": "^16.4.6",
+ "@vitejs/plugin-legacy": "^1.5.1",
+ "less": "^4.1.1",
+ "prettier": "^2.3.2",
+ "ts-jest": "29.0.1",
+ "ts-node": "^10.2.1",
+ "typescript": "^4.4.1-rc",
+ "vite": "^2.4.4"
+ },
+ "dependencies": {
+ "@univerjs/base-render": "workspace:^0.0.1",
+ "@univerjs/base-slides": "workspace:^0.0.1",
+ "@univerjs/base-ui": "workspace:^0.0.1",
+ "@univerjs/core": "workspace:^0.0.1",
+ "css-vars-ponyfill": "^2.4.6",
+ "preact": "^10.12.1"
+ }
+}
\ No newline at end of file
diff --git a/packages/ui-plugin-slides/src/Basic/Const/PLUGIN_NAME.ts b/packages/ui-plugin-slides/src/Basic/Const/PLUGIN_NAME.ts
new file mode 100644
index 0000000000..9ee068a5a0
--- /dev/null
+++ b/packages/ui-plugin-slides/src/Basic/Const/PLUGIN_NAME.ts
@@ -0,0 +1 @@
+export const SLIDE_UI_PLUGIN_NAME = 'SlideUI';
diff --git a/packages/ui-plugin-slides/src/Basic/Const/index.ts b/packages/ui-plugin-slides/src/Basic/Const/index.ts
new file mode 100644
index 0000000000..0dc96d927a
--- /dev/null
+++ b/packages/ui-plugin-slides/src/Basic/Const/index.ts
@@ -0,0 +1 @@
+export * from './PLUGIN_NAME';
diff --git a/packages/ui-plugin-slides/src/Basic/Enum/index.ts b/packages/ui-plugin-slides/src/Basic/Enum/index.ts
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/packages/ui-plugin-slides/src/Basic/Shared/index.ts b/packages/ui-plugin-slides/src/Basic/Shared/index.ts
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/packages/ui-plugin-slides/src/Basic/index.ts b/packages/ui-plugin-slides/src/Basic/index.ts
new file mode 100644
index 0000000000..640d1bb8b3
--- /dev/null
+++ b/packages/ui-plugin-slides/src/Basic/index.ts
@@ -0,0 +1,4 @@
+export * from './Const';
+export * from './Enum';
+export * from '../Locale';
+export * from './Shared';
diff --git a/packages/ui-plugin-slides/src/Controller/UIController.ts b/packages/ui-plugin-slides/src/Controller/UIController.ts
new file mode 100644
index 0000000000..db19ec8146
--- /dev/null
+++ b/packages/ui-plugin-slides/src/Controller/UIController.ts
@@ -0,0 +1,12 @@
+import { SlidePlugin } from '@univerjs/base-slides';
+import { SlideUIPlugin } from '../SlideUIPlugin';
+
+export class UIController {
+ protected _slidePlugin: SlidePlugin;
+
+ protected _plugin: SlideUIPlugin;
+
+ constructor(plugin: SlideUIPlugin) {
+ this._plugin = plugin;
+ }
+}
diff --git a/packages/ui-plugin-slides/src/Controller/index.ts b/packages/ui-plugin-slides/src/Controller/index.ts
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/packages/ui-plugin-slides/src/Locale/en.ts b/packages/ui-plugin-slides/src/Locale/en.ts
new file mode 100644
index 0000000000..54163bc14e
--- /dev/null
+++ b/packages/ui-plugin-slides/src/Locale/en.ts
@@ -0,0 +1,8 @@
+export default {
+ ui: {
+ tooltip: 'UI',
+ one: 'one',
+ two: 'two',
+ three: 'three',
+ },
+};
diff --git a/packages/ui-plugin-slides/src/Locale/index.ts b/packages/ui-plugin-slides/src/Locale/index.ts
new file mode 100644
index 0000000000..3ac4bcd0fd
--- /dev/null
+++ b/packages/ui-plugin-slides/src/Locale/index.ts
@@ -0,0 +1,4 @@
+import zh from './zh';
+import en from './en';
+
+export { zh, en };
diff --git a/packages/ui-plugin-slides/src/Locale/zh.ts b/packages/ui-plugin-slides/src/Locale/zh.ts
new file mode 100644
index 0000000000..3af3fac77c
--- /dev/null
+++ b/packages/ui-plugin-slides/src/Locale/zh.ts
@@ -0,0 +1,8 @@
+export default {
+ ui: {
+ tooltip: 'UI',
+ one: '一',
+ two: '二',
+ three: '三',
+ },
+};
diff --git a/packages/ui-plugin-slides/src/Model/index.ts b/packages/ui-plugin-slides/src/Model/index.ts
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/packages/ui-plugin-slides/src/Service/index.ts b/packages/ui-plugin-slides/src/Service/index.ts
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/packages/ui-plugin-slides/src/SlideUIPlugin.ts b/packages/ui-plugin-slides/src/SlideUIPlugin.ts
new file mode 100644
index 0000000000..266823599c
--- /dev/null
+++ b/packages/ui-plugin-slides/src/SlideUIPlugin.ts
@@ -0,0 +1,40 @@
+import { Plugin, Context, UniverSlide } from '@univerjs/core';
+import { zh, en } from './Locale';
+import { SLIDE_UI_PLUGIN_NAME } from './Basic/Const/PLUGIN_NAME';
+import { UIController } from './Controller/UIController';
+
+export interface ISlideUIPluginConfig {}
+
+export class SlideUIPlugin extends Plugin<any, Context> {
+ private _UIController: UIController;
+
+ constructor(config?: ISlideUIPluginConfig) {
+ super(SLIDE_UI_PLUGIN_NAME);
+ }
+
+ static create(config?: ISlideUIPluginConfig) {
+ return new SlideUIPlugin(config);
+ }
+
+ installTo(universheetInstance: UniverSlide) {
+ universheetInstance.installPlugin(this);
+ }
+
+ initialize(): void {
+ /**
+ * load more Locale object
+ */
+ this.getLocale().load({
+ en,
+ zh,
+ });
+
+ this._UIController = new UIController(this);
+ }
+
+ onMounted(): void {
+ this.initialize();
+ }
+
+ onDestroy(): void {}
+}
diff --git a/packages/ui-plugin-slides/src/Types/index.d.ts b/packages/ui-plugin-slides/src/Types/index.d.ts
new file mode 100644
index 0000000000..918439fdbe
--- /dev/null
+++ b/packages/ui-plugin-slides/src/Types/index.d.ts
@@ -0,0 +1,10 @@
+/// <reference types="vite/client" />
+
+export * from '../index';
+declare module '@univerjs/ui-plugin-slides' {}
+
+// use css module
+declare module '*.less' {
+ const resource: { [key: string]: string };
+ export = resource;
+}
diff --git a/packages/ui-plugin-slides/src/Types/preact.d.ts b/packages/ui-plugin-slides/src/Types/preact.d.ts
new file mode 100644
index 0000000000..0d092b3751
--- /dev/null
+++ b/packages/ui-plugin-slides/src/Types/preact.d.ts
@@ -0,0 +1,4 @@
+/// <reference types="enzyme-adapter-preact-pure" />
+import JSX = preact.JSX;
+
+declare module 'enzyme';
diff --git a/packages/ui-plugin-slides/src/View/Render/index.ts b/packages/ui-plugin-slides/src/View/Render/index.ts
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/packages/ui-plugin-slides/src/View/UI/index.ts b/packages/ui-plugin-slides/src/View/UI/index.ts
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/packages/ui-plugin-slides/src/index.ts b/packages/ui-plugin-slides/src/index.ts
new file mode 100644
index 0000000000..d35fee8363
--- /dev/null
+++ b/packages/ui-plugin-slides/src/index.ts
@@ -0,0 +1 @@
+export * from './SlideUIPlugin';
diff --git a/packages/ui-plugin-slides/tsconfig.json b/packages/ui-plugin-slides/tsconfig.json
new file mode 100644
index 0000000000..7d1f34cc0a
--- /dev/null
+++ b/packages/ui-plugin-slides/tsconfig.json
@@ -0,0 +1,38 @@
+{
+ "compilerOptions": {
+ "rootDir": "./",
+ "outDir": "lib",
+ "target": "ESNext",
+ "lib": [
+ "ESNext",
+ "DOM",
+ "WebWorker"
+ ],
+ "module": "ESNext",
+ "moduleResolution": "Node", //This value is needed for Node.js.
+ "declaration": true,
+ "declarationDir": "./lib",
+ "declarationMap": true,
+ "sourceMap": true,
+ "resolveJsonModule": true,
+ "strict": true,
+ "allowJs": true,
+ "baseUrl": "./",
+ "skipLibCheck": true,
+ "esModuleInterop": true, // auto allowSyntheticDefaultImports tru
+ "suppressImplicitAnyIndexErrors": true,
+ "experimentalDecorators": true,
+ "jsx": "react-jsx",
+ "jsxImportSource": "preact",
+ "strictPropertyInitialization": false,
+ "types": [
+ "jest",
+ "node",
+ "@types/jest"
+ ]
+ },
+ "include": [
+ "src/**/*",
+ "test/**/*.test.(ts|tsx|js)"
+ ]
+}
\ No newline at end of file
diff --git a/packages/ui-plugin-slides/vite.config.ts b/packages/ui-plugin-slides/vite.config.ts
new file mode 100644
index 0000000000..dcdbd9e822
--- /dev/null
+++ b/packages/ui-plugin-slides/vite.config.ts
@@ -0,0 +1,44 @@
+import { defineConfig } from 'vite';
+import path from 'path';
+import preact from '@preact/preset-vite';
+import legacy from '@vitejs/plugin-legacy';
+import { name, version } from './package.json';
+
+const resolve = (url: string) => path.resolve(__dirname, url);
+
+export default defineConfig({
+ build: {
+ // lib: {
+ // entry: resolve('src/index.ts'),
+ // name: 'BaseStyleUniver',
+ // formats: ['es', 'umd', 'cjs'],
+ // fileName: 'index',
+ // },
+ // outDir: './lib',
+ },
+ define: {
+ pkgJson: { name, version },
+ },
+ css: {
+ modules: {
+ localsConvention: 'camelCaseOnly', // dash to camelCase conversion// .apply-color -> applyColor
+ generateScopedName: 'univer-[local]', // custom prefix class name
+ },
+ preprocessorOptions: {
+ less: {
+ javascriptEnabled: true,
+ },
+ },
+ },
+ server: {
+ port: 3103,
+ open: true, // Automatically open the app in the browser on server start.
+ },
+ plugins: [
+ preact(),
+ legacy({
+ targets: ['ie >= 11'],
+ additionalLegacyPolyfills: ['regenerator-runtime/runtime'],
+ }),
+ ],
+});