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.
TypeScript boardcollaborationdocdocxexceloffce365officepdfpptpptxpresentationsdksheetslidesspreadsheetuniverwordwordprocessorworkspacexlsx
feat(demo): add support for dynamic imports (#3433)
白熱33571b6efbc9
diff --git a/examples/esbuild.config.mjs b/examples/esbuild.config.mjsindex 0075558503..921bc04a21 100644--- a/examples/esbuild.config.mjs+++ b/examples/esbuild.config.mjs@@ -47,6 +47,8 @@ function monacoBuildTask() {const ctx = await esbuild[args.watch ? 'context' : 'build']({bundle: true,+ format: 'esm',+ splitting: true,color: true,loader: { '.svg': 'file', '.ttf': 'file' },sourcemap: args.watch,diff --git a/examples/public/docs-uniscript/index.html b/examples/public/docs-uniscript/index.htmlindex ceca80978c..4ce2d7ce83 100644--- a/examples/public/docs-uniscript/index.html+++ b/examples/public/docs-uniscript/index.html@@ -26,6 +26,6 @@<body style="overflow: hidden"><div id="app" style="height: 100%"></div>- <script src="./main.js"></script>+ <script type="module" src="./main.js"></script></body></html>diff --git a/examples/public/docs/index.html b/examples/public/docs/index.htmlindex aba35a5111..737231eb1d 100644--- a/examples/public/docs/index.html+++ b/examples/public/docs/index.html@@ -26,6 +26,6 @@<body><div id="app" style="height: 100%"></div>- <script src="./main.js"></script>+ <script type="module" src="./main.js"></script></body></html>diff --git a/examples/public/index.html b/examples/public/index.htmlindex 0bc36647ca..70b652cb2f 100644--- a/examples/public/index.html+++ b/examples/public/index.html@@ -25,6 +25,6 @@<body style="overflow: hidden"><div id="app" style="height: 100%"></div>- <script src="./main.js"></script>+ <script type="module" src="./main.js"></script></body></html>diff --git a/examples/public/mobile-s/index.html b/examples/public/mobile-s/index.htmlindex c228b9f521..6e4179b27e 100644--- a/examples/public/mobile-s/index.html+++ b/examples/public/mobile-s/index.html@@ -26,6 +26,6 @@<body style="overflow: hidden"><div id="app" style="height: 100%"></div>- <script src="./main.js"></script>+ <script type="module" src="./main.js"></script></body></html>diff --git a/examples/public/sheets-multi/index.html b/examples/public/sheets-multi/index.htmlindex f25beb52d4..091d2c4671 100644--- a/examples/public/sheets-multi/index.html+++ b/examples/public/sheets-multi/index.html@@ -25,6 +25,6 @@<body style="overflow: hidden; display: flex; flex-direction: row"><div id="container" style="flex: 1 1 0%"></div>- <script src="./main.js"></script>+ <script type="module" src="./main.js"></script></body></html>diff --git a/examples/public/sheets-uniscript/index.html b/examples/public/sheets-uniscript/index.htmlindex d46fc63434..040ccdb1e2 100644--- a/examples/public/sheets-uniscript/index.html+++ b/examples/public/sheets-uniscript/index.html@@ -26,6 +26,6 @@<body style="overflow: hidden"><div id="app" style="height: 100%"></div>- <script src="./main.js"></script>+ <script type="module" src="./main.js"></script></body></html>diff --git a/examples/public/sheets/index.html b/examples/public/sheets/index.htmlindex 4005a1fcee..e6f1a9e137 100644--- a/examples/public/sheets/index.html+++ b/examples/public/sheets/index.html@@ -26,6 +26,6 @@<body style="overflow: hidden"><div id="app" style="height: 100%"></div>- <script src="./main.js"></script>+ <script type="module" src="./main.js"></script></body></html>diff --git a/examples/public/slides/index.html b/examples/public/slides/index.htmlindex 0d453221a9..d8258d438d 100644--- a/examples/public/slides/index.html+++ b/examples/public/slides/index.html@@ -25,6 +25,6 @@<body style="overflow: hidden"><div id="app" style="height: 100%"></div>- <script src="./main.js"></script>+ <script type="module" src="./main.js"></script></body></html>diff --git a/examples/public/uni/index.html b/examples/public/uni/index.htmlindex c228b9f521..6e4179b27e 100644--- a/examples/public/uni/index.html+++ b/examples/public/uni/index.html@@ -26,6 +26,6 @@<body style="overflow: hidden"><div id="app" style="height: 100%"></div>- <script src="./main.js"></script>+ <script type="module" src="./main.js"></script></body></html>diff --git a/examples/src/data/docs/default-document-data-cn.ts b/examples/src/data/docs/default-document-data-cn.tsindex af2f6c22cb..a1bc3c5c81 100644--- a/examples/src/data/docs/default-document-data-cn.ts+++ b/examples/src/data/docs/default-document-data-cn.ts@@ -14,9 +14,9 @@* limitations under the License.*/-import type { IDocumentData } from '@univerjs/core';import { BooleanNumber, DocumentFlavor } from '@univerjs/core';import { ptToPixel } from '@univerjs/engine-render';+import type { IDocumentData } from '@univerjs/core';export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {id: 'd',diff --git a/examples/src/data/docs/default-document-data-dreamer.ts b/examples/src/data/docs/default-document-data-dreamer.tsindex 1f6c8762c9..53c616b30c 100644--- a/examples/src/data/docs/default-document-data-dreamer.ts+++ b/examples/src/data/docs/default-document-data-dreamer.ts@@ -14,7 +14,6 @@* limitations under the License.*/-import type { IDocumentData } from '@univerjs/core';import {BooleanNumber,ColumnSeparatorType,@@ -27,6 +26,7 @@ import {WrapTextType,} from '@univerjs/core';import { ptToPixel } from '@univerjs/engine-render';+import type { IDocumentData } from '@univerjs/core';export const DEFAULT_DOCUMENT_DATA_DREAMER: IDocumentData = {id: 'd',diff --git a/examples/src/data/docs/default-document-data-en.ts b/examples/src/data/docs/default-document-data-en.tsindex f4875aebde..9e333d089e 100644--- a/examples/src/data/docs/default-document-data-en.ts+++ b/examples/src/data/docs/default-document-data-en.ts@@ -14,7 +14,6 @@* limitations under the License.*/-import type { IDocumentData } from '@univerjs/core';import {BooleanNumber,ColumnSeparatorType,@@ -28,6 +27,7 @@ import {WrapTextType,} from '@univerjs/core';import { ptToPixel } from '@univerjs/engine-render';+import type { IDocumentData } from '@univerjs/core';export const DEFAULT_DOCUMENT_DATA_EN: IDocumentData = {id: 'd-en',diff --git a/examples/src/data/docs/default-document-data.ts b/examples/src/data/docs/default-document-data.tsindex 8040915249..288e05eadc 100644--- a/examples/src/data/docs/default-document-data.ts+++ b/examples/src/data/docs/default-document-data.ts@@ -14,7 +14,6 @@* limitations under the License.*/-import type { IDocumentData } from '@univerjs/core';import {BaselineOffset,BooleanNumber,@@ -28,6 +27,7 @@ import {SectionType,WrapTextType,} from '@univerjs/core';+import type { IDocumentData } from '@univerjs/core';export const DEFAULT_DOCUMENT_DATA: IDocumentData = {id: 'd',diff --git a/examples/src/data/docs/default-document.data-simple.ts b/examples/src/data/docs/default-document.data-simple.tsindex fb11834cdb..110079bfc9 100644--- a/examples/src/data/docs/default-document.data-simple.ts+++ b/examples/src/data/docs/default-document.data-simple.ts@@ -14,9 +14,9 @@* limitations under the License.*/-import type { IDocumentData, IParagraph, ISectionBreak, ITable, ITableCell, ITableColumn, ITableRow } from '@univerjs/core';import { BooleanNumber, DocumentFlavor, HorizontalAlign, ObjectRelativeFromH, ObjectRelativeFromV, TableAlignmentType, TableCellHeightRule, TableSizeType, TableTextWrapType, Tools } from '@univerjs/core';import { ptToPixel } from '@univerjs/engine-render';+import type { IDocumentData, IParagraph, ISectionBreak, ITable, ITableCell, ITableColumn, ITableRow } from '@univerjs/core';const TABLE_START = '\x1A'; // 表格开始const TABLE_ROW_START = '\x1B'; // 表格行开始diff --git a/examples/src/data/sheets/default-workbook-data.ts b/examples/src/data/sheets/default-workbook-data.tsindex 0b46e233fd..273f1ad551 100644--- a/examples/src/data/sheets/default-workbook-data.ts+++ b/examples/src/data/sheets/default-workbook-data.ts@@ -14,7 +14,6 @@* limitations under the License.*/-import type { IDocumentData, IWorkbookData } from '@univerjs/core';import {BaselineOffset,BooleanNumber,@@ -33,6 +32,7 @@ import {WrapStrategy,WrapTextType,} from '@univerjs/core';+import type { IDocumentData, IWorkbookData } from '@univerjs/core';const richTextTestFloat: IDocumentData = {id: 'd',diff --git a/examples/src/data/sheets/demo/default-workbook-data-demo1.ts b/examples/src/data/sheets/demo/default-workbook-data-demo1.tsindex 3df2c39c2f..b446dcb764 100644--- a/examples/src/data/sheets/demo/default-workbook-data-demo1.ts+++ b/examples/src/data/sheets/demo/default-workbook-data-demo1.ts@@ -14,8 +14,8 @@* limitations under the License.*/-import type { IWorkbookData } from '@univerjs/core';import { BooleanNumber, BorderStyleTypes, LocaleType } from '@univerjs/core';+import type { IWorkbookData } from '@univerjs/core';export const DEFAULT_WORKBOOK_DATA_DEMO1: IWorkbookData = {id: 'workbook-right',diff --git a/examples/src/data/sheets/demo/default-workbook-data-demo2.ts b/examples/src/data/sheets/demo/default-workbook-data-demo2.tsindex 8fba153079..8dce1e0142 100644--- a/examples/src/data/sheets/demo/default-workbook-data-demo2.ts+++ b/examples/src/data/sheets/demo/default-workbook-data-demo2.ts@@ -14,8 +14,8 @@* limitations under the License.*/-import type { IWorkbookData } from '@univerjs/core';import { BooleanNumber, BorderStyleTypes, LocaleType } from '@univerjs/core';+import type { IWorkbookData } from '@univerjs/core';export const DEFAULT_WORKBOOK_DATA_DEMO2: IWorkbookData = {id: 'workbook-01',diff --git a/examples/src/data/sheets/demo/default-workbook-data-demo3.ts b/examples/src/data/sheets/demo/default-workbook-data-demo3.tsindex 5bc36a68c4..0b4157d972 100644--- a/examples/src/data/sheets/demo/default-workbook-data-demo3.ts+++ b/examples/src/data/sheets/demo/default-workbook-data-demo3.ts@@ -14,8 +14,8 @@* limitations under the License.*/-import type { IDocumentData, IWorkbookData } from '@univerjs/core';import { BooleanNumber, BorderStyleTypes, LocaleType } from '@univerjs/core';+import type { IDocumentData, IWorkbookData } from '@univerjs/core';const richTextDemo: IDocumentData = {id: 'd',diff --git a/examples/src/data/sheets/demo/default-workbook-data-demo4.ts b/examples/src/data/sheets/demo/default-workbook-data-demo4.tsindex 885446d5c5..bf5d47e44d 100644--- a/examples/src/data/sheets/demo/default-workbook-data-demo4.ts+++ b/examples/src/data/sheets/demo/default-workbook-data-demo4.ts@@ -14,8 +14,8 @@* limitations under the License.*/-import type { IDocumentData, IWorkbookData } from '@univerjs/core';import { BooleanNumber, BorderStyleTypes, LocaleType } from '@univerjs/core';+import type { IDocumentData, IWorkbookData } from '@univerjs/core';const richTextDemo1: IDocumentData = {id: 'd',diff --git a/examples/src/data/sheets/demo/default-workbook-data-demo5.ts b/examples/src/data/sheets/demo/default-workbook-data-demo5.tsindex e15d33c068..44eac169cb 100644--- a/examples/src/data/sheets/demo/default-workbook-data-demo5.ts+++ b/examples/src/data/sheets/demo/default-workbook-data-demo5.ts@@ -14,8 +14,8 @@* limitations under the License.*/-import type { IWorkbookData } from '@univerjs/core';import { BorderStyleTypes, LocaleType } from '@univerjs/core';+import type { IWorkbookData } from '@univerjs/core';export const DEFAULT_WORKBOOK_DATA_DEMO5: IWorkbookData = {id: 'workbook-01',diff --git a/examples/src/data/sheets/demo/default-workbook-data-demo6.ts b/examples/src/data/sheets/demo/default-workbook-data-demo6.tsindex aacaee78a9..529f1c4d49 100644--- a/examples/src/data/sheets/demo/default-workbook-data-demo6.ts+++ b/examples/src/data/sheets/demo/default-workbook-data-demo6.ts@@ -14,8 +14,8 @@* limitations under the License.*/-import type { IWorkbookData } from '@univerjs/core';import { BorderStyleTypes, LocaleType } from '@univerjs/core';+import type { IWorkbookData } from '@univerjs/core';export const DEFAULT_WORKBOOK_DATA_DEMO6: IWorkbookData = {id: 'workbook-01',diff --git a/examples/src/data/sheets/demo/default-workbook-data-demo7.ts b/examples/src/data/sheets/demo/default-workbook-data-demo7.tsindex c0e6e73df5..25232de9df 100644--- a/examples/src/data/sheets/demo/default-workbook-data-demo7.ts+++ b/examples/src/data/sheets/demo/default-workbook-data-demo7.ts@@ -14,8 +14,8 @@* limitations under the License.*/-import type { IWorkbookData } from '@univerjs/core';import { LocaleType } from '@univerjs/core';+import type { IWorkbookData } from '@univerjs/core';export const DEFAULT_WORKBOOK_DATA_DEMO7: IWorkbookData = {id: 'workbook-01',diff --git a/examples/src/data/sheets/demo/default-workbook-data-demo8.ts b/examples/src/data/sheets/demo/default-workbook-data-demo8.tsindex 9d999b43b1..c6e7346ffa 100644--- a/examples/src/data/sheets/demo/default-workbook-data-demo8.ts+++ b/examples/src/data/sheets/demo/default-workbook-data-demo8.ts@@ -14,8 +14,8 @@* limitations under the License.*/-import type { IWorkbookData } from '@univerjs/core';import { LocaleType } from '@univerjs/core';+import type { IWorkbookData } from '@univerjs/core';export const DEFAULT_WORKBOOK_DATA_DEMO8: IWorkbookData = {id: 'workbook-01',diff --git a/examples/src/data/sheets/slide-workbook-data.ts b/examples/src/data/sheets/slide-workbook-data.tsindex 75631370ed..974e46dbaa 100644--- a/examples/src/data/sheets/slide-workbook-data.ts+++ b/examples/src/data/sheets/slide-workbook-data.ts@@ -14,8 +14,8 @@* limitations under the License.*/-import type { IWorkbookData } from '@univerjs/core';import { BooleanNumber, BorderStyleTypes, LocaleType } from '@univerjs/core';+import type { IWorkbookData } from '@univerjs/core';import { PAGE5_RICHTEXT_1 } from '../slides/rich-text/page5-richtext1';diff --git a/examples/src/data/sheets/uniscript-data.ts b/examples/src/data/sheets/uniscript-data.tsindex 473d82c7cb..b7ad372136 100644--- a/examples/src/data/sheets/uniscript-data.ts+++ b/examples/src/data/sheets/uniscript-data.ts@@ -14,8 +14,8 @@* limitations under the License.*/-import type { IWorkbookData } from '@univerjs/core';import { LocaleType } from '@univerjs/core';+import type { IWorkbookData } from '@univerjs/core';export const UNISCRIT_WORKBOOK_DATA_DEMO: IWorkbookData = {id: 'uniscript-demo',diff --git a/examples/src/data/slides/default-pages/page4.ts b/examples/src/data/slides/default-pages/page4.tsindex dd45e2c64e..61770724e6 100644--- a/examples/src/data/slides/default-pages/page4.ts+++ b/examples/src/data/slides/default-pages/page4.ts@@ -14,8 +14,8 @@* limitations under the License.*/-import type { IWorksheetData } from '@univerjs/core';import { BasicShapes, PageElementType, PageType } from '@univerjs/core';+import type { IWorksheetData } from '@univerjs/core';import { SLIDE_WORKBOOK_DATA } from '../../sheets/slide-workbook-data';diff --git a/examples/src/data/slides/rich-text/page5-richtext1.ts b/examples/src/data/slides/rich-text/page5-richtext1.tsindex b9bbba00e0..2ed0a82b34 100644--- a/examples/src/data/slides/rich-text/page5-richtext1.ts+++ b/examples/src/data/slides/rich-text/page5-richtext1.ts@@ -14,8 +14,8 @@* limitations under the License.*/-import type { IDocumentData } from '@univerjs/core';import { BooleanNumber, ColumnSeparatorType, PresetListType, SectionType } from '@univerjs/core';+import type { IDocumentData } from '@univerjs/core';export const PAGE5_RICHTEXT_1: IDocumentData = {id: 'd',diff --git a/examples/src/data/slides/unlimited-slide-data.ts b/examples/src/data/slides/unlimited-slide-data.tsindex a8f01c353e..531273d360 100644--- a/examples/src/data/slides/unlimited-slide-data.ts+++ b/examples/src/data/slides/unlimited-slide-data.ts@@ -14,8 +14,8 @@* limitations under the License.*/-import type { ISlideData } from '@univerjs/core';import { BasicShapes, PageElementType, PageType } from '@univerjs/core';+import type { ISlideData } from '@univerjs/core';import { DEFAULT_SECOND_PAGE } from './default-pages/page2';import { DEFAULT_THIRD_PAGE } from './default-pages/page3';diff --git a/examples/src/docs-uniscript/main.ts b/examples/src/docs-uniscript/main.tsindex 3d86d00007..f6cc9b33bb 100644--- a/examples/src/docs-uniscript/main.ts+++ b/examples/src/docs-uniscript/main.ts@@ -14,17 +14,17 @@* limitations under the License.*/-import { LocaleType, LogLevel, Univer } from '@univerjs/core';+import { LocaleType, LogLevel, Univer, UniverInstanceType } from '@univerjs/core';import { defaultTheme } from '@univerjs/design';import { UniverDocsPlugin } from '@univerjs/docs';import { UniverDocsUIPlugin } from '@univerjs/docs-ui';import { UniverFormulaEnginePlugin } from '@univerjs/engine-formula';import { UniverRenderEnginePlugin } from '@univerjs/engine-render';+import { UniverSheetsPlugin } from '@univerjs/sheets';+import { UniverSheetsUIPlugin } from '@univerjs/sheets-ui';+import { UniverUIPlugin } from '@univerjs/ui';import { UniverUniscriptPlugin } from '@univerjs/uniscript';--import { UniverSheetsUIPlugin } from '@univerjs/sheets-ui';-import { UniverSheetsPlugin } from '@univerjs/sheets';import { DEFAULT_DOCUMENT_DATA_CN } from '../data';import { enUS, ruRU, zhCN } from '../locales';@@ -58,17 +58,18 @@ univer.registerPlugin(UniverSheetsUIPlugin);univer.registerPlugin(UniverUniscriptPlugin, {getWorkerUrl(moduleID: string, label: string) {if (label === 'typescript' || label === 'javascript') {- return './vs/language/typescript/ts.worker.js';+ return '/vs/language/typescript/ts.worker.js';}- return './vs/editor/editor.worker.js';+ return '/vs/editor/editor.worker.js';},});// create univer doc instance-univer.createUniverDoc(DEFAULT_DOCUMENT_DATA_CN);+univer.createUnit(UniverInstanceType.UNIVER_DOC, DEFAULT_DOCUMENT_DATA_CN);declare global {+ // eslint-disable-next-line ts/naming-conventioninterface Window {univer?: Univer;}diff --git a/examples/src/mobile-s/lazy.ts b/examples/src/mobile-s/lazy.tsindex a1a2a0c52e..c7d2733740 100644--- a/examples/src/mobile-s/lazy.ts+++ b/examples/src/mobile-s/lazy.ts@@ -14,8 +14,8 @@* limitations under the License.*/-import type { Plugin, PluginCtor } from '@univerjs/core';import { UniverSheetsFilterUIPlugin } from '@univerjs/sheets-filter-ui';+import type { Plugin, PluginCtor } from '@univerjs/core';export default function getLazyPlugins(): Array<[PluginCtor<Plugin>] | [PluginCtor<Plugin>, unknown]> {return [diff --git a/examples/src/mobile-s/main.ts b/examples/src/mobile-s/main.tsindex bd0f262752..ab16d0751c 100644--- a/examples/src/mobile-s/main.ts+++ b/examples/src/mobile-s/main.ts@@ -18,20 +18,20 @@ import { LocaleType, LogLevel, Univer, UniverInstanceType, UserManagerService }import { defaultTheme } from '@univerjs/design';import { UniverDocsPlugin } from '@univerjs/docs';import { UniverDocsUIPlugin } from '@univerjs/docs-ui';+import { UniverFormulaEnginePlugin } from '@univerjs/engine-formula';import { UniverRenderEnginePlugin } from '@univerjs/engine-render';+import { UniverRPCMainThreadPlugin } from '@univerjs/rpc';import { UniverSheetsPlugin } from '@univerjs/sheets';-import { UniverSheetsMobileUIPlugin } from '@univerjs/sheets-ui';-import { UniverMobileUIPlugin } from '@univerjs/ui';-import { UniverFormulaEnginePlugin } from '@univerjs/engine-formula';-import type { FUniver } from '@univerjs/facade';+import { UniverSheetsConditionalFormattingMobileUIPlugin } from '@univerjs/sheets-conditional-formatting-ui';+import { UniverSheetsDataValidationMobilePlugin } from '@univerjs/sheets-data-validation';import { UniverSheetsFilterPlugin } from '@univerjs/sheets-filter';import { UniverSheetsFilterMobileUIPlugin } from '@univerjs/sheets-filter-ui';+import { UniverSheetsFormulaMobilePlugin } from '@univerjs/sheets-formula';import { UniverSheetsNumfmtPlugin } from '@univerjs/sheets-numfmt';+import { UniverSheetsMobileUIPlugin } from '@univerjs/sheets-ui';+import { UniverMobileUIPlugin } from '@univerjs/ui';+import type { FUniver } from '@univerjs/facade';import type { IUniverRPCMainThreadConfig } from '@univerjs/rpc';-import { UniverRPCMainThreadPlugin } from '@univerjs/rpc';-import { UniverSheetsFormulaMobilePlugin } from '@univerjs/sheets-formula';-import { UniverSheetsDataValidationMobilePlugin } from '@univerjs/sheets-data-validation';-import { UniverSheetsConditionalFormattingMobileUIPlugin } from '@univerjs/sheets-conditional-formatting-ui';import { DEFAULT_WORKBOOK_DATA_DEMO } from '../data/sheets/demo/default-workbook-data-demo';import { enUS } from '../locales';@@ -50,9 +50,12 @@ univer.registerPlugin(UniverFormulaEnginePlugin);// core pluginsuniver.registerPlugin(UniverDocsPlugin);univer.registerPlugin(UniverRenderEnginePlugin);-univer.registerPlugin(UniverMobileUIPlugin, { container: 'app', contextMenu: true });+univer.registerPlugin(UniverMobileUIPlugin, {+ container: 'app',+ contextMenu: true,+});univer.registerPlugin(UniverRPCMainThreadPlugin, {- workerURL: './worker.js',+ workerURL: new Worker(new URL('./worker.js', import.meta.url), { type: 'module' }),} as IUniverRPCMainThreadConfig);univer.registerPlugin(UniverDocsUIPlugin);diff --git a/examples/src/sheets-multi/main.tsx b/examples/src/sheets-multi/main.tsxindex 39c844ef3d..ba8f6eb359 100644--- a/examples/src/sheets-multi/main.tsx+++ b/examples/src/sheets-multi/main.tsx@@ -14,11 +14,9 @@* limitations under the License.*/-import 'react-mosaic-component/react-mosaic-component.css';-import './index.css';-import { LocaleType, LogLevel, Tools, Univer } from '@univerjs/core';import { defaultTheme } from '@univerjs/design';+import { UniverDocsPlugin } from '@univerjs/docs';import { UniverDocsUIPlugin } from '@univerjs/docs-ui';import { UniverRenderEnginePlugin } from '@univerjs/engine-render';@@ -30,10 +28,12 @@ import { UniverUIPlugin } from '@univerjs/ui';import React, { useEffect } from 'react';import { createRoot } from 'react-dom/client';import { Mosaic, MosaicWindow } from 'react-mosaic-component';-import { DEFAULT_WORKBOOK_DATA_DEMO } from '../data';import { enUS, ruRU, zhCN } from '../locales';+import 'react-mosaic-component/react-mosaic-component.css';+import './index.css';+function factory(id: string) {return function createUniverOnContainer() {const univer = new Univer({diff --git a/examples/src/sheets-uniscript/data.csv b/examples/src/sheets-uniscript/data.csvindex 91392e0be0..b1760bc2f7 100644--- a/examples/src/sheets-uniscript/data.csv+++ b/examples/src/sheets-uniscript/data.csv@@ -47,4 +47,4 @@44162319370120344652262619140203742663272219160509096X-370705195105122060\ No newline at end of file+370705195105122060diff --git a/examples/src/sheets-uniscript/draw-univer-logo.js b/examples/src/sheets-uniscript/draw-univer-logo.jsindex d72f3db7dd..b414646a53 100644--- a/examples/src/sheets-uniscript/draw-univer-logo.js+++ b/examples/src/sheets-uniscript/draw-univer-logo.js@@ -16,7 +16,7 @@/* eslint-disable */-+const newSheet = univerAPI.getActiveWorkbook().create("Draw Univer Logo", 80, 80);newSheet.setRowHeights(0, 80, 6);newSheet.setColumnWidths(0, 80, 6);diff --git a/examples/src/sheets-uniscript/main.ts b/examples/src/sheets-uniscript/main.tsindex d144dc376d..78097b752e 100644--- a/examples/src/sheets-uniscript/main.ts+++ b/examples/src/sheets-uniscript/main.ts@@ -14,7 +14,8 @@* limitations under the License.*/-import { LocaleType, LogLevel, Univer } from '@univerjs/core';+import { LocaleType, LogLevel, Univer, UniverInstanceType } from '@univerjs/core';+import { UniverDebuggerPlugin } from '@univerjs/debugger';import { defaultTheme } from '@univerjs/design';import { UniverDocsPlugin } from '@univerjs/docs';import { UniverDocsUIPlugin } from '@univerjs/docs-ui';@@ -26,7 +27,6 @@ import { UniverSheetsNumfmtPlugin } from '@univerjs/sheets-numfmt';import { UniverSheetsUIPlugin } from '@univerjs/sheets-ui';import { UniverUIPlugin } from '@univerjs/ui';import { UniverUniscriptPlugin } from '@univerjs/uniscript';-import { UniverDebuggerPlugin } from '@univerjs/debugger';import { UNISCRIT_WORKBOOK_DATA_DEMO } from '../data/sheets/uniscript-data';import { enUS, ruRU, zhCN } from '../locales';@@ -64,15 +64,15 @@ univer.registerPlugin(UniverSheetsFormulaPlugin);univer.registerPlugin(UniverUniscriptPlugin, {getWorkerUrl(moduleID: string, label: string) {if (label === 'typescript' || label === 'javascript') {- return './vs/language/typescript/ts.worker.js';+ return '/vs/language/typescript/ts.worker.js';}- return './vs/editor/editor.worker.js';+ return '/vs/editor/editor.worker.js';},});// create univer sheet instance-univer.createUniverSheet(UNISCRIT_WORKBOOK_DATA_DEMO);+univer.createUnit(UniverInstanceType.UNIVER_SHEET, UNISCRIT_WORKBOOK_DATA_DEMO);declare global {interface Window {diff --git a/examples/src/sheets/main.ts b/examples/src/sheets/main.tsindex 8a4e649c42..f4bfc49ed3 100644--- a/examples/src/sheets/main.ts+++ b/examples/src/sheets/main.ts@@ -65,7 +65,7 @@ const univer = new Univer({});univer.registerPlugin(UniverRPCMainThreadPlugin, {- workerURL: './worker.js',+ workerURL: new Worker(new URL('./worker.js', import.meta.url), { type: 'module' }),} as IUniverRPCMainThreadConfig);univer.registerPlugin(UniverDocsPlugin);diff --git a/examples/src/slides/main.ts b/examples/src/slides/main.tsindex 3fef5f5b12..1b7f5c1e43 100644--- a/examples/src/slides/main.ts+++ b/examples/src/slides/main.ts@@ -16,15 +16,15 @@import { LocaleType, Univer, UniverInstanceType } from '@univerjs/core';import { greenTheme } from '@univerjs/design';+import { UniverDocsPlugin } from '@univerjs/docs';+import { UniverDocsUIPlugin } from '@univerjs/docs-ui';+import { UniverDrawingPlugin } from '@univerjs/drawing';+import { UniverFormulaEnginePlugin } from '@univerjs/engine-formula';+import { UniverRenderEnginePlugin } from '@univerjs/engine-render';import { UniverSlidesPlugin } from '@univerjs/slides';import { UniverSlidesUIPlugin } from '@univerjs/slides-ui';import { UniverUIPlugin } from '@univerjs/ui';--import { UniverFormulaEnginePlugin } from '@univerjs/engine-formula';-import { UniverDocsPlugin } from '@univerjs/docs';-import { UniverDocsUIPlugin } from '@univerjs/docs-ui';-import { UniverDrawingPlugin } from '@univerjs/drawing';import { DEFAULT_SLIDE_DATA } from '../data';import { enUS, ruRU, zhCN } from '../locales';diff --git a/examples/src/uni/lazy.ts b/examples/src/uni/lazy.tsindex f5129383d6..37ef75ac93 100644--- a/examples/src/uni/lazy.ts+++ b/examples/src/uni/lazy.ts@@ -14,9 +14,9 @@* limitations under the License.*/-import type { Plugin, PluginCtor } from '@univerjs/core';import { UniverSheetsFilterUIPlugin } from '@univerjs/sheets-filter-ui';import { UniverDocUniFormulaUIPlugin } from '@univerjs/uni-formula-ui';+import type { Plugin, PluginCtor } from '@univerjs/core';// import { UniverUniscriptPlugin } from '@univerjs/uniscript';export default function getLazyPlugins(): Array<[PluginCtor<Plugin>] | [PluginCtor<Plugin>, unknown]> {diff --git a/examples/src/uni/main.ts b/examples/src/uni/main.tsindex 4f7a2b4f11..aa4d0e900a 100644--- a/examples/src/uni/main.ts+++ b/examples/src/uni/main.ts@@ -14,37 +14,37 @@* limitations under the License.*/-import type { Nullable } from '@univerjs/core';import { Injector, LocaleType, LogLevel, Univer, UniverInstanceType } from '@univerjs/core';+import { UniverDebuggerPlugin } from '@univerjs/debugger';import { defaultTheme } from '@univerjs/design';import { UniverDocsPlugin } from '@univerjs/docs';+import { UniverDocsDrawingUIPlugin } from '@univerjs/docs-drawing-ui';import { DocUIController, UniverDocsUIPlugin } from '@univerjs/docs-ui';import { UniverFormulaEnginePlugin } from '@univerjs/engine-formula';import { UniverRenderEnginePlugin } from '@univerjs/engine-render';+import { FUniver } from '@univerjs/facade';+import { UniverRPCMainThreadPlugin } from '@univerjs/rpc';import { UniverSheetsPlugin } from '@univerjs/sheets';+import { UniverSheetsConditionalFormattingUIPlugin } from '@univerjs/sheets-conditional-formatting-ui';+import { UniverSheetsDrawingUIPlugin } from '@univerjs/sheets-drawing-ui';+import { UniverSheetsFindReplacePlugin } from '@univerjs/sheets-find-replace';import { UniverSheetsFormulaPlugin } from '@univerjs/sheets-formula';+import { UniverSheetsHyperLinkUIPlugin } from '@univerjs/sheets-hyper-link-ui';import { UniverSheetsNumfmtPlugin } from '@univerjs/sheets-numfmt';-import { SheetUIController, UniverSheetsUIPlugin } from '@univerjs/sheets-ui';-import { UniSheetsUIController } from '@univerjs/uni-sheets-ui';-import { UniverUniUIPlugin } from '@univerjs/uniui';-import { UniverDebuggerPlugin } from '@univerjs/debugger';-import { FUniver } from '@univerjs/facade';-import { UniverSheetsConditionalFormattingUIPlugin } from '@univerjs/sheets-conditional-formatting-ui';import { UniverSheetsSortUIPlugin } from '@univerjs/sheets-sort-ui';-import { UniverSheetsHyperLinkUIPlugin } from '@univerjs/sheets-hyper-link-ui';-import { UniverSheetsFindReplacePlugin } from '@univerjs/sheets-find-replace';-import type { IThreadCommentMentionDataSource } from '@univerjs/thread-comment-ui';-import { IThreadCommentMentionDataService, UniverThreadCommentUIPlugin } from '@univerjs/thread-comment-ui';import { UniverSheetsThreadCommentPlugin } from '@univerjs/sheets-thread-comment';-import { UniverSheetsDrawingUIPlugin } from '@univerjs/sheets-drawing-ui';-import type { IUniverRPCMainThreadConfig } from '@univerjs/rpc';-import { UniverRPCMainThreadPlugin } from '@univerjs/rpc';-import { UniverDocUniFormulaPlugin } from '@univerjs/uni-formula';-import { UniverDocsDrawingUIPlugin } from '@univerjs/docs-drawing-ui';-import { UniSlidesUIController } from '@univerjs/uni-slides-ui';+import { SheetUIController, UniverSheetsUIPlugin } from '@univerjs/sheets-ui';import { UniverSlidesPlugin } from '@univerjs/slides';import { SlidesUIController, UniverSlidesUIPlugin } from '@univerjs/slides-ui';+import { IThreadCommentMentionDataService, UniverThreadCommentUIPlugin } from '@univerjs/thread-comment-ui';import { UniDocsUIController } from '@univerjs/uni-docs-ui';+import { UniverDocUniFormulaPlugin } from '@univerjs/uni-formula';+import { UniSheetsUIController } from '@univerjs/uni-sheets-ui';+import { UniSlidesUIController } from '@univerjs/uni-slides-ui';+import { UniverUniUIPlugin } from '@univerjs/uniui';+import type { Nullable } from '@univerjs/core';+import type { IUniverRPCMainThreadConfig } from '@univerjs/rpc';+import type { IThreadCommentMentionDataSource } from '@univerjs/thread-comment-ui';import { DEFAULT_DOCUMENT_DATA_CN, DEFAULT_DOCUMENT_DATA_EN, DEFAULT_SLIDE_DATA, DEFAULT_WORKBOOK_DATA_DEMO, DEFAULT_WORKBOOK_DATA_DEMO1 } from '../data';import { enUS } from '../locales';@@ -150,7 +150,7 @@ function registerBasicPlugins(univer: Univer) {});univer.registerPlugin(UniverRPCMainThreadPlugin, {- workerURL: './worker.js',+ workerURL: new Worker(new URL('./worker.js', import.meta.url), { type: 'module' }),} as IUniverRPCMainThreadConfig);univer.registerPlugin(UniverThreadCommentUIPlugin, {overrides: [[IThreadCommentMentionDataService, { useClass: CustomMentionDataService }]],diff --git a/packages-experimental/action-recorder/src/controllers/config.schema.ts b/packages-experimental/action-recorder/src/controllers/config.schema.tsnew file mode 100644index 0000000000..57500ba4d3--- /dev/null+++ b/packages-experimental/action-recorder/src/controllers/config.schema.ts@@ -0,0 +1,27 @@+/**+ * Copyright 2023-present DreamNum Inc.+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */++import type { MenuConfig } from '@univerjs/ui';++export const PLUGIN_CONFIG_KEY = 'action-recorder.config';++export const configSymbol = Symbol(PLUGIN_CONFIG_KEY);++export interface IUniverActionRecorderConfig {+ menu?: MenuConfig;+}++export const defaultPluginConfig: IUniverActionRecorderConfig = {};diff --git a/packages-experimental/action-recorder/src/plugin.ts b/packages-experimental/action-recorder/src/plugin.tsindex 8b91f7dc42..fbc7fa3a5a 100644--- a/packages-experimental/action-recorder/src/plugin.ts+++ b/packages-experimental/action-recorder/src/plugin.ts@@ -14,11 +14,13 @@* limitations under the License.*/-import { Inject, Injector, Plugin } from '@univerjs/core';+import { IConfigService, Inject, Injector, Plugin } from '@univerjs/core';import type { Dependency } from '@univerjs/core';import { ActionRecorderController } from './controllers/action-recorder.controller';+import { defaultPluginConfig, PLUGIN_CONFIG_KEY } from './controllers/config.schema';import { ActionRecorderService } from './services/action-recorder.service';import { ActionReplayService } from './services/replay.service';+import type { IUniverActionRecorderConfig } from './controllers/config.schema';/*** This plugin provides a recorder for user's interactions with Univer,@@ -28,12 +30,21 @@ export class UniverActionRecorderPlugin extends Plugin {static override pluginName = 'UNIVER_ACTION_RECORDER_PLUGIN';constructor(- @Inject(Injector) protected readonly _injector: Injector+ private readonly _config: Partial<IUniverActionRecorderConfig> = defaultPluginConfig,+ @Inject(Injector) protected readonly _injector: Injector,+ @IConfigService private readonly _configService: IConfigService) {super();++ // Manage the plugin configuration.+ const { menu, ...rest } = this._config;+ if (menu) {+ this._configService.setConfig('menu', menu, { merge: true });+ }+ this._configService.setConfig(PLUGIN_CONFIG_KEY, rest);}- override onStarting(_injector?: Injector): void {+ override onStarting(): void {([[ActionRecorderService],[ActionReplayService],