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
chore(cli): add docs-plugin and slides-plugin template
Dushusir4c1dc51ea10b
diff --git a/cli/src/templates/base/src/main.tsx b/cli/src/templates/base/src/main.tsxindex 2dbe46aba9..5ca32e1af6 100644--- a/cli/src/templates/base/src/main.tsx+++ b/cli/src/templates/base/src/main.tsx@@ -12,10 +12,10 @@ const uiDefaultConfigUp = {layout: 'auto',};-const univerSheetUp = UniverSheet.newInstance(DEFAULT_WORKBOOK_DATA);+const univerSheet = UniverSheet.newInstance(DEFAULT_WORKBOOK_DATA);-univerSheetUp.installPlugin(new RenderEngine());-univerSheetUp.installPlugin(new UniverComponentSheet());+univerSheet.installPlugin(new RenderEngine());+univerSheet.installPlugin(new UniverComponentSheet());-univerSheetUp.installPlugin(new SheetPlugin(uiDefaultConfigUp));-univerSheetUp.installPlugin(new <%= projectUpperValue %>Plugin());+univerSheet.installPlugin(new SheetPlugin(uiDefaultConfigUp));+univerSheet.installPlugin(new <%= projectUpperValue %>Plugin());diff --git a/cli/src/templates/common-plugin/index.html b/cli/src/templates/common-plugin/index.htmlindex d8d577832d..87007e935e 100644--- a/cli/src/templates/common-plugin/index.html+++ b/cli/src/templates/common-plugin/index.html@@ -5,7 +5,7 @@<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>UniverSheet</title>+ <title>Univer</title><style>html,body {diff --git a/cli/src/templates/docs-plugin/.eslintrc.js b/cli/src/templates/docs-plugin/.eslintrc.jsnew file mode 100644index 0000000000..7f4cf3e7ba--- /dev/null+++ b/cli/src/templates/docs-plugin/.eslintrc.js@@ -0,0 +1,51 @@+module.exports = {+ env: {+ browser: true,+ es2021: true,+ node: true,+ },+ parser: '@typescript-eslint/parser',+ extends: [+ 'airbnb-typescript',+ 'prettier',+ 'eslint:recommended',+ 'plugin:import/recommended',+ 'plugin:import/typescript',+ ],+ parserOptions: {+ ecmaVersion: 12,+ sourceType: 'module',+ project: './tsconfig.json',+ },+ plugins: ['@typescript-eslint', 'prettier', 'import'],+ rules: {+ 'prettier/prettier': [+ 'error',+ {+ endOfLine: 'auto',+ },+ ],+ 'import/prefer-default-export': 'off',+ 'import/no-extraneous-dependencies': [+ 'error',+ { devDependencies: true },+ ],+ // turn on errors for missing imports+ 'import/no-unresolved': 'error',+ },+ settings: {+ 'import/parsers': {+ '@typescript-eslint/parser': ['.ts', '.tsx'],+ },+ 'import/resolver': {+ typescript: {+ alwaysTryTypes: true, // always try to resolve config under `<root>@config` directory even it doesn't contain any source code, like `@config/unist`++ // Choose from one of the "project" configs below or omit to use <root>/tsconfig.json by default++ // use <root>/path/to/folder/tsconfig.json+ project: './tsconfig.json',+ },+ },+ },+};diff --git a/cli/src/templates/docs-plugin/.gitignore b/cli/src/templates/docs-plugin/.gitignorenew file mode 100644index 0000000000..12e1bd6bec--- /dev/null+++ b/cli/src/templates/docs-plugin/.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.localdiff --git a/cli/src/templates/docs-plugin/.prettierrc.cjs b/cli/src/templates/docs-plugin/.prettierrc.cjsnew file mode 100644index 0000000000..6604107223--- /dev/null+++ b/cli/src/templates/docs-plugin/.prettierrc.cjs@@ -0,0 +1,7 @@+module.exports = {+ singleQuote: true,+ trailingComma: 'es5',+ tabWidth: 4,+ semi: true,+ printWidth: 180,+};diff --git a/cli/src/templates/docs-plugin/README-zh.md b/cli/src/templates/docs-plugin/README-zh.mdnew file mode 100644index 0000000000..ce9ee6ae8e--- /dev/null+++ b/cli/src/templates/docs-plugin/README-zh.md@@ -0,0 +1,55 @@+# style-universheet++简体中文 | [English](./README.md)++## 介绍++UniverSheet <%= projectUpperValue %>插件++### 安装++```bash+npm i @univer/<%= projectName %>+```++### 使用++```js+impport {<%= projectUpperValue %>} from '@univer/<%= 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 @univer/<%= projectName %> dev+```++### 打包++```+# 当前目录 ./packages/<%= projectName %>/+npm run build++# 或者根目录 ./+pnpm run --filter @univer/<%= projectName %> build+```diff --git a/cli/src/templates/docs-plugin/README.md b/cli/src/templates/docs-plugin/README.mdnew file mode 100644index 0000000000..36a4be688c--- /dev/null+++ b/cli/src/templates/docs-plugin/README.md@@ -0,0 +1,55 @@+# style-universheet++English| [简体中文](./README-zh.md)++## Introduction++UniverSheet Plugin <%= projectUpperValue %>++### Installation++```bash+npm i @univer/<%= projectName %>+```++### Usage++```js+impport {<%= projectUpperValue %>} from '@univer/<%= 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 @univer/<%= projectName %> dev+```++### Package++```+# Current directory ./packages/<%= projectName %>/+npm run build++# Or root directory ./+pnpm run --filter @univer/<%= projectName %> build+```diff --git a/cli/src/templates/docs-plugin/index.html b/cli/src/templates/docs-plugin/index.htmlnew file mode 100644index 0000000000..61edd42cbc--- /dev/null+++ b/cli/src/templates/docs-plugin/index.html@@ -0,0 +1,24 @@+<!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>UniverDoc</title>+ <style>+ html,+ body {+ height: 100%;+ margin: 0;+ }+ </style>+</head>++<body>+ <div id="app" style="position:absolute;z-index: 99999;"></div>+ <div id="univerdoc" style="height: 100%;"></div>+ <script type="module" src="/src/main.tsx"></script>+</body>++</html>\ No newline at end of filediff --git a/cli/src/templates/docs-plugin/jest.config.js b/cli/src/templates/docs-plugin/jest.config.jsnew file mode 100644index 0000000000..73ef4bae42--- /dev/null+++ b/cli/src/templates/docs-plugin/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.test.json',+ },+ },+};diff --git a/cli/src/templates/docs-plugin/package.json b/cli/src/templates/docs-plugin/package.jsonnew file mode 100644index 0000000000..808eb199e8--- /dev/null+++ b/cli/src/templates/docs-plugin/package.json@@ -0,0 +1,67 @@+{+ "name": "@univer/<%= projectName %>",+ "version": "0.0.1",+ "description": "UniverSheet normal <%= projectName %>",+ "keywords": [],+ "author": "DreamNum <[email protected]>",+ "license": "MIT",+ "main": "./lib/univer-<%= projectName %>.cjs.js",+ "module": "./lib/univer-<%= projectName %>.es.js",+ "browser": {+ "./lib/univer-<%= projectName %>.cjs.js": "./src/index.ts",+ "./lib/univer-<%= projectName %>.es.js": "./src/index.ts"+ },+ "types": "./src/Types/index.d.ts",+ "exports": {+ ".": {+ "import": {+ "node": "./lib/univer-<%= projectName %>.cjs.js",+ "default": "./lib/univer-<%= projectName %>.es.js"+ },+ "require": "./lib/univer-<%= projectName %>.cjs.js",+ "types": "./lib/univer-<%= projectName %>.d.ts"+ },+ "./*": "./src/*"+ },+ "directories": {+ "lib": "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",+ "eslint": "^8.22.0",+ "eslint-config-airbnb-typescript": "^17.0.0",+ "eslint-config-prettier": "^8.3.0",+ "eslint-plugin-import": "^2.23.4",+ "eslint-plugin-prettier": "^3.4.0",+ "eslint-plugin-jsx-a11y": "^6.5.1",+ "eslint-plugin-react": "^7.28.0",+ "eslint-plugin-react-hooks": "^4.3.0",+ "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": {+ "@univer/common-plugin-data": "workspace:^0.0.1",+ "@univer/base-component": "workspace:^0.0.1",+ "@univer/base-render": "workspace:^0.0.1",+ "@univer/core": "workspace:^0.0.1",+ "@univer/base-docs": "workspace:^0.0.1",+ "@univer/style-universheet": "workspace:^0.0.1",+ "preact": "^10.5.14"+ }+}diff --git a/cli/src/templates/docs-plugin/src/Basic/Const/PLUGIN_NAME.ts b/cli/src/templates/docs-plugin/src/Basic/Const/PLUGIN_NAME.tsnew file mode 100644index 0000000000..5964f8ac95--- /dev/null+++ b/cli/src/templates/docs-plugin/src/Basic/Const/PLUGIN_NAME.ts@@ -0,0 +1 @@+export const <%= projectConstantValue %>_PLUGIN_NAME = '<%= projectValue %>';diff --git a/cli/src/templates/docs-plugin/src/Basic/Const/index.ts b/cli/src/templates/docs-plugin/src/Basic/Const/index.tsnew file mode 100644index 0000000000..0dc96d927a--- /dev/null+++ b/cli/src/templates/docs-plugin/src/Basic/Const/index.ts@@ -0,0 +1 @@+export * from './PLUGIN_NAME';diff --git a/cli/src/templates/docs-plugin/src/Basic/Enum/index.ts b/cli/src/templates/docs-plugin/src/Basic/Enum/index.tsnew file mode 100644index 0000000000..e69de29bb2diff --git a/cli/src/templates/docs-plugin/src/Basic/Shared/index.ts b/cli/src/templates/docs-plugin/src/Basic/Shared/index.tsnew file mode 100644index 0000000000..e69de29bb2diff --git a/cli/src/templates/docs-plugin/src/Basic/index.ts b/cli/src/templates/docs-plugin/src/Basic/index.tsnew file mode 100644index 0000000000..640d1bb8b3--- /dev/null+++ b/cli/src/templates/docs-plugin/src/Basic/index.ts@@ -0,0 +1,4 @@+export * from './Const';+export * from './Enum';+export * from '../Locale';+export * from './Shared';diff --git a/cli/src/templates/docs-plugin/src/Controller/SortController.ts b/cli/src/templates/docs-plugin/src/Controller/SortController.tsnew file mode 100644index 0000000000..3c578d3113--- /dev/null+++ b/cli/src/templates/docs-plugin/src/Controller/SortController.ts@@ -0,0 +1,16 @@+import { BaseComponentRender } from '@univer/base-component';+import { DocPlugin } from '@univer/base-docs';+import { <%= projectConstantValue %>_PLUGIN_NAME } from '../Basic/Const';+import { <%= projectUpperValue %>Plugin } from '../<%= projectUpperValue %>Plugin';++export class <%= projectUpperValue %>Controller {+ protected _docPlugin: DocPlugin;++ protected _plugin: <%= projectUpperValue %>Plugin;++ protected _render: BaseComponentRender;++ constructor(plugin: <%= projectUpperValue %>Plugin) {+ this._plugin = plugin;+ }+}diff --git a/cli/src/templates/docs-plugin/src/Controller/index.ts b/cli/src/templates/docs-plugin/src/Controller/index.tsnew file mode 100644index 0000000000..e69de29bb2diff --git a/cli/src/templates/docs-plugin/src/Locale/en.ts b/cli/src/templates/docs-plugin/src/Locale/en.tsnew file mode 100644index 0000000000..e60e73303a--- /dev/null+++ b/cli/src/templates/docs-plugin/src/Locale/en.ts@@ -0,0 +1,8 @@+export default {+ <%= projectValue %>: {+ tooltip: '<%= projectUpperValue %>',+ one:'one',+ two:'two',+ three:'three',+ },+};diff --git a/cli/src/templates/docs-plugin/src/Locale/index.ts b/cli/src/templates/docs-plugin/src/Locale/index.tsnew file mode 100644index 0000000000..3ac4bcd0fd--- /dev/null+++ b/cli/src/templates/docs-plugin/src/Locale/index.ts@@ -0,0 +1,4 @@+import zh from './zh';+import en from './en';++export { zh, en };diff --git a/cli/src/templates/docs-plugin/src/Locale/zh.ts b/cli/src/templates/docs-plugin/src/Locale/zh.tsnew file mode 100644index 0000000000..3288d76f8e--- /dev/null+++ b/cli/src/templates/docs-plugin/src/Locale/zh.ts@@ -0,0 +1,8 @@+export default {+ <%= projectValue %>: {+ tooltip: '<%= projectUpperValue %>',+ one:'一',+ two:'二',+ three:'三',+ },+};diff --git a/cli/src/templates/docs-plugin/src/Model/index.ts b/cli/src/templates/docs-plugin/src/Model/index.tsnew file mode 100644index 0000000000..e69de29bb2diff --git a/cli/src/templates/docs-plugin/src/Service/index.ts b/cli/src/templates/docs-plugin/src/Service/index.tsnew file mode 100644index 0000000000..e69de29bb2diff --git a/cli/src/templates/docs-plugin/src/SortPlugin.tsx b/cli/src/templates/docs-plugin/src/SortPlugin.tsxnew file mode 100644index 0000000000..0272d519cf--- /dev/null+++ b/cli/src/templates/docs-plugin/src/SortPlugin.tsx@@ -0,0 +1,43 @@+import { Plugin, DocContext, UniverDoc } from '@univer/core';+import { zh, en } from './Locale';+import { <%= projectConstantValue %>_PLUGIN_NAME} from './Basic/Const/PLUGIN_NAME'+import { <%= projectUpperValue %>Controller } from './Controller/<%= projectUpperValue %>Controller';++export interface I<%= projectUpperValue %>PluginConfig {}++export class <%= projectUpperValue %>Plugin extends Plugin<any, DocContext> {+ private _<%= projectValue %>Controller: <%= projectUpperValue %>Controller;++ constructor(config ?: I<%= projectUpperValue %>PluginConfig) {+ super(<%= projectConstantValue %>_PLUGIN_NAME);+ }++ static create(config?: I<%= projectUpperValue %>PluginConfig) {+ return new <%= projectUpperValue %>Plugin(config);+ }++ installTo(universheetInstance: UniverDoc) {+ universheetInstance.installPlugin(this);+ }++ initialize(): void {++ const context = this.getContext();++ /**+ * load more Locale object+ */+ context.getLocale().load({+ en: en,+ zh: zh,+ });++ this._<%= projectValue %>Controller = new <%= projectUpperValue %>Controller(this);+ }++ onMounted(): void {+ this.initialize()+ }++ onDestroy(): void {}+}diff --git a/cli/src/templates/docs-plugin/src/Types/index.d.ts b/cli/src/templates/docs-plugin/src/Types/index.d.tsnew file mode 100644index 0000000000..9820ab8ea2--- /dev/null+++ b/cli/src/templates/docs-plugin/src/Types/index.d.ts@@ -0,0 +1,10 @@+/// <reference types="vite/client" />++export * from '../index';+declare module '@univer/<%= projectName %>' {}++// use css module+declare module '*.less' {+ const resource: { [key: string]: string };+ export = resource;+}diff --git a/cli/src/templates/docs-plugin/src/Types/preact.d.ts b/cli/src/templates/docs-plugin/src/Types/preact.d.tsnew file mode 100644index 0000000000..0d092b3751--- /dev/null+++ b/cli/src/templates/docs-plugin/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/cli/src/templates/docs-plugin/src/View/Render/index.ts b/cli/src/templates/docs-plugin/src/View/Render/index.tsnew file mode 100644index 0000000000..e69de29bb2diff --git a/cli/src/templates/docs-plugin/src/View/UI/index.ts b/cli/src/templates/docs-plugin/src/View/UI/index.tsnew file mode 100644index 0000000000..e69de29bb2diff --git a/cli/src/templates/docs-plugin/src/index.ts b/cli/src/templates/docs-plugin/src/index.tsnew file mode 100644index 0000000000..245449c0b4--- /dev/null+++ b/cli/src/templates/docs-plugin/src/index.ts@@ -0,0 +1,3 @@+import { <%= projectUpperValue %>Plugin } from './<%= projectUpperValue %>Plugin';++export { <%= projectUpperValue %>Plugin };diff --git a/cli/src/templates/docs-plugin/src/main.tsx b/cli/src/templates/docs-plugin/src/main.tsxnew file mode 100644index 0000000000..376b752ed7--- /dev/null+++ b/cli/src/templates/docs-plugin/src/main.tsx@@ -0,0 +1,20 @@+import { UniverDoc } from '@univer/core';+import { RenderEngine } from '@univer/base-render';+import { DocPlugin } from '@univer/base-docs';+import { UniverComponentSheet } from '@univer/style-universheet';++import { <%= projectUpperValue %>Plugin } from './<%= projectUpperValue %>Plugin';+++const uiDefaultConfigUp = {+ container: 'univerdoc',+ layout: 'auto',+};++const univerDoc = UniverDoc.newInstance();++univerDoc.installPlugin(new RenderEngine());+univerDoc.installPlugin(new UniverComponentSheet());++univerDoc.installPlugin(new DocPlugin(uiDefaultConfigUp));+univerDoc.installPlugin(new <%= projectUpperValue %>Plugin());diff --git a/cli/src/templates/docs-plugin/tsconfig.json b/cli/src/templates/docs-plugin/tsconfig.jsonnew file mode 100644index 0000000000..fc81cbd47e--- /dev/null+++ b/cli/src/templates/docs-plugin/tsconfig.json@@ -0,0 +1,31 @@+{+ "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": "preserve",+ "jsxFactory": "h",+ "jsxFragmentFactory": "Fragment",+ "strictPropertyInitialization": false,+ "types": ["jest", "node", "@types/jest"]+ },+ "include": ["src/**/*", "test/**/*.test.(ts|tsx|js)"]+}diff --git a/cli/src/templates/docs-plugin/tsconfig.ref.json b/cli/src/templates/docs-plugin/tsconfig.ref.jsonnew file mode 100644index 0000000000..0c86b2c554--- /dev/null+++ b/cli/src/templates/docs-plugin/tsconfig.ref.json@@ -0,0 +1,7 @@+{+ "extends": "./tsconfig.json",+ "include": ["src/**/*"],+ "compilerOptions": {+ "composite": true+ }+}diff --git a/cli/src/templates/docs-plugin/tsconfig.test.json b/cli/src/templates/docs-plugin/tsconfig.test.jsonnew file mode 100644index 0000000000..a2ac02c4ae--- /dev/null+++ b/cli/src/templates/docs-plugin/tsconfig.test.json@@ -0,0 +1,7 @@+{+ "extends": "./tsconfig.json",+ "compilerOptions": {+ "jsx": "react-jsx",+ "jsxImportSource": "preact"+ }+}diff --git a/cli/src/templates/docs-plugin/vite.config.ts b/cli/src/templates/docs-plugin/vite.config.tsnew file mode 100644index 0000000000..020ecd6209--- /dev/null+++ b/cli/src/templates/docs-plugin/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'],+ // 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/cli/src/templates/sheets-plugin/index.html b/cli/src/templates/sheets-plugin/index.htmlindex 45b8be6bf6..1fa3bb8e2e 100644--- a/cli/src/templates/sheets-plugin/index.html+++ b/cli/src/templates/sheets-plugin/index.html@@ -17,7 +17,7 @@<body><div id="app" style="position:absolute;z-index: 99999;"></div>- <div id="universheet-demo" style="height: 100%;"></div>+ <div id="universheet" style="height: 100%;"></div><script type="module" src="/src/main.tsx"></script></body>diff --git a/cli/src/templates/sheets-plugin/src/main.tsx b/cli/src/templates/sheets-plugin/src/main.tsxindex 47249c6780..5ca32e1af6 100644--- a/cli/src/templates/sheets-plugin/src/main.tsx+++ b/cli/src/templates/sheets-plugin/src/main.tsx@@ -8,14 +8,14 @@ import { <%= projectUpperValue %>Plugin } from './<%= projectUpperValue %>Pluginconst uiDefaultConfigUp = {- container: 'universheet-demo',+ container: 'universheet',layout: 'auto',};-const univerSheetUp = UniverSheet.newInstance(DEFAULT_WORKBOOK_DATA);+const univerSheet = UniverSheet.newInstance(DEFAULT_WORKBOOK_DATA);-univerSheetUp.installPlugin(new RenderEngine());-univerSheetUp.installPlugin(new UniverComponentSheet());+univerSheet.installPlugin(new RenderEngine());+univerSheet.installPlugin(new UniverComponentSheet());-univerSheetUp.installPlugin(new SheetPlugin(uiDefaultConfigUp));-univerSheetUp.installPlugin(new <%= projectUpperValue %>Plugin());+univerSheet.installPlugin(new SheetPlugin(uiDefaultConfigUp));+univerSheet.installPlugin(new <%= projectUpperValue %>Plugin());diff --git a/cli/src/templates/slides-plugin/.eslintrc.js b/cli/src/templates/slides-plugin/.eslintrc.jsnew file mode 100644index 0000000000..7f4cf3e7ba--- /dev/null+++ b/cli/src/templates/slides-plugin/.eslintrc.js@@ -0,0 +1,51 @@+module.exports = {+ env: {+ browser: true,+ es2021: true,+ node: true,+ },+ parser: '@typescript-eslint/parser',+ extends: [+ 'airbnb-typescript',+ 'prettier',+ 'eslint:recommended',+ 'plugin:import/recommended',+ 'plugin:import/typescript',+ ],+ parserOptions: {+ ecmaVersion: 12,+ sourceType: 'module',+ project: './tsconfig.json',+ },+ plugins: ['@typescript-eslint', 'prettier', 'import'],+ rules: {+ 'prettier/prettier': [+ 'error',+ {+ endOfLine: 'auto',+ },+ ],+ 'import/prefer-default-export': 'off',+ 'import/no-extraneous-dependencies': [+ 'error',+ { devDependencies: true },+ ],+ // turn on errors for missing imports+ 'import/no-unresolved': 'error',+ },+ settings: {+ 'import/parsers': {+ '@typescript-eslint/parser': ['.ts', '.tsx'],+ },+ 'import/resolver': {+ typescript: {+ alwaysTryTypes: true, // always try to resolve config under `<root>@config` directory even it doesn't contain any source code, like `@config/unist`++ // Choose from one of the "project" configs below or omit to use <root>/tsconfig.json by default++ // use <root>/path/to/folder/tsconfig.json+ project: './tsconfig.json',+ },+ },+ },+};diff --git a/cli/src/templates/slides-plugin/.gitignore b/cli/src/templates/slides-plugin/.gitignorenew file mode 100644index 0000000000..12e1bd6bec--- /dev/null+++ b/cli/src/templates/slides-plugin/.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.localdiff --git a/cli/src/templates/slides-plugin/.prettierrc.cjs b/cli/src/templates/slides-plugin/.prettierrc.cjsnew file mode 100644index 0000000000..6604107223--- /dev/null+++ b/cli/src/templates/slides-plugin/.prettierrc.cjs@@ -0,0 +1,7 @@+module.exports = {+ singleQuote: true,+ trailingComma: 'es5',+ tabWidth: 4,+ semi: true,+ printWidth: 180,+};diff --git a/cli/src/templates/slides-plugin/README-zh.md b/cli/src/templates/slides-plugin/README-zh.mdnew file mode 100644index 0000000000..ce9ee6ae8e--- /dev/null+++ b/cli/src/templates/slides-plugin/README-zh.md@@ -0,0 +1,55 @@+# style-universheet++简体中文 | [English](./README.md)++## 介绍++UniverSheet <%= projectUpperValue %>插件++### 安装++```bash+npm i @univer/<%= projectName %>+```++### 使用++```js+impport {<%= projectUpperValue %>} from '@univer/<%= 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 @univer/<%= projectName %> dev+```++### 打包++```+# 当前目录 ./packages/<%= projectName %>/+npm run build++# 或者根目录 ./+pnpm run --filter @univer/<%= projectName %> build+```diff --git a/cli/src/templates/slides-plugin/README.md b/cli/src/templates/slides-plugin/README.mdnew file mode 100644index 0000000000..36a4be688c--- /dev/null+++ b/cli/src/templates/slides-plugin/README.md@@ -0,0 +1,55 @@+# style-universheet++English| [简体中文](./README-zh.md)++## Introduction++UniverSheet Plugin <%= projectUpperValue %>++### Installation++```bash+npm i @univer/<%= projectName %>+```++### Usage++```js+impport {<%= projectUpperValue %>} from '@univer/<%= 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 @univer/<%= projectName %> dev+```++### Package++```+# Current directory ./packages/<%= projectName %>/+npm run build++# Or root directory ./+pnpm run --filter @univer/<%= projectName %> build+```diff --git a/cli/src/templates/slides-plugin/index.html b/cli/src/templates/slides-plugin/index.htmlnew file mode 100644index 0000000000..82f655ecb1--- /dev/null+++ b/cli/src/templates/slides-plugin/index.html@@ -0,0 +1,24 @@+<!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>UniverSlide</title>+ <style>+ html,+ body {+ height: 100%;+ margin: 0;+ }+ </style>+</head>++<body>+ <div id="app" style="position:absolute;z-index: 99999;"></div>+ <div id="universlide" style="height: 100%;"></div>+ <script type="module" src="/src/main.tsx"></script>+</body>++</html>\ No newline at end of filediff --git a/cli/src/templates/slides-plugin/jest.config.js b/cli/src/templates/slides-plugin/jest.config.jsnew file mode 100644index 0000000000..73ef4bae42--- /dev/null+++ b/cli/src/templates/slides-plugin/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.test.json',+ },+ },+};diff --git a/cli/src/templates/slides-plugin/package.json b/cli/src/templates/slides-plugin/package.jsonnew file mode 100644index 0000000000..72d1b13fa3--- /dev/null+++ b/cli/src/templates/slides-plugin/package.json@@ -0,0 +1,67 @@+{+ "name": "@univer/<%= projectName %>",+ "version": "0.0.1",+ "description": "UniverSheet normal <%= projectName %>",+ "keywords": [],+ "author": "DreamNum <[email protected]>",+ "license": "MIT",+ "main": "./lib/univer-<%= projectName %>.cjs.js",+ "module": "./lib/univer-<%= projectName %>.es.js",+ "browser": {+ "./lib/univer-<%= projectName %>.cjs.js": "./src/index.ts",+ "./lib/univer-<%= projectName %>.es.js": "./src/index.ts"+ },+ "types": "./src/Types/index.d.ts",+ "exports": {+ ".": {+ "import": {+ "node": "./lib/univer-<%= projectName %>.cjs.js",+ "default": "./lib/univer-<%= projectName %>.es.js"+ },+ "require": "./lib/univer-<%= projectName %>.cjs.js",+ "types": "./lib/univer-<%= projectName %>.d.ts"+ },+ "./*": "./src/*"+ },+ "directories": {+ "lib": "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",+ "eslint": "^8.22.0",+ "eslint-config-airbnb-typescript": "^17.0.0",+ "eslint-config-prettier": "^8.3.0",+ "eslint-plugin-import": "^2.23.4",+ "eslint-plugin-prettier": "^3.4.0",+ "eslint-plugin-jsx-a11y": "^6.5.1",+ "eslint-plugin-react": "^7.28.0",+ "eslint-plugin-react-hooks": "^4.3.0",+ "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": {+ "@univer/common-plugin-data": "workspace:^0.0.1",+ "@univer/base-component": "workspace:^0.0.1",+ "@univer/base-render": "workspace:^0.0.1",+ "@univer/core": "workspace:^0.0.1",+ "@univer/base-slides": "workspace:^0.0.1",+ "@univer/style-universheet": "workspace:^0.0.1",+ "preact": "^10.5.14"+ }+}diff --git a/cli/src/templates/slides-plugin/src/Basic/Const/PLUGIN_NAME.ts b/cli/src/templates/slides-plugin/src/Basic/Const/PLUGIN_NAME.tsnew file mode 100644index 0000000000..5964f8ac95--- /dev/null+++ b/cli/src/templates/slides-plugin/src/Basic/Const/PLUGIN_NAME.ts@@ -0,0 +1 @@+export const <%= projectConstantValue %>_PLUGIN_NAME = '<%= projectValue %>';diff --git a/cli/src/templates/slides-plugin/src/Basic/Const/index.ts b/cli/src/templates/slides-plugin/src/Basic/Const/index.tsnew file mode 100644index 0000000000..0dc96d927a--- /dev/null+++ b/cli/src/templates/slides-plugin/src/Basic/Const/index.ts@@ -0,0 +1 @@+export * from './PLUGIN_NAME';diff --git a/cli/src/templates/slides-plugin/src/Basic/Enum/index.ts b/cli/src/templates/slides-plugin/src/Basic/Enum/index.tsnew file mode 100644index 0000000000..e69de29bb2diff --git a/cli/src/templates/slides-plugin/src/Basic/Shared/index.ts b/cli/src/templates/slides-plugin/src/Basic/Shared/index.tsnew file mode 100644index 0000000000..e69de29bb2diff --git a/cli/src/templates/slides-plugin/src/Basic/index.ts b/cli/src/templates/slides-plugin/src/Basic/index.tsnew file mode 100644index 0000000000..640d1bb8b3--- /dev/null+++ b/cli/src/templates/slides-plugin/src/Basic/index.ts@@ -0,0 +1,4 @@+export * from './Const';+export * from './Enum';+export * from '../Locale';+export * from './Shared';diff --git a/cli/src/templates/slides-plugin/src/Controller/SortController.ts b/cli/src/templates/slides-plugin/src/Controller/SortController.tsnew file mode 100644index 0000000000..c54451403b--- /dev/null+++ b/cli/src/templates/slides-plugin/src/Controller/SortController.ts@@ -0,0 +1,16 @@+import { BaseComponentRender } from '@univer/base-component';+import { SlidePlugin } from '@univer/base-slides';+import { <%= projectConstantValue %>_PLUGIN_NAME } from '../Basic/Const';+import { <%= projectUpperValue %>Plugin } from '../<%= projectUpperValue %>Plugin';++export class <%= projectUpperValue %>Controller {+ protected _slidePlugin: SlidePlugin;++ protected _plugin: <%= projectUpperValue %>Plugin;++ protected _render: BaseComponentRender;++ constructor(plugin: <%= projectUpperValue %>Plugin) {+ this._plugin = plugin;+ }+}diff --git a/cli/src/templates/slides-plugin/src/Controller/index.ts b/cli/src/templates/slides-plugin/src/Controller/index.tsnew file mode 100644index 0000000000..e69de29bb2diff --git a/cli/src/templates/slides-plugin/src/Locale/en.ts b/cli/src/templates/slides-plugin/src/Locale/en.tsnew file mode 100644index 0000000000..e60e73303a--- /dev/null+++ b/cli/src/templates/slides-plugin/src/Locale/en.ts@@ -0,0 +1,8 @@+export default {+ <%= projectValue %>: {+ tooltip: '<%= projectUpperValue %>',+ one:'one',+ two:'two',+ three:'three',+ },+};diff --git a/cli/src/templates/slides-plugin/src/Locale/index.ts b/cli/src/templates/slides-plugin/src/Locale/index.tsnew file mode 100644index 0000000000..3ac4bcd0fd--- /dev/null+++ b/cli/src/templates/slides-plugin/src/Locale/index.ts@@ -0,0 +1,4 @@+import zh from './zh';+import en from './en';++export { zh, en };diff --git a/cli/src/templates/slides-plugin/src/Locale/zh.ts b/cli/src/templates/slides-plugin/src/Locale/zh.tsnew file mode 100644index 0000000000..3288d76f8e--- /dev/null+++ b/cli/src/templates/slides-plugin/src/Locale/zh.ts@@ -0,0 +1,8 @@+export default {+ <%= projectValue %>: {+ tooltip: '<%= projectUpperValue %>',+ one:'一',+ two:'二',+ three:'三',+ },+};diff --git a/cli/src/templates/slides-plugin/src/Model/index.ts b/cli/src/templates/slides-plugin/src/Model/index.tsnew file mode 100644index 0000000000..e69de29bb2diff --git a/cli/src/templates/slides-plugin/src/Service/index.ts b/cli/src/templates/slides-plugin/src/Service/index.tsnew file mode 100644index 0000000000..e69de29bb2diff --git a/cli/src/templates/slides-plugin/src/SortPlugin.tsx b/cli/src/templates/slides-plugin/src/SortPlugin.tsxnew file mode 100644index 0000000000..78eb9e99b3--- /dev/null+++ b/cli/src/templates/slides-plugin/src/SortPlugin.tsx@@ -0,0 +1,43 @@+import { Plugin, SlideContext, UniverSlide } from '@univer/core';+import { zh, en } from './Locale';+import { <%= projectConstantValue %>_PLUGIN_NAME} from './Basic/Const/PLUGIN_NAME'+import { <%= projectUpperValue %>Controller } from './Controller/<%= projectUpperValue %>Controller';++export interface I<%= projectUpperValue %>PluginConfig {}++export class <%= projectUpperValue %>Plugin extends Plugin<any, SlideContext> {+ private _<%= projectValue %>Controller: <%= projectUpperValue %>Controller;++ constructor(config ?: I<%= projectUpperValue %>PluginConfig) {+ super(<%= projectConstantValue %>_PLUGIN_NAME);+ }++ static create(config?: I<%= projectUpperValue %>PluginConfig) {+ return new <%= projectUpperValue %>Plugin(config);+ }++ installTo(universheetInstance: UniverSlide) {+ universheetInstance.installPlugin(this);+ }++ initialize(): void {++ const context = this.getContext();++ /**+ * load more Locale object+ */+ context.getLocale().load({+ en: en,+ zh: zh,+ });++ this._<%= projectValue %>Controller = new <%= projectUpperValue %>Controller(this);+ }++ onMounted(): void {+ this.initialize()+ }++ onDestroy(): void {}+}diff --git a/cli/src/templates/slides-plugin/src/Types/index.d.ts b/cli/src/templates/slides-plugin/src/Types/index.d.tsnew file mode 100644index 0000000000..9820ab8ea2--- /dev/null+++ b/cli/src/templates/slides-plugin/src/Types/index.d.ts@@ -0,0 +1,10 @@+/// <reference types="vite/client" />++export * from '../index';+declare module '@univer/<%= projectName %>' {}++// use css module+declare module '*.less' {+ const resource: { [key: string]: string };+ export = resource;+}diff --git a/cli/src/templates/slides-plugin/src/Types/preact.d.ts b/cli/src/templates/slides-plugin/src/Types/preact.d.tsnew file mode 100644index 0000000000..0d092b3751--- /dev/null+++ b/cli/src/templates/slides-plugin/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/cli/src/templates/slides-plugin/src/View/Render/index.ts b/cli/src/templates/slides-plugin/src/View/Render/index.tsnew file mode 100644index 0000000000..e69de29bb2diff --git a/cli/src/templates/slides-plugin/src/View/UI/index.ts b/cli/src/templates/slides-plugin/src/View/UI/index.tsnew file mode 100644index 0000000000..e69de29bb2diff --git a/cli/src/templates/slides-plugin/src/index.ts b/cli/src/templates/slides-plugin/src/index.tsnew file mode 100644index 0000000000..245449c0b4--- /dev/null+++ b/cli/src/templates/slides-plugin/src/index.ts@@ -0,0 +1,3 @@+import { <%= projectUpperValue %>Plugin } from './<%= projectUpperValue %>Plugin';++export { <%= projectUpperValue %>Plugin };diff --git a/cli/src/templates/slides-plugin/src/main.tsx b/cli/src/templates/slides-plugin/src/main.tsxnew file mode 100644index 0000000000..a2fbfd77c8--- /dev/null+++ b/cli/src/templates/slides-plugin/src/main.tsx@@ -0,0 +1,19 @@+import { UniverSlide } from '@univer/core';+import { RenderEngine } from '@univer/base-render';+import { SlidePlugin } from '@univer/base-slides';+import { UniverComponentSheet } from '@univer/style-universheet';+import { <%= projectUpperValue %>Plugin } from './<%= projectUpperValue %>Plugin';+++const uiDefaultConfigUp = {+ container: 'universlide',+ layout: 'auto',+};++const univerSlide = UniverSlide.newInstance();++univerSlide.installPlugin(new RenderEngine());+univerSlide.installPlugin(new UniverComponentSheet());++univerSlide.installPlugin(new SlidePlugin(uiDefaultConfigUp));+univerSlide.installPlugin(new <%= projectUpperValue %>Plugin());diff --git a/cli/src/templates/slides-plugin/tsconfig.json b/cli/src/templates/slides-plugin/tsconfig.jsonnew file mode 100644index 0000000000..fc81cbd47e--- /dev/null+++ b/cli/src/templates/slides-plugin/tsconfig.json@@ -0,0 +1,31 @@+{+ "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": "preserve",+ "jsxFactory": "h",+ "jsxFragmentFactory": "Fragment",+ "strictPropertyInitialization": false,+ "types": ["jest", "node", "@types/jest"]+ },+ "include": ["src/**/*", "test/**/*.test.(ts|tsx|js)"]+}diff --git a/cli/src/templates/slides-plugin/tsconfig.ref.json b/cli/src/templates/slides-plugin/tsconfig.ref.jsonnew file mode 100644index 0000000000..0c86b2c554--- /dev/null+++ b/cli/src/templates/slides-plugin/tsconfig.ref.json@@ -0,0 +1,7 @@+{+ "extends": "./tsconfig.json",+ "include": ["src/**/*"],+ "compilerOptions": {+ "composite": true+ }+}diff --git a/cli/src/templates/slides-plugin/tsconfig.test.json b/cli/src/templates/slides-plugin/tsconfig.test.jsonnew file mode 100644index 0000000000..a2ac02c4ae--- /dev/null+++ b/cli/src/templates/slides-plugin/tsconfig.test.json@@ -0,0 +1,7 @@+{+ "extends": "./tsconfig.json",+ "compilerOptions": {+ "jsx": "react-jsx",+ "jsxImportSource": "preact"+ }+}diff --git a/cli/src/templates/slides-plugin/vite.config.ts b/cli/src/templates/slides-plugin/vite.config.tsnew file mode 100644index 0000000000..020ecd6209--- /dev/null+++ b/cli/src/templates/slides-plugin/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'],+ // 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'],+ }),+ ],+});